Commit 3c0d642de1a4dbd058ecfa800de10f09270502ce

Authored by yeqianyong
1 parent ec4628ba

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

1 1 package com.lframework.xingyun.sc.bo.ledger.receipt;
2 2
3 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 7 import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo;
5 8 import java.math.BigDecimal;
6 9 import com.lframework.starter.common.constants.StringPool;
... ... @@ -10,6 +13,7 @@ import java.time.LocalDateTime;
10 13 import io.swagger.annotations.ApiModelProperty;
11 14
12 15 import lombok.Data;
  16 +import org.apache.commons.lang3.StringUtils;
13 17
14 18 /**
15 19 * <p>
... ... @@ -36,6 +40,18 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> {
36 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 57 @ApiModelProperty("额度")
... ... @@ -54,24 +70,48 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> {
54 70 private String deptId;
55 71
56 72 /**
  73 + * 办事处名称
  74 + */
  75 + @ApiModelProperty("办事处名称")
  76 + private String deptName;
  77 +
  78 + /**
57 79 * 区域ID
58 80 */
59 81 @ApiModelProperty("区域ID")
60 82 private String region;
61 83
62 84 /**
  85 + * 区域名称
  86 + */
  87 + @ApiModelProperty("区域名称")
  88 + private String regionName;
  89 +
  90 + /**
63 91 * 备货单位ID
64 92 */
65 93 @ApiModelProperty("备货单位ID")
66 94 private String stockUpCompanyId;
67 95
68 96 /**
  97 + * 备货单位名称
  98 + */
  99 + @ApiModelProperty("备货单位名称")
  100 + private String stockUpCompanyName;
  101 +
  102 + /**
69 103 * 客户ID
70 104 */
71 105 @ApiModelProperty("客户ID")
72 106 private String customerId;
73 107
74 108 /**
  109 + * 客户名称
  110 + */
  111 + @ApiModelProperty("客户名称")
  112 + private String customerName;
  113 +
  114 + /**
75 115 * 厂别
76 116 */
77 117 @ApiModelProperty("厂别")
... ... @@ -236,6 +276,13 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> {
236 276
237 277 @Override
238 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 50 @HasPermission({"account-manage:ledger-detail:query"})
51 51 @GetMapping("/query")
52 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 59 PageResult<ReceiptLedgerInfo> pageResult = receiptLedgerInfoService.query(getPageIndex(vo), getPageSize(vo), vo);
58 60 List<ReceiptLedgerInfo> dataList = pageResult.getDatas();
... ...
... ... @@ -7,6 +7,8 @@ import com.lframework.starter.common.exceptions.impl.DefaultClientException;
7 7 import com.lframework.starter.common.utils.ObjectUtil;
8 8 import com.lframework.starter.common.utils.StringUtil;
9 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 12 import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo;
11 13 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
12 14 import com.lframework.starter.web.core.utils.PageResultUtil;
... ... @@ -20,6 +22,7 @@ import com.lframework.starter.common.utils.Assert;
20 22 import com.lframework.xingyun.sc.utils.CommonUtil;
21 23 import com.lframework.xingyun.sc.vo.ledger.receipt.ReceiptLedgerInfoSplitVo;
22 24 import com.lframework.xingyun.sc.vo.ledger.receipt.UpdateReceiptLedgerInfoVo;
  25 +import org.apache.commons.collections4.CollectionUtils;
23 26 import org.springframework.transaction.annotation.Transactional;
24 27 import com.lframework.xingyun.sc.mappers.ReceiptLedgerInfoMapper;
25 28 import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService;
... ... @@ -27,13 +30,23 @@ import com.lframework.xingyun.sc.vo.ledger.receipt.CreateReceiptLedgerInfoVo;
27 30 import com.lframework.xingyun.sc.vo.ledger.receipt.QueryReceiptLedgerInfoVo;
28 31 import org.springframework.stereotype.Service;
29 32
  33 +import javax.annotation.Resource;
30 34 import java.math.BigDecimal;
31 35 import java.util.ArrayList;
  36 +import java.util.Collections;
32 37 import java.util.List;
  38 +import java.util.Map;
  39 +import java.util.stream.Collectors;
33 40
34 41 @Service
35 42 public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedgerInfoMapper, ReceiptLedgerInfo> implements ReceiptLedgerInfoService {
36 43
  44 +
  45 + @Resource
  46 + private SysDataDicItemService sysDataDicItemService;
  47 +
  48 +
  49 +
37 50 @Override
38 51 public PageResult<ReceiptLedgerInfo> query(Integer pageIndex, Integer pageSize, QueryReceiptLedgerInfoVo vo) {
39 52 Assert.greaterThanZero(pageIndex);
... ... @@ -47,8 +60,21 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
47 60
48 61 @Override
49 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 80 @Override
... ... @@ -125,12 +151,10 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
125 151 throw new DefaultClientException("应收款台账明细不存在!");
126 152 }
127 153 LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class)
128   - .set(ReceiptLedgerInfo::getDelFlag, 1)
  154 + .set(ReceiptLedgerInfo::getDelFlag, true)
129 155 .eq(ReceiptLedgerInfo::getId, id);
130 156
131 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 7 import java.io.*;
8 8 import java.math.BigDecimal;
9 9 import java.math.RoundingMode;
  10 +import java.time.LocalDate;
10 11 import java.time.LocalDateTime;
11 12 import java.time.Year;
  13 +import java.time.YearMonth;
12 14 import java.time.format.DateTimeFormatter;
13 15 import java.util.ArrayList;
14 16 import java.util.Collections;
... ... @@ -91,15 +93,18 @@ public class CommonUtil {
91 93 * @param month 月份数字 (1-12)
92 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 98 if (month < 1 || month > 12) {
97 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 109 return dateTime.format(FORMATTER);
105 110 }
... ...
... ... @@ -61,8 +61,15 @@ public class QueryReceiptLedgerInfoVo extends PageVo implements BaseVo, Serializ
61 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 105 <if test="vo.customerId != null and vo.customerId != ''">
106 106 AND tb.customer_id = #{vo.customerId}
107 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 113 </if>
111 114 <if test="vo.customerName != null and vo.customerName != ''">
112 115 AND oc.name LIKE CONCAT('%', #{vo.customerName}, '%')
... ... @@ -138,7 +141,7 @@
138 141 processed_date,
139 142 actual_returned_date,
140 143 returned_amount,
141   - actual_returned_amount
  144 + actual_returned_amount,
142 145 end_account_receivable,
143 146 apply_status,
144 147 coordinate_date,
... ... @@ -148,7 +151,6 @@
148 151 fourth_coordinate_date,
149 152 fifth_coordinate_date,
150 153 description,
151   - spilt,
152 154 create_by_id,
153 155 update_by_id,
154 156 create_time,
... ... @@ -175,14 +177,13 @@
175 177 #{item.actualReturnedAmount},
176 178 #{item.endAccountReceivable},
177 179 #{item.applyStatus},
178   - #{item.coordinateAate},
  180 + #{item.coordinateDate},
179 181 #{item.remark},
180 182 #{item.secondCoordinateDate},
181 183 #{item.thirdCoordinateDate},
182 184 #{item.fourthCoordinateDate},
183 185 #{item.fifthCoordinateDate},
184 186 #{item.description},
185   - #{item.spilt},
186 187 #{item.createById},
187 188 #{item.updateById},
188 189 #{item.createTime},
... ...