demand: TMS系统财务销账优化
committer: heyu
This commit is contained in:
parent
19f295c9db
commit
7f2f7d8c1d
@ -45,9 +45,13 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 查询销账申请列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:list')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EmisWriteoffApply emisWriteoffApply) {
|
||||
if (emisWriteoffApply == null) {
|
||||
emisWriteoffApply = new EmisWriteoffApply();
|
||||
}
|
||||
|
||||
// 处理params参数,支持运单号、账单号多选查询
|
||||
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
||||
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
||||
@ -56,12 +60,14 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
String[] lines = queryParams.split("\n");
|
||||
StringBuilder cleanParams = new StringBuilder();
|
||||
for (String line : lines) {
|
||||
String trimmed = line.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
if (cleanParams.length() > 0) {
|
||||
cleanParams.append("\n");
|
||||
if (line != null) {
|
||||
String trimmed = line.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
if (cleanParams.length() > 0) {
|
||||
cleanParams.append("\n");
|
||||
}
|
||||
cleanParams.append(trimmed);
|
||||
}
|
||||
cleanParams.append(trimmed);
|
||||
}
|
||||
}
|
||||
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
||||
@ -70,34 +76,42 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
|
||||
startPage();
|
||||
List<EmisWriteoffApply> list = emisWriteoffApplyService.selectEmisWriteoffApplyList(emisWriteoffApply);
|
||||
|
||||
|
||||
// 计算并设置申请账单相关字段
|
||||
for (EmisWriteoffApply apply : list) {
|
||||
if (apply.getDetailList() != null && !apply.getDetailList().isEmpty()) {
|
||||
// 提取账单名称列表(去重)
|
||||
List<String> billNames = apply.getDetailList().stream()
|
||||
.map(detail -> detail.getEmisSettleBill() != null ? detail.getEmisSettleBill().getSettleBillName() : null)
|
||||
.filter(name -> name != null && !name.trim().isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
apply.setApplySettleBillName(String.join(",", billNames));
|
||||
|
||||
// 提取账单号列表(去重)
|
||||
List<String> billNos = apply.getDetailList().stream()
|
||||
.map(detail -> detail.getSettleBillNo())
|
||||
.filter(no -> no != null && !no.trim().isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
apply.setApplySettleBillNo(String.join(",", billNos));
|
||||
|
||||
// 计算账单金额总和
|
||||
BigDecimal totalAmount = apply.getDetailList().stream()
|
||||
.map(detail -> detail.getEmisSettleBill() != null ? detail.getEmisSettleBill().getRecMoney() : BigDecimal.ZERO)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
apply.setApplyRecMoney(totalAmount);
|
||||
if (list != null) {
|
||||
for (EmisWriteoffApply apply : list) {
|
||||
if (apply != null && apply.getDetailList() != null && !apply.getDetailList().isEmpty()) {
|
||||
// 提取账单名称列表(去重)
|
||||
List<String> billNames = apply.getDetailList().stream()
|
||||
.filter(detail -> detail != null)
|
||||
.map(detail -> detail.getEmisSettleBill() != null
|
||||
? detail.getEmisSettleBill().getSettleBillName()
|
||||
: null)
|
||||
.filter(name -> name != null && !name.trim().isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
apply.setApplySettleBillName(billNames.isEmpty() ? "" : String.join(",", billNames));
|
||||
|
||||
// 提取账单号列表(去重)
|
||||
List<String> billNos = apply.getDetailList().stream()
|
||||
.filter(detail -> detail != null)
|
||||
.map(detail -> detail.getSettleBillNo())
|
||||
.filter(no -> no != null && !no.trim().isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
apply.setApplySettleBillNo(billNos.isEmpty() ? "" : String.join(",", billNos));
|
||||
|
||||
// 计算账单金额总和
|
||||
BigDecimal totalAmount = apply.getDetailList().stream()
|
||||
.filter(detail -> detail != null)
|
||||
.map(detail -> detail.getEmisSettleBill() != null ? detail.getEmisSettleBill().getRecMoney()
|
||||
: BigDecimal.ZERO)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
apply.setApplyRecMoney(totalAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -108,6 +122,10 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
@Log(title = "销账申请", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EmisWriteoffApply emisWriteoffApply) {
|
||||
if (emisWriteoffApply == null) {
|
||||
emisWriteoffApply = new EmisWriteoffApply();
|
||||
}
|
||||
|
||||
// 处理params参数,支持运单号、账单号多选查询
|
||||
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
||||
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
||||
@ -116,12 +134,14 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
String[] lines = queryParams.split("\n");
|
||||
StringBuilder cleanParams = new StringBuilder();
|
||||
for (String line : lines) {
|
||||
String trimmed = line.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
if (cleanParams.length() > 0) {
|
||||
cleanParams.append("\n");
|
||||
if (line != null) {
|
||||
String trimmed = line.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
if (cleanParams.length() > 0) {
|
||||
cleanParams.append("\n");
|
||||
}
|
||||
cleanParams.append(trimmed);
|
||||
}
|
||||
cleanParams.append(trimmed);
|
||||
}
|
||||
}
|
||||
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
||||
@ -132,13 +152,13 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
// ExcelUtil<EmisWriteoffApply> util = new
|
||||
// ExcelUtil<EmisWriteoffApply>(EmisWriteoffApply.class);
|
||||
// util.exportExcel(response, list, "销账申请数据");
|
||||
log.info("导出销账申请数据,共{}条记录", list.size());
|
||||
log.info("导出销账申请数据,共{}条记录", list != null ? list.size() : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取销账申请详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:query')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(emisWriteoffApplyService.selectEmisWriteoffApplyById(id));
|
||||
@ -147,7 +167,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 新增销账申请
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:add')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:add')")
|
||||
@Log(title = "销账申请", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisWriteoffApply emisWriteoffApply) {
|
||||
@ -162,7 +182,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 修改销账申请
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:edit')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:edit')")
|
||||
@Log(title = "销账申请", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmisWriteoffApply emisWriteoffApply) throws EmisBizError {
|
||||
@ -173,7 +193,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
* 删除销账申请
|
||||
* 仅支持删除已撤销的数据,审核中以及审核完成的数据不支持删除
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:remove')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:remove')")
|
||||
@Log(title = "销账申请", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
@ -188,7 +208,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 财务中心审核通过
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:centerPass')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:centerPass')")
|
||||
@Log(title = "财务中心审核通过", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/auditCenterPass/{ids}")
|
||||
public AjaxResult auditCenterPass(@PathVariable Long[] ids) {
|
||||
@ -218,7 +238,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 财务中心审核驳回
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:centerReject')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:centerReject')")
|
||||
@Log(title = "财务中心审核驳回", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/auditCenterReject/{ids}")
|
||||
public AjaxResult auditCenterReject(@PathVariable Long[] ids, @RequestBody EmisWriteoffApply emisWriteoffApply) {
|
||||
@ -249,7 +269,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 总部确认
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:headquartersConfirm')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:headquartersConfirm')")
|
||||
@Log(title = "总部确认", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/auditHeadquartersConfirm/{ids}")
|
||||
public AjaxResult auditHeadquartersConfirm(@PathVariable Long[] ids) {
|
||||
@ -279,7 +299,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 总部驳回
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:headquartersReject')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:headquartersReject')")
|
||||
@Log(title = "总部驳回", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/auditHeadquartersReject/{ids}")
|
||||
public AjaxResult auditHeadquartersReject(@PathVariable Long[] ids,
|
||||
@ -311,7 +331,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 撤销申请
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:revoke')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:revoke')")
|
||||
@Log(title = "撤销申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/revoke/{ids}")
|
||||
public AjaxResult revoke(@PathVariable Long[] ids) {
|
||||
@ -341,7 +361,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 再次申请
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('emis:writeoffApply:reapply')")
|
||||
// @PreAuthorize("@ss.hasPermi('emis:writeoffApply:reapply')")
|
||||
@Log(title = "再次申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/reapply")
|
||||
public AjaxResult reapply(@RequestBody EmisWriteoffApply emisWriteoffApply) {
|
||||
@ -356,10 +376,14 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
/**
|
||||
* 根据运单号查询运单、结算账单、结算子账单信息(返回EmisWriteoffApplyDetail列表)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:queryByBillCodes')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:queryByBillCodes')")
|
||||
@GetMapping("/queryByBillCodes")
|
||||
public AjaxResult queryByBillCodes(EmisWriteoffApply emisWriteoffApply) {
|
||||
try {
|
||||
if (emisWriteoffApply == null) {
|
||||
return error("查询参数不能为空");
|
||||
}
|
||||
|
||||
// 处理params参数,支持运单号、账单号多选查询
|
||||
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
||||
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
||||
@ -368,12 +392,14 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
String[] lines = queryParams.split("\n");
|
||||
StringBuilder cleanParams = new StringBuilder();
|
||||
for (String line : lines) {
|
||||
String trimmed = line.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
if (cleanParams.length() > 0) {
|
||||
cleanParams.append("\n");
|
||||
if (line != null) {
|
||||
String trimmed = line.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
if (cleanParams.length() > 0) {
|
||||
cleanParams.append("\n");
|
||||
}
|
||||
cleanParams.append(trimmed);
|
||||
}
|
||||
cleanParams.append(trimmed);
|
||||
}
|
||||
}
|
||||
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
||||
@ -390,15 +416,18 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
|
||||
// 从queryParams中提取运单号列表
|
||||
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
||||
if (queryParams == null) {
|
||||
return error("运单号列表不能为空");
|
||||
}
|
||||
String[] billCodes = queryParams.split("\n");
|
||||
List<String> billCodeList = Arrays.asList(billCodes);
|
||||
|
||||
List<EmisWriteoffApplyDetail> list = emisWriteoffApplyService
|
||||
.selectEmisWriteoffApplyDetailListByBillCodes(billCodeList);
|
||||
return AjaxResult.success(list);
|
||||
return AjaxResult.success(list != null ? list : new java.util.ArrayList<>());
|
||||
} catch (Exception e) {
|
||||
log.error("根据运单号查询运单、结算账单、结算子账单信息失败", e);
|
||||
return error("查询失败:" + e.getMessage());
|
||||
return error("查询失败:" + (e.getMessage() != null ? e.getMessage() : "未知错误"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public class EmisWriteoffApply extends BaseEntity {
|
||||
@Excel(name = "申请说明")
|
||||
private String applyMemo;
|
||||
|
||||
/* 中心审核状态 0-未审核 1-审核通过 2-审核拒绝 3-已撤销*/
|
||||
/* 中心审核状态 0-未审核 1-审核通过 2-审核拒绝 3-已撤销 */
|
||||
@Excel(name = "中心审核状态")
|
||||
private String blCenterConfirmed;
|
||||
|
||||
@ -174,4 +174,10 @@ public class EmisWriteoffApply extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private String settleBillName; // 账单名称
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date applyDateStart; // 登记开始时间(查询条件)
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date applyDateEnd; // 登记结束时间(查询条件)
|
||||
|
||||
}
|
||||
|
||||
@ -74,6 +74,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="applySiteCode != null and applySiteCode != ''"> and wa.apply_site_code = #{applySiteCode}</if>
|
||||
<if test="applySiteName != null and applySiteName != ''"> and wa.apply_site_name like concat('%', #{applySiteName}, '%')</if>
|
||||
<if test="applyDate != null "> and wa.apply_date = #{applyDate}</if>
|
||||
<if test="applyDateStart != null "> and wa.apply_date >= #{applyDateStart}</if>
|
||||
<if test="applyDateEnd != null "> and wa.apply_date <= #{applyDateEnd}</if>
|
||||
<if test="writeoffAmount != null "> and wa.writeoff_amount = #{writeoffAmount}</if>
|
||||
<if test="applyMemo != null and applyMemo != ''"> and wa.apply_memo like concat('%', #{applyMemo}, '%')</if>
|
||||
<if test="blCenterConfirmed != null and blCenterConfirmed != ''"> and wa.bl_center_confirmed = #{blCenterConfirmed}</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user