Commit 25b987bee27ab797a775548a43a0488019a4486d
1 parent
92856c5f
1.针对A01客户的过期时间单独设置,并且无论填没填都会发送邮件
2.针对修改数量后,价格没有发送变化。
Showing
4 changed files
with
51 additions
and
17 deletions
src/main/java/com/order/erp/domain/EmailTemplateEnum.java
... | ... | @@ -15,7 +15,7 @@ public enum EmailTemplateEnum { |
15 | 15 | |
16 | 16 | CONFIRM_SAMPLE_TEMPLATE("确认样确认状态", "您收到此邮件是因为您未能在规定的期限内完成以下货号的确认样确认,请尽快完成", 1L), |
17 | 17 | |
18 | - OTHER_SAMPLE_TEMPLATE("其他要求样品发送日期", "您收到此邮件是因为您未能在规定的期限内完成以下货号的其他要求样品的发送,请尽快完成", 2L), | |
18 | + OTHER_SAMPLE_TEMPLATE("EXTRA,SHOWROOM,ONLINE sample发送日期", "您收到此邮件是因为您未能在规定的期限内完成以下货号的EXTRA,SHOWROOM,ONLINE sample的发送,请尽快完成", 2L), | |
19 | 19 | |
20 | 20 | BIG_SAMPLE_TEMPLATE("大货样确认状态", "您收到此邮件是因为您未能在规定的期限内完成以下货号的大货样确认,请尽快完成", 3L), |
21 | 21 | ... | ... |
src/main/java/com/order/erp/job/OrderOverTimeEventJob.java
... | ... | @@ -77,7 +77,6 @@ public class OrderOverTimeEventJob { |
77 | 77 | */ |
78 | 78 | |
79 | 79 | @Scheduled(cron = "0 0 5 * * ?") |
80 | - | |
81 | 80 | //存储的日期都必须为yyyy-MM-dd HH:mm:ss。 |
82 | 81 | public void checkOverTimeExecuteV2() { |
83 | 82 | List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.getEventList(); |
... | ... | @@ -421,9 +420,28 @@ public class OrderOverTimeEventJob { |
421 | 420 | String orderHodTime = eventJobVO.getBaseInfo().getOrderHodTime(); |
422 | 421 | LocalDate today = LocalDate.now(); |
423 | 422 | LocalDate localDate = DateUtils.parseDate(orderHodTime); |
423 | + //对于A01的订单,最晚订舱日期要为12天或者6天,海运为12天,空运为6天,其他的订单为10天。 对于A01来说,不管你填写没有,也要提醒,即使你填写了,也要提醒。 | |
424 | + if(eventJobVO.getBaseInfo().getCustomerCode().contains("A01")){ | |
425 | + //海运 | |
426 | + if("SEA".equals(eventJobVO.getBaseInfo().getOutboundType())){ | |
427 | + if(Constant.FOURTEEN ==(int) ChronoUnit.DAYS.between(today, localDate)){ | |
428 | + return true; | |
429 | + } | |
430 | + } | |
431 | + else if("AIR".equals(eventJobVO.getBaseInfo().getOutboundType())){ | |
432 | + if(Constant.SEVEN ==(int) ChronoUnit.DAYS.between(today, localDate)){ | |
433 | + return true; | |
434 | + } | |
435 | + }else{ | |
436 | + if(Constant.ENABLE_TEN ==(int) ChronoUnit.DAYS.between(today, localDate)){ | |
437 | + return true; | |
438 | + } | |
439 | + } | |
440 | + }else{ | |
424 | 441 | if ( Constant.ENABLE_TEN ==(int) ChronoUnit.DAYS.between(today, localDate) && StringUtils.isBlank(eventJobVO.getTrackStageInfo().getLatestBkTime())) { |
425 | 442 | return true; |
426 | 443 | } |
444 | + } | |
427 | 445 | return false; |
428 | 446 | } |
429 | 447 | ... | ... |
src/main/java/com/order/erp/service/order/OrderBaseInfoService.java
... | ... | @@ -117,7 +117,7 @@ public interface OrderBaseInfoService extends IService<OrderBaseInfoDO> { |
117 | 117 | |
118 | 118 | long countRecentYear(); |
119 | 119 | |
120 | - ServerResult checkChargeOrderCount(List<Long> orderIds); | |
120 | + ServerResult checkChargeOrderCount(OrderBaseInfoVO baseInfoVO); | |
121 | 121 | |
122 | 122 | List<OrderBaseInfoDO> getEventList(); |
123 | 123 | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... | ... | @@ -59,6 +59,7 @@ import java.time.LocalDate; |
59 | 59 | import java.time.LocalDateTime; |
60 | 60 | import java.time.Month; |
61 | 61 | import java.util.*; |
62 | +import java.util.concurrent.TimeUnit; | |
62 | 63 | import java.util.function.Function; |
63 | 64 | import java.util.stream.Collectors; |
64 | 65 | |
... | ... | @@ -128,7 +129,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
128 | 129 | |
129 | 130 | @Resource |
130 | 131 | private OrderOpinionLogService orderOpinionLogService; |
131 | - | |
132 | + @Resource | |
133 | + private RedisUtils redisUtils; | |
132 | 134 | @Resource |
133 | 135 | private EasyPdfUtils pdfUtils; |
134 | 136 | |
... | ... | @@ -1728,7 +1730,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1728 | 1730 | StringBuilder stringBuilder = new StringBuilder(productionComment); |
1729 | 1731 | stringBuilder.append("\n").append(date + ":" + resultText); |
1730 | 1732 | orderBaseInfoDo.setProductionComment(stringBuilder.toString()); |
1731 | - sendProductionCommentEmail(orderBaseInfoDo, stringBuilder.toString()); | |
1733 | +// sendProductionCommentEmail(orderBaseInfoDo, stringBuilder.toString()); | |
1734 | + setEmailSendUtilsRedis(orderBaseInfoDo,resultText,stringBuilder.toString()); | |
1732 | 1735 | |
1733 | 1736 | } |
1734 | 1737 | trackStageDO.setPpConfirmResult(trackStageInfo.getPpConfirmResult()); |
... | ... | @@ -1752,7 +1755,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1752 | 1755 | StringBuilder stringBuilder = new StringBuilder(productionComment); |
1753 | 1756 | stringBuilder.append("\n").append(date + ": " + resultText); |
1754 | 1757 | orderBaseInfoDo.setProductionComment(stringBuilder.toString()); |
1755 | - sendProductionCommentEmail(orderBaseInfoDo, stringBuilder.toString()); | |
1758 | +// sendProductionCommentEmail(orderBaseInfoDo, stringBuilder.toString()); | |
1759 | + setEmailSendUtilsRedis(orderBaseInfoDo,resultText,stringBuilder.toString()); | |
1756 | 1760 | } |
1757 | 1761 | trackStageDO.setShippmentSampleConfirmResult(trackStageInfo.getShippmentSampleConfirmResult()); |
1758 | 1762 | } |
... | ... | @@ -1775,7 +1779,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1775 | 1779 | StringBuilder stringBuilder = new StringBuilder(productionComment); |
1776 | 1780 | stringBuilder.append("\n").append(date + ": " + resultText); |
1777 | 1781 | orderBaseInfoDo.setProductionComment(stringBuilder.toString()); |
1778 | - sendProductionCommentEmail(orderBaseInfoDo, stringBuilder.toString()); | |
1782 | +// sendProductionCommentEmail(orderBaseInfoDo, stringBuilder.toString()); | |
1783 | + setEmailSendUtilsRedis(orderBaseInfoDo,resultText,stringBuilder.toString()); | |
1779 | 1784 | } |
1780 | 1785 | trackStageDO.setAitexTestFinishResult(trackStageInfo.getAitexTestFinishResult()); |
1781 | 1786 | } |
... | ... | @@ -1795,7 +1800,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1795 | 1800 | StringBuilder stringBuilder = new StringBuilder(productionComment); |
1796 | 1801 | stringBuilder.append("\n").append(date + ": " + resultText); |
1797 | 1802 | orderBaseInfoDo.setProductionComment(stringBuilder.toString()); |
1798 | - sendProductionCommentEmail(orderBaseInfoDo, stringBuilder.toString()); | |
1803 | +// sendProductionCommentEmail(orderBaseInfoDo, stringBuilder.toString()); | |
1804 | + setEmailSendUtilsRedis(orderBaseInfoDo,resultText,stringBuilder.toString()); | |
1799 | 1805 | } |
1800 | 1806 | |
1801 | 1807 | trackStageDO.setSgsTestFinishResult(trackStageInfo.getSgsTestFinishResult()); |
... | ... | @@ -1841,7 +1847,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1841 | 1847 | StringBuilder stringBuilder = new StringBuilder(productionComment); |
1842 | 1848 | stringBuilder.append("\n").append(date+": "+resultText); |
1843 | 1849 | orderBaseInfoDo.setProductionComment(stringBuilder.toString()); |
1844 | - sendProductionCommentEmail(orderBaseInfoDo,stringBuilder.toString()); | |
1850 | +// sendProductionCommentEmail(orderBaseInfoDo,stringBuilder.toString()); | |
1851 | + setEmailSendUtilsRedis(orderBaseInfoDo,resultText,stringBuilder.toString()); | |
1845 | 1852 | } |
1846 | 1853 | if(StringUtils.isNotBlank(updateVO.getTrackStageInfo().getShippmentSampleConfirmResult())) { |
1847 | 1854 | String resultText = updateVO.getTrackStageInfo().getShippmentSampleConfirmResult().contains("ok") |
... | ... | @@ -1854,7 +1861,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1854 | 1861 | StringBuilder stringBuilder = new StringBuilder(productionComment); |
1855 | 1862 | stringBuilder.append("\n").append(date+": "+resultText); |
1856 | 1863 | orderBaseInfoDo.setProductionComment(stringBuilder.toString()); |
1857 | - sendProductionCommentEmail(orderBaseInfoDo,stringBuilder.toString()); | |
1864 | +// sendProductionCommentEmail(orderBaseInfoDo,stringBuilder.toString()); | |
1865 | + setEmailSendUtilsRedis(orderBaseInfoDo,resultText,stringBuilder.toString()); | |
1858 | 1866 | } |
1859 | 1867 | if(StringUtils.isNotBlank(updateVO.getTrackStageInfo().getAitexTestFinishResult())){ |
1860 | 1868 | String resultText =updateVO.getTrackStageInfo().getAitexTestFinishResult().contains("ok") |
... | ... | @@ -1867,7 +1875,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1867 | 1875 | StringBuilder stringBuilder = new StringBuilder(productionComment); |
1868 | 1876 | stringBuilder.append("\n").append(date+": "+resultText); |
1869 | 1877 | orderBaseInfoDo.setProductionComment(stringBuilder.toString()); |
1870 | - sendProductionCommentEmail(orderBaseInfoDo,stringBuilder.toString()); | |
1878 | +// sendProductionCommentEmail(orderBaseInfoDo,stringBuilder.toString()); | |
1879 | + setEmailSendUtilsRedis(orderBaseInfoDo,resultText,stringBuilder.toString()); | |
1871 | 1880 | } |
1872 | 1881 | if(StringUtils.isNotBlank(updateVO.getTrackStageInfo().getSgsTestFinishResult())){ |
1873 | 1882 | String resultText = updateVO.getTrackStageInfo().getSgsTestFinishResult().contains("ok") |
... | ... | @@ -1880,7 +1889,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1880 | 1889 | StringBuilder stringBuilder = new StringBuilder(productionComment); |
1881 | 1890 | stringBuilder.append("\n").append(date+": "+resultText); |
1882 | 1891 | orderBaseInfoDo.setProductionComment(stringBuilder.toString()); |
1883 | - sendProductionCommentEmail(orderBaseInfoDo,stringBuilder.toString()); | |
1892 | +// sendProductionCommentEmail(orderBaseInfoDo,stringBuilder.toString()); | |
1893 | + setEmailSendUtilsRedis(orderBaseInfoDo,resultText,stringBuilder.toString()); | |
1884 | 1894 | } |
1885 | 1895 | } |
1886 | 1896 | orderBaseInfoDo.setOrderStatus(OrderStatusEnum.TRACK_ING.getStatus()); |
... | ... | @@ -1970,7 +1980,13 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1970 | 1980 | orderOpinionLogService.saveBatch(orderOpinionLogDOList); |
1971 | 1981 | return ServerResult.success(); |
1972 | 1982 | } |
1973 | - | |
1983 | +//这个方法的作用就是:她们反应对于内部编号相同的订单,就不需要发送四个测试结果的产品意见信息,不然创建一个订单就发送四个测试结果,太麻烦了,所以这里根据项目号和测试结果进行区分。 | |
1984 | + public void setEmailSendUtilsRedis(OrderBaseInfoDO orderBaseInfoDo,String resultText,String productionComment){ | |
1985 | + if(!redisUtils.hasKey(orderBaseInfoDo.getInnerNo()+Constant.CROSS_BAR_CHARACTER+resultText)){ | |
1986 | + sendProductionCommentEmail(orderBaseInfoDo,productionComment); | |
1987 | + redisUtils.set(orderBaseInfoDo.getInnerNo()+Constant.CROSS_BAR_CHARACTER+resultText, "1", 90, TimeUnit.DAYS); | |
1988 | + } | |
1989 | + } | |
1974 | 1990 | /** |
1975 | 1991 | * @param orderId |
1976 | 1992 | * @param userId |
... | ... | @@ -2053,7 +2069,7 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
2053 | 2069 | } |
2054 | 2070 | if (Objects.nonNull(baseInfoVO.getOrderCount())) { |
2055 | 2071 | baseInfoDO.setOrderCount(baseInfoVO.getOrderCount()); |
2056 | - checkChargeOrderCount(Arrays.asList(baseInfoVO.getId())); | |
2072 | + checkChargeOrderCount(baseInfoVO); | |
2057 | 2073 | } |
2058 | 2074 | if (StringUtils.isNotBlank(baseInfoVO.getOrderComposition())) { |
2059 | 2075 | baseInfoDO.setOrderComposition(baseInfoVO.getOrderComposition()); |
... | ... | @@ -2254,10 +2270,10 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
2254 | 2270 | |
2255 | 2271 | |
2256 | 2272 | @Override |
2257 | - public ServerResult checkChargeOrderCount(List<Long> ids) { | |
2273 | + public ServerResult checkChargeOrderCount(OrderBaseInfoVO baseInfoVO) { | |
2258 | 2274 | LambdaQueryWrapper<OrderBaseInfoDO> queryWrapper = new LambdaQueryWrapper<OrderBaseInfoDO>() |
2259 | 2275 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
2260 | - .in(CollectionUtils.isNotEmpty(ids), OrderBaseInfoDO::getId, ids) | |
2276 | + .in(CollectionUtils.isNotEmpty(Arrays.asList(baseInfoVO.getId())), OrderBaseInfoDO::getId, Arrays.asList(baseInfoVO.getId())) | |
2261 | 2277 | .ne(OrderBaseInfoDO::getOrderStatus, OrderStatusEnum.ORDER_FINISH.getStatus()); |
2262 | 2278 | List<OrderBaseInfoDO> ordersDOS = list(queryWrapper); |
2263 | 2279 | |
... | ... | @@ -2277,7 +2293,7 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
2277 | 2293 | for (OrderInfoResultVO resultVO : orderInfoResultVOS) { |
2278 | 2294 | if (profitAnalysisDOMap.containsKey(resultVO.getId())) { |
2279 | 2295 | OrderProfitAnalysisDO profitAnalysisDO = profitAnalysisDOMap.get(resultVO.getId()); |
2280 | - Integer orderCount = resultVO.getOrderCount(); | |
2296 | + Integer orderCount = baseInfoVO.getOrderCount(); | |
2281 | 2297 | BigDecimal customerTotalPrice = new BigDecimal(profitAnalysisDO.getCustomerTotalPrice()).setScale(Constant.TWO, RoundingMode.HALF_UP); |
2282 | 2298 | BigDecimal customerPrice = new BigDecimal(profitAnalysisDO.getCustomerPrice()).setScale(Constant.TWO, RoundingMode.HALF_UP); |
2283 | 2299 | ... | ... |