diff --git a/src/main/java/com/cm/inspection/runnable/taskcheck/v2/TaskCheckSaveRunnable.java b/src/main/java/com/cm/inspection/runnable/taskcheck/v2/TaskCheckSaveRunnable.java index aa3d2cf..9c4d78b 100644 --- a/src/main/java/com/cm/inspection/runnable/taskcheck/v2/TaskCheckSaveRunnable.java +++ b/src/main/java/com/cm/inspection/runnable/taskcheck/v2/TaskCheckSaveRunnable.java @@ -15,6 +15,7 @@ import com.cm.inspection.pojo.dtos.enterprise.checkitem.v2.CheckItemDTO; import com.cm.inspection.pojo.dtos.enterpriseofgridoperator.EnterpriseOfGridOperatorDTO; import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemDTO; import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO; +import com.cm.inspection.service.BaseService; import com.cm.inspection.service.enterprise.IEnterpriseService; import com.cm.inspection.service.enterprise.checkitem.v2.ICheckItemService; import com.cm.inspection.service.enterpriseofgridoperator.IEnterpriseOfGridOperatorService; @@ -129,7 +130,6 @@ public class TaskCheckSaveRunnable implements Runnable { countEnterpriseCheckItem++; } } - dataSourceTransactionManager.commit(transactionStatus); publishMsg.append("\n下发任务企业数量:").append(taskCheckEnterprise.size()); publishMsg.append("\n无检查项企业数量:").append(countNoCheckItems); publishMsg.append("\n行业检查项数量:" + countIndustryCheckItem); @@ -137,6 +137,7 @@ public class TaskCheckSaveRunnable implements Runnable { publishStatus = 1; // 发送通知 sendNotice(taskCheckEnterprise); + dataSourceTransactionManager.commit(transactionStatus); } catch (Exception e) { publishStatus = -1; log.error(e.getMessage(), e); @@ -381,6 +382,10 @@ public class TaskCheckSaveRunnable implements Runnable { notice.put("title", "任务通知"); notice.put("msg", "您有新的任务待处理,请点击查看"); notice.put("target", "GO_TASK"); + notice.put("system", BaseService.SYSTEM_NAME); + notice.put("module", BaseService.MODULE_TASK_V2); + notice.put("menu", BaseService.MENU_TASK_V2); + notice.put("serviceId", taskId); noticeJSONArray.add(notice); noticeJSONObject.put("noticies", noticeJSONArray); @@ -395,7 +400,7 @@ public class TaskCheckSaveRunnable implements Runnable { HttpEntity httpEntity = new HttpEntity<>(noticeJSONObject, httpHeaders); try { - ResponseEntity responseEntity = restTemplate.postForEntity(noticeUrl + "/resource/message/noticewithtarget?access_token={access_token}", httpEntity, String.class, ClientTokenManager.getInstance().getClientToken().getAccessToken()); + ResponseEntity responseEntity = restTemplate.postForEntity(noticeUrl + "/resource/message/noticewithtarget/save?access_token={access_token}", httpEntity, String.class, ClientTokenManager.getInstance().getClientToken().getAccessToken()); String responseBody = responseEntity.getBody(); if (HttpStatus.OK.value() == responseEntity.getStatusCodeValue()) { log.debug("推送成功"); diff --git a/src/main/java/com/cm/inspection/service/BaseService.java b/src/main/java/com/cm/inspection/service/BaseService.java index 33c4953..7c7a01a 100644 --- a/src/main/java/com/cm/inspection/service/BaseService.java +++ b/src/main/java/com/cm/inspection/service/BaseService.java @@ -13,4 +13,9 @@ import com.cm.common.base.AbstractService; * @Version: 1.0 **/ public class BaseService extends AbstractService { + + public static final String SYSTEM_NAME = "inspection"; + public static final String MODULE_TASK_V2 = "task_v2"; + public static final String MENU_TASK_V2 = "list_task_v2"; + } diff --git a/src/main/java/com/cm/inspection/service/taskcheck/v2/impl/TaskCheckServiceImpl.java b/src/main/java/com/cm/inspection/service/taskcheck/v2/impl/TaskCheckServiceImpl.java index 7e6989c..b41105e 100644 --- a/src/main/java/com/cm/inspection/service/taskcheck/v2/impl/TaskCheckServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/taskcheck/v2/impl/TaskCheckServiceImpl.java @@ -88,7 +88,7 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi private DataSourceTransactionManager dataSourceTransactionManager; @Autowired private IUserService userService; - @Value("${notice-url}") + @Value("${api-path.notice-url}") private String noticeUrl; @Override diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 152b722..0b8786e 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -96,6 +96,7 @@ security: api-path: user-center: ${security.oauth2.oauth-server} + notice-url: http://192.168.0.103:7001/usercenter # 访问控制 access-control: @@ -129,6 +130,4 @@ access-control: logging: level: root: error - com.cm: debug - -notice-url: http://192.168.0.103:7001/usercenter \ No newline at end of file + com.cm: debug \ No newline at end of file