Commit d05ee4e6 authored by 刘林's avatar 刘林

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

parents 710658f9 0cf77189
......@@ -560,7 +560,7 @@ public class EquipClaimServiceImpl {
.filter(s -> s.contains("_"))
.map(s -> s.split("_", 2))
.filter(parts -> parts.length == 2)
.map(parts -> parts[0])
.map(parts -> parts[1])
.orElse(null), null));
useInfo.setUseDate(Objects.toString(equipInfo.get("useDate"), null));
useInfo.setLongitudeLatitude(toJSONString(equipInfo.get("longitudeLatitude")));
......@@ -725,6 +725,24 @@ public class EquipClaimServiceImpl {
}
/**
* 根据code获取市区县名字
*
* @param key key
* @param codeKey codeKey
* @param mapData 表单信息
* @return name
*/
private String getRegionName(String key, String codeKey, JSONObject mapData) {
return Optional.ofNullable((List<LinkedHashMap>) redisUtils.get(key))
.flatMap(list -> list.stream()
.filter(item -> String.valueOf(item.get("regionCode"))
.equals(String.valueOf(mapData.get(codeKey))))
.map(item -> (String) item.get("regionName"))
.findFirst())
.orElse("");
}
/**
* 认领 更新设备信息
*
* @param equipInfo
......@@ -751,6 +769,18 @@ public class EquipClaimServiceImpl {
// 有证纳管状态 没填写 给默认值
useInfo.setEquState(EquimentEnum.ZAIYONG.getCode().toString());
}
if (!ObjectUtils.isEmpty(useInfo.getProvince())) {
useInfo.setProvinceName("陕西省");
}
if (!ObjectUtils.isEmpty(useInfo.getCity())) {
useInfo.setCityName(this.getRegionName("CITY", "CITY".toLowerCase(), equipInfo));
}
if (!ObjectUtils.isEmpty(useInfo.getCounty())) {
useInfo.setCountyName(this.getRegionName("REGION", "COUNTY".toLowerCase(), equipInfo));
}
if (!ObjectUtils.isEmpty(useInfo.getFactoryUseSiteStreet())) {
useInfo.setStreetName(this.getRegionName("STREET", "factoryUseSiteStreet", equipInfo));
}
idxBizJgUseInfoService.saveOrUpdateData(useInfo);
// 设计信息
IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgDesignInfo.class);
......@@ -770,6 +800,18 @@ public class EquipClaimServiceImpl {
constructionInfo.setRecord(record);
constructionInfo.setRecDate(timestamp);
constructionInfo.setSequenceNbr(Objects.toString(equipInfo.get("CONSTRUCTIONINFO_SEQ")));
if (!ObjectUtils.isEmpty(constructionInfo.getConstructionProvince())) {
constructionInfo.setConstructionProvinceName("陕西省");
}
if (!ObjectUtils.isEmpty(constructionInfo.getConstructionCity())) {
constructionInfo.setConstructionCityName(this.getRegionName("CITY", "constructionCity", equipInfo));
}
if (!ObjectUtils.isEmpty(constructionInfo.getConstructionCounty())) {
constructionInfo.setConstructionCountyName(this.getRegionName("REGION", "constructionCounty", equipInfo));
}
if (!ObjectUtils.isEmpty(constructionInfo.getConstructionStreet())) {
constructionInfo.setConstructionStreetName(this.getRegionName("STREET", "constructionStreet", equipInfo));
}
iIdxBizJgConstructionInfoService.saveOrUpdateData(constructionInfo);
// 注册登记信息
IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgRegisterInfo.class);
......@@ -1005,7 +1047,7 @@ public class EquipClaimServiceImpl {
jgUseRegistrationEqServiceImpl.save(useRegEq);
});
// 历史表
JSONObject changeData = getJgUseRegistrationChangeData(equipInfo,projectContraption, applyNo);
JSONObject changeData = getJgUseRegistrationChangeData(equipInfo, projectContraption, applyNo);
JgRegistrationHistory registrationHistory = JgRegistrationHistory.builder()
.registrationClass("使用登记")
.changeData(JSON.toJSONString(changeData))
......@@ -1094,9 +1136,10 @@ public class EquipClaimServiceImpl {
/**
* 组装使用登记表单的回显数据
*
* @return
*/
private JSONObject getJgUseRegistrationChangeData(JSONObject equipInfo,IdxBizJgProjectContraption proCon, String spplyNo) {
private JSONObject getJgUseRegistrationChangeData(JSONObject equipInfo, IdxBizJgProjectContraption proCon, String spplyNo) {
CompanyBo company = getSelectedOrgInfo().getCompany();
JSONObject jsonObject = new JSONObject();
jsonObject.putAll(equipInfo);
......@@ -1131,7 +1174,7 @@ public class EquipClaimServiceImpl {
JSONArray pipeArray = JSON.parseArray(toJSONString(equipInfo.get(PIPELINE_LIST)));
pipeArray.forEach(item -> {
JSONObject itemObj = JSON.parseObject(toJSONString(item));
itemObj.put("productName",itemObj.get("pipeName"));
itemObj.put("productName", itemObj.get("pipeName"));
});
jsonObject.put("equipmentLists", pipeArray);
jsonObject.put("useRegistrationCode", equipInfo.get(USE_REGISTRATION_CODE).toString());
......@@ -1183,7 +1226,7 @@ public class EquipClaimServiceImpl {
for (Map<String, Object> pipeline : pipelineList) {
boolean hasRecord = !ObjectUtils.isEmpty(pipeline.get("record"));
String record = hasRecord ? pipeline.get("record").toString() : UUID.randomUUID().toString();
pipeline.put("record",record);
pipeline.put("record", record);
// 更新时工业管道(8300)检验检测信息
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgInspectionDetectionInfo.class);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
......@@ -1191,7 +1234,7 @@ public class EquipClaimServiceImpl {
Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst();
Map<String, Object> mapOrDefault = optional.orElse(Collections.emptyMap());
inspectionDetectionInfo.setInspectOrgName((String) mapOrDefault.getOrDefault("useUnit", inspectionDetectionInfo.getInspectOrgName()));
inspectionDetectionInfo.setInspectConclusion((String) pipeline.getOrDefault("inspectConclusionCode", "" ));
inspectionDetectionInfo.setInspectConclusion((String) pipeline.getOrDefault("inspectConclusionCode", ""));
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(nowDate);
inspectionDetectionInfo.setSequenceNbr(null);
......@@ -1418,7 +1461,7 @@ public class EquipClaimServiceImpl {
if (!toUpdateParamsPipelineList.isEmpty()) {
iIdxBizJgTechParamsPipelineService.updateBatchByRecord(toUpdateParamsPipelineList);
}
equipInfo.put(PIPELINE_LIST,pipelineList);
equipInfo.put(PIPELINE_LIST, pipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList);
}
......@@ -1444,12 +1487,12 @@ public class EquipClaimServiceImpl {
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.isNull(IdxBizJgProjectContraption::getProjectContraptionParentId));
boolean hasThisProCon = !ObjectUtils.isEmpty(oldProCon);
if (hasThisProCon){
if (hasThisProCon) {
List<String> records = idxBizJgUseInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getProjectContraptionId, oldProCon.getSequenceNbr()).list().stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList());
List<String> oldPipelineNumber = iIdxBizJgTechParamsPipelineService.lambdaQuery().select(IdxBizJgTechParamsPipeline::getPipelineNumber).in(IdxBizJgTechParamsPipeline::getRecord,records).list().stream().map(IdxBizJgTechParamsPipeline::getPipelineNumber).collect(Collectors.toList());
List<String> oldPipelineNumber = iIdxBizJgTechParamsPipelineService.lambdaQuery().select(IdxBizJgTechParamsPipeline::getPipelineNumber).in(IdxBizJgTechParamsPipeline::getRecord, records).list().stream().map(IdxBizJgTechParamsPipeline::getPipelineNumber).collect(Collectors.toList());
List<String> newPipelineNumber = pipelineList.stream().map(item -> item.get("pipelineNumber").toString()).collect(Collectors.toList());
boolean noCommonElements = Collections.disjoint(oldPipelineNumber, newPipelineNumber);
if (!noCommonElements){
if (!noCommonElements) {
throw new BadRequest("管道编号与本单位原装置下的重复!");
}
}
......
......@@ -236,9 +236,9 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
if (SUBMIT_TYPE_FLOW.equals(submit)) {
if (CollectionUtils.isEmpty(equipmentLists) ||
equipmentLists.stream().map(v -> (String) v.get("chargingMedium")).distinct().count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同充装介质设备!");
// 不限制一个车只能使用一个充装介质的气瓶
if (CollectionUtils.isEmpty(equipmentLists)) {
throw new BadRequest("请选择设备信息!");
}
// 检查设备是否已经在使用
// 个人主体的身份证(6600_620422199903010258) 特殊处理 只取_后的身份证号码
......@@ -1878,10 +1878,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
.convertValue(map.get("equipmentLists"), new TypeReference<List<Map<String, Object>>>() {
});
// 设备列表判空 + 选择同一充装介质的设备
// 20250801修改为不限制一个车只能使用一个充装介质的气瓶
Optional.ofNullable(equipmentLists)
.filter(list -> !list.isEmpty())
.filter(list -> list.stream().map(v -> (String) v.get("chargingMedium")).distinct().count() == 1)
.orElseThrow(() -> new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同充装介质设备!"));
// .filter(list -> list.stream().map(v -> (String) v.get("chargingMedium")).distinct().count() == 1)
.orElseThrow(() -> new BadRequest("请选择设备信息!"));
// 确保车用气瓶使用信息中填写的【使用登记证编号】【车辆VIN】与列表所选择设备的一致
Optional.of(equipmentLists)
.filter(eqLists -> {
......@@ -2230,10 +2231,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
JgVehicleInformationDto vehicleInfoDto = JSON.parseObject(JSON.toJSONString(map), JgVehicleInformationDto.class);
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
// 20250801修改为不限制一个车只能使用一个充装介质的气瓶
Optional.ofNullable(equipmentLists)
.filter(list -> !list.isEmpty())
.filter(list -> list.stream().map(v -> (String) v.get("chargingMedium")).distinct().count() == 1)
.orElseThrow(() -> new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同充装介质设备!"));
// .filter(list -> list.stream().map(v -> (String) v.get("chargingMedium")).distinct().count() == 1)
.orElseThrow(() -> new BadRequest("请选择设备信息!"));
CompanyBo company = reginParams.getCompany();
vehicleInfoDto.setCreateDate(new Date());
......
......@@ -230,4 +230,10 @@ public class TzsUserInfo extends BaseEntity {
*/
@TableField(value = "create_date")
protected Date createDate;
@TableField(value = "practice_registration")
private String practiceRegistration;
@TableField(value = "labor_contract")
private String laborContract;
}
......@@ -27,9 +27,9 @@ public enum ConditionEnum {
dateLt("小于", "lt", TechnicalParameter.ParamType.DATE),
dateGe("大于等于", "gte", TechnicalParameter.ParamType.DATE),
dateLe("小于等于", "lte", TechnicalParameter.ParamType.DATE),
in("包含","in", null),
notIn("不包含","notIn", null),
eq("等于","eq", null),
in("包含", "in", null),
notIn("不包含", "notIn", null),
eq("等于", "eq", null),
;
......@@ -49,4 +49,17 @@ public enum ConditionEnum {
}
return jsonArray;
}
public static JSONArray getByCode(String code, TechnicalParameter.ParamType paramType) {
JSONArray jsonArray = new JSONArray();
for (ConditionEnum value : values()) {
if (value.code == code && value.paramType == paramType) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("label", value.name);
jsonObject.put("value", value.code);
jsonArray.add(jsonObject);
}
}
return jsonArray;
}
}
......@@ -87,8 +87,10 @@ public enum EquipAdvanceSearchEnum {
if ("技术参数".equals(item.name)) {
jsonObject.put("type", "select2");
jsonObject.put("method", "POST");
jsonObject.put("conditions", ConditionEnum.getByCode("eq",item.paramType));
} else {
jsonObject.put("conditions", ConditionEnum.getByCode(item.paramType));
}
jsonObject.put("conditions", ConditionEnum.getByCode(item.paramType));
jsonObject.put("url", item.url);
jsonArray.add(jsonObject);
}
......
......@@ -1655,11 +1655,17 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
private void addTechParam(JSONObject techParam, JSONObject paramRange, EnhancedDynamicQueryBuilder builder) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(techParam));
JSONObject js = (JSONObject) jsonObject.get("value");
String field = js.getString("value");
String field = jsonObject.getString("value");
JSONObject js = (JSONObject) jsonObject.get("skillConfig");
String fieldType = js.getString("fieldType");
String itemCondition = paramRange.getString("itemCondition");
Object value = paramRange.get("value");
Object value = null;
if (paramRange.get("value") instanceof JSONObject) {
JSONObject jsValue = (JSONObject) paramRange.get("value");
value = jsValue.get("value");
} else {
value = paramRange.get("value");
}
String andOr = paramRange.getString("andOr");
getParamQuery(field, itemCondition, value, fieldType, true, null, builder, andOr);
}
......@@ -1893,7 +1899,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
builder.add(existsQuery, and);
}
}
} else if (field.equals("issueDate")) {
} else if (field.equals("issueDate")) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
switch (itemCondition) {
case "eq":
......@@ -2806,7 +2812,6 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
public JSONArray queryTypeZYXM(String type) {
JSONArray result = new JSONArray();
if ("特种设备安全管理和作业人员证".equals(type)) {
......
......@@ -236,7 +236,7 @@ public class DPSubServiceImpl {
// 气瓶区分车用和非车用
if ("2300".equals(param.getString("EQU_CATEGORY_CODE"))){
keyParams = JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.keyParams_2300_" +
("1".equals(param.getString("WHETHER_VEHICLE_CYLINDER")) ? "true" : "false"));
("否".equals(param.getString("WHETHER_VEHICLE_CYLINDER")) || "0".equals(param.getString("WHETHER_VEHICLE_CYLINDER")) ? "true" : "false"));
keyinfo.remove("keyParams_2300_true");
keyinfo.remove("keyParams_2300_false");
} else {
......@@ -254,7 +254,7 @@ public class DPSubServiceImpl {
((JSONArray) keyParams).stream().forEach(x -> {
JSONObject xobj = (JSONObject) x;
xobj.put("type", "text");
xobj.put("value", "param".equals(xobj.getString("source")) ? param.get(xobj.getString("key")) : result.get(xobj.getString("key")));
xobj.put("value", "param".equals(xobj.getString("source")) || "EQU_LIST".equals(xobj.getString("key")) ? param.get(xobj.getString("key")) : result.get(xobj.getString("key")));
});
this.processQRCodeWidget(content.getJSONObject("keyinfo").getJSONObject("qrcode"), result);
......@@ -776,7 +776,20 @@ public class DPSubServiceImpl {
));
jsonObject.put("value", fieldMap.get(value));
}
} else if("tableToTable".equals(xObj.getString("componentKey"))){
} else if ("selectTree".equals(xObj.getString("componentKey"))) {
String name = null;
if (!ValidationUtil.isEmpty(visualParams.getJSONObject("api")) && StrUtil.isNotEmpty(visualParams.getJSONObject("api").getString("apiPath"))) {
ResponseModel selectResult = this.getApiResult(visualParams.getJSONObject("api"), null, apiResult);
if (!ValidationUtil.isEmpty(selectResult) && selectResult.getStatus() == 200 && !ValidationUtil.isEmpty(value)) {
JSONArray result = (JSONArray) selectResult.getResult();
// 递归处理树形结构
name = getTreeNameById(result, value.toString());
}
} else if (!CollectionUtils.isEmpty(visualParams.getJSONArray("data"))) {
name = getTreeNameById(visualParams.getJSONArray("data"), value.toString());
}
jsonObject.put("value", name);
} else if ("tableToTable".equals(xObj.getString("componentKey"))) {
}
}
......@@ -786,6 +799,29 @@ public class DPSubServiceImpl {
return datas;
}
private String getTreeNameById(JSONArray jsonArray, String value) {
final String[] name = new String[1];
if (!ObjectUtils.isEmpty(jsonArray)) {
List<Object> collect = jsonArray.stream().filter(y -> value.equals(JsonValueUtils.getValueByKey(y, "id", "id"))).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
collect.stream().findFirst().ifPresent(z -> name[0] = ((JSONObject) z).getString("name"));
} else {
for (Object object : jsonArray) {
JSONObject object1 = (JSONObject) object;
if (!ObjectUtils.isEmpty(object1.get("children"))) {
name[0] = getTreeNameById(object1.getJSONArray("children"), value);
if (name[0] != null) {
return name[0];
}
}
}
}
} else {
return null;
}
return name[0];
}
public JSONObject buildSubFormData(JSONObject map, int i, JSONObject yObj, Object apiResult) {
JSONArray subs = map.getJSONArray("subs");
JSONArray children = yObj.getJSONArray("children");
......@@ -903,6 +939,7 @@ public class DPSubServiceImpl {
}
}
result = isRefactor ? resultMap : result;
responseModel.setResult(result);
} else if (result instanceof JSONArray) {
JSONArray jsonArray = (JSONArray) result;
......@@ -916,8 +953,8 @@ public class DPSubServiceImpl {
}
}
result = isRefactor ? jsonArray : result;
responseModel.setResult(result);
}
responseModel.setResult(result);
}
return responseModel;
}
......
......@@ -67,7 +67,7 @@ public class UserBizByTCMServiceImpl {
Map<String, Object> maps = new HashMap<>();
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectById(id);
TzsUserInfoVo tzsUserInfoVo = new TzsUserInfoVo();
BeanUtils.copyProperties(tzsUserInfo, tzsUserInfoVo, "identification", "profile", "post", "permissionItem", "appointDoc");
BeanUtils.copyProperties(tzsUserInfo, tzsUserInfoVo, "identification", "profile", "post", "permissionItem", "appointDoc","practiceRegistration","laborContract");
if (!ObjectUtils.isEmpty(tzsUserInfo.getPost())) {
tzsUserInfoVo.setPost(JSON.parseArray(tzsUserInfo.getPost()));
}
......@@ -83,6 +83,8 @@ public class UserBizByTCMServiceImpl {
tzsUserInfoVo.setIdentification(ObjectUtils.isEmpty(tzsUserInfo.getIdentification()) ? null : JSON.parseArray(tzsUserInfo.getIdentification()));
tzsUserInfoVo.setProfile(ObjectUtils.isEmpty(tzsUserInfo.getProfile()) ? null : JSON.parseArray(tzsUserInfo.getProfile()));
tzsUserInfoVo.setAppointDoc(ObjectUtils.isEmpty(tzsUserInfo.getAppointDoc()) ? null : JSON.parseArray(tzsUserInfo.getAppointDoc()));
tzsUserInfoVo.setPracticeRegistration(ObjectUtils.isEmpty(tzsUserInfo.getPracticeRegistration()) ? null : JSON.parseArray(tzsUserInfo.getPracticeRegistration()));
tzsUserInfoVo.setLaborContract(ObjectUtils.isEmpty(tzsUserInfo.getLaborContract()) ? null : JSON.parseArray(tzsUserInfo.getLaborContract()));
tzsUserInfoVo.setOtherAccessories(ObjectUtils.isEmpty(tzsUserInfo.getOtherAccessories()) ? null : JSON.parseArray(tzsUserInfo.getOtherAccessories()));
tzsUserInfoVo.setBirthday(tzsUserInfo.getBirthday() != null ? DateUtils.longStrDate(tzsUserInfo.getBirthday()): null);
tzsUserInfoVo.setSpeciality_required(tzsUserInfo.getSpeciality());
......
......@@ -2402,46 +2402,53 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
List<RegUnitInfo> regUnitInfos = regUnitInfoService.lambdaQuery().in(RegUnitInfo::getAdminUserId, adminUserIdList).list();
List<String> useUnitCodes = regUnitInfos.stream().map(RegUnitInfo::getUnitCode).collect(Collectors.toList());
if (ValidationUtil.isEmpty(useUnitCodes)) {
return;
}
List<TzBaseEnterpriseInfo> enterpriseInfos = baseEnterpriseInfoService.lambdaQuery().in(TzBaseEnterpriseInfo::getUseUnitCode, useUnitCodes).list();
Map<String, TzBaseEnterpriseInfo> enterpriseInfoMap = enterpriseInfos.stream().collect(Collectors.toMap(TzBaseEnterpriseInfo::getUseUnitCode, x -> x, (oldValue, newValue) -> newValue));
for (RegUnitInfo regUnitInfo : regUnitInfos) {
String useCode = regUnitInfo.getUnitCode();
CompanyModel companyInfo = Privilege.companyClient.queryByCompanyCode(useCode).getResult();
Set<String> appCodesSet = new HashSet<>();
Map<Long, List<Long>> roleSeqMap = new HashMap<>();
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
List<RoleModel> userRoleList = new ArrayList<>();
List<Long> roleIds = new ArrayList<>();
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null, null);
List<RoleModel> roleModels = roleListResult.getResult();
List<DataDictionary> unitTypeList = regUnitInfoService.setAndGetUnitTypeList();
TzBaseEnterpriseInfo baseEnterpriseInfo = enterpriseInfoMap.get(regUnitInfo.getUnitCode());
String[] unitTypes = baseEnterpriseInfo.getUnitType().split("#");
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.queryByUserId(regUnitInfo.getAdminUserId());
AgencyUserModel agencyUserModel = userResult.getResult();
Map<String, DataDictionary> dataDictionaryMap = unitTypeList.stream().collect(Collectors.toMap(DataDictionary::getName, Function.identity(), (k1, k2) -> k1));
for (String type : unitTypes) {
DataDictionary unitType = dataDictionaryMap.get(type);
String appCode = unitType.getTypeDesc() != null ? unitType.getTypeDesc() : "";
String[] appCodes = appCode.split(",");
Collections.addAll(appCodesSet, appCodes);
userRoleList.addAll(roleModels.stream()
.filter(r -> unitType.getExtend().contains(r.getSequenceNbr().toString())).collect(Collectors.toList()));
userRoleList.forEach(r -> {
if (!roleIds.contains(r.getSequenceNbr())) {
roleIds.add(r.getSequenceNbr());
}
});
roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds);
orgRoles.put(companyInfo.getSequenceNbr(), userRoleList);
}
try {
CompanyModel companyInfo = Privilege.companyClient.queryByCompanyCode(useCode).getResult();
Set<String> appCodesSet = new HashSet<>();
Map<Long, List<Long>> roleSeqMap = new HashMap<>();
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
List<RoleModel> userRoleList = new ArrayList<>();
List<Long> roleIds = new ArrayList<>();
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null, null);
List<RoleModel> roleModels = roleListResult.getResult();
List<DataDictionary> unitTypeList = regUnitInfoService.setAndGetUnitTypeList();
TzBaseEnterpriseInfo baseEnterpriseInfo = enterpriseInfoMap.get(regUnitInfo.getUnitCode());
String[] unitTypes = baseEnterpriseInfo.getUnitType().split("#");
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.queryByUserId(regUnitInfo.getAdminUserId());
AgencyUserModel agencyUserModel = userResult.getResult();
Map<String, DataDictionary> dataDictionaryMap = unitTypeList.stream().collect(Collectors.toMap(DataDictionary::getName, Function.identity(), (k1, k2) -> k1));
for (String type : unitTypes) {
DataDictionary unitType = dataDictionaryMap.get(type);
String appCode = unitType.getTypeDesc() != null ? unitType.getTypeDesc() : "";
String[] appCodes = appCode.split(",");
Collections.addAll(appCodesSet, appCodes);
userRoleList.addAll(roleModels.stream()
.filter(r -> unitType.getExtend().contains(r.getSequenceNbr().toString())).collect(Collectors.toList()));
userRoleList.forEach(r -> {
if (!roleIds.contains(r.getSequenceNbr())) {
roleIds.add(r.getSequenceNbr());
}
});
roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds);
orgRoles.put(companyInfo.getSequenceNbr(), userRoleList);
}
agencyUserModel.setAppCodes(new ArrayList<>(appCodesSet));
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqMap);
userResult = Privilege.agencyUserClient.update(agencyUserModel, regUnitInfo.getAdminUserId());
System.out.println(userResult);
agencyUserModel.setAppCodes(new ArrayList<>(appCodesSet));
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqMap);
Privilege.agencyUserClient.update(agencyUserModel, regUnitInfo.getAdminUserId());
log.info("更新企业管理员:{} 成功", useCode);
} catch (Exception e) {
log.warn("更新企业管理员:{} 失败, 错误原因: {}", useCode, e.getMessage());
}
}
}
......@@ -2469,21 +2476,25 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
Map<String, RegUnitInfo> regUnitInfoMap = regUnitInfos.stream().collect(Collectors.toMap(RegUnitInfo::getUnitCode, x -> x, (oldValue, newValue) -> newValue));
for (TzsUserInfo userInfo : userInfos) {
// 更新人员信息同步平台
TzsUserInfoDto tzsUserInfoDto = new TzsUserInfoDto();
Bean.toModel(userInfo, tzsUserInfoDto);
RegUnitInfo regUnitInfo = regUnitInfoMap.get(tzsUserInfoDto.getUnitCode());
if (regUnitInfo == null || StringUtils.isEmpty(regUnitInfo.getAdminUserId())) {
continue;
}
AgencyUserModel adminUserModel = userModelMap.get(regUnitInfo.getAdminUserId());
if (adminUserModel == null) {
continue;
try {
// 更新人员信息同步平台
TzsUserInfoDto tzsUserInfoDto = new TzsUserInfoDto();
Bean.toModel(userInfo, tzsUserInfoDto);
RegUnitInfo regUnitInfo = regUnitInfoMap.get(tzsUserInfoDto.getUnitCode());
if (regUnitInfo == null || StringUtils.isEmpty(regUnitInfo.getAdminUserId())) {
continue;
}
AgencyUserModel adminUserModel = userModelMap.get(regUnitInfo.getAdminUserId());
if (adminUserModel == null) {
continue;
}
Long companySeq = Long.valueOf(regUnitInfo.getAmosCompanySeq());
List<String> appCodesSet = adminUserModel.getAppCodes();
// 根据post同步平台的用户组
syncNewPost(tzsUserInfoDto, companySeq, appCodesSet);
} catch (Exception e) {
log.warn("更新企业管理员:{} 失败, 错误原因: {}", userInfo, e.getMessage());
}
Long companySeq = Long.valueOf(regUnitInfo.getAmosCompanySeq());
List<String> appCodesSet = adminUserModel.getAppCodes();
// 根据post同步平台的用户组
syncNewPost(tzsUserInfoDto, companySeq, appCodesSet);
}
}
}
......@@ -29,8 +29,8 @@
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="status != 2 ">ORDER BY CODE96333 DESC LIMIT 1 </if>
<if test="status == 2 ">ORDER BY CODE96333 ASC LIMIT 1 </if>
<if test="status != 2 ">ORDER BY CAST(CODE96333 AS UNSIGNED) DESC LIMIT 1 </if>
<if test="status == 2 ">ORDER BY CAST(CODE96333 AS UNSIGNED) ASC LIMIT 1 </if>
</select>
<select id="selectElevatorCodeMaxValue" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.KV">
......
......@@ -93,6 +93,7 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
}
@Override
@Deprecated
public boolean reduceElevatorCode(String key) {
return reduceSequence(key, SEQUENCE_TYPE, LOCK_KEY_ELEVATOR);
}
......@@ -294,13 +295,19 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
log.info("===================>获取《{}》初始码:{}<===================", sequenceKey, initialCode);
return initialCode;
}
Long currentSequence = Long.parseLong(currentSequenceStr);
// currentSequenceStr截取前两位作为prefix
String prefix = currentSequenceStr.substring(0, 2);
// 截取剩余的数字作为顺序码
currentSequenceStr = currentSequenceStr.substring(2);
long currentSequence = Long.parseLong(currentSequenceStr);
log.info("===================>获取《{}》当前顺序码:{}<===================", sequenceKey, currentSequenceStr);
currentSequence++;
currentSequence = Long.parseLong(prefix + currentSequence);
// 生成顺序码
String formattedSequence = String.format(sequenceType, currentSequence);
// 去除先导0字符
formattedSequence = formattedSequence.replaceFirst("^0+", "");
log.info("===================>更新《{}》顺序码:{}<===================", sequenceKey, formattedSequence);
// 更新顺序码
valueOps.set(sequenceKey, formattedSequence);
......
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