Commit 22b50b90 authored by hezhuozhi's avatar hezhuozhi

工作台

parent 8b41f5fc
......@@ -12,6 +12,7 @@ public enum HygfRouthTypeEnum {
*/
HYGF_REPAY("hygf_repayment", "还款"),
HYGF_DZKC("hygf_dzkc", "电站勘察"),
HYGF_DSG("hygf_dsg", "待施工"),
;
private final String code;
......
......@@ -11,6 +11,7 @@ public enum TaskTypeStationEnum {
重置密码("重置密码", "重置密码"),
设置管理员("设置管理员", "设置管理员"),
发货管理("发货管理", "发货管理"),
派工发料("派工发料", "派工发料"),
施工完工("施工完工", "施工完工"),
并网管理("并网管理", "并网管理"),
验收管理("验收管理", "验收管理"),
......
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.Date;
......@@ -26,43 +34,43 @@ public class ToDoTasks extends BaseEntity {
/**
* 任务类型
*/
@TableField("type")
@TableField("type")
private String type;
/**
* 业务id
*/
@TableField("business_id")
@TableField("business_id")
private Long businessId;
/**
* 任务状态
*/
@TableField("state")
@TableField("state")
private String state;
/**
* 用户id
*/
@TableField("amos_user_id")
@TableField("amos_user_id")
private String amosUserId;
/**
* 任务创建时间
*/
@TableField("creation_time")
@TableField("creation_time")
private Date creationTime;
/**
* 完成时间
*/
@TableField("complete_time")
@TableField("complete_time")
private Date completeTime;
/**
* 任务名称
*/
@TableField("task_name")
@TableField("task_name")
private String taskName;
/**
......@@ -77,9 +85,15 @@ public class ToDoTasks extends BaseEntity {
@TableField("route_path")
private String routePath;
/**
*路由地址
*/
@TableField("wx_route_path")
private String wxRoutePath;
public ToDoTasks(String type, Long businessId, String taskName,String orgCode) {
public ToDoTasks(String type, Long businessId, String taskName, String orgCode) {
addOperator();
this.type = type;
this.businessId = businessId;
this.state = "待办";
......@@ -88,7 +102,8 @@ public class ToDoTasks extends BaseEntity {
this.taskName = taskName;
}
public ToDoTasks(String type, Long businessId, String taskName,String orgCode,String routePath) {
public ToDoTasks(String type, Long businessId, String taskName, String orgCode, String routePath,String wxRoutePath) {
addOperator();
this.type = type;
this.businessId = businessId;
this.state = "待办";
......@@ -96,9 +111,11 @@ public class ToDoTasks extends BaseEntity {
this.creationTime = new Date();
this.taskName = taskName;
this.routePath = routePath;
this.wxRoutePath= wxRoutePath;
}
public ToDoTasks(String type, Long businessId) {
addOperator();
this.type = type;
this.businessId = businessId;
this.state = "待办";
......@@ -107,4 +124,15 @@ public class ToDoTasks extends BaseEntity {
public ToDoTasks() {
}
private void addOperator() {
try {
this.recDate = new Date();
this.recUserId = RequestContext.getExeUserId();
this.recUserName = RequestContext.getLoginId();
} catch (Exception e) {
e.printStackTrace();
}
}
}
......@@ -28,4 +28,12 @@ public interface ToDoTasksMapper extends BaseMapper<ToDoTasks> {
*/
List<String> getTodoUserIds(@Param("companyOrgCode") String companyOrgCode, @Param("roleId") String roleId);
/**
* 根据区域公司、角色、经销商获取待办的人员
* @param companyOrgCode
* @param roleId
* @param amosDealerId
* @return
*/
List<String> getTodoUserIdsByAmosDealer(@Param("companyOrgCode") String companyOrgCode, @Param("roleId") String roleId, @Param("amosDealerId") String amosDealerId);
}
......@@ -29,8 +29,8 @@
left join hygf_financing_info hfi on hfi.peasant_household_id = hph.sequence_nbr
<where>
hph.construction_state = '验收完成'
<if test="map.routhPathId != null and map.routhPathId != ''">
and hph.sequence_nbr = #{map.routhPathId}
<if test="params.routhPathId != null and params.routhPathId != ''">
and hph.sequence_nbr = #{params.routhPathId}
</if>
<if test="params.ownersName != null and params.ownersName !=''">
and hph.owners_name like concat('%',#{params.ownersName},'%')
......
......@@ -36,6 +36,20 @@
</if>
</where>
GROUP BY USER_ID;
GROUP BY USER_ID
</select>
<select id="getTodoUserIdsByAmosDealer" resultType="java.lang.String">
SELECT amos_user_id FROM std_user_biz sub
LEFT JOIN hygf_personnel_business hpb ON hpb.foundation_id=sub.sequence_nbr
<where>
sub.role like #{roleId}
and sub.amos_id = #{amosDealerId}
<if test="companyOrgCode != null and companyOrgCode != ''">
and hpb.regional_companies_code like #{companyOrgCode}
</if>
</where>
GROUP BY amos_user_id
</select>
</mapper>
......@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.*;
import com.yeejoin.amos.boot.module.hygf.biz.vo.RouthPathVO;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
......@@ -35,9 +36,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
......
......@@ -171,8 +171,6 @@ public class AcceptanceCheckServiceImpl extends BaseService<AcceptanceCheckDto,A
basicGridAuditingDto.setPeasantHouseholdId(basicGridRecord.getPeasantHouseholdId());
basicGridAuditingDto.setPromoter(RequestContext.getExeUserId());
Sequence sequence = new Sequence();
long auditingSequenceNbr = sequence.nextId();
basicGridAuditingDto.setSequenceNbr(auditingSequenceNbr);
acceptanceCheckAuditingService.createWithModel(basicGridAuditingDto);
update.set(AcceptanceCheck::getInstanceId,basicGridAuditingDto.getInstanceId());
......@@ -193,7 +191,8 @@ public class AcceptanceCheckServiceImpl extends BaseService<AcceptanceCheckDto,A
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(basicGridRecord.getPeasantHouseholdId()));
String routhPath = toDoTasksService.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.验收管理.getCode(), auditingSequenceNbr, taskName, orgCode,routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.验收管理.getCode(), basicGridRecord.getPeasantHouseholdId(), taskName, orgCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksService.addToDoTasksByUserIds(userIds,toDoTasks);
}
......@@ -272,7 +271,8 @@ public class AcceptanceCheckServiceImpl extends BaseService<AcceptanceCheckDto,A
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(basicGridAuditing.getPeasantHouseholdId()));
String routhPath = toDoTasksService.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.验收管理.getCode(), basicGridAuditing.getSequenceNbr(), taskName,orgCode,routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.验收管理.getCode(), basicGridAuditing.getPeasantHouseholdId(), taskName,orgCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksService.completeAndAddToDoTask(userIds,toDoTasks,"");
}
......
......@@ -251,9 +251,6 @@ public class BasicGridAcceptanceServiceImpl extends BaseService<BasicGridAccepta
BeanUtils.copyProperties(workflowResultDto, basicGridAuditingDto);
basicGridAuditingDto.setPeasantHouseholdId(grid.getPeasantHouseholdId());
basicGridAuditingDto.setPromoter(RequestContext.getExeUserId());
Sequence sequence = new Sequence();
long auditingSequenceNbr = sequence.nextId();
basicGridAuditingDto.setSequenceNbr(auditingSequenceNbr);
basicGridAuditingService.createWithModel(basicGridAuditingDto);
update.set(BasicGridRecord::getInstanceId, basicGridAuditingDto.getInstanceId());
......@@ -274,7 +271,8 @@ public class BasicGridAcceptanceServiceImpl extends BaseService<BasicGridAccepta
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(grid.getPeasantHouseholdId()));
String routhPath = toDoTasksService.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.并网管理.getCode(), auditingSequenceNbr, taskName, orgCode,routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.并网管理.getCode(), grid.getPeasantHouseholdId(), taskName, orgCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksService.addToDoTasksByUserIds(userIds,toDoTasks);
}
......@@ -535,7 +533,8 @@ public class BasicGridAcceptanceServiceImpl extends BaseService<BasicGridAccepta
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(basicGridAuditing.getPeasantHouseholdId()));
String routhPath = toDoTasksService.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.并网管理.getCode(), basicGridAuditing.getSequenceNbr(), taskName,orgCode,routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.并网管理.getCode(), basicGridAuditing.getPeasantHouseholdId(), taskName,orgCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksService.completeAndAddToDoTask(userIds,toDoTasks,"");
}
......
......@@ -92,7 +92,8 @@ public class DealerReviewServiceImpl extends BaseService<DealerReviewDto, Dealer
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(dealerReview.getUnitInfoId()));
String routhPath = toDoTasksService.getRouthPath(dealerReview.getNextProcessNode(), routhPathVO);
ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.经销商审核.getCode(), dealerReview.getUnitInfoId(), "经销商"+ name +"待经销商审核", regionalCompaniesCode, routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(dealerReview.getNextProcessNode(), routhPathVO);
ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.经销商审核.getCode(), dealerReview.getUnitInfoId(), "经销商"+ name +"待经销商审核", regionalCompaniesCode, routhPath,wxRouthPath);
String roleId = toDoTasksService.getRoleIdByName("户用光伏-管理员");
List<String> todoUserIds = toDoTasksService.getTodoUserIds(null, roleId);
toDoTasksService.addToDoTasksByUserIds(todoUserIds, toDoTasks);
......
......@@ -234,7 +234,8 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(peasantHousehold.getSequenceNbr()));
String routhPath = toDoTasksService.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.投融资管理.getCode(), peasantHousehold.getSequenceNbr(), taskName, orgCode,routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.投融资管理.getCode(), peasantHousehold.getSequenceNbr(), taskName, orgCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksService.addToDoTasksByUserIds(userIds,toDoTasks);
}
......@@ -382,7 +383,8 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(financingAuditing.getPeasantHouseholdId()));
String routhPath = toDoTasksService.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.投融资管理.getCode(), peasantHousehold.getSequenceNbr(), taskName,orgCode,routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.投融资管理.getCode(), peasantHousehold.getSequenceNbr(), taskName,orgCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksService.completeAndAddToDoTask(userIds,toDoTasks,"");
//节点为待整改时生成整改单
......
......@@ -205,7 +205,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(peasantHousehold.getSequenceNbr()));
String routhPath = toDoTasksServiceImpl.getRouthPath(HygfRouthTypeEnum.HYGF_DZKC.getCode(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.电站勘察.getCode(), peasantHousehold.getSequenceNbr(), "用户"+householdContract.getPartyA()+"电站信息勘察",householdContract.getDealerCode(),routhPath);
String wxRouthPath = toDoTasksServiceImpl.getWxRouthPath(HygfRouthTypeEnum.HYGF_DZKC.getCode(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.电站勘察.getCode(), peasantHousehold.getSequenceNbr(), "用户"+householdContract.getPartyA()+"电站信息勘察",householdContract.getDealerCode(),routhPath,wxRouthPath);
toDoTasksServiceImpl.addToDoTasksByUserIds(todoUserIds,toDoTasks);
ToDoTasks toDoTasks1= new ToDoTasks (TaskTypeStationEnum.合同填报.getCode(), householdContract.getSequenceNbr(), "用户"+householdContract.getPartyA()+"的合同待发起",householdContract.getDealerCode());
......@@ -965,7 +966,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(peasantHousehold.getSequenceNbr()));
String routhPath = toDoTasksServiceImpl.getRouthPath(HygfRouthTypeEnum.HYGF_DZKC.getCode(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.电站勘察.getCode(), peasantHousehold.getSequenceNbr(), "用户"+householdContract.getPartyA()+"电站信息勘察",householdContract.getDealerCode(),routhPath);
String wxRouthPath = toDoTasksServiceImpl.getWxRouthPath(HygfRouthTypeEnum.HYGF_DZKC.getCode(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.电站勘察.getCode(), peasantHousehold.getSequenceNbr(), "用户"+householdContract.getPartyA()+"电站信息勘察",householdContract.getDealerCode(),routhPath,wxRouthPath);
toDoTasksServiceImpl.addToDoTasksByUserIds(todoUserIds,toDoTasks);
ToDoTasks toDoTasks1= new ToDoTasks (TaskTypeStationEnum.合同填报.getCode(), householdContract.getSequenceNbr(), "用户"+householdContract.getPartyA()+"的合同待发起",householdContract.getDealerCode());
......
......@@ -230,15 +230,15 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(powerStation.getSequenceNbr()));
String routhPath = toDoTasksServiceImpl.getRouthPath(powerStation.getNextProcessNode(), routhPathVO);
String wxRouthPath = toDoTasksServiceImpl.getWxRouthPath(powerStation.getNextProcessNode(), routhPathVO);
if (PowerStationNodeEnum.经销商确认.getCode().equals(powerStationNodeEnum.getCode())) {
ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户" + name + "电站勘察待" + powerStationNodeEnum.getName(), peasantHousehold.getDeveloperCode(),routhPath);
ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户" + name + "电站勘察待" + powerStationNodeEnum.getName(), peasantHousehold.getDeveloperCode(),routhPath,wxRouthPath);
List<String> userIds = new ArrayList<>();
userIds.add(peasantHousehold.getDeveloperUserId());
toDoTasksServiceImpl.addToDoTasksByUserIds(userIds, toDoTasks);
}else {
ToDoTasks toDoTasks= new ToDoTasks(TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户" + name + "电站勘察待" + powerStationNodeEnum.getName(), peasantHousehold.getDeveloperCode(),routhPath);
String roleId = toDoTasksServiceImpl.getRoleIdByName(powerStation.getNodeRole());
List<String> todoUserIds = toDoTasksServiceImpl.getTodoUserIds(null, roleId);
ToDoTasks toDoTasks= new ToDoTasks(TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户" + name + "电站勘察待" + powerStationNodeEnum.getName(), peasantHousehold.getDeveloperCode(),routhPath,wxRouthPath);
List<String> todoUserIds = Arrays.asList(Optional.ofNullable(powerStation.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksServiceImpl.completeAndAddToDoTask(todoUserIds, toDoTasks,meg);
}
} else {
......
......@@ -673,9 +673,10 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(model.getSequenceNbr()));
String routhPath = toDoTasksServiceImpl.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.发货管理.getCode(), model.getSequenceNbr(), "下单人"+model.getOrderUser()+"发货待确认",model.getRegionalCompaniesCode(),routhPath);
String wxRouthPath = toDoTasksServiceImpl.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.发货管理.getCode(), model.getSequenceNbr(), "下单人"+model.getOrderUser()+"发货待确认",model.getRegionalCompaniesCode(),routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksServiceImpl.addToDoTasksByUserIds(userIds,toDoTasks);
toDoTasksServiceImpl.completeAndAddToDoTask(userIds,toDoTasks,"");
//提交时 赋值发货时间及订单状态
model.setDeliveryTime(new Date());
model.setDeliveryState(DeliveryStateeEnum.已发货.getName());
......@@ -773,7 +774,8 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(model.getSequenceNbr()));
String routhPath = toDoTasksServiceImpl.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.发货管理.getCode(), model.getSequenceNbr(), "下单人"+model.getOrderUser()+"发货待确认",model.getRegionalCompaniesCode(),routhPath);
String wxRouthPath = toDoTasksServiceImpl.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.发货管理.getCode(), model.getSequenceNbr(), "下单人"+model.getOrderUser()+"发货待确认",model.getRegionalCompaniesCode(),routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksServiceImpl.addToDoTasksByUserIds(userIds,toDoTasks);
}else {
......@@ -1052,7 +1054,8 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(preparationMoney.getSequenceNbr()));
String routhPath = toDoTasksServiceImpl.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.发货管理.getCode(), preparationMoney.getSequenceNbr(), "下单人"+preparationMoney.getOrderUser()+"发货"+preparationMoney.getOrderStatus(),preparationMoney.getRegionalCompaniesCode(),routhPath);
String wxRouthPath = toDoTasksServiceImpl.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.发货管理.getCode(), preparationMoney.getSequenceNbr(), "下单人"+preparationMoney.getOrderUser()+"发货"+preparationMoney.getOrderStatus(),preparationMoney.getRegionalCompaniesCode(),routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksServiceImpl.completeAndAddToDoTask(userIds,toDoTasks,"");
}
......
......@@ -170,9 +170,10 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(repayment.getSequenceNbr()));
String routhPath = toDoTasksService.getRouthPath(HygfRouthTypeEnum.HYGF_REPAY.getCode(), routhPathVO);
ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.还款.getCode(), repayment.getSequenceNbr(), createTaskName(repayment), repayment.getRegionalCompaniesCode(), routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(HygfRouthTypeEnum.HYGF_REPAY.getCode(), routhPathVO);
ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.还款.getCode(), repayment.getSequenceNbr(), createTaskName(repayment), repayment.getRegionalCompaniesCode(), routhPath,wxRouthPath);
String roleId = toDoTasksService.getRoleIdByName("户用光伏-投融");
List<String> todoUserIds = toDoTasksService.getTodoUserIds("%" + repayment.getRegionalCompaniesCode() + "%", roleId);
List<String> todoUserIds = toDoTasksService.getTodoUserIds(repayment.getRegionalCompaniesCode(), roleId);
toDoTasksService.addToDoTasksByUserIds(todoUserIds, toDoTasks);
if (CollectionUtil.isNotEmpty(todoUserIds)){
List<String> todoTelephones = repaymentMapper.getTodoTelephones(todoUserIds);
......
......@@ -304,9 +304,9 @@ public class SurveyInformationServiceImpl
// peasantHousehold.setSurveyOrNot(1);
} else if (OPERATION_TYPE_APPLY.equals(operationType)) {
// 提交审核
submitExamine(peasantHousehold);
ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.电站勘察.getCode(), peasantHousehold.getSequenceNbr());
toDoTasksService.completeToDoTasks(toDoTasks,"");
submitExamine(peasantHousehold);
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
......@@ -444,10 +444,6 @@ public class SurveyInformationServiceImpl
long idsk = peasantHousehold.getSequenceNbr();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
//添加待办
// WorkflowResultDto workflowResultDto = workFlowService.buildWorkFlowInfo(processTaskDTOS).get(0);
// workflowResultDto.setInstanceId(powerStation.getProcessInstanceId());
// commonService.buildTaskModel(commonService.buildTaskModelDto(powerStation, workflowResultDto, BusinessTypeEnum.HYGF_DZ_SH));
} catch (Exception e) {
e.printStackTrace();
log.error("submitExamine error:", e);
......
......@@ -4,10 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.TasksRole;
......@@ -32,13 +30,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -51,46 +47,46 @@ import java.util.stream.Collectors;
* @date 2023-09-08
*/
@Service
public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToDoTasksMapper> implements IToDoTasksService {
public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto, ToDoTasks, ToDoTasksMapper> implements IToDoTasksService {
final static Logger log = LoggerFactory.getLogger(ToDoTasksServiceImpl.class);
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
ToDoTasksMapper toDoTasksMapper;
@Autowired
RedisUtils redisUtils;
@Autowired
UserMessageMapper userMessageMapper;
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
Sequence sequence;
@Value("classpath:/json/hygfRouth.json")
private Resource urlInfo;
final static Logger log = LoggerFactory.getLogger(ToDoTasksServiceImpl.class);
@Value("classpath:/json/wxHygfRouth.json")
private Resource wxUrlInfo;
/**
* 分页查询
*/
public Page<ToDoTasksDto> queryForToDoTasksPage(Page<ToDoTasksDto> page) {
public Page<ToDoTasksDto> queryForToDoTasksPage(Page<ToDoTasksDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<ToDoTasksDto> queryForToDoTasksList() {
return this.queryForList("" , false);
public List<ToDoTasksDto> queryForToDoTasksList() {
return this.queryForList("", false);
}
public IPage<ToDoTasks> queryToDoTasksPageDto(ToDoTasksPageDto dto) {
public IPage<ToDoTasks> queryToDoTasksPageDto(ToDoTasksPageDto dto) {
//列表数据组装
QueryWrapper<ToDoTasks> qw = new QueryWrapper<>();
qw.eq(StringUtils.isNotEmpty(dto.getType()), "type",dto.getType() );
qw.eq(StringUtils.isNotEmpty(dto.getState()), "state",dto.getState() );
qw.eq(StringUtils.isNotEmpty(dto.getAmosUserId()), "amos_user_id",dto.getAmosUserId() );
qw.eq(StringUtils.isNotEmpty(dto.getType()), "type", dto.getType());
qw.eq(StringUtils.isNotEmpty(dto.getState()), "state", dto.getState());
qw.eq(StringUtils.isNotEmpty(dto.getAmosUserId()), "amos_user_id", dto.getAmosUserId());
qw.orderBy(Boolean.TRUE, Boolean.FALSE, "creation_time");
IPage<ToDoTasks> toDoTasksPage = toDoTasksMapper.selectPage(dto, qw);
......@@ -99,41 +95,39 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
@Transactional
@Async
public void completeAndAddToDoTask(List<String> userIds,ToDoTasks toDoTasks,String meg) {
public void completeAndAddToDoTask(List<String> userIds, ToDoTasks toDoTasks, String meg) {
try {
completeToDoTasks(toDoTasks,meg);
addToDoTasksByUserIds(userIds,toDoTasks);
}catch (Exception e){
completeToDoTasks(toDoTasks, meg);
addToDoTasksByUserIds(userIds, toDoTasks);
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("任务更新失败!");
}
}
@Transactional
@Async
public void completeToDoTasks(ToDoTasks toDoTasks,String meg) {
public void completeToDoTasks(ToDoTasks toDoTasks, String meg) {
try {
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, toDoTasks.getType());
wrapper.eq(ToDoTasks::getState, "待办");
wrapper.eq(ToDoTasks::getBusinessId, toDoTasks.getBusinessId());
List<ToDoTasks> doTasks= toDoTasksMapper.selectList(wrapper);
if(CollectionUtils.isNotEmpty(doTasks)){
List<ToDoTasks> doTasks = toDoTasksMapper.selectList(wrapper);
if (CollectionUtils.isNotEmpty(doTasks)) {
for (ToDoTasks doTask : doTasks) {
doTask.setState("已办");
doTask.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTask);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTask).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTask.getType(), doTask.getBusinessId(), doTask.getAmosUserId(), new Date(), doTask.getTaskName()+",此消息已确认."+meg, doTask.getAmosOrgCode());
emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(doTask).getBytes(), 2, false);
UserMessage userMessage = new UserMessage(doTask.getType(), doTask.getBusinessId(), doTask.getAmosUserId(), new Date(), doTask.getTaskName() + ",此消息已确认." + meg, doTask.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2, false);
}
}else {
} else {
log.error("没有查询到待办,不进行更新和发送消息");
}
}catch (Exception e){
e.printStackTrace();
throw new BadRequest("任务更新失败!");
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
......@@ -146,25 +140,24 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
@Async
public void deleteByBusinessIds(List<String> businessIds) {
try {
if(CollectionUtil.isNotEmpty(businessIds)){
if(businessIds.size() < 1000){
if (CollectionUtil.isNotEmpty(businessIds)) {
if (businessIds.size() < 1000) {
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.in(ToDoTasks::getBusinessId,businessIds);
wrapper.in(ToDoTasks::getBusinessId, businessIds);
remove(wrapper);
}else {
} else {
List<List<String>> lists = ListUtils.splitList(businessIds, 1000);
for (List<String> list : lists) {
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.in(ToDoTasks::getBusinessId,list);
wrapper.in(ToDoTasks::getBusinessId, list);
remove(wrapper);
}
}
}else {
} else {
log.error("业务Id为空,不进行删除");
}
}catch (Exception e){
e.printStackTrace();
throw new BadRequest("业务删除失败!");
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
......@@ -172,61 +165,59 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
@Async
public void addToDoTasksByUserIds(List<String> userIds, ToDoTasks toDoTasks) {
try {
if(CollectionUtil.isNotEmpty(userIds)){
if (CollectionUtil.isNotEmpty(userIds)) {
for (String todoUserId : userIds) {
toDoTasks.setAmosUserId(todoUserId);
toDoTasks.setSequenceNbr(sequence.nextId());
toDoTasksMapper.insert(toDoTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(toDoTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName(), toDoTasks.getAmosOrgCode());
emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(toDoTasks).getBytes(), 2, false);
UserMessage userMessage = new UserMessage(toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName(), toDoTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2, false);
}
}else {
} else {
log.error("用户为空,不进行添加待办和发送消息");
}
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("任务添加失败!");
}
}
@Override
@Transactional
public void addToDoTasksByUserId(String userId, ToDoTasks toDoTasks,String meg) {
public void addToDoTasksByUserId(String userId, ToDoTasks toDoTasks, String meg) {
try {
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, toDoTasks.getType());
wrapper.eq(ToDoTasks::getState, "待办");
wrapper.eq(ToDoTasks::getBusinessId, toDoTasks.getBusinessId());
ToDoTasks doTasks= toDoTasksMapper.selectOne(wrapper);
if(doTasks!=null){
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+",此消息已确认."+meg, doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, toDoTasks.getType());
wrapper.eq(ToDoTasks::getState, "待办");
wrapper.eq(ToDoTasks::getBusinessId, toDoTasks.getBusinessId());
ToDoTasks doTasks = toDoTasksMapper.selectOne(wrapper);
if (doTasks != null) {
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(doTasks).getBytes(), 2, false);
UserMessage userMessage = new UserMessage(doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName() + ",此消息已确认." + meg, doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2, false);
}
toDoTasks.setAmosUserId(userId);
toDoTasksMapper.insert(toDoTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(toDoTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName(), toDoTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}catch (Exception e){
e.printStackTrace();
throw new BadRequest("任务添加失败!");
toDoTasks.setAmosUserId(userId);
toDoTasksMapper.insert(toDoTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(toDoTasks).getBytes(), 2, false);
UserMessage userMessage = new UserMessage(toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName(), toDoTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2, false);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
@Override
@Async
public void addToDoTasksByRole(String role, ToDoTasks toDoTasks,String meg) {
public void addToDoTasksByRole(String role, ToDoTasks toDoTasks, String meg) {
//查询该角色的所有人员,按时间倒序排序。缓存,每次按顺序取一个,内存中删除一个,知道分配完,继续查询获取,重新分配。
try {
......@@ -235,16 +226,16 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
wrapper.eq(ToDoTasks::getType, toDoTasks.getType());
wrapper.eq(ToDoTasks::getState, "待办");
wrapper.eq(ToDoTasks::getBusinessId, toDoTasks.getBusinessId());
ToDoTasks doTasks= toDoTasksMapper.selectOne(wrapper);
if(doTasks!=null){
ToDoTasks doTasks = toDoTasksMapper.selectOne(wrapper);
if (doTasks != null) {
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(doTasks).getBytes(), 2, false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成."+meg, doTasks.getAmosOrgCode());
UserMessage userMessage = new UserMessage(doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName() + "已完成." + meg, doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2, false);
}
......@@ -252,86 +243,124 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
synchronized (this) {
if (redisUtils.hasKey("TAKS_" + role)) {
String id = redisUtils.get("TAKS_" + role).toString();
System.out.println(role+"角色人员"+id);
List<TasksRole> listd = toDoTasksMapper.getTasksRole(role,toDoTasks.getAmosOrgCode());
System.out.println(role + "角色人员" + id);
List<TasksRole> listd = toDoTasksMapper.getTasksRole(role, toDoTasks.getAmosOrgCode());
if (listd != null && !listd.isEmpty()) {
List<String> idList=listd.stream().map(TasksRole::getAmosUserId).collect(Collectors.toList());
if(idList.indexOf(id)>-1){
if(idList.indexOf(id)+1>idList.size()-1){
toDoTasks.setAmosUserId(idList.get(0));
redisUtils.set("TAKS_" + role, idList.get(0));
}else{
toDoTasks.setAmosUserId(idList.get(idList.indexOf(id)+1));
redisUtils.set("TAKS_" + role, idList.get(idList.indexOf(id)+1));
}
}else{
List<String> idList = listd.stream().map(TasksRole::getAmosUserId).collect(Collectors.toList());
if (idList.indexOf(id) > -1) {
if (idList.indexOf(id) + 1 > idList.size() - 1) {
toDoTasks.setAmosUserId(idList.get(0));
redisUtils.set("TAKS_" + role, idList.get(0));
} else {
toDoTasks.setAmosUserId(idList.get(idList.indexOf(id) + 1));
redisUtils.set("TAKS_" + role, idList.get(idList.indexOf(id) + 1));
}
} else {
toDoTasks.setAmosUserId(idList.get(0));
redisUtils.set("TAKS_" + role, idList.get(0));
}
}else {
System.out.println(role+"没有此角色人员");
} else {
System.out.println(role + "没有此角色人员");
log.info("没有此角色人员!");
}
} else {
List<TasksRole> listd = toDoTasksMapper.getTasksRole(role,toDoTasks.getAmosOrgCode());
List<TasksRole> listd = toDoTasksMapper.getTasksRole(role, toDoTasks.getAmosOrgCode());
if (listd != null && !listd.isEmpty()) {
List<String> idList=listd.stream().map(TasksRole::getAmosUserId).collect(Collectors.toList());
List<String> idList = listd.stream().map(TasksRole::getAmosUserId).collect(Collectors.toList());
toDoTasks.setAmosUserId(idList.get(0));
redisUtils.set("TAKS_" + role, idList.get(0));
} else {
System.out.println(role+"没有此角色人员");
} else {
System.out.println(role + "没有此角色人员");
log.info("没有此角色人员!");
}
}
toDoTasksMapper.insert(toDoTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(toDoTasks).getBytes(), 2 ,false);
emqKeeper.getMqttClient().publish("TASK_MESSAGE", JSON.toJSONString(toDoTasks).getBytes(), 2, false);
UserMessage userMessage= new UserMessage( toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName()+"待完成", toDoTasks.getAmosOrgCode());
UserMessage userMessage = new UserMessage(toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName() + "待完成", toDoTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
emqKeeper.getMqttClient().publish("MY_MESSAGE", JSON.toJSONString(userMessage).getBytes(), 2, false);
}
}catch(Exception e){
log.info("生成待办任务失败!");
e.printStackTrace();
} catch (Exception e) {
log.info("生成待办任务失败!");
e.printStackTrace();
}
}
}
public String getRoleIdByName(String groupName) {
return toDoTasksMapper.getRoleIdByName(groupName);
}
public List<String> getTodoUserIds(String companyOrgCode, String roleId) {
return toDoTasksMapper.getTodoUserIds(companyOrgCode,roleId);
if (StringUtils.isNotEmpty(companyOrgCode)) {
companyOrgCode = "%" + companyOrgCode + "%";
}
return toDoTasksMapper.getTodoUserIds(companyOrgCode, roleId);
}
/**
* 根据区域公司、角色、经销商获取待办的人员
* @param companyOrgCode
* @param roleId
* @param amosDealerId
* @return
*/
public List<String> getTodoUserIds(String companyOrgCode,String roleId,String amosDealerId){
if (StringUtils.isNotEmpty(companyOrgCode)) {
companyOrgCode = "%" + companyOrgCode + "%";
}
if (StringUtils.isNotEmpty(roleId)) {
roleId = "%" + roleId + "%";
}
return toDoTasksMapper.getTodoUserIdsByAmosDealer(companyOrgCode, roleId,amosDealerId);
}
//获取路由地址
public String getRouthPath(String type,Object model) {
public String getRouthPath(String type, Object model) {
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
String routhPath="";
String urlParams = "";
return getRouthPath(type, urlList, model);
}
//获取微信路由地址
public String getWxRouthPath(String type, Object model) {
List<Map> urlList = JsonUtils.getResourceList(wxUrlInfo);
return getRouthPath(type, urlList, model);
}
private String getRouthPath(String type, List<Map> urlList, Object model) {
String routhPath = "";
try {
urlParams = "&" + toQueryParams(model);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
for (Map map : urlList) {
if (map.get("type").equals(type)) {
routhPath = (map.get("url").toString() + urlParams);
break;
for (Map map : urlList) {
if (map.get("type").equals(type)) {
routhPath = map.get("url").toString();
if (StringUtils.isNotEmpty(routhPath)) {
// 检查 URL 是否已有参数
if (routhPath.contains("?")) {
// 如果 URL 已经包含参数,使用 '&' 来拼接新的参数
routhPath = routhPath + "&" + toQueryParams(model);
} else {
// 如果 URL 没有参数,使用 '?' 来开始拼接
routhPath = routhPath + "?" + toQueryParams(model);
}
}
break;
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return routhPath;
}
private <T> String toQueryParams(T obj) throws UnsupportedEncodingException {
private <T> String toQueryParams(T obj) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
for (Class<?> clazz = obj.getClass(); !clazz.equals(Object.class); clazz = clazz.getSuperclass()) {
......
......@@ -215,6 +215,15 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
}
constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
//新增待办
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(model.getSequenceNbr()));
String routhPath = toDoTasksService.getRouthPath(HygfRouthTypeEnum.HYGF_DSG.getCode(), routhPathVO);
String wxRouthPath = toDoTasksService.getWxRouthPath(HygfRouthTypeEnum.HYGF_DSG.getCode(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.派工发料.getCode(), model.getSequenceNbr(), "有一个派单编号"+model.getWorkOrderNum()+"待施工",model.getRegionCode(),routhPath,wxRouthPath);
String roleId = toDoTasksService.getRoleIdByName("户用光伏-经销商-施工");
List<String> todoUserIds = toDoTasksService.getTodoUserIds(model.getRegionCode(), roleId, String.valueOf(model.getAmosDealerId()));
toDoTasksService.addToDoTasksByUserIds(todoUserIds,toDoTasks);
return model;
}
......@@ -385,13 +394,14 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
String taskName="派工发料提交完成,需处理";
String regionalCompaniesCode="";
if(Objects.nonNull(workOrder)){
taskName="制单人"+workOrder.getPreparer() +"派工单"+ workOrder.getWorkOrderStatus();
taskName="工程负责人"+workOrder.getPreparer() +"派工单"+ WorkOrderEnum.待登记.getCode();
regionalCompaniesCode=workOrder.getRegionCode();
}
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(powerStationConstructionData.getWorkOrderId()));
routhPathVO.setRouthPathId(String.valueOf(powerStationConstructionData.getWorkOrderPowerStationId()));
String routhPath = toDoTasksService.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.施工完工.getCode(), powerStationConstructionData.getWorkOrderPowerStationId(), taskName, regionalCompaniesCode,routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.施工完工.getCode(), powerStationConstructionData.getWorkOrderPowerStationId(), taskName, regionalCompaniesCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksService.addToDoTasksByUserIds(userIds,toDoTasks);
}else {
......@@ -544,13 +554,14 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
String taskName="";
String regionalCompaniesCode="";
if(Objects.nonNull(workOrder)){
taskName="制单人"+workOrder.getPreparer() +"派工单"+ workflowResultDto.getNextNodeName();
taskName="工程负责人"+workOrder.getPreparer() +"派工单"+ workflowResultDto.getNextNodeName();
regionalCompaniesCode=workOrder.getRegionCode();
}
RouthPathVO routhPathVO = new RouthPathVO();
routhPathVO.setRouthPathId(String.valueOf(hygfWorkOrderStationAuditing.getWorkOrderPowerStationId()));
String routhPath = toDoTasksService.getRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.施工完工.getCode(), hygfWorkOrderStationAuditing.getWorkOrderPowerStationId(), taskName,regionalCompaniesCode,routhPath);
String wxRouthPath = toDoTasksService.getWxRouthPath(workflowResultDto.getNextNodeKey(), routhPathVO);
ToDoTasks toDoTasks= new ToDoTasks (TaskTypeStationEnum.施工完工.getCode(), hygfWorkOrderStationAuditing.getWorkOrderPowerStationId(), taskName,regionalCompaniesCode,routhPath,wxRouthPath);
List<String> userIds = Arrays.asList(Optional.ofNullable(workflowResultDto.getNextExecuteUserIds()).orElse("").split(","));
toDoTasksService.completeAndAddToDoTask(userIds,toDoTasks,"");
}
......@@ -938,7 +949,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
up4.eq(HygfOnGrid::getWorkOrderId, workOrderId);
up4.eq(HygfOnGrid::getWorkOrderPowerStationId, workOrderPowerStationId);
HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
//增加整改单数据
List<HygfRectificationOrder> hygfRectificationOrderList= rectificationOrderService.selectForListBySource(String.valueOf(peasantHousehold.getSequenceNbr()), RectificationOrderEnum.并网.getName());
if (CollectionUtil.isNotEmpty(hygfRectificationOrderList)){
......@@ -949,7 +960,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
hygfOnGrid.setEngineeringOrders(engineeringOrders.size()>0?engineeringOrders:null);
hygfOnGrid.setDesignOrders(designOrders.size()>0?designOrders:null);
}
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
......@@ -1017,7 +1028,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
LambdaQueryWrapper<AcceptanceCheck> quv1 = new LambdaQueryWrapper();
quv1.eq(AcceptanceCheck::getPeasantHouseholdId, peasantHouseholdId);
AcceptanceCheck acceptanceCheck = acceptanceCheckMapper.selectOne(quv1);
//增加整改单数据
List<HygfRectificationOrder> hygfRectificationOrderListYs= rectificationOrderService.selectForListBySource(String.valueOf(peasantHousehold.getSequenceNbr()), RectificationOrderEnum.验收.getName());
if (CollectionUtil.isNotEmpty(hygfRectificationOrderListYs)){
......@@ -1430,6 +1441,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
if (list == null || list.isEmpty()) {
upq.set(WorkOrder::getWorkOrderStatus, WorkOrderEnum.已完工.getCode());
workOrderMapper.update(null, upq);
//完成待办
ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.派工发料.getCode(), workOrderPowerStation.getWorkOrderId());
toDoTasksService.completeToDoTasks(toDoTasks,"");
}
......
......@@ -78,10 +78,16 @@
"url": "/mixuap?appId=1677158789557547009&id=1808437079118450689"
},
{
"type": "hygf_dsg",
"pageType": "",
"name": "待施工",
"url": ""
},
{
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "施工完成提交",
"url": "/mixuap?appId=1677158789557547009&id=1742435224567967746"
"url": ""
},
{
"type": "Activity_1spujef",
......@@ -114,7 +120,7 @@
"url": "/mixuap?appId=1678340647909617665&id=1823622039500492802"
},
{
"type": "hygf_bw1",
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "并网登记提交",
"url": "/mixuap?appId=1677158789557547009&id=1747137335817957378"
......@@ -189,7 +195,7 @@
"type": "AuditPass",
"pageType": "",
"name": "放款确认",
"url": "/mixuap?appId=1678340647909617665&id=1831228592361574401"
"url": "/mixuap?appId=1678340647909617665&id=1831226627237875713"
},
{
"type": "hygf_repayment",
......
[
{
"type": "jxs_03",
"pageType": "",
"name": "经销商管理员审核",
"url": ""
},
{
"type": "hygf_dzkc",
"pageType": "",
"name": "电站勘察",
"url": "/view/mine/minepage/PeasantManage"
},
{
"type": "hygf_02",
"pageType": "",
"name": "经销商确认",
"url": "/view/mine/minepage/SurveyList"
},
{
"type": "hygf_03",
"pageType": "",
"name": "设计审核",
"url": "/view/mine/minepage/SurveyListgld"
},
{
"type": "hygf_05",
"pageType": "",
"name": "投融审核",
"url": "/view/mine/minepage/SurveyListgld"
},
{
"type": "hygf_07",
"pageType": "",
"name": "法务审核",
"url": "/view/mine/minepage/SurveyListgld"
},
{
"type": "hygf_09",
"pageType": "",
"name": "设计上传典型图库",
"url": "/view/mine/minepage/SurveyListgld"
},
{
"type": "hygf_10",
"pageType": "",
"name": "经销商设计人员上传设计图",
"url": "/view/mine/minepage/SurveyList"
},
{
"type": "hygf_11",
"pageType": "",
"name": "设计图纸审核",
"url": "/view/mine/minepage/SurveyListgld"
},
{
"type": "fh_dtj",
"pageType": "",
"name": "待发货",
"url": ""
},
{
"type": "fh_dyr",
"pageType": "",
"name": "待确认",
"url": "/view/mine/subPackageA/menus/shippingOrder/shippingOrderList/index"
},
{
"type": "fh_dsh",
"pageType": "",
"name": "待审核",
"url": "/view/mine/subPackageA/menus/shippingOrder/shippingOrderList/index"
},
{
"type": "fh_sqbh",
"pageType": "",
"name": "申请补货",
"url": "/view/mine/subPackageA/menus/shippingOrder/shippingOrderList/index"
},
{
"type": "hygf_dsg",
"pageType": "",
"name": "待施工",
"url": ""
},
{
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "施工完成提交",
"url": "/view/mine/sggl/SgglList"
},
{
"type": "Activity_1spujef",
"pageType": "",
"name": "完工登记提交",
"url": "/view/mine/wgdj/WgdjList"
},
{
"type": "Activity_16r1828",
"pageType": "",
"name": "完工自审",
"url": "/view/mine/wgzs/WgzsList"
},
{
"type": "Activity_1bldcno",
"pageType": "",
"name": "完工自审-片区运营中心",
"url": "/view/mine/subPackageA/menus/constructionAcceptance/index"
},
{
"type": "Activity_1yftt2k",
"pageType": "",
"name": "工程审核",
"url": "/view/mine/subPackageA/menus/constructionAcceptance/index"
},
{
"type": "Activity_095if3p",
"pageType": "",
"name": "设计审核",
"url": "/view/mine/subPackageA/menus/constructionAcceptance/index"
},
{
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "并网登记提交",
"url": "/view/mine/bwgl/BwglList"
},
{
"type": "Activity_0r2x1es",
"pageType": "",
"name": "经销商管理审核",
"url": "/view/mine/bwgl/BwglList"
},
{
"type": "Activity_05nlkey",
"pageType": "",
"name": "片区审核",
"url": "/view/mine/subPackageA/menus/onGridAcceptance/index"
},
{
"type": "Activity_0k4o46e",
"pageType": "",
"name": "设计审核/工程审核",
"url": "/view/mine/subPackageA/menus/onGridAcceptance/index"
},
{
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "验收提交",
"url": "/view/mine/subPackageA/menus/acceptanceCheck/ysgl"
},
{
"type": "Activity_0ojajec",
"pageType": "",
"name": "经销商管理员审核",
"url": "/view/mine/subPackageA/menus/acceptanceCheck/ysgl"
},
{
"type": "Activity_0edftmv",
"pageType": "",
"name": "片区审核",
"url": "/view/mine/subPackageA/menus/acceptanceCheck/index"
},
{
"type": "Activity_1rjn5s1",
"pageType": "",
"name": "投融/法务审核",
"url": "/view/mine/subPackageA/menus/acceptanceCheck/index"
},
{
"type": "Activity_0rbc0gc",
"pageType": "",
"name": "资产审核",
"url": "/view/mine/subPackageA/menus/acceptanceCheck/index"
},
{
"type": "AbarbeitungWaitPush",
"pageType": "",
"name": "推送融资",
"url": "/view/mine/subPackageA/InvestmentAndFinancing/investment/index"
},
{
"type": "WaitAbarbeitung",
"pageType": "",
"name": "经销商重新提交验收/退回建档",
"url": "/view/mine/subPackageA/menus/acceptanceCheck/ysgl"
},
{
"type": "FinancingAudit",
"pageType": "",
"name": "融资审核",
"url": "/view/mine/subPackageA/InvestmentAndFinancing/financing/index"
},
{
"type": "AuditPass",
"pageType": "",
"name": "放款确认",
"url": "/view/mine/subPackageA/InvestmentAndFinancing/investment/index"
},
{
"type": "hygf_repayment",
"pageType": "",
"name": "还款管理",
"url": ""
}
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment