Commit 0fe074d9 authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 3c9ca9f2 2d074da6
......@@ -7,3 +7,5 @@ target/
.settings
log/
amos-boot-system-tzs/.idea/
rebel.xml
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.api.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationReformDto;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 改造变更登记接口类
*
......@@ -8,5 +16,12 @@ package com.yeejoin.amos.boot.module.jg.api.service;
* @date 2023-12-20
*/
public interface IJgChangeRegistrationReformService {
Page<Map<String, Object>> getList(JgChangeRegistrationReformDto dto, Page<Map<String, Object>> page, List<String> roleIds);
void save(JSONObject map);
void updateExecuteIds(String instanceId, Long sequenceNbr, String operate);
void flowExecute(Long id, String instanceId, String operate, String comment);
void withdraw(String instanceId);
void deleteBatch(List<Long> ids);
Map<String, Object> getDetail(String currentDocumentId, String equipId);
void exportUseRegistrationCertificate(String sequenceNbr, HttpServletResponse response);
}
......@@ -99,13 +99,12 @@
fi.factory_standard AS factoryStandard,
fi.product_quality_yield_prove AS productQualityYieldProve,
fi.ins_use_maintain_explain AS insUseMaintainExplain,
ui.safety_manager AS safetyManager,
ei.legal_person AS safetyManager,
ei.legal_phone AS safetyManagerPhone,
ui.CITY_NAME AS useUnitCityName,
ui.COUNTY_NAME AS useUnitCountyName,
ei.ADDRESS AS useUnitAddress,
ei.use_code AS useCode
eio.use_code AS useCode
FROM tzs_jg_maintain_notice isn
LEFT JOIN tzs_jg_maintain_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
......@@ -114,6 +113,7 @@
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equ_id
LEFT JOIN idx_biz_jg_use_info ui ON ui.record = re.equ_id
LEFT JOIN tz_base_enterprise_info ei ON ei.use_code = isn.use_unit_credit_code
LEFT JOIN tz_base_enterprise_info eio ON eio.use_code = isn.install_unit_credit_code
WHERE isn.sequence_nbr = #{sequenceNbr} LIMIT 1
</select>
</mapper>
......@@ -88,8 +88,6 @@
isn.next_execute_ids as nextExecuteIds,
isn.promoter,
isn.notice_status AS noticeStatus,
<!-- isn.install_start_date AS installLicenseExpirationDate,-->
<!-- isn.install_license_no AS installLicenseNo,-->
isn.plan_date AS installStartDate,
isn.construction_manager AS installLeaderName,
isn.construction_manager_phone AS installLeaderPhone,
......@@ -126,16 +124,17 @@
ei.legal_person AS safetyManager,
ei.legal_phone AS safetyManagerPhone,
ei.ADDRESS AS useUnitAddress,
ei.use_code AS useCode
ei2.use_code AS useCode
FROM
tzs_jg_reform_notice isn
LEFT JOIN tzs_jg_reform_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
LEFT JOIN idx_biz_jg_design_info di ON di.record = re.equ_id
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equ_id
LEFT JOIN idx_biz_jg_use_info ui ON ui.record = re.equ_id
LEFT JOIN tz_base_enterprise_info ei ON ei.use_code = isn.use_unit_credit_code
LEFT JOIN tzs_jg_reform_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
LEFT JOIN idx_biz_jg_design_info di ON di.record = re.equ_id
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equ_id
LEFT JOIN idx_biz_jg_use_info ui ON ui.record = re.equ_id
LEFT JOIN tz_base_enterprise_info ei ON ei.use_code = isn.use_unit_credit_code
LEFT JOIN tz_base_enterprise_info ei2 ON ei2.use_code = isn.install_unit_credit_code
WHERE
isn.sequence_nbr = #{sequenceNbr}
LIMIT 1
......
......@@ -25,6 +25,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import javax.servlet.http.HttpServletResponse;
/**
* 改造变更登记
*
......@@ -130,10 +132,9 @@ public class JgChangeRegistrationReformController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "打印历史数据", notes = "打印历史数据")
@GetMapping(value = "/printHistoryData")
public ResponseModel<Map<String, Object>> printHistoryData(@RequestParam("currentDocumentId") String currentDocumentId,@RequestParam(value = "equipId",required = false) String equipId) {
return ResponseHelper.buildResponse(jgChangeRegistrationReformServiceImpl.getDetail(currentDocumentId,equipId));
@GetMapping(value = "/export")
@ApiOperation(httpMethod = "GET", value = "改造登记-导出使用登记证", notes = "改造登记-导出使用登记证")
public void exportImageZip(HttpServletResponse response, @RequestParam("sequenceNbr") String sequenceNbr){
jgChangeRegistrationReformServiceImpl.exportUseRegistrationCertificate(sequenceNbr, response);
}
}
......@@ -78,8 +78,9 @@ public class JgMaintainByWorkFlowController {
// TODO 受理维修告知流程
LinkedHashMap model1 = (LinkedHashMap) model.get("model");
LinkedHashMap maintainInfo = (LinkedHashMap) model1.get(TABLE_PAGE_ID);
String opinion = model.get("opinion").toString();
JgMaintainNoticeDto jgMaintainNoticeDto = JSON.parseObject(JSON.toJSONString(maintainInfo), JgMaintainNoticeDto.class);
jgMaintainNoticeServiceImpl.accept(jgMaintainNoticeDto, op);
jgMaintainNoticeServiceImpl.accept(jgMaintainNoticeDto, op,opinion);
return ResponseHelper.buildResponse(null);
}
}
......@@ -78,8 +78,10 @@ public class JgReformByWorkFlowController {
// TODO 受理改造告知流程
LinkedHashMap model1 = (LinkedHashMap) model.get("model");
LinkedHashMap installationInfo = (LinkedHashMap) model1.get("reformInfo");
JgReformNoticeDto JgReformNoticeDto = JSON.parseObject(JSON.toJSONString(installationInfo), JgReformNoticeDto.class);
jgReformNoticeService.accept(JgReformNoticeDto, op);
String opinion = (String) model.get("opinion");
JgReformNoticeDto jgReformNoticeDto = JSON.parseObject(JSON.toJSONString(installationInfo), JgReformNoticeDto.class);
jgReformNoticeDto.setRemark(opinion);
jgReformNoticeService.accept(jgReformNoticeDto, op);
return ResponseHelper.buildResponse(null);
}
}
......@@ -27,13 +27,11 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.*;
import java.util.stream.Collectors;
......@@ -99,16 +97,20 @@ public class CommonServiceImpl implements ICommonService {
public List<EquipmentCategory> getEquipmentCategoryList(String code, String type) {
List<EquipmentCategory> result = new ArrayList<>();
LambdaQueryWrapper<EquipmentCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EquipmentCategory::getCode, code);
EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectOne(wrapper);
if (ObjectUtils.isEmpty(type)) {
result.add(equipmentCategory);
if(!ValidationUtil.isEmpty(equipmentCategory)){
result.add(equipmentCategory);
}
} else {
LambdaQueryWrapper<EquipmentCategory> wrapper2 = new LambdaQueryWrapper<>();
wrapper2.eq(EquipmentCategory::getParentId, equipmentCategory.getId());
result = equipmentCategoryMapper.selectList(wrapper2);
List<EquipmentCategory> equipmentCategories = equipmentCategoryMapper.selectList(wrapper2);
if(!ValidationUtil.isEmpty(equipmentCategories)){
result = equipmentCategories;
}
}
return result;
}
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
......@@ -12,17 +13,13 @@ import com.yeejoin.amos.boot.module.jg.api.enums.ConstructionEnum;
import com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgConstructionInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgInspectionDetectionInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgMainPartsDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgMaintenanceRecordInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProtectionDevicesDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgRegisterInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.commons.collections.CollectionUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
......@@ -30,7 +27,6 @@ import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.recycler.Recycler;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
......@@ -69,13 +65,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private static final String EQUDEFINE = "EQU_DEFINE";
private static final String EQUDEFINECODE = "EQU_DEFINE_CODE";
/**
* levlel=company,是企业,如果不是都是监管单位,
* * 在接口中查询当前登录人所属单位是监管单位还是企业。
* * 如果为监管单位添加监管机构查询参数(ORG_BRANCH_CODE);
* * 如果为企业添加使用单位查询参数(USE_UNIT_CREDIT_CODE)
*/
private static final String LEVEL = "company";
// 新增修改标识
private static final String OPERATESAVE = "save";
private static final String OPERATEEDIT = "edit";
......@@ -123,6 +112,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired
private SuperviseInfoMapper superviseInfoMapper;
/**
* 设备注册信息
*
......@@ -541,53 +531,32 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//获取当前登录人单位类型
JSONObject company = getCompanyType();
if (ValidationUtil.isEmpty(company)) {
result.setRecords(new ArrayList<>());
result.setTotal(0);
return result;
}
String companyCode = company.getString("companyCode").contains("_") ?
company.getString("companyCode").split("_")[1] : company.getString("companyCode");
String type = company.getString("companyType");
if (ValidationUtil.isEmpty(type) || ValidationUtil.isEmpty(companyCode)) {
result.setRecords(new ArrayList<>());
result.setTotal(0);
return result;
}
//根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString());
}
//获取当前登录人单位类型
List<JSONObject> companyType = getCompanyType();
if (!ValidationUtil.isEmpty(companyType)) {
JSONObject object = getCompanyType().get(0);
String level = object.getString("level");
String code = object.getString("orgCode");
String companyCode = object.getString("companyCode").contains("_") ?
object.getString("companyCode").split("_")[1] : object.getString("companyCode");
String type = object.getString("companyType");
// 根据当前登录用户类型及管辖机构筛选条件添加对应参数
if (!ValidationUtil.isEmpty(level)) {
if (LEVEL.equals(level)) {
//企业
if (!ValidationUtil.isEmpty(type) && ValidationUtil.equals(type, "使用单位")) {
map.put("USE_UNIT_CREDIT_CODE", companyCode);
} else if (!ValidationUtil.isEmpty(type) && ValidationUtil.equals(type, "安装改造维修单位")) {
map.put("USC_UNIT_CREDIT_CODE", companyCode);
}
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("ORG_BRANCH_CODE"));
query.must(QueryBuilders.matchPhrasePrefixQuery("ORG_BRANCH_CODE", test));
boolMust.must(query);
}
} else {
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
String paramCode = map.getString("ORG_BRANCH_CODE");
if (paramCode.contains(code)) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("ORG_BRANCH_CODE"));
query.must(QueryBuilders.matchPhrasePrefixQuery("ORG_BRANCH_CODE", test));
boolMust.must(query);
} else {
return result;
}
} else {
//监管单位
map.put("ORG_BRANCH_CODE", code);
}
}
}
// 根据当前登录用户类型及管辖机构筛选条件添加对应参数
if (!ValidationUtil.isEmpty(type) && ValidationUtil.equals(type, "使用单位")) {
map.put("USE_UNIT_CREDIT_CODE", companyCode);
} else if (!ValidationUtil.isEmpty(type) && ValidationUtil.equals(type, "安装改造维修单位")) {
map.put("USC_UNIT_CREDIT_CODE", companyCode);
}
// 默认条件【STATUS==="" || null】
......@@ -732,23 +701,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*
* @return
*/
public List<JSONObject> getCompanyType() {
public JSONObject getCompanyType() {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<CompanyModel> companys = reginParams.getUserModel().getCompanys();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
CompanyBo company = reginParams.getCompany();
List<JSONObject> objectList = new ArrayList<>();
if (!ValidationUtil.isEmpty(companys)) {
for (CompanyModel company : companys) {
JSONObject object = new JSONObject();
object.put("level", company.getLevel());
object.put("orgCode", company.getOrgCode());
object.put("companyCode", company.getCompanyCode());
object.put("companyType", company.getCompanyType());
objectList.add(object);
JSONObject object = new JSONObject();
if (!ValidationUtil.isEmpty(company)) {
object.put("level", company.getLevel());
object.put("orgCode", company.getOrgCode());
object.put("companyCode", company.getCompanyCode());
CompanyModel result = Privilege.companyClient.queryByCompanyCode(company.getCompanyCode()).getResult();
if(!ValidationUtil.isEmpty(result)){
object.put("companyType", result.getCompanyType());
}
}
return objectList;
return object;
}
private String batchSubmitOrUpdate(Map<String, Object> map) {
......
......@@ -15,13 +15,13 @@ import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationReformService;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationReformDto;
import com.yeejoin.amos.boot.module.jg.api.service.IJgRegistrationHistoryService;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsElevator;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
......@@ -30,15 +30,20 @@ import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
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.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
......@@ -51,15 +56,22 @@ import java.util.stream.Collectors;
@Service
public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeRegistrationReformDto, JgChangeRegistrationReform, JgChangeRegistrationReformMapper> implements IJgChangeRegistrationReformService {
@Autowired
IIdxBizJgRegisterInfoService idxBizJgRegisterInfoService;
@Autowired
WorkFlowFeignService workFlowFeginService;
@Autowired
TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
RedisUtils redisUtils;
@Autowired
ICommonService commonService;
@Autowired
private IIdxBizJgUseInfoService useInfoService;
@Autowired
private IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
@Autowired
private IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired
private IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
@Autowired
private UseInfoMapper useInfoMapper;
@Autowired
private InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
......@@ -88,6 +100,8 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
//更名变更登记关系表mapper
@Autowired
private JgChangeRegistrationNameEqMapper jgChangeRegistrationNameEqMapper;
@Autowired
private IJgRegistrationHistoryService jgRegistrationHistoryService;
/**
* 分页查询
......@@ -106,9 +120,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
UseInfo useInfo = new UseInfo();
BeanUtil.copyProperties(map, useInfo);
String equipId = map.get("record").toString();
String equipId = map.get("record").toString();
LambdaQueryWrapper<UseInfo> lambda = new QueryWrapper<UseInfo>().lambda();
lambda.eq(UseInfo::getRecord,equipId);
lambda.eq(UseInfo::getRecord, equipId);
// 更新使用信息
useInfoMapper.update(useInfo, lambda);
InspectionDetectionInfo inspectionDetectionInfo = new InspectionDetectionInfo();
......@@ -126,10 +140,10 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReform.setSupervisoryCode(supervisoryCode);
jgChangeRegistrationReform.setUseUnitName(useInfo.getUseUnitName());
jgChangeRegistrationReform.setUseUnitCreditCode(useInfo.getUseUnitCreditCode());
if(!ObjectUtils.isEmpty(map.get("transformationQualityCertificate"))){
if (!ObjectUtils.isEmpty(map.get("transformationQualityCertificate"))) {
jgChangeRegistrationReform.setTransformationQualityCertificate(JSONObject.toJSONString(map.get("transformationQualityCertificate")));
}
if(!ObjectUtils.isEmpty(map.get("renovationSupervisioninspectionCertificate"))) {
if (!ObjectUtils.isEmpty(map.get("renovationSupervisioninspectionCertificate"))) {
jgChangeRegistrationReform.setRenovationSupervisioninspectionCertificate(JSONObject.toJSONString(map.get("renovationSupervisioninspectionCertificate")));
}
// 使用单位提交
......@@ -145,7 +159,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReform.setInspectUnitName(reginParams.getCompany().getCompanyName());
}
if (map.containsKey("receiveCompanyCode")) {
String receiveCompanyCode = String.valueOf(map.getString("receiveCompanyCode"));
String receiveCompanyCode = String.valueOf(map.getString("receiveCompanyCode"));
jgChangeRegistrationReform.setReceiveCompanyCode(receiveCompanyCode);
jgChangeRegistrationReform.setReceiveOrgCode(receiveCompanyCode.split("_")[0]);
jgChangeRegistrationReform.setReceiveOrgName(receiveCompanyCode.split("_")[1]);
......@@ -181,11 +195,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
// 业务管理设备信息保存
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = new JgChangeRegistrationReformEq();
jgChangeRegistrationReformEq.setEquId(equipId);
ResponseModel<List<String>> result =tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.GZBG.getCode(), 1);
if(!result.getResult().isEmpty()){
ResponseModel<List<String>> result = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.GZBG.getCode(), 1);
if (!result.getResult().isEmpty()) {
jgChangeRegistrationReform.setApplyNo(result.getResult().get(0));
}else {
throw new BadRequest("申请单编号生成失败,请稍后重试!");
} else {
throw new BadRequest("申请单编号生成失败,请稍后重试!");
}
jgChangeRegistrationReform.setAuditStatus(WorkFlowStatusEnum.CHANGE_SUBMIT.getPass());
jgChangeRegistrationReform.setStatus(WorkFlowStatusEnum.CHANGE_SUBMIT.getPass());
......@@ -287,7 +301,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = jgChangeRegistrationReformEqMapper.selectOne(new QueryWrapper<JgChangeRegistrationReformEq>().eq("equip_transfer_id", jgChangeRegistrationReform.getSequenceNbr()));
String newUseRegistrationCertificateNumber = getCode(jgChangeRegistrationReform.getSupervisoryCode());
jgChangeRegistrationReform.setUseRegistrationCode(newUseRegistrationCertificateNumber);
updateTechparamsByEquIdAndCurrentDoucumentId(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform.getSequenceNbr().toString(),newUseRegistrationCertificateNumber,jgChangeRegistrationReform.getApplyNo() );
updateTechparamsByEquIdAndCurrentDoucumentId(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform.getSequenceNbr().toString(), newUseRegistrationCertificateNumber, jgChangeRegistrationReform.getApplyNo());
}
this.getBaseMapper().updateById(jgChangeRegistrationReform);
}
......@@ -428,8 +442,8 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
}
public void deleteBatch(List<Long> ids) {
List<JgChangeRegistrationReform> jgChangeRegistrationReformList = this.getBaseMapper().selectList(new QueryWrapper<JgChangeRegistrationReform>().in("sequence_nbr", ids));
List<String> applyNos =jgChangeRegistrationReformList.stream().map(JgChangeRegistrationReform::getApplyNo).collect(Collectors.toList());
List<JgChangeRegistrationReform> jgChangeRegistrationReformList = this.getBaseMapper().selectList(new QueryWrapper<JgChangeRegistrationReform>().in("sequence_nbr", ids));
List<String> applyNos = jgChangeRegistrationReformList.stream().map(JgChangeRegistrationReform::getApplyNo).collect(Collectors.toList());
JgChangeRegistrationReform jgChangeRegistrationReform = new JgChangeRegistrationReform();
jgChangeRegistrationReform.setIsDelete(true);
LambdaQueryWrapper<JgChangeRegistrationReform> lambda = new QueryWrapper<JgChangeRegistrationReform>().lambda();
......@@ -445,7 +459,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
public Map<String, Object> getDetail(String currentDocumentId, String equipId) {
JgChangeRegistrationReform jgChangeRegistrationReform = this.getBaseMapper().selectById(currentDocumentId);
if(ObjectUtils.isEmpty(equipId)){
if (ObjectUtils.isEmpty(equipId)) {
equipId = jgChangeRegistrationReformEqMapper.selectEquipId(currentDocumentId);
}
Map<String, Object> detail = JSONObject.parseObject(JSONObject.toJSONString(jgChangeRegistrationReform), Map.class);
......@@ -454,10 +468,10 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
if ((detail.get("status").equals("已完成") || detail.get("status").equals("流程结束"))) {
originalData = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equipId);
originalData.remove("sequenceNbr");
if(!ObjectUtils.isEmpty(detail.get("transformationQualityCertificate"))){
if (!ObjectUtils.isEmpty(detail.get("transformationQualityCertificate"))) {
detail.put("transformationQualityCertificate", JSONObject.parse(detail.get("transformationQualityCertificate").toString()));
}
if(!ObjectUtils.isEmpty(detail.get("renovationSupervisioninspectionCertificate"))){
if (!ObjectUtils.isEmpty(detail.get("renovationSupervisioninspectionCertificate"))) {
detail.put("renovationSupervisioninspectionCertificate", JSONObject.parse(detail.get("renovationSupervisioninspectionCertificate").toString()));
}
} else {
......@@ -495,7 +509,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
* @param equipId
* @param currentDocumentId
*/
public void updateTechparamsByEquIdAndCurrentDoucumentId(String equipId, String currentDocumentId, String newUseRegistrationCertificateNumber,String applyNo) {
public void updateTechparamsByEquIdAndCurrentDoucumentId(String equipId, String currentDocumentId, String newUseRegistrationCertificateNumber, String applyNo) {
IdxBizJgTechParamsElevator idxBizJgTechParamsElevator = idxBizJgTechParamsElevatorMapper.selectOne(new QueryWrapper<IdxBizJgTechParamsElevator>().eq("RECORD", equipId));
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryMapper.selectOne(new QueryWrapper<JgRegistrationHistory>()
......@@ -559,4 +573,122 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
}
return null;
}
@Override
public void exportUseRegistrationCertificate(String sequenceNbr, HttpServletResponse response) {
Map<String, Object> exportParamsMap = new HashMap<>();
//查询移装变更详情
JgChangeRegistrationReform jgChangeRegistrationReform = this.getById(sequenceNbr);
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = jgChangeRegistrationReformEqMapper.selectOne(new QueryWrapper<JgChangeRegistrationReformEq>().eq("equip_transfer_id", sequenceNbr));
if (ValidationUtil.isEmpty(jgChangeRegistrationReform) || ValidationUtil.isEmpty(jgChangeRegistrationReformEq)) {
throw new BadRequest("使用登记证导出失败,请稍后重试!");
}
//是否废弃
exportParamsMap.put("isInvalid", jgChangeRegistrationReformEq.getIsInvalid());
if (ValidationUtil.isEmpty(jgChangeRegistrationReform.getReceiveOrgName())) {
throw new BadRequest("使用登记证导出失败,登记机关为空!");
}
exportParamsMap.put("receiveOrgName", jgChangeRegistrationReform.getReceiveOrgName());
//使用登记证编号
if (ValidationUtil.isEmpty(jgChangeRegistrationReform.getUseRegistrationCode())) {
throw new BadRequest("使用登记证导出失败,使用登记证编号为空!");
}
exportParamsMap.put("useRegistrationCode", jgChangeRegistrationReform.getUseRegistrationCode());
//使用单位名称
if (ValidationUtil.isEmpty(jgChangeRegistrationReform.getUseUnitName())) {
throw new BadRequest("使用登记证导出失败,使用单位名称为空!");
}
exportParamsMap.put("useUnitName", jgChangeRegistrationReform.getUseUnitName());
//监管码
if (ValidationUtil.isEmpty(jgChangeRegistrationReform.getSupervisoryCode())) {
throw new BadRequest("使用登记证导出失败,监管码为空!");
}
exportParamsMap.put("supervisoryCode", jgChangeRegistrationReform.getSupervisoryCode());
//发证日期(当前时间)
LocalDate today = LocalDate.now();
exportParamsMap.put("giveOutYear", today.getYear());
exportParamsMap.put("giveOutMonth", today.getMonthValue());
exportParamsMap.put("giveOutDay", today.getDayOfMonth());
//查询设备注册信息
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoService.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", jgChangeRegistrationReformEq.getEquId()));
if (!ValidationUtil.isEmpty(registerInfo)) {
//设备种类、类别、品种
String equList = registerInfo.getEquList();//设备种类
String equCategory = registerInfo.getEquCategory();//设备类别
String equDefine = registerInfo.getEquDefine();//设备品种
List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null);
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null);
List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null);
if (CollectionUtils.isNotEmpty(categoryList0)) {
if (ValidationUtil.isEmpty(categoryList0.get(0).getName())) {
throw new BadRequest("使用登记证导出失败,设备种类为空!");
}
exportParamsMap.put("equList", categoryList0.get(0).getName());
}
if (CollectionUtils.isNotEmpty(categoryList1)) {
if (ValidationUtil.isEmpty(categoryList1.get(0).getName())) {
throw new BadRequest("使用登记证导出失败,设备类别为空!");
}
exportParamsMap.put("equCategory", categoryList1.get(0).getName());
}
if (CollectionUtils.isNotEmpty(categoryList2)) {
if (ValidationUtil.isEmpty(categoryList2.get(0).getName())) {
throw new BadRequest("使用登记证导出失败,设备品种为空!");
}
exportParamsMap.put("equDefine", categoryList2.get(0).getName());
}
//设备代码
if (ValidationUtil.isEmpty(registerInfo.getEquCode())) {
throw new BadRequest("使用登记证导出失败,设备代码为空!");
}
exportParamsMap.put("equCode", registerInfo.getEquCode());
}
//单位内部编码
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(jgChangeRegistrationReformEq.getEquId());
if (!ValidationUtil.isEmpty(useInfo)) {
if (ValidationUtil.isEmpty(useInfo.getUseInnerCode())) {
throw new BadRequest("使用登记证导出失败,设备单位内部编码为空!");
}
exportParamsMap.put("useInnerCode", useInfo.getUseInnerCode());
String fullAddress = "";
String province = useInfo.getProvinceName();
String city = useInfo.getCityName();
String county = useInfo.getCountyName();
String street = useInfo.getStreetName();
String address = useInfo.getAddress();
if (!ObjectUtils.isEmpty(province)) {
fullAddress += province;
}
if (!ObjectUtils.isEmpty(city)) {
fullAddress += city;
}
if (!ObjectUtils.isEmpty(county)) {
fullAddress += county;
}
if (!ObjectUtils.isEmpty(street)) {
fullAddress += street;
}
if (!ObjectUtils.isEmpty(address)) {
fullAddress += address;
}
if (ValidationUtil.isEmpty(fullAddress)) {
throw new BadRequest("使用登记证导出失败,设备使用地址为空!");
}
exportParamsMap.put("fullAddress", fullAddress);
}
IdxBizJgFactoryInfo factoryInfo = idxBizJgFactoryInfoService.getOneData(jgChangeRegistrationReformEq.getEquId());
//产品编号(出厂编号)
if (!ValidationUtil.isEmpty(factoryInfo)) {
if (ValidationUtil.isEmpty(factoryInfo.getFactoryNum())) {
throw new BadRequest("使用登记证导出失败,产品编号为空!");
}
exportParamsMap.put("factoryNum", factoryInfo.getFactoryNum());
}
//调用生成使用登记证
commonService.generateCertificateReport(exportParamsMap, response);
}
}
\ No newline at end of file
......@@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aspose.words.SaveFormat;
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;
......@@ -12,7 +11,6 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
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;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNoticeEq;
......@@ -28,7 +26,6 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
......@@ -38,20 +35,14 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
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;
......@@ -126,7 +117,7 @@ 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",
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard", "productQualityYieldProve",
"insUseMaintainExplain", "inspectReport", "proxyStatementAttachment", "installContractAttachment"};
// 设备信息 "equCategory", "equDefine", "equRegisterCode", "produceCountry", "produceLicenseNum",
List<Map<String, Object>> equipmentInfos = jgMaintainNoticeMapper.queryEquipInformation(sequenceNbr);
......@@ -179,7 +170,8 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
JgMaintainNotice notice = new JgMaintainNotice();
BeanUtils.copyProperties(noticeDto, notice);
boolean submit = submit(notice, op);
op = "已提交";
boolean submit = submit(notice, op, null);
if (submit) {
// 查询下节点任务
getNext(roleListSecond, notice.getInstanceId(), taskName);
......@@ -281,24 +273,19 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
throw new IllegalArgumentException("维修告知单不存在");
}
Map<String, Object> installation = informationList.get(0);
String useCode = String.valueOf(installation.get("useCode"));
LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode);
// 因模板许可证编号配置最多支持三个,再多样式混乱,目前返回三个
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode).last("limit 3");
List<TzBaseUnitLicence> list = baseUnitLicenceMapper.selectList(wrapper);
ArrayList<String> installLicenseNoList = new ArrayList<>();
ArrayList<String> installLicenseExpirationDateList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
list.forEach(tzBaseUnitLicence -> {
// 因模板许可证编号配置最多支持三个,再多样式混乱,目前返回三个
if (installLicenseNoList.size() < 3) {
installLicenseNoList.add(tzBaseUnitLicence.getCertNo());
installLicenseExpirationDateList.add(DateUtils.convertDateToString(tzBaseUnitLicence.getExpiryDate(), DateUtils.DATE_PATTERN));
}
installLicenseNoList.add(tzBaseUnitLicence.getCertNo());
installLicenseExpirationDateList.add(DateUtils.convertDateToString(tzBaseUnitLicence.getExpiryDate(), DateUtils.DATE_PATTERN));
});
}
Function<String, String> getValue = key -> installation.getOrDefault(key, "").toString();
// 组装模板变量
Map<String, Object> placeholders = new HashMap<>();
......@@ -308,28 +295,29 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
placeholders.put("productName", getValue.apply("productName"));
placeholders.put("equipType", getValue.apply("equType"));
placeholders.put("equipCode", getValue.apply("equRegisterCode"));
placeholders.put("produceCode", getValue.apply("produceCode")); // TODO: 制造编号 - 设备出厂编号
placeholders.put("produceCode", getValue.apply("produceCode"));
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("fullAddress", getValue.apply("provinceName") + getValue.apply("cityName") +
getValue.apply("countyName") + getValue.apply("streetName") + getValue.apply("address"));
placeholders.put("installStartDate", getValue.apply("installStartDate"));
placeholders.put("installType", "维修"); // TODO: 施工类别
placeholders.put("installType", "维修告知");
placeholders.put("installLicenseNo", "");
placeholders.put("installLicenseExpirationDate", "");
placeholders.put("installLeaderName", getValue.apply("installLeaderName"));// 施工负责人
placeholders.put("installLeaderPhone", getValue.apply("installLeaderPhone"));// 施工负责人手机
placeholders.put("installUnitAddress", getValue.apply("provinceName") + getValue.apply("cityName") + getValue.apply("countyName") + getValue.apply("address")); // TODO: 施工单位地址
placeholders.put("installUnitAddress", getValue.apply("provinceName") + getValue.apply("cityName") +
getValue.apply("countyName") + getValue.apply("streetName") + getValue.apply("address")); // TODO: 施工单位地址
placeholders.put("useUnitName", getValue.apply("useUnitName"));
placeholders.put("useUnitLeaderName", getValue.apply("safetyManager"));
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitProvinceName") + getValue.apply("useUnitCityName") + getValue.apply("useUnitCountyName") + getValue.apply("useUnitAddress"));
placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitProvinceName") + getValue.apply("useUnitCityName") +
getValue.apply("useUnitCountyName") + getValue.apply("streetName") + getValue.apply("useUnitAddress"));
// 生成二维码
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
placeholders.put("installLicenseNoList", installLicenseNoList);
placeholders.put("installLicenseExpirationDateList", installLicenseExpirationDateList);
placeholders.put("installLicenseNoList", installLicenseNoList);//许可证编号
placeholders.put("installLicenseExpirationDateList", installLicenseExpirationDateList);//许可证有效期
String url = WordTemplateUtils.templateToPdf("installation-notification-report.ftl", placeholders);
// 更新到数据库
JgMaintainNotice.setNoticeReportUrl(url);
......@@ -353,7 +341,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
// 获取告知单号
// List<String> applyNoList = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.WXGZ.getCode(), deviceList.size());
ResponseModel<List<String>> applyNoResult =tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.GZBG.getCode(), deviceList.size());
ResponseModel<List<String>> applyNoResult = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.GZBG.getCode(), deviceList.size());
if (CollectionUtils.isEmpty(applyNoResult.getResult())) {
log.error(" 获取告知单号失败");
......@@ -558,7 +546,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
}
public boolean submit(JgMaintainNotice notice, String op) {
public boolean submit(JgMaintainNotice notice, String op, String opinion) {
AjaxResult ajaxResult = Workflow.taskClient.getTask(notice.getInstanceId());
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
......@@ -566,7 +554,9 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
// dto.setComment("提交流程");
if (!StringUtils.isEmpty(opinion)) {
dto.setComment(opinion);
}
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", op);
dto.setVariable(map);
......@@ -601,7 +591,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
@Transactional
public void accept(JgMaintainNoticeDto dto, String op) {
public void accept(JgMaintainNoticeDto dto, String op, String opinion) {
String[] taskName = new String[]{"流程结束"};
String userId = RequestContext.getExeUserId();
JgMaintainNotice jgMaintainNotice = this.jgMaintainNoticeMapper.selectById(dto.getSequenceNbr());
......@@ -614,7 +604,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
log.error("日期转换失败:{}", e);
}
ArrayList<String> roleList = new ArrayList<>();
boolean submit = submit(jgMaintainNotice, op);
boolean submit = submit(jgMaintainNotice, op, opinion);
if (submit) {
getNext(roleList, dto.getInstanceId(), taskName);
jgMaintainNotice.setStatus(taskName[0]);
......
......@@ -32,6 +32,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -63,6 +64,7 @@ import java.util.stream.Collectors;
* @date 2023-12-19
*/
@Service
@Slf4j
public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, JgReformNotice, JgReformNoticeMapper> implements IJgReformNoticeService {
private static final String SUBMIT_TYPE_FLOW = "1";
......@@ -182,8 +184,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
JgReformNotice notice = new JgReformNotice();
BeanUtils.copyProperties(noticeDto, notice);
boolean submit = submit(notice, op);
op = "提交";
boolean submit = submit(notice, op, "");
if (submit) {
// 查询下节点任务
......@@ -291,6 +293,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
String useCode = String.valueOf(installation.get("useCode"));
LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode);
wrapper.last(" LIMIT 3");
List<TzBaseUnitLicence> list = baseUnitLicenceMapper.selectList(wrapper);
ArrayList<String> installLicenseNoList = new ArrayList<>();
......@@ -318,25 +321,29 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
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("fullAddress", getValue.apply("provinceName") + getValue.apply("cityName") +
getValue.apply("countyName") + getValue.apply("streetName") + getValue.apply("address"));
placeholders.put("installStartDate", getValue.apply("installStartDate"));
placeholders.put("installType", "改造"); // TODO: 施工类别
placeholders.put("installLicenseNo", "");
placeholders.put("installLicenseExpirationDate", "");
placeholders.put("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("provinceName") + getValue.apply("cityName") + getValue.apply("countyName") + getValue.apply("address")); // TODO: 施工单位地址
placeholders.put("installUnitAddress", getValue.apply("provinceName") + getValue.apply("cityName") +
getValue.apply("countyName") + getValue.apply("streetName") + getValue.apply("address")); // TODO: 施工单位地址
placeholders.put("useUnitName", getValue.apply("useUnitName"));
placeholders.put("useUnitLeaderName", getValue.apply("safetyManager"));
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitAddress"));
placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitProvinceName") + getValue.apply("useUnitCityName") +
getValue.apply("useUnitCountyName") + getValue.apply("streetName") + getValue.apply("useUnitAddress"));
// 生成二维码
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
placeholders.put("installLicenseNoList", installLicenseNoList);
placeholders.put("installLicenseExpirationDateList", installLicenseExpirationDateList);
log.info("改造告知单 => {}", JSON.toJSONString(placeholders));
String url = WordTemplateUtils.templateToPdf("installation-notification-report.ftl", placeholders);
// 更新到数据库
......@@ -590,7 +597,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
return urls;
}
public boolean submit(JgReformNotice notice, String op) {
public boolean submit(JgReformNotice notice, String op, String comment) {
AjaxResult ajaxResult = Workflow.taskClient.getTask(notice.getInstanceId());
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
......@@ -599,7 +606,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
dto.setComment("提交流程");
dto.setComment(comment);
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", op);
dto.setVariable(map);
......@@ -649,7 +656,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
ArrayList<String> roleList = new ArrayList<>();
boolean submit = submit(jgReformNotice, op);
boolean submit = submit(jgReformNotice, op, dto.getRemark());
if (submit) {
getNext(roleList, dto.getInstanceId(), taskName);
jgReformNotice.setStatus(taskName[0]);
......
......@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -59,7 +60,6 @@ public class JyjcInspectionApplicationController extends BaseController {
if(null == model.get("equip") ||model.getJSONArray("equip").size() < 1 ){
return CommonResponseUtil.failure("未选择报检设备时不可提交");
}
}
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.save(model));
}
......@@ -211,7 +211,11 @@ public class JyjcInspectionApplicationController extends BaseController {
@PostMapping(value = "/flow/{type}/receive")
public ResponseModel<HashMap<String, String>> execueFlow(@PathVariable(value = "type") String type, @RequestBody Map<String, Object> params) {
params.put("type", type);
jyjcInspectionApplicationServiceImpl.doReceive(params);
try {
jyjcInspectionApplicationServiceImpl.doReceive(params);
}catch (Exception e){
return CommonResponseUtil.failure("该项流程发生变化,请返回列表刷新查看状态后重试");
}
HashMap<String, String> result = new HashMap<>();
result.put("result","success");
return ResponseHelper.buildResponse(result);
......
......@@ -46,6 +46,7 @@ public class CommonserviceImpl {
QueryWrapper userInfoQueryWrapper = new QueryWrapper<>();
userInfoQueryWrapper.eq("unit_code", unitCode);
userInfoQueryWrapper.like("post", jyjcUserPost);
userInfoQueryWrapper.eq("is_delete",false);
List<TzsUserInfo> userInfos = userInfoMapper.selectList(userInfoQueryWrapper);
return userInfos;
}
......
......@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jyjc.api.entity.*;
import com.yeejoin.amos.boot.module.jyjc.api.enums.DocumentEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.ResultStatusEnum;
......@@ -40,6 +41,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -110,9 +112,10 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
try {
//开启报检流程工作流
FeignClientResult ajaxResult = Workflow.taskV2Client.startByVariable(dto);
String id = ((Map) ajaxResult.getResult()).get("id").toString();
String id = JSON.parseObject(JSON.toJSONString(ajaxResult.getResult())) .get("id").toString();
// String id = ((Map) ajaxResult.getResult()).get("id").toString();
model.setProcessInstanceId(id);
execueFlow(MapBuilder.<String, Object>create().put("op", "0").put("instanceId", id).put("comments", "").build());
execueFlow(MapBuilder.<String, Object>create().put("op", "提交").put("instanceId", id).put("comments", "").build());
// region 获取下一个流程节点的数据
......@@ -130,6 +133,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
model.setStatus(String.valueOf(FlowStatusEnum.TO_SUBMITTED.getCode())); //6611 对应数据字典 检验流程状态 待受理
} else if (model.getOperationType().equals("1")) {
model.setStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
}
LambdaQueryWrapper<JyjcOpeningApplication> wa = new LambdaQueryWrapper<JyjcOpeningApplication>().eq(JyjcOpeningApplication::getUnitCode, model.getInspectionUnitCode()).eq(JyjcOpeningApplication::getStatus, FlowStatusEnum.TO_BE_FINISHED.getCode());
......@@ -168,7 +172,6 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
// endregion
if (null == model.getSequenceNbr()){
model.setStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
model = this.createWithModel(model);
}else {
model = this.updateWithModel(model);
......@@ -239,7 +242,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
}
model.setStatus(String.valueOf(FlowStatusEnum.TO_SUBMITTED.getCode())); //6611 对应数据字典 检验流程状态 待受理
execueFlow(MapBuilder.<String, Object>create().put("op", "0").put("instanceId", model.getProcessInstanceId()).put("comments", "").build());
execueFlow(MapBuilder.<String, Object>create().put("op", "提交").put("instanceId", model.getProcessInstanceId()).put("comments", "").build());
Map<String, Object> nextNodeInfo = workflowHelper.getNextWorkflowNode(model.getProcessInstanceId());
String role = (String) nextNodeInfo.get("role");
model.setNextExecuteIds(role);
......@@ -259,15 +262,14 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<JyjcInspectionApplication> jyjcInspectionApplications = this.getBaseMapper().selectBatchIds(sequenceNbr);
long count = jyjcInspectionApplications.stream().filter(e ->
e.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getCode())
|| e.getStatus().equals(FlowStatusEnum.TO_SUBMITTED.getCode())
e.getStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()))
|| e.getStatus().equals(String.valueOf(FlowStatusEnum.TO_SUBMITTED.getCode()))
).count();
if (count > 0) {
throw new BadRequest("存在 已完成、待受理状态的报检单 不可删除!");
}
this.deleteBatchSeq(sequenceNbr);
for (Long seq : sequenceNbr) {
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(seq);
......@@ -450,6 +452,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} catch (Exception e) {
e.printStackTrace();
log.error("执行工作流错误, => {}", params, e);
throw new BaseException("该项流程发生变化,刷新查看状态后重试","400","");
}
}
......@@ -491,7 +494,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<String> persons = JSONArray.parseArray(JSON.toJSONString(params.get("inspectionChargePerson")), String.class);
// List<String> phones = JSONArray.parseArray(JSON.toJSONString(params.get("inspectionChargePhone")), String.class);
String inspectionChargePerson = String.join(",",persons);
String inspectionChargePerson = persons == null?"":String.join(",",persons);
String inspectionChargePhone = (String)params.get("inspectionChargePhone");
String processDescription = (String)params.get("comments");
if (StringUtils.isNotBlank(inspectionChargePerson)) {
......@@ -518,7 +521,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
this.getBaseMapper().updatePromoter(entity.getSequenceNbr());
}
//逻辑变更为 通过后才对办理时间赋值
if (status.equals(FlowStatusEnum.TO_BE_FINISHED.getCode())){
if (status.equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()))){
entity.setAcceptDate(new Date());
entity.setInnerPersonCode(params.getOrDefault("innerPersonCode","").toString());
}
......
......@@ -121,7 +121,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
model.setApplyTime(new Date());
model.setWorkflowProstanceId(instanceId);
// 默认自动执行第一步
execueFlowNoBusiness(MapBuilder.<String, Object>create().put("op", "0").put("instanceId", instanceId).put("comments", "").build());
execueFlowNoBusiness(MapBuilder.<String, Object>create().put("op", "提交").put("instanceId", instanceId).put("comments", "").build());
// 查询下节点任务
Map<String, Object> nextNodeInfo = workflowHelper.getNextWorkflowNode(instanceId);
String role = (String) nextNodeInfo.get("role");
......
......@@ -450,4 +450,10 @@ public class IdxBizJgTechParamsElevator extends TzsBaseEntity {
@TableField("\"KZG_OPERATION_MODE\"")
private String kzgOperationMode;
/**
* 轿门位置
*/
@TableField("\"JMWZ\"")
private String jmwz;
}
......@@ -165,7 +165,7 @@
tz_base_enterprise_info info
inner JOIN tz_jyjc_opening_application tjoa ON info.use_code = tjoa.unit_code
AND status = '6616'
where unit_type LIKE CONCAT('%',#{unitType},'%')
where unit_type LIKE CONCAT('%',#{unitType},'%') group by info.use_code
</select>
<select id="selectBySeq" resultType="com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo">
select * from tz_base_enterprise_info where sequence_nbr = #{sequenceNbr}
......
package com.yeejoin.amos.boot.module.ymt.biz.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(httpHosts);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
}
}
}
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