|
@@ -1,5 +1,6 @@
|
|
|
package com.rongwei.savecheck.controller;
|
|
|
|
|
|
+import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.utils.SpringContextUtils;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.sfcommon.sys.service.UrgingService;
|
|
@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -37,32 +39,30 @@ public class UrgingController {
|
|
|
private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
|
|
|
|
|
|
@PostMapping("/send")
|
|
|
- public void complaintForm(@RequestBody Map<String, List<String>> params) {
|
|
|
- log.info("开发发送催办提醒:{}",params);
|
|
|
- params.forEach((k, v) -> {
|
|
|
- if (StringUtils.isBlank(k)) {
|
|
|
- log.error("催办类型为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (v == null) {
|
|
|
- log.error("催办数据ID为空");
|
|
|
- return;
|
|
|
- }
|
|
|
- UrgingService urgingService;
|
|
|
- if (SPECIAL_EQUIPMENT.equals(k)) {
|
|
|
- urgingService = SpringContextUtils.getBean("specialEquipmentUrgingServiceImpl");
|
|
|
- } else if (SPECIAL_CERTIFICATE.equals(k)) {
|
|
|
- urgingService = SpringContextUtils.getBean("specialCertificateUrgingServiceImpl");
|
|
|
- } else if (SECURITY_ATTACHMENTS.equals(k)) {
|
|
|
- urgingService = SpringContextUtils.getBean("securityAttachmentsUrgingServiceImpl");
|
|
|
- } else {
|
|
|
- log.error("催办类型不正确:{}", k);
|
|
|
- urgingService = null;
|
|
|
- }
|
|
|
- if (urgingService != null) {
|
|
|
- log.error("当前催办类型为:{},需要被催办的数据为:{}", k, v);
|
|
|
- urgingService.emailAndNotifyUrging(v);
|
|
|
- }
|
|
|
- });
|
|
|
+ public R complaintForm(@RequestBody Map<String, List<String>> params) {
|
|
|
+ log.info("开发发送催办提醒:{}", params);
|
|
|
+
|
|
|
+ List<String> dataIds;
|
|
|
+ String beanName;
|
|
|
+ if (params.containsKey(SPECIAL_EQUIPMENT)) {
|
|
|
+ beanName = "specialEquipmentUrgingServiceImpl";
|
|
|
+ dataIds = params.getOrDefault(SPECIAL_EQUIPMENT, new ArrayList<>());
|
|
|
+ } else if (params.containsKey(SPECIAL_CERTIFICATE)) {
|
|
|
+ beanName = "specialCertificateUrgingServiceImpl";
|
|
|
+ dataIds = params.getOrDefault(SPECIAL_CERTIFICATE, new ArrayList<>());
|
|
|
+ } else if (params.containsKey(SECURITY_ATTACHMENTS)) {
|
|
|
+ beanName = "securityAttachmentsUrgingServiceImpl";
|
|
|
+ dataIds = params.getOrDefault(SECURITY_ATTACHMENTS, new ArrayList<>());
|
|
|
+ } else {
|
|
|
+ beanName = "";
|
|
|
+ dataIds = new ArrayList<>();
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(beanName) || dataIds == null || dataIds.isEmpty()) {
|
|
|
+ log.error("催办类型不正确:{}或者暂无需要催办的数据:{}", params.keySet(), dataIds);
|
|
|
+ return R.error("当前类型暂不支持催办");
|
|
|
+ }
|
|
|
+ UrgingService urgingService = SpringContextUtils.getBean(beanName);
|
|
|
+ log.error("当前催办类型为:{},需要被催办的数据为:{}", beanName, dataIds);
|
|
|
+ return urgingService.emailAndNotifyUrging(dataIds);
|
|
|
}
|
|
|
}
|