Commit 595a5890 authored by 王果's avatar 王果

维修告知接口调整

parent 372a120b
......@@ -174,4 +174,7 @@ public class JgMaintainNoticeDto extends BaseDto {
@ApiModelProperty(value = "街道名字")
private String streetName;
@ApiModelProperty(value = "告知单PDF URL")
private String noticeReportUrl;
}
......@@ -280,4 +280,17 @@ public class JgMaintainNotice extends BaseEntity {
*/
@TableField(value = "factory_use_site_street")
private String factoryUseSiteStreet;
/**
* 告知单PDF URL
*/
@TableField("notice_report_url")
private String noticeReportUrl;
/**
* 告知单PDF URL
*/
@TableField(value = "promoter")
private String promoter;
}
......@@ -33,4 +33,6 @@ public interface JgMaintainNoticeMapper extends CustomBaseMapper<JgMaintainNotic
*/
@MapKey("sequenceNbr")
List<Map<String, Object>> queryEquipInformation(@Param("sequenceNbr") long sequenceNbr);
void updatePromoter(@Param("id")Long id);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper">
<update id="updatePromoter">
UPDATE tzs_jg_maintain_notice set promoter = null
where sequence_nbr = #{id}
</update>
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice">
select
......@@ -20,9 +24,11 @@
tjmn.street,
tjmn.maintain_type,
tjmn.plan_date,
tjmn.notice_report_url,
tjmn.province_name AS provinceName,
tjmn.city_name AS cityName,
tjmn.county_name AS countyName,
tjmn.promoter,
tjmn.instance_id AS instanceId
FROM
tzs_jg_maintain_notice tjmn
......@@ -44,14 +50,17 @@
<if test="param.noticeStatus != null and param.noticeStatus != ''">
AND tjmn.notice_status = #{param.noticeStatus}
</if>
<if test="param.maintainType != null and param.maintainType != ''">
AND tjmn.maintain_type = #{param.maintainType}
</if>
</if>
<if test="type == 'supervision'">
AND (tjmn.notice_status in ('6612', '6613', '6614') or tjmn.status in('6614') )
AND tjmn.receive_org_credit_code = #{orgCode}
</if>
<if test="type == 'enterprise'">
AND tjmn.install_unit_credit_code = #{orgCode}
</if>
<!-- <if test="type == 'supervision'">-->
<!-- AND (tjmn.notice_status in ('6612', '6613', '6614') or tjmn.status in('6614') )-->
<!-- AND tjmn.receive_org_credit_code = #{orgCode}-->
<!-- </if>-->
<!-- <if test="type == 'enterprise'">-->
<!-- AND tjmn.install_unit_credit_code = #{orgCode}-->
<!-- </if>-->
</where>
ORDER BY
tjmn.notice_date DESC
......@@ -70,15 +79,17 @@
tjmn.province,
tjmn.city,
tjmn.county,
tjmn.factory_use_site_street,
tjmn.street_name,
tjmn.factory_use_site_street AS factoryUseSiteStreet,
tjmn.street_name AS streetName,
tjmn.street,
tjmn.maintain_type,
tjmn.plan_date,
tjmn.maintain_type AS maintainType,
tjmn.plan_date AS planDate,
tjmn.notice_report_url AS noticeReportUrl,
tjmn.province_name AS provinceName,
tjmn.city_name AS cityName,
tjmn.county_name AS countyName,
tjmn.instance_id AS instanceId,
tjmn.promoter,
ri.equ_list AS equList,
ri.equ_category AS equCategory,
ri.EQU_DEFINE AS equDefine,
......
......@@ -34,6 +34,7 @@ public class JgMaintainByWorkFlowController {
@Autowired
JgMaintainNoticeServiceImpl jgMaintainNoticeServiceImpl;
private static final String TABLE_PAGE_ID = "1734141426742095873";
// /**
// * 提交
// *
......@@ -57,7 +58,7 @@ public class JgMaintainByWorkFlowController {
@PostMapping(value = "/cancel")
@ApiOperation(httpMethod = "POST", value = "维修告知撤销", notes = "维修告知撤销")
public ResponseModel<JgMaintainNoticeDto> cancel(@RequestBody Map<String, Object> model) {
JgMaintainNoticeDto maintainInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get("maintainInfo")), JgMaintainNoticeDto.class, true);
JgMaintainNoticeDto maintainInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get(TABLE_PAGE_ID)), JgMaintainNoticeDto.class, true);
if (Objects.isNull(maintainInfo)) {
throw new IllegalArgumentException("参数maintainInfo不能为空");
}
......@@ -76,7 +77,7 @@ public class JgMaintainByWorkFlowController {
public ResponseModel<JgMaintainNoticeDto> accept(@RequestBody Map<String, Object> model, String op) {
// TODO 受理维修告知流程
LinkedHashMap model1 = (LinkedHashMap) model.get("model");
LinkedHashMap maintainInfo = (LinkedHashMap) model1.get("maintainInfo");
LinkedHashMap maintainInfo = (LinkedHashMap) model1.get(TABLE_PAGE_ID);
JgMaintainNoticeDto jgMaintainNoticeDto = JSON.parseObject(JSON.toJSONString(maintainInfo), JgMaintainNoticeDto.class);
jgMaintainNoticeServiceImpl.accept(jgMaintainNoticeDto, op);
return ResponseHelper.buildResponse(null);
......
......@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile;
import com.yeejoin.amos.boot.module.jg.api.dto.JgMaintainNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice;
......@@ -22,7 +24,6 @@ import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.SupervisoryCodeInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
......@@ -45,12 +46,14 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.text.ParseException;
import java.util.*;
import java.util.function.Function;
......@@ -79,13 +82,19 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
private ICreateCodeService iCreateCodeService;
@Autowired
RegistrationInfoMapper tzsJgRegistrationInfoMapper;
@Autowired
OtherInfoMapper tzsJgOtherInfoMapper;
@Autowired
TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
SupervisoryCodeInfoMapper supervisoryCodeInfoMapper;
@Autowired
RedisUtils redisUtils;
public static byte[] file2byte(File file) {
try {
FileInputStream in = new FileInputStream(file);
......@@ -110,9 +119,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
public Map<String, Map<String, Object>> queryBySequenceNbr(Long sequenceNbr) {
// 维修告知信息
JgMaintainNotice notice = jgMaintainNoticeMapper.selectById(sequenceNbr);
if (Objects.isNull(notice)) {
if (Objects.isNull(notice))
return null;
}
Map<String, Object> maintainInfo = BeanUtil.beanToMap(notice);
maintainInfo.put("powerOfAttorneyList", JSON.parseArray(notice.getPowerOfAttorney()));
maintainInfo.put("constructionContractList", JSON.parseArray(notice.getConstructionContract()));
......@@ -128,22 +136,19 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if (!ValidationUtil.isEmpty(notice.getStreet()) && !ValidationUtil.isEmpty(notice.getStreetName())) {
maintainInfo.put("street", notice.getStreet() + "_" + notice.getStreetName());
}
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard",
"productQualityYieldProve", "insUseMaintainExplain", "inspectReport",
"proxyStatementAttachment", "installContractAttachment"};
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard", "productQualityYieldProve",
"insUseMaintainExplain", "inspectReport", "proxyStatementAttachment", "installContractAttachment"};
// 设备信息
List<Map<String, Object>> equipmentInfos = jgMaintainNoticeMapper.queryEquipInformation(sequenceNbr);
for (String s : fields) {
if (maintainInfo.containsKey(s)) {
if (maintainInfo.containsKey(s))
maintainInfo.put(s, JSON.parseArray(maintainInfo.get(s).toString()));
}
if (equipmentInfos.get(0).containsKey(s)) {
if (equipmentInfos.get(0).containsKey(s))
equipmentInfos.get(0).put(s, JSON.parseArray(equipmentInfos.get(0).get(s).toString()));
}
}
return new HashMap<String, Map<String, Object>>() {{
this.put(TABLE_PAGE_ID, maintainInfo);
this.put("equipmentInfo", equipmentInfos.get(0));
put(TABLE_PAGE_ID, maintainInfo);
put("equipmentInfo", equipmentInfos.get(0));
}};
}
......@@ -154,9 +159,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
*/
@SuppressWarnings({"rawtypes", "Duplicates"})
public JgMaintainNoticeDto updateMaintainNotice(String submitType, JgMaintainNoticeDto noticeDto, String op) {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType))
throw new IllegalArgumentException("参数不能为空");
}
// 字段转换
this.convertField(noticeDto);
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
......@@ -171,7 +175,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
noticeDto.setInstanceId(instanceId);
} catch (Exception e) {
log.error("提交失败:{}", e);
log.error("JgMaintainNoticeServiceImpl.updateMaintainNotice启动失败:{}", e);
}
}
ajaxResult = Workflow.taskClient.getTask(noticeDto.getInstanceId());
......@@ -196,7 +200,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
jgMaintainNoticeMapper.updateById(bean);
}
} catch (Exception e) {
log.error("提交失败:{}", e);
log.error("JgMaintainNoticeServiceImpl.updateMaintainNotice执行失败:{}", e);
}
} else {
JgMaintainNotice bean = new JgMaintainNotice();
......@@ -218,7 +222,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@Override
public Page<JgMaintainNoticeDto> queryForJgMaintainNoticePage(Page<JgMaintainNotice> page, JgMaintainNoticeDto model, String type, ReginParams reginParams) {
String orgCode;
orgCode = reginParams.getCompany().getOrgCode();
orgCode = reginParams.getCompany().getCompanyCode();
Page<JgMaintainNotice> noticePage = jgMaintainNoticeMapper.queryForPage(page, model, type, orgCode);
Page<JgMaintainNoticeDto> noticeDtoPage = new Page<>();
BeanUtils.copyProperties(noticePage, noticeDtoPage, "records");
......@@ -277,19 +281,14 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
*/
@Override
public String generateMaintainNoticeReport(Long sequenceNbr) {
if (Objects.isNull(sequenceNbr)) {
if (Objects.isNull(sequenceNbr))
throw new IllegalArgumentException("参数不能为空");
}
JgMaintainNotice jgMaintainNotice = this.getById(sequenceNbr);
List<Map<String, Object>> informationList = jgMaintainNoticeMapper.queryEquipInformation(sequenceNbr);
if (Objects.isNull(jgMaintainNotice) || CollectionUtils.isEmpty(informationList)) {
if (Objects.isNull(jgMaintainNotice) || CollectionUtils.isEmpty(informationList))
throw new IllegalArgumentException("维修告知单不存在");
}
Map<String, Object> maintain = informationList.get(0);
Function<String, String> getValue = key -> maintain.getOrDefault(key, "").toString();
// 组装模板变量
Map<String, Object> placeholders = new HashMap<>();
placeholders.put("sequenceNbr", getValue.apply("sequenceNbr"));
......@@ -297,18 +296,18 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
placeholders.put("applyNo", getValue.apply("applyNo"));
placeholders.put("productName", getValue.apply("productName"));
placeholders.put("equipType", getValue.apply("equType"));
// placeholders.put("equipCode", getValue.apply("equRegisterCode"));
placeholders.put("equipCode", "");
placeholders.put("produceCode", getValue.apply("produceCode")); // TODO: 制造编号
placeholders.put("produceUnitName", getValue.apply("produceUnitName"));
placeholders.put("produceLicenseNum", getValue.apply("produceLicenseNum"));
placeholders.put("fullAddress", getValue.apply("provinceName") + getValue.apply("cityName") + getValue.apply("countyName") + getValue.apply("address"));
// placeholders.put("installStartDate", getValue.apply("installStartDate"));
// placeholders.put("installType", getValue.apply("installType")); // TODO: 施工类别
// placeholders.put("installLicenseNo", getValue.apply("installLicenseNo"));
// placeholders.put("installLicenseExpirationDate", getValue.apply("installLicenseExpirationDate"));
// placeholders.put("installLeaderName", getValue.apply("installLeaderName"));
// placeholders.put("installLeaderPhone", getValue.apply("installLeaderPhone"));
// placeholders.put("installUnitAddress", getValue.apply("installUnitAddress")); // TODO: 施工单位地址
placeholders.put("installStartDate", "");
placeholders.put("installType", "");
placeholders.put("installLicenseNo", "");
placeholders.put("installLicenseExpirationDate", "");
placeholders.put("installLeaderName", "");
placeholders.put("installLeaderPhone", "");
placeholders.put("installUnitAddress", "");
placeholders.put("useUnitName", getValue.apply("useUnitName"));
placeholders.put("useUnitLeaderName", getValue.apply("safetyManager"));
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
......@@ -316,31 +315,25 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
// 生成二维码
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
// word转pdf
// File pdfFile;
// try {
// pdfFile = this.wordToPdf("installation-notification-report.ftl", placeholders);
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
//
// // 上传pdf至文件服务器
// String url = this.uploadFile(pdfFile);
//
// // 删除临时文件
// try {
// Files.deleteIfExists(pdfFile.toPath());
// } catch (IOException e) {
// log.error("删除临时文件失败:{}", e);
// }
// 更新到数据库
// jgMaintainNotice.setNoticeReportUrl(url);
// this.updateById(jgMaintainNotice);
// return url;
return "";
File pdfFile;
try {
pdfFile = this.wordToPdf("installation-notification-report.ftl", placeholders);
} catch (Exception e) {
throw new RuntimeException(e);
}
// 上传pdf至文件服务器
String url = this.uploadFile(pdfFile);
// 删除临时文件
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (IOException e) {
log.error("JgMaintainNoticeServiceImpl.generateMaintainNoticeReport删除临时文件失败:{}", e);
}
//更新到数据库
jgMaintainNotice.setNoticeReportUrl(url);
this.updateById(jgMaintainNotice);
return url;
}
/**
......@@ -350,11 +343,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
*/
private File wordToPdf(String wordPath, Map<String, Object> placeholders) throws Exception {
Assert.hasText(wordPath, "word文件路径不能为空");
String tempFileName = "维修告知单_" + System.currentTimeMillis() + "_temp.pdf";
WordTemplateUtils instance = WordTemplateUtils.getInstance();
return instance.fillAndConvertDocFile(wordPath, tempFileName, placeholders, SaveFormat.PDF);
}
......@@ -383,23 +373,18 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
JgMaintainNoticeDto model = jgMaintainNoticeDtoMap.get(TABLE_PAGE_ID);
// 字段转换
convertField(model);
// 获取告知设备列表
List<Map<String, Object>> deviceList = model.getDeviceList();
if (CollectionUtils.isEmpty(deviceList)) {
if (CollectionUtils.isEmpty(deviceList))
return;
}
// 获取告知单号
List<String> applyNoList = iCreateCodeService.createApplicationFormCode(ApplicationFormTypeEnum.WXGZ.getCode(), deviceList.size());
if (CollectionUtils.isEmpty(applyNoList)) {
if (CollectionUtils.isEmpty(applyNoList))
return;
}
// 判断当前是否为提交
List<String> instanceIdList = new ArrayList<>();
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程
// ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
for (int i = 0; i < deviceList.size(); i++) {
......@@ -410,7 +395,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
list.add(dto);
}
actWorkflowBatchDTO.setProcess(list);
try {
FeignClientResult result = Workflow.taskV2Client.startByVariableBatch(actWorkflowBatchDTO);
List<Object> returnList = (List<Object>) result.getResult();
......@@ -418,12 +402,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
JSONObject jsonObject = JSON.parseObject(JSONObject.toJSONString(obj));
instanceIdList.add(jsonObject.getString("id"));
}
} catch (Exception e) {
e.printStackTrace();
log.error("JgMaintainNoticeServiceImpl.saveNotice发起流程失败",e);
throw new RuntimeException(e);
}
}
List<JgMaintainNotice> list = new ArrayList<>();
List<JgMaintainNoticeEq> equipList = new ArrayList<>();
deviceList.forEach(obj -> {
......@@ -436,6 +419,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
dto.setNoticeDate(new Date());
dto.setInstallUnitName(reginParams.getCompany().getCompanyName());
dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode());
dto.setPromoter(reginParams.getUserModel().getUserId());
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(applyNo);
if (!CollectionUtils.isEmpty(instanceIdList)) {
......@@ -466,9 +450,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if (!ValidationUtil.isEmpty(model.getConstructionContractList())) {
model.setConstructionContract(JSON.toJSONString(model.getConstructionContractList()));
}
// 分割省市区字段
// 分割省市区街道字段
String province = model.getProvince();
if (!ObjectUtils.isEmpty(province)) {
String[] provinceList = province.split("_");
......@@ -477,7 +459,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
model.setProvinceName(provinceList[1]);
}
}
String city = model.getCity();
if (!ObjectUtils.isEmpty(city)) {
String[] cityList = city.split("_");
......@@ -486,7 +467,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
model.setCityName(cityList[1]);
}
}
String county = model.getCounty();
if (!ObjectUtils.isEmpty(county)) {
String[] countyList = county.split("_");
......@@ -495,7 +475,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
model.setCountyName(countyList[1]);
}
}
String street = model.getStreet();
if (!ObjectUtils.isEmpty(street)) {
String[] streetList = street.split("_");
......@@ -504,7 +483,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
model.setStreetName(streetList[1]);
}
}
// 分割单位
String useUnitId = model.getUseUnitCreditCode();
if (!ObjectUtils.isEmpty(useUnitId)) {
......@@ -514,7 +492,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
model.setUseUnitName(useUnitList[1]);
}
}
// 分割接收机构
String receiveOrgId = model.getReceiveOrgCode();
if (!ObjectUtils.isEmpty(receiveOrgId)) {
String[] receiveOrgIdList = receiveOrgId.split("_");
......@@ -523,7 +501,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
model.setReceiveOrgName(receiveOrgIdList[1]);
}
}
String inspectUnitId = model.getInspectionUnitCreditCode();
if (!ObjectUtils.isEmpty(inspectUnitId)) {
String[] inspectUnitIdList = inspectUnitId.split("_");
......@@ -543,7 +520,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
public boolean submit(JgMaintainNotice notice, String op) {
AjaxResult ajaxResult = Workflow.taskClient.getTask(notice.getInstanceId());
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
......@@ -565,7 +541,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
return false;
}
} catch (Exception e) {
log.error("提交失败:{}", e);
log.error("JgMaintainNoticeServiceImpl.submit提交失败:{}", e);
return false;
}
}
......@@ -581,17 +557,17 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@Transactional
public void accept(JgMaintainNoticeDto dto, String op) {
JgMaintainNotice jgMaintainNotice = this.jgMaintainNoticeMapper.selectById(dto.getSequenceNbr());
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(
RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
// 组装设备注册代码
StringBuffer stringBuffer = new StringBuffer();
String ym = null;
try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
} catch (ParseException e) {
log.error("日期转换失败:{}", e);
log.error("JgMaintainNoticeServiceImpl.accept日期转换失败:{}", e);
}
LambdaQueryWrapper<JgMaintainNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, dto.getSequenceNbr());
JgMaintainNoticeEq jgRelationEquip = jgMaintainNoticeEqMapper.selectOne(queryWrapper);
......@@ -599,12 +575,9 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
// OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord, jgRelationEquip.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(jgMaintainNotice.getCity()).append(ym);
// String equCode = stringBuffer.toString();
// String deviceRegistrationCode = iCreateCodeService.createDeviceRegistrationCode(equCode);
......@@ -613,22 +586,20 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
map.put("countyCode", jgMaintainNotice.getCounty());
map.put("equCategory", tzsJgRegistrationInfo.getEquCategory());
// map.put("isXiXian", jgMaintainNotice.getIsXixian() == null ? "0" : jgMaintainNotice.getIsXixian());
Map<String, Object> mapCode;
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
mapCode = code.getResult();
LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>();
queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode, mapCode.get("superviseCode").toString());
SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3);
supervisoryCodeInfo.setStatus("1");
supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo);
// Map<String, Object> mapCode;
// ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
// mapCode = code.getResult();
// LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>();
// queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode, mapCode.get("superviseCode").toString());
// SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3);
// supervisoryCodeInfo.setStatus("1");
// supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo);
boolean submit = submit(jgMaintainNotice, op);
if (submit) {
if ("0".equals(op)) {
jgMaintainNotice.setPromoter(reginParams.getUserModel().getUserId());
jgMaintainNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.HAVE_PROCESSED.getCode()));
// this.generateMaintainNoticeReport(jgMaintainNotice.getSequenceNbr());
this.generateMaintainNoticeReport(jgMaintainNotice.getSequenceNbr());
// // 更新其他业务表
// tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
// tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
......@@ -640,29 +611,9 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} else {
jgMaintainNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
jgMaintainNotice.setInstanceStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
jgMaintainNoticeMapper.updatePromoter(jgMaintainNotice.getSequenceNbr());
}
jgMaintainNoticeMapper.updateById(jgMaintainNotice);
updateById(jgMaintainNotice);
}
// // 组装监管码
// String division = "";
// if (((XIAN.equals(dto.getCity()) || XIAN_YANG.equals(dto.getCity())) && "1".equals(dto.getIsXixian()))) {
// division = "X";
// } else {
// //生成监管码前缀
// Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), dto.getCounty());
// division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), dto.getCity()).get("code").toString() : divisionMap.get("code").toString();
// }
//
// // 组装96333码
// String prefix = "";
// if (((XIAN.equals(dto.getCity()) || XIAN_YANG.equals(dto.getCity())) && "1".equals(dto.getIsXixian()))) {
// prefix = EquipmentCategoryEnum.XXCSM.getValue();
// } else {
// Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), dto.getCounty());
// prefix = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), dto.getCity()).get("code").toString() : elevatorMap.get("code").toString();
// }
}
}
\ No newline at end of file
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