Commit 3c0d642de1a4dbd058ecfa800de10f09270502ce

Authored by yeqianyong
1 parent ec4628ba

楚江erp:1、台账明细搜索调整;2、台账数据拆分bug修复

1 package com.lframework.xingyun.sc.bo.ledger.receipt; 1 package com.lframework.xingyun.sc.bo.ledger.receipt;
2 2
3 import com.fasterxml.jackson.annotation.JsonFormat; 3 import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.starter.web.core.utils.ApplicationUtil;
  5 +import com.lframework.starter.web.inner.entity.SysDataDicItem;
  6 +import com.lframework.starter.web.inner.service.system.SysDataDicItemService;
4 import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo; 7 import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo;
5 import java.math.BigDecimal; 8 import java.math.BigDecimal;
6 import com.lframework.starter.common.constants.StringPool; 9 import com.lframework.starter.common.constants.StringPool;
@@ -10,6 +13,7 @@ import java.time.LocalDateTime; @@ -10,6 +13,7 @@ import java.time.LocalDateTime;
10 import io.swagger.annotations.ApiModelProperty; 13 import io.swagger.annotations.ApiModelProperty;
11 14
12 import lombok.Data; 15 import lombok.Data;
  16 +import org.apache.commons.lang3.StringUtils;
13 17
14 /** 18 /**
15 * <p> 19 * <p>
@@ -36,6 +40,18 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { @@ -36,6 +40,18 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> {
36 private String customerShortId; 40 private String customerShortId;
37 41
38 /** 42 /**
  43 + * 客户简称
  44 + */
  45 + @ApiModelProperty("客户简称")
  46 + private String customerShortName;
  47 +
  48 + /**
  49 + * 客户类型
  50 + */
  51 + @ApiModelProperty("客户类型")
  52 + private String customerType;
  53 +
  54 + /**
39 * 额度 55 * 额度
40 */ 56 */
41 @ApiModelProperty("额度") 57 @ApiModelProperty("额度")
@@ -54,24 +70,48 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { @@ -54,24 +70,48 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> {
54 private String deptId; 70 private String deptId;
55 71
56 /** 72 /**
  73 + * 办事处名称
  74 + */
  75 + @ApiModelProperty("办事处名称")
  76 + private String deptName;
  77 +
  78 + /**
57 * 区域ID 79 * 区域ID
58 */ 80 */
59 @ApiModelProperty("区域ID") 81 @ApiModelProperty("区域ID")
60 private String region; 82 private String region;
61 83
62 /** 84 /**
  85 + * 区域名称
  86 + */
  87 + @ApiModelProperty("区域名称")
  88 + private String regionName;
  89 +
  90 + /**
63 * 备货单位ID 91 * 备货单位ID
64 */ 92 */
65 @ApiModelProperty("备货单位ID") 93 @ApiModelProperty("备货单位ID")
66 private String stockUpCompanyId; 94 private String stockUpCompanyId;
67 95
68 /** 96 /**
  97 + * 备货单位名称
  98 + */
  99 + @ApiModelProperty("备货单位名称")
  100 + private String stockUpCompanyName;
  101 +
  102 + /**
69 * 客户ID 103 * 客户ID
70 */ 104 */
71 @ApiModelProperty("客户ID") 105 @ApiModelProperty("客户ID")
72 private String customerId; 106 private String customerId;
73 107
74 /** 108 /**
  109 + * 客户名称
  110 + */
  111 + @ApiModelProperty("客户名称")
  112 + private String customerName;
  113 +
  114 + /**
75 * 厂别 115 * 厂别
76 */ 116 */
77 @ApiModelProperty("厂别") 117 @ApiModelProperty("厂别")
@@ -236,6 +276,13 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { @@ -236,6 +276,13 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> {
236 276
237 @Override 277 @Override
238 protected void afterInit(ReceiptLedgerInfo dto) { 278 protected void afterInit(ReceiptLedgerInfo dto) {
239 - 279 + if (StringUtils.isNotBlank(dto.getCustomerType())) {
  280 + // 获取客户类型(数据字典)
  281 + SysDataDicItemService sysDataDicItemService = ApplicationUtil.getBean(SysDataDicItemService.class);
  282 + SysDataDicItem dicItem = sysDataDicItemService.findByCode("ENTERPRISE_TYPE", dto.getCustomerType());
  283 + if (dicItem != null) {
  284 + this.customerType = dicItem.getName();
  285 + }
  286 + }
240 } 287 }
241 } 288 }
@@ -50,9 +50,11 @@ public class ReceiptLedgerInfoController extends DefaultBaseController { @@ -50,9 +50,11 @@ public class ReceiptLedgerInfoController extends DefaultBaseController {
50 @HasPermission({"account-manage:ledger-detail:query"}) 50 @HasPermission({"account-manage:ledger-detail:query"})
51 @GetMapping("/query") 51 @GetMapping("/query")
52 public InvokeResult<PageResult<QueryReceiptLedgerInfoBo>> query(@Valid QueryReceiptLedgerInfoVo vo) { 52 public InvokeResult<PageResult<QueryReceiptLedgerInfoBo>> query(@Valid QueryReceiptLedgerInfoVo vo) {
53 - if (vo.getTabNum() != null) {  
54 - String dateTime = CommonUtil.convertToMonthDate(vo.getTabNum());  
55 - vo.setCreateTime(dateTime); 53 + if (vo.getTabNum() != null && vo.getCreateYear() != null) {
  54 + String startTime = CommonUtil.convertToMonthDate(vo.getCreateYear(), vo.getTabNum(), 1, 0, 0, 0);
  55 + String endTime = CommonUtil.convertToMonthDate(vo.getCreateYear(), vo.getTabNum(), 0, 23, 59, 59);
  56 + vo.setCreateTimeStart(startTime);
  57 + vo.setCreateTimeEnd(endTime);
56 } 58 }
57 PageResult<ReceiptLedgerInfo> pageResult = receiptLedgerInfoService.query(getPageIndex(vo), getPageSize(vo), vo); 59 PageResult<ReceiptLedgerInfo> pageResult = receiptLedgerInfoService.query(getPageIndex(vo), getPageSize(vo), vo);
58 List<ReceiptLedgerInfo> dataList = pageResult.getDatas(); 60 List<ReceiptLedgerInfo> dataList = pageResult.getDatas();
@@ -7,6 +7,8 @@ import com.lframework.starter.common.exceptions.impl.DefaultClientException; @@ -7,6 +7,8 @@ import com.lframework.starter.common.exceptions.impl.DefaultClientException;
7 import com.lframework.starter.common.utils.ObjectUtil; 7 import com.lframework.starter.common.utils.ObjectUtil;
8 import com.lframework.starter.common.utils.StringUtil; 8 import com.lframework.starter.common.utils.StringUtil;
9 import com.lframework.starter.web.core.components.security.SecurityUtil; 9 import com.lframework.starter.web.core.components.security.SecurityUtil;
  10 +import com.lframework.starter.web.inner.entity.SysDataDicItem;
  11 +import com.lframework.starter.web.inner.service.system.SysDataDicItemService;
10 import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo; 12 import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo;
11 import com.lframework.starter.web.core.impl.BaseMpServiceImpl; 13 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
12 import com.lframework.starter.web.core.utils.PageResultUtil; 14 import com.lframework.starter.web.core.utils.PageResultUtil;
@@ -20,6 +22,7 @@ import com.lframework.starter.common.utils.Assert; @@ -20,6 +22,7 @@ import com.lframework.starter.common.utils.Assert;
20 import com.lframework.xingyun.sc.utils.CommonUtil; 22 import com.lframework.xingyun.sc.utils.CommonUtil;
21 import com.lframework.xingyun.sc.vo.ledger.receipt.ReceiptLedgerInfoSplitVo; 23 import com.lframework.xingyun.sc.vo.ledger.receipt.ReceiptLedgerInfoSplitVo;
22 import com.lframework.xingyun.sc.vo.ledger.receipt.UpdateReceiptLedgerInfoVo; 24 import com.lframework.xingyun.sc.vo.ledger.receipt.UpdateReceiptLedgerInfoVo;
  25 +import org.apache.commons.collections4.CollectionUtils;
23 import org.springframework.transaction.annotation.Transactional; 26 import org.springframework.transaction.annotation.Transactional;
24 import com.lframework.xingyun.sc.mappers.ReceiptLedgerInfoMapper; 27 import com.lframework.xingyun.sc.mappers.ReceiptLedgerInfoMapper;
25 import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService; 28 import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService;
@@ -27,13 +30,23 @@ import com.lframework.xingyun.sc.vo.ledger.receipt.CreateReceiptLedgerInfoVo; @@ -27,13 +30,23 @@ import com.lframework.xingyun.sc.vo.ledger.receipt.CreateReceiptLedgerInfoVo;
27 import com.lframework.xingyun.sc.vo.ledger.receipt.QueryReceiptLedgerInfoVo; 30 import com.lframework.xingyun.sc.vo.ledger.receipt.QueryReceiptLedgerInfoVo;
28 import org.springframework.stereotype.Service; 31 import org.springframework.stereotype.Service;
29 32
  33 +import javax.annotation.Resource;
30 import java.math.BigDecimal; 34 import java.math.BigDecimal;
31 import java.util.ArrayList; 35 import java.util.ArrayList;
  36 +import java.util.Collections;
32 import java.util.List; 37 import java.util.List;
  38 +import java.util.Map;
  39 +import java.util.stream.Collectors;
33 40
34 @Service 41 @Service
35 public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedgerInfoMapper, ReceiptLedgerInfo> implements ReceiptLedgerInfoService { 42 public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedgerInfoMapper, ReceiptLedgerInfo> implements ReceiptLedgerInfoService {
36 43
  44 +
  45 + @Resource
  46 + private SysDataDicItemService sysDataDicItemService;
  47 +
  48 +
  49 +
37 @Override 50 @Override
38 public PageResult<ReceiptLedgerInfo> query(Integer pageIndex, Integer pageSize, QueryReceiptLedgerInfoVo vo) { 51 public PageResult<ReceiptLedgerInfo> query(Integer pageIndex, Integer pageSize, QueryReceiptLedgerInfoVo vo) {
39 Assert.greaterThanZero(pageIndex); 52 Assert.greaterThanZero(pageIndex);
@@ -47,8 +60,21 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge @@ -47,8 +60,21 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
47 60
48 @Override 61 @Override
49 public List<ReceiptLedgerInfo> query(QueryReceiptLedgerInfoVo vo) { 62 public List<ReceiptLedgerInfo> query(QueryReceiptLedgerInfoVo vo) {
50 -  
51 - return getBaseMapper().query(vo); 63 + List<ReceiptLedgerInfo> infoList = getBaseMapper().query(vo);
  64 + if (CollectionUtils.isEmpty(infoList)) {
  65 + return Collections.emptyList();
  66 + }
  67 + // 获取客户类型(数据字典)
  68 + List<SysDataDicItem> enterpriseTypeList = sysDataDicItemService.findByDicCode("ENTERPRISE_TYPE");
  69 + Map<String, String> enterpriseTypeMap = enterpriseTypeList.stream()
  70 + .collect(Collectors.toMap(SysDataDicItem::getCode, SysDataDicItem::getName, (v1, v2) -> v1));
  71 + for (ReceiptLedgerInfo info : infoList) {
  72 + String customerType = info.getCustomerType();
  73 + String enterpriseType = enterpriseTypeMap.get(customerType);
  74 +
  75 + info.setCustomerType(enterpriseType);
  76 + }
  77 + return infoList;
52 } 78 }
53 79
54 @Override 80 @Override
@@ -125,12 +151,10 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge @@ -125,12 +151,10 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
125 throw new DefaultClientException("应收款台账明细不存在!"); 151 throw new DefaultClientException("应收款台账明细不存在!");
126 } 152 }
127 LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class) 153 LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class)
128 - .set(ReceiptLedgerInfo::getDelFlag, 1) 154 + .set(ReceiptLedgerInfo::getDelFlag, true)
129 .eq(ReceiptLedgerInfo::getId, id); 155 .eq(ReceiptLedgerInfo::getId, id);
130 156
131 getBaseMapper().update(updateWrapper); 157 getBaseMapper().update(updateWrapper);
132 - OpLogUtil.setVariable("id", data.getId());  
133 - OpLogUtil.setExtra(id);  
134 } 158 }
135 159
136 /** 160 /**
@@ -7,8 +7,10 @@ import org.apache.commons.collections4.CollectionUtils; @@ -7,8 +7,10 @@ import org.apache.commons.collections4.CollectionUtils;
7 import java.io.*; 7 import java.io.*;
8 import java.math.BigDecimal; 8 import java.math.BigDecimal;
9 import java.math.RoundingMode; 9 import java.math.RoundingMode;
  10 +import java.time.LocalDate;
10 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
11 import java.time.Year; 12 import java.time.Year;
  13 +import java.time.YearMonth;
12 import java.time.format.DateTimeFormatter; 14 import java.time.format.DateTimeFormatter;
13 import java.util.ArrayList; 15 import java.util.ArrayList;
14 import java.util.Collections; 16 import java.util.Collections;
@@ -91,15 +93,18 @@ public class CommonUtil { @@ -91,15 +93,18 @@ public class CommonUtil {
91 * @param month 月份数字 (1-12) 93 * @param month 月份数字 (1-12)
92 * @return 格式化的日期时间字符串,如 "2025-01-01 00:00:00" 94 * @return 格式化的日期时间字符串,如 "2025-01-01 00:00:00"
93 */ 95 */
94 - public static String convertToMonthDate(int month) { 96 + public static String convertToMonthDate(int year, int month, int day, int hour, int minute, int second) {
95 // 验证月份是否有效 97 // 验证月份是否有效
96 if (month < 1 || month > 12) { 98 if (month < 1 || month > 12) {
97 throw new DefaultClientException("月份必须在 1-12 之间,当前值: " + month); 99 throw new DefaultClientException("月份必须在 1-12 之间,当前值: " + month);
98 } 100 }
99 - // 获取当前年份  
100 - int currentYear = Year.now().getValue();  
101 - // 创建当月第一天的日期时间  
102 - LocalDateTime dateTime = LocalDateTime.of(currentYear, month, 1, 0, 0, 0); 101 + if (day == 0) {
  102 + // 获取最后一天
  103 + YearMonth yearMonth = YearMonth.of(year, month);
  104 + LocalDate lastDay = yearMonth.atEndOfMonth();
  105 + day = lastDay.getDayOfMonth();
  106 + }
  107 + LocalDateTime dateTime = LocalDateTime.of(year, month, day, hour, minute, second);
103 // 格式化为字符串 108 // 格式化为字符串
104 return dateTime.format(FORMATTER); 109 return dateTime.format(FORMATTER);
105 } 110 }
@@ -61,8 +61,15 @@ public class QueryReceiptLedgerInfoVo extends PageVo implements BaseVo, Serializ @@ -61,8 +61,15 @@ public class QueryReceiptLedgerInfoVo extends PageVo implements BaseVo, Serializ
61 private Integer tabNum; 61 private Integer tabNum;
62 62
63 /** 63 /**
64 - * 创建时间 64 + * 创建时间范围
65 */ 65 */
66 - @ApiModelProperty("创建时间")  
67 - private String createTime; 66 + @ApiModelProperty("创建时间范围")
  67 + private String createTimeStart;
  68 + private String createTimeEnd;
  69 +
  70 + /**
  71 + * 年份
  72 + */
  73 + @ApiModelProperty("年份")
  74 + private Integer createYear;
68 } 75 }
@@ -105,8 +105,11 @@ @@ -105,8 +105,11 @@
105 <if test="vo.customerId != null and vo.customerId != ''"> 105 <if test="vo.customerId != null and vo.customerId != ''">
106 AND tb.customer_id = #{vo.customerId} 106 AND tb.customer_id = #{vo.customerId}
107 </if> 107 </if>
108 - <if test="vo.createTime != null and vo.createTime != ''">  
109 - AND tb.create_time >= #{vo.createTime} 108 + <if test="vo.createTimeStart != null and vo.createTimeStart != ''">
  109 + AND tb.create_time >= #{vo.createTimeStart}
  110 + </if>
  111 + <if test="vo.createTimeEnd != null and vo.createTimeEnd != ''">
  112 + AND tb.create_time &lt;= #{vo.createTimeEnd}
110 </if> 113 </if>
111 <if test="vo.customerName != null and vo.customerName != ''"> 114 <if test="vo.customerName != null and vo.customerName != ''">
112 AND oc.name LIKE CONCAT('%', #{vo.customerName}, '%') 115 AND oc.name LIKE CONCAT('%', #{vo.customerName}, '%')
@@ -138,7 +141,7 @@ @@ -138,7 +141,7 @@
138 processed_date, 141 processed_date,
139 actual_returned_date, 142 actual_returned_date,
140 returned_amount, 143 returned_amount,
141 - actual_returned_amount 144 + actual_returned_amount,
142 end_account_receivable, 145 end_account_receivable,
143 apply_status, 146 apply_status,
144 coordinate_date, 147 coordinate_date,
@@ -148,7 +151,6 @@ @@ -148,7 +151,6 @@
148 fourth_coordinate_date, 151 fourth_coordinate_date,
149 fifth_coordinate_date, 152 fifth_coordinate_date,
150 description, 153 description,
151 - spilt,  
152 create_by_id, 154 create_by_id,
153 update_by_id, 155 update_by_id,
154 create_time, 156 create_time,
@@ -175,14 +177,13 @@ @@ -175,14 +177,13 @@
175 #{item.actualReturnedAmount}, 177 #{item.actualReturnedAmount},
176 #{item.endAccountReceivable}, 178 #{item.endAccountReceivable},
177 #{item.applyStatus}, 179 #{item.applyStatus},
178 - #{item.coordinateAate}, 180 + #{item.coordinateDate},
179 #{item.remark}, 181 #{item.remark},
180 #{item.secondCoordinateDate}, 182 #{item.secondCoordinateDate},
181 #{item.thirdCoordinateDate}, 183 #{item.thirdCoordinateDate},
182 #{item.fourthCoordinateDate}, 184 #{item.fourthCoordinateDate},
183 #{item.fifthCoordinateDate}, 185 #{item.fifthCoordinateDate},
184 #{item.description}, 186 #{item.description},
185 - #{item.spilt},  
186 #{item.createById}, 187 #{item.createById},
187 #{item.updateById}, 188 #{item.updateById},
188 #{item.createTime}, 189 #{item.createTime},