Commit b91814d480eee3f0440abe8e4a93b1246ef781b0
1 parent
fd3c0b52
fix:1.审核通过之后,也需要给财务发送邮件。
2.对于质检信息,跟单信息遇到相同的style号的订单采用填写任何一个订单,会自动把相同style号的订单的跟单和质检信息复制过去,无需填写多个。 产生的问题:扫描最近三个月的订单,要是扫描不到就会产生查询不到数据的错误, 更新之后,要是扫描不到,就 只对于当前修改的订单进行更新,不对于其它相同style的订单进行跟单或者质检信息的复制。
Showing
4 changed files
with
86 additions
and
17 deletions
src/main/java/com/order/erp/common/utils/EmailSendUtils.java
... | ... | @@ -12,6 +12,7 @@ import com.order.erp.domain.dto.admin.AdminUserDO; |
12 | 12 | import com.order.erp.domain.dto.admin.AdminUserRoleDO; |
13 | 13 | import com.order.erp.domain.dto.order.InvoiceBillOrderDO; |
14 | 14 | import com.order.erp.domain.dto.order.ProducePaymentCheckBillOrderDO; |
15 | +//import com.order.erp.domain.vo.order.DeductionUrlFieldVO; | |
15 | 16 | import com.order.erp.domain.vo.order.FinanceEventJobVO; |
16 | 17 | import com.order.erp.domain.vo.order.InvoiceAndCheckBillSendEmailVO; |
17 | 18 | import com.order.erp.domain.vo.order.OrderEventJobVO; |
... | ... | @@ -312,7 +313,9 @@ public class EmailSendUtils { |
312 | 313 | .toArray(String[]::new); // 转换为 String[] 数组 |
313 | 314 | } |
314 | 315 | invoiceNoOrCheckNo = invoiceBillOrderDO.getInvoiceNo(); |
315 | - }else{ | |
316 | + } | |
317 | +// else if(invoiceAndCheckBillSendEmailVO.getCheckBillOrderDO()!=null){ | |
318 | + else { | |
316 | 319 | ProducePaymentCheckBillOrderDO checkBillOrderDO = invoiceAndCheckBillSendEmailVO.getCheckBillOrderDO(); |
317 | 320 | Set<Long> userIds = null; |
318 | 321 | //得到跟单员和业务员和财务。 |
... | ... | @@ -329,10 +332,46 @@ public class EmailSendUtils { |
329 | 332 | queryWrapper.or().in(AdminUserDO::getId,userIds); |
330 | 333 | } |
331 | 334 | List<AdminUserDO> adminUserDOList = adminUserService.list(queryWrapper); |
332 | - email = adminUserDOList.stream().map(AdminUserDO::getEmail).filter(Objects::nonNull).flatMap(emails -> Arrays.asList(emails.split("[,,]+")) | |
335 | + List<AdminUserDO> distinctUserList = adminUserDOList.stream() | |
336 | + .collect(Collectors.toMap(AdminUserDO::getUserName, user -> user, (existing, replacement) -> existing)) | |
337 | + .values() | |
338 | + .stream() | |
339 | + .collect(Collectors.toList()); | |
340 | + | |
341 | + email = distinctUserList.stream().map(AdminUserDO::getEmail).filter(Objects::nonNull).flatMap(emails -> Arrays.asList(emails.split("[,,]+")) | |
333 | 342 | .stream()).map(String::trim).filter(s -> !s.isEmpty()).toArray(String[]::new); |
334 | 343 | invoiceNoOrCheckNo=checkBillOrderDO.getCheckNo(); |
335 | - } | |
344 | + }/*else{ | |
345 | + DeductionUrlFieldVO deductionUrlFieldVO = invoiceAndCheckBillSendEmailVO.getDeductionUrlFieldVO(); | |
346 | + Set<Long> userIds = null; | |
347 | + //得到跟单员和业务员和财务。 | |
348 | + if(isTrue){ | |
349 | + List<AdminUserRoleDO> list = adminUserRoleService.list(new LambdaQueryWrapper<AdminUserRoleDO>() | |
350 | + .eq(AdminUserRoleDO::getRoleId, Constant.SEVEN)); | |
351 | + userIds= list.stream().map(AdminUserRoleDO::getUserId).collect(Collectors.toSet()); | |
352 | + } | |
353 | + LambdaQueryWrapper<AdminUserDO> queryWrapper = new LambdaQueryWrapper<AdminUserDO>() | |
354 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
355 | + .and(wrapper -> wrapper | |
356 | + .in(AdminUserDO::getUserName, Arrays.asList(deductionUrlFieldVO.getTrackerUser(), deductionUrlFieldVO.getBusinesPerson()))); | |
357 | + if(CollectionUtils.isNotEmpty(userIds)){ | |
358 | + queryWrapper.or().in(AdminUserDO::getId,userIds); | |
359 | + } | |
360 | + List<AdminUserDO> adminUserDOList = adminUserService.list(queryWrapper); | |
361 | + List<AdminUserDO> distinctUserList = adminUserDOList.stream() | |
362 | + .collect(Collectors.toMap(AdminUserDO::getUserName, user -> user, (existing, replacement) -> existing)) | |
363 | + .values() | |
364 | + .stream() | |
365 | + .collect(Collectors.toList()); | |
366 | + | |
367 | + email = distinctUserList.stream().map(AdminUserDO::getEmail).filter(Objects::nonNull).flatMap(emails -> Arrays.asList(emails.split("[,,]+")) | |
368 | + .stream()).map(String::trim).filter(s -> !s.isEmpty()).toArray(String[]::new); | |
369 | + if(StringUtils.isEmpty(deductionUrlFieldVO.getCheckNo())){ | |
370 | + invoiceNoOrCheckNo=deductionUrlFieldVO.getInvoiceNo(); | |
371 | + }else{ | |
372 | + invoiceNoOrCheckNo=deductionUrlFieldVO.getCheckNo(); | |
373 | + } | |
374 | + }*/ | |
336 | 375 | if(Objects.nonNull(email)){ |
337 | 376 | try { |
338 | 377 | helper = new MimeMessageHelper(mimeMessage); | ... | ... |
src/main/java/com/order/erp/mapper/order/OrderBaseInfoMapper.java
... | ... | @@ -64,5 +64,12 @@ public interface OrderBaseInfoMapper extends BaseMapper<OrderBaseInfoDO> { |
64 | 64 | long countAllDayvalueByOrderStatus(Integer orderStatus, LocalDate startDate, LocalDate endDate); |
65 | 65 | @Select("SELECT count(*) AS count FROM order_base_info WHERE enable_flag=10 AND create_time >= #{startDate} AND create_time < #{endDate};") |
66 | 66 | long countRecentDayByOrderInit(LocalDate startDate, LocalDate endDate); |
67 | + List<OrderBaseInfoDO> sameAttributeOrder(@Param("customerStyle") String customerStyle, | |
68 | + @Param("innerNo") String innerNo, | |
69 | + @Param("isReturnOrder") String isReturnOrder, | |
70 | + @Param("monthsAgo") LocalDateTime monthsAgo, | |
71 | + @Param("now") LocalDateTime now); | |
72 | + | |
73 | + | |
67 | 74 | } |
68 | 75 | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... | ... | @@ -2201,28 +2201,24 @@ end |
2201 | 2201 | redisUtils.set(orderBaseInfoDo.getInnerNo()+Constant.CROSS_BAR_CHARACTER+resultText, "1", 90, TimeUnit.DAYS); |
2202 | 2202 | } |
2203 | 2203 | } |
2204 | - //查询最近三个月的数据。 | |
2204 | + //查询最近四个月的数据。(之前设置三个月太少了!)。 | |
2205 | 2205 | private List<OrderBaseInfoDO> getTwoMonthOrderBaseInfo(OrderBaseInfoDO orderBaseInfoDo){ |
2206 | 2206 | LocalDateTime now = LocalDateTime.now(); |
2207 | - LocalDateTime twoMonthsAgo = now.minusMonths(3); | |
2208 | - LambdaQueryWrapper<OrderBaseInfoDO> orderBaseInfoDOLambdaQueryWrapper; | |
2207 | + LocalDateTime twoMonthsAgo = now.minusMonths(4); | |
2208 | + List<OrderBaseInfoDO> orderBaseInfoDOList; | |
2209 | 2209 | //这部分代码的目的是,遇到相同style的订单,他们只需要填写其中任何一个订单的跟单信息,就会填写的跟单信息复制到其他订单上。 |
2210 | 2210 | if(Constant.STRING_ZERO.equals(orderBaseInfoDo.getReturnOrder())){ |
2211 | 2211 | //查询所有相同的style的并且不是返单的订单。 |
2212 | - orderBaseInfoDOLambdaQueryWrapper = new LambdaQueryWrapper<OrderBaseInfoDO>().eq(OrderBaseInfoDO::getEnableFlag, Constant.ENABLE_TEN) | |
2213 | - .eq(OrderBaseInfoDO::getCustomerStyle, orderBaseInfoDo.getCustomerStyle()) | |
2214 | - .eq(OrderBaseInfoDO::getInnerNo, orderBaseInfoDo.getInnerNo()) | |
2215 | - .eq(OrderBaseInfoDO::getReturnOrder, Constant.STRING_ZERO) | |
2216 | - .between(OrderBaseInfoDO::getCreateTime, twoMonthsAgo, now); | |
2212 | + orderBaseInfoDOList = baseMapper.sameAttributeOrder(orderBaseInfoDo.getCustomerStyle(), orderBaseInfoDo.getInnerNo(), Constant.STRING_ZERO, twoMonthsAgo, now); | |
2217 | 2213 | }else{ |
2218 | 2214 | //查询所有相同的style的并且是返单的订单。 |
2219 | - orderBaseInfoDOLambdaQueryWrapper = new LambdaQueryWrapper<OrderBaseInfoDO>().eq(OrderBaseInfoDO::getEnableFlag, Constant.ENABLE_TEN) | |
2220 | - .eq(OrderBaseInfoDO::getCustomerStyle, orderBaseInfoDo.getCustomerStyle()) | |
2221 | - .eq(OrderBaseInfoDO::getInnerNo, orderBaseInfoDo.getInnerNo()) | |
2222 | - .eq(OrderBaseInfoDO::getReturnOrder, Constant.STRING_ONE) | |
2223 | - .between(OrderBaseInfoDO::getCreateTime, twoMonthsAgo, now); | |
2215 | + orderBaseInfoDOList = baseMapper.sameAttributeOrder(orderBaseInfoDo.getCustomerStyle(), orderBaseInfoDo.getInnerNo(), Constant.STRING_ONE, twoMonthsAgo, now); | |
2224 | 2216 | } |
2225 | - return list(orderBaseInfoDOLambdaQueryWrapper); | |
2217 | + //如果一个都没有查询出来,就说明创建订单时创建质检信息,到现在已经距离四个月了,所以连自己都没有查询出来,这个时候就把自己传过去,避免一个都没有。 | |
2218 | + if(CollectionUtils.isEmpty(orderBaseInfoDOList)){ | |
2219 | + orderBaseInfoDOList.add(orderBaseInfoDo); | |
2220 | + } | |
2221 | + return orderBaseInfoDOList; | |
2226 | 2222 | } |
2227 | 2223 | |
2228 | 2224 | private List<OrderOptLogDO> inspectionCopy(OrderBaseInfoDO orderBaseInfoDo,OrderUpdateVO updateVO,Long userId){ | ... | ... |
src/main/resources/mapper/OrderBaseInfoMapper.xml
... | ... | @@ -106,4 +106,31 @@ |
106 | 106 | date; |
107 | 107 | </select> |
108 | 108 | |
109 | + | |
110 | + <select id="sameAttributeOrder" resultType="com.order.erp.domain.dto.order.OrderBaseInfoDO"> | |
111 | + SELECT | |
112 | + obi.* | |
113 | + FROM | |
114 | + order_base_info obi | |
115 | + JOIN | |
116 | + order_inspection_stage opa | |
117 | + ON | |
118 | + opa.order_id = obi.id | |
119 | + AND opa.enable_flag = 10 | |
120 | + WHERE | |
121 | + obi.enable_flag = 10 | |
122 | + AND | |
123 | + obi.customer_style = #{customerStyle} | |
124 | + AND | |
125 | + obi.inner_no = #{innerNo} | |
126 | + AND | |
127 | + obi.return_order = #{isReturnOrder} | |
128 | + AND | |
129 | + obi.create_time BETWEEN #{monthsAgo} AND #{now} | |
130 | + AND | |
131 | + (opa.mid_check_apply_time IS NULL | |
132 | + OR | |
133 | + opa.mid_check_result IS NULL) | |
134 | + </select> | |
135 | + | |
109 | 136 | </mapper> | ... | ... |