demand: TMS系统财务销账优化
committer: heyu
This commit is contained in:
parent
19f295c9db
commit
7f2f7d8c1d
@ -48,6 +48,10 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:list')")
|
@PreAuthorize("@ss.hasPermi('emis:writeoffApply:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(EmisWriteoffApply emisWriteoffApply) {
|
public TableDataInfo list(EmisWriteoffApply emisWriteoffApply) {
|
||||||
|
if (emisWriteoffApply == null) {
|
||||||
|
emisWriteoffApply = new EmisWriteoffApply();
|
||||||
|
}
|
||||||
|
|
||||||
// 处理params参数,支持运单号、账单号多选查询
|
// 处理params参数,支持运单号、账单号多选查询
|
||||||
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
||||||
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
||||||
@ -56,6 +60,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
String[] lines = queryParams.split("\n");
|
String[] lines = queryParams.split("\n");
|
||||||
StringBuilder cleanParams = new StringBuilder();
|
StringBuilder cleanParams = new StringBuilder();
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
|
if (line != null) {
|
||||||
String trimmed = line.trim();
|
String trimmed = line.trim();
|
||||||
if (!trimmed.isEmpty()) {
|
if (!trimmed.isEmpty()) {
|
||||||
if (cleanParams.length() > 0) {
|
if (cleanParams.length() > 0) {
|
||||||
@ -64,6 +69,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
cleanParams.append(trimmed);
|
cleanParams.append(trimmed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,31 +78,39 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
List<EmisWriteoffApply> list = emisWriteoffApplyService.selectEmisWriteoffApplyList(emisWriteoffApply);
|
List<EmisWriteoffApply> list = emisWriteoffApplyService.selectEmisWriteoffApplyList(emisWriteoffApply);
|
||||||
|
|
||||||
// 计算并设置申请账单相关字段
|
// 计算并设置申请账单相关字段
|
||||||
|
if (list != null) {
|
||||||
for (EmisWriteoffApply apply : list) {
|
for (EmisWriteoffApply apply : list) {
|
||||||
if (apply.getDetailList() != null && !apply.getDetailList().isEmpty()) {
|
if (apply != null && apply.getDetailList() != null && !apply.getDetailList().isEmpty()) {
|
||||||
// 提取账单名称列表(去重)
|
// 提取账单名称列表(去重)
|
||||||
List<String> billNames = apply.getDetailList().stream()
|
List<String> billNames = apply.getDetailList().stream()
|
||||||
.map(detail -> detail.getEmisSettleBill() != null ? detail.getEmisSettleBill().getSettleBillName() : null)
|
.filter(detail -> detail != null)
|
||||||
|
.map(detail -> detail.getEmisSettleBill() != null
|
||||||
|
? detail.getEmisSettleBill().getSettleBillName()
|
||||||
|
: null)
|
||||||
.filter(name -> name != null && !name.trim().isEmpty())
|
.filter(name -> name != null && !name.trim().isEmpty())
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
apply.setApplySettleBillName(String.join(",", billNames));
|
apply.setApplySettleBillName(billNames.isEmpty() ? "" : String.join(",", billNames));
|
||||||
|
|
||||||
// 提取账单号列表(去重)
|
// 提取账单号列表(去重)
|
||||||
List<String> billNos = apply.getDetailList().stream()
|
List<String> billNos = apply.getDetailList().stream()
|
||||||
|
.filter(detail -> detail != null)
|
||||||
.map(detail -> detail.getSettleBillNo())
|
.map(detail -> detail.getSettleBillNo())
|
||||||
.filter(no -> no != null && !no.trim().isEmpty())
|
.filter(no -> no != null && !no.trim().isEmpty())
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
apply.setApplySettleBillNo(String.join(",", billNos));
|
apply.setApplySettleBillNo(billNos.isEmpty() ? "" : String.join(",", billNos));
|
||||||
|
|
||||||
// 计算账单金额总和
|
// 计算账单金额总和
|
||||||
BigDecimal totalAmount = apply.getDetailList().stream()
|
BigDecimal totalAmount = apply.getDetailList().stream()
|
||||||
.map(detail -> detail.getEmisSettleBill() != null ? detail.getEmisSettleBill().getRecMoney() : BigDecimal.ZERO)
|
.filter(detail -> detail != null)
|
||||||
|
.map(detail -> detail.getEmisSettleBill() != null ? detail.getEmisSettleBill().getRecMoney()
|
||||||
|
: BigDecimal.ZERO)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
apply.setApplyRecMoney(totalAmount);
|
apply.setApplyRecMoney(totalAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
@ -108,6 +122,10 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
@Log(title = "销账申请", businessType = BusinessType.EXPORT)
|
@Log(title = "销账申请", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(EmisWriteoffApply emisWriteoffApply) {
|
public void export(EmisWriteoffApply emisWriteoffApply) {
|
||||||
|
if (emisWriteoffApply == null) {
|
||||||
|
emisWriteoffApply = new EmisWriteoffApply();
|
||||||
|
}
|
||||||
|
|
||||||
// 处理params参数,支持运单号、账单号多选查询
|
// 处理params参数,支持运单号、账单号多选查询
|
||||||
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
||||||
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
||||||
@ -116,6 +134,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
String[] lines = queryParams.split("\n");
|
String[] lines = queryParams.split("\n");
|
||||||
StringBuilder cleanParams = new StringBuilder();
|
StringBuilder cleanParams = new StringBuilder();
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
|
if (line != null) {
|
||||||
String trimmed = line.trim();
|
String trimmed = line.trim();
|
||||||
if (!trimmed.isEmpty()) {
|
if (!trimmed.isEmpty()) {
|
||||||
if (cleanParams.length() > 0) {
|
if (cleanParams.length() > 0) {
|
||||||
@ -124,6 +143,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
cleanParams.append(trimmed);
|
cleanParams.append(trimmed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +152,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
// ExcelUtil<EmisWriteoffApply> util = new
|
// ExcelUtil<EmisWriteoffApply> util = new
|
||||||
// ExcelUtil<EmisWriteoffApply>(EmisWriteoffApply.class);
|
// ExcelUtil<EmisWriteoffApply>(EmisWriteoffApply.class);
|
||||||
// util.exportExcel(response, list, "销账申请数据");
|
// util.exportExcel(response, list, "销账申请数据");
|
||||||
log.info("导出销账申请数据,共{}条记录", list.size());
|
log.info("导出销账申请数据,共{}条记录", list != null ? list.size() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -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)
|
@Log(title = "再次申请", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/reapply")
|
@PostMapping("/reapply")
|
||||||
public AjaxResult reapply(@RequestBody EmisWriteoffApply emisWriteoffApply) {
|
public AjaxResult reapply(@RequestBody EmisWriteoffApply emisWriteoffApply) {
|
||||||
@ -360,6 +380,10 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
@GetMapping("/queryByBillCodes")
|
@GetMapping("/queryByBillCodes")
|
||||||
public AjaxResult queryByBillCodes(EmisWriteoffApply emisWriteoffApply) {
|
public AjaxResult queryByBillCodes(EmisWriteoffApply emisWriteoffApply) {
|
||||||
try {
|
try {
|
||||||
|
if (emisWriteoffApply == null) {
|
||||||
|
return error("查询参数不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
// 处理params参数,支持运单号、账单号多选查询
|
// 处理params参数,支持运单号、账单号多选查询
|
||||||
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
if (emisWriteoffApply.getParams() != null && emisWriteoffApply.getParams().containsKey("queryParams")) {
|
||||||
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
||||||
@ -368,6 +392,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
String[] lines = queryParams.split("\n");
|
String[] lines = queryParams.split("\n");
|
||||||
StringBuilder cleanParams = new StringBuilder();
|
StringBuilder cleanParams = new StringBuilder();
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
|
if (line != null) {
|
||||||
String trimmed = line.trim();
|
String trimmed = line.trim();
|
||||||
if (!trimmed.isEmpty()) {
|
if (!trimmed.isEmpty()) {
|
||||||
if (cleanParams.length() > 0) {
|
if (cleanParams.length() > 0) {
|
||||||
@ -376,6 +401,7 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
cleanParams.append(trimmed);
|
cleanParams.append(trimmed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
emisWriteoffApply.getParams().put("queryParams", cleanParams.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,15 +416,18 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
|||||||
|
|
||||||
// 从queryParams中提取运单号列表
|
// 从queryParams中提取运单号列表
|
||||||
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
String queryParams = (String) emisWriteoffApply.getParams().get("queryParams");
|
||||||
|
if (queryParams == null) {
|
||||||
|
return error("运单号列表不能为空");
|
||||||
|
}
|
||||||
String[] billCodes = queryParams.split("\n");
|
String[] billCodes = queryParams.split("\n");
|
||||||
List<String> billCodeList = Arrays.asList(billCodes);
|
List<String> billCodeList = Arrays.asList(billCodes);
|
||||||
|
|
||||||
List<EmisWriteoffApplyDetail> list = emisWriteoffApplyService
|
List<EmisWriteoffApplyDetail> list = emisWriteoffApplyService
|
||||||
.selectEmisWriteoffApplyDetailListByBillCodes(billCodeList);
|
.selectEmisWriteoffApplyDetailListByBillCodes(billCodeList);
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list != null ? list : new java.util.ArrayList<>());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("根据运单号查询运单、结算账单、结算子账单信息失败", 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 = "申请说明")
|
@Excel(name = "申请说明")
|
||||||
private String applyMemo;
|
private String applyMemo;
|
||||||
|
|
||||||
/* 中心审核状态 0-未审核 1-审核通过 2-审核拒绝 3-已撤销*/
|
/* 中心审核状态 0-未审核 1-审核通过 2-审核拒绝 3-已撤销 */
|
||||||
@Excel(name = "中心审核状态")
|
@Excel(name = "中心审核状态")
|
||||||
private String blCenterConfirmed;
|
private String blCenterConfirmed;
|
||||||
|
|
||||||
@ -174,4 +174,10 @@ public class EmisWriteoffApply extends BaseEntity {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String settleBillName; // 账单名称
|
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="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="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="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="writeoffAmount != null "> and wa.writeoff_amount = #{writeoffAmount}</if>
|
||||||
<if test="applyMemo != null and applyMemo != ''"> and wa.apply_memo like concat('%', #{applyMemo}, '%')</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>
|
<if test="blCenterConfirmed != null and blCenterConfirmed != ''"> and wa.bl_center_confirmed = #{blCenterConfirmed}</if>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user