Commit b84d5175 authored by tianbo's avatar tianbo

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_tzs_register
parents 55ec1018 f489d872
...@@ -283,4 +283,20 @@ public class JgInstallationNoticeDto extends BaseDto { ...@@ -283,4 +283,20 @@ public class JgInstallationNoticeDto extends BaseDto {
@ApiModelProperty (value = "其他附件") @ApiModelProperty (value = "其他附件")
private List<Map<String, Object>> otherAccessoriesList; private List<Map<String, Object>> otherAccessoriesList;
@ApiModelProperty(value = "告知书编号")
private String informNumber;
@ApiModelProperty(value = "96333码")
private String code96333;
@ApiModelProperty(value = "设备代码")
private String equCode;
@ApiModelProperty(value = "设备品种")
private String equDefine;
@ApiModelProperty(value = "设备类别")
private String equipCategory;
} }
package com.yeejoin.amos.boot.module.jg.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum CylinderTypeEnum {
CYLINDER("瓶", "2300"),
SEAMLESS_CYLINDER("无缝气瓶(车用)", "2310"),
WELDED_CYLINDER("焊接气瓶(车用)", "2320"),
SPECIAL_CYLINDER("特种气瓶(车用)", "23T0");
private final String name;
private final String code;
public static String of(String code) {
for (CylinderTypeEnum constants : values()) {
if (constants.getCode().equals(code)) {
return constants.getName();
}
}
return null;
}
}
...@@ -24,7 +24,7 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat ...@@ -24,7 +24,7 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat
* @param type 类型:enterprise-企业端、supervision-监管端 * @param type 类型:enterprise-企业端、supervision-监管端
* @return 安装告知列表 * @return 安装告知列表
*/ */
Page<JgInstallationNotice> queryForPage(Page<JgInstallationNotice> page, @Param("param") JgInstallationNoticeDto model, @Param("type") String type, @Param("orgCode") String orgCode); Page<Map<String, Object>> queryForPage(Page<JgInstallationNotice> page, @Param("param") JgInstallationNoticeDto model, @Param("type") String type, @Param("orgCode") String orgCode);
/** /**
* 根据安装告知编号查询设备、设计、制造等信息 * 根据安装告知编号查询设备、设计、制造等信息
......
...@@ -44,7 +44,7 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot ...@@ -44,7 +44,7 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
* @param type 类型:enterprise-企业端、supervision-监管端 * @param type 类型:enterprise-企业端、supervision-监管端
* @return 安装告知列表 * @return 安装告知列表
*/ */
Page<JgInstallationNoticeDto> queryForJgInstallationNoticePage(Page<JgInstallationNotice> page, JgInstallationNoticeDto model, String type, ReginParams reginParams); Page<Map<String, Object>> queryForJgInstallationNoticePage(Page<JgInstallationNotice> page, JgInstallationNoticeDto model, String type, ReginParams reginParams);
/** /**
* 批量删除 * 批量删除
......
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper">
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice"> <select id="queryForPage" resultType="java.util.Map">
select select
isn.sequence_nbr AS sequenceNbr, isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo, isn.apply_no AS applyNo,
isn.supervisory_code AS supervisoryCode, isn.supervisory_code AS supervisoryCode,
isn.notice_date AS noticeDate, DATE_FORMAT(isn.notice_date,'%Y-%m-%d') AS noticeDate,
isn.use_unit_name AS useUnitName, isn.use_unit_name AS useUnitName,
isn.receive_org_name AS receiveOrgName, isn.receive_org_name AS receiveOrgName,
isn.region_no AS regionNo, isn.region_no AS regionNo,
isn.install_start_date AS installStartDate, DATE_FORMAT(isn.install_start_date,'%Y-%m-%d') AS installStartDate,
isn.address AS address, isn.address AS address,
isn.notice_status AS noticeStatus, isn.notice_status AS noticeStatus,
isn.install_unit_name AS installUnitName, isn.install_unit_name AS installUnitName,
...@@ -19,20 +19,27 @@ ...@@ -19,20 +19,27 @@
isn.city_name AS cityName, isn.city_name AS cityName,
isn.county_name AS countyName, isn.county_name AS countyName,
isn.instance_id AS instanceId, isn.instance_id AS instanceId,
isn.inform_number AS informNumber,
isn.promoter, isn.promoter,
isn.next_execute_ids AS nextExecuteIds, isn.next_execute_ids AS nextExecuteIds,
isn.instance_status AS instanceStatus, isn.instance_status AS instanceStatus,
isn.handle_date AS handleDate, DATE_FORMAT(isn.handle_date,'%Y-%m-%d') AS handleDate,
other.CODE96333 AS code96333,
(select name from tz_equipment_category ec WHERE ec.code = ri.equ_category) AS equList, (select name from tz_equipment_category ec WHERE ec.code = ri.equ_category) AS equList,
isn.notice_report_url AS noticeReportUrl, isn.notice_report_url AS noticeReportUrl,
isn.create_user_id as createUserId, isn.create_user_id as createUserId,
isn.next_task_id AS nextTaskId, isn.next_task_id AS nextTaskId,
isn.next_execute_user_ids as nextExecuteUserIds, isn.next_execute_user_ids as nextExecuteUserIds,
concat(ibjui."PROVINCE_NAME", '', ibjui."CITY_NAME", '', ibjui."COUNTY_NAME", '', ibjui."STREET_NAME", '', ibjui."ADDRESS") as equAddress ri.EQU_CODE AS equCode,
(select name from tz_equipment_category ec WHERE ec.code = ri.EQU_DEFINE) AS equDefine,
(SELECT name from tz_equipment_category where code = ri.EQU_LIST) AS equListName,
concat(ibjui."PROVINCE_NAME", '', ibjui."CITY_NAME", '', ibjui."COUNTY_NAME", '', ibjui."STREET_NAME") as equAddress,
ibjui."ADDRESS" as detailedAddress
FROM tzs_jg_installation_notice isn FROM tzs_jg_installation_notice isn
LEFT JOIN tzs_jg_installation_notice_eq insEq on insEq.equip_transfer_id = isn.sequence_nbr 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 LEFT JOIN idx_biz_jg_use_info ibjui on insEq.equ_id = ibjui.RECORD
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = insEq.equ_id LEFT JOIN idx_biz_jg_register_info ri ON ri.record = insEq.equ_id
LEFT JOIN idx_biz_jg_other_info other on other.RECORD = insEq.equ_id
<where> <where>
isn.is_delete = false isn.is_delete = false
<if test="param != null "> <if test="param != null ">
...@@ -42,15 +49,47 @@ ...@@ -42,15 +49,47 @@
<if test="param.receiveOrgCreditCode != null and param.receiveOrgCreditCode != ''"> <if test="param.receiveOrgCreditCode != null and param.receiveOrgCreditCode != ''">
AND isn.receive_org_credit_code = #{param.receiveOrgCreditCode} AND isn.receive_org_credit_code = #{param.receiveOrgCreditCode}
</if> </if>
<if test="param.useUnitName != null and param.useUnitName != ''"> <if test="param.installUnitId != null and param.installUnitId != ''">
AND isn.use_unit_credit_code = #{param.useUnitName} AND isn.install_unit_credit_code = #{param.installUnitId}
</if>
<if test="param.installUnitName != null and param.installUnitName != ''">
AND isn.install_unit_credit_code = #{param.installUnitName}
</if> </if>
<if test="param.noticeStatus != null and param.noticeStatus != ''"> <if test="param.noticeStatus != null and param.noticeStatus != ''">
AND isn.notice_status = #{param.noticeStatus} AND isn.notice_status = #{param.noticeStatus}
</if> </if>
<if test="param.noticeDate != null">
AND isn."notice_date" LIKE concat('%',DATE_FORMAT(#{param.noticeDate},'%Y-%m-%d'),'%')
</if>
<if test="param.informNumber != null and param.informNumber != ''">
AND isn."inform_number" LIKE concat('%',#{param.informNumber},'%')
</if>
<if test="param.supervisoryCode != null and param.supervisoryCode != ''">
AND isn."supervisory_code" LIKE concat('%',#{param.supervisoryCode},'%')
</if>
<if test="param.code96333 != null and param.code96333 != ''">
AND other."CODE96333" LIKE concat('%',#{param.code96333},'%')
</if>
<if test="param.equCode != null and param.equCode != ''">
AND ri."EQU_CODE" LIKE concat('%',#{param.equCode},'%')
</if>
<if test="param.equList != null and param.equList != ''">
AND ri."EQU_LIST" = #{param.equList}
</if>
<if test="param.equipCategory != null and param.equipCategory != ''">
AND ri."equ_category" = #{param.equipCategory}
</if>
<if test="param.equDefine != null and param.equDefine != ''">
AND ri."EQU_DEFINE" = #{param.equDefine}
</if>
<if test="param.equAddress != null and param.equAddress != ''">
AND (
ibjui."PROVINCE_NAME" LIKE CONCAT('%', #{param.equAddress}, '%')
OR ibjui."CITY_NAME" LIKE CONCAT('%', #{param.equAddress}, '%')
OR ibjui."COUNTY_NAME" LIKE CONCAT('%', #{param.equAddress}, '%')
OR ibjui."STREET_NAME" LIKE CONCAT('%', #{param.equAddress}, '%')
)
</if>
<if test="param.useUnitCreditCode != null and param.useUnitCreditCode != ''">
AND isn.use_unit_credit_code = #{param.useUnitCreditCode}
</if>
</if> </if>
<if test="type == 'supervision'"> <if test="type == 'supervision'">
AND (isn.receive_org_credit_code = #{orgCode} or isn.transfer_to_user_ids like concat('%',#{param.transferToUserIds},'%')) AND (isn.receive_org_credit_code = #{orgCode} or isn.transfer_to_user_ids like concat('%',#{param.transferToUserIds},'%'))
...@@ -88,9 +127,9 @@ ...@@ -88,9 +127,9 @@
isn.use_unit_name AS useUnitName, isn.use_unit_name AS useUnitName,
isn.inform_number AS informNumber, isn.inform_number AS informNumber,
isn.other_accessories AS otherAccessories, isn.other_accessories AS otherAccessories,
(select name from tz_equipment_category tec2 where ri."EQU_DEFINE"::text = tec2.code::text) AS equCategory, tec2.name AS equCategory,
(select name from tz_equipment_category tec1 where ri."EQU_LIST"::text = tec1.code::text) AS equList, tec1.name AS equList,
(select name from tz_equipment_category tec where ri."EQU_CATEGORY"::text = tec.code::text) AS equDefine, tec.name AS equDefine,
if(ri.EQU_CODE is null or ri.EQU_CODE = 'null', '', ri.EQU_CODE) AS equRegisterCode, if(ri.EQU_CODE is null or ri.EQU_CODE = 'null', '', ri.EQU_CODE) AS equRegisterCode,
re.equ_id as equId, re.equ_id as equId,
ri.PRODUCT_NAME AS productName, ri.PRODUCT_NAME AS productName,
...@@ -118,19 +157,25 @@ ...@@ -118,19 +157,25 @@
fi.factory_standard AS factoryStandard, fi.factory_standard AS factoryStandard,
fi.product_quality_yield_prove AS productQualityYieldProve, fi.product_quality_yield_prove AS productQualityYieldProve,
fi.ins_use_maintain_explain AS insUseMaintainExplain, fi.ins_use_maintain_explain AS insUseMaintainExplain,
(select useUnit.use_contact from tz_base_enterprise_info useUnit Where useUnit.use_unit_code = isn.use_unit_credit_code) AS safetyManager, useUnit.use_contact AS safetyManager,
(select useUnit.contact_phone from tz_base_enterprise_info useUnit where useUnit.use_unit_code = isn.use_unit_credit_code) AS safetyManagerPhone, useUnit.contact_phone AS safetyManagerPhone,
(select useUnit.use_code from tz_base_enterprise_info useUnit Where useUnit.use_unit_code = isn.use_unit_credit_code) AS useCode, useUnit.use_code AS useCode,
(select idi.INSPECT_REPORT from idx_biz_jg_inspection_detection_info idi Where idi.record = re.equ_id) as inspectReport, installUnit.use_code AS installUnitCreditCode,
(select useUnit.address from tz_base_enterprise_info useUnit Where useUnit.use_unit_code = isn.use_unit_credit_code) as useUnitLeaderAddress, useUnit.address as useUnitLeaderAddress,
(select use_code from tz_base_enterprise_info tbei Where tbei.use_code = isn.install_unit_credit_code) AS installUnitCreditCode, re.equ_id as equId,
(select address from tz_base_enterprise_info tbei Where tbei.use_code = isn.install_unit_credit_code) AS installUnitAddress installUnit.address installUnitAddress,
FROM (select idi.INSPECT_REPORT from idx_biz_jg_inspection_detection_info idi Where idi.record = re.equ_id ORDER BY idi.INSPECT_DATE desc LIMIT 1) as inspectReport
FROM
tzs_jg_installation_notice isn tzs_jg_installation_notice isn
LEFT JOIN tzs_jg_installation_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr LEFT JOIN tzs_jg_installation_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
LEFT JOIN idx_biz_jg_design_info di ON di.record = re.equ_id LEFT JOIN idx_biz_jg_design_info di ON di.record = re.equ_id
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
LEFT JOIN tz_base_enterprise_info useUnit ON useUnit.use_unit_code = isn.use_unit_credit_code
LEFT JOIN tz_base_enterprise_info installUnit ON installUnit.use_code = isn.install_unit_credit_code
LEFT JOIN amos_tzs_biz.tz_equipment_category tec ON ri."EQU_CATEGORY"::text = tec.code::text
LEFT JOIN amos_tzs_biz.tz_equipment_category tec1 ON ri."EQU_LIST"::text = tec1.code::text
LEFT JOIN amos_tzs_biz.tz_equipment_category tec2 ON ri."EQU_DEFINE"::text = tec2.code::text
WHERE WHERE
isn.sequence_nbr = #{sequenceNbr} isn.sequence_nbr = #{sequenceNbr}
LIMIT 1 LIMIT 1
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
ur.apply_no as applyNo, ur.apply_no as applyNo,
ur.next_execute_ids as nextExecuteIds, ur.next_execute_ids as nextExecuteIds,
ur.promoter, ur.promoter,
ur.supervisory_code as supervisoryCode, GROUP_CONCAT(DISTINCT other.supervisory_code) as supervisoryCode,
ur.use_registration_code as useRegistrationCode, ur.use_registration_code as useRegistrationCode,
date_format(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate, date_format(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate,
ur.receive_org_name as receiveOrgName, ur.receive_org_name as receiveOrgName,
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
ur.apply_no as applyNo, ur.apply_no as applyNo,
ur.next_execute_ids as nextExecuteIds, ur.next_execute_ids as nextExecuteIds,
ur.promoter as promoter, ur.promoter as promoter,
ur.supervisory_code as supervisoryCode, GROUP_CONCAT(DISTINCT other.supervisory_code) as supervisoryCode,
ur.use_registration_code as useRegistrationCode, ur.use_registration_code as useRegistrationCode,
date_format(ur.audit_pass_date, '%Y-%m-%d') as auditPassDate, date_format(ur.audit_pass_date, '%Y-%m-%d') as auditPassDate,
ur.receive_org_name as receiveOrgName, ur.receive_org_name as receiveOrgName,
......
...@@ -162,6 +162,20 @@ public class CommonController extends BaseController { ...@@ -162,6 +162,20 @@ public class CommonController extends BaseController {
return ResponseHelper.buildResponse(commonService.getSecurityAdmin(type, useUnitCode)); return ResponseHelper.buildResponse(commonService.getSecurityAdmin(type, useUnitCode));
} }
/**
* 设备分类
* @param type 1,设备种类 2,设备类别 3,设备品种
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentClassification")
@ApiOperation(httpMethod = "GET", value = "设备分类", notes = "1,设备种类 2,设备类别 3,设备品种")
public ResponseModel<List<EquipmentCategory>> equipmentClassification(@RequestParam(value = "type") String type) {
return ResponseHelper.buildResponse(commonService.equipmentClassification(type));
}
/** /**
* 查询安全管理员的基本信息 * 查询安全管理员的基本信息
......
...@@ -137,10 +137,11 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -137,10 +137,11 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page") @PostMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "安装告知分页查询", notes = "安装告知分页查询") @ApiOperation(httpMethod = "GET", value = "安装告知分页查询", notes = "安装告知分页查询")
public ResponseModel<Page<JgInstallationNoticeDto>> queryForPage( public ResponseModel<Page<Map<String, Object>>> queryForPage(
@ApiParam(value = "当前页码", required = true) @RequestParam(value = "current", defaultValue = "1") int current, @ApiParam(value = "当前页码", required = true) @RequestParam(value = "current", defaultValue = "1") int current,
@ApiParam(value = "每页大小", required = true) @RequestParam(value = "size", defaultValue = "20") int size, @ApiParam(value = "每页大小", required = true) @RequestParam(value = "size", defaultValue = "20") int size,
@ApiParam(value = "类型:enterprise-企业端、supervision-监管端", required = true) @RequestParam(value = "type", defaultValue = "enterprise") String type, @ApiParam(value = "类型:enterprise-企业端、supervision-监管端", required = true)
@RequestParam(value = "type", defaultValue = "enterprise") String type,
@RequestBody(required = false) JgInstallationNoticeDto model @RequestBody(required = false) JgInstallationNoticeDto model
) { ) {
Page<JgInstallationNotice> page = new Page<>(current, size); Page<JgInstallationNotice> page = new Page<>(current, size);
......
...@@ -62,7 +62,8 @@ public class JgVehicleInformationController extends BaseController { ...@@ -62,7 +62,8 @@ public class JgVehicleInformationController extends BaseController {
String.valueOf(map.get("instanceId")), String.valueOf(map.get("instanceId")),
String.valueOf(map.get("operate")), String.valueOf(map.get("operate")),
String.valueOf(map.get("comment")), String.valueOf(map.get("comment")),
String.valueOf(map.get("nextTaskId"))); String.valueOf(map.get("nextTaskId")),
String.valueOf(map.get("EQU_DEFINE_CODE")));
return ResponseHelper.buildResponse("ok"); return ResponseHelper.buildResponse("ok");
} }
......
...@@ -147,6 +147,13 @@ public interface ICommonService { ...@@ -147,6 +147,13 @@ public interface ICommonService {
Integer countEquipInUseTimesForDel(String record); Integer countEquipInUseTimesForDel(String record);
/** /**
* 设备分类
* @param type 1,设备种类 2,设备类别 3,设备品种
* @return
*/
List<EquipmentCategory> equipmentClassification(String type);
/**
* 套打使用标志生成 * 套打使用标志生成
* @param useFlagParamDto 参数 * @param useFlagParamDto 参数
* @param response 文件信息 * @param response 文件信息
......
...@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory; import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.EquipTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PrintingTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.PrintingTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
...@@ -89,6 +90,7 @@ import java.net.URLEncoder; ...@@ -89,6 +90,7 @@ import java.net.URLEncoder;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -799,7 +801,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -799,7 +801,7 @@ public class CommonServiceImpl implements ICommonService {
* @param response response * @param response response
* @param pathResource PDF模版路径 * @param pathResource PDF模版路径
* @param printFileName 生成文件名称 * @param printFileName 生成文件名称
* @param v * @param textSize 字体大小
*/ */
private void fillParamValueToPdf(Map<String, Object> map, HttpServletResponse response, String pathResource, String printFileName, float textSize) { private void fillParamValueToPdf(Map<String, Object> map, HttpServletResponse response, String pathResource, String printFileName, float textSize) {
// 读取资源文件夹下的模板 // 读取资源文件夹下的模板
...@@ -927,14 +929,14 @@ public class CommonServiceImpl implements ICommonService { ...@@ -927,14 +929,14 @@ public class CommonServiceImpl implements ICommonService {
JSONObject jsonObject = new JSONObject(provideMap); JSONObject jsonObject = new JSONObject(provideMap);
return jgTransferNoticeService.saveNotice(submitType, jsonObject, reginParams); return jgTransferNoticeService.saveNotice(submitType, jsonObject, reginParams);
} else if (type.equals(ApplicationFormTypeEnum.SYDJ.getBusinessCode())) { } else if (type.equals(ApplicationFormTypeEnum.SYDJ.getBusinessCode())) {
String code = (String) basicObj.get("equDefineCode"); String code = (String) basicObj.get("businessScenarios");
noticeObj.put("receiveOrgCode", !ObjectUtils.isEmpty(basicObj.get("receiveOrgCreditCode")) ? String.valueOf(basicObj.get("receiveOrgCreditCode")) : String.valueOf(basicObj.get("receiveOrgCreditCode1"))); noticeObj.put("receiveOrgCode", !ObjectUtils.isEmpty(basicObj.get("receiveOrgCreditCode")) ? String.valueOf(basicObj.get("receiveOrgCreditCode")) : String.valueOf(basicObj.get("receiveOrgCreditCode1")));
JSONObject jsonObject = new JSONObject(noticeObj); JSONObject jsonObject = new JSONObject(noticeObj);
if (submitType.equals("1")) { if (submitType.equals("1")) {
jsonObject.put("submit", Boolean.TRUE); jsonObject.put("submit", Boolean.TRUE);
} }
//判断是否为车用气瓶使用登记或者设备使用登记 //判断是否为车用气瓶使用登记或者设备使用登记
return code != null && code.equals("23T0") ? jgVehicleInformationService.save(submitType, jsonObject) : jgUseRegistrationServiceImpl.save(jsonObject); return code != null && code.equals("1") ? jgVehicleInformationService.save(submitType, jsonObject) : jgUseRegistrationServiceImpl.save(jsonObject);
} else if (type.equals(ApplicationFormTypeEnum.GZBG.getBusinessCode())) { } else if (type.equals(ApplicationFormTypeEnum.GZBG.getBusinessCode())) {
// 兼容业务逻辑代码 // 兼容业务逻辑代码
if (submitType.equals("1")) { if (submitType.equals("1")) {
...@@ -1482,7 +1484,11 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1482,7 +1484,11 @@ public class CommonServiceImpl implements ICommonService {
String equDefine = equipRegistrationInfo.getEquDefine(); // 设备品种 "3110" String equDefine = equipRegistrationInfo.getEquDefine(); // 设备品种 "3110"
if (!ObjectUtils.isEmpty(equCategory)) { if (!ObjectUtils.isEmpty(equCategory)) {
// 设备种类简称 // 设备种类简称
String equCategoryAbbrName = EquipTypeEnum.getMessage(equCategory.substring(0, 1)); String equCategoryAbbrName = Optional.ofNullable(CylinderTypeEnum.CYLINDER.getCode().equals(equCategory) ?
CylinderTypeEnum.CYLINDER.getName() : equCategory)
.map(category -> category.substring(0, 1))
.map(EquipTypeEnum::getMessage)
.orElse(null);
// 设备代码中间两位 // 设备代码中间两位
String equipType2MidDigits; String equipType2MidDigits;
...@@ -1660,6 +1666,29 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1660,6 +1666,29 @@ public class CommonServiceImpl implements ICommonService {
} }
} }
/**
* 设备分类
* @param type 1,设备种类 2,设备类别 3,设备品种
* @return
*/
@Override
public List<EquipmentCategory> equipmentClassification(String type){
List<EquipmentCategory> categoryList = equipmentCategoryMapper.selectList(new QueryWrapper<>());
List<EquipmentCategory> result = Collections.emptyList();
switch (type){
case "1":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
case "2":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*00$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
case "3":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*0$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
}
return result;
}
@Override @Override
public void fightUseFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) { public void fightUseFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) {
Objects.requireNonNull(useFlagParamDto, "参数不能为空"); Objects.requireNonNull(useFlagParamDto, "参数不能为空");
......
...@@ -1186,15 +1186,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1186,15 +1186,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
boolMust.must(nullOrEmptyQuery); boolMust.must(nullOrEmptyQuery);
} else if (ValidationUtil.equals(queryType, "WB")) { } else if (ValidationUtil.equals(queryType, "WB")) {
// 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null || "")】 // 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null || "")】
BoolQueryBuilder nullOrEmptyQuery = QueryBuilders.boolQuery() BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery();
.mustNot(QueryBuilders.wildcardQuery("EQU_STATE", "*")); wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
boolMust.must(nullOrEmptyQuery); boolMust.must(wbBuilder);
} else if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "SY")) { } else if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "SY")) {
// 查询 使用登记【可选设备列表】【(EQU_STATUS=== null || "" ) && (USE_ORG_CODE ==="" || null)】 // 查询 使用登记【可选设备列表】【(EQU_STATUS=== null || "" ) && (USE_ORG_CODE(使用登记证编号) ==="" || null)】
BoolQueryBuilder nullOrEmptyQuery = QueryBuilders.boolQuery() BoolQueryBuilder syBuilder = QueryBuilders.boolQuery();
.mustNot(QueryBuilders.wildcardQuery("EQU_STATE", "*")) syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
.mustNot(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*")); syBuilder.mustNot(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*"));
boolMust.must(nullOrEmptyQuery); boolMust.must(syBuilder);
} }
} }
......
...@@ -381,28 +381,21 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -381,28 +381,21 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
* @return 安装告知列表 * @return 安装告知列表
*/ */
@Override @Override
public Page<JgInstallationNoticeDto> queryForJgInstallationNoticePage(Page<JgInstallationNotice> page, JgInstallationNoticeDto model, String type , ReginParams reginParams) { public Page<Map<String, Object>> queryForJgInstallationNoticePage(Page<JgInstallationNotice> page, JgInstallationNoticeDto model, String type , ReginParams reginParams) {
String orgCode; String orgCode;
orgCode = reginParams.getCompany().getCompanyCode(); orgCode = reginParams.getCompany().getCompanyCode();
model.setTransferToUserIds(reginParams.getUserModel().getUserId()); model.setTransferToUserIds(reginParams.getUserModel().getUserId());
Page<JgInstallationNotice> noticePage = jgInstallationNoticeMapper.queryForPage(page, model, type, orgCode); Page<Map<String, Object>> noticePage = jgInstallationNoticeMapper.queryForPage(page, model, type, orgCode);
List<Map<String, Object>> mappedRecords = noticePage.getRecords().stream().peek(notice -> {
// 将Page<JgInstallationNotice>转化为Page<JgInstallationNoticeDto> Optional<Long> noticeStatusOpt = Optional.ofNullable((String) notice.get("noticeStatus")).map(Long::valueOf);
Page<JgInstallationNoticeDto> noticeDtoPage = new Page<>(); noticeStatusOpt.ifPresent(status -> {
BeanUtils.copyProperties(noticePage, noticeDtoPage, "records"); String noticeStatusDesc = FlowStatusEnum.getNameByType(status);
List<JgInstallationNoticeDto> records = noticePage.getRecords().stream().map(notice -> { notice.put("noticeStatusDesc", noticeStatusDesc);
JgInstallationNoticeDto noticeDto = new JgInstallationNoticeDto(); });
BeanUtils.copyProperties(notice, noticeDto);
if (Objects.nonNull(notice.getNoticeStatus())) {
String noticeStatusDesc = FlowStatusEnum.getNameByType(Long.valueOf(notice.getNoticeStatus()));
noticeDto.setNoticeStatusDesc(noticeStatusDesc);
}
return noticeDto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
noticeDtoPage.setRecords(records); noticePage.setRecords(mappedRecords);
return noticePage;
return noticeDtoPage;
} }
/** /**
...@@ -485,7 +478,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -485,7 +478,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
Map<String, Object> placeholders = new HashMap<>(); Map<String, Object> placeholders = new HashMap<>();
placeholders.put("doMain", TZSDOMAIN); placeholders.put("doMain", TZSDOMAIN);
placeholders.put("installUnitName", getValue.apply("installUnitName")); placeholders.put("installUnitName", getValue.apply("installUnitName"));
placeholders.put("informNumber", "".equals(getValue.apply("informNumber")) ? getValue.apply("applyNo") : getValue.apply("informNumber")); placeholders.put("informNumber", getValue.apply("informNumber"));
placeholders.put("productName", getValue.apply("productName")); placeholders.put("productName", getValue.apply("productName"));
placeholders.put("equipType", getValue.apply("equType")); placeholders.put("equipType", getValue.apply("equType"));
placeholders.put("equipCode", getValue.apply("equRegisterCode")); placeholders.put("equipCode", getValue.apply("equRegisterCode"));
......
...@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory; ...@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.EquipTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum; import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper;
...@@ -519,15 +520,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -519,15 +520,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
CompanyBo company = reginParams.getCompany(); CompanyBo company = reginParams.getCompany();
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists"); List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
if (CollectionUtils.isEmpty(equipmentLists)) { if (org.springframework.util.CollectionUtils.isEmpty(equipmentLists) || equipmentLists.stream()
throw new BadRequest("请先选择设备信息!"); .map(v -> (String) v.get("EQU_DEFINE_CODE"))
.distinct()
.count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同设备种类!");
} }
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo( List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo(
equipmentLists.stream() equipmentLists.stream()
.map(v -> (String) v.get("record")) .map(v -> (String) v.get("record"))
.collect(Collectors.toList()) .collect(Collectors.toList())
); );
if (!"2300".equals(map.get("EQU_CATEGORY_CODE")) && inspectionDetectionInfoList.stream().anyMatch(info -> if (!CylinderTypeEnum.CYLINDER.getCode().equals(map.get("EQU_CATEGORY_CODE")) && inspectionDetectionInfoList.stream().anyMatch(info ->
ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) || ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) ||
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()) || ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()) ||
ObjectUtils.isEmpty(info.getInspectOrgName()))) { ObjectUtils.isEmpty(info.getInspectOrgName()))) {
...@@ -850,6 +854,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -850,6 +854,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
LambdaQueryWrapper<IdxBizJgOtherInfo> lambdaOth = new QueryWrapper<IdxBizJgOtherInfo>().lambda(); LambdaQueryWrapper<IdxBizJgOtherInfo> lambdaOth = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
lambdaOth.eq(IdxBizJgOtherInfo::getRecord, String.valueOf(mapData.get("equipId"))); lambdaOth.eq(IdxBizJgOtherInfo::getRecord, String.valueOf(mapData.get("equipId")));
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(lambdaOth); IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(lambdaOth);
jgUseRegistration.setSupervisoryCode(otherInfo.getSupervisoryCode());
// 注册信息 // 注册信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaReg = new QueryWrapper<IdxBizJgRegisterInfo>().lambda(); LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaReg = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, String.valueOf(mapData.get("equipId"))); lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, String.valueOf(mapData.get("equipId")));
...@@ -1173,7 +1178,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -1173,7 +1178,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) jsonObject.get("equipmentLists"); List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) jsonObject.get("equipmentLists");
List<String> records = equipmentLists.stream().map(v -> (String) v.get("record")).collect(Collectors.toList()); List<String> records = equipmentLists.stream().map(v -> (String) v.get("record")).collect(Collectors.toList());
jsonObject.remove("equipmentLists"); jsonObject.remove("equipmentLists");
if ("2300".equals(jsonObject.get("EQU_CATEGORY_CODE"))) { if (CylinderTypeEnum.CYLINDER.getCode().equals(jsonObject.get("EQU_CATEGORY_CODE"))) {
jsonObject.put("equipmentLists", jgUseRegistrationMapper.queryForUnitVesselEquipment(records)); jsonObject.put("equipmentLists", jgUseRegistrationMapper.queryForUnitVesselEquipment(records));
} else { } else {
jsonObject.put("equipmentLists", jgUseRegistrationMapper.queryForUnitPipelineEquipment(records)); jsonObject.put("equipmentLists", jgUseRegistrationMapper.queryForUnitPipelineEquipment(records));
......
...@@ -16,9 +16,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -16,9 +16,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgVehicleInformationService; import com.yeejoin.amos.boot.module.jg.api.service.IJgVehicleInformationService;
...@@ -127,8 +125,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -127,8 +125,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
JgVehicleInformationDto vehicleInfoDto = JSON.parseObject(JSON.toJSONString(map), JgVehicleInformationDto.class); JgVehicleInformationDto vehicleInfoDto = JSON.parseObject(JSON.toJSONString(map), JgVehicleInformationDto.class);
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists"); List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
if (CollectionUtils.isEmpty(equipmentLists)) { if (CollectionUtils.isEmpty(equipmentLists) || equipmentLists.stream()
throw new BadRequest("请选择设备"); .map(v -> (String) v.get("EQU_DEFINE_CODE"))
.distinct()
.count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同设备种类!");
} }
CompanyBo company = reginParams.getCompany(); CompanyBo company = reginParams.getCompany();
...@@ -236,11 +237,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -236,11 +237,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
List<WorkflowResultDto> workflowResultDtoList = commonService.buildWorkFlowInfo(processTasks); List<WorkflowResultDto> workflowResultDtoList = commonService.buildWorkFlowInfo(processTasks);
if (!ObjectUtils.isEmpty(workflowResultDtoList) && !ObjectUtils.isEmpty(workflowResultDtoList.get(0))) { if (!ObjectUtils.isEmpty(workflowResultDtoList) && !ObjectUtils.isEmpty(workflowResultDtoList.get(0))) {
WorkflowResultDto workflowResultDto = workflowResultDtoList.get(0); WorkflowResultDto workflowResultDto = workflowResultDtoList.get(0);
this.updateData(vehicleInformation.getSequenceNbr(), "0", workflowResultDto, Boolean.TRUE); this.updateData(vehicleInformation.getSequenceNbr(), "0", workflowResultDto, Boolean.TRUE, String.valueOf(map.get("EQU_DEFINE_CODE")));
} }
} else { } else {
// 执行流程 // 执行流程
flowExecute(vehicleInformation.getSequenceNbr(), vehicleInformation.getInstanceId(), "0", "", String.valueOf(map.get("nextTaskId"))); flowExecute(vehicleInformation.getSequenceNbr(), vehicleInformation.getInstanceId(), "0", "", String.valueOf(map.get("nextTaskId")), String.valueOf(map.get("EQU_DEFINE_CODE")));
} }
} else { } else {
ArrayList<TaskModelDto> list = new ArrayList<>(); ArrayList<TaskModelDto> list = new ArrayList<>();
...@@ -262,97 +263,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -262,97 +263,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
return Collections.singletonList(vehicleInformation); return Collections.singletonList(vehicleInformation);
} }
public void updateHistory(JSONObject map, String equipId, String currentDocumentId, String supervisoryCode) {
JgRegistrationHistory jgRegistrationHistory = new JgRegistrationHistory();
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
// lambda.eq(JgRegistrationHistory::getEquId, equipId);
lambda.eq(JgRegistrationHistory::getCurrentDocumentId, currentDocumentId);
lambda.eq(JgRegistrationHistory::getRegistrationClass, "车用气瓶登记");
Integer integer = jgRegistrationHistoryService.getBaseMapper().selectCount(lambda);
if (integer > 0) {
jgRegistrationHistory.setChangeData(JSON.toJSONString(map));
jgRegistrationHistoryService.update(jgRegistrationHistory, lambda);
} else {
jgRegistrationHistory.setChangeData(JSON.toJSONString(map));
jgRegistrationHistory.setStatus("new");
jgRegistrationHistory.setRegistrationClass("车用气瓶登记");
jgRegistrationHistory.setSupervisoryCode(supervisoryCode);
jgRegistrationHistory.setEquId(equipId);
jgRegistrationHistory.setCurrentDocumentId(currentDocumentId);
jgRegistrationHistoryService.save(jgRegistrationHistory);
}
}
private void createTaskModel(JgVehicleInformation vehicle, String taskName, String submitType, String nextUserIds) {
if ("1".equals(submitType)) {
TaskModelDto taskModelDto = new TaskModelDto();
taskModelDto.setFlowCreateDate(vehicle.getRegDate());
taskModelDto.setTaskName(taskName);
taskModelDto.setTaskCode(vehicle.getApplyNo());
taskModelDto.setTaskContent(this.buildTaskContent(vehicle));
taskModelDto.setTaskDesc("");
taskModelDto.setTaskType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getCode());
taskModelDto.setTaskTypeLabel(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName());
taskModelDto.setRelationId(vehicle.getInstanceId());
taskModelDto.setExecuteUserIds(nextUserIds);
FlowStatusEnum flowStatusEnum = this.getTaskStatus(submitType);
taskModelDto.setTaskStatus(flowStatusEnum.getCode());
taskModelDto.setTaskStatusLabel(flowStatusEnum.getName());
taskModelDto.setFlowStatus(this.getTaskStatusByName(vehicle.getStatus()));
taskModelDto.setFlowStatusLabel(vehicle.getStatus());
taskModelDto.setStartUserId(vehicle.getCreateUserId());
taskModelDto.setStartUser(vehicle.getRecUserName());
taskModelDto.setFlowCode(vehicle.getNextTaskId());
taskModelDto.setStartUserCompanyName(vehicle.getUseUnitName());
taskModelDto.setNextExecuteUser(vehicle.getNextExecuteIds());
taskModelDto.setStartDate(vehicle.getCreateDate());
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtil.copyProperties(vehicle, taskMessageDto);
taskModelDto.setModel(taskMessageDto);
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
// redis流程实时数据更新
commonService.saveExecuteFlowData2Redis(vehicle.getInstanceId(), this.buildInstanceRuntimeData(vehicle));
}
}
/**
* 摘要构建
*
* @param dto 业务
* @return 摘要
*/
private String buildTaskContent(JgVehicleInformation dto) {
List<Map<String, Object>> list = this.baseMapper.selectEquipList(dto.getSequenceNbr());
String supervisoryCode = "";
String equList = "";
if (!CollectionUtils.isEmpty(list)) {
Map<String, Object> map = list.get(0);
if (map.containsKey("EQU_LIST")) {
equList = map.get("EQU_LIST") + "";
}
if (map.containsKey("SUPERVISORY_CODE")) {
supervisoryCode = map.get("SUPERVISORY_CODE") + "";
}
}
supervisoryCode = StringUtils.isEmpty(supervisoryCode) ? "无" : supervisoryCode;
String format = String.format("来自%s【%s】等的业务办理,【申请单号:%s】等", equList, supervisoryCode, dto.getApplyNo());
return format;
}
private FlowStatusEnum getTaskStatus(String operate) {
if ("0".equals(operate)) {
return FlowStatusEnum.TO_BE_FINISHED;
} else {
return FlowStatusEnum.REJECTED;
}
}
private Integer getTaskStatusByName(String auditStatus) {
return commonService.getDictionaryCodeByName(auditStatus);
}
/** /**
* 撤回操作 * 撤回操作
* *
...@@ -490,13 +400,13 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -490,13 +400,13 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param comment 意见 * @param comment 意见
* @param nextTaskId nextTaskId * @param nextTaskId nextTaskId
*/ */
public void flowExecute(Long sequenceNbr, String instanceId, String operate, String comment, String nextTaskId) { public void flowExecute(Long sequenceNbr, String instanceId, String operate, String comment, String nextTaskId, String equDefineCode) {
String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId); String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId);
RLock lock = redissonClient.getLock(lockKey); RLock lock = redissonClient.getLock(lockKey);
try { try {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS); boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回) // 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if(!isLocked){ if (!isLocked) {
throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!"); throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!");
} }
// 流程执行时,状态及权限校验 // 流程执行时,状态及权限校验
...@@ -527,7 +437,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -527,7 +437,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
List<WorkflowResultDto> resultDto = commonService.buildWorkFlowInfo(processTaskDTOS); List<WorkflowResultDto> resultDto = commonService.buildWorkFlowInfo(processTaskDTOS);
if (!ObjectUtils.isEmpty(resultDto) && !ObjectUtils.isEmpty(resultDto.get(0))) { if (!ObjectUtils.isEmpty(resultDto) && !ObjectUtils.isEmpty(resultDto.get(0))) {
WorkflowResultDto workflowResultDto = resultDto.get(0); WorkflowResultDto workflowResultDto = resultDto.get(0);
this.updateData(jgVehicleInformation.getSequenceNbr(), operate, workflowResultDto, Boolean.FALSE); this.updateData(jgVehicleInformation.getSequenceNbr(), operate, workflowResultDto, Boolean.FALSE, equDefineCode);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -546,7 +456,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -546,7 +456,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param workflowResultDto workflowResultDto * @param workflowResultDto workflowResultDto
* @param isFirst isFirst * @param isFirst isFirst
*/ */
public void updateData(Long sequenceNbr, String operate, WorkflowResultDto workflowResultDto, Boolean isFirst) { public void updateData(Long sequenceNbr, String operate, WorkflowResultDto workflowResultDto, Boolean isFirst, String equDefineCode) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
String role = workflowResultDto.getNextExecutorRoleIds(); String role = workflowResultDto.getNextExecutorRoleIds();
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName(); String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
...@@ -625,7 +535,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -625,7 +535,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
CompanyModel receiveParentResult = Privilege.companyClient.seleteOne(receiveCompanyResult.getParentId()).getResult(); CompanyModel receiveParentResult = Privilege.companyClient.seleteOne(receiveCompanyResult.getParentId()).getResult();
receiveCompanyCode = receiveParentResult.getCompanyCode(); receiveCompanyCode = receiveParentResult.getCompanyCode();
} }
String code = generateVehicleUseRegistrationCode(receiveCompanyCode); String code = this.generateVehicleUseRegistrationCode(receiveCompanyCode, equDefineCode);
jgVehicleInformation.setUseRegistrationCode(code); jgVehicleInformation.setUseRegistrationCode(code);
jgVehicleInformation.setAuditPassDate(new Date()); jgVehicleInformation.setAuditPassDate(new Date());
...@@ -867,16 +777,16 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -867,16 +777,16 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
/** /**
* 根据车辆属地生成使用登记证 * 根据车辆属地生成使用登记证
*
* @param receiveCompanyCode 车辆属地 * @param receiveCompanyCode 车辆属地
* @return String * @return String
*/ */
private String generateVehicleUseRegistrationCode(String receiveCompanyCode) { private String generateVehicleUseRegistrationCode(String receiveCompanyCode, String equDefineCode) {
StringBuilder useRegistration = new StringBuilder("容3T"); // 构建设备种类简称
if (!ObjectUtils.isEmpty(receiveCompanyCode)) { String useRegistration = String.format("瓶%s%s", equDefineCode.substring(1, 3), VehicleApanageEnum.of(receiveCompanyCode));
ResponseModel<String> stringResponseModel = tzsServiceFeignClient.useRegistrationCode(useRegistration.append(VehicleApanageEnum.of(receiveCompanyCode)) + ""); // 调用服务端获取注册码
return stringResponseModel.getResult(); ResponseModel<String> stringResponseModel = tzsServiceFeignClient.useRegistrationCode(useRegistration);
} return stringResponseModel.getResult();
return null;
} }
/** /**
...@@ -911,9 +821,12 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -911,9 +821,12 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
throw new BadRequest("使用登记证导出失败,请稍后重试或检查数据完整性!"); throw new BadRequest("使用登记证导出失败,请稍后重试或检查数据完整性!");
} }
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoService.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", vehicleInformationEqList.get(0).getEquId())); List<IdxBizJgRegisterInfo> registerInfoList = idxBizJgRegisterInfoMapper.selectList(new QueryWrapper<IdxBizJgRegisterInfo>().in("RECORD", vehicleInformationEqList.stream()
if (registerInfo != null) { .map(JgVehicleInformationEq::getEquId)
populateEquipmentInformation(registerInfo, exportParamsMap); .filter(Objects::nonNull)
.collect(Collectors.toList())));
if (!ValidationUtil.isEmpty(registerInfoList)) {
populateEquipmentInformation(registerInfoList, exportParamsMap);
} }
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(vehicleInformationEqList.get(0).getEquId()); IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(vehicleInformationEqList.get(0).getEquId());
...@@ -955,27 +868,31 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -955,27 +868,31 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
} }
} }
private void populateEquipmentInformation(IdxBizJgRegisterInfo registerInfo, Map<String, Object> exportParamsMap) { private void populateEquipmentInformation(List<IdxBizJgRegisterInfo> registerInfoList, Map<String, Object> exportParamsMap) {
String equList = registerInfo.getEquList(); Optional<IdxBizJgRegisterInfo> optionalRegisterInfo = registerInfoList.stream().findFirst();
String equCategory = registerInfo.getEquCategory(); if (optionalRegisterInfo.isPresent()) {
String equDefine = registerInfo.getEquDefine(); IdxBizJgRegisterInfo registerInfo = optionalRegisterInfo.get();
List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null); String equList = registerInfo.getEquList();
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null); String equCategory = registerInfo.getEquCategory();
List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null); String equDefine = registerInfo.getEquDefine();
if (notEmptyAndHasName(categoryList0)) { List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null);
exportParamsMap.put("equList", categoryList0.get(0).getName()); List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null);
} if (notEmptyAndHasName(categoryList0)) {
if (notEmptyAndHasName(categoryList1)) { exportParamsMap.put("equList", categoryList0.get(0).getName());
exportParamsMap.put("equCategory", categoryList1.get(0).getName()); }
} if (notEmptyAndHasName(categoryList1)) {
if (notEmptyAndHasName(categoryList2)) { exportParamsMap.put("equCategory", categoryList1.get(0).getName());
exportParamsMap.put("equDefine", "特种气瓶(车用)"); }
} exportParamsMap.put("equDefine", CylinderTypeEnum.of(equDefine));
if (registerInfo.getEquCode() == null) { if (registerInfoList.stream().anyMatch(r -> r.getEquCode() == null)) {
throw new BadRequest("使用登记证导出失败,设备代码为空!"); throw new BadRequest("使用登记证导出失败,设备代码为空!");
}
exportParamsMap.put("equCode", registerInfoList.stream()
.map(IdxBizJgRegisterInfo::getEquCode)
.filter(Objects::nonNull)
.collect(Collectors.joining(", ")));
exportParamsMap.put("equListCode", equList);
} }
exportParamsMap.put("equCode", registerInfo.getEquCode());
exportParamsMap.put("equListCode", equList);
} }
private boolean notEmptyAndHasName(List<EquipmentCategory> categoryList) { private boolean notEmptyAndHasName(List<EquipmentCategory> categoryList) {
......
...@@ -129,6 +129,8 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio ...@@ -129,6 +129,8 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (!baseUnitLicences.isEmpty()) { if (!baseUnitLicences.isEmpty()) {
baseUnitLicenceService.saveOrUpdateBatch(baseUnitLicences); baseUnitLicenceService.saveOrUpdateBatch(baseUnitLicences);
//添加不在字典中的登记机关
regUnitInfoService.addNotInDJJGDictionary(baseUnitLicences);
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
......
...@@ -89,515 +89,551 @@ import java.util.stream.Stream; ...@@ -89,515 +89,551 @@ import java.util.stream.Stream;
@Service @Service
@EnableScheduling @EnableScheduling
public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitInfo, RegUnitInfoMapper> public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitInfo, RegUnitInfoMapper>
implements IRegUnitInfoService { implements IRegUnitInfoService {
@Autowired @Autowired
RedisUtil redisUtil; RedisUtil redisUtil;
@Autowired @Autowired
BaseUnitLicenceServiceImpl baseUnitLicenceService; BaseUnitLicenceServiceImpl baseUnitLicenceService;
@Autowired @Autowired
DataDictionaryServiceImpl iDataDictionaryService; DataDictionaryServiceImpl iDataDictionaryService;
@Autowired @Autowired
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
@Autowired @Autowired
RegUnitIcServiceImpl regUnitIcService; RegUnitIcServiceImpl regUnitIcService;
@Autowired
TzBaseEnterpriseInfoServiceImpl tzBaseEnterpriseInfoService;
@Autowired @Autowired
TzBaseEnterpriseInfoServiceImpl tzBaseEnterpriseInfoService; TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired @Autowired
TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper; RestTemplate restTemplate;
@Autowired @Autowired
RestTemplate restTemplate; AccessFeignService accessFeignService;
@Autowired @Autowired
AccessFeignService accessFeignService; UgpServiceFeignClient ugpServiceFeignClient;
@Autowired @Autowired
UgpServiceFeignClient ugpServiceFeignClient; RegUnitInfoMapper regUnitInfoMapper;
@Autowired
RegUnitInfoMapper regUnitInfoMapper;
@Autowired @Autowired
StartPlatformTokenService startPlatformTokenService; StartPlatformTokenService startPlatformTokenService;
@Autowired @Autowired
EquipmentCategoryServiceImpl equipmentCategoryService; EquipmentCategoryServiceImpl equipmentCategoryService;
@Autowired @Autowired
IdxFeignService idxFeignService; IdxFeignService idxFeignService;
@Autowired @Autowired
WorkflowFeignService workflowFeignService; WorkflowFeignService workflowFeignService;
@Autowired @Autowired
TzsBaseInstitutionMapper tzsBaseInstitutionMapper; TzsBaseInstitutionMapper tzsBaseInstitutionMapper;
@Autowired @Autowired
TzsUserInfoServiceImpl tzsUserInfoService; TzsUserInfoServiceImpl tzsUserInfoService;
private final Logger logger = LogManager.getLogger(RegUnitInfoServiceImpl.class); private final Logger logger = LogManager.getLogger(RegUnitInfoServiceImpl.class);
/** /**
* 单位类型,数据来源:cb_data_dictionary type = UNIT_TYPE * 单位类型,数据来源:cb_data_dictionary type = UNIT_TYPE
*/ */
private static String DICT_TYPE_UNIT_TYPE = "UNIT_TYPE_NEW"; private static String DICT_TYPE_UNIT_TYPE = "UNIT_TYPE_NEW";
/** private static final String DICT_TYPE_DJJG = "DJJG";
* 个体类型,数据来源:cb_data_dictionary type = PERSON_REGISTER_TYPE /**
*/ * 个体类型,数据来源:cb_data_dictionary type = PERSON_REGISTER_TYPE
private static String PERSON_REGISTER_TYPE = "PERSON_REGISTER_TYPE"; */
private static String PERSON_REGISTER_TYPE = "PERSON_REGISTER_TYPE";
@Value("${org.filter.group.seq}")
@Value("${org.filter.group.seq}") private Long groupSeq;
private Long groupSeq;
@Value("${is.ugp}")
@Value("${is.ugp}") private boolean isUgp;
private boolean isUgp;
@Autowired
@Autowired DataDictionaryServiceImpl dataDictionaryService;
DataDictionaryServiceImpl dataDictionaryService;
@Override
@Override @Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class) public RegUnitInfoDto registerUnit(RegUnitInfoDto model) {
public RegUnitInfoDto registerUnit(RegUnitInfoDto model) { StopWatch watch = new StopWatch();
StopWatch watch = new StopWatch(); watch.start();
watch.start(); if (ValidationUtil.isEmpty(model.getUnitCode())) {
if(ValidationUtil.isEmpty(model.getUnitCode())){ model.setUnitCode(model.getForm().getString("unitCode"));
model.setUnitCode(model.getForm().getString("unitCode")); }
} RegUnitInfo regUnitInfo = new RegUnitInfo();
RegUnitInfo regUnitInfo = new RegUnitInfo(); try {
try { startPlatformTokenService.setRequestContext();
startPlatformTokenService.setRequestContext(); // 注册用统一信用码注册,默认证件类型为营业执照,数据来源:cb_data_dictionary code = 1060
// 注册用统一信用码注册,默认证件类型为营业执照,数据来源:cb_data_dictionary code = 1060 model.setUnitCodeType("1060");
model.setUnitCodeType("1060"); model.setUnitCodeTypeName("营业执照");
model.setUnitCodeTypeName("营业执照"); Bean.copyExistPropertis(model, regUnitInfo);
Bean.copyExistPropertis(model, regUnitInfo); regUnitInfo.setUnitType(StringUtils.join(model.getUnitTypeList(), ","));
regUnitInfo.setUnitType(StringUtils.join(model.getUnitTypeList(), ",")); regUnitInfo.setUnitTypeCode(StringUtils.join(model.getUnitTypeCodeList(), ","));
regUnitInfo.setUnitTypeCode(StringUtils.join(model.getUnitTypeCodeList(), ",")); // 1.调用平台进行创建单位、用户信息
// 1.调用平台进行创建单位、用户信息 this.createCompanyAndUser(regUnitInfo);
this.createCompanyAndUser(regUnitInfo); // 2.异步调用ugp,同步公司数据
// 2.异步调用ugp,同步公司数据 FutureTask<ResponseModel<Boolean>> future = getResponseModelFutureTask(model);
FutureTask<ResponseModel<Boolean>> future = getResponseModelFutureTask(model); // 3.插入单位注册许可信息表:tz_base_unit_licence
// 3.插入单位注册许可信息表:tz_base_unit_licence // 3.1先删除已有许可信息 (2024-04-02放开企业许可信息编辑功能)
// 3.1先删除已有许可信息 (2024-04-02放开企业许可信息编辑功能) LambdaQueryWrapper<BaseUnitLicence> queryWrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<BaseUnitLicence> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(BaseUnitLicence::getUnitCode, model.getUnitCode());
queryWrapper.eq(BaseUnitLicence::getUnitCode, model.getUnitCode()); baseUnitLicenceService.remove(queryWrapper);
baseUnitLicenceService.remove(queryWrapper); // 3.2再插入新许可信息
// 3.2再插入新许可信息 List<BaseUnitLicence> baseUnitLicences = model.getUnitLicences().stream().map(s -> {
List<BaseUnitLicence> baseUnitLicences = model.getUnitLicences().stream().map(s -> { s.setUnitCode(model.getUnitCode());
s.setUnitCode(model.getUnitCode()); s.setUnitName(model.getName());
s.setUnitName(model.getName()); BaseUnitLicence target = new BaseUnitLicence();
BaseUnitLicence target = new BaseUnitLicence(); Bean.copyExistPropertis(s, target);
Bean.copyExistPropertis(s, target); target.setSequenceNbr(null);
target.setSequenceNbr(null); return target;
return target; }).collect(Collectors.toList());
}).collect(Collectors.toList()); if (!baseUnitLicences.isEmpty()) {
if (!baseUnitLicences.isEmpty()) { baseUnitLicenceService.saveOrUpdateBatch(baseUnitLicences);
baseUnitLicenceService.saveOrUpdateBatch(baseUnitLicences); //添加不在字典中的登记机关
} this.addNotInDJJGDictionary(baseUnitLicences);
// 4.插入工商单位信息表:tz_flc_reg_unit_ic }
RegUnitIc regUnitIc = new RegUnitIc(); // 4.插入工商单位信息表:tz_flc_reg_unit_ic
model.getRegUnitIc().setUnitCode(model.getUnitCode()); RegUnitIc regUnitIc = new RegUnitIc();
model.getRegUnitIc().setUnitName(model.getName()); model.getRegUnitIc().setUnitCode(model.getUnitCode());
Bean.copyExistPropertis(model.getRegUnitIc(), regUnitIc); model.getRegUnitIc().setUnitName(model.getName());
regUnitIcService.saveOrUpdate(regUnitIc); Bean.copyExistPropertis(model.getRegUnitIc(), regUnitIc);
// 5.创建企业信息 regUnitIcService.saveOrUpdate(regUnitIc);
this.createBaseEnterpriseInfo(model, EnterpriseEnums.QY_DW.getType()); // 5.创建企业信息
if (!ObjectUtils.isEmpty(regUnitInfo.getAdminName())){ this.createBaseEnterpriseInfo(model, EnterpriseEnums.QY_DW.getType());
regUnitInfo.setContactPerson(regUnitInfo.getAdminName()); if (!ObjectUtils.isEmpty(regUnitInfo.getAdminName())) {
} regUnitInfo.setContactPerson(regUnitInfo.getAdminName());
if (!ObjectUtils.isEmpty(regUnitInfo.getAdminTel())){ }
regUnitInfo.setContactPersonTel(regUnitInfo.getAdminTel()); if (!ObjectUtils.isEmpty(regUnitInfo.getAdminTel())) {
} regUnitInfo.setContactPersonTel(regUnitInfo.getAdminTel());
// 6.插入注册单位基本信息表:tz_flc_reg_unit_info }
this.save(regUnitInfo); // 6.插入注册单位基本信息表:tz_flc_reg_unit_info
// 7.组织返回数据 this.save(regUnitInfo);
// 7.1企业基本信息 // 7.组织返回数据
Bean.copyExistPropertis(regUnitInfo, model); // 7.1企业基本信息
// 7.2行政许可数据 Bean.copyExistPropertis(regUnitInfo, model);
model.setUnitLicences(Bean.toModels(baseUnitLicences, BaseUnitLicenceDto.class)); // 7.2行政许可数据
// 7.3工商信息 model.setUnitLicences(Bean.toModels(baseUnitLicences, BaseUnitLicenceDto.class));
model.setRegUnitIc(Bean.toModel(regUnitIc, new RegUnitIcDto())); // 7.3工商信息
//8.获取多线程执行结果 true成功 false失败(tzs和ugp一起后放开) model.setRegUnitIc(Bean.toModel(regUnitIc, new RegUnitIcDto()));
if (isUgp && future != null && !Boolean.TRUE.equals(future.get().getResult())) { //8.获取多线程执行结果 true成功 false失败(tzs和ugp一起后放开)
throw new BadRequest("UGP信息同步失败"); if (isUgp && future != null && !Boolean.TRUE.equals(future.get().getResult())) {
} throw new BadRequest("UGP信息同步失败");
watch.stop(); }
if(logger.isDebugEnabled()){ watch.stop();
logger.debug("注册总耗时:==》{}", watch.getTotalTimeSeconds()); if (logger.isDebugEnabled()) {
} logger.debug("注册总耗时:==》{}", watch.getTotalTimeSeconds());
}catch (Exception e) { }
logger.error(e.getMessage(), e); } catch (Exception e) {
try { logger.error(e.getMessage(), e);
// 失败后回滚:删除已经创建的企业信息 try {
if (StringUtils.isNotEmpty(regUnitInfo.getAmosCompanySeq())) { // 失败后回滚:删除已经创建的企业信息
FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient.seleteOne(Long.parseLong(regUnitInfo.getAmosCompanySeq())); if (StringUtils.isNotEmpty(regUnitInfo.getAmosCompanySeq())) {
if (feignClientResult != null && feignClientResult.getResult() != null) { FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient.seleteOne(Long.parseLong(regUnitInfo.getAmosCompanySeq()));
Privilege.companyClient.deleteCompany(regUnitInfo.getAmosCompanySeq()); if (feignClientResult != null && feignClientResult.getResult() != null) {
} Privilege.companyClient.deleteCompany(regUnitInfo.getAmosCompanySeq());
} }
// 失败后回滚:删除已经创建的管理员账号 }
if (StringUtils.isNotEmpty(regUnitInfo.getAdminUserId())) { // 失败后回滚:删除已经创建的管理员账号
FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient.queryByUserId(regUnitInfo.getAdminUserId()); if (StringUtils.isNotEmpty(regUnitInfo.getAdminUserId())) {
if (feignClientResult != null && feignClientResult.getResult() != null) { FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient.queryByUserId(regUnitInfo.getAdminUserId());
Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId()); if (feignClientResult != null && feignClientResult.getResult() != null) {
} Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId());
} }
} catch (Exception rollbackException) { }
logger.error("回滚操作发生异常: {}", rollbackException.getMessage(), rollbackException); } catch (Exception rollbackException) {
} logger.error("回滚操作发生异常: {}", rollbackException.getMessage(), rollbackException);
}
throw new RuntimeException("企业注册失败,请联系管理员!");
} throw new RuntimeException("企业注册失败,请联系管理员!");
return model; }
} return model;
}
@SchedulerLock(name="asyncSetQrCodeTask",lockAtMostFor = "PT30M")
@Scheduled(cron = "${async.set.qr-code.cron:0 0/1 * * * ?}") /**
public void asyncSetQrCode() { * 添加不在字典中的登记机关
// 给所有新注册的企业创建二维码,每次处理1000个,不排序 * @param baseUnitLicences baseUnitLicences
if (logger.isDebugEnabled()) { */
logger.debug("新注册企业二维码生成开始"); public void addNotInDJJGDictionary(List<BaseUnitLicence> baseUnitLicences) {
} List<String> approvedOrganList = baseUnitLicences.stream()
List<TzBaseEnterpriseInfo> noQrCodeList = tzBaseEnterpriseInfoMapper.listNoQrCode(); .map(BaseUnitLicence::getApprovedOrgan)
if (noQrCodeList.isEmpty()) { .collect(Collectors.toList());
if (logger.isDebugEnabled()) { List<DataDictionary> allDictionaryList = this.initAllDataDictionaryList();
logger.debug("暂无待生成二维码的企业");
} Set<String> existingNames = allDictionaryList.stream()
return; .filter(d -> d.getType().equals(DICT_TYPE_DJJG))
} .map(DataDictionary::getName)
.collect(Collectors.toSet());
noQrCodeList.parallelStream().forEach(enterpriseInfo -> enterpriseInfo.setQrCode(createQRCode(enterpriseInfo.getUseCode())));
// 过滤出不在已存在的数据字典中的机构名,并转换为相应的数据字典对象
tzBaseEnterpriseInfoService.saveOrUpdateBatch(noQrCodeList); List<DataDictionary> notInDataDictionaryList = approvedOrganList.stream()
.filter(approvedOrgan -> !existingNames.contains(approvedOrgan))
if (logger.isDebugEnabled()) { .map(approvedOrgan -> {
logger.debug("新注册企业二维码生成结束"); DataDictionary dictionary = new DataDictionary();
} dictionary.setName(approvedOrgan);
} dictionary.setType(DICT_TYPE_DJJG);
dictionary.setCode(UUID.randomUUID().toString().replace("-", "").substring(0, 16));
private FutureTask<ResponseModel<Boolean>> getResponseModelFutureTask(RegUnitInfoDto model) { return dictionary;
//多线程同步ugp信息(tzs和ugp一起后放开) })
FutureTask<ResponseModel<Boolean>> future = null; .collect(Collectors.toList());
if(isUgp) {
String token = RequestContext.getToken(); if (!notInDataDictionaryList.isEmpty()) {
String appKey = RequestContext.getAppKey(); iDataDictionaryService.saveBatch(notInDataDictionaryList);
String product = RequestContext.getProduct(); // 更新缓存
Callable callable = () -> { allDictionaryList.addAll(notInDataDictionaryList);
RequestContext.setToken(token); redisUtil.set(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY, JSONObject.toJSONString(allDictionaryList));
RequestContext.setAppKey(appKey); }
RequestContext.setProduct(product); }
//同步企业至ugp,成功返回true,失败返回false
return ugpServiceFeignClient.syncCompany(model); @SchedulerLock(name = "asyncSetQrCodeTask", lockAtMostFor = "PT30M")
}; @Scheduled(cron = "${async.set.qr-code.cron:0 0/1 * * * ?}")
future = new FutureTask(callable); public void asyncSetQrCode() {
Thread thread = new Thread(future); // 给所有新注册的企业创建二维码,每次处理1000个,不排序
thread.start(); if (logger.isDebugEnabled()) {
} logger.debug("新注册企业二维码生成开始");
return future; }
} List<TzBaseEnterpriseInfo> noQrCodeList = tzBaseEnterpriseInfoMapper.listNoQrCode();
if (noQrCodeList.isEmpty()) {
private static String createQRCode(String unitCode) { if (logger.isDebugEnabled()) {
String urlString = null; logger.debug("暂无待生成二维码的企业");
byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(unitCode, 150); }
InputStream inputStream = new ByteArrayInputStream(bytes); return;
try { }
MultipartFile file = new MockMultipartFile(unitCode+".png",unitCode+".png", ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/qrcode"); noQrCodeList.parallelStream().forEach(enterpriseInfo -> enterpriseInfo.setQrCode(createQRCode(enterpriseInfo.getUseCode())));
if (date != null) {
Map<String, String> map = date.getResult(); tzBaseEnterpriseInfoService.saveOrUpdateBatch(noQrCodeList);
Iterator<String> it = map.keySet().iterator();
urlString=it.next(); if (logger.isDebugEnabled()) {
} logger.debug("新注册企业二维码生成结束");
} catch (IOException e) { }
e.printStackTrace(); }
throw new BadRequest(unitCode + ":生成二维码失败");
} private FutureTask<ResponseModel<Boolean>> getResponseModelFutureTask(RegUnitInfoDto model) {
return urlString; //多线程同步ugp信息(tzs和ugp一起后放开)
} FutureTask<ResponseModel<Boolean>> future = null;
if (isUgp) {
/** String token = RequestContext.getToken();
* 创建企业信息 String appKey = RequestContext.getAppKey();
* @param regUnitInfo 提交对象 String product = RequestContext.getProduct();
*/ Callable callable = () -> {
public TzBaseEnterpriseInfo createBaseEnterpriseInfo(RegUnitInfoDto regUnitInfo, String type) { RequestContext.setToken(token);
// 1.填充数据 RequestContext.setAppKey(appKey);
TzBaseEnterpriseInfo baseEnterpriseInfo = new TzBaseEnterpriseInfo(); RequestContext.setProduct(product);
baseEnterpriseInfo.setUnitType(StringUtils.join(regUnitInfo.getUnitTypeList(), "#")); //同步企业至ugp,成功返回true,失败返回false
baseEnterpriseInfo.setUseCode(regUnitInfo.getUnitCode()); return ugpServiceFeignClient.syncCompany(model);
baseEnterpriseInfo.setUseUnit(regUnitInfo.getName()); };
future = new FutureTask(callable);
if(type.equals(EnterpriseEnums.GR_ZT.getType())){ Thread thread = new Thread(future);
baseEnterpriseInfo.setUseUnitCode(regUnitInfo.getUnitCode().split("_")[1]); thread.start();
} else { }
baseEnterpriseInfo.setProvince(regUnitInfo.getProvince()); return future;
baseEnterpriseInfo.setCity(regUnitInfo.getCity()); }
baseEnterpriseInfo.setDistrict(regUnitInfo.getDistrict());
baseEnterpriseInfo.setStreet(regUnitInfo.getStree()); private static String createQRCode(String unitCode) {
baseEnterpriseInfo.setCommunity(regUnitInfo.getCommunity()); String urlString = null;
baseEnterpriseInfo.setAddress(regUnitInfo.getAddress()); byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(unitCode, 150);
baseEnterpriseInfo.setLegalPerson(regUnitInfo.getLegalPerson()); InputStream inputStream = new ByteArrayInputStream(bytes);
baseEnterpriseInfo.setLegalPhone(regUnitInfo.getLegalPersonTel()); try {
baseEnterpriseInfo.setLongitude(regUnitInfo.getLongitude()); MultipartFile file = new MockMultipartFile(unitCode + ".png", unitCode + ".png", ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
baseEnterpriseInfo.setLatitude(regUnitInfo.getLatitude()); FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/qrcode");
baseEnterpriseInfo.setUseContact(regUnitInfo.getAdminName()); if (date != null) {
baseEnterpriseInfo.setContactPhone(regUnitInfo.getAdminTel()); Map<String, String> map = date.getResult();
baseEnterpriseInfo.setUseUnitCode(regUnitInfo.getUnitCode()); Iterator<String> it = map.keySet().iterator();
baseEnterpriseInfo.setUseUnitCertificate(regUnitInfo.getUnitCodeTypeName()); urlString = it.next();
} }
// 管辖机构信息 } catch (IOException e) {
baseEnterpriseInfo.setSuperviseCode(regUnitInfo.getManagementUnitCompanyCode()); e.printStackTrace();
baseEnterpriseInfo.setSuperviseOrgCode(regUnitInfo.getManagementUnitOrgCode()); throw new BadRequest(unitCode + ":生成二维码失败");
// 这个表有两个字段所以赋值两字段 }
baseEnterpriseInfo.setSuperviseOrgName(regUnitInfo.getManagementUnit()); return urlString;
baseEnterpriseInfo.setGoverningBody(regUnitInfo.getManagementUnit()); }
if (UnitDataSourceEnum.NATIONAL.getCode().equals(regUnitInfo.getIsNationwide())) {
baseEnterpriseInfo.setDataSources(UnitDataSourceEnum.NATIONAL.getName()); /**
} else { * 创建企业信息
baseEnterpriseInfo.setDataSources(UnitDataSourceEnum.SHAANXI.getName()); *
} * @param regUnitInfo 提交对象
*/
baseEnterpriseInfo.setRegisterType(Objects.requireNonNull(EnterpriseEnums.getEnumByType(type).getTypeName())); public TzBaseEnterpriseInfo createBaseEnterpriseInfo(RegUnitInfoDto regUnitInfo, String type) {
if (type.equals(EnterpriseEnums.QY_DW.getType())){ // 1.填充数据
baseEnterpriseInfo.setIndustry(regUnitInfo.getRegUnitIc().getIndustryName()); TzBaseEnterpriseInfo baseEnterpriseInfo = new TzBaseEnterpriseInfo();
baseEnterpriseInfo.setRegistrationAuthority(regUnitInfo.getRegUnitIc().getRegisteredOrgan()); baseEnterpriseInfo.setUnitType(StringUtils.join(regUnitInfo.getUnitTypeList(), "#"));
baseEnterpriseInfo.setApprovalTime(regUnitInfo.getRegUnitIc().getApprovedDate()); baseEnterpriseInfo.setUseCode(regUnitInfo.getUnitCode());
baseEnterpriseInfo.setOperatingStatus(regUnitInfo.getRegUnitIc().getBusinessState()); baseEnterpriseInfo.setUseUnit(regUnitInfo.getName());
}
baseEnterpriseInfo.setSyncDate(new Date()); if (type.equals(EnterpriseEnums.GR_ZT.getType())) {
baseEnterpriseInfo.setSyncState(0); baseEnterpriseInfo.setUseUnitCode(regUnitInfo.getUnitCode().split("_")[1]);
LambdaQueryWrapper<TzBaseEnterpriseInfo> wrapper = new LambdaQueryWrapper<>(); } else {
wrapper.eq(TzBaseEnterpriseInfo::getUseCode,regUnitInfo.getUnitCode()); baseEnterpriseInfo.setProvince(regUnitInfo.getProvince());
tzBaseEnterpriseInfoService.saveOrUpdate(baseEnterpriseInfo,wrapper); baseEnterpriseInfo.setCity(regUnitInfo.getCity());
return baseEnterpriseInfo; baseEnterpriseInfo.setDistrict(regUnitInfo.getDistrict());
} baseEnterpriseInfo.setStreet(regUnitInfo.getStree());
baseEnterpriseInfo.setCommunity(regUnitInfo.getCommunity());
@Override baseEnterpriseInfo.setAddress(regUnitInfo.getAddress());
public RegUnitInfoDto unitCheck(String unitCode,String companyName,String registerType, String cardType) { baseEnterpriseInfo.setLegalPerson(regUnitInfo.getLegalPerson());
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto(); baseEnterpriseInfo.setLegalPhone(regUnitInfo.getLegalPersonTel());
startPlatformTokenService.getToken(); baseEnterpriseInfo.setLongitude(regUnitInfo.getLongitude());
baseEnterpriseInfo.setLatitude(regUnitInfo.getLatitude());
baseEnterpriseInfo.setUseContact(regUnitInfo.getAdminName());
baseEnterpriseInfo.setContactPhone(regUnitInfo.getAdminTel());
baseEnterpriseInfo.setUseUnitCode(regUnitInfo.getUnitCode());
baseEnterpriseInfo.setUseUnitCertificate(regUnitInfo.getUnitCodeTypeName());
}
// 管辖机构信息
baseEnterpriseInfo.setSuperviseCode(regUnitInfo.getManagementUnitCompanyCode());
baseEnterpriseInfo.setSuperviseOrgCode(regUnitInfo.getManagementUnitOrgCode());
// 这个表有两个字段所以赋值两字段
baseEnterpriseInfo.setSuperviseOrgName(regUnitInfo.getManagementUnit());
baseEnterpriseInfo.setGoverningBody(regUnitInfo.getManagementUnit());
if (UnitDataSourceEnum.NATIONAL.getCode().equals(regUnitInfo.getIsNationwide())) {
baseEnterpriseInfo.setDataSources(UnitDataSourceEnum.NATIONAL.getName());
} else {
baseEnterpriseInfo.setDataSources(UnitDataSourceEnum.SHAANXI.getName());
}
baseEnterpriseInfo.setRegisterType(Objects.requireNonNull(EnterpriseEnums.getEnumByType(type).getTypeName()));
if (type.equals(EnterpriseEnums.QY_DW.getType())) {
baseEnterpriseInfo.setIndustry(regUnitInfo.getRegUnitIc().getIndustryName());
baseEnterpriseInfo.setRegistrationAuthority(regUnitInfo.getRegUnitIc().getRegisteredOrgan());
baseEnterpriseInfo.setApprovalTime(regUnitInfo.getRegUnitIc().getApprovedDate());
baseEnterpriseInfo.setOperatingStatus(regUnitInfo.getRegUnitIc().getBusinessState());
}
baseEnterpriseInfo.setSyncDate(new Date());
baseEnterpriseInfo.setSyncState(0);
LambdaQueryWrapper<TzBaseEnterpriseInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseEnterpriseInfo::getUseCode, regUnitInfo.getUnitCode());
tzBaseEnterpriseInfoService.saveOrUpdate(baseEnterpriseInfo, wrapper);
return baseEnterpriseInfo;
}
@Override
public RegUnitInfoDto unitCheck(String unitCode, String companyName, String registerType, String cardType) {
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
startPlatformTokenService.getToken();
// if (!ValidationUtil.isEmpty(companyName)) { // if (!ValidationUtil.isEmpty(companyName)) {
// FeignClientResult<CompanyModel> result = Privilege.companyClient.queryByCompanyName(companyName); // FeignClientResult<CompanyModel> result = Privilege.companyClient.queryByCompanyName(companyName);
// if (result.getResult() != null) { // if (result.getResult() != null) {
// throw new BadRequest("重复的公司名称"); // throw new BadRequest("重复的公司名称");
// } // }
// } // }
if("6600".equals(cardType)){ if ("6600".equals(cardType)) {
boolean b =IdcardUtil.isValidCard(unitCode); boolean b = IdcardUtil.isValidCard(unitCode);
if (!b) { if (!b) {
throw new BadRequest("非法的证件号码"); throw new BadRequest("非法的证件号码");
} }
} }
if (!ValidationUtil.isEmpty(unitCode)) { if (!ValidationUtil.isEmpty(unitCode)) {
unitCode = ObjectUtils.isEmpty(cardType) ? unitCode : cardType + "_" + unitCode; unitCode = ObjectUtils.isEmpty(cardType) ? unitCode : cardType + "_" + unitCode;
FeignClientResult<CompanyModel> result = Privilege.companyClient.queryByCompanyCode(unitCode); FeignClientResult<CompanyModel> result = Privilege.companyClient.queryByCompanyCode(unitCode);
if (result.getResult() != null) { if (result.getResult() != null) {
throw new BadRequest(!ObjectUtils.isEmpty(cardType) ? "重复的证件号码" : "重复的注册编码"); throw new BadRequest(!ObjectUtils.isEmpty(cardType) ? "重复的证件号码" : "重复的注册编码");
} }
} }
// 1.校验重复性 // 1.校验重复性
// RegUnitInfo regUnitInfo = this // RegUnitInfo regUnitInfo = this
// .getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode)); // .getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
// if (regUnitInfo != null) { // if (regUnitInfo != null) {
// throw new RuntimeException("该单位已注册,请联系企业管理员!"); // throw new RuntimeException("该单位已注册,请联系企业管理员!");
// } // }
// 2.组织返回数据 // 2.组织返回数据
if(ObjectUtils.isEmpty(registerType)){ if (ObjectUtils.isEmpty(registerType)) {
//2.1 工商信息查询 //2.1 工商信息查询
Map<String, Object> resultMap = accessFeignService.getData(unitCode).getResult(); Map<String, Object> resultMap = accessFeignService.getData(unitCode).getResult();
if (resultMap == null){ if (resultMap == null) {
throw new BadRequest("工商信息接口查询失败,请稍后再试!"); throw new BadRequest("工商信息接口查询失败,请稍后再试!");
} }
if (ObjectUtils.isEmpty(resultMap)) { if (ObjectUtils.isEmpty(resultMap)) {
throw new BadRequest("未查询到企业信息,请核对!"); throw new BadRequest("未查询到企业信息,请核对!");
} }
if(!ValidationUtil.isEmpty(resultMap)){ if (!ValidationUtil.isEmpty(resultMap)) {
// 2.2 工商信息组装 // 2.2 工商信息组装
String area = String.valueOf(resultMap.get("area")); String area = String.valueOf(resultMap.get("area"));
String city = area.substring(0,area.indexOf("市")+1); String city = area.substring(0, area.indexOf("市") + 1);
String district = area.substring(city.length()); String district = area.substring(city.length());
if("高新区".equals(district)){ if ("高新区".equals(district)) {
district = "雁塔区"; district = "雁塔区";
} }
regUnitInfoDto.setCity(city); regUnitInfoDto.setCity(city);
regUnitInfoDto.setDistrict(district); regUnitInfoDto.setDistrict(district);
regUnitInfoDto.setStree(String.valueOf(resultMap.get("street"))); regUnitInfoDto.setStree(String.valueOf(resultMap.get("street")));
regUnitInfoDto.setCommunity(String.valueOf(resultMap.get("community"))); regUnitInfoDto.setCommunity(String.valueOf(resultMap.get("community")));
regUnitInfoDto.setAddress(String.valueOf(resultMap.get("address"))); regUnitInfoDto.setAddress(String.valueOf(resultMap.get("address")));
regUnitInfoDto.setUnitCode(String.valueOf(resultMap.get("creditCode"))); regUnitInfoDto.setUnitCode(String.valueOf(resultMap.get("creditCode")));
regUnitInfoDto.setName(String.valueOf(resultMap.get("unitName"))); regUnitInfoDto.setName(String.valueOf(resultMap.get("unitName")));
regUnitInfoDto.setLegalPerson(String.valueOf(resultMap.get("legalPeople"))); regUnitInfoDto.setLegalPerson(String.valueOf(resultMap.get("legalPeople")));
String industryName = ""; String industryName = "";
if(ObjectUtils.isNotEmpty(resultMap.get("industryCode"))){ if (ObjectUtils.isNotEmpty(resultMap.get("industryCode"))) {
List<DataDictionary> dictionaries = this.initAllDataDictionaryList(); List<DataDictionary> dictionaries = this.initAllDataDictionaryList();
Optional<DataDictionary> op = dictionaries.stream().filter(d->d.getCode() != null && d.getType() !=null && d.getCode().equals(String.valueOf(resultMap.get("industryCode")))&& "HYXLDM".equals(d.getType())).findFirst(); Optional<DataDictionary> op = dictionaries.stream().filter(d -> d.getCode() != null && d.getType() != null && d.getCode().equals(String.valueOf(resultMap.get("industryCode"))) && "HYXLDM".equals(d.getType())).findFirst();
if(op.isPresent()) { if (op.isPresent()) {
DataDictionary dataDictionary = op.get(); DataDictionary dataDictionary = op.get();
industryName = dataDictionary.getName(); industryName = dataDictionary.getName();
} }
} }
String approveDate = String.valueOf(resultMap.get("approval_time")); String approveDate = String.valueOf(resultMap.get("approval_time"));
approveDate = approveDate.contains("年")?approveDate.replace("年","-"):approveDate; approveDate = approveDate.contains("年") ? approveDate.replace("年", "-") : approveDate;
approveDate = approveDate.contains("月")?approveDate.replace("月","-"):approveDate; approveDate = approveDate.contains("月") ? approveDate.replace("月", "-") : approveDate;
approveDate = approveDate.contains("日")?approveDate.replace("日","-"):approveDate; approveDate = approveDate.contains("日") ? approveDate.replace("日", "-") : approveDate;
RegUnitIcDto regUnitIcDto = new RegUnitIcDto(); RegUnitIcDto regUnitIcDto = new RegUnitIcDto();
regUnitIcDto.setUnitCode(regUnitInfoDto.getUnitCode()); regUnitIcDto.setUnitCode(regUnitInfoDto.getUnitCode());
try { try {
regUnitIcDto.setApprovedDate(DateUtils.dateParse(approveDate,"yyyy-MM-dd")); regUnitIcDto.setApprovedDate(DateUtils.dateParse(approveDate, "yyyy-MM-dd"));
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
regUnitIcDto.setUnitName(regUnitInfoDto.getName()); regUnitIcDto.setUnitName(regUnitInfoDto.getName());
regUnitIcDto.setRegisteredOrgan(String.valueOf(resultMap.get("registration_authority"))); regUnitIcDto.setRegisteredOrgan(String.valueOf(resultMap.get("registration_authority")));
regUnitIcDto.setBusinessState(String.valueOf(resultMap.get("operating_status"))); regUnitIcDto.setBusinessState(String.valueOf(resultMap.get("operating_status")));
regUnitIcDto.setProvince("陕西省"); regUnitIcDto.setProvince("陕西省");
regUnitIcDto.setCity(regUnitInfoDto.getCity()); regUnitIcDto.setCity(regUnitInfoDto.getCity());
regUnitIcDto.setDistrict(regUnitInfoDto.getDistrict()); regUnitIcDto.setDistrict(regUnitInfoDto.getDistrict());
regUnitIcDto.setStree(regUnitInfoDto.getStree()); regUnitIcDto.setStree(regUnitInfoDto.getStree());
regUnitIcDto.setCommunity(regUnitInfoDto.getCommunity()); regUnitIcDto.setCommunity(regUnitInfoDto.getCommunity());
regUnitIcDto.setAddress(regUnitInfoDto.getAddress()); regUnitIcDto.setAddress(regUnitInfoDto.getAddress());
regUnitIcDto.setLegalPerson(regUnitInfoDto.getLegalPerson()); regUnitIcDto.setLegalPerson(regUnitInfoDto.getLegalPerson());
regUnitIcDto.setIndustryName(industryName); regUnitIcDto.setIndustryName(industryName);
regUnitInfoDto.setRegUnitIc(regUnitIcDto); regUnitInfoDto.setRegUnitIc(regUnitIcDto);
} else { } else {
regUnitInfoDto.setRegUnitIc(new RegUnitIcDto()); regUnitInfoDto.setRegUnitIc(new RegUnitIcDto());
} }
} else if("6598".equals(registerType)){ } else if ("6598".equals(registerType)) {
TzsBaseInstitution regUnitMessage = tzsBaseInstitutionMapper.selectOne(new LambdaQueryWrapper<TzsBaseInstitution>().eq(TzsBaseInstitution::getUseCode, unitCode)); TzsBaseInstitution regUnitMessage = tzsBaseInstitutionMapper.selectOne(new LambdaQueryWrapper<TzsBaseInstitution>().eq(TzsBaseInstitution::getUseCode, unitCode));
TzsBaseInstitutionDto institutionDto = new TzsBaseInstitutionDto(); TzsBaseInstitutionDto institutionDto = new TzsBaseInstitutionDto();
if(!ObjectUtils.isEmpty(regUnitMessage)){ if (!ObjectUtils.isEmpty(regUnitMessage)) {
BeanUtils.copyProperties(regUnitMessage, institutionDto); BeanUtils.copyProperties(regUnitMessage, institutionDto);
} }
regUnitInfoDto.setRegUnitMessage(institutionDto); regUnitInfoDto.setRegUnitMessage(institutionDto);
} }
// 2.3 许可信息组装 // 2.3 许可信息组装
List<BaseUnitLicence> unitLicences = baseUnitLicenceService List<BaseUnitLicence> unitLicences = baseUnitLicenceService
.list(new LambdaQueryWrapper<BaseUnitLicence>().eq(BaseUnitLicence::getUnitCode, unitCode)); .list(new LambdaQueryWrapper<BaseUnitLicence>().eq(BaseUnitLicence::getUnitCode, unitCode));
regUnitInfoDto.setUnitLicences(Bean.toModels(unitLicences, BaseUnitLicenceDto.class)); regUnitInfoDto.setUnitLicences(Bean.toModels(unitLicences, BaseUnitLicenceDto.class));
return regUnitInfoDto; return regUnitInfoDto;
} }
@Override @Override
public List<DataDictionary> getUnitTypeList() { public List<DataDictionary> getUnitTypeList() {
return this.setAndGetUnitTypeList(); return this.setAndGetUnitTypeList();
} }
public List<DataDictionary> setAndGetUnitTypeList() { public List<DataDictionary> setAndGetUnitTypeList() {
List<DataDictionary> dataDictionaries; List<DataDictionary> dataDictionaries;
// 先从Redis缓存中获取值 // 先从Redis缓存中获取值
if(redisUtil.hasKey(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY)){ if (redisUtil.hasKey(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY)) {
dataDictionaries = JSONObject.parseArray(redisUtil.get(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY).toString(),DataDictionary.class); dataDictionaries = JSONObject.parseArray(redisUtil.get(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY).toString(), DataDictionary.class);
return dataDictionaries; return dataDictionaries;
} }
// 在同步块内再次检查缓存,以避免多个线程同时查不到缓存时重复查询数据库 // 在同步块内再次检查缓存,以避免多个线程同时查不到缓存时重复查询数据库
synchronized (this){ synchronized (this) {
if(redisUtil.hasKey(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY)){ if (redisUtil.hasKey(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY)) {
dataDictionaries = JSONObject.parseArray(redisUtil.get(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY).toString(),DataDictionary.class); dataDictionaries = JSONObject.parseArray(redisUtil.get(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY).toString(), DataDictionary.class);
} else{ } else {
dataDictionaries = iDataDictionaryService.getByType(DICT_TYPE_UNIT_TYPE); dataDictionaries = iDataDictionaryService.getByType(DICT_TYPE_UNIT_TYPE);
redisUtil.set(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY,JSONObject.toJSONString(dataDictionaries)); redisUtil.set(BizCommonConstant.UNIT_TYPE_LIST_REDIS_KEY, JSONObject.toJSONString(dataDictionaries));
} }
} }
return dataDictionaries; return dataDictionaries;
} }
@Override @Override
public List<DataDictionary> getPersonTypeList() { public List<DataDictionary> getPersonTypeList() {
return this.setAndGetPersonRegisterTypeList(); return this.setAndGetPersonRegisterTypeList();
} }
public List<DataDictionary> setAndGetPersonRegisterTypeList() { public List<DataDictionary> setAndGetPersonRegisterTypeList() {
List<DataDictionary> dataDictionaries; List<DataDictionary> dataDictionaries;
// 先从Redis缓存中获取值 // 先从Redis缓存中获取值
if(redisUtil.hasKey(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY)){ if (redisUtil.hasKey(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY)) {
dataDictionaries = JSONObject.parseArray(redisUtil.get(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY).toString(),DataDictionary.class); dataDictionaries = JSONObject.parseArray(redisUtil.get(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY).toString(), DataDictionary.class);
return dataDictionaries; return dataDictionaries;
} }
// 在同步块内再次检查缓存,以避免多个线程同时查不到缓存时重复查询数据库 // 在同步块内再次检查缓存,以避免多个线程同时查不到缓存时重复查询数据库
synchronized (this){ synchronized (this) {
if(redisUtil.hasKey(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY)){ if (redisUtil.hasKey(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY)) {
dataDictionaries = JSONObject.parseArray(redisUtil.get(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY).toString(),DataDictionary.class); dataDictionaries = JSONObject.parseArray(redisUtil.get(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY).toString(), DataDictionary.class);
} else{ } else {
dataDictionaries = iDataDictionaryService.getByType(PERSON_REGISTER_TYPE); dataDictionaries = iDataDictionaryService.getByType(PERSON_REGISTER_TYPE);
redisUtil.set(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY,JSONObject.toJSONString(dataDictionaries)); redisUtil.set(BizCommonConstant.PERSON_REGISTER_TYPE_LIST_REDIS_KEY, JSONObject.toJSONString(dataDictionaries));
} }
} }
return dataDictionaries; return dataDictionaries;
} }
@Override @Override
public List<DataDictionary> getChildList(String type, String group) { public List<DataDictionary> getChildList(String type, String group) {
List<DataDictionary> dictionaries = this.initAllDataDictionaryList(); List<DataDictionary> dictionaries = this.initAllDataDictionaryList();
return dictionaries.stream().parallel().filter(d->d.getType().equals(type) && d.getTypeDesc().equals(group)).collect(Collectors.toList()); return dictionaries.stream().parallel().filter(d -> d.getType().equals(type) && d.getTypeDesc().equals(group)).collect(Collectors.toList());
} }
@Override @Override
public void setAllDataDictionaryList(){ public void setAllDataDictionaryList() {
this.initAllDataDictionaryList(); this.initAllDataDictionaryList();
} }
@Override @Override
public List<Menu> getDictionaryWithTreeFillId(String type) throws Exception { public List<Menu> getDictionaryWithTreeFillId(String type) throws Exception {
List<DataDictionary> dictionaries = this.initAllDataDictionaryList(); List<DataDictionary> dictionaries = this.initAllDataDictionaryList();
List<DataDictionary> temp = dictionaries.stream().parallel().filter(d->d.getType().equals(type)).collect(Collectors.toList()); List<DataDictionary> temp = dictionaries.stream().parallel().filter(d -> d.getType().equals(type)).collect(Collectors.toList());
return TreeParser.getTree(null, temp, DataDictionary.class.getName(), "getSequenceNbr", 2, return TreeParser.getTree(null, temp, DataDictionary.class.getName(), "getSequenceNbr", 2,
"getName", "getParent", null, "getCode"); "getName", "getParent", null, "getCode");
} }
@Override @Override
public List<DataDictionary> getDictionaryListByType(String type) throws Exception { public List<DataDictionary> getDictionaryListByType(String type) throws Exception {
List<DataDictionary> dictionaries = this.initAllDataDictionaryList(); List<DataDictionary> dictionaries = this.initAllDataDictionaryList();
return dictionaries.stream().parallel().filter(d->d.getType().equals(type)).collect(Collectors.toList()); return dictionaries.stream().parallel().filter(d -> d.getType().equals(type)).collect(Collectors.toList());
} }
public List<DataDictionary> initAllDataDictionaryList() { public List<DataDictionary> initAllDataDictionaryList() {
List<DataDictionary> dictionaries; List<DataDictionary> dictionaries;
// 使用双重检查锁定 // 使用双重检查锁定
if (redisUtil.hasKey(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY)) { if (redisUtil.hasKey(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY)) {
String json = redisUtil.get(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY).toString(); String json = redisUtil.get(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY).toString();
dictionaries = JSONObject.parseArray(json, DataDictionary.class); dictionaries = JSONObject.parseArray(json, DataDictionary.class);
return dictionaries; return dictionaries;
} }
synchronized (this) { synchronized (this) {
if (redisUtil.hasKey(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY)) { if (redisUtil.hasKey(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY)) {
String json = redisUtil.get(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY).toString(); String json = redisUtil.get(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY).toString();
dictionaries = JSONObject.parseArray(json, DataDictionary.class); dictionaries = JSONObject.parseArray(json, DataDictionary.class);
} else{ } else {
dictionaries = dataDictionaryService.list(new LambdaQueryWrapper<DataDictionary>().eq(BaseEntity::getIsDelete,false)); dictionaries = dataDictionaryService.list(new LambdaQueryWrapper<DataDictionary>().eq(BaseEntity::getIsDelete, false));
redisUtil.set(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY, JSONObject.toJSONString(dictionaries)); redisUtil.set(BizCommonConstant.TCM_ALL_DATA_DICT_REDIS_KEY, JSONObject.toJSONString(dictionaries));
} }
} }
return dictionaries; return dictionaries;
} }
@Override
@Override public Collection getManagementUnitTree(String orgCode) {
public Collection getManagementUnitTree(String orgCode) { List<LinkedHashMap> companyModels = (List<LinkedHashMap>) redisUtil.get(BizCommonConstant.COMPANY_TREE_REDIS_KEY);
List<LinkedHashMap> companyModels = (List<LinkedHashMap>) redisUtil.get(BizCommonConstant.COMPANY_TREE_REDIS_KEY); if (ValidationUtil.isEmpty(companyModels)) {
if (ValidationUtil.isEmpty(companyModels)) { startPlatformTokenService.getToken();
startPlatformTokenService.getToken(); companyModels = equipmentCategoryService.creatTree();
companyModels = equipmentCategoryService.creatTree(); }
} if (!ValidationUtil.isEmpty(orgCode)) {
if (!ValidationUtil.isEmpty(orgCode)) {
companyModels = findNodesByCondition(companyModels, "orgCode", orgCode, "children"); companyModels = findNodesByCondition(companyModels, "orgCode", orgCode, "children");
companyModels = (List<LinkedHashMap>) companyModels.get(0).get("children"); companyModels = (List<LinkedHashMap>) companyModels.get(0).get("children");
} }
return companyModels; return companyModels;
} }
// public Collection getManagementUnitTree2(String orgCode) { // public Collection getManagementUnitTree2(String orgCode) {
...@@ -630,218 +666,218 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -630,218 +666,218 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// return result; // return result;
// } // }
public static List<LinkedHashMap> findNodesByCondition(List<LinkedHashMap> nodes, String conditionName, public static List<LinkedHashMap> findNodesByCondition(List<LinkedHashMap> nodes, String conditionName,
String condition, String childName) { String condition, String childName) {
return nodes.stream() return nodes.stream()
.flatMap(node -> Stream.concat( .flatMap(node -> Stream.concat(
node.get(conditionName).equals(condition) ? Stream.of(node) : Stream.empty(), node.get(conditionName).equals(condition) ? Stream.of(node) : Stream.empty(),
node.get(childName) != null ? findNodesByCondition((List<LinkedHashMap>) node.get(childName), node.get(childName) != null ? findNodesByCondition((List<LinkedHashMap>) node.get(childName),
conditionName, condition, condition).stream() : conditionName, condition, condition).stream() :
Stream.empty() Stream.empty()
)) ))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean unitLogOut(String unitCode) { public Boolean unitLogOut(String unitCode) {
RegUnitInfo regUnitInfo = this RegUnitInfo regUnitInfo = this
.getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode)); .getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
if (regUnitInfo == null) { if (regUnitInfo == null) {
return Boolean.FALSE; return Boolean.FALSE;
} }
try { try {
// 1.删除已经创建的企业信息 // 1.删除已经创建的企业信息
if (StringUtils.isNotEmpty(regUnitInfo.getAmosCompanySeq())) { if (StringUtils.isNotEmpty(regUnitInfo.getAmosCompanySeq())) {
CompanyModel companyModel = Privilege.companyClient CompanyModel companyModel = Privilege.companyClient
.seleteOne(Long.parseLong(regUnitInfo.getAmosCompanySeq())).getResult(); .seleteOne(Long.parseLong(regUnitInfo.getAmosCompanySeq())).getResult();
if (companyModel != null) { if (companyModel != null) {
Privilege.companyClient.deleteCompany(regUnitInfo.getAmosCompanySeq()); Privilege.companyClient.deleteCompany(regUnitInfo.getAmosCompanySeq());
} }
} }
// 2.删除已经创建的管理员账号 // 2.删除已经创建的管理员账号
FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient
.queryByUserId(regUnitInfo.getAdminUserId()); .queryByUserId(regUnitInfo.getAdminUserId());
if (feignClientResult != null) { if (feignClientResult != null) {
Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId()); Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId());
} }
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
// 3.企业注册表删除 // 3.企业注册表删除
this.remove(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode)); this.remove(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
// 4.工商信息表删除 // 4.工商信息表删除
regUnitIcService.remove(new LambdaQueryWrapper<RegUnitIc>().eq(RegUnitIc::getUnitCode, unitCode)); regUnitIcService.remove(new LambdaQueryWrapper<RegUnitIc>().eq(RegUnitIc::getUnitCode, unitCode));
// 5.许可信息删除 // 5.许可信息删除
baseUnitLicenceService baseUnitLicenceService
.remove(new LambdaQueryWrapper<BaseUnitLicence>().eq(BaseUnitLicence::getUnitCode, unitCode)); .remove(new LambdaQueryWrapper<BaseUnitLicence>().eq(BaseUnitLicence::getUnitCode, unitCode));
// 6.企业数据信息删除 // 6.企业数据信息删除
tzBaseEnterpriseInfoService tzBaseEnterpriseInfoService
.remove(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().eq(TzBaseEnterpriseInfo::getUseCode, unitCode)); .remove(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().eq(TzBaseEnterpriseInfo::getUseCode, unitCode));
// 7.机场单位表信息删除 // 7.机场单位表信息删除
iOrgUsrService iOrgUsrService
.remove(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getAmosOrgId, regUnitInfo.getAmosCompanySeq())); .remove(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getAmosOrgId, regUnitInfo.getAmosCompanySeq()));
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override @Override
public Boolean checkRepeatAccount(String userName) { public Boolean checkRepeatAccount(String userName) {
return this.count(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getAdminLoginName, userName)) > 0; return this.count(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getAdminLoginName, userName)) > 0;
} }
@Override @Override
public Boolean checkRepeatPhone(String phoneNo) { public Boolean checkRepeatPhone(String phoneNo) {
return this.count(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getAdminTel, phoneNo)) > 0; return this.count(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getAdminTel, phoneNo)) > 0;
} }
@Override @Override
public void updateAdminInfo(JSONObject dataResult) { public void updateAdminInfo(JSONObject dataResult) {
RegUnitInfo regUnitInfo = regUnitInfoMapper.selectOne(new QueryWrapper<RegUnitInfo>().eq("admin_user_id", dataResult.get("userId"))); RegUnitInfo regUnitInfo = regUnitInfoMapper.selectOne(new QueryWrapper<RegUnitInfo>().eq("admin_user_id", dataResult.get("userId")));
if(!ObjectUtils.isEmpty(regUnitInfo)){ if (!ObjectUtils.isEmpty(regUnitInfo)) {
regUnitInfo.setAdminTel(String.valueOf(dataResult.get("mobile"))); regUnitInfo.setAdminTel(String.valueOf(dataResult.get("mobile")));
regUnitInfo.setAdminName(String.valueOf(dataResult.get("realName"))); regUnitInfo.setAdminName(String.valueOf(dataResult.get("realName")));
regUnitInfoMapper.updateById(regUnitInfo); regUnitInfoMapper.updateById(regUnitInfo);
} }
} }
@Override @Override
public Boolean creatQrCode() { public Boolean creatQrCode() {
List<TzBaseEnterpriseInfo> tzBaseEnterpriseInfoList = tzBaseEnterpriseInfoMapper.selectList(new QueryWrapper<TzBaseEnterpriseInfo>().isNull("qr_code")); List<TzBaseEnterpriseInfo> tzBaseEnterpriseInfoList = tzBaseEnterpriseInfoMapper.selectList(new QueryWrapper<TzBaseEnterpriseInfo>().isNull("qr_code"));
if (!ObjectUtils.isEmpty(tzBaseEnterpriseInfoList) && tzBaseEnterpriseInfoList.size() > 0) { if (!ObjectUtils.isEmpty(tzBaseEnterpriseInfoList) && tzBaseEnterpriseInfoList.size() > 0) {
for (TzBaseEnterpriseInfo tzBaseEnterpriseInfo : tzBaseEnterpriseInfoList) { for (TzBaseEnterpriseInfo tzBaseEnterpriseInfo : tzBaseEnterpriseInfoList) {
String qrCode = createQRCode(tzBaseEnterpriseInfo.getUseCode()); String qrCode = createQRCode(tzBaseEnterpriseInfo.getUseCode());
tzBaseEnterpriseInfoMapper.updateById(tzBaseEnterpriseInfo.setQrCode(qrCode)); tzBaseEnterpriseInfoMapper.updateById(tzBaseEnterpriseInfo.setQrCode(qrCode));
} }
return true; return true;
} else { } else {
return false; return false;
} }
} }
@Override @Override
public RegUnitInfoDto adminInfo(String unitCode) { public RegUnitInfoDto adminInfo(String unitCode) {
// 管理员信息 // 管理员信息
RegUnitInfo regUnitInfo = this.getOne( RegUnitInfo regUnitInfo = this.getOne(
new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode)); new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto(); RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
if (regUnitInfo != null) { if (regUnitInfo != null) {
BeanUtils.copyProperties(regUnitInfo, regUnitInfoDto); BeanUtils.copyProperties(regUnitInfo, regUnitInfoDto);
} }
regUnitInfoDto.setAdminIdCardPhoto(ObjectUtils.isEmpty(regUnitInfo.getAdminIdCardPhoto()) ? new ArrayList() : JSON.parseArray(regUnitInfo.getAdminIdCardPhoto())); regUnitInfoDto.setAdminIdCardPhoto(ObjectUtils.isEmpty(regUnitInfo.getAdminIdCardPhoto()) ? new ArrayList() : JSON.parseArray(regUnitInfo.getAdminIdCardPhoto()));
return regUnitInfoDto; return regUnitInfoDto;
} }
private CompanyModel dealChildCompany(CompanyModel cm) { private CompanyModel dealChildCompany(CompanyModel cm) {
cm.setChildren(this.getFilterChild(cm.getChildren() != null ? cm.getChildren() : new ArrayList())); cm.setChildren(this.getFilterChild(cm.getChildren() != null ? cm.getChildren() : new ArrayList()));
cm.getChildren().stream().filter(n -> { cm.getChildren().stream().filter(n -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class);
return !ValidationUtil.isEmpty(CompanyLevelEnum.getEnum(c.getLevel())); return !ValidationUtil.isEmpty(CompanyLevelEnum.getEnum(c.getLevel()));
}).map(n -> { }).map(n -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class);
return dealChildCompany(c); return dealChildCompany(c);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return cm; return cm;
} }
private List getFilterChild(Collection children) { private List getFilterChild(Collection children) {
return (List) children.stream().filter(n -> { return (List) children.stream().filter(n -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class);
return !ValidationUtil.isEmpty(CompanyLevelEnum.getEnum(c.getLevel())); return !ValidationUtil.isEmpty(CompanyLevelEnum.getEnum(c.getLevel()));
}).map(s -> { }).map(s -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(s), CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(s), CompanyModel.class);
c.setChildren(this.getFilterChild(c.getChildren() != null ? c.getChildren() : new ArrayList())); c.setChildren(this.getFilterChild(c.getChildren() != null ? c.getChildren() : new ArrayList()));
return c; return c;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
private void createCompanyAndUser(RegUnitInfo regUnitInfo) { private void createCompanyAndUser(RegUnitInfo regUnitInfo) {
CompanyModel companyInfo = new CompanyModel(); CompanyModel companyInfo = new CompanyModel();
FeignClientResult<AgencyUserModel> userResult = null; FeignClientResult<AgencyUserModel> userResult = null;
try { try {
StopWatch watch1 = new StopWatch(); StopWatch watch1 = new StopWatch();
watch1.start(); watch1.start();
List<RoleModel> allRoleList = startPlatformTokenService.getAllRole(); List<RoleModel> allRoleList = startPlatformTokenService.getAllRole();
watch1.stop(); watch1.stop();
if(logger.isDebugEnabled()){ if (logger.isDebugEnabled()) {
logger.debug("平台查询角色接口耗时:==>{}",watch1.getTotalTimeSeconds()); logger.debug("平台查询角色接口耗时:==>{}", watch1.getTotalTimeSeconds());
} }
List<RoleModel> userRoleList = new ArrayList<>(); List<RoleModel> userRoleList = new ArrayList<>();
List<Long> roleIds = new ArrayList<>(); List<Long> roleIds = new ArrayList<>();
Set<String> roleNameSet = new HashSet<>(); Set<String> roleNameSet = new HashSet<>();
// 3.1创建公司 // 3.1创建公司
companyInfo.setAddress(dealNull2EmptyString(regUnitInfo.getProvince()) companyInfo.setAddress(dealNull2EmptyString(regUnitInfo.getProvince())
+ dealNull2EmptyString(regUnitInfo.getCity()) + dealNull2EmptyString(regUnitInfo.getDistrict()) + dealNull2EmptyString(regUnitInfo.getCity()) + dealNull2EmptyString(regUnitInfo.getDistrict())
+ dealNull2EmptyString(regUnitInfo.getStree()) + dealNull2EmptyString(regUnitInfo.getCommunity()) + dealNull2EmptyString(regUnitInfo.getStree()) + dealNull2EmptyString(regUnitInfo.getCommunity())
+ dealNull2EmptyString(regUnitInfo.getAddress())); + dealNull2EmptyString(regUnitInfo.getAddress()));
companyInfo.setAgencyCode("tzs"); companyInfo.setAgencyCode("tzs");
companyInfo.setParentId(Long.parseLong(regUnitInfo.getManagementUnitId())); companyInfo.setParentId(Long.parseLong(regUnitInfo.getManagementUnitId()));
companyInfo.setLevel("company"); companyInfo.setLevel("company");
companyInfo.setCompanyName(regUnitInfo.getName()); companyInfo.setCompanyName(regUnitInfo.getName());
companyInfo.setCompanyCode(regUnitInfo.getUnitCode()); companyInfo.setCompanyCode(regUnitInfo.getUnitCode());
companyInfo.setContact(regUnitInfo.getLegalPerson()); companyInfo.setContact(regUnitInfo.getLegalPerson());
companyInfo.setCompanyType(regUnitInfo.getUnitType()); companyInfo.setCompanyType(regUnitInfo.getUnitType());
companyInfo.setLandlinePhone(regUnitInfo.getLegalPersonTel()); companyInfo.setLandlinePhone(regUnitInfo.getLegalPersonTel());
StopWatch watch2 = new StopWatch(); StopWatch watch2 = new StopWatch();
watch2.start(); watch2.start();
FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo); FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo);
watch2.stop(); watch2.stop();
if(logger.isDebugEnabled()){ if (logger.isDebugEnabled()) {
logger.debug("创建amos公司耗时:==>{}",watch2.getTotalTimeSeconds()); logger.debug("创建amos公司耗时:==>{}", watch2.getTotalTimeSeconds());
} }
if (companyResult == null || companyResult.getResult() == null) { if (companyResult == null || companyResult.getResult() == null) {
throw new BadRequest("单位注册失败"); throw new BadRequest("单位注册失败");
} }
String adminUserName = regUnitInfo.getAdminName(); String adminUserName = regUnitInfo.getAdminName();
String loginName = regUnitInfo.getAdminLoginName(); String loginName = regUnitInfo.getAdminLoginName();
String pwd = regUnitInfo.getAdminLoginPwd(); String pwd = regUnitInfo.getAdminLoginPwd();
String adminTel = regUnitInfo.getAdminTel(); String adminTel = regUnitInfo.getAdminTel();
// 3.2 创建平台用户 // 3.2 创建平台用户
companyInfo = companyResult.getResult(); companyInfo = companyResult.getResult();
AgencyUserModel agencyUserModel = new AgencyUserModel(); AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setUserName(loginName); agencyUserModel.setUserName(loginName);
agencyUserModel.setRealName(adminUserName); agencyUserModel.setRealName(adminUserName);
agencyUserModel.setLockStatus("UNLOCK"); agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(pwd); agencyUserModel.setPassword(pwd);
agencyUserModel.setRePassword(pwd); agencyUserModel.setRePassword(pwd);
agencyUserModel.setAgencyCode("tzs"); agencyUserModel.setAgencyCode("tzs");
agencyUserModel.setMobile(adminTel); agencyUserModel.setMobile(adminTel);
String unitTypeCode = regUnitInfo.getUnitTypeCode(); String unitTypeCode = regUnitInfo.getUnitTypeCode();
// 根据unitTypeCode 获取应用和角色 数据字典配置 // 根据unitTypeCode 获取应用和角色 数据字典配置
String[] units = unitTypeCode.split(","); String[] units = unitTypeCode.split(",");
Set<String> appCodesSet = new HashSet<>(); Set<String> appCodesSet = new HashSet<>();
Map<Long, List<Long>> roleSeqMap = new HashMap<>(); Map<Long, List<Long>> roleSeqMap = new HashMap<>();
Map<Long, List<RoleModel>> orgRoles = new HashMap<>(); Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
List<DataDictionary> unitTypeList = setAndGetUnitTypeList(); List<DataDictionary> unitTypeList = setAndGetUnitTypeList();
Map<String, DataDictionary> dataDictionaryMap = unitTypeList.stream().collect(Collectors.toMap(DataDictionary::getCode, Function.identity(), (k1, k2) -> k1)); Map<String, DataDictionary> dataDictionaryMap = unitTypeList.stream().collect(Collectors.toMap(DataDictionary::getCode, Function.identity(), (k1, k2) -> k1));
for (String typeCode : units) { for (String typeCode : units) {
DataDictionary unitType = dataDictionaryMap.get(typeCode); DataDictionary unitType = dataDictionaryMap.get(typeCode);
String appCode = unitType.getTypeDesc() != null ? unitType.getTypeDesc() : ""; String appCode = unitType.getTypeDesc() != null ? unitType.getTypeDesc() : "";
String[] appCodes = appCode.split(","); String[] appCodes = appCode.split(",");
Collections.addAll(appCodesSet, appCodes); Collections.addAll(appCodesSet, appCodes);
roleNameSet.add(unitType.getName()); roleNameSet.add(unitType.getName());
userRoleList.addAll(allRoleList.stream() userRoleList.addAll(allRoleList.stream()
.filter(r -> unitType.getExtend().contains(r.getSequenceNbr().toString())).collect(Collectors.toList())); .filter(r -> unitType.getExtend().contains(r.getSequenceNbr().toString())).collect(Collectors.toList()));
userRoleList.forEach(r -> { userRoleList.forEach(r -> {
if (!roleIds.contains(r.getSequenceNbr())) { if (!roleIds.contains(r.getSequenceNbr())) {
roleIds.add(r.getSequenceNbr()); roleIds.add(r.getSequenceNbr());
} }
}); });
roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds); roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds);
orgRoles.put(companyInfo.getSequenceNbr(), userRoleList); orgRoles.put(companyInfo.getSequenceNbr(), userRoleList);
} }
agencyUserModel.setAppCodes(new ArrayList<>(appCodesSet)); agencyUserModel.setAppCodes(new ArrayList<>(appCodesSet));
agencyUserModel.setOrgRoles(orgRoles); agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqMap); agencyUserModel.setOrgRoleSeqs(roleSeqMap);
StopWatch watch3 = new StopWatch(); StopWatch watch3 = new StopWatch();
watch3.start(); watch3.start();
userResult = Privilege.agencyUserClient.create(agencyUserModel); userResult = Privilege.agencyUserClient.create(agencyUserModel);
watch3.stop(); watch3.stop();
if(logger.isDebugEnabled()){ if (logger.isDebugEnabled()) {
logger.debug("创建amos人员耗时:==>{}",watch3.getTotalTimeSeconds()); logger.debug("创建amos人员耗时:==>{}", watch3.getTotalTimeSeconds());
} }
if (userResult == null || userResult.getResult() == null) { if (userResult == null || userResult.getResult() == null) {
throw new BadRequest("单位注册失败"); throw new BadRequest("单位注册失败");
} }
// //同步创建为当前注册管理员添加两员配备人员信息 // //同步创建为当前注册管理员添加两员配备人员信息
// if (userResult.getStatus() == 200) { // if (userResult.getStatus() == 200) {
// TzsUserInfo tzsUserInfo = new TzsUserInfo(); // TzsUserInfo tzsUserInfo = new TzsUserInfo();
...@@ -856,152 +892,152 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -856,152 +892,152 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// tzsUserInfo.setAmosUserName(regUnitInfo.getAdminLoginName()); // tzsUserInfo.setAmosUserName(regUnitInfo.getAdminLoginName());
// tzsUserInfoService.save(tzsUserInfo); // tzsUserInfoService.save(tzsUserInfo);
// } // }
regUnitInfo.setAdminUserId(userResult.getResult().getUserId()); regUnitInfo.setAdminUserId(userResult.getResult().getUserId());
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr().toString()); regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr().toString());
// 3.3 org_user 创建组织机构 // 3.3 org_user 创建组织机构
OrgUsr org = new OrgUsr(); OrgUsr org = new OrgUsr();
org.setBizOrgCode(TreeParser.genTreeCode()); org.setBizOrgCode(TreeParser.genTreeCode());
org.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY); org.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY);
org.setBizOrgName(regUnitInfo.getName()); org.setBizOrgName(regUnitInfo.getName());
org.setRecDate(new Date()); org.setRecDate(new Date());
org.setRecUserId(userResult.getResult().getUserId()); org.setRecUserId(userResult.getResult().getUserId());
org.setRecUserName(userResult.getResult().getRealName()); org.setRecUserName(userResult.getResult().getRealName());
org.setAmosOrgId(companyInfo.getSequenceNbr() + ""); org.setAmosOrgId(companyInfo.getSequenceNbr() + "");
org.setAmosOrgCode(companyInfo.getOrgCode()); org.setAmosOrgCode(companyInfo.getOrgCode());
iOrgUsrService.save(org); iOrgUsrService.save(org);
} catch (Exception e) { } catch (Exception e) {
// 删除已经创建的 企业信息 // 删除已经创建的 企业信息
if (companyInfo != null && companyInfo.getSequenceNbr() != null) { if (companyInfo != null && companyInfo.getSequenceNbr() != null) {
Privilege.companyClient.deleteCompany(companyInfo.getSequenceNbr() + ""); Privilege.companyClient.deleteCompany(companyInfo.getSequenceNbr() + "");
} }
if (userResult != null && userResult.getResult() != null if (userResult != null && userResult.getResult() != null
&& StringUtils.isNotEmpty(userResult.getResult().getUserId())) { && StringUtils.isNotEmpty(userResult.getResult().getUserId())) {
Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId()); Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId());
} }
logger.error(e.getMessage(),e); logger.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
public AgencyUserModel createUser(AccountDto dto,String type) { public AgencyUserModel createUser(AccountDto dto, String type) {
FeignClientResult<AgencyUserModel> userResult = null; FeignClientResult<AgencyUserModel> userResult = null;
try { try {
List<RoleModel> allRoleList = startPlatformTokenService.getAllRole(); List<RoleModel> allRoleList = startPlatformTokenService.getAllRole();
List<RoleModel> userRoleList = new ArrayList<>(); List<RoleModel> userRoleList = new ArrayList<>();
List<Long> roleIds = new ArrayList<>(); List<Long> roleIds = new ArrayList<>();
Set<String> roleNameSet = new HashSet<>(); Set<String> roleNameSet = new HashSet<>();
// 3.2 创建平台用户 // 3.2 创建平台用户
AgencyUserModel agencyUserModel = new AgencyUserModel(); AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setUserName(dto.getLoginName()); agencyUserModel.setUserName(dto.getLoginName());
agencyUserModel.setRealName(dto.getAdminUserName()); agencyUserModel.setRealName(dto.getAdminUserName());
agencyUserModel.setLockStatus("UNLOCK"); agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(dto.getPwd()); agencyUserModel.setPassword(dto.getPwd());
agencyUserModel.setRePassword(dto.getPwd()); agencyUserModel.setRePassword(dto.getPwd());
agencyUserModel.setAgencyCode("tzs"); agencyUserModel.setAgencyCode("tzs");
agencyUserModel.setMobile(dto.getAdminTel()); agencyUserModel.setMobile(dto.getAdminTel());
// 根据unitTypeCode 获取应用和角色 数据字典配置 // 根据unitTypeCode 获取应用和角色 数据字典配置
String[] units = dto.getUnitTypeCode().split(","); String[] units = dto.getUnitTypeCode().split(",");
Set<String> appCodesSet = new HashSet<>(); Set<String> appCodesSet = new HashSet<>();
Map<Long, List<Long>> roleSeqMap = new HashMap<>(); Map<Long, List<Long>> roleSeqMap = new HashMap<>();
Map<Long, List<RoleModel>> orgRoles = new HashMap<>(); Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
List<DataDictionary> unitTypeList = EnterpriseEnums.GR_ZT.getType().equals(type)? setAndGetPersonRegisterTypeList() : setAndGetUnitTypeList(); List<DataDictionary> unitTypeList = EnterpriseEnums.GR_ZT.getType().equals(type) ? setAndGetPersonRegisterTypeList() : setAndGetUnitTypeList();
Map<String, DataDictionary> dataDictionaryMap = unitTypeList.stream().collect(Collectors.toMap(DataDictionary::getCode, Function.identity(), (k1, k2) -> k1)); Map<String, DataDictionary> dataDictionaryMap = unitTypeList.stream().collect(Collectors.toMap(DataDictionary::getCode, Function.identity(), (k1, k2) -> k1));
for (String typeCode : units) { for (String typeCode : units) {
DataDictionary unitType = dataDictionaryMap.get(typeCode); DataDictionary unitType = dataDictionaryMap.get(typeCode);
String appCode = unitType.getTypeDesc() != null ? unitType.getTypeDesc() : ""; String appCode = unitType.getTypeDesc() != null ? unitType.getTypeDesc() : "";
String[] appCodes = appCode.split(","); String[] appCodes = appCode.split(",");
Collections.addAll(appCodesSet, appCodes); Collections.addAll(appCodesSet, appCodes);
roleNameSet.add(unitType.getName()); roleNameSet.add(unitType.getName());
userRoleList.addAll(allRoleList.stream() userRoleList.addAll(allRoleList.stream()
.filter(r -> unitType.getExtend().contains(r.getSequenceNbr().toString())).collect(Collectors.toList())); .filter(r -> unitType.getExtend().contains(r.getSequenceNbr().toString())).collect(Collectors.toList()));
userRoleList.forEach(r -> { userRoleList.forEach(r -> {
if (!roleIds.contains(r.getSequenceNbr())) { if (!roleIds.contains(r.getSequenceNbr())) {
roleIds.add(r.getSequenceNbr()); roleIds.add(r.getSequenceNbr());
} }
}); });
roleSeqMap.put(dto.getCompanyId(), roleIds); roleSeqMap.put(dto.getCompanyId(), roleIds);
orgRoles.put(dto.getCompanyId(), userRoleList); orgRoles.put(dto.getCompanyId(), userRoleList);
} }
agencyUserModel.setAppCodes(new ArrayList<>(appCodesSet)); agencyUserModel.setAppCodes(new ArrayList<>(appCodesSet));
agencyUserModel.setOrgRoles(orgRoles); agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqMap); agencyUserModel.setOrgRoleSeqs(roleSeqMap);
StopWatch watch3 = new StopWatch(); StopWatch watch3 = new StopWatch();
watch3.start(); watch3.start();
userResult = Privilege.agencyUserClient.create(agencyUserModel); userResult = Privilege.agencyUserClient.create(agencyUserModel);
watch3.stop(); watch3.stop();
if(logger.isDebugEnabled()){ if (logger.isDebugEnabled()) {
logger.debug("创建amos人员耗时:==>{}",watch3.getTotalTimeSeconds()); logger.debug("创建amos人员耗时:==>{}", watch3.getTotalTimeSeconds());
} }
if (userResult == null || userResult.getResult() == null) { if (userResult == null || userResult.getResult() == null) {
throw new BadRequest("单位注册失败"); throw new BadRequest("单位注册失败");
} }
return userResult.getResult(); return userResult.getResult();
} catch (Exception e) { } catch (Exception e) {
// 删除已经创建的 企业信息 // 删除已经创建的 企业信息
if (dto.getCompanyId() != null) { if (dto.getCompanyId() != null) {
Privilege.companyClient.deleteCompany(dto.getCompanyId() + ""); Privilege.companyClient.deleteCompany(dto.getCompanyId() + "");
} }
if (userResult != null && userResult.getResult() != null if (userResult != null && userResult.getResult() != null
&& StringUtils.isNotEmpty(userResult.getResult().getUserId())) { && StringUtils.isNotEmpty(userResult.getResult().getUserId())) {
Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId()); Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId());
} }
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
@Override @Override
public String submit(Long pageId, String taskId, String planInstanceId, String topic, String tableName, Map<String, Object> objectMap) throws Exception { public String submit(Long pageId, String taskId, String planInstanceId, String topic, String tableName, Map<String, Object> objectMap) throws Exception {
String roleId = ""; String roleId = "";
// 根据指标taskId查询 // 根据指标taskId查询
FeignClientResult<Map<String, Object>> taskMessage = idxFeignService.getTaskId(taskId); FeignClientResult<Map<String, Object>> taskMessage = idxFeignService.getTaskId(taskId);
logger.info("idx返回任务信息,{}", JSONObject.toJSONString(taskMessage)); logger.info("idx返回任务信息,{}", JSONObject.toJSONString(taskMessage));
if ("200".equals(String.valueOf(taskMessage.getStatus())) && !ObjectUtils.isEmpty(taskMessage)) { if ("200".equals(String.valueOf(taskMessage.getStatus())) && !ObjectUtils.isEmpty(taskMessage)) {
Object id = taskMessage.getResult().get("processInstanceId"); Object id = taskMessage.getResult().get("processInstanceId");
// 根据processInstanceId查询workFlow服务对应的taskId // 根据processInstanceId查询workFlow服务对应的taskId
JSONObject flowTask = workflowFeignService.getTaskId(String.valueOf(id)); JSONObject flowTask = workflowFeignService.getTaskId(String.valueOf(id));
logger.info("workFlow返回任务id,{}", JSONObject.toJSONString(flowTask)); logger.info("workFlow返回任务id,{}", JSONObject.toJSONString(flowTask));
if (!ObjectUtils.isEmpty(flowTask) && !ObjectUtils.isEmpty(flowTask.get("data"))) { if (!ObjectUtils.isEmpty(flowTask) && !ObjectUtils.isEmpty(flowTask.get("data"))) {
JSONObject data = JSON.parseObject(JSON.toJSONString(flowTask.get("data"))); JSONObject data = JSON.parseObject(JSON.toJSONString(flowTask.get("data")));
Object id1 = data.get("id"); Object id1 = data.get("id");
// 根据taskId查询流程节点绑定角色id // 根据taskId查询流程节点绑定角色id
JSONObject result = workflowFeignService.getRoleId(String.valueOf(id1)); JSONObject result = workflowFeignService.getRoleId(String.valueOf(id1));
logger.info("workFlow返回角色id,{}", JSONObject.toJSONString(result)); logger.info("workFlow返回角色id,{}", JSONObject.toJSONString(result));
if (!ObjectUtils.isEmpty(result) && !ObjectUtils.isEmpty(result.get("result"))) { if (!ObjectUtils.isEmpty(result) && !ObjectUtils.isEmpty(result.get("result"))) {
JSONObject result1 = JSON.parseObject(JSON.toJSONString(result.get("result"))); JSONObject result1 = JSON.parseObject(JSON.toJSONString(result.get("result")));
roleId = String.valueOf(result1.get("roleId")); roleId = String.valueOf(result1.get("roleId"));
} }
} }
} }
// 企业下所有用户(上送工作流企业整改用户参数) // 企业下所有用户(上送工作流企业整改用户参数)
ArrayList<String> flow = new ArrayList<>(); ArrayList<String> flow = new ArrayList<>();
// 企业下所有用户(更新任务) // 企业下所有用户(更新任务)
ArrayList<String> task = new ArrayList<>(); ArrayList<String> task = new ArrayList<>();
// 查询第一个填报信息获取企业 // 查询第一个填报信息获取企业
String companyName = ""; String companyName = "";
// 查询流程第一个节点所选择的执行企业信息 // 查询流程第一个节点所选择的执行企业信息
FeignClientResult<JSONObject> firstTask = idxFeignService.getFirstTask(taskId); FeignClientResult<JSONObject> firstTask = idxFeignService.getFirstTask(taskId);
logger.info("idx返回第一个节点任务信息,{}", JSONObject.toJSONString(firstTask)); logger.info("idx返回第一个节点任务信息,{}", JSONObject.toJSONString(firstTask));
if (!ObjectUtils.isEmpty(firstTask)) { if (!ObjectUtils.isEmpty(firstTask)) {
companyName = String.valueOf(firstTask.getResult().get("CHECKED_COMPANY")); companyName = String.valueOf(firstTask.getResult().get("CHECKED_COMPANY"));
} }
if (!ObjectUtils.isEmpty(objectMap)) { if (!ObjectUtils.isEmpty(objectMap)) {
FeignClientResult<CompanyModel> companyModelFeignClientResult = Privilege.companyClient.queryByCompanyName(companyName); FeignClientResult<CompanyModel> companyModelFeignClientResult = Privilege.companyClient.queryByCompanyName(companyName);
if (!ObjectUtils.isEmpty(companyModelFeignClientResult.getResult()) && !ObjectUtils.isEmpty(companyModelFeignClientResult.getResult().getOrgCode())) { if (!ObjectUtils.isEmpty(companyModelFeignClientResult.getResult()) && !ObjectUtils.isEmpty(companyModelFeignClientResult.getResult().getOrgCode())) {
//FeignClientResult<Set<AgencyUserModel>> setFeignClientResult = Privilege.agencyUserClient.queryByOrgCode(companyModelFeignClientResult.getResult().getOrgCode(), null); //FeignClientResult<Set<AgencyUserModel>> setFeignClientResult = Privilege.agencyUserClient.queryByOrgCode(companyModelFeignClientResult.getResult().getOrgCode(), null);
Long sequenceNbr = companyModelFeignClientResult.getResult().getSequenceNbr(); Long sequenceNbr = companyModelFeignClientResult.getResult().getSequenceNbr();
// 查询企业对应角色下的用户 // 查询企业对应角色下的用户
logger.info("向privilege发送参数roleId,companyId,{},{}", roleId, sequenceNbr); logger.info("向privilege发送参数roleId,companyId,{},{}", roleId, sequenceNbr);
FeignClientResult<List<AgencyUserModel>> listFeignClientResult = Privilege.agencyUserClient.queryByCompanyRoles(sequenceNbr, roleId, null, null); FeignClientResult<List<AgencyUserModel>> listFeignClientResult = Privilege.agencyUserClient.queryByCompanyRoles(sequenceNbr, roleId, null, null);
logger.info("privilege返回用户信息,{}", JSONObject.toJSONString(listFeignClientResult)); logger.info("privilege返回用户信息,{}", JSONObject.toJSONString(listFeignClientResult));
if (!ObjectUtils.isEmpty(listFeignClientResult) && !ObjectUtils.isEmpty(listFeignClientResult.getResult())){ if (!ObjectUtils.isEmpty(listFeignClientResult) && !ObjectUtils.isEmpty(listFeignClientResult.getResult())) {
listFeignClientResult.getResult().forEach(item ->{ listFeignClientResult.getResult().forEach(item -> {
flow.add(item.getUserName()); flow.add(item.getUserName());
task.add(item.getUserId()); task.add(item.getUserId());
}); });
}else { } else {
throw new BadRequest("没有对应企业整改执行人!"); throw new BadRequest("没有对应企业整改执行人!");
} }
// if (!ObjectUtils.isEmpty(setFeignClientResult)) { // if (!ObjectUtils.isEmpty(setFeignClientResult)) {
// setFeignClientResult.getResult().forEach(item -> { // setFeignClientResult.getResult().forEach(item -> {
...@@ -1009,16 +1045,16 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -1009,16 +1045,16 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// task.add(item.getUserId()); // task.add(item.getUserId());
// }); // });
// } // }
} }
} }
String userIds = String.join(",", flow); String userIds = String.join(",", flow);
String userIdsTask = String.join(",", task); String userIdsTask = String.join(",", task);
// 添加被检查企业下的人员id // 添加被检查企业下的人员id
objectMap.put("CHECKED_COMPANY_USERS", userIds); objectMap.put("CHECKED_COMPANY_USERS", userIds);
objectMap.put("CHECKED_COMPANY_USER_ids", userIdsTask); objectMap.put("CHECKED_COMPANY_USER_ids", userIdsTask);
// 表单信息提交 // 表单信息提交
FeignClientResult<String> submit = idxFeignService.submit(pageId, taskId, planInstanceId,"CHECKED_COMPANY_USER_ids", topic, tableName, objectMap); FeignClientResult<String> submit = idxFeignService.submit(pageId, taskId, planInstanceId, "CHECKED_COMPANY_USER_ids", topic, tableName, objectMap);
// if ("200".equals(String.valueOf(submit.getStatus()))) { // if ("200".equals(String.valueOf(submit.getStatus()))) {
// JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
// jsonObject.put("title", "企业整改"); // jsonObject.put("title", "企业整改");
// jsonObject.put("userIds", userIdsTask); // jsonObject.put("userIds", userIdsTask);
...@@ -1028,27 +1064,28 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -1028,27 +1064,28 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// //logger.info("idx执行任务更新任务返回参数,{}", JSONObject.toJSONString(jsonObjectFeignClientResult)); // //logger.info("idx执行任务更新任务返回参数,{}", JSONObject.toJSONString(jsonObjectFeignClientResult));
// //
// } // }
return "ok"; return "ok";
} }
/*** /***
* idx通用提交接口为异步,解决任务还未创建成功时执行更新失败 * idx通用提交接口为异步,解决任务还未创建成功时执行更新失败
* @param taskId * @param taskId
* @param object * @param object
* @throws InterruptedException * @throws InterruptedException
*/ */
void updateAmosTask(String taskId, JSONObject object) throws InterruptedException { void updateAmosTask(String taskId, JSONObject object) throws InterruptedException {
Thread.sleep(1000*2); Thread.sleep(1000 * 2);
FeignClientResult<JSONObject> jsonObjectFeignClientResult = idxFeignService.updateAmosTask(taskId, object); FeignClientResult<JSONObject> jsonObjectFeignClientResult = idxFeignService.updateAmosTask(taskId, object);
logger.info("idx执行任务更新任务返回参数,{}", JSONObject.toJSONString(jsonObjectFeignClientResult)); logger.info("idx执行任务更新任务返回参数,{}", JSONObject.toJSONString(jsonObjectFeignClientResult));
} }
private String dealNull2EmptyString(String t) {
return StringUtils.isEmpty(t) ? "" : t; private String dealNull2EmptyString(String t) {
} return StringUtils.isEmpty(t) ? "" : t;
}
@Override
public List<DataDictionary> getXkItemList(String type) { @Override
List<DataDictionary> dictionaries = this.initAllDataDictionaryList(); public List<DataDictionary> getXkItemList(String type) {
return dictionaries.stream().parallel().filter(d->("XK-"+type).equals(d.getExtend())).collect(Collectors.toList()); List<DataDictionary> dictionaries = this.initAllDataDictionaryList();
} return dictionaries.stream().parallel().filter(d -> ("XK-" + type).equals(d.getExtend())).collect(Collectors.toList());
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment