Commit 3efd19bae6b1dc46649afedcb9eea97c1d777005
1 parent
78eb9f1d
feat:防止没有给生产科配置邮箱产生空指针异常
Showing
8 changed files
with
106 additions
and
46 deletions
pom.xml
... | ... | @@ -55,6 +55,12 @@ |
55 | 55 | <groupId>com.alibaba</groupId> |
56 | 56 | <artifactId>easyexcel</artifactId> |
57 | 57 | <version>${easyexcel.version}</version> |
58 | + <exclusions> | |
59 | + <exclusion> | |
60 | + <artifactId>asm</artifactId> | |
61 | + <groupId>org.ow2.asm</groupId> | |
62 | + </exclusion> | |
63 | + </exclusions> | |
58 | 64 | </dependency> |
59 | 65 | |
60 | 66 | <dependency> |
... | ... | @@ -86,6 +92,12 @@ |
86 | 92 | <artifactId>spring-boot-starter-test</artifactId> |
87 | 93 | <version>${springboot.version}</version> |
88 | 94 | <scope>test</scope> |
95 | + <exclusions> | |
96 | + <exclusion> | |
97 | + <artifactId>asm</artifactId> | |
98 | + <groupId>org.ow2.asm</groupId> | |
99 | + </exclusion> | |
100 | + </exclusions> | |
89 | 101 | </dependency> |
90 | 102 | |
91 | 103 | <dependency> |
... | ... | @@ -265,6 +277,12 @@ |
265 | 277 | <groupId>com.aliyun.oss</groupId> |
266 | 278 | <artifactId>aliyun-sdk-oss</artifactId> |
267 | 279 | <version>${aliyun-sdk-oss.version}</version> |
280 | + <exclusions> | |
281 | + <exclusion> | |
282 | + <artifactId>aliyun-java-sdk-core</artifactId> | |
283 | + <groupId>com.aliyun</groupId> | |
284 | + </exclusion> | |
285 | + </exclusions> | |
268 | 286 | </dependency> |
269 | 287 | |
270 | 288 | <!--thumbnailator 图片压缩工具--> |
... | ... | @@ -280,6 +298,12 @@ |
280 | 298 | <groupId>wiki.xsx</groupId> |
281 | 299 | <artifactId>x-easypdf-pdfbox</artifactId> |
282 | 300 | <version>${x-easypdf-pdfbox.version}</version> |
301 | + <exclusions> | |
302 | + <exclusion> | |
303 | + <artifactId>commons-logging</artifactId> | |
304 | + <groupId>commons-logging</groupId> | |
305 | + </exclusion> | |
306 | + </exclusions> | |
283 | 307 | </dependency> |
284 | 308 | |
285 | 309 | <!--email邮件配置--> | ... | ... |
src/main/java/com/order/erp/job/OrderOverTimeEventJob.java
... | ... | @@ -301,7 +301,7 @@ public class OrderOverTimeEventJob { |
301 | 301 | private Boolean filterBigSampleEvent(OrderEventJobVO eventJobVO) { |
302 | 302 | String orderHodTime = eventJobVO.getBaseInfo().getOrderHodTime(); |
303 | 303 | String shippmentSampleConfirmResult = eventJobVO.getTrackStageInfo().getShippmentSampleConfirmResult(); |
304 | - String shippmentSampleConfirmTime = eventJobVO.getTrackStageInfo().getShippmentSampleSendTime(); | |
304 | + String shippmentSampleConfirmTime = eventJobVO.getTrackStageInfo().getShippmentSampleConfirmTime(); | |
305 | 305 | if (StringUtils.isNotBlank(orderHodTime) && StringUtils.isNotBlank(shippmentSampleConfirmResult) && StringUtils.isNotBlank(shippmentSampleConfirmTime)) { |
306 | 306 | int daysBetween = getDaysBetween(shippmentSampleConfirmResult, shippmentSampleConfirmTime, orderHodTime); |
307 | 307 | if (daysBetween == Constant.SEVEN || daysBetween == Constant.NEGATIVE_ONE) { | ... | ... |
src/main/java/com/order/erp/mapper/order/OrderBaseInfoMapper.java
... | ... | @@ -31,7 +31,8 @@ public interface OrderBaseInfoMapper extends BaseMapper<OrderBaseInfoDO> { |
31 | 31 | |
32 | 32 | List<QueryProjectNoAndInnerNoDto> queryProjectNoAndInnerNoDto(@Param("flag") Boolean flag, |
33 | 33 | @Param("dto") QueryProjectNoAndInnerNoDto dto); |
34 | - @Select("SELECT * FROM order_base_info WHERE order_status!=50 and enable_flag=10 and DATE_SUB(CURDATE(), INTERVAL 3 MONTH) <= date(create_time);") | |
34 | +// @Select("SELECT * FROM order_base_info WHERE order_status!=50 and enable_flag=10 and DATE_SUB(CURDATE(), INTERVAL 3 MONTH) <= date(create_time);") | |
35 | +@Select("SELECT * FROM order_base_info WHERE enable_flag=10 and DATE_SUB(CURDATE(), INTERVAL 3 MONTH) <= date(create_time);") | |
35 | 36 | List<OrderBaseInfoDO> getEventList(); |
36 | 37 | } |
37 | 38 | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... | ... | @@ -1801,40 +1801,23 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
1801 | 1801 | AdminUserDO ProductionDepartmentUserDO = userService.getOne(new LambdaQueryWrapper<AdminUserDO>() |
1802 | 1802 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
1803 | 1803 | .eq(AdminUserDO::getUserName, orderBaseInfoDO.getProductionDepartment())); |
1804 | - OrderEventJobVO orderEventJobVO = new OrderEventJobVO(); | |
1805 | - orderEventJobVO.setInspectionStageInfo(inspectionStageInfo); | |
1806 | - OrderBaseInfoVO orderBaseInfoVo = BeanUtil.copyProperties(orderBaseInfoDo, OrderBaseInfoVO.class); | |
1807 | - orderEventJobVO.setBaseInfo(orderBaseInfoVo); | |
1808 | - List<String> emails = Arrays.asList(ProductionDepartmentUserDO.getEmail().split( "[,,]+")) | |
1809 | - .stream().map(String::trim) | |
1810 | - .collect(Collectors.toList()); | |
1811 | - //一旦修改完质检信息就自动发送邮件对应的生产科。多次编辑保存多次发送。 | |
1812 | - if (StringUtils.isNotBlank(inspectionStageInfo.getEndCheckApplyTime())) { | |
1813 | - String EndCheckApplyTime= inspectionStageInfo.getEndCheckApplyTime().substring(0, 10); | |
1814 | - String ProductionDepartmentConsignTime =orderBaseInfoDo.getProductionDepartmentConsignTime().substring(0, 10); | |
1815 | - String EndCheckApply = DateUtils.format(DateUtils.parseDate(EndCheckApplyTime, DATE), DATE); | |
1816 | - String ProductionDepartmentConsign = DateUtils.format(DateUtils.parseDate(ProductionDepartmentConsignTime,DATE), DATE); | |
1817 | - orderEventJobVO.getInspectionStageInfo().setEndCheckApplyTime(EndCheckApply); | |
1818 | - orderEventJobVO.getBaseInfo().setProductionDepartmentConsignTime(ProductionDepartmentConsign); | |
1819 | - //尾期验货报告。 | |
1820 | - emailSendUtils.sendEmail(EmailTemplateEnum.END_CHECK_REPORT_TEMPLATE, emails, orderEventJobVO); | |
1821 | - }else if(StringUtils.isNotBlank(inspectionStageInfo.getMidCheckApplyTime())){ | |
1822 | - String MidCheckApplyTime= inspectionStageInfo.getMidCheckApplyTime().substring(0, 10); | |
1823 | - String ProductionDepartmentConsignTime =orderBaseInfoDo.getProductionDepartmentConsignTime().substring(0, 10); | |
1824 | - String MidCheckApply = DateUtils.format(DateUtils.parseDate(MidCheckApplyTime, DATE), DATE); | |
1825 | - String ProductionDepartmentConsign = DateUtils.format(DateUtils.parseDate(ProductionDepartmentConsignTime,DATE), DATE); | |
1826 | - orderEventJobVO.getInspectionStageInfo().setMidCheckApplyTime(MidCheckApply); | |
1827 | - orderEventJobVO.getBaseInfo().setProductionDepartmentConsignTime(ProductionDepartmentConsign); | |
1828 | - //中期验货报告。 | |
1829 | - emailSendUtils.sendEmail(EmailTemplateEnum.MID_CHECK_REPORT_TEMPLATE, emails, orderEventJobVO); | |
1804 | + if( Objects.nonNull(ProductionDepartmentUserDO) && StringUtils.isNotBlank(ProductionDepartmentUserDO.getEmail())){ | |
1805 | + sendOrderInspectionStage(updateVO,inspectionStageInfo); | |
1830 | 1806 | } |
1831 | - | |
1832 | 1807 | } else { |
1833 | 1808 | inspectionStageDO = new OrderInspectionStageDO(); |
1834 | 1809 | BeanUtils.copyProperties(updateVO.getInspectionStageInfo(), inspectionStageDO); |
1835 | 1810 | inspectionStageDO.setOrderId(updateVO.getOrderId()); |
1836 | 1811 | inspectionStageDO.setOrderStatus(OrderStatusEnum.INSPECT_ING.getStatus()); |
1837 | 1812 | inspectionStageService.save(inspectionStageDO); |
1813 | + OrderBaseInfoDO orderBaseInfoDO = baseInfoService.getById(updateVO.getOrderId()); | |
1814 | + AdminUserDO ProductionDepartmentUserDO = userService.getOne(new LambdaQueryWrapper<AdminUserDO>() | |
1815 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
1816 | + .eq(AdminUserDO::getUserName, orderBaseInfoDO.getProductionDepartment())); | |
1817 | + if( Objects.nonNull(ProductionDepartmentUserDO) && StringUtils.isNotBlank(ProductionDepartmentUserDO.getEmail())){ | |
1818 | + sendOrderInspectionStage(updateVO,inspectionStageInfo); | |
1819 | + } | |
1820 | + | |
1838 | 1821 | } |
1839 | 1822 | orderBaseInfoDo.setOrderStatus(OrderStatusEnum.INSPECT_ING.getStatus()); |
1840 | 1823 | optLogDO = buildOrderOptLogDo(updateVO.getOrderId(), userId, OrderOptTypeEnum.ORDER_INSPECT_EDIT_APPLY.getDesc(), JSONObject.toJSONString(updateVO)); |
... | ... | @@ -2155,4 +2138,36 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
2155 | 2138 | List<OrderBaseInfoDO> orderBaseInfoDOList = baseMapper.getEventList(); |
2156 | 2139 | return orderBaseInfoDOList; |
2157 | 2140 | } |
2141 | + | |
2142 | + private void sendOrderInspectionStage(OrderUpdateVO updateVO, OrderInspectionStageVO inspectionStageInfo){ | |
2143 | + OrderBaseInfoDO orderBaseInfoDO = baseInfoService.getById(updateVO.getOrderId()); | |
2144 | + AdminUserDO ProductionDepartmentUserDO = userService.getOne(new LambdaQueryWrapper<AdminUserDO>() | |
2145 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
2146 | + .eq(AdminUserDO::getUserName, orderBaseInfoDO.getProductionDepartment())); | |
2147 | + OrderEventJobVO orderEventJobVO = new OrderEventJobVO(); | |
2148 | + orderEventJobVO.setInspectionStageInfo(inspectionStageInfo); | |
2149 | + OrderBaseInfoVO orderBaseInfoVo = BeanUtil.copyProperties(orderBaseInfoDO, OrderBaseInfoVO.class); | |
2150 | + orderEventJobVO.setBaseInfo(orderBaseInfoVo); | |
2151 | + List<String> emails = Arrays.asList(ProductionDepartmentUserDO.getEmail().split( "[,,]+")) | |
2152 | + .stream().map(String::trim) | |
2153 | + .collect(Collectors.toList()); | |
2154 | + //一旦修改完质检信息就自动发送邮件对应的生产科。多次编辑保存多次发送。 | |
2155 | + if (StringUtils.isNotBlank(inspectionStageInfo.getEndCheckApplyTime())) { | |
2156 | + String EndCheckApplyTime= inspectionStageInfo.getEndCheckApplyTime().substring(0, 10); | |
2157 | + String ProductionDepartmentConsignTime =orderBaseInfoDO.getProductionDepartmentConsignTime().substring(0, 10); | |
2158 | + orderEventJobVO.getInspectionStageInfo().setEndCheckApplyTime(EndCheckApplyTime); | |
2159 | + orderEventJobVO.getBaseInfo().setProductionDepartmentConsignTime(ProductionDepartmentConsignTime); | |
2160 | + //尾期验货报告。 | |
2161 | + emailSendUtils.sendEmail(EmailTemplateEnum.END_CHECK_REPORT_TEMPLATE, emails, orderEventJobVO); | |
2162 | + }else if(StringUtils.isNotBlank(inspectionStageInfo.getMidCheckApplyTime())){ | |
2163 | + String MidCheckApplyTime= inspectionStageInfo.getMidCheckApplyTime().substring(0, 10); | |
2164 | + String ProductionDepartmentConsignTime =orderBaseInfoDO.getProductionDepartmentConsignTime().substring(0, 10); | |
2165 | + String MidCheckApply = DateUtils.format(DateUtils.parseDate(MidCheckApplyTime, DATE), DATE); | |
2166 | + String ProductionDepartmentConsign = DateUtils.format(DateUtils.parseDate(ProductionDepartmentConsignTime,DATE), DATE); | |
2167 | + orderEventJobVO.getInspectionStageInfo().setMidCheckApplyTime(MidCheckApply); | |
2168 | + orderEventJobVO.getBaseInfo().setProductionDepartmentConsignTime(ProductionDepartmentConsign); | |
2169 | + //中期验货报告。 | |
2170 | + emailSendUtils.sendEmail(EmailTemplateEnum.MID_CHECK_REPORT_TEMPLATE, emails, orderEventJobVO); | |
2171 | + } | |
2172 | + } | |
2158 | 2173 | } | ... | ... |
src/main/resources/application-local.yml
... | ... | @@ -57,13 +57,13 @@ spring: |
57 | 57 | testWhileIdle: true |
58 | 58 | testOnBorrow: true |
59 | 59 | testOnReturn: true |
60 | - password: canrd@2024 | |
60 | + password: root | |
61 | 61 | time-between-eviction-runs-millis: 1000 |
62 | - url: jdbc:mysql://39.108.227.113:3307/order-erp1?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true&useAffectedRows=true&autoReconnectForPools=true | |
62 | + url: jdbc:mysql://localhost:3306/order-erp1?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true&useAffectedRows=true&autoReconnectForPools=true | |
63 | 63 | username: root |
64 | 64 | redis: |
65 | 65 | database: 0 |
66 | - host: 39.108.227.113 | |
66 | + host: localhost | |
67 | 67 | lettuce: |
68 | 68 | pool: |
69 | 69 | max-active: 2000 |
... | ... | @@ -76,21 +76,33 @@ spring: |
76 | 76 | timeout: 2000 |
77 | 77 | mail: |
78 | 78 | # 配置 SMTP 服务器地址 |
79 | +# host: smtp.163.com | |
79 | 80 | host: smtp.mxhichina.com |
80 | - # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的 | |
81 | + # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的 | |
81 | 82 | username: system@canrd.com |
82 | - # 配置密码,注意不是真正的密码,而是刚刚申请到的授权码 | |
83 | + # 配置密码,注意不是真正的密码,而是刚刚申请到的授权码 | |
83 | 84 | password: Kelude2015 |
84 | - # 邮件接收者 | |
85 | + # 邮件接收者 | |
85 | 86 | mailRecipient: #邮件接收者邮箱 |
87 | + # 端口号465或587(QQ邮箱发送邮件仅支持587端口协议) | |
88 | + port: 465 | |
89 | + | |
90 | + # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的 | |
91 | +# username: chenhang4442024@163.com | |
92 | + # 配置密码,注意不是真正的密码,而是刚刚申请到的授权码 | |
93 | +# password: ACHWYJSXRITHTMGA | |
94 | + # 邮件接收者 | |
95 | +# mailRecipient: #邮件接收者邮箱 | |
86 | 96 | # 端口号465或587(QQ邮箱发送邮件仅支持587端口协议) |
87 | - port: 587 | |
97 | +# port: 25 | |
88 | 98 | # 默认的邮件编码为UTF-8 |
89 | 99 | default-encoding: UTF-8 |
90 | 100 | # 配置SSL 加密工厂 |
91 | 101 | properties: |
92 | 102 | mail: |
93 | 103 | smtp: |
104 | + ssl: | |
105 | + enabled: true | |
94 | 106 | socketFactoryClass: javax.net.ssl.SSLSocketFactory |
95 | 107 | #表示开启 DEBUG 模式,这样,邮件发送过程的日志会在控制台打印出来,方便排查错误 |
96 | 108 | debug: true | ... | ... |
src/main/resources/application-pre-prod.yml
... | ... | @@ -76,15 +76,19 @@ spring: |
76 | 76 | timeout: 2000 |
77 | 77 | mail: |
78 | 78 | # 配置 SMTP 服务器地址 |
79 | - host: xxx | |
79 | +# host: xxx | |
80 | + host: smtp.163.com | |
80 | 81 | # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的 |
81 | - username: xxxx | |
82 | +# username: xxxx | |
83 | + username: chenhang4442024@163.com | |
82 | 84 | # 配置密码,注意不是真正的密码,而是刚刚申请到的授权码 |
83 | - password: xxx | |
85 | +# password: xxx | |
86 | + password: ACHWYJSXRITHTMGA | |
84 | 87 | # 邮件接收者 |
85 | 88 | mailRecipient: #邮件接收者邮箱 |
86 | 89 | # 端口号465或587(QQ邮箱发送邮件仅支持587端口协议) |
87 | - port: 587 | |
90 | +# port: 587 | |
91 | + port: 25 | |
88 | 92 | # 默认的邮件编码为UTF-8 |
89 | 93 | default-encoding: UTF-8 |
90 | 94 | # 配置SSL 加密工厂 | ... | ... |
src/main/resources/application-test.yml
... | ... | @@ -76,25 +76,29 @@ spring: |
76 | 76 | timeout: 2000 |
77 | 77 | mail: |
78 | 78 | # 配置 SMTP 服务器地址 |
79 | - host: smtp.mxhichina.com | |
79 | +# host: smtp.mxhichina.com | |
80 | + host: smtp.163.com | |
80 | 81 | # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的 |
81 | - username: system@canrd.com | |
82 | + username: chenhang4442024@163.com | |
82 | 83 | # 配置密码,注意不是真正的密码,而是刚刚申请到的授权码 |
83 | - password: Kelude2015 | |
84 | + password: ACHWYJSXRITHTMGA | |
84 | 85 | # 邮件接收者 |
85 | 86 | mailRecipient: #邮件接收者邮箱 |
86 | 87 | # 端口号465或587(QQ邮箱发送邮件仅支持587端口协议) |
87 | - port: 587 | |
88 | + port: 465 | |
88 | 89 | # 默认的邮件编码为UTF-8 |
89 | 90 | default-encoding: UTF-8 |
90 | 91 | # 配置SSL 加密工厂 |
91 | 92 | properties: |
92 | 93 | mail: |
93 | 94 | smtp: |
95 | + ssl: | |
96 | + enable: true | |
94 | 97 | socketFactoryClass: javax.net.ssl.SSLSocketFactory |
95 | 98 | #表示开启 DEBUG 模式,这样,邮件发送过程的日志会在控制台打印出来,方便排查错误 |
96 | 99 | debug: true |
97 | 100 | |
101 | + | |
98 | 102 | freemarker: |
99 | 103 | template-loader-path: classpath:/template/ |
100 | 104 | suffix: .flt | ... | ... |
-
mentioned in commit bdf35574