Commit b7c390f0 authored by 王果's avatar 王果

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

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/CommonController.java
parents 6307da3b 8f22d497
......@@ -25,17 +25,9 @@ import com.yeejoin.amos.boot.module.elevator.flc.api.feign.PrivilegeFeginService
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import lombok.extern.slf4j.Slf4j;
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.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
......@@ -123,39 +115,39 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Autowired
private RedisUtils redisUtils;
//管辖机构redis缓存key
// 管辖机构redis缓存key
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
//行政区划redis缓存key
// 行政区划redis缓存key
private static final String PROVINCE = "PROVINCE";
private static final String CITY = "CITY";
private static final String REGION = "REGION";
//西安行政区划code
// 西安行政区划code
private static final String XIAN = "610100";
//判断行政区划查询市还是区
// 判断行政区划查询市还是区
private static final String END_CODE = "0000";
//一码通监督管理表单id
// 一码通监督管理表单id
private static final String SUPERVISION_FROM_ID = "1627903532906602497";
//一码通使用信息表单id
// 一码通使用信息表单id
private static final String USE_INFO_FROM_ID = "1627903393253056514";
//一码通码自动生成
// 一码通码自动生成
final static String CREATE = "1";
//一码通码手动输入
// 一码通码手动输入
final static String NOT_CREATE = "0";
//一码通复制功能url参数key
// 一码通复制功能url参数key
private static final String COPY_KEY = "stashType";
//判断行政区划查询街道
// 判断行政区划查询街道
private static final String STREET_END_CODE = "00";
private static final String STREET = "STREET";
private static final String STREET_LEVEL = "4";
private static final String CITY_LEVEL = "2";
private static final String REGION_LEVEL = "3";
@Autowired
RestHighLevelClient restHighLevelClient;
RestHighLevelClient restHighLevelClient;
private static String USE_CODE = "use_code";
......@@ -242,14 +234,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String city, county, equipCategory;
EquInfoDto equInfoDto = new EquInfoDto();
if (ObjectUtils.isEmpty(record)) {
//获取对应行政区划
// 获取对应行政区划
county = EquipmentCategoryEnum.XZQH.getCode();
city = map.get("regionCode").toString();
//获取对应设备分类
// 获取对应设备分类
equipCategory = map.get("equCategory").toString();
} else {
equInfoDto = categoryOtherInfoMapper.selectEquipInfo(record);
//判断这条数据认领状态是否为已认领,否则直接返回
// 判断这条数据认领状态是否为已认领,否则直接返回
if (!ObjectUtils.isEmpty(equInfoDto) && EquipmentCategoryEnum.YRL.getName().equals(equInfoDto.getStatus())) {
city = equInfoDto.getCity();
county = equInfoDto.getCounty();
......@@ -258,10 +250,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return new HashMap<>();
}
}
//生成码
// 生成码
Map<String, String> codeMap;
synchronized (EquipmentCategoryServiceImpl.class) {
codeMap = creatCode(city, county, equipCategory, null,null);
codeMap = creatCode(city, county, equipCategory, null, null);
}
if (ObjectUtils.isEmpty(codeMap)) {
return new HashMap<>();
......@@ -274,19 +266,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
supervisoryCodeInfo.setStatus(equState);
if (!ObjectUtils.isEmpty(record)) {
String supervisorCode, elevatorCode;
//设备状态为报废,对应电梯码作废
// 设备状态为报废,对应电梯码作废
equState = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? EquipmentCategoryEnum.WSY.getCode() : EquipmentCategoryEnum.YSY.getCode();
supervisorCode = codeMap.get("superviseCode");
elevatorCode = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? null : codeMap.get("code96333");
List<CategoryOtherInfo> categoryOtherInfo = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().eq("SUPERVISORY_CODE", supervisorCode));
if (categoryOtherInfo.size() > 0) {
// categoryOtherInfoMapper.updateCode(supervisorCode, equState);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode()));
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisoryCodeInfo.getSupervisoryCode()));
} else {
supervisoryCodeInfo.setStatus(equState);
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
}
//修改源数据的电梯码
// 修改源数据的电梯码
categoryOtherInfoMapper.updateSupervisorCode(supervisorCode, elevatorCode, record);
} else {
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
......@@ -297,13 +289,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override
public List<LinkedHashMap> getTree() {
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
//判断redis是否存在管辖机构树
// 判断redis是否存在管辖机构树
return !ObjectUtils.isEmpty(result) ? result : creatTree();
}
@Override
public List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(),RequestContext.getAppKey(),RequestContext.getProduct());
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteRegulatorTreeData(result);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
......@@ -322,7 +314,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//将管辖机构树中children为[]的修改为null
// 将管辖机构树中children为[]的修改为null
if (e.get("children") != null) {
if (((List<LinkedHashMap>) e.get("children")).size() == 0) {
e.put("children", null);
......@@ -345,7 +337,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//删除使用单位
// 删除使用单位
if ("company".equals(e.get("level"))) {
it.remove();
}
......@@ -368,7 +360,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return ObjectUtils.isEmpty(list) ? getProvinceList(level) : list;
} else if (!ObjectUtils.isEmpty(parentId)) {
String regionCode = parentId.split("_")[0];
//regionCode不是以00结尾查询街道,以0000结果查询市、否则查询区
// regionCode不是以00结尾查询街道,以0000结果查询市、否则查询区
if (!regionCode.endsWith(STREET_END_CODE)) {
list = ObjectUtils.isEmpty(redisUtils.get(STREET)) ? getProvinceList(STREET_LEVEL) : (List<LinkedHashMap>) redisUtils.get(STREET);
} else if (regionCode.endsWith(END_CODE)) {
......@@ -383,19 +375,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
public Map<String, Object> getRegionList() {
//查询省下所有的行政区划市,封装并存入redis
// 查询省下所有的行政区划市,封装并存入redis
Map<String, Object> map1 = new HashMap<>();
List<LinkedHashMap> cityList;
FeignClientResult tree = privilegeFeginService.getTree();
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
//获取陕西省regionCode
// 获取陕西省regionCode
String regionCode = ((List<LinkedHashMap>) privilegeFeginService.getProvince("1").getResult()).get(0).get("regionCode").toString();
cityList = deleteTreeData(result, regionCode);
Map<String, Object> cityMap = new HashMap<>();
cityMap.put(regionCode, cityList);
map1.put(regionCode, cityList);
redisUtils.set(CITY, cityMap);
//查询市下所有的行政区划区,封装并存入redis
// 查询市下所有的行政区划区,封装并存入redis
if (!ObjectUtils.isEmpty(cityList)) {
List<LinkedHashMap> region = (List<LinkedHashMap>) privilegeFeginService.getTree().getResult();
Map<String, Object> map = new HashMap<>();
......@@ -464,7 +456,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<LinkedHashMap> list = new ArrayList<>();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//修改数据
// 修改数据
if (type.equals(e.get("parentRegionCode").toString())) {
e.put("children", null);
e.put("sequenceNbr", e.get("regionCode"));
......@@ -481,33 +473,33 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
/**
* 具体生成监管码和电梯96333识别码逻辑
*/
private synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333,String supervisionCode) {
private synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333, String supervisionCode) {
Map<String, String> resultMap = new HashMap<>();
StringBuilder supervisorCode = new StringBuilder();
StringBuilder elevatorCode = new StringBuilder();
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
String prefix;
//判断是否需要生成96333电梯码
// 判断是否需要生成96333电梯码
if (equipCategory.startsWith("3") && !XIAN.equals(city)) {
//判断数据是否携带96333电梯码,携带则使用,不携带则生成
if("null".equals(code96333)){
// 判断数据是否携带96333电梯码,携带则使用,不携带则生成
if ("null".equals(code96333)) {
prefix = getPrefix(EquipmentCategoryEnum.XZQHDT.getCode(), city);
//查询未使用的电梯码
// 查询未使用的电梯码
categoryOtherInfo = categoryOtherInfoMapper.selectElevatorCode(prefix, EquipmentCategoryEnum.WSY.getCode());
//如果存在未使用的电梯码则启用未使用的否则创建
// 如果存在未使用的电梯码则启用未使用的否则创建
String elevator = ObjectUtils.isEmpty(categoryOtherInfo) ? createElevatorCode(city, county) : categoryOtherInfo.getCode();
if(!ObjectUtils.isEmpty(categoryOtherInfo)){
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333",categoryOtherInfo.getCode()));
if (!ObjectUtils.isEmpty(categoryOtherInfo)) {
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333", categoryOtherInfo.getCode()));
}
elevatorCode.append(elevator);
resultMap.put("creatStatus",CREATE);
resultMap.put("creatStatus", CREATE);
} else {
elevatorCode.append(code96333);
resultMap.put("creatStatus",NOT_CREATE);
resultMap.put("creatStatus", NOT_CREATE);
}
}
//判断原数据是否存在监管码,存在则用原监管码即可,不存在则生成
if("null".equals(supervisionCode)){
// 判断原数据是否存在监管码,存在则用原监管码即可,不存在则生成
if ("null".equals(supervisionCode)) {
String supervisor = createSupervisorCode(city, county, equipCategory);
supervisorCode.append(supervisor);
} else {
......@@ -520,18 +512,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
SupervisoryCodeInfo selectOne = supervisoryCodeInfoMapper.selectOne(new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionCode));
//将生成的码添加到码表中,码的使用状态为初始状态
// 将生成的码添加到码表中,码的使用状态为初始状态
String equState = EquipmentCategoryEnum.CSZT.getCode();
supervisoryCodeInfo.setCode96333(String.valueOf(elevatorCode));
supervisoryCodeInfo.setCreateStatus(resultMap.get("creatStatus"));
supervisoryCodeInfo.setSupervisoryCode(String.valueOf(supervisorCode));
supervisoryCodeInfo.setStatus(equState);
if(ObjectUtils.isEmpty(selectOne)){
if (ObjectUtils.isEmpty(selectOne)) {
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
} else {
selectOne.setCode96333(String.valueOf(elevatorCode));
supervisoryCodeInfoMapper.update(selectOne,
new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",selectOne.getSupervisoryCode()));
new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", selectOne.getSupervisoryCode()));
}
resultMap.put("superviseCode", ObjectUtils.isEmpty(supervisorCode) ? null : supervisorCode.toString());
resultMap.put("code96333", ObjectUtils.isEmpty(elevatorCode) ? null : elevatorCode.toString());
......@@ -552,15 +544,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
*/
private String createSupervisorCode(String city, String county, String equipCategory) {
StringBuilder supervisorCode = new StringBuilder();
//生成监管码前缀
// 生成监管码前缀
Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), county);
String division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), city).get("code").toString() : divisionMap.get("code").toString();
supervisorCode.append(division).append(equipCategory).append("-");
//获取行政区划区县、市是否存在历史监管码
// 获取行政区划区县、市是否存在历史监管码
CategoryOtherInfo supervisor = categoryOtherInfoMapper.selectSupervisorCode(supervisorCode.toString());
//生成对应监管码
// 生成对应监管码
if (!ObjectUtils.isEmpty(supervisor) && supervisor.getSupervisoryCode() != null) {
//获取补零位长度
// 获取补零位长度
String supervisoryCode = supervisor.getSupervisoryCode().substring(6);
long num = Long.valueOf(supervisoryCode) + 1;
int numLength = String.valueOf(num).length();
......@@ -586,7 +578,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
*/
private String createElevatorCode(String city, String county) {
StringBuilder elevatorCode = new StringBuilder();
//生成生成96333电梯码前缀
// 生成生成96333电梯码前缀
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
String elevator = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString();
elevatorCode.append(elevator);
......@@ -595,10 +587,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (ValidationUtil.isEmpty(initSupervisoryCode)) {
elevatorCode.append(EquipmentCategoryEnum.getValue.get(elevator));
} else {
//获取行政区划区县、市是否存在历史96333电梯码
// 获取行政区划区县、市是否存在历史96333电梯码
CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString(), null);
if (!ObjectUtils.isEmpty(elevatorOtherInfo) && elevatorOtherInfo.getCode() != null) {
//获取补零位长度
// 获取补零位长度
String elevatorCode1 = elevatorOtherInfo.getCode().substring(2);
long num = Long.parseLong(elevatorCode1) + 1;
int numLength = String.valueOf(num).length();
......@@ -735,12 +727,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ValidationUtil.isEmpty(level)) {
Page<Map<String, Object>> m = new Page<>();
if (LEVEL.equals(level)) {
//企业
// 企业
map.put("USE_UNIT_CREDIT_CODE", companyCode);
m = this.getPage(map);
map.remove("USE_UNIT_CREDIT_CODE");
} else {
//监管单位
// 监管单位
map.put("ORG_BRANCH_CODE", code);
m = this.getPage(map);
map.remove("ORG_BRANCH_CODE");
......@@ -758,7 +750,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
objectPage.setSize(Long.valueOf(map.get("size").toString()));
objectPage.setCurrent(Long.valueOf(map.get("number").toString()));
model.setResult(objectPage);
//设备状态码对应枚举值
// 设备状态码对应枚举值
List<Map<String, Object>> records = model.getResult().getRecords();
List<Map<String, Object>> result = new ArrayList<>();
for (Map<String, Object> record : records) {
......@@ -799,7 +791,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return list;
}
public List<EquipExportVo> getEquipExportData(EquipExportDto dto){
public List<EquipExportVo> getEquipExportData(EquipExportDto dto) {
ArrayList<EquipExportVo> list = new ArrayList<>();
List<JSONObject> objectList = getCompanyType();
if (!ValidationUtil.isEmpty(dto.getEQU_STATE())) {
......@@ -811,14 +803,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String companyCode = object.getString("companyCode");
if (!ValidationUtil.isEmpty(level)) {
if (LEVEL.equals(level)) {
//企业
// 企业
dto.setUSE_UNIT_CREDIT_CODE(companyCode);
} else {
//监管单位
// 监管单位
dto.setORG_BRANCH_CODE(orgCode);
}
List<EquipExportVo> equipExportData = equipmentCategoryMapper.getEquipExportData(dto);
if (!ObjectUtils.isEmpty(equipExportData) ) {
if (!ObjectUtils.isEmpty(equipExportData)) {
list.addAll(equipExportData);
}
}
......@@ -858,23 +850,22 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
@Override
@Async
public void createEquipmentCategoryData() {
if(log.isInfoEnabled()){
if (log.isInfoEnabled()) {
log.info("初始化一码通总览数据开始");
}
equipmentCategoryDataService.remove(new QueryWrapper<>());
getCategoryData(null,null);
getCategoryData(null, null);
}
private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes,List<String> orgBranchCodes) {
private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes, List<String> orgBranchCodes) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<EquipmentCategoryData> list = new ArrayList<>();
// 查询所有单位
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes,orgBranchCodes);
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes, orgBranchCodes);
// 统计查询不同单位、不同装备定义、不同状态下的设备数量
List<UseUnitCreditCodeCategoryDto> equipCountList = equipmentCategoryMapper.useUnitCreditCodeCategoryCount();
// 查询8大类设备定义
......@@ -882,31 +873,31 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
// 组织EquipmentCategoryData表数据
for (Map<String, Object> map : allUnitList) {
EquipmentCategoryData equipmentCategoryData = new EquipmentCategoryData();
if(ObjectUtils.isEmpty(map.get("supervise_org_code")) || ObjectUtils.isEmpty(map.get(USE_CODE))){
if (ObjectUtils.isEmpty(map.get("supervise_org_code")) || ObjectUtils.isEmpty(map.get(USE_CODE))) {
continue;
}
equipmentCategoryData.setOrgBranchCode(map.get("supervise_org_code").toString());
equipmentCategoryData.setUnitCode(map.get(USE_CODE).toString());
// 指定单位的设备统计信息
List<UseUnitCreditCodeCategoryDto> unitEquipCountList = equipCountList.stream().filter(r->r.getUseUnitCreditCode().equals(map.get(USE_CODE).toString())).collect(Collectors.toList());
unitEquipCountList = unitEquipCountList.stream().filter(r->r.getOrgBranchCode().equals(map.get(ORG_BRANCH_CODE).toString())).collect(Collectors.toList());
List<UseUnitCreditCodeCategoryDto> unitEquipCountList = equipCountList.stream().filter(r -> r.getUseUnitCreditCode().equals(map.get(USE_CODE).toString())).collect(Collectors.toList());
unitEquipCountList = unitEquipCountList.stream().filter(r -> r.getOrgBranchCode().equals(map.get(ORG_BRANCH_CODE).toString())).collect(Collectors.toList());
for (EquipmentCategory category : equipmentCategories) {
Map<String, Object> data = new HashMap<>();
data.put("waitClaim", unitEquipCountList.stream().filter(r->r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.DRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("alreadyClaim", unitEquipCountList.stream().filter(r->r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.YRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("refuseClaim", unitEquipCountList.stream().filter(r->r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.YJL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("waitClaim", unitEquipCountList.stream().filter(r -> r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.DRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("alreadyClaim", unitEquipCountList.stream().filter(r -> r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.YRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("refuseClaim", unitEquipCountList.stream().filter(r -> r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.YJL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
this.set8CategoryCountData(equipmentCategoryData, category, data);
}
equipmentCategoryData.setRecDate(new Date());
list.add(equipmentCategoryData);
}
if(!ObjectUtils.isEmpty(unitCodes)){
equipmentCategoryDataMapper.delete(new QueryWrapper<EquipmentCategoryData>().in("unit_code",unitCodes));
if (!ObjectUtils.isEmpty(unitCodes)) {
equipmentCategoryDataMapper.delete(new QueryWrapper<EquipmentCategoryData>().in("unit_code", unitCodes));
}
equipmentCategoryDataService.saveOrUpdateBatch(list);
stopWatch.stop();
if(log.isInfoEnabled()){
log.info("总览数据刷新结束,耗时:{} 秒",stopWatch.getTotalTimeSeconds());
if (log.isInfoEnabled()) {
log.info("总览数据刷新结束,耗时:{} 秒", stopWatch.getTotalTimeSeconds());
}
return list;
}
......@@ -945,19 +936,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private List<EquipmentCategory> getEquipmentCategories() {
LambdaQueryWrapper<EquipmentCategory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.likeLeft(EquipmentCategory::getCode,"000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode,"7000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode,"F000");
lambdaQueryWrapper.likeLeft(EquipmentCategory::getCode, "000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode, "7000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode, "F000");
return equipmentCategoryMapper.selectList(lambdaQueryWrapper);
}
private List<EquipmentCategoryData> updateEquipmentCategoryData(String unitCode,String orgBranchCode) {
private List<EquipmentCategoryData> updateEquipmentCategoryData(String unitCode, String orgBranchCode) {
List<String> unitCodeList = new ArrayList<>();
unitCodeList.add(unitCode);
List<String> orgBranchCodeList = new ArrayList<>();
orgBranchCodeList.add(orgBranchCode);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList,null);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList, null);
return equipmentCategoryData;
}
......@@ -968,7 +959,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<String> records = new ArrayList<>();
List<ESEquipmentCategoryDto> list = new ArrayList<>();
if(recordList.toString().contains("[")){
if (recordList.toString().contains("[")) {
for (String record : (List<String>) recordList) {
records.add(record);
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
......@@ -981,7 +972,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString());
list.add(esEquipmentCategoryDto);
}
//删除监管码表数据
// 删除监管码表数据
List<String> superviseCodeList = superviseInfoMapper.selectSuperviseCodeList(records);
List<Map<String, Object>> unitCodeAndOrgBranchCodeList = superviseInfoMapper.selectUnitCodeList(records);
List<String> unitCodeList = new ArrayList<>();
......@@ -991,17 +982,17 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
orgBranchCodeList.add(String.valueOf(objectMap.get("orgBranchCode")));
}
if(!ObjectUtils.isEmpty(superviseCodeList)){
if (!ObjectUtils.isEmpty(superviseCodeList)) {
supervisoryCodeInfoMapper.updateStatus(superviseCodeList);
}
//删除涉及的19张表的数据
// 删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(records);
// 根据统一信用代码更新总览表
if(!ObjectUtils.isEmpty(unitCodeList)){
getCategoryData(unitCodeList,orgBranchCodeList);
if (!ObjectUtils.isEmpty(unitCodeList)) {
getCategoryData(unitCodeList, orgBranchCodeList);
}
//删除es中的数据
// 删除es中的数据
esEquipmentCategory.deleteAll(list);
return records;
}
......@@ -1025,7 +1016,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String claimStatus = String.valueOf(superviseMap.get("claimStatus"));
String code96333 = String.valueOf(superviseMap.get("code96333"));
String operateType = String.valueOf(superviseMap.get("operateType"));
//生成码
// 生成码
Map<String, String> codeMap;
if (EquipmentCategoryEnum.YRL.getName().equals(claimStatus)) {
log.info("准备生成监管码或96333电梯识别码");
......@@ -1033,15 +1024,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String county = String.valueOf(superviseMap.get("county"));
String equCategory = String.valueOf(superviseMap.get("equCategory"));
String supervisionCode = String.valueOf(superviseMap.get("supervisionCode"));
//生成码
// 生成码
codeMap = creatCode(city, county, equCategory, code96333, supervisionCode);
log.info("已生成对应监管码或96333电梯识别码");
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
// 删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map.remove("data");
supervisionMap.put("CODE96333", codeMap.get("code96333"));
supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode"));
map.put(SUPERVISION_FROM_ID, supervisionMap);
//根据操作状态判断是调用新增还是修改接口
// 根据操作状态判断是调用新增还是修改接口
responseModel = "save".equals(operateType) ? idxFeignService.batchSubmit(null, null, null, null, map) :
idxFeignService.batchUpdate(null, null, map);
if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
......@@ -1053,7 +1044,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
map.remove("data");
supervisionMap.put("CODE96333", "null".equals(code96333) ? null : code96333);
map.put(SUPERVISION_FROM_ID, supervisionMap);
//根据操作状态判断是调用新增还是修改接口
// 根据操作状态判断是调用新增还是修改接口
responseModel = "save".equals(operateType) ? idxFeignService.batchSubmit(null, null, null, null, map) :
idxFeignService.batchUpdate(null, null, map);
} else {
......@@ -1061,11 +1052,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
responseModel = idxFeignService.batchUpdate(null, null, map);
}
stopWatch.stop();
if(log.isInfoEnabled()){
log.info("通用提交耗时:{} 秒",stopWatch.getTotalTimeSeconds());
if (log.isInfoEnabled()) {
log.info("通用提交耗时:{} 秒", stopWatch.getTotalTimeSeconds());
}
} catch (Exception e) {
log.error(e.getMessage(),e);
log.error(e.getMessage(), e);
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.BF.getCode());
ResponseModel<Object> response = new ResponseModel<>();
response.setDevMessage(e.getMessage());
......@@ -1074,14 +1065,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
response.setStatus(HttpStatus.BAD_REQUEST.value());
return response;
} finally {
updateEquipmentCategoryData(unitCode,orgBranchCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode()));
updateEquipmentCategoryData(unitCode, orgBranchCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisoryCodeInfo.getSupervisoryCode()));
}
return responseModel;
}
//分页查询所有数据
// 分页查询所有数据
public Page<Map<String, Object>> getAll(Map<String, Object> map) {
String tableName = map.get(TABLENAME).toString();
Assert.hasText(tableName, "表名不能为空");
......@@ -1099,7 +1090,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return page;
}
//查询总条数
// 查询总条数
public Long counts(Map<String, Object> map) {
String tableName = map.get(TABLENAME).toString();
Assert.hasText(tableName, "表名不能为空");
......@@ -1107,6 +1098,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Long count = bizJdbcTemplate.queryForObject(countSql, Long.class);
return count;
}
/**
* es数据同步
*
......@@ -1182,15 +1174,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* es保存设备数据
*/
public ESEquipmentCategoryDto saveESEquipmentCategory(Map<String, Object> map) {
//处理时间问题
String recDate1 = map.get("REC_DATE").toString().substring(0,19);
// 处理时间问题
String recDate1 = map.get("REC_DATE").toString().substring(0, 19);
long time = Timestamp.valueOf(recDate1).getTime();
map.put("REC_DATE",time);
map.put("REC_DATE", time);
ESEquipmentCategoryDto dto = JSONObject.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
ESEquipmentCategoryDto save = esEquipmentCategory.save(dto);
if (!ObjectUtils.isEmpty(save)) {
//同步到es后修改
// 同步到es后修改
UseInfo useInfo = new UseInfo();
useInfo.setIsNotEs(1);
useInfoMapper.update(useInfo, new QueryWrapper<UseInfo>().eq("RECORD",
......@@ -1198,6 +1190,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
return save;
}
public Page<JSONObject> queryByKeys(JSONObject map) {
// //根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
......@@ -1209,10 +1202,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String companyCode = object.getString("companyCode");
if (!ValidationUtil.isEmpty(level)) {
if (LEVEL.equals(level)) {
//企业
// 企业
map.put("USE_UNIT_CREDIT_CODE", companyCode);
} else {
//监管单位
// 监管单位
map.put("ORG_BRANCH_CODE", code);
}
}
......@@ -1222,16 +1215,16 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//通用匹配规则,条件构建
//SEQUENCE_NBR
// 通用匹配规则,条件构建
// SEQUENCE_NBR
if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("SEQUENCE_NBR", "*"+map.getString("SEQUENCE_NBR")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("SEQUENCE_NBR", "*" + map.getString("SEQUENCE_NBR") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("ORG_BRANCH_NAME", "*"+map.getString("ORG_BRANCH_NAME")+"*" ));
query.must(QueryBuilders.matchPhraseQuery("ORG_BRANCH_NAME", "*" + map.getString("ORG_BRANCH_NAME") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
......@@ -1241,12 +1234,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*"+map.getString("USE_UNIT_NAME")+"*"));
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*" + map.getString("USE_UNIT_NAME") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", "*"+map.getString("USE_UNIT_CREDIT_CODE")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", "*" + map.getString("USE_UNIT_CREDIT_CODE") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST_CODE"))) {
......@@ -1256,23 +1249,23 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST", "*"+map.getString("EQU_LIST")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST", "*" + map.getString("EQU_LIST") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_CATEGORY"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY", "*"+map.getString("EQU_CATEGORY")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY", "*" + map.getString("EQU_CATEGORY") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("USE_ORG_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*"+map.getString("USE_ORG_CODE").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*" + map.getString("USE_ORG_CODE").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("CODE96333"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("CODE96333", "*"+map.getString("CODE96333").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("CODE96333", "*" + map.getString("CODE96333").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_CODE"))) {
......@@ -1283,7 +1276,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ObjectUtils.isEmpty(map.getString("SUPERVISORY_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*"+map.getString("SUPERVISORY_CODE").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*" + map.getString("SUPERVISORY_CODE").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) {
......@@ -1296,14 +1289,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
query.must(QueryBuilders.matchPhraseQuery("ADDRESS", "*" + map.getString("ADDRESS") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_STATE")) ) {
if (!ObjectUtils.isEmpty(map.getString("EQU_STATE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("EQU_STATE", map.getLong("EQU_STATE")));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("STATUS"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", "*"+map.getString("STATUS")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", "*" + map.getString("STATUS") + "*"));
boolMust.must(meBuilder);
}
builder.query(boolMust);
......@@ -1335,7 +1328,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return result;
}
//es统计总记录数
// es统计总记录数
public Long getCount(String indexs, RestHighLevelClient esClient) {
Long totle = 0L;
SearchRequest searchRequest = new SearchRequest(indexs);
......
......@@ -10,8 +10,6 @@ import com.google.common.collect.Lists;
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;
import com.yeejoin.amos.boot.module.cylinder.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.cylinder.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.cylinder.api.dto.*;
import com.yeejoin.amos.boot.module.cylinder.api.entity.*;
import com.yeejoin.amos.boot.module.cylinder.api.enums.EquimentEnum;
......@@ -20,22 +18,16 @@ import com.yeejoin.amos.boot.module.cylinder.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.cylinder.api.mapper.*;
import com.yeejoin.amos.boot.module.cylinder.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.cylinder.api.vo.EquipExportVo;
import com.yeejoin.amos.boot.module.cylinder.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.cylinder.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.cylinder.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.cylinder.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import lombok.extern.slf4j.Slf4j;
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.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
......@@ -123,33 +115,33 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Autowired
private RedisUtils redisUtils;
//管辖机构redis缓存key
// 管辖机构redis缓存key
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
//行政区划redis缓存key
// 行政区划redis缓存key
private static final String PROVINCE = "PROVINCE";
private static final String CITY = "CITY";
private static final String REGION = "REGION";
//西安行政区划code
// 西安行政区划code
private static final String XIAN = "610100";
//判断行政区划查询市还是区
// 判断行政区划查询市还是区
private static final String END_CODE = "0000";
//一码通监督管理表单id
// 一码通监督管理表单id
private static final String SUPERVISION_FROM_ID = "1627903532906602497";
//一码通使用信息表单id
// 一码通使用信息表单id
private static final String USE_INFO_FROM_ID = "1627903393253056514";
//一码通码自动生成
// 一码通码自动生成
final static String CREATE = "1";
//一码通码手动输入
// 一码通码手动输入
final static String NOT_CREATE = "0";
//一码通复制功能url参数key
// 一码通复制功能url参数key
private static final String COPY_KEY = "stashType";
@Autowired
RestHighLevelClient restHighLevelClient;
RestHighLevelClient restHighLevelClient;
private static String USE_CODE = "use_code";
......@@ -236,14 +228,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String city, county, equipCategory;
EquInfoDto equInfoDto = new EquInfoDto();
if (ObjectUtils.isEmpty(record)) {
//获取对应行政区划
// 获取对应行政区划
county = EquipmentCategoryEnum.XZQH.getCode();
city = map.get("regionCode").toString();
//获取对应设备分类
// 获取对应设备分类
equipCategory = map.get("equCategory").toString();
} else {
equInfoDto = categoryOtherInfoMapper.selectEquipInfo(record);
//判断这条数据认领状态是否为已认领,否则直接返回
// 判断这条数据认领状态是否为已认领,否则直接返回
if (!ObjectUtils.isEmpty(equInfoDto) && EquipmentCategoryEnum.YRL.getName().equals(equInfoDto.getStatus())) {
city = equInfoDto.getCity();
county = equInfoDto.getCounty();
......@@ -252,10 +244,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return new HashMap<>();
}
}
//生成码
// 生成码
Map<String, String> codeMap;
synchronized (EquipmentCategoryServiceImpl.class) {
codeMap = creatCode(city, county, equipCategory, null,null);
codeMap = creatCode(city, county, equipCategory, null, null);
}
if (ObjectUtils.isEmpty(codeMap)) {
return new HashMap<>();
......@@ -268,19 +260,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
supervisoryCodeInfo.setStatus(equState);
if (!ObjectUtils.isEmpty(record)) {
String supervisorCode, elevatorCode;
//设备状态为报废,对应电梯码作废
// 设备状态为报废,对应电梯码作废
equState = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? EquipmentCategoryEnum.WSY.getCode() : EquipmentCategoryEnum.YSY.getCode();
supervisorCode = codeMap.get("superviseCode");
elevatorCode = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? null : codeMap.get("code96333");
List<CategoryOtherInfo> categoryOtherInfo = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().eq("SUPERVISORY_CODE", supervisorCode));
if (categoryOtherInfo.size() > 0) {
// categoryOtherInfoMapper.updateCode(supervisorCode, equState);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode()));
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisoryCodeInfo.getSupervisoryCode()));
} else {
supervisoryCodeInfo.setStatus(equState);
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
}
//修改源数据的电梯码
// 修改源数据的电梯码
categoryOtherInfoMapper.updateSupervisorCode(supervisorCode, elevatorCode, record);
} else {
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
......@@ -291,13 +283,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override
public List<LinkedHashMap> getTree() {
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
//判断redis是否存在管辖机构树
// 判断redis是否存在管辖机构树
return !ObjectUtils.isEmpty(result) ? result : creatTree();
}
@Override
public List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(),RequestContext.getAppKey(),RequestContext.getProduct());
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteRegulatorTreeData(result);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
......@@ -316,7 +308,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//将管辖机构树中children为[]的修改为null
// 将管辖机构树中children为[]的修改为null
if (e.get("children") != null) {
if (((List<LinkedHashMap>) e.get("children")).size() == 0) {
e.put("children", null);
......@@ -339,7 +331,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//删除使用单位
// 删除使用单位
if ("company".equals(e.get("level"))) {
it.remove();
}
......@@ -362,7 +354,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return ObjectUtils.isEmpty(list) ? getProvinceList(level) : list;
} else if (!ObjectUtils.isEmpty(parentId)) {
String regionCode = parentId.split("_")[0];
//regionCode以0000结果查询市、否则查询区
// regionCode以0000结果查询市、否则查询区
Map<String, Object> map = regionCode.endsWith(END_CODE) ? (Map<String, Object>) redisUtils.get(CITY) : (Map<String, Object>) redisUtils.get(REGION);
if (ObjectUtils.isEmpty(map)) {
map = getRegionList();
......@@ -375,19 +367,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
public Map<String, Object> getRegionList() {
//查询省下所有的行政区划市,封装并存入redis
// 查询省下所有的行政区划市,封装并存入redis
Map<String, Object> map1 = new HashMap<>();
List<LinkedHashMap> cityList;
FeignClientResult tree = privilegeFeginService.getTree();
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
//获取陕西省regionCode
// 获取陕西省regionCode
String regionCode = ((List<LinkedHashMap>) privilegeFeginService.getProvince("1").getResult()).get(0).get("regionCode").toString();
cityList = deleteTreeData(result, regionCode);
Map<String, Object> cityMap = new HashMap<>();
cityMap.put(regionCode, cityList);
map1.put(regionCode, cityList);
redisUtils.set(CITY, cityMap);
//查询市下所有的行政区划区,封装并存入redis
// 查询市下所有的行政区划区,封装并存入redis
if (!ObjectUtils.isEmpty(cityList)) {
List<LinkedHashMap> region = (List<LinkedHashMap>) privilegeFeginService.getTree().getResult();
Map<String, Object> map = new HashMap<>();
......@@ -456,7 +448,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<LinkedHashMap> list = new ArrayList<>();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//修改数据
// 修改数据
if (type.equals(e.get("parentRegionCode").toString())) {
e.put("children", null);
e.put("sequenceNbr", e.get("regionCode"));
......@@ -473,33 +465,33 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
/**
* 具体生成监管码和电梯96333识别码逻辑
*/
private synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333,String supervisionCode) {
private synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333, String supervisionCode) {
Map<String, String> resultMap = new HashMap<>();
StringBuilder supervisorCode = new StringBuilder();
StringBuilder elevatorCode = new StringBuilder();
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
String prefix;
//判断是否需要生成96333电梯码
// 判断是否需要生成96333电梯码
if (equipCategory.startsWith("3") && !XIAN.equals(city)) {
//判断数据是否携带96333电梯码,携带则使用,不携带则生成
if("null".equals(code96333)){
// 判断数据是否携带96333电梯码,携带则使用,不携带则生成
if ("null".equals(code96333)) {
prefix = getPrefix(EquipmentCategoryEnum.XZQHDT.getCode(), city);
//查询未使用的电梯码
// 查询未使用的电梯码
categoryOtherInfo = categoryOtherInfoMapper.selectElevatorCode(prefix, EquipmentCategoryEnum.WSY.getCode());
//如果存在未使用的电梯码则启用未使用的否则创建
// 如果存在未使用的电梯码则启用未使用的否则创建
String elevator = ObjectUtils.isEmpty(categoryOtherInfo) ? createElevatorCode(city, county) : categoryOtherInfo.getCode();
if(!ObjectUtils.isEmpty(categoryOtherInfo)){
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333",categoryOtherInfo.getCode()));
if (!ObjectUtils.isEmpty(categoryOtherInfo)) {
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333", categoryOtherInfo.getCode()));
}
elevatorCode.append(elevator);
resultMap.put("creatStatus",CREATE);
resultMap.put("creatStatus", CREATE);
} else {
elevatorCode.append(code96333);
resultMap.put("creatStatus",NOT_CREATE);
resultMap.put("creatStatus", NOT_CREATE);
}
}
//判断原数据是否存在监管码,存在则用原监管码即可,不存在则生成
if("null".equals(supervisionCode)){
// 判断原数据是否存在监管码,存在则用原监管码即可,不存在则生成
if ("null".equals(supervisionCode)) {
String supervisor = createSupervisorCode(city, county, equipCategory);
supervisorCode.append(supervisor);
} else {
......@@ -512,18 +504,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
SupervisoryCodeInfo selectOne = supervisoryCodeInfoMapper.selectOne(new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionCode));
//将生成的码添加到码表中,码的使用状态为初始状态
// 将生成的码添加到码表中,码的使用状态为初始状态
String equState = EquipmentCategoryEnum.CSZT.getCode();
supervisoryCodeInfo.setCode96333(String.valueOf(elevatorCode));
supervisoryCodeInfo.setCreateStatus(resultMap.get("creatStatus"));
supervisoryCodeInfo.setSupervisoryCode(String.valueOf(supervisorCode));
supervisoryCodeInfo.setStatus(equState);
if(ObjectUtils.isEmpty(selectOne)){
if (ObjectUtils.isEmpty(selectOne)) {
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
} else {
selectOne.setCode96333(String.valueOf(elevatorCode));
supervisoryCodeInfoMapper.update(selectOne,
new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",selectOne.getSupervisoryCode()));
new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", selectOne.getSupervisoryCode()));
}
resultMap.put("superviseCode", ObjectUtils.isEmpty(supervisorCode) ? null : supervisorCode.toString());
resultMap.put("code96333", ObjectUtils.isEmpty(elevatorCode) ? null : elevatorCode.toString());
......@@ -544,15 +536,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
*/
private String createSupervisorCode(String city, String county, String equipCategory) {
StringBuilder supervisorCode = new StringBuilder();
//生成监管码前缀
// 生成监管码前缀
Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), county);
String division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), city).get("code").toString() : divisionMap.get("code").toString();
supervisorCode.append(division).append(equipCategory).append("-");
//获取行政区划区县、市是否存在历史监管码
// 获取行政区划区县、市是否存在历史监管码
CategoryOtherInfo supervisor = categoryOtherInfoMapper.selectSupervisorCode(supervisorCode.toString());
//生成对应监管码
// 生成对应监管码
if (!ObjectUtils.isEmpty(supervisor) && supervisor.getSupervisoryCode() != null) {
//获取补零位长度
// 获取补零位长度
String supervisoryCode = supervisor.getSupervisoryCode().substring(6);
long num = Long.valueOf(supervisoryCode) + 1;
int numLength = String.valueOf(num).length();
......@@ -578,7 +570,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
*/
private String createElevatorCode(String city, String county) {
StringBuilder elevatorCode = new StringBuilder();
//生成生成96333电梯码前缀
// 生成生成96333电梯码前缀
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
String elevator = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString();
elevatorCode.append(elevator);
......@@ -587,10 +579,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (ValidationUtil.isEmpty(initSupervisoryCode)) {
elevatorCode.append(EquipmentCategoryEnum.getValue.get(elevator));
} else {
//获取行政区划区县、市是否存在历史96333电梯码
// 获取行政区划区县、市是否存在历史96333电梯码
CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString(), null);
if (!ObjectUtils.isEmpty(elevatorOtherInfo) && elevatorOtherInfo.getCode() != null) {
//获取补零位长度
// 获取补零位长度
String elevatorCode1 = elevatorOtherInfo.getCode().substring(2);
long num = Long.parseLong(elevatorCode1) + 1;
int numLength = String.valueOf(num).length();
......@@ -727,12 +719,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ValidationUtil.isEmpty(level)) {
Page<Map<String, Object>> m = new Page<>();
if (LEVEL.equals(level)) {
//企业
// 企业
map.put("USE_UNIT_CREDIT_CODE", companyCode);
m = this.getPage(map);
map.remove("USE_UNIT_CREDIT_CODE");
} else {
//监管单位
// 监管单位
map.put("ORG_BRANCH_CODE", code);
m = this.getPage(map);
map.remove("ORG_BRANCH_CODE");
......@@ -750,7 +742,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
objectPage.setSize(Long.valueOf(map.get("size").toString()));
objectPage.setCurrent(Long.valueOf(map.get("number").toString()));
model.setResult(objectPage);
//设备状态码对应枚举值
// 设备状态码对应枚举值
List<Map<String, Object>> records = model.getResult().getRecords();
List<Map<String, Object>> result = new ArrayList<>();
for (Map<String, Object> record : records) {
......@@ -791,7 +783,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return list;
}
public List<EquipExportVo> getEquipExportData(EquipExportDto dto){
public List<EquipExportVo> getEquipExportData(EquipExportDto dto) {
ArrayList<EquipExportVo> list = new ArrayList<>();
List<JSONObject> objectList = getCompanyType();
if (!ValidationUtil.isEmpty(dto.getEQU_STATE())) {
......@@ -803,14 +795,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String companyCode = object.getString("companyCode");
if (!ValidationUtil.isEmpty(level)) {
if (LEVEL.equals(level)) {
//企业
// 企业
dto.setUSE_UNIT_CREDIT_CODE(companyCode);
} else {
//监管单位
// 监管单位
dto.setORG_BRANCH_CODE(orgCode);
}
List<EquipExportVo> equipExportData = equipmentCategoryMapper.getEquipExportData(dto);
if (!ObjectUtils.isEmpty(equipExportData) ) {
if (!ObjectUtils.isEmpty(equipExportData)) {
list.addAll(equipExportData);
}
}
......@@ -850,23 +842,22 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
@Override
@Async
public void createEquipmentCategoryData() {
if(log.isInfoEnabled()){
if (log.isInfoEnabled()) {
log.info("初始化一码通总览数据开始");
}
equipmentCategoryDataService.remove(new QueryWrapper<>());
getCategoryData(null,null);
getCategoryData(null, null);
}
private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes,List<String> orgBranchCodes) {
private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes, List<String> orgBranchCodes) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<EquipmentCategoryData> list = new ArrayList<>();
// 查询所有单位
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes,orgBranchCodes);
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes, orgBranchCodes);
// 统计查询不同单位、不同装备定义、不同状态下的设备数量
List<UseUnitCreditCodeCategoryDto> equipCountList = equipmentCategoryMapper.useUnitCreditCodeCategoryCount();
// 查询8大类设备定义
......@@ -874,31 +865,31 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
// 组织EquipmentCategoryData表数据
for (Map<String, Object> map : allUnitList) {
EquipmentCategoryData equipmentCategoryData = new EquipmentCategoryData();
if(ObjectUtils.isEmpty(map.get("supervise_org_code")) || ObjectUtils.isEmpty(map.get(USE_CODE))){
if (ObjectUtils.isEmpty(map.get("supervise_org_code")) || ObjectUtils.isEmpty(map.get(USE_CODE))) {
continue;
}
equipmentCategoryData.setOrgBranchCode(map.get("supervise_org_code").toString());
equipmentCategoryData.setUnitCode(map.get(USE_CODE).toString());
// 指定单位的设备统计信息
List<UseUnitCreditCodeCategoryDto> unitEquipCountList = equipCountList.stream().filter(r->r.getUseUnitCreditCode().equals(map.get(USE_CODE).toString())).collect(Collectors.toList());
unitEquipCountList = unitEquipCountList.stream().filter(r->r.getOrgBranchCode().equals(map.get(ORG_BRANCH_CODE).toString())).collect(Collectors.toList());
List<UseUnitCreditCodeCategoryDto> unitEquipCountList = equipCountList.stream().filter(r -> r.getUseUnitCreditCode().equals(map.get(USE_CODE).toString())).collect(Collectors.toList());
unitEquipCountList = unitEquipCountList.stream().filter(r -> r.getOrgBranchCode().equals(map.get(ORG_BRANCH_CODE).toString())).collect(Collectors.toList());
for (EquipmentCategory category : equipmentCategories) {
Map<String, Object> data = new HashMap<>();
data.put("waitClaim", unitEquipCountList.stream().filter(r->r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.DRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("alreadyClaim", unitEquipCountList.stream().filter(r->r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.YRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("refuseClaim", unitEquipCountList.stream().filter(r->r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.YJL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("waitClaim", unitEquipCountList.stream().filter(r -> r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.DRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("alreadyClaim", unitEquipCountList.stream().filter(r -> r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.YRL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
data.put("refuseClaim", unitEquipCountList.stream().filter(r -> r.getEquList().equals(category.getCode()) && EquipmentCategoryEnum.YJL.getName().equals(r.getClaimStatus())).collect(Collectors.summarizingLong(UseUnitCreditCodeCategoryDto::getTotal)).getSum());
this.set8CategoryCountData(equipmentCategoryData, category, data);
}
equipmentCategoryData.setRecDate(new Date());
list.add(equipmentCategoryData);
}
if(!ObjectUtils.isEmpty(unitCodes)){
equipmentCategoryDataMapper.delete(new QueryWrapper<EquipmentCategoryData>().in("unit_code",unitCodes));
if (!ObjectUtils.isEmpty(unitCodes)) {
equipmentCategoryDataMapper.delete(new QueryWrapper<EquipmentCategoryData>().in("unit_code", unitCodes));
}
equipmentCategoryDataService.saveOrUpdateBatch(list);
stopWatch.stop();
if(log.isInfoEnabled()){
log.info("总览数据刷新结束,耗时:{} 秒",stopWatch.getTotalTimeSeconds());
if (log.isInfoEnabled()) {
log.info("总览数据刷新结束,耗时:{} 秒", stopWatch.getTotalTimeSeconds());
}
return list;
}
......@@ -937,19 +928,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private List<EquipmentCategory> getEquipmentCategories() {
LambdaQueryWrapper<EquipmentCategory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.likeLeft(EquipmentCategory::getCode,"000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode,"7000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode,"F000");
lambdaQueryWrapper.likeLeft(EquipmentCategory::getCode, "000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode, "7000");
lambdaQueryWrapper.ne(EquipmentCategory::getCode, "F000");
return equipmentCategoryMapper.selectList(lambdaQueryWrapper);
}
private List<EquipmentCategoryData> updateEquipmentCategoryData(String unitCode,String orgBranchCode) {
private List<EquipmentCategoryData> updateEquipmentCategoryData(String unitCode, String orgBranchCode) {
List<String> unitCodeList = new ArrayList<>();
unitCodeList.add(unitCode);
List<String> orgBranchCodeList = new ArrayList<>();
orgBranchCodeList.add(orgBranchCode);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList,null);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList, null);
return equipmentCategoryData;
}
......@@ -960,7 +951,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<String> records = new ArrayList<>();
List<ESEquipmentCategoryDto> list = new ArrayList<>();
if(recordList.toString().contains("[")){
if (recordList.toString().contains("[")) {
for (String record : (List<String>) recordList) {
records.add(record);
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
......@@ -973,7 +964,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString());
list.add(esEquipmentCategoryDto);
}
//删除监管码表数据
// 删除监管码表数据
List<String> superviseCodeList = superviseInfoMapper.selectSuperviseCodeList(records);
List<Map<String, Object>> unitCodeAndOrgBranchCodeList = superviseInfoMapper.selectUnitCodeList(records);
List<String> unitCodeList = new ArrayList<>();
......@@ -983,17 +974,17 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
orgBranchCodeList.add(String.valueOf(objectMap.get("orgBranchCode")));
}
if(!ObjectUtils.isEmpty(superviseCodeList)){
if (!ObjectUtils.isEmpty(superviseCodeList)) {
supervisoryCodeInfoMapper.updateStatus(superviseCodeList);
}
//删除涉及的19张表的数据
// 删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(records);
// 根据统一信用代码更新总览表
if(!ObjectUtils.isEmpty(unitCodeList)){
getCategoryData(unitCodeList,orgBranchCodeList);
if (!ObjectUtils.isEmpty(unitCodeList)) {
getCategoryData(unitCodeList, orgBranchCodeList);
}
//删除es中的数据
// 删除es中的数据
esEquipmentCategory.deleteAll(list);
return records;
}
......@@ -1017,7 +1008,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String claimStatus = String.valueOf(superviseMap.get("claimStatus"));
String code96333 = String.valueOf(superviseMap.get("code96333"));
String operateType = String.valueOf(superviseMap.get("operateType"));
//生成码
// 生成码
Map<String, String> codeMap;
if (EquipmentCategoryEnum.YRL.getName().equals(claimStatus)) {
log.info("准备生成监管码或96333电梯识别码");
......@@ -1025,15 +1016,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String county = String.valueOf(superviseMap.get("county"));
String equCategory = String.valueOf(superviseMap.get("equCategory"));
String supervisionCode = String.valueOf(superviseMap.get("supervisionCode"));
//生成码
// 生成码
codeMap = creatCode(city, county, equCategory, code96333, supervisionCode);
log.info("已生成对应监管码或96333电梯识别码");
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
// 删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map.remove("data");
supervisionMap.put("CODE96333", codeMap.get("code96333"));
supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode"));
map.put(SUPERVISION_FROM_ID, supervisionMap);
//根据操作状态判断是调用新增还是修改接口
// 根据操作状态判断是调用新增还是修改接口
responseModel = "save".equals(operateType) ? idxFeignService.batchSubmit(null, null, null, null, map) :
idxFeignService.batchUpdate(null, null, map);
if (!ObjectUtils.isEmpty(responseModel) && "200".equals(String.valueOf(responseModel.getStatus()))) {
......@@ -1045,7 +1036,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
map.remove("data");
supervisionMap.put("CODE96333", "null".equals(code96333) ? null : code96333);
map.put(SUPERVISION_FROM_ID, supervisionMap);
//根据操作状态判断是调用新增还是修改接口
// 根据操作状态判断是调用新增还是修改接口
responseModel = "save".equals(operateType) ? idxFeignService.batchSubmit(null, null, null, null, map) :
idxFeignService.batchUpdate(null, null, map);
} else {
......@@ -1053,11 +1044,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
responseModel = idxFeignService.batchUpdate(null, null, map);
}
stopWatch.stop();
if(log.isInfoEnabled()){
log.info("通用提交耗时:{} 秒",stopWatch.getTotalTimeSeconds());
if (log.isInfoEnabled()) {
log.info("通用提交耗时:{} 秒", stopWatch.getTotalTimeSeconds());
}
} catch (Exception e) {
log.error(e.getMessage(),e);
log.error(e.getMessage(), e);
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.BF.getCode());
ResponseModel<Object> response = new ResponseModel<>();
response.setDevMessage(e.getMessage());
......@@ -1066,14 +1057,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
response.setStatus(HttpStatus.BAD_REQUEST.value());
return response;
} finally {
updateEquipmentCategoryData(unitCode,orgBranchCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code",supervisoryCodeInfo.getSupervisoryCode()));
updateEquipmentCategoryData(unitCode, orgBranchCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisoryCodeInfo.getSupervisoryCode()));
}
return responseModel;
}
//分页查询所有数据
// 分页查询所有数据
public Page<Map<String, Object>> getAll(Map<String, Object> map) {
String tableName = map.get(TABLENAME).toString();
Assert.hasText(tableName, "表名不能为空");
......@@ -1091,7 +1082,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return page;
}
//查询总条数
// 查询总条数
public Long counts(Map<String, Object> map) {
String tableName = map.get(TABLENAME).toString();
Assert.hasText(tableName, "表名不能为空");
......@@ -1099,6 +1090,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Long count = bizJdbcTemplate.queryForObject(countSql, Long.class);
return count;
}
/**
* es数据同步
*
......@@ -1174,15 +1166,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* es保存设备数据
*/
public ESEquipmentCategoryDto saveESEquipmentCategory(Map<String, Object> map) {
//处理时间问题
String recDate1 = map.get("REC_DATE").toString().substring(0,19);
// 处理时间问题
String recDate1 = map.get("REC_DATE").toString().substring(0, 19);
long time = Timestamp.valueOf(recDate1).getTime();
map.put("REC_DATE",time);
map.put("REC_DATE", time);
ESEquipmentCategoryDto dto = JSONObject.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
ESEquipmentCategoryDto save = esEquipmentCategory.save(dto);
if (!ObjectUtils.isEmpty(save)) {
//同步到es后修改
// 同步到es后修改
UseInfo useInfo = new UseInfo();
useInfo.setIsNotEs(1);
useInfoMapper.update(useInfo, new QueryWrapper<UseInfo>().eq("RECORD",
......@@ -1190,6 +1182,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
return save;
}
public Page<JSONObject> queryByKeys(JSONObject map) {
// //根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
......@@ -1201,10 +1194,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String companyCode = object.getString("companyCode");
if (!ValidationUtil.isEmpty(level)) {
if (LEVEL.equals(level)) {
//企业
// 企业
map.put("USE_UNIT_CREDIT_CODE", companyCode);
} else {
//监管单位
// 监管单位
map.put("ORG_BRANCH_CODE", code);
}
}
......@@ -1214,16 +1207,16 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//通用匹配规则,条件构建
//SEQUENCE_NBR
// 通用匹配规则,条件构建
// SEQUENCE_NBR
if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("SEQUENCE_NBR", "*"+map.getString("SEQUENCE_NBR")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("SEQUENCE_NBR", "*" + map.getString("SEQUENCE_NBR") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("ORG_BRANCH_NAME", "*"+map.getString("ORG_BRANCH_NAME")+"*" ));
query.must(QueryBuilders.matchPhraseQuery("ORG_BRANCH_NAME", "*" + map.getString("ORG_BRANCH_NAME") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
......@@ -1233,12 +1226,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*"+map.getString("USE_UNIT_NAME")+"*"));
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*" + map.getString("USE_UNIT_NAME") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", "*"+map.getString("USE_UNIT_CREDIT_CODE")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", "*" + map.getString("USE_UNIT_CREDIT_CODE") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST_CODE"))) {
......@@ -1248,23 +1241,23 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST", "*"+map.getString("EQU_LIST")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST", "*" + map.getString("EQU_LIST") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_CATEGORY"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY", "*"+map.getString("EQU_CATEGORY")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY", "*" + map.getString("EQU_CATEGORY") + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("USE_ORG_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*"+map.getString("USE_ORG_CODE").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*" + map.getString("USE_ORG_CODE").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("CODE96333"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("CODE96333", "*"+map.getString("CODE96333").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("CODE96333", "*" + map.getString("CODE96333").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_CODE"))) {
......@@ -1275,7 +1268,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ObjectUtils.isEmpty(map.getString("SUPERVISORY_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*"+map.getString("SUPERVISORY_CODE").toLowerCase()+"*"));
meBuilder.must(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*" + map.getString("SUPERVISORY_CODE").toLowerCase() + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) {
......@@ -1288,14 +1281,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
query.must(QueryBuilders.matchPhraseQuery("ADDRESS", "*" + map.getString("ADDRESS") + "*"));
boolMust.must(query);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_STATE")) ) {
if (!ObjectUtils.isEmpty(map.getString("EQU_STATE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("EQU_STATE", map.getLong("EQU_STATE")));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("STATUS"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", "*"+map.getString("STATUS")+"*"));
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", "*" + map.getString("STATUS") + "*"));
boolMust.must(meBuilder);
}
builder.query(boolMust);
......@@ -1327,7 +1320,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return result;
}
//es统计总记录数
// es统计总记录数
public Long getCount(String indexs, RestHighLevelClient esClient) {
Long totle = 0L;
SearchRequest searchRequest = new SearchRequest(indexs);
......
......@@ -127,4 +127,14 @@ public class JgChangeRegistrationTransferDto extends BaseDto {
@ApiModelProperty(value = "设备移装完整详细地址")
private String fullAddress;
@ApiModelProperty(value = "设备名称")
private String productName;
@ApiModelProperty(value = "设备移装完整详细地址")
private String allAddress;
@ApiModelProperty(value = " 单位内部编号")
private String innerCode;
}
......@@ -228,4 +228,8 @@ public class JgTransferNoticeDto extends BaseDto {
@ApiModelProperty (value = "下一节点可执行人")
private String nextExecuteUserIds;
@TableField(exist = false)
private String equAddress;
}
......@@ -336,4 +336,10 @@ public class JgReformNotice extends BaseEntity {
*/
@TableField(value = "next_execute_user_ids")
private String nextExecuteUserIds;
/**
* 地址
*/
@TableField(exist = false)
private String fullAddress;
}
......@@ -96,7 +96,7 @@ public class JgScrapCancel extends BaseEntity {
private String receiveOrgName;
/**
* 接收机构公司代码
* 接收机构公司代码--暂时未用到
*/
@TableField("receive_company_code")
private String receiveCompanyCode;
......
......@@ -319,5 +319,8 @@ public class JgTransferNotice extends BaseEntity {
@TableField("\"next_execute_user_ids\"")
private String nextExecuteUserIds;
@TableField(exist = false)
private String equAddress;
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgScrapCancelEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgScrapCancelEq;
/**
* 报废注销设备关系表 Mapper 接口
......
......@@ -21,9 +21,9 @@ import java.util.Map;
*/
public interface IJgChangeRegistrationTransferService extends IService<JgChangeRegistrationTransfer> {
List<JgChangeRegistrationTransfer> updateTransfer(String submitType, JSONObject map, ReginParams reginParams);
List<JgChangeRegistrationTransferDto> updateTransfer(String submitType, JSONObject map, ReginParams reginParams);
List<JgChangeRegistrationTransfer> createTransfer(String submitType, JSONObject map, ReginParams reginParams);
List<JgChangeRegistrationTransferDto> createTransfer(String submitType, JSONObject map, ReginParams reginParams);
boolean deleteBatchBySequenceNbrs(Long[] sequenceNbrs);
......
......@@ -22,14 +22,16 @@
isn.promoter,
isn.next_execute_ids AS nextExecuteIds,
isn.instance_status AS instanceStatus,
isn.equ_address AS equAddress,
<!-- isn.equ_address AS equAddress,-->
isn.handle_date AS handleDate,
isn.equ_list AS equList,
isn.notice_report_url AS noticeReportUrl,
isn.create_user_id as createUserId,
isn.next_execute_user_ids as nextExecuteUserIds
FROM
tzs_jg_installation_notice isn
isn.next_execute_user_ids as nextExecuteUserIds,
concat(ibjui."PROVINCE_NAME", '', ibjui."CITY_NAME", '', ibjui."COUNTY_NAME", '', ibjui."STREET_NAME", '', ibjui."ADDRESS") as equAddress
FROM tzs_jg_installation_notice isn
LEFT JOIN tzs_jg_installation_notice_eq insEq on insEq.equip_transfer_id = isn.sequence_nbr
LEFT JOIN idx_biz_jg_use_info ibjui on insEq.equ_id = ibjui.RECORD
<where>
isn.is_delete = false
<if test="param != null ">
......
......@@ -10,10 +10,12 @@
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice">
select
isn.*,
concat(use."PROVINCE_NAME", '', use."CITY_NAME", '', use."COUNTY_NAME", '', use."STREET_NAME", '', use."ADDRESS") as fullAddress
concat(ibjui."PROVINCE_NAME", '', ibjui."CITY_NAME", '', ibjui."COUNTY_NAME", '', ibjui."STREET_NAME", '', ibjui."ADDRESS") as fullAddress,
ibjoi.SUPERVISORY_CODE as supervisoryCode
FROM tzs_jg_maintain_notice isn
left join tzs_jg_maintain_notice_eq isneq on isn.sequence_nbr = isneq.equip_transfer_id
LEFT JOIN idx_biz_jg_use_info use on isneq.equ_id = use.RECORD
LEFT JOIN idx_biz_jg_use_info ibjui on isneq.equ_id = ibjui.RECORD
LEFT JOIN idx_biz_jg_other_info ibjoi on isneq.equ_id = ibjoi.RECORD
<where>
isn.is_delete = 0
<if test="param != null ">
......
......@@ -26,12 +26,16 @@
ec."name" AS equipCateName,
tjtn.handle_date AS handleDate,
tjtn.create_user_id as createUserId,
tjtn.next_execute_user_ids as nextExecuteUserIds
tjtn.next_execute_user_ids as nextExecuteUserIds,
oi.SUPERVISORY_CODE as supervisoryCode,
concat(ibjui."PROVINCE_NAME", '', ibjui."CITY_NAME", '', ibjui."COUNTY_NAME", '', ibjui."STREET_NAME", '', ibjui."ADDRESS") as equAddress
FROM
tzs_jg_transfer_notice tjtn
LEFT JOIN tzs_jg_transfer_notice_eq re ON re.equip_transfer_id = tjtn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
LEFT JOIN tz_equipment_category ec ON ec.code = ri.equ_category
LEFT JOIN idx_biz_jg_use_info ibjui on re.equ_id = ibjui.RECORD
left join idx_biz_jg_other_info oi on oi.RECORD = re.equ_id
<where>
tjtn.is_delete = false
<if test="param != null ">
......
......@@ -192,7 +192,8 @@
ur.use_registration_code as useRegistrationCode,
date_format(ur.audit_pass_date, '%Y-%m-%d') as auditPassDate,
ur.receive_org_name as receiveOrgName,
ur.next_execute_user_ids as nextExecuteUserIds
ur.next_execute_user_ids as nextExecuteUserIds,
ur.is_xixian as isXixian
from tzs_jg_use_registration ur
LEFT JOIN tzs_jg_use_registration_eq re on ur.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri on re.equ_id = jri.RECORD
......
......@@ -192,15 +192,18 @@ public class CommonController extends BaseController {
Object result = commonService.invokeBusinessProcess(submitType, map, reginParams);
return ResponseHelper.buildResponse(result);
}
/**
* 根据公司id获取公司下人员
*
* 获取当前登录人企业类型
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/getCompanyUser")
@ApiOperation(httpMethod = "POST", value = "根据公司id获取公司下人员", notes = "根据公司id获取公司下人员")
public ResponseModel<Object> getCompanyUser(@RequestParam(value = "companyId") Long companyId) {
Object result = commonService.getCompanyUser(companyId);
return ResponseHelper.buildResponse(result);
@GetMapping(value = "/getCompanyType")
@ApiOperation(httpMethod = "GET", value = "获取当前登录人企业类型", notes = "获取当前登录人企业类型")
public ResponseModel<Object> getCompanyType() {
return ResponseHelper.buildResponse(iJgInstallationNoticeService.getCompanyType());
}
}
......@@ -10,7 +10,7 @@ import java.util.List;
public interface ICmWorkflowService {
List<ProcessTaskDTO> startBatch(ActWorkflowBatchDTO params);
ProcessTaskDTO complete(String taskId, TaskResultDTO data);
ProcessTaskDTO completeOrReject(String taskId, TaskResultDTO data, String operate);
ProcessTaskDTO rollBack(String processInstanceId);
}
......@@ -12,7 +12,6 @@ import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.List;
......@@ -23,6 +22,18 @@ import java.util.List;
@Slf4j
public class CmWorkflowServiceImpl implements ICmWorkflowService {
/**
* 通过
*/
public static String PASS_OPERATE = "0";
/**
* 驳回
*/
public static String REJECT_OPERATE = "1";
@Override
public List<ProcessTaskDTO> startBatch(ActWorkflowBatchDTO params) {
List<ProcessTaskDTO> processTasks;
......@@ -43,11 +54,23 @@ public class CmWorkflowServiceImpl implements ICmWorkflowService {
}
@Override
public ProcessTaskDTO complete(String taskId, TaskResultDTO data) {
ProcessTaskDTO processTaskDTO;
public ProcessTaskDTO completeOrReject(String taskId, TaskResultDTO data, String operate) {
ProcessTaskDTO processTaskDTO = null;
try {
log.info("开始请求工作流完成任务接口:/complete/standard/{taskId},请求参数:{},{}", taskId, JSONObject.toJSONString(data));
processTaskDTO = Workflow.taskV2Client.completeByTaskFroStandard(taskId, data).getResult();
if(PASS_OPERATE.equals(operate)){
// 通过操作
log.info("开始请求工作流完成任务接口:/complete/standard/{taskId},请求参数:{},{}", taskId, JSONObject.toJSONString(data));
processTaskDTO = Workflow.taskV2Client.completeByTaskFroStandard(taskId, data).getResult();
} else if(REJECT_OPERATE.equals(operate)) {
// 驳回操作
// todo 需要工作流适配调整后 进行切换 Workflow.taskV2Client.reject(taskId, data);
log.info("开始请求工作流驳回任务接口:/reject/{taskId},请求参数:{},{}", taskId, JSONObject.toJSONString(data));
processTaskDTO = Workflow.taskV2Client.completeByTaskFroStandard(taskId, data).getResult();
} else {
// 执行普通节点(提交)
log.info("开始请求工作流完成任务接口:/complete/standard/{taskId},请求参数:{},{}", taskId, JSONObject.toJSONString(data));
processTaskDTO = Workflow.taskV2Client.completeByTaskFroStandard(taskId, data).getResult();
}
} catch (InnerInvokException e) {
//拦截无审核人异常信息
String devMessage = e.getDevMessage();
......
......@@ -402,6 +402,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfoMap.put("fullAddress", fullAddress);
}
useInfoMap.put("useinfoSeq", useInfo.getSequenceNbr());
if(!ValidationUtil.isEmpty(useInfo.getLongitudeLatitude())){
useInfoMap.put("longitudeLatitude", JSON.parseObject(useInfo.getLongitudeLatitude()));
}
} else {
useInfoMap = convertCamelToUnderscore(useInfo, null);
if (!ValidationUtil.isEmpty(province)) {
......@@ -420,6 +424,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfoMap.put("FULLADDRESS", fullAddress);
}
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
if(!ValidationUtil.isEmpty(useInfo.getLongitudeLatitude())) {
useInfoMap.put("LONGITUDE_LATITUDE", JSON.parseObject(useInfo.getLongitudeLatitude()));
}
}
if (!useInfoMap.isEmpty()) {
Map<String, Object> filterMap = useInfoMap.entrySet()
......@@ -1078,42 +1085,43 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if(!ValidationUtil.isEmpty(list)){
equIds = list.stream().map(item -> item.get("SEQUENCE_NBR").toString()).collect(Collectors.toList());
}
//查询设备是否正在使用
//设备的使用标识是,安装告知和使用登记中有使用记录。
List<JgInstallationNoticeEq> installationNoticeEqList = jgInstallationNoticeEqServiceImpl.getListByEquIds(equIds);
List<JgUseRegistrationEq> useRegistrationEqList = jgUseRegistrationEqServiceImpl.getListByEquIds(equIds);
Map<String, Boolean> equIsUseMap = new HashMap<>();
if(!ValidationUtil.isEmpty(installationNoticeEqList) ){
equIsUseMap.putAll(installationNoticeEqList.stream().collect(Collectors.toMap(JgInstallationNoticeEq::getEquId, obj -> true, (oldValue, newValue) -> oldValue)));
}
if(!ValidationUtil.isEmpty(useRegistrationEqList)){
equIsUseMap.putAll(useRegistrationEqList.stream().collect(Collectors.toMap(JgUseRegistrationEq::getEquId, obj -> true, (oldValue, newValue) -> oldValue)));
}
// 查询设备地址
List<IdxBizJgUseInfo> useInfoListByEquIds = idxBizJgUseInfoService.getUseInfoListByEquIds(equIds);
Map<String, String> equAddressMap = new HashMap<>();
if(!ValidationUtil.isEmpty(useInfoListByEquIds)){
equAddressMap = useInfoListByEquIds.stream().collect(Collectors.toMap(IdxBizJgUseInfo::getRecord,
useInfo -> {
String fulladdress="";
if(!ValidationUtil.isEmpty(useInfo.getProvinceName())) fulladdress += useInfo.getProvinceName();
if(!ValidationUtil.isEmpty(useInfo.getCityName())) fulladdress += useInfo.getCityName();
if(!ValidationUtil.isEmpty(useInfo.getCountyName())) fulladdress += useInfo.getCountyName();
if(!ValidationUtil.isEmpty(useInfo.getStreetName())) fulladdress += useInfo.getStreetName();
if(!ValidationUtil.isEmpty(useInfo.getAddress())) fulladdress += useInfo.getAddress();
return fulladdress;
}
)
);
}
// 更新设备使用情况和设备地址
for(JSONObject item : list){
Boolean isUse = equIsUseMap.get(item.getString("SEQUENCE_NBR"));
String fullAddress = equAddressMap.get(item.getString("SEQUENCE_NBR"));
item.put("IS_USE", !ValidationUtil.isEmpty(isUse) ? isUse ? isUse : false : false);
item.put("ADDRESS", !ValidationUtil.isEmpty(fullAddress) ? fullAddress : "");
if(!ValidationUtil.isEmpty(equIds)){
//查询设备是否正在使用
//设备的使用标识是,安装告知和使用登记中有使用记录。
List<JgInstallationNoticeEq> installationNoticeEqList = jgInstallationNoticeEqServiceImpl.getListByEquIds(equIds);
List<JgUseRegistrationEq> useRegistrationEqList = jgUseRegistrationEqServiceImpl.getListByEquIds(equIds);
Map<String, Boolean> equIsUseMap = new HashMap<>();
if(!ValidationUtil.isEmpty(installationNoticeEqList) ){
equIsUseMap.putAll(installationNoticeEqList.stream().collect(Collectors.toMap(JgInstallationNoticeEq::getEquId, obj -> true, (oldValue, newValue) -> oldValue)));
}
if(!ValidationUtil.isEmpty(useRegistrationEqList)){
equIsUseMap.putAll(useRegistrationEqList.stream().collect(Collectors.toMap(JgUseRegistrationEq::getEquId, obj -> true, (oldValue, newValue) -> oldValue)));
}
// 查询设备地址
List<IdxBizJgUseInfo> useInfoListByEquIds = idxBizJgUseInfoService.getUseInfoListByEquIds(equIds);
Map<String, String> equAddressMap = new HashMap<>();
if(!ValidationUtil.isEmpty(useInfoListByEquIds)){
equAddressMap = useInfoListByEquIds.stream().collect(Collectors.toMap(IdxBizJgUseInfo::getRecord,
useInfo -> {
String fulladdress="";
if(!ValidationUtil.isEmpty(useInfo.getProvinceName())) fulladdress += useInfo.getProvinceName();
if(!ValidationUtil.isEmpty(useInfo.getCityName())) fulladdress += useInfo.getCityName();
if(!ValidationUtil.isEmpty(useInfo.getCountyName())) fulladdress += useInfo.getCountyName();
if(!ValidationUtil.isEmpty(useInfo.getStreetName())) fulladdress += useInfo.getStreetName();
if(!ValidationUtil.isEmpty(useInfo.getAddress())) fulladdress += useInfo.getAddress();
return fulladdress;
}
)
);
}
// 更新设备使用情况和设备地址
for(JSONObject item : list){
Boolean isUse = equIsUseMap.get(item.getString("SEQUENCE_NBR"));
String fullAddress = equAddressMap.get(item.getString("SEQUENCE_NBR"));
item.put("IS_USE", !ValidationUtil.isEmpty(isUse) ? isUse ? isUse : false : false);
item.put("ADDRESS", !ValidationUtil.isEmpty(fullAddress) ? fullAddress : "");
}
}
totle = response.getInternalResponse().hits().getTotalHits().value;
result.setRecords(list);
result.setTotal(totle);
......
......@@ -408,7 +408,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", operate);
dto.setVariable(map);
return cmWorkflowService.complete(jgChangeRegistrationName.getNextTaskId(), dto);
return cmWorkflowService.completeOrReject(jgChangeRegistrationName.getNextTaskId(), dto, operate);
}
private void convertField(JgChangeRegistrationNameDto model) {
......@@ -514,7 +514,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
}
dto.setVariable(map);
//执行流程
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(taskId, dto);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(taskId, dto, operate);
// 更新下一步执行人、创建待办
updateExecuteIds(instanceId, id, operate, processTaskDTO);
}
......
......@@ -373,7 +373,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
dto.setVariable(map);
dto.setNextExecuteUserCompanyCode(getNextUserOrgCode(operate, jgChangeRegistrationReform));
//执行流程
processTaskDTO = iCmWorkflowService.complete(taskId, dto);
processTaskDTO = iCmWorkflowService.completeOrReject(taskId, dto, operate);
// 更新下一步执行人
updateExecuteIds(instanceId, jgChangeRegistrationReform, operate, processTaskDTO);
......@@ -792,7 +792,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
*/
public String getSummaryInfo(JgChangeRegistrationReform jgChangeRegistrationReform) {
String result = "来自%s【%s】的业务办理,【申请单号:%s】";
return String.format(result, Optional.ofNullable(jgChangeRegistrationReform.getEquipListName()).orElse("无"), jgChangeRegistrationReform.getSupervisoryCode(), jgChangeRegistrationReform.getApplyNo());
return String.format(result, Optional.ofNullable(jgChangeRegistrationReform.getEquipListName()).orElse("无"), Optional.ofNullable(jgChangeRegistrationReform.getSupervisoryCode()).orElse("无"), jgChangeRegistrationReform.getApplyNo());
}
/**
......
......@@ -51,8 +51,6 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -143,7 +141,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
* @param map
* @return
*/
public List<JgChangeRegistrationTransfer> createTransfer(String submitType, JSONObject map, ReginParams reginParams) {
public List<JgChangeRegistrationTransferDto> createTransfer(String submitType, JSONObject map, ReginParams reginParams) {
Map<String, Object> tableData = (Map<String, Object>) map.get(TABLE_PAGE_ID);
if (ValidationUtil.isEmpty(tableData)) {
......@@ -366,7 +364,16 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
modelDtos.add(dto);
commonService.buildTaskModel(modelDtos);
}
return Collections.singletonList(oldTransfer);
JgChangeRegistrationTransferDto resultDto = new JgChangeRegistrationTransferDto();
Bean.copyExistPropertis(oldTransfer,resultDto);
//组装返回信息,添加设备信息的展示
resultDto.setEquCategory((String) tableData.get("equCategoryDesc"));
resultDto.setProductName((String) tableData.get("productName"));
resultDto.setAllAddress(oldTransfer.getFullAddress());
resultDto.setEquCode((String) tableData.get("equCode"));
resultDto.setInnerCode((String) tableData.get("useInnerCode"));
return Collections.singletonList(resultDto);
}
/**
......@@ -375,7 +382,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
* @param map
* @return
*/
public List<JgChangeRegistrationTransfer> updateTransfer(String submitType, JSONObject map, ReginParams reginParams) {
public List<JgChangeRegistrationTransferDto> updateTransfer(String submitType, JSONObject map, ReginParams reginParams) {
return this.createTransfer(submitType, map, reginParams);
}
......@@ -406,7 +413,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
map.put("approvalStatus", "提交");
}
//执行流程
ProcessTaskDTO complete = icmWorkflowService.complete(taskId, dto);
ProcessTaskDTO complete = icmWorkflowService.completeOrReject(taskId, dto, operate);
workflowResult = commonService.buildWorkFlowInfo(Collections.singletonList(complete)).get(0);
// 更新下一步执行人
this.updateExecuteIds(instanceId, transfer, operate, workflowResult);
......@@ -1140,7 +1147,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
*/
public String getSummaryInfo(JgChangeRegistrationTransfer transfer) {
String result = "来自%s【%s】的业务办理,【申请单号:%s】";
return String.format(result, Optional.ofNullable(transfer.getEquipListName()).orElse("无"), transfer.getSupervisoryCode(), transfer.getApplyNo());
return String.format(result, Optional.ofNullable(transfer.getEquipListName()).orElse("无"), Optional.ofNullable(transfer.getSupervisoryCode()).orElse("无"), Optional.ofNullable(transfer.getApplyNo()).orElse("无"));
}
public String getNextUserOrgCode(String operate, JgChangeRegistrationTransfer contract) {
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil;
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.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -21,8 +18,6 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationUnitService;
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.utils.ImageUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
......@@ -30,21 +25,16 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
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.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
......@@ -55,11 +45,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.time.LocalDate;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -279,7 +266,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
task.setVariable(map);
//执行流程
task.setNextExecuteUserCompanyCode(noticeDto.getReceiveOrgCode());
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(taskId, task);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(taskId, task, op);
JgChangeRegistrationUnit bean = new JgChangeRegistrationUnit();
BeanUtils.copyProperties(noticeDto, bean);
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
......@@ -776,7 +763,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
}
task.setVariable(map);
//执行流程
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(taskId, task);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(taskId, task, op);
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
String taskName1 = "";
String nextTaskId = "";
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.TaskMessageDto;
......@@ -24,7 +22,6 @@ import com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo;
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.RegistrationInfoMapper;
......@@ -44,7 +41,6 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.util.*;
/**
......@@ -135,7 +131,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
}
dto.setVariable(commMap);
ProcessTaskDTO processTaskDTO = iCmWorkflowService.complete(jgEnableDisable.getNextTaskId(), dto);
ProcessTaskDTO processTaskDTO = iCmWorkflowService.completeOrReject(jgEnableDisable.getNextTaskId(), dto, submit);
processTaskDTOS.add(processTaskDTO);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
......@@ -500,7 +496,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
workDto.setVariable(commMap);
workDto.setComment(opinion);
workDto.setNextExecuteUserCompanyCode("1".equals(op) ? jgEnableDisable.getUseUnitCreditCode() : jgEnableDisable.getReceiveCompanyCode());
processTaskDTO = iCmWorkflowService.complete(jgEnableDisable.getNextTaskId(), workDto);
processTaskDTO = iCmWorkflowService.completeOrReject(jgEnableDisable.getNextTaskId(), workDto, op);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
return workflowResultDto;
......
......@@ -96,14 +96,15 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
JgEquipTransferEq jgEquipTransferEq = buildJgEquipTransferEq(obj, applyNo);
JgEquipTransfer transfer = buildJgEquipTransfer(model, applyNo, reginParams, submitType, workflowResultList, i);
transfer.setSupervisoryCode(String.valueOf(obj.get("SUPERVISORY_CODE")));
transfer.setEquList(String.valueOf(obj.get("EQU_LIST")));
transfer.setEquDefine(String.valueOf(obj.get("EQU_DEFINE")));
transfer.setEquCategory(String.valueOf(obj.get("EQU_CATEGORY")));
transfer.setProductName(String.valueOf(obj.get("PRODUCT_NAME")));
transfer.setUseRegistCode(String.valueOf(obj.get("USE_ORG_CODE")));
transfer.setUseInnerCode(String.valueOf(obj.get("USE_INNER_CODE")));
transfer.setEquAddress(String.valueOf(obj.get("ADDRESS")));
transfer.setEquCode(String.valueOf(obj.get("EQU_CODE")));
transfer.setEquList(Objects.toString(obj.get("EQU_LIST"),""));
transfer.setEquDefine(Objects.toString(obj.get("EQU_DEFINE"),""));
transfer.setEquCategory(Objects.toString(obj.get("EQU_CATEGORY"),""));
transfer.setProductName(Objects.toString(obj.get("PRODUCT_NAME"),""));
transfer.setUseRegistCode(Objects.toString(obj.get("USE_ORG_CODE"),""));
transfer.setUseRegistCode(Objects.toString(obj.get("USE_ORG_CODE"), ""));
transfer.setUseInnerCode(Objects.toString(obj.get("USE_INNER_CODE"),""));
transfer.setEquAddress(Objects.toString(obj.get("ADDRESS"),""));
transfer.setEquCode(Objects.toString(obj.get("EQU_CODE"),""));
transferList.add(transfer);
equipTransferEqList.add(jgEquipTransferEq);
});
......@@ -137,7 +138,7 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
private TaskModelDto buildTempTaskModelDto(JgEquipTransfer item) {
return TaskModelDto.builder()
.model(item)
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), item.getSupervisoryCode(), item.getApplyNo()))
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), Objects.toString(item.getSupervisoryCode(), ""), item.getApplyNo()))
.taskCode(item.getApplyNo())
.taskType(BusinessTypeEnum.JG_EQUIPMENT_HANDOVER.getCode())
.relationId(item.getSequenceNbr()+"")
......@@ -183,8 +184,8 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
.taskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName())
.flowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode())
.flowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName())
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), item.getSupervisoryCode(), item.getApplyNo()))
.taskDesc(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), item.getSupervisoryCode(), item.getApplyNo()))
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), Objects.toString(item.getSupervisoryCode(), ""), item.getApplyNo()))
.taskDesc(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), Objects.toString(item.getSupervisoryCode(), ""), item.getApplyNo()))
.startUserId(item.getCreateUserId())
.startUser(item.getCreateUserName())
.startUserCompanyName(item.getCreateUserCompanyName())
......@@ -292,7 +293,7 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
}
dto.setVariable(commMap);
dto.setNextExecuteUserCompanyCode(transfer.getInstallUnitCreditCode());
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(transfer.getNextTaskId(), dto);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(transfer.getNextTaskId(), dto, op);
// 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(equipTransferDto, transfer);
......@@ -345,7 +346,7 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
workDto.setNextExecuteUserCompanyCode("1".equals(op) ? jgEquipTransfer.getUseUnitCreditCode() : jgEquipTransfer.getInstallUnitCreditCode());
workDto.setVariable(commMap);
workDto.setComment(jgEquipTransferDto.getProcessAdvice());
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(jgEquipTransfer.getNextTaskId(), workDto);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(jgEquipTransfer.getNextTaskId(), workDto, op);
// 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
jgEquipTransfer.setPromoter(reginParams.getUserModel().getUserId());
......
......@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
......@@ -274,7 +273,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
dto.setVariable(commMap);
//下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(notice.getReceiveOrgCreditCode());
processTaskDTO = iCmWorkflowService.complete(notice.getNextTaskId(), dto);
processTaskDTO = iCmWorkflowService.completeOrReject(notice.getNextTaskId(), dto, op);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice);
......@@ -954,7 +953,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
workDto.setVariable(commMap);
workDto.setComment(jgTransferNotice.getProcessAdvice());
workDto.setNextExecuteUserCompanyCode("1".equals(op) ? jgTransferNotice.getInstallUnitCreditCode() : jgTransferNotice.getReceiveOrgCreditCode());
processTaskDTO = iCmWorkflowService.complete(jgTransferNotice.getNextTaskId(), workDto);
processTaskDTO = iCmWorkflowService.completeOrReject(jgTransferNotice.getNextTaskId(), workDto, op);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
return workflowResultDto;
......
......@@ -17,7 +17,6 @@ import com.yeejoin.amos.boot.module.jg.api.dto.JgMaintainNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.dto.TaskMessageDto;
import com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto;
import com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisableEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
......@@ -219,7 +218,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
//下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(notice.getReceiveCompanyCode());
dto.setVariable(commMap);
processTaskDTO = cmWorkflowService.complete(notice.getNextTaskId(), dto);
processTaskDTO = cmWorkflowService.completeOrReject(notice.getNextTaskId(), dto, op);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice);
......@@ -295,7 +294,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if (Objects.nonNull(notice.getMaintainType())) {
noticeDto.setMaintainTypeDesc(dictionaries.stream().filter(d -> notice.getMaintainType().equals(d.getCode())).map(DataDictionary::getName).collect(Collectors.joining()));
}
noticeDto.setFullAddress(notice.getProvinceName() + notice.getCityName() + notice.getCountyName() + notice.getStreetName() + notice.getAddress());
return noticeDto;
}).collect(java.util.stream.Collectors.toList());
noticeDtoPage.setRecords(records);
......@@ -745,7 +743,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
//组装信息
TaskResultDTO taskResultDTO = assembleData(jgMaintainNotice, op, opinion);
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(jgMaintainNotice.getNextTaskId(), taskResultDTO);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(jgMaintainNotice.getNextTaskId(), taskResultDTO, op);
// 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
......
......@@ -177,7 +177,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
dto.setVariable(map);
//下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(getNextUserOrgCode(operate, contract));
ProcessTaskDTO complete = workflowService.complete(taskId, dto);
ProcessTaskDTO complete = workflowService.completeOrReject(taskId, dto, operate);
// 更新下一步执行人、创建待办
updateExecuteIds(instanceId, id, operate, complete);
}
......@@ -450,7 +450,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", op);
dto.setVariable(map);
return workflowService.complete(contract.getNextTaskId(), dto);
return workflowService.completeOrReject(contract.getNextTaskId(), dto, op);
}
private void buildRoleList(List<ProcessTaskDTO> processTasks, List<String> roleListNext, List<String> roleListAll) {
......
......@@ -202,7 +202,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}
dto.setNextExecuteUserCompanyCode(notice.getReceiveCompanyCode());
dto.setVariable(commMap);
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(notice.getNextTaskId(), dto);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(notice.getNextTaskId(), dto, op);
// 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice);
......@@ -420,10 +420,11 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
dto.setCreateUserName(reginParams.getUserModel().getRealName());
dto.setCreateUserId(reginParams.getUserModel().getUserId());
dto.setCreateUserCompanyName(reginParams.getCompany().getCompanyName());
dto.setEquCategory(String.valueOf(obj.get("EQU_CATEGORY")));
dto.setEquListCode(String.valueOf(obj.get("EQU_DEFINE")));
dto.setSupervisoryCode(String.valueOf(obj.get("SUPERVISORY_CODE")));
dto.setEquList(String.valueOf(obj.get("EQU_LIST")));
dto.setEquCategory(Objects.toString(obj.get("EQU_CATEGORY"),""));
dto.setEquListCode(Objects.toString(obj.get("EQU_DEFINE"),""));
dto.setSupervisoryCode(Objects.toString(obj.get("SUPERVISORY_CODE"),""));
dto.setEquList(Objects.toString(obj.get("EQU_LIST"),""));
dto.setFullAddress(Objects.toString(obj.get("ADDRESS"),""));
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
WorkflowResultDto workflowResult = workflowResultList.get(i);
......@@ -487,7 +488,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private TaskModelDto buildTempTaskModelDto(JgReformNotice item) {
return TaskModelDto.builder()
.model(item)
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), item.getSupervisoryCode(), item.getApplyNo()))
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), Objects.toString(item.getSupervisoryCode(), ""), item.getApplyNo()))
.taskCode(item.getApplyNo())
.taskType(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getCode())
.relationId(item.getSequenceNbr()+"")
......@@ -722,7 +723,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
workDto.setNextExecuteUserCompanyCode("1".equals(op) ? jgReformNotice.getInstallUnitCreditCode() : jgReformNotice.getReceiveOrgCode());
workDto.setVariable(commMap);
workDto.setComment(dto.getRemark());
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(jgReformNotice.getNextTaskId(), workDto);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(jgReformNotice.getNextTaskId(), workDto, op);
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
jgReformNotice.setPromoter(reginParams.getUserModel().getUserId());
jgReformNotice.setRemark(dto.getRemark());
......@@ -812,8 +813,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
.taskStatusLabel(statusEnum.getName())
.flowStatus(statusEnum.getCode())
.flowStatusLabel(statusEnum.getName())
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", transfer.getEquList(), transfer.getSupervisoryCode(), transfer.getApplyNo()))
.taskDesc(String.format("来自%s【%s】的业务办理,【申请单号:%s】", transfer.getEquList(), transfer.getSupervisoryCode(), transfer.getApplyNo()))
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", transfer.getEquList(), Objects.toString(transfer.getSupervisoryCode(), ""), transfer.getApplyNo()))
.taskDesc(String.format("来自%s【%s】的业务办理,【申请单号:%s】", transfer.getEquList(), Objects.toString(transfer.getSupervisoryCode(), ""), transfer.getApplyNo()))
.startUserCompanyName(transfer.getCreateUserCompanyName())
.startUserId(taskV2Model.getStartUserId())
.startUser(taskV2Model.getStartUser())
......
......@@ -193,7 +193,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
dto.setProcessDefinitionKey("scrapCancelNew");
dto.setBusinessKey(applyNoList.get(0));
dto.setCompleteFirstTask(Boolean.TRUE);
//下一节点执行人单位(下节点接收机构code)
// 下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(model.getReceiveOrgCode());
list.add(dto);
......@@ -314,9 +314,9 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
LambdaQueryWrapper<JgScrapCancel> lambda = new QueryWrapper<JgScrapCancel>().lambda();
lambda.eq(JgScrapCancel::getSequenceNbr, id);
JgScrapCancel jgScrapCancel = this.baseMapper.selectOne(lambda);
//删除代办消息
// 删除代办消息
commonService.deleteTaskModel(String.valueOf(jgScrapCancel.getSequenceNbr()));
//更新jgScrapCancel数据
// 更新jgScrapCancel数据
jgScrapCancel.setIsDelete(true);
this.updateById(jgScrapCancel);
}
......@@ -324,6 +324,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
}
public JgScrapCancelDto updateInfo(String submitType, JgScrapCancelDto jgScrapCancelDto, String op) {
if (Objects.isNull(jgScrapCancelDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
}
......@@ -335,7 +336,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// 更新并提交
// 发起流程
if (!StringUtils.hasText(jgScrapCancelDto.getInstanceId())) {
//未进流程直接发起并执行
// 未进流程直接发起并执行
List<ProcessTaskDTO> processTasks;
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
......@@ -367,7 +368,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
createTaskModel(bean, taskName, "1", nextUserIds);
} else {
// 已经在流程中,执行一步
ProcessTaskDTO processTaskDTO = submit(jgScrapCancelDto.getNextTaskId());
ProcessTaskDTO processTaskDTO = submit(jgScrapCancelDto);
String nextTaskId = processTaskDTO.getNextTask().get(0).getId();
String taskName = processTaskDTO.getNextTask().get(0).getName();
this.buildRoleList(Collections.singletonList(processTaskDTO), roleListNext, roleListAll);
......@@ -408,7 +409,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
String supervisoryCode = otherInfo.getSupervisoryCode();
jgScrapCancelDto.setSupervisoryCode(supervisoryCode);
}
//更新操作
// 更新操作
JgScrapCancel bean = new JgScrapCancel();
BeanUtils.copyProperties(jgScrapCancelDto, bean);
bean.setCancelCertificate(JSON.toJSONString(jgScrapCancelDto.getCancelCertificateList()));
......@@ -428,9 +429,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
taskV2Model.setTaskDesc("");
taskV2Model.setTaskContent(this.buildTaskContent(jgScrapCancelDto.getEquList(), jgScrapCancelDto.getSupervisoryCode(), jgScrapCancelDto.getCancelType(), jgScrapCancelDto.getApplyNo()));
taskV2Model.setTaskName(taskName);
taskV2Model.setTaskDesc("");
taskV2Model.setTaskCode(jgScrapCancelDto.getApplyNo());
taskV2Model.setExecuteUserIds(nextUserIds);
taskV2Model.setRelationId(jgScrapCancelDto.getInstanceId());
FlowStatusEnum flowStatusEnum = this.getTaskStatus(operate);
taskV2Model.setTaskStatus(flowStatusEnum.getCode());
......@@ -490,15 +489,18 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
}
}
public ProcessTaskDTO submit(String taskId) {
//组装信息
public ProcessTaskDTO submit(JgScrapCancelDto jgScrapCancelDto) {
JgScrapCancel model = this.getById(jgScrapCancelDto.getSequenceNbr());
// 组装信息
String op = "提交";
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
dto.setTaskId(jgScrapCancelDto.getNextTaskId());
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", "提交");
map.put("approvalStatus", op);
dto.setNextExecuteUserCompanyCode(model.getReceiveOrgCode());
dto.setVariable(map);
return cmWorkflowService.complete(taskId, dto);
return cmWorkflowService.completeOrReject(jgScrapCancelDto.getNextTaskId(), dto, op);
}
public Map<String, Object> queryBySequenceNbr(Long sequenceNbr) {
......@@ -585,7 +587,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
public void flowExecute(String equList, Long id, String instanceId, String operate, String comment) {
JgScrapCancel jgScrapCancel = this.getBaseMapper().selectById(id);
String taskId = jgScrapCancel.getNextTaskId();
//组装信息
// 组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
......@@ -596,10 +598,10 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
map.put("approvalStatus", "提交");
}
dto.setVariable(map);
//下一节点执行人单位(下节点接收机构code)
// 下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(this.getNextUserOrgCode(operate, jgScrapCancel));
//执行流程
ProcessTaskDTO processTaskDTO = cmWorkflowService.complete(taskId, dto);
// 执行流程
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(taskId, dto, operate);
// 更新下一步执行人、创建待办
updateExecuteIds(equList, instanceId, id, operate, processTaskDTO);
}
......@@ -701,8 +703,10 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
if ("0".equals(operate)) {
code = jgScrapCancel.getReceiveOrgCode();
} else {
//驳回
if (WorkFlowStatusEnum.CANCEL_RECEIVE.getPass().equals(jgScrapCancel.getAuditStatus()) || WorkFlowStatusEnum.CANCEL_RECEIVE.getReject().equals(jgScrapCancel.getAuditStatus()) || WorkFlowStatusEnum.CANCEL_RECEIVE.getRollBack().equals(jgScrapCancel.getAuditStatus())) {
// 驳回
if (WorkFlowStatusEnum.CANCEL_RECEIVE.getPass().equals(jgScrapCancel.getAuditStatus()) ||
WorkFlowStatusEnum.CANCEL_RECEIVE.getReject().equals(jgScrapCancel.getAuditStatus()) ||
WorkFlowStatusEnum.CANCEL_RECEIVE.getRollBack().equals(jgScrapCancel.getAuditStatus())) {
code = jgScrapCancel.getUseUnitCode();
}
}
......
......@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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;
......@@ -15,7 +14,6 @@ import com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.dto.TaskMessageDto;
import com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto;
import com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
......@@ -319,7 +317,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
dto.setVariable(commMap);
dto.setNextExecuteUserCompanyCode(notice.getReceiveOrgCode());
processTaskDTO = iCmWorkflowService.complete(notice.getNextTaskId(), dto);
processTaskDTO = iCmWorkflowService.completeOrReject(notice.getNextTaskId(), dto, op);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice);
......@@ -485,6 +483,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
} else {
dto.setNextExecuteUserIds(reginParams.getUserModel().getUserId());
}
dto.setEquipCateName(obj.getOrDefault("EQU_CATEGORY", "").toString());
dto.setEquList(String.valueOf(obj.get("EQU_LIST")));
dto.setSupervisoryCode(String.valueOf(obj.get("SUPERVISORY_CODE")));
dto.setInstallUnitName(reginParams.getCompany().getCompanyName());
......@@ -499,6 +498,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
dto.setCreateUserName(reginParams.getUserModel().getRealName());
dto.setCreateUserId(reginParams.getUserModel().getUserId());
dto.setEquAddress(obj.getOrDefault("ADDRESS", "").toString());
list.add(dto);
equipList.add(jgRelationEquip);
});
......@@ -802,7 +802,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
workDto.setNextExecuteUserCompanyCode("1".equals(op) ? jgTransferNotice.getInstallUnitCreditCode() : jgTransferNotice.getReceiveOrgCode());
workDto.setVariable(commMap);
workDto.setComment(opinion);
processTaskDTO = iCmWorkflowService.complete(jgTransferNotice.getNextTaskId(), workDto);
processTaskDTO = iCmWorkflowService.completeOrReject(jgTransferNotice.getNextTaskId(), workDto, op);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
return workflowResultDto;
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.JgUseRegistrationDto;
......@@ -47,6 +48,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.time.LocalDate;
import java.util.*;
......@@ -113,6 +115,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambdaSelect);
JSONObject map = JSONObject.parseObject(jgRegistrationHistory.getChangeData());
map.remove("status");
// 安全管理员
if (map.containsKey("safetyManagerName")){
map.put("safetyManager", map.get("safetyManagerName"));
}
IdxBizJgUseInfo useInfo = new IdxBizJgUseInfo();
BeanUtil.copyProperties(map, useInfo);
// 城市
......@@ -195,12 +201,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgUseRegistration.setUseUnitCreditCode(String.valueOf(map.get("useUnitCreditCode")));
String equType = this.baseMapper.getEquType(String.valueOf(map.get("equipId")));
if (map.containsKey("receiveOrgCode")) {
//维保单位信息
// 接收单位信息
String[] splitMaintenanceUnitCode = String.valueOf(map.getString("receiveOrgCode")).split("_");
jgUseRegistration.setReceiveCompanyCode(splitMaintenanceUnitCode[0]);
jgUseRegistration.setReceiveOrgName(splitMaintenanceUnitCode[1]);
}
// 安全管理员
if (map.containsKey("safetyManager")) {
String[] data = String.valueOf(map.getString("safetyManager")).split("_");
map.put("safetyManagerName", data[1]);
}
// 使用单位提交
jgUseRegistration.setUseUnitCreditCode(reginParams.getCompany().getCompanyCode());
jgUseRegistration.setCreateUserId(reginParams.getUserModel().getUserId());
......@@ -479,9 +490,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 驳回到使用单位
dto.setNextExecuteUserCompanyCode(jgUseRegistration.getUseUnitCreditCode());
} else {
dto.setNextExecuteUserCompanyCode(jgUseRegistration.getReceiveOrgCode());
dto.setNextExecuteUserCompanyCode(jgUseRegistration.getReceiveCompanyCode());
}
ProcessTaskDTO complete = cmWorkflowService.complete(jgUseRegistration.getNextTaskId(), dto);
ProcessTaskDTO complete = cmWorkflowService.completeOrReject(jgUseRegistration.getNextTaskId(), dto, operate);
ArrayList<ProcessTaskDTO> processTaskDTOS = new ArrayList<>();
processTaskDTOS.add(complete);
List<WorkflowResultDto> resultDto = commonServiceImpl.buildWorkFlowInfo(processTaskDTOS);
......@@ -726,15 +737,32 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
LambdaQueryWrapper<IdxBizJgOtherInfo> lambdaOth = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
lambdaOth.eq(IdxBizJgOtherInfo::getRecord, record);
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(lambdaOth);
// 使用信息
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, record);
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda);
// 注册信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaReg = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, record);
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
if (ObjectUtils.isEmpty(registerInfo.getEquCode())) {
//生成设备注册代码
StringBuffer stringBuffer = new StringBuffer();
String ym = null;
try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
} catch (ParseException e) {
log.error("日期转换失败:{}", e);
}
stringBuffer.append(registerInfo.getEquCategory()).append(useInfo.getCity()).append(ym);
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(stringBuffer.toString());
String deviceRegistrationCode = responseModel.getResult();
if (!ObjectUtils.isEmpty(deviceRegistrationCode)) {
registerInfo.setEquCode(deviceRegistrationCode);
idxBizJgRegisterInfoMapper.updateById(registerInfo);
}
}
if (ObjectUtils.isEmpty(otherInfo.getSupervisoryCode())) {
// 使用信息
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, record);
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda);
// 注册信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaReg = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, record);
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
// 生成监管码、96333码
Map<String, Object> map = new HashMap<>();
map.put("cityCode", useInfo.getCity());
......
......@@ -182,4 +182,17 @@ public class JyjcInspectionResult extends BaseEntity {
*/
@TableField("trace_id")
private String traceId;
/**
* 检验检测单位名称(冗余)
*/
@TableField(value = "inspection_unit_name")
private String inspectionUnitName;
/**
* 报检单位名称(冗余)
*/
@TableField(value = "application_unit_name")
private String applicationUnitName;
}
......@@ -41,6 +41,8 @@ public enum DocumentEnum {
AGGLRY("aqglry", "安全管理人员证"),
ZYRYZ("zyry", "作业人员证"),
WBHT("wbht", "维保合同"),
AQBHZZ("aqbhzz", "安全保护装置的型式试验证书"),
ZJHG("zjhg", "自检合格证明"),
AZJY("azjy", "安装监检报告");
private String code;
......
......@@ -95,7 +95,9 @@ public class JyjcInspectionResultModel extends BaseModel {
@ApiModelProperty(value = "检验检测类型名称(冗余)")
private String inspectionTypeName;
@ApiModelProperty(value = "报检日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date applicationDate;
@ApiModelProperty("检验结果方式")
......@@ -143,10 +145,10 @@ public class JyjcInspectionResultModel extends BaseModel {
@ApiModelProperty(value = "设备使用地址")
private String equUseAddress;
@ApiModelProperty(value = "检验检测单")
@ApiModelProperty(value = "检验检测单位名称(冗余)")
private String inspectionUnitName;
@ApiModelProperty(value = "报检单位")
@ApiModelProperty(value = "报检单位名称(冗余)")
private String applicationUnitName;
@ApiModelProperty(value = "监管码")
......
......@@ -61,23 +61,54 @@
<select id="selectForPage"
resultType="com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel">
select res.sequence_nbr, res.inspection_unit_code, res.application_no, res.application_unit_code,
res.equip_unicode, res.result_status, res.license_number, res.result_no, res.inspector, res.inner_person_code,
res.inspection_conclusion, res.inspection_date, res.next_inspection_date, res.inspection_start_date,
res.inspection_end_date, res.inspection_result_summary, res.non_conformance, res.remark,
res.rec_user_id, res.rec_date, res.biz_type,res.equ_category, res.inspection_type, res.inspection_type_name,
res.application_date,use_unit_name, use_unit_credit_code, province_name, city_name, county_name, street_name, equ_code, use_inner_code, ibjri.equ_list,
tec1.name equ_list_name, ibjri.equ_category , ibjoi.SUPERVISORY_CODE supervisoryCode
, use_org_code, res.equ_define, ibjui.ADDRESS equUseAddress, bei.use_unit inspectionUnitName, bei1.use_unit applicationUnitName, cdb.name inspectionTypeName
from tz_jyjc_inspection_result res
left join idx_biz_jg_other_info ibjoi on res.equip_unicode = ibjoi.record
left join idx_biz_jg_use_info ibjui on ibjui.record = res.equip_unicode
left join idx_biz_jg_register_info ibjri on ibjui.record = ibjri.record
left join tz_equipment_category tec on ibjri.equ_category = tec.code
left join tz_equipment_category tec1 on ibjri.equ_list = tec1.code
left join tz_base_enterprise_info bei on res.inspection_unit_code = bei.use_code
left join tz_base_enterprise_info bei1 on res.application_unit_code = bei1.use_code
left join cb_data_dictionary cdb on res.inspection_type = cdb.code
SELECT
res.sequence_nbr,
res.inspection_unit_code,
res.application_no,
res.application_unit_code,
res.equip_unicode,
res.result_status,
res.license_number,
res.result_no,
res.inspector,
res.inner_person_code,
res.inspection_conclusion,
res.inspection_date,
res.next_inspection_date,
res.inspection_start_date,
res.inspection_end_date,
res.inspection_result_summary,
res.non_conformance,
res.remark,
res.rec_user_id,
res.rec_date,
res.biz_type,
res.equ_category,
res.inspection_type,
res.inspection_type_name,
res.application_date,
res.inspection_unit_name,
res.application_unit_name,
res.inspection_type_name,
ibjui.use_unit_name,
ibjui.use_unit_credit_code,
ibjui.province_name,
ibjui.city_name,
ibjui.county_name,
ibjui.street_name,
ibjri.equ_code,
ibjui.use_inner_code,
ibjri.equ_list,
(SELECT NAME FROM tz_equipment_category WHERE code = res.equ_list) AS equ_list_name,
ibjoi.SUPERVISORY_CODE supervisoryCode,
ibjri.use_org_code,
res.equ_define,
ibjui.ADDRESS equUseAddress
FROM
tz_jyjc_inspection_result res
LEFT JOIN idx_biz_jg_other_info ibjoi ON res.equip_unicode = ibjoi.record
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjui.record = res.equip_unicode
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjui.record = ibjri.record
<where>
<if test="jyjcInspectionResultModel.applicationNo != '' and jyjcInspectionResultModel.applicationNo != null">
and res.application_no like concat('%',#{jyjcInspectionResultModel.applicationNo},'%')
......@@ -86,19 +117,19 @@
and res.application_unit_code = #{jyjcInspectionResultModel.applicationUnitCode}
</if>
<if test="jyjcInspectionResultModel.useOrgCode != '' and jyjcInspectionResultModel.useOrgCode != null">
and use_org_code like concat('%',#{jyjcInspectionResultModel.useOrgCode},'%')
and ibjri.use_org_code like concat('%',#{jyjcInspectionResultModel.useOrgCode},'%')
</if>
<if test="jyjcInspectionResultModel.useInnerCode != '' and jyjcInspectionResultModel.useInnerCode != null">
and use_inner_code like concat('%',#{jyjcInspectionResultModel.useInnerCode},'%')
and ibjui.use_inner_code like concat('%',#{jyjcInspectionResultModel.useInnerCode},'%')
</if>
<if test="jyjcInspectionResultModel.equCode != '' and jyjcInspectionResultModel.equCode != null">
and equ_code like concat('%',#{jyjcInspectionResultModel.equCode},'%')
and ibjri.equ_code like concat('%',#{jyjcInspectionResultModel.equCode},'%')
</if>
<if test="jyjcInspectionResultModel.equipUnicode != '' and jyjcInspectionResultModel.equipUnicode != null">
and res.equip_unicode like concat('%',#{jyjcInspectionResultModel.equipUnicode},'%')
</if>
<if test="jyjcInspectionResultModel.equCategory != '' and jyjcInspectionResultModel.equCategory != null">
and ibjri.equ_category = #{jyjcInspectionResultModel.equCategory}
<if test="jyjcInspectionResultModel.equList != '' and jyjcInspectionResultModel.equList != null">
and ibjri.equ_list = #{jyjcInspectionResultModel.equList}
</if>
<if test="jyjcInspectionResultModel.inspectionType != '' and jyjcInspectionResultModel.inspectionType != null">
and res.inspection_type = #{jyjcInspectionResultModel.inspectionType}
......@@ -107,7 +138,7 @@
AND TO_DAYS(res.application_date) = TO_DAYS(#{jyjcInspectionResultModel.applicationDate})
</if>
<if test="jyjcInspectionResultModel.useUnitCreditCode != '' and jyjcInspectionResultModel.useUnitCreditCode != null">
and use_unit_credit_code like concat('%',#{jyjcInspectionResultModel.useUnitCreditCode},'%')
and ibjui.use_unit_credit_code like concat('%',#{jyjcInspectionResultModel.useUnitCreditCode},'%')
</if>
<if test="jyjcInspectionResultModel.inspectionUnitCode != '' and jyjcInspectionResultModel.inspectionUnitCode != null">
and res.inspection_unit_code = #{jyjcInspectionResultModel.inspectionUnitCode}
......@@ -130,6 +161,6 @@
</otherwise>
</choose>
</where>
ORDER BY application_date DESC
ORDER BY res.application_date DESC
</select>
</mapper>
......@@ -12,7 +12,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.sun.org.apache.regexp.internal.RE;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
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.service.impl.DataDictionaryServiceImpl;
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;
......@@ -113,6 +117,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
@Autowired
TaskModelServiceImpl taskModelService;
@Autowired
DataDictionaryServiceImpl dataDictionaryService;
public JyjcInspectionApplicationModel save(@RequestBody JSONObject obj) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
......@@ -353,6 +360,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
@Override
public Boolean deleteBatchData(List<Long> sequenceNbr) {
// List<JyjcInspectionApplication> jyjcInspectionApplications = this.getBaseMapper().selectBatchIds(sequenceNbr);
......@@ -398,6 +406,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
@Override
public Page<JyjcInspectionApplicationModel> queryForPageList(Page<JyjcInspectionApplication> page, JyjcInspectionApplicationModel model) {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(),
RequestContext.getToken())).toString(), ReginParams.class);
......@@ -520,7 +529,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
TaskResultDTO task = new TaskResultDTO();
task.setResultCode("approvalStatus");
task.setTaskId(taskId);
task.setComment("");
task.setComment(params.getOrDefault("comments","").toString());
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", "0");
task.setVariable(map);
......@@ -581,17 +590,21 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
for (int i = 0; i < applicationEquipModels.size(); i++) {
JyjcInspectionResult resultModel = new JyjcInspectionResult();
resultModel.setInspectionUnitCode(inspectionApplicationModel.getInspectionUnitCode());
resultModel.setInspectionUnitName(inspectionApplicationModel.getInspectionUnitName());
resultModel.setApplicationNo(inspectionApplicationModel.getApplicationNo());
resultModel.setApplicationUnitCode(inspectionApplicationModel.getApplicationUnitCode());
resultModel.setApplicationUnitName(inspectionApplicationModel.getApplicationUnitName());
resultModel.setResultStatus(ResultStatusEnum.NO_RESULT.getCode());
resultModel.setApplicationDate(inspectionApplicationModel.getApplicationDate());
resultModel.setResultType(inspectionApplicationModel.getResultType());
//resultModel.setResultType("input");
resultModel.setInspectionType(inspectionApplicationModel.getInspectionType());
resultModel.setInspectionTypeName(this.getDictNameByCode(inspectionApplicationModel.getInspectionType()));
// 解析设备
resultModel.setBizType(inspectionApplicationModel.getBizType());
resultModel.setResultNo(codes.get(i));
resultModel.setEquipUnicode(applicationEquipModels.get(i).getEquipUnicode());//设备唯一标识
//设备唯一标识
resultModel.setEquipUnicode(applicationEquipModels.get(i).getEquipUnicode());
resultModel.setEquDefine(applicationEquipModels.get(i).getEquDefine());
resultModel.setEquCategory(applicationEquipModels.get(i).getEquCategory());
resultModel.setEquList(applicationEquipModels.get(i).getEquList());
......@@ -603,6 +616,11 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
JyjcInspectionApplicationHandlerFactory.apply(type).notifyInspectionUnit(thiryPartParams);
}
private String getDictNameByCode(String code) {
DataDictionary dataDictionary = dataDictionaryService.getByCode(code,"JYJC");
return dataDictionary != null ? dataDictionary.getName() : "";
}
/**
* 退回
*
......@@ -626,8 +644,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
TaskResultDTO task = new TaskResultDTO();
task.setResultCode("approvalStatus");
task.setTaskId(taskId);
task.setComment("");
HashMap<String, Object> map = new HashMap<>();
task.setComment(params.getOrDefault("comments","").toString()); HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", "1");
task.setVariable(map);
//执行流程
......
......@@ -143,7 +143,7 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
categoryOtherInfoMapper.selectSupervisorCodeMaxValue().forEach(vo ->
stringRedisTemplate.opsForValue().set(vo.getName(), String.valueOf(vo.getValue())));
return Long.parseLong(Objects.requireNonNull(redisTemplate.opsForValue().get(sequenceKey)));
return Long.parseLong(redisTemplate.opsForValue().get(sequenceKey) == null ? "0" : redisTemplate.opsForValue().get(sequenceKey));
}
/**
......
......@@ -24,7 +24,7 @@
"type": "lifting"
},
{
"name": "场机动车辆",
"name": "场(厂)内专用机动车辆",
"code": "5000",
"image": "upload/tzs/common/image/总览厂车.png",
"imageUrl": "upload/tzs/common/image/监管厂车.png",
......@@ -105,7 +105,7 @@
"imageUrl": "upload/tzs/common/image/监管起重机械.png"
},
{
"name": "场机动车辆",
"name": "场(厂)内专用机动车辆",
"code": "5000",
"image": "upload/tzs/common/image/总览厂车.png",
"imageUrl": "upload/tzs/common/image/监管厂车.png"
......@@ -156,7 +156,7 @@
"imageUrl": "upload/tzs/common/image/监管起重机械.png"
},
{
"name": "场机动车辆",
"name": "场(厂)内专用机动车辆",
"code": "5000",
"image": "upload/tzs/common/image/总览厂车.png",
"imageUrl": "upload/tzs/common/image/监管厂车.png"
......@@ -264,7 +264,7 @@
"type": "lifting"
},
{
"name": "场机动车辆",
"name": "场(厂)内专用机动车辆",
"code": "5000",
"image": "upload/tzs/common/image/总览厂车.png",
"imageUrl": "upload/tzs/common/image/监管厂车.png",
......@@ -300,7 +300,7 @@
"type": "lifting"
},
{
"name": "场机动车辆",
"name": "场(厂)内专用机动车辆",
"code": "5000",
"image": "upload/tzs/common/image/总览厂车.png",
"imageUrl": "upload/tzs/common/image/监管厂车.png",
......
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