This commit is contained in:
wangliwen 2022-04-26 09:26:21 +08:00
parent 258dcbb57a
commit 19f628ee58
6 changed files with 33 additions and 5 deletions

View File

@ -13,7 +13,6 @@ import io.renren.modules.activiti.service.ActProcessService;
import io.renren.modules.activiti.service.ActRunningService; import io.renren.modules.activiti.service.ActRunningService;
import io.renren.modules.demanData.dto.TDemandDataDTO; import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.service.TDemandDataService; import io.renren.modules.demanData.service.TDemandDataService;
import io.renren.modules.security.user.SecurityUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
@ -58,9 +57,6 @@ public class DemandDataController {
if (page.getTotal() <= 0) { // if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程:" + key); return new Result().error("联系管理员添加流程:" + key);
} }
logger.info(SecurityUser.getUser().toString());
logger.info("---------------------------------------------------"); logger.info("---------------------------------------------------");
logger.info(JSONObject.toJSONString(tDemandDataDTO)); logger.info(JSONObject.toJSONString(tDemandDataDTO));
logger.info("####################################################"); logger.info("####################################################");

View File

@ -14,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
public interface TDemandDataDao extends BaseDao<TDemandDataEntity> { public interface TDemandDataDao extends BaseDao<TDemandDataEntity> {
void updateInstanceId(String instanceId, Long id); void updateInstanceId(String instanceId, Long id);
void updateFlag(Integer flag, Long id);
} }

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import io.renren.modules.demanData.dto.TDemandDataDTO; 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.SysDeptDTO;
import io.renren.modules.sys.dto.SysRoleDTO; import io.renren.modules.sys.dto.SysRoleDTO;
import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.dto.SysUserDTO;
@ -45,6 +46,8 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
private SysRoleUserService sysRoleUserService; private SysRoleUserService sysRoleUserService;
@Autowired @Autowired
private SysDeptService sysDeptService; private SysDeptService sysDeptService;
@Autowired
private TDemandDataService tDemandDataService;
@Override @Override
public void notify(DelegateExecution execution) throws Exception { public void notify(DelegateExecution execution) throws Exception {
@ -64,12 +67,16 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
logger.error("roleDTOId:" + roleDTO.getId()); logger.error("roleDTOId:" + roleDTO.getId());
final String eventName = delegateTask.getEventName(); final String eventName = delegateTask.getEventName();
switch (eventName) { switch (eventName) {
case EVENTNAME_CREATE: case EVENTNAME_CREATE: // 进入节点
create(delegateTask, roleDTO); create(delegateTask, roleDTO);
break; break;
case EVENTNAME_COMPLETE: // 任务完成后
complete(delegateTask);
break;
default: default:
logger.info("未处理该事件:" + eventName); logger.info("未处理该事件:" + eventName);
} }
logger.error("----------------------结束能力需求受理者1节点---------------------------");
} }
/** /**
@ -129,4 +136,16 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
} }
} }
private void complete(DelegateTask delegateTask) {
Map<String, Object> 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());// 更新状态为已审批通过
}
}
} }

View File

@ -12,4 +12,6 @@ import io.renren.modules.demanData.entity.TDemandDataEntity;
*/ */
public interface TDemandDataService extends CrudService<TDemandDataEntity, TDemandDataDTO> { public interface TDemandDataService extends CrudService<TDemandDataEntity, TDemandDataDTO> {
void updateInstanceId(String instanceId, Long id); void updateInstanceId(String instanceId, Long id);
void updateFlag(Integer flag, Long id);
} }

View File

@ -33,4 +33,9 @@ public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDem
public void updateInstanceId(String instanceId, Long id) { public void updateInstanceId(String instanceId, Long id) {
baseDao.updateInstanceId(instanceId, id); baseDao.updateInstanceId(instanceId, id);
} }
@Override
public void updateFlag(Integer flag, Long id) {
}
} }

View File

@ -28,4 +28,8 @@
update t_demand_data set instance_id = #{instanceId} where id = #{id}; update t_demand_data set instance_id = #{instanceId} where id = #{id};
</update> </update>
<update id="updateFlag">
update t_demand_data set flag = #{flag} where id = #{id};
</update>
</mapper> </mapper>