Commit 3ee6943d authored by 刘林's avatar 刘林

fix(jg):历史设备登记添加routePath

parent 27ff2c00
...@@ -49,6 +49,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService; ...@@ -49,6 +49,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis; import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil; import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.common.StringUtil; import com.yeejoin.amos.boot.module.ymt.api.common.StringUtil;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.*; import com.yeejoin.amos.boot.module.ymt.api.enums.*;
...@@ -75,8 +76,10 @@ import org.redisson.api.RedissonClient; ...@@ -75,8 +76,10 @@ import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -94,6 +97,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -94,6 +97,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URLEncoder; import java.net.URLEncoder;
...@@ -137,6 +141,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -137,6 +141,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
private static final String REGION = "REGION"; private static final String REGION = "REGION";
private static final String STREET = "STREET"; private static final String STREET = "STREET";
public static final String carNumber = "carNumber"; public static final String carNumber = "carNumber";
@Value("classpath:/json/urlInfo.json")
private Resource urlInfo;
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
...@@ -3986,7 +3992,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3986,7 +3992,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 历史设备 生成证书管理表记录 & 生成安装 维保等操作记录 // 历史设备 生成证书管理表记录 & 生成安装 维保等操作记录
this.historyEquGenManageRelated(map, jgUseRegistration, registerInfo, idxBizJgFactoryInfo); this.historyEquGenManageRelated(map, jgUseRegistration, registerInfo, idxBizJgFactoryInfo);
String routePath = this.buildTaskModel(jgUseRegistration, map, reginParams);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder() jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(jgUseRegistration.getApplyNo()) .applyNo(jgUseRegistration.getApplyNo())
.businessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName()) .businessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName())
...@@ -3995,6 +4001,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3995,6 +4001,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.approvalUnit(jgUseRegistration.getReceiveOrgName()) .approvalUnit(jgUseRegistration.getReceiveOrgName())
.approvalUnitCode(jgUseRegistration.getReceiveOrgCode()) .approvalUnitCode(jgUseRegistration.getReceiveOrgCode())
.status("正常") .status("正常")
.routePath(routePath)
.changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理") .changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理")
.build()); .build());
} }
...@@ -4012,6 +4019,55 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -4012,6 +4019,55 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} }
} }
public String buildTaskModel(JgUseRegistration jgUseRegistration, JSONObject map, ReginParams reginParams) {
TaskModelDto modelDto = new TaskModelDto();
modelDto.setNextExecuteUser(jgUseRegistration.getNextExecuteUserIds());
modelDto.setPageType("look");
modelDto.setStartUserId(RequestContext.getExeUserId());
modelDto.setStartUser(reginParams.getUserModel().getRealName());
modelDto.setStartUserCompanyName(reginParams.getCompany().getCompanyName());
modelDto.setStartDate(new Date());
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtil.copyProperties(jgUseRegistration, taskMessageDto);
taskMessageDto.setRegType("历史登记");
taskMessageDto.setEQU_LIST_CODE("3000");
taskMessageDto.setAuditStatus(null);
taskMessageDto.setEquipId((String.valueOf(map.get("equipId"))));
modelDto.setModel(taskMessageDto);
// 获取URL配置并匹配对应业务类型和pageType
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
if (CollectionUtils.isEmpty(urlList)) {
throw new IllegalStateException("URL配置未初始化");
}
final String targetType = BusinessTypeEnum.JG_USAGE_REGISTRATION.getCode();
final String targetPageType = modelDto.getPageType();
for (Map urlMap : urlList) {
Object type = urlMap.get("type");
Object pageType = urlMap.get("pageType");
if (Objects.equals(type, targetType) && Objects.equals(pageType, targetPageType)) {
String baseUrl = String.valueOf(urlMap.get("url"));
try {
String queryParams = commonServiceImpl.toQueryParams(modelDto.getModel());
String roleIds = Optional.ofNullable(modelDto.getNextExecuteUser()).orElse("");
return baseUrl.replace("{roleIds}", roleIds)
.replace("{userId}", taskMessageDto.getCreateUserId())
+ "&" + queryParams
+ "&nextExecuteUserIds=" + Optional.ofNullable(modelDto.getExecuteUserIds()).orElse("");
} catch (UnsupportedEncodingException e) {
// 建议记录日志,便于排查问题
log.error("URL参数编码失败", e);
throw new IllegalStateException("构建任务模型URL失败", e);
}
}
}
throw new IllegalStateException("未找到匹配的URL配置项,type=" + targetType + ", pageType=" + targetPageType);
}
/** /**
* 历史设备登记-》更新维保信息 * 历史设备登记-》更新维保信息
*/ */
......
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