From 19f628ee5847f1375e5c20fa91053dc101a7f444 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 26 Apr 2022 09:26:21 +0800 Subject: [PATCH] ... --- .../controller/DemandDataController.java | 4 ---- .../modules/demanData/dao/TDemandDataDao.java | 2 ++ .../listener/DemandDataListener.java | 21 ++++++++++++++++++- .../demanData/service/TDemandDataService.java | 2 ++ .../service/impl/TDemandDataServiceImpl.java | 5 +++++ .../mapper/demanData/TDemandDataDao.xml | 4 ++++ 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java index 671377e0..30589197 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java @@ -13,7 +13,6 @@ import io.renren.modules.activiti.service.ActProcessService; import io.renren.modules.activiti.service.ActRunningService; import io.renren.modules.demanData.dto.TDemandDataDTO; import io.renren.modules.demanData.service.TDemandDataService; -import io.renren.modules.security.user.SecurityUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.codehaus.jackson.map.ObjectMapper; @@ -58,9 +57,6 @@ public class DemandDataController { if (page.getTotal() <= 0) { // return new Result().error("联系管理员添加流程:" + key); } - - logger.info(SecurityUser.getUser().toString()); - logger.info("---------------------------------------------------"); logger.info(JSONObject.toJSONString(tDemandDataDTO)); logger.info("####################################################"); diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/dao/TDemandDataDao.java b/renren-admin/src/main/java/io/renren/modules/demanData/dao/TDemandDataDao.java index 51449071..968af979 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/dao/TDemandDataDao.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/dao/TDemandDataDao.java @@ -14,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper; public interface TDemandDataDao extends BaseDao { void updateInstanceId(String instanceId, Long id); + void updateFlag(Integer flag, Long id); + } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java index b4cb2c29..5893ba61 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.JsonElement; import io.renren.modules.demanData.dto.TDemandDataDTO; +import io.renren.modules.demanData.service.TDemandDataService; import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysRoleDTO; import io.renren.modules.sys.dto.SysUserDTO; @@ -45,6 +46,8 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti private SysRoleUserService sysRoleUserService; @Autowired private SysDeptService sysDeptService; + @Autowired + private TDemandDataService tDemandDataService; @Override public void notify(DelegateExecution execution) throws Exception { @@ -64,12 +67,16 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti logger.error("roleDTOId:" + roleDTO.getId()); final String eventName = delegateTask.getEventName(); switch (eventName) { - case EVENTNAME_CREATE: + case EVENTNAME_CREATE: // 进入节点 create(delegateTask, roleDTO); break; + case EVENTNAME_COMPLETE: // 任务完成后 + complete(delegateTask); + break; default: logger.info("未处理该事件:" + eventName); } + logger.error("----------------------结束能力需求受理者1节点---------------------------"); } /** @@ -129,4 +136,16 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti } } + + private void complete(DelegateTask delegateTask) { + Map kv = delegateTask.getVariables(); + Gson gson = new Gson(); + JsonElement jsonElement = gson.toJsonTree(kv); + TDemandDataDTO demandDataDTO = gson.fromJson(jsonElement, TDemandDataDTO.class); + + if (demandDataDTO != null) { + logger.info(JSONObject.toJSONString(demandDataDTO)); + tDemandDataService.updateFlag(3, demandDataDTO.getId());// 更新状态为已审批通过 + } + } } diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/service/TDemandDataService.java b/renren-admin/src/main/java/io/renren/modules/demanData/service/TDemandDataService.java index ab132089..4024fce2 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/service/TDemandDataService.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/service/TDemandDataService.java @@ -12,4 +12,6 @@ import io.renren.modules.demanData.entity.TDemandDataEntity; */ public interface TDemandDataService extends CrudService { void updateInstanceId(String instanceId, Long id); + + void updateFlag(Integer flag, Long id); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java index c0ea3ca0..5c90f10c 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java @@ -33,4 +33,9 @@ public class TDemandDataServiceImpl extends CrudServiceImpl + + update t_demand_data set flag = #{flag} where id = #{id}; + + \ No newline at end of file