Commit 998abdd7 authored by suhuiguang's avatar suhuiguang

1.特种气瓶-登记证扫一扫后端接口

parent a1b9c8c0
package com.yeejoin.amos.boot.biz.common.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author system_generator
* @date 2024-07-03
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="JgUseRegistrationManageDto", description="")
public class JgUseRegistrationManageDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "使用单位名称")
private String useUnitName;
@ApiModelProperty(value = "申请编号")
private String applyNo;
@ApiModelProperty(value = "使用登记证状态(已登记,已注销)")
private String certificateStatus;
@ApiModelProperty(value = "接收机构/登记机关")
private String receiveOrgName;
@ApiModelProperty(value = "办理日期")
private String auditPassDate;
@ApiModelProperty(value = "登记类别")
private String regType;
@ApiModelProperty(value = "申请日期")
private String regDate;
@ApiModelProperty(value = "设备种类")
private String equList;
@ApiModelProperty(value = "设备类别")
private String equCategory;
@ApiModelProperty(value = "设备品种")
private String equDefine;
@ApiModelProperty(value = "设备种类编码")
private String equListCode;
@ApiModelProperty(value = "设备类别编码")
private String equCategoryCode;
@ApiModelProperty(value = "设备品种编码")
private String equDefineCode;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建人ID")
private String createUserId;
@ApiModelProperty(value = "创建时间")
private String createDate;
@ApiModelProperty(value = "使用登记证编号")
private String useRegistrationCode;
@ApiModelProperty(value = "使用单位统一信用代码")
private String useUnitCreditCode;
@ApiModelProperty(value = "原使用单位统一信用代码")
private String originalUseUnitCreditCode;
@ApiModelProperty(value = "接收机构公司代码")
private String receiveCompanyCode;
@ApiModelProperty(value = "登记证书编号/登记证书唯一码")
private String certificateNo;
@ApiModelProperty(value = "数据类型:监管/行政审批局,企业")
private String dataType;
@ApiModelProperty(value = "车牌号-车用气瓶登记")
private String carNumber;
@ApiModelProperty(value = "设备使用地址")
private String equUseAddress;
@ApiModelProperty(value = "使用单位地址")
private String useUnitAddress;
@ApiModelProperty("使用登记办理类型,unit单位, set台套")
private String manageType;
@ApiModelProperty(value = "使用单位统一信用代码-搜索使用")
private String useUnitCreditCodeForSearch;
@ApiModelProperty(value = "是否车用气瓶--过滤数据使用")
private String whetherVehicleCylinder;
@ApiModelProperty(value = "是否气瓶--过滤数据使用 ---目前使用场景:注销报废业务 值为true 只过滤出气瓶的使用登记证)")
private String isCyl;
@ApiModelProperty(value = "是否报废状态:1报废 0 未报废 ---目前使用场景:非单位业务办理报废业务,筛选出非报废状态的证--过滤数据使用)")
private String isScrap;
@ApiModelProperty(value = "业务类型code,报废业务使用")
private String applyType;
@ApiModelProperty(value = "城市名称")
private String cityName;
}
package com.yeejoin.amos.boot.module.app.api.annotation;
import java.util.HashMap;
import java.util.Map;
public class ChargeMediaConverter implements Converter<String> {
private static final Map<String, String> dictionary = new HashMap<>();
static {
dictionary.put("LIQUEFIED_NATURAL_GAS", "液化天然气");
dictionary.put("LIQUEFIED_PETROLEUM_GAS", "液化石油气");
dictionary.put("COMPRESSED_NATURAL_GAS", "压缩天然气");
dictionary.put("HYDROGEN", "氢气");
dictionary.put("HELIUM", "氦气");
dictionary.put("AIR", "空气");
dictionary.put("OXYGEN", "氧气");
dictionary.put("PROPANE", "丙烷");
dictionary.put("BUTANCE", "丁烷");
dictionary.put("LIQUEFIED_CARBON_DIOXIDE", "液化二氧化碳");
dictionary.put("LIQUID_OXYGEN", "液氧");
dictionary.put("NITROGEN", "氮气");
dictionary.put("ARGON", "氩气");
dictionary.put("LIQUID_ARGON", "液氩");
dictionary.put("LIQUID_NITROGEN", "液氮");
dictionary.put("DISSOLVE_ACETYLENE", "溶解乙炔");
dictionary.put("1,1,1,2-TETRAFLUOROETHANE_(R134A)", "1,1,1,2-四氟乙烷(R134a)");
}
@Override
public String convertToLabelData(String key) {
return dictionary.getOrDefault(key, key);
}
}
package com.yeejoin.amos.boot.module.app.api.annotation;
public interface Converter<V> {
V convertToLabelData(String key);
}
package com.yeejoin.amos.boot.module.app.api.annotation;
public class DefaultConverter implements Converter<String> {
@Override
public String convertToLabelData(String key) {
return key;
}
}
package com.yeejoin.amos.boot.module.app.api.annotation;
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Documented
public @interface FieldDisplayDefine {
String value();
boolean isExist() default true;
Class<? extends Converter> converter() default DefaultConverter.class;
}
package com.yeejoin.amos.boot.module.app.api.annotation;
import java.util.HashMap;
import java.util.Map;
public class InspectResultConverter implements Converter<String> {
private static final Map<String, String> dictionary = new HashMap<>();
static {
dictionary.put("6040", "合格");
dictionary.put("6041", "不合格");
dictionary.put("6042", "复检合格");
dictionary.put("6043", "复检不合格");
dictionary.put("6044", "其他");
dictionary.put("6045", "整改后合格");
dictionary.put("6046", "符合");
dictionary.put("6047", "不符合");
dictionary.put("6048", "符合要求");
dictionary.put("6049", "基本符合要求");
dictionary.put("6050", "不符合要求");
dictionary.put("6051", "允许使用");
}
@Override
public String convertToLabelData(String key) {
return dictionary.getOrDefault(key, key);
}
}
package com.yeejoin.amos.boot.module.app.api.dto;
import com.yeejoin.amos.boot.module.app.api.annotation.ChargeMediaConverter;
import com.yeejoin.amos.boot.module.app.api.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.module.app.api.annotation.InspectResultConverter;
import lombok.Data;
@Data
public class CylinderInfoForWX {
private String record;
@FieldDisplayDefine(value = "设备品种")
private String equDefine;
@FieldDisplayDefine(value = "产品编号")
private String factoryNum;
@FieldDisplayDefine(value = "设备代码")
private String equCode;
@FieldDisplayDefine(value = "制造单位")
private String produceUnitName;
@FieldDisplayDefine(value = "制造年月")
private String produceDate;
@FieldDisplayDefine(value = "充装介质", converter = ChargeMediaConverter.class)
private String chargingMedium;
@FieldDisplayDefine(value = "公称工作压力(MPa)")
private String nominalWorkingPressure;
@FieldDisplayDefine(value = "容积(L)")
private String singleBottleVolume;
@FieldDisplayDefine(value = "最近一次检验日期")
private String lastInspectDate;
@FieldDisplayDefine(value = "下次检验日期")
private String nextInspectDate;
@FieldDisplayDefine(value = "检验结果" ,converter = InspectResultConverter.class)
private String inspectConclusion;
}
package com.yeejoin.amos.boot.module.app.api.dto;
import com.yeejoin.amos.boot.module.app.api.annotation.FieldDisplayDefine;
import lombok.Data;
@Data
public class VehicleInfoForWX {
@FieldDisplayDefine(value = "车牌号")
private String carNumber;
@FieldDisplayDefine(value = "使用登记证编号")
private String useRegistrationCode;
@FieldDisplayDefine(value = "设备类别")
private String equCategory;
@FieldDisplayDefine(value = "所属区域")
private String useUnitAddress;
@FieldDisplayDefine(value = "气瓶数量")
private String gasNum;
@FieldDisplayDefine(value = "使用单位名称", isExist = false)
private String useUnitName;
@FieldDisplayDefine(value = "设备种类",isExist = false)
private String equList;
@FieldDisplayDefine(value = "设备品种",isExist = false)
private String equDefine;
}
package com.yeejoin.amos.boot.module.app.api.mapper;
import com.yeejoin.amos.boot.biz.common.dto.JgUseRegistrationManageDto;
import com.yeejoin.amos.boot.module.app.api.dto.CylinderInfoForWX;
import com.yeejoin.amos.boot.module.app.api.dto.VehicleInfoForWX;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-12-13
*/
@Mapper
public interface AppCommonMapper {
/**
* 查询指定单号下的车用气瓶信息
*
* @param applyNo 单号
* @return 车用气瓶信息
*/
List<CylinderInfoForWX> queryCylinderIfoOfVehicle(String applyNo);
/**
* 查询车辆基本信息
*
* @param applyNo 申请单号
* @return 车辆基本信息
*/
VehicleInfoForWX queryVehicleBaseInfo(String applyNo);
JgUseRegistrationManageDto selectOneCert(String applyNo);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.app.api.mapper.AppCommonMapper">
<select id="queryCylinderIfoOfVehicle" resultType="com.yeejoin.amos.boot.module.app.api.dto.CylinderInfoForWX">
select
*
from
(select
f.record,
f.FACTORY_NUM,
f.PRODUCE_UNIT_NAME,
date_format(f.PRODUCE_DATE, 'YYYY-MM-DD') as PRODUCE_DATE,
p.CHARGING_MEDIUM,
p.NOMINAL_WORKING_PRESSURE,
p.SINGLE_BOTTLE_VOLUME,
r.equ_code
from
idx_biz_jg_factory_info f,
idx_biz_jg_tech_params_vessel p,
idx_biz_jg_register_info r
where
f.record=p.record and r.record = f.record and f.record in (
select
equ_id as record
from
(select
b.equ_id,
a.apply_no
from
tzs_jg_vehicle_information a,
tzs_jg_vehicle_information_eq b
where
b.vehicle_id = a.sequence_nbr
union ALL
select
b.equ_id,
a.apply_no
from
tzs_jg_change_vehicle_registration_unit a,
tzs_jg_change_vehicle_registration_unit_eq b
where
b.unit_change_id = a.sequence_nbr) as s1
WHERE
s1.apply_no = #{applyNo})) a
left join
(select
record,
date_format(INSPECT_DATE, 'YYYY-MM-DD') as lastInspectDate,
date_format(NEXT_INSPECT_DATE, 'YYYY-MM-DD') nextInspectDate,
INSPECT_CONCLUSION as inspectConclusion
from
idx_biz_jg_inspection_detection_info
where record in (select record from (select max(INSPECT_DATE), record FROM "idx_biz_jg_inspection_detection_info" where record in (
select
equ_id as record
from
(select
b.equ_id,
a.apply_no
from
tzs_jg_vehicle_information a,
tzs_jg_vehicle_information_eq b
where
b.vehicle_id = a.sequence_nbr
union ALL
select
b.equ_id,
a.apply_no
from
tzs_jg_change_vehicle_registration_unit a,
tzs_jg_change_vehicle_registration_unit_eq b
where
b.unit_change_id = a.sequence_nbr) as s1
WHERE
s1.apply_no = #{applyNo}) GROUP BY record))) b
on a.record = b.record
</select>
<select id="queryVehicleBaseInfo" resultType="com.yeejoin.amos.boot.module.app.api.dto.VehicleInfoForWX">
SELECT
use_registration_code,
car_number,
equ_list,
equ_define,
equ_category,
gas_num,
use_unit_address,
use_unit_name
FROM
"tzs_jg_use_registration_manage"
where
apply_no=#{applyNo} limit 1
</select>
<select id="selectOneCert" resultType="com.yeejoin.amos.boot.biz.common.dto.JgUseRegistrationManageDto">
SELECT
*
FROM
"tzs_jg_use_registration_manage"
WHERE
apply_no = #{applyNo}
and is_delete = false
ORDER BY rec_date desc limit 1
</select>
</mapper>
...@@ -125,6 +125,20 @@ public class TzsAppController { ...@@ -125,6 +125,20 @@ public class TzsAppController {
/** /**
* 小程序获取证详情-微信扫一扫
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/certInfoWX")
@ApiOperation(httpMethod = "GET", value = "小程序获取登记证或者使用标志详情", notes = "小程序获取登记证或者使用标志详情")
public ResponseModel<Map> getCertInfoForWX(@RequestParam String applyNo,
@RequestParam String from) {
return ResponseHelper.buildResponse(appService.getCertInfoForWX(applyNo,from));
}
/**
* 根据监管码查询设备详情 * 根据监管码查询设备详情
* *
* @return * @return
......
package com.yeejoin.amos.boot.module.app.biz.service.impl;
import com.yeejoin.amos.boot.module.app.biz.strategy.ISearchDetailHandler;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.Map;
@Component
public class SetSearchDetailDetailHandlerImpl implements ISearchDetailHandler<Map<String, Object>> {
@Override
public String manageType() {
return "set";
}
@Override
public Map<String, Object> hanlder(String applyNo, String from) {
return Collections.emptyMap();
}
}
...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; ...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper; import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.dto.JgUseRegistrationManageDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil; import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
...@@ -19,9 +20,10 @@ import com.yeejoin.amos.boot.module.app.api.dto.*; ...@@ -19,9 +20,10 @@ import com.yeejoin.amos.boot.module.app.api.dto.*;
import com.yeejoin.amos.boot.module.app.api.entity.*; import com.yeejoin.amos.boot.module.app.api.entity.*;
import com.yeejoin.amos.boot.module.app.api.enums.EquipmentCategoryEnum; import com.yeejoin.amos.boot.module.app.api.enums.EquipmentCategoryEnum;
import com.yeejoin.amos.boot.module.app.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.app.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.app.api.mapper.AppCommonMapper;
import com.yeejoin.amos.boot.module.app.api.mapper.CategoryOtherInfoMapper; import com.yeejoin.amos.boot.module.app.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.app.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.app.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.app.api.mapper.ViewJgClaimMapper; import com.yeejoin.amos.boot.module.app.biz.strategy.SearchDetailStrategyContext;
import com.yeejoin.amos.boot.module.app.biz.utils.HttpUtils; import com.yeejoin.amos.boot.module.app.biz.utils.HttpUtils;
import com.yeejoin.amos.boot.module.app.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.app.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.app.biz.utils.RedisUtil; import com.yeejoin.amos.boot.module.app.biz.utils.RedisUtil;
...@@ -78,819 +80,833 @@ import java.util.stream.Collectors; ...@@ -78,819 +80,833 @@ import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
public class TzsAppService { public class TzsAppService {
/** /**
* 产品appkey * 产品appkey
*/ */
@Value("${amos.biz.appCode:AMOS_STUDIO}") @Value("${amos.biz.appCode:AMOS_STUDIO}")
private String appKey; private String appKey;
/** /**
* 产品product * 产品product
*/ */
private static final String product = "AMOS_STUDIO_WEB"; private static final String product = "AMOS_STUDIO_WEB";
private static final String regionRedis = "app_region_redis"; private static final String regionRedis = "app_region_redis";
private final int successsCode = 200; private final int successsCode = 200;
@Autowired @Autowired
DesignInfoService designInfoService; DesignInfoService designInfoService;
@Autowired @Autowired
DataDictionaryMapper dataDictionaryMapper; DataDictionaryMapper dataDictionaryMapper;
@Autowired @Autowired
IdxFeignService idxFeignService; IdxFeignService idxFeignService;
@Autowired @Autowired
EquipmentCategoryMapper equipmentCategoryMapper; EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired @Autowired
EquipmentCategoryServiceImpl equipmentCategoryServiceImpl; EquipmentCategoryServiceImpl equipmentCategoryServiceImpl;
@Autowired @Autowired
ProduceInfoService produceInfoService; ProduceInfoService produceInfoService;
@Autowired @Autowired
ConstructionInfoService constructionInfoService; ConstructionInfoService constructionInfoService;
@Autowired @Autowired
RegistrationInfoService registrationInfoService; RegistrationInfoService registrationInfoService;
@Autowired @Autowired
EquipTechParamBoilerService boilerService; EquipTechParamBoilerService boilerService;
@Autowired @Autowired
EquipTechParamElevatorService elevatorService; EquipTechParamElevatorService elevatorService;
@Autowired @Autowired
EquipTechParamLiftingService liftingService; EquipTechParamPipelineService pipelineService;
@Autowired @Autowired
EquipTechParamPipelineService pipelineService; EquipTechParamRidesService ridesService;
@Autowired @Autowired
EquipTechParamRidesService ridesService; EquipTechParamRopewayService ropewayService;
@Autowired @Autowired
EquipTechParamRopewayService ropewayService; EquipTechParamVehicleService vehicleService;
@Autowired @Autowired
EquipTechParamVehicleService vehicleService; EquipTechParamVesselService vesselService;
@Autowired @Autowired
EquipTechParamVesselService vesselService; MainPartsServiceImpl mainPartsService;
@Autowired @Autowired
MainPartsServiceImpl mainPartsService; ProtectionDevicesServiceImpl protectionDevicesService;
@Autowired @Autowired
ProtectionDevicesServiceImpl protectionDevicesService; UseInfoService unseInfoService;
@Autowired @Autowired
UseInfoService unseInfoService; MaintenanceInfoService maintenanceInfoService;
@Autowired @Autowired
MaintenanceInfoService maintenanceInfoService; InspectionDetectionInfoServiceImpl inspectionDetectionInfoService;
@Autowired @Autowired
InspectionDetectionInfoServiceImpl inspectionDetectionInfoService; OtherInfoService otherInfoService;
@Autowired @Autowired
OtherInfoService otherInfoService; CategoryOtherInfoMapper categoryOtherInfoMapper;
@Autowired @Autowired
CategoryOtherInfoMapper categoryOtherInfoMapper; RedisUtils redisUtils;
@Autowired @Value("${tzs.WxApp.appId}")
RedisUtils redisUtils; String WxAppAppId;
@Value("${tzs.WxApp.appId}") @Value("${tzs.WxApp.secret}")
String WxAppAppId; String WxAppSecret;
@Value("${tzs.WxApp.secret}") @Value("${tzs.WxApp.grant-type}")
String WxAppSecret; String WxAppGrantType;
@Value("${tzs.WxApp.grant-type}")
String WxAppGrantType; @Value("classpath:/json/equipCategory.json")
@Value("${minio.url.path}") private Resource equipCategory;
String minioPath;
@Autowired @Autowired
ViewJgClaimMapper viewJgClaimMapper; RestHighLevelClient restHighLevelClient;
@Value("classpath:/json/equipCategory.json")
private Resource equipCategory; @Autowired
private RedisUtil redisUtil;
@Autowired
RestHighLevelClient restHighLevelClient; @Autowired
private AppCommonMapper commonMapper;
@Autowired
private RedisUtil redisUtil; private static final String REG_TYPE_VEHICLE = "车用气瓶登记";
private static final String STREET = "STREET"; private static final String STREET = "STREET";
public Map<String, Object> getEquipmentInfo(String record) { public Map<String, Object> getEquipmentInfo(String record) {
List<DataDictionary> dictionaryList = getDictionary(); List<DataDictionary> dictionaryList = getDictionary();
List<EquipmentCategory> equipmentCategories = equipmentCategoryMapper.selectList(null); List<EquipmentCategory> equipmentCategories = equipmentCategoryMapper.selectList(null);
Map<String, Object> map = new HashMap(); Map<String, Object> map = new HashMap();
map.put("SEQUENCE_NBR", record); map.put("SEQUENCE_NBR", record);
map.put("tableName", "idx_biz_view_jg_claim"); map.put("tableName", "idx_biz_view_jg_claim");
ResponseModel<Page<Map<String, Object>>> model = idxFeignService.getPage(map); ResponseModel<Page<Map<String, Object>>> model = idxFeignService.getPage(map);
List<Map<String, Object>> detailMapList = model.getResult().getRecords(); List<Map<String, Object>> detailMapList = model.getResult().getRecords();
if (!ValidationUtil.isEmpty(detailMapList)) { if (!ValidationUtil.isEmpty(detailMapList)) {
map = detailMapList.iterator().next(); map = detailMapList.iterator().next();
} }
map.putAll(getQRCode(record)); map.putAll(getQRCode(record));
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
// 出厂 // 出厂
JSONObject exFactoryJsonObject = new JSONObject(); JSONObject exFactoryJsonObject = new JSONObject();
List exFactoryList = new ArrayList(); List exFactoryList = new ArrayList();
getGroupList(null, record, DesignInfo.class, DesignInfoModel.class, designInfoService, exFactoryList, false, dictionaryList, equipmentCategories); getGroupList(null, record, DesignInfo.class, DesignInfoModel.class, designInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
getGroupList(null, record, ProduceInfo.class, ProduceInfoModel.class, produceInfoService, exFactoryList, false, dictionaryList, equipmentCategories); getGroupList(null, record, ProduceInfo.class, ProduceInfoModel.class, produceInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
exFactoryJsonObject.put("title", "出厂"); exFactoryJsonObject.put("title", "出厂");
exFactoryJsonObject.put("tabValue", exFactoryList); exFactoryJsonObject.put("tabValue", exFactoryList);
jsonArray.add(exFactoryJsonObject); jsonArray.add(exFactoryJsonObject);
// 施工 // 施工
JSONObject constructionJsonObject = new JSONObject(); JSONObject constructionJsonObject = new JSONObject();
List constructionList = new ArrayList(); List constructionList = new ArrayList();
getGroupList(null, record, ConstructionInfo.class, ConstructionInfoModel.class, constructionInfoService, constructionList, true, dictionaryList, equipmentCategories); getGroupList(null, record, ConstructionInfo.class, ConstructionInfoModel.class, constructionInfoService, constructionList, true, dictionaryList, equipmentCategories);
constructionJsonObject.put("title", "施工"); constructionJsonObject.put("title", "施工");
constructionJsonObject.put("tabValue", constructionList); constructionJsonObject.put("tabValue", constructionList);
jsonArray.add(constructionJsonObject); jsonArray.add(constructionJsonObject);
// 注册 // 注册
JSONObject registrationJsonObject = new JSONObject(); JSONObject registrationJsonObject = new JSONObject();
String equipType = String.valueOf(map.get("EQU_LIST_CODE")); String equipType = String.valueOf(map.get("EQU_LIST_CODE"));
List registrationList = new ArrayList(); List registrationList = new ArrayList();
switch (equipType) { switch (equipType) {
case "4000": case "4000":
getGroupList(null, record, EquipTechParamLifting.class, EquipTechParamLiftingModel.class, elevatorService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, EquipTechParamLifting.class, EquipTechParamLiftingModel.class, elevatorService, registrationList, false, dictionaryList, equipmentCategories);
break; break;
case "3000": case "3000":
getGroupList(null, record, EquipTechParamElevator.class, EquipTechParamElevatorModel.class, elevatorService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, EquipTechParamElevator.class, EquipTechParamElevatorModel.class, elevatorService, registrationList, false, dictionaryList, equipmentCategories);
break; break;
case "5000": case "5000":
getGroupList(null, record, EquipTechParamVehicle.class, EquipTechParamVehicleModel.class, vehicleService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, EquipTechParamVehicle.class, EquipTechParamVehicleModel.class, vehicleService, registrationList, false, dictionaryList, equipmentCategories);
break; break;
case "1000": case "1000":
getGroupList(null, record, EquipTechParamBoiler.class, EquipTechParamBoilerModel.class, boilerService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, EquipTechParamBoiler.class, EquipTechParamBoilerModel.class, boilerService, registrationList, false, dictionaryList, equipmentCategories);
break; break;
case "2000": case "2000":
getGroupList(null, record, EquipTechParamVessel.class, EquipTechParamVesselModel.class, vesselService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, EquipTechParamVessel.class, EquipTechParamVesselModel.class, vesselService, registrationList, false, dictionaryList, equipmentCategories);
break; break;
case "8000": case "8000":
getGroupList(null, record, EquipTechParamPipeline.class, EquipTechParamPipelineModel.class, pipelineService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, EquipTechParamPipeline.class, EquipTechParamPipelineModel.class, pipelineService, registrationList, false, dictionaryList, equipmentCategories);
break; break;
case "6000": case "6000":
getGroupList(null, record, EquipTechParamRides.class, EquipTechParamRidesModel.class, ridesService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, EquipTechParamRides.class, EquipTechParamRidesModel.class, ridesService, registrationList, false, dictionaryList, equipmentCategories);
break; break;
case "9000": case "9000":
getGroupList(null, record, EquipTechParamRopeway.class, EquipTechParamRopewayModel.class, ropewayService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, EquipTechParamRopeway.class, EquipTechParamRopewayModel.class, ropewayService, registrationList, false, dictionaryList, equipmentCategories);
break; break;
} }
getGroupList(null, record, RegistrationInfo.class, RegistrationInfoModel.class, registrationInfoService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, RegistrationInfo.class, RegistrationInfoModel.class, registrationInfoService, registrationList, false, dictionaryList, equipmentCategories);
getGroupList(null, record, MainParts.class, MainPartsModel.class, mainPartsService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, MainParts.class, MainPartsModel.class, mainPartsService, registrationList, false, dictionaryList, equipmentCategories);
getGroupList(null, record, ProtectionDevices.class, ProtectionDevicesModel.class, protectionDevicesService, registrationList, false, dictionaryList, equipmentCategories); getGroupList(null, record, ProtectionDevices.class, ProtectionDevicesModel.class, protectionDevicesService, registrationList, false, dictionaryList, equipmentCategories);
registrationJsonObject.put("title", "注册"); registrationJsonObject.put("title", "注册");
registrationJsonObject.put("tabValue", registrationList); registrationJsonObject.put("tabValue", registrationList);
jsonArray.add(registrationJsonObject); jsonArray.add(registrationJsonObject);
// 使用 // 使用
JSONObject useJsonObject = new JSONObject(); JSONObject useJsonObject = new JSONObject();
List useList = new ArrayList(); List useList = new ArrayList();
getGroupList(null, record, UseInfo.class, UseInfoModel.class, unseInfoService, useList, false, dictionaryList, equipmentCategories); getGroupList(null, record, UseInfo.class, UseInfoModel.class, unseInfoService, useList, false, dictionaryList, equipmentCategories);
useJsonObject.put("title", "使用"); useJsonObject.put("title", "使用");
useJsonObject.put("tabValue", useList); useJsonObject.put("tabValue", useList);
jsonArray.add(useJsonObject); jsonArray.add(useJsonObject);
// 维保 // 维保
JSONObject maintenanceJsonObject = new JSONObject(); JSONObject maintenanceJsonObject = new JSONObject();
List maintenanceList = new ArrayList(); List maintenanceList = new ArrayList();
getGroupList(null, record, MaintenanceInfo.class, MaintenanceInfoModel.class, maintenanceInfoService, maintenanceList, true, dictionaryList, equipmentCategories); getGroupList(null, record, MaintenanceInfo.class, MaintenanceInfoModel.class, maintenanceInfoService, maintenanceList, true, dictionaryList, equipmentCategories);
maintenanceJsonObject.put("title", "维保"); maintenanceJsonObject.put("title", "维保");
maintenanceJsonObject.put("tabValue", maintenanceList); maintenanceJsonObject.put("tabValue", maintenanceList);
jsonArray.add(maintenanceJsonObject); jsonArray.add(maintenanceJsonObject);
// 检验 // 检验
JSONObject inspectionJsonObject = new JSONObject(); JSONObject inspectionJsonObject = new JSONObject();
List inspectionList = new ArrayList(); List inspectionList = new ArrayList();
getGroupList(null, record, InspectionDetectionInfo.class, InspectionDetectionInfoModel.class, inspectionDetectionInfoService, inspectionList, true, dictionaryList, equipmentCategories); getGroupList(null, record, InspectionDetectionInfo.class, InspectionDetectionInfoModel.class, inspectionDetectionInfoService, inspectionList, true, dictionaryList, equipmentCategories);
inspectionJsonObject.put("title", "检验"); inspectionJsonObject.put("title", "检验");
inspectionJsonObject.put("tabValue", inspectionList); inspectionJsonObject.put("tabValue", inspectionList);
jsonArray.add(inspectionJsonObject); jsonArray.add(inspectionJsonObject);
// 其他 // 其他
JSONObject otherJsonObject = new JSONObject(); JSONObject otherJsonObject = new JSONObject();
List otherList = new ArrayList(); List otherList = new ArrayList();
getGroupList(null, record, OtherInfo.class, OtherInfoModel.class, otherInfoService, otherList, false, dictionaryList, equipmentCategories); getGroupList(null, record, OtherInfo.class, OtherInfoModel.class, otherInfoService, otherList, false, dictionaryList, equipmentCategories);
otherJsonObject.put("title", "其他"); otherJsonObject.put("title", "其他");
otherJsonObject.put("tabValue", otherList); otherJsonObject.put("tabValue", otherList);
jsonArray.add(otherJsonObject); jsonArray.add(otherJsonObject);
map.put("tab", jsonArray); map.put("tab", jsonArray);
return map; return map;
} }
public Map<String, Object> getEquipmentInfoWX(String record) { public Map<String, Object> getCertInfoForWX(String applyNo, String from) {
List<DataDictionary> dictionaryList = getDictionary(); // 单位办理方式[unit](气瓶、压力管道)、台套办理方式[set](7大类,不包含压力管道)、车用气瓶(压力容器->气瓶)
List<EquipmentCategory> equipmentCategories = equipmentCategoryMapper.selectList(null); JgUseRegistrationManageDto jgUseRegistrationManage = commonMapper.selectOneCert(applyNo);
Map<String, Object> map = new HashMap(); // 使用登记、车用气瓶登记
map.put("SEQUENCE_NBR", record); String regType = jgUseRegistrationManage.getRegType();
map.put("tableName", "idx_biz_view_jg_claim"); // unit、set、null
ResponseModel<Page<Map<String, Object>>> model = idxFeignService.getPage(map); String manageType = jgUseRegistrationManage.getManageType() == null ? "set" : jgUseRegistrationManage.getManageType();
List<Map<String, Object>> detailMapList = model.getResult().getRecords(); if (REG_TYPE_VEHICLE.equals(regType)) {
if (!ValidationUtil.isEmpty(detailMapList)) { return SearchDetailStrategyContext.getHandler("vehicle").hanlder(applyNo, from);
map = detailMapList.iterator().next(); }
} return SearchDetailStrategyContext.getHandler(manageType).hanlder(applyNo, from);
if(!ObjectUtils.isEmpty(model.getResult().getRecords().get(0).get("SUPERVISORY_CODE"))){ }
map.putAll(getQRCode(model.getResult().getRecords().get(0).get("SUPERVISORY_CODE").toString()));
}
public Map<String, Object> getEquipmentInfoWX(String record) {
JSONArray jsonArray = new JSONArray(); List<DataDictionary> dictionaryList = getDictionary();
JSONObject exFactoryJsonObject = new JSONObject(); List<EquipmentCategory> equipmentCategories = equipmentCategoryMapper.selectList(null);
List exFactoryList = new ArrayList(); Map<String, Object> map = new HashMap();
HashMap putMap = new HashMap(); map.put("SEQUENCE_NBR", record);
Field[] fields = EquBaseInfoForWXModel.class.getDeclaredFields(); map.put("tableName", "idx_biz_view_jg_claim");
for (Field f : fields) { ResponseModel<Page<Map<String, Object>>> model = idxFeignService.getPage(map);
putMap.put(f.getName(), ""); List<Map<String, Object>> detailMapList = model.getResult().getRecords();
} if (!ValidationUtil.isEmpty(detailMapList)) {
if (EquipmentClassifityEnum.DT.getCode().equals(map.get("EQU_LIST_CODE"))) { map = detailMapList.iterator().next();
// 基本信息 }
Field[] fields1 = ElevatorBaseInfoForWXModel.class.getDeclaredFields(); if (!ObjectUtils.isEmpty(model.getResult().getRecords().get(0).get("SUPERVISORY_CODE"))) {
for (Field f : fields1) { map.putAll(getQRCode(model.getResult().getRecords().get(0).get("SUPERVISORY_CODE").toString()));
putMap.put(f.getName(), ""); }
}
JSONArray jsonArray = new JSONArray();
getGroupList(putMap, record, RegistrationInfo.class, ElevatorBaseInfoForWXModel.class, registrationInfoService, exFactoryList, false, dictionaryList, equipmentCategories); JSONObject exFactoryJsonObject = new JSONObject();
getGroupList(putMap, record, DesignInfo.class, ElevatorBaseInfoForWXModel.class, designInfoService, exFactoryList, false, dictionaryList, equipmentCategories); List exFactoryList = new ArrayList();
getGroupList(putMap, record, OtherInfo.class, ElevatorBaseInfoForWXModel.class, otherInfoService, exFactoryList, false, dictionaryList, equipmentCategories); HashMap putMap = new HashMap();
getGroupList(putMap, record, UseInfo.class, ElevatorBaseInfoForWXModel.class, unseInfoService, exFactoryList, false, dictionaryList, equipmentCategories); Field[] fields = EquBaseInfoForWXModel.class.getDeclaredFields();
getGroupList(putMap, record, ProduceInfo.class, ElevatorBaseInfoForWXModel.class, produceInfoService, exFactoryList, false, dictionaryList, equipmentCategories); for (Field f : fields) {
putMap.put(f.getName(), "");
if (exFactoryList.size() > 0) { }
String area = map.get("USE_PLACE").toString(); if (EquipmentClassifityEnum.DT.getCode().equals(map.get("EQU_LIST_CODE"))) {
JSONObject jsonObject = (JSONObject) exFactoryList.get(0); // 基本信息
List<HashMap<String, Object>> groupValue = (List<HashMap<String, Object>>) jsonObject.get("groupValue"); Field[] fields1 = ElevatorBaseInfoForWXModel.class.getDeclaredFields();
groupValue.forEach(e -> { for (Field f : fields1) {
e.put("fieldValue", putMap.get(e.get("fieldKey"))); putMap.put(f.getName(), "");
if (e.get("fieldKey").equals("area")) { }
e.put("fieldValue", area);
} getGroupList(putMap, record, RegistrationInfo.class, ElevatorBaseInfoForWXModel.class, registrationInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
}); getGroupList(putMap, record, DesignInfo.class, ElevatorBaseInfoForWXModel.class, designInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
Object ob = exFactoryList.get(0); getGroupList(putMap, record, OtherInfo.class, ElevatorBaseInfoForWXModel.class, otherInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
exFactoryList.clear(); getGroupList(putMap, record, UseInfo.class, ElevatorBaseInfoForWXModel.class, unseInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
exFactoryList.add(ob); getGroupList(putMap, record, ProduceInfo.class, ElevatorBaseInfoForWXModel.class, produceInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
}
if (exFactoryList.size() > 0) {
exFactoryJsonObject.put("title", "基本信息"); String area = map.get("USE_PLACE").toString();
exFactoryJsonObject.put("tabValue", exFactoryList); JSONObject jsonObject = (JSONObject) exFactoryList.get(0);
jsonArray.add(exFactoryJsonObject); List<HashMap<String, Object>> groupValue = (List<HashMap<String, Object>>) jsonObject.get("groupValue");
groupValue.forEach(e -> {
// 最近检验信息 e.put("fieldValue", putMap.get(e.get("fieldKey")));
JSONObject constructionJsonObject = new JSONObject(); if (e.get("fieldKey").equals("area")) {
List constructionList = new ArrayList(); e.put("fieldValue", area);
getGroupList(null, record, InspectionDetectionInfo.class, InspectionDetectionInfoModelForWX.class, inspectionDetectionInfoService, constructionList, true, dictionaryList, equipmentCategories); }
constructionJsonObject.put("title", "最近检验信息"); });
constructionJsonObject.put("tabValue", constructionList); Object ob = exFactoryList.get(0);
jsonArray.add(constructionJsonObject); exFactoryList.clear();
exFactoryList.add(ob);
// 设备维保信息 }
JSONObject useJsonObject = new JSONObject();
List maintenanceList = new ArrayList(); exFactoryJsonObject.put("title", "基本信息");
getGroupList(null, record, MaintenanceInfo.class, MaintenanceInfoModelForWX.class, maintenanceInfoService, maintenanceList, false, dictionaryList, equipmentCategories); exFactoryJsonObject.put("tabValue", exFactoryList);
useJsonObject.put("title", "设备维保信息"); jsonArray.add(exFactoryJsonObject);
if (maintenanceList.size() > 1) {
List maintenanceList1 = new ArrayList(); // 最近检验信息
maintenanceList1.add(maintenanceList.get(0)); JSONObject constructionJsonObject = new JSONObject();
maintenanceList.clear(); List constructionList = new ArrayList();
maintenanceList.add(maintenanceList1.get(0)); getGroupList(null, record, InspectionDetectionInfo.class, InspectionDetectionInfoModelForWX.class, inspectionDetectionInfoService, constructionList, true, dictionaryList, equipmentCategories);
} constructionJsonObject.put("title", "最近检验信息");
useJsonObject.put("tabValue", maintenanceList); constructionJsonObject.put("tabValue", constructionList);
jsonArray.add(useJsonObject); jsonArray.add(constructionJsonObject);
map.put("tab", jsonArray);
} else if ("气瓶".equals(map.get("EQU_CATEGORY"))) { // 设备维保信息
// 基本信息 JSONObject useJsonObject = new JSONObject();
Field[] fields2 = CylinderEquBaseInfoForWXModel.class.getDeclaredFields(); List maintenanceList = new ArrayList();
for (Field f : fields2) { getGroupList(null, record, MaintenanceInfo.class, MaintenanceInfoModelForWX.class, maintenanceInfoService, maintenanceList, false, dictionaryList, equipmentCategories);
putMap.put(f.getName(), ""); useJsonObject.put("title", "设备维保信息");
} if (maintenanceList.size() > 1) {
List maintenanceList1 = new ArrayList();
getGroupList(putMap, record, RegistrationInfo.class, OtherEquBaseInfoForWXModel.class, registrationInfoService, exFactoryList, false, dictionaryList, equipmentCategories); maintenanceList1.add(maintenanceList.get(0));
getGroupList(putMap, record, DesignInfo.class, OtherEquBaseInfoForWXModel.class, designInfoService, exFactoryList, false, dictionaryList, equipmentCategories); maintenanceList.clear();
getGroupList(putMap, record, OtherInfo.class, OtherEquBaseInfoForWXModel.class, otherInfoService, exFactoryList, false, dictionaryList, equipmentCategories); maintenanceList.add(maintenanceList1.get(0));
getGroupList(putMap, record, UseInfo.class, OtherEquBaseInfoForWXModel.class, unseInfoService, exFactoryList, false, dictionaryList, equipmentCategories); }
getGroupList(putMap, record, ProduceInfo.class, OtherEquBaseInfoForWXModel.class, produceInfoService, exFactoryList, false, dictionaryList, equipmentCategories); useJsonObject.put("tabValue", maintenanceList);
jsonArray.add(useJsonObject);
if (exFactoryList.size() > 0) { map.put("tab", jsonArray);
JSONObject jsonObject = (JSONObject) exFactoryList.get(0); } else if ("气瓶".equals(map.get("EQU_CATEGORY"))) {
List<HashMap<String, Object>> groupValue = (List<HashMap<String, Object>>) jsonObject.get("groupValue"); // 基本信息
groupValue.forEach(e -> { Field[] fields2 = CylinderEquBaseInfoForWXModel.class.getDeclaredFields();
e.put("fieldValue", putMap.get(e.get("fieldKey"))); for (Field f : fields2) {
}); putMap.put(f.getName(), "");
Object ob = exFactoryList.get(0); }
exFactoryList.clear();
exFactoryList.add(ob); getGroupList(putMap, record, RegistrationInfo.class, OtherEquBaseInfoForWXModel.class, registrationInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
} getGroupList(putMap, record, DesignInfo.class, OtherEquBaseInfoForWXModel.class, designInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
getGroupList(putMap, record, OtherInfo.class, OtherEquBaseInfoForWXModel.class, otherInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
exFactoryJsonObject.put("title", "基本信息"); getGroupList(putMap, record, UseInfo.class, OtherEquBaseInfoForWXModel.class, unseInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
exFactoryJsonObject.put("tabValue", exFactoryList); getGroupList(putMap, record, ProduceInfo.class, OtherEquBaseInfoForWXModel.class, produceInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
jsonArray.add(exFactoryJsonObject);
if (exFactoryList.size() > 0) {
// 最近检验信息 JSONObject jsonObject = (JSONObject) exFactoryList.get(0);
JSONObject constructionJsonObject = new JSONObject(); List<HashMap<String, Object>> groupValue = (List<HashMap<String, Object>>) jsonObject.get("groupValue");
List constructionList = new ArrayList(); groupValue.forEach(e -> {
getGroupList(null, record, InspectionDetectionInfo.class, InspectionDetectionInfoModelForWX.class, inspectionDetectionInfoService, constructionList, true, dictionaryList, equipmentCategories); e.put("fieldValue", putMap.get(e.get("fieldKey")));
constructionJsonObject.put("title", "最近检验信息"); });
constructionJsonObject.put("tabValue", constructionList); Object ob = exFactoryList.get(0);
jsonArray.add(constructionJsonObject); exFactoryList.clear();
map.put("tab", jsonArray); exFactoryList.add(ob);
} else { }
// 基本信息
Field[] fields3 = OtherEquBaseInfoForWXModel.class.getDeclaredFields(); exFactoryJsonObject.put("title", "基本信息");
for (Field f : fields3) { exFactoryJsonObject.put("tabValue", exFactoryList);
putMap.put(f.getName(), ""); jsonArray.add(exFactoryJsonObject);
}
// 最近检验信息
getGroupList(putMap, record, RegistrationInfo.class, OtherEquBaseInfoForWXModel.class, registrationInfoService, exFactoryList, false, dictionaryList, equipmentCategories); JSONObject constructionJsonObject = new JSONObject();
getGroupList(putMap, record, DesignInfo.class, OtherEquBaseInfoForWXModel.class, designInfoService, exFactoryList, false, dictionaryList, equipmentCategories); List constructionList = new ArrayList();
getGroupList(putMap, record, OtherInfo.class, OtherEquBaseInfoForWXModel.class, otherInfoService, exFactoryList, false, dictionaryList, equipmentCategories); getGroupList(null, record, InspectionDetectionInfo.class, InspectionDetectionInfoModelForWX.class, inspectionDetectionInfoService, constructionList, true, dictionaryList, equipmentCategories);
getGroupList(putMap, record, UseInfo.class, OtherEquBaseInfoForWXModel.class, unseInfoService, exFactoryList, false, dictionaryList, equipmentCategories); constructionJsonObject.put("title", "最近检验信息");
getGroupList(putMap, record, ProduceInfo.class, OtherEquBaseInfoForWXModel.class, produceInfoService, exFactoryList, false, dictionaryList, equipmentCategories); constructionJsonObject.put("tabValue", constructionList);
jsonArray.add(constructionJsonObject);
if (exFactoryList.size() > 0) { map.put("tab", jsonArray);
JSONObject jsonObject = (JSONObject) exFactoryList.get(0); } else {
List<HashMap<String, Object>> groupValue = (List<HashMap<String, Object>>) jsonObject.get("groupValue"); // 基本信息
groupValue.forEach(e -> { Field[] fields3 = OtherEquBaseInfoForWXModel.class.getDeclaredFields();
e.put("fieldValue", putMap.get(e.get("fieldKey"))); for (Field f : fields3) {
}); putMap.put(f.getName(), "");
Object ob = exFactoryList.get(0); }
exFactoryList.clear();
exFactoryList.add(ob); getGroupList(putMap, record, RegistrationInfo.class, OtherEquBaseInfoForWXModel.class, registrationInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
} getGroupList(putMap, record, DesignInfo.class, OtherEquBaseInfoForWXModel.class, designInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
getGroupList(putMap, record, OtherInfo.class, OtherEquBaseInfoForWXModel.class, otherInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
exFactoryJsonObject.put("title", "基本信息"); getGroupList(putMap, record, UseInfo.class, OtherEquBaseInfoForWXModel.class, unseInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
exFactoryJsonObject.put("tabValue", exFactoryList); getGroupList(putMap, record, ProduceInfo.class, OtherEquBaseInfoForWXModel.class, produceInfoService, exFactoryList, false, dictionaryList, equipmentCategories);
jsonArray.add(exFactoryJsonObject);
if (exFactoryList.size() > 0) {
// 最近检验信息 JSONObject jsonObject = (JSONObject) exFactoryList.get(0);
JSONObject constructionJsonObject = new JSONObject(); List<HashMap<String, Object>> groupValue = (List<HashMap<String, Object>>) jsonObject.get("groupValue");
List constructionList = new ArrayList(); groupValue.forEach(e -> {
getGroupList(null, record, InspectionDetectionInfo.class, InspectionDetectionInfoModelForWX.class, inspectionDetectionInfoService, constructionList, true, dictionaryList, equipmentCategories); e.put("fieldValue", putMap.get(e.get("fieldKey")));
constructionJsonObject.put("title", "最近检验信息"); });
constructionJsonObject.put("tabValue", constructionList); Object ob = exFactoryList.get(0);
jsonArray.add(constructionJsonObject); exFactoryList.clear();
map.put("tab", jsonArray); exFactoryList.add(ob);
} }
return map;
} exFactoryJsonObject.put("title", "基本信息");
exFactoryJsonObject.put("tabValue", exFactoryList);
public void getGroupList(HashMap putMap, String record, Class entity, Class dto, BaseService service, List list, boolean isOne, List<DataDictionary> dictionaryList, List<EquipmentCategory> equipmentCategories) { jsonArray.add(exFactoryJsonObject);
TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""), entity);
QueryWrapper wrapper = new QueryWrapper(); // 最近检验信息
wrapper.eq("RECORD", record); JSONObject constructionJsonObject = new JSONObject();
if (isOne) { List constructionList = new ArrayList();
wrapper.orderByDesc("REC_DATE"); getGroupList(null, record, InspectionDetectionInfo.class, InspectionDetectionInfoModelForWX.class, inspectionDetectionInfoService, constructionList, true, dictionaryList, equipmentCategories);
} constructionJsonObject.put("title", "最近检验信息");
constructionJsonObject.put("tabValue", constructionList);
List entityList = service.list(wrapper); jsonArray.add(constructionJsonObject);
Iterator iterator = entityList.iterator(); map.put("tab", jsonArray);
JSONObject result; }
if (!isOne) { return map;
if (!ValidationUtil.isEmpty(entityList)) { }
if (entityList.size() > 0) {
while (iterator.hasNext()) { public void getGroupList(HashMap putMap, String record, Class entity, Class dto, BaseService service, List list, boolean isOne, List<DataDictionary> dictionaryList, List<EquipmentCategory> equipmentCategories) {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(iterator.next())); TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""), entity);
result = getFieldList(putMap, dto, jsonObject, null, dictionaryList, equipmentCategories); QueryWrapper wrapper = new QueryWrapper();
list.add(result); wrapper.eq("RECORD", record);
} if (isOne) {
} wrapper.orderByDesc("REC_DATE");
} }
} else {
int count = entityList.size(); List entityList = service.list(wrapper);
JSONObject jsonObject = null; Iterator iterator = entityList.iterator();
if (count > 0) { JSONObject result;
jsonObject = JSON.parseObject(JSON.toJSONString(iterator.next())); if (!isOne) {
} else { if (!ValidationUtil.isEmpty(entityList)) {
jsonObject = new JSONObject(); if (entityList.size() > 0) {
} while (iterator.hasNext()) {
result = getFieldList(putMap, dto, jsonObject, count, dictionaryList, equipmentCategories); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(iterator.next()));
list.add(result); result = getFieldList(putMap, dto, jsonObject, null, dictionaryList, equipmentCategories);
} list.add(result);
} }
}
public JSONObject getFieldList(HashMap putMap, Class clazz, JSONObject jsonObject, Integer count, List<DataDictionary> dictionaryList, List<EquipmentCategory> equipmentCategories) { }
JSONObject result = new JSONObject(); } else {
JSONObject ApiModel = JSON.parseObject(JSON.toJSONString(clazz.getAnnotation(ApiModel.class))); int count = entityList.size();
List<Field> declaredFields = Lists.newArrayList(clazz.getSuperclass().getDeclaredFields()); JSONObject jsonObject = null;
declaredFields.addAll(Arrays.asList(clazz.getDeclaredFields())); if (count > 0) {
jsonObject = JSON.parseObject(JSON.toJSONString(iterator.next()));
List<Map<String, Object>> list = new ArrayList<>(); } else {
if (!ValidationUtil.isEmpty(declaredFields)) { jsonObject = new JSONObject();
for (Field field : declaredFields) { }
if ("sequenceNbr".equals(field.getName()) || "recDate".equals(field.getName()) || "recUserId".equals(field.getName()) result = getFieldList(putMap, dto, jsonObject, count, dictionaryList, equipmentCategories);
|| "recUserName".equals(field.getName()) || "isDelete".equals(field.getName())) { list.add(result);
continue; }
} }
if (field.getAnnotation(ApiModelProperty.class) != null && !ValidationUtil.isEmpty(field.getAnnotation(ApiModelProperty.class).value())) {
Map<String, Object> map = new HashMap<>(); public JSONObject getFieldList(HashMap putMap, Class clazz, JSONObject jsonObject, Integer count, List<DataDictionary> dictionaryList, List<EquipmentCategory> equipmentCategories) {
String filedName = field.getAnnotation(ApiModelProperty.class).value(); JSONObject result = new JSONObject();
// key和value可根据需求存 JSONObject ApiModel = JSON.parseObject(JSON.toJSONString(clazz.getAnnotation(ApiModel.class)));
// 这存的key为注解的值,value为类属性名 List<Field> declaredFields = Lists.newArrayList(clazz.getSuperclass().getDeclaredFields());
map.put("fieldName", filedName); declaredFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
map.put("fieldKey", field.getName());
if (!ValidationUtil.isEmpty(jsonObject)) { List<Map<String, Object>> list = new ArrayList<>();
map.put("fieldValue", jsonObject.getString(field.getName())); if (!ValidationUtil.isEmpty(declaredFields)) {
getCon(field.getName(), jsonObject, map, dictionaryList, equipmentCategories); for (Field field : declaredFields) {
} else { if ("sequenceNbr".equals(field.getName()) || "recDate".equals(field.getName()) || "recUserId".equals(field.getName())
map.put("fieldValue", ""); || "recUserName".equals(field.getName()) || "isDelete".equals(field.getName())) {
} continue;
}
if (null != putMap && putMap.containsKey(field.getName())) { if (field.getAnnotation(ApiModelProperty.class) != null && !ValidationUtil.isEmpty(field.getAnnotation(ApiModelProperty.class).value())) {
if (null != map.get("fieldValue")) { Map<String, Object> map = new HashMap<>();
putMap.put(field.getName(), map.get("fieldValue")); String filedName = field.getAnnotation(ApiModelProperty.class).value();
} // key和value可根据需求存
} // 这存的key为注解的值,value为类属性名
// 街道信息处理 map.put("fieldName", filedName);
if (String.valueOf(map.get("fieldKey")).equals("factoryUseSiteStreet")) { map.put("fieldKey", field.getName());
map.put("fieldValue", getStreet(String.valueOf(map.get("fieldValue")))); if (!ValidationUtil.isEmpty(jsonObject)) {
} map.put("fieldValue", jsonObject.getString(field.getName()));
list.add(map); getCon(field.getName(), jsonObject, map, dictionaryList, equipmentCategories);
} } else {
} map.put("fieldValue", "");
} }
// 整理出现多个附件的情况
Iterator<Map<String, Object>> iterator = list.iterator(); if (null != putMap && putMap.containsKey(field.getName())) {
JSONArray array = new JSONArray(); if (null != map.get("fieldValue")) {
Boolean bool = true; putMap.put(field.getName(), map.get("fieldValue"));
String name = ""; }
while (iterator.hasNext()) { }
Map<String, Object> map = iterator.next(); // 街道信息处理
String fieldName = map.get("fieldName").toString(); if (String.valueOf(map.get("fieldKey")).equals("factoryUseSiteStreet")) {
if (fieldName.contains("附件")) { map.put("fieldValue", getStreet(String.valueOf(map.get("fieldValue"))));
if (bool) { }
// 第一个出现的附件名称为表单显示的名称 list.add(map);
name = fieldName; }
bool = false; }
} }
if (!ValidationUtil.isEmpty(map.get("fieldValue"))) { // 整理出现多个附件的情况
JSONArray jsonArray = JSON.parseArray(String.valueOf(map.get("fieldValue"))); Iterator<Map<String, Object>> iterator = list.iterator();
JSONArray json = new JSONArray(); JSONArray array = new JSONArray();
for (Object obj : jsonArray) { Boolean bool = true;
JSONObject object = JSON.parseObject(JSON.toJSONString(obj)); String name = "";
if (!ValidationUtil.isEmpty(object)) { while (iterator.hasNext()) {
object.getString("url"); Map<String, Object> map = iterator.next();
object.put("url", object.getString("url")); String fieldName = map.get("fieldName").toString();
json.add(object); if (fieldName.contains("附件")) {
} if (bool) {
} // 第一个出现的附件名称为表单显示的名称
array.addAll(json); name = fieldName;
} bool = false;
// 删除所有附件 }
iterator.remove(); if (!ValidationUtil.isEmpty(map.get("fieldValue"))) {
} JSONArray jsonArray = JSON.parseArray(String.valueOf(map.get("fieldValue")));
} JSONArray json = new JSONArray();
// 如果有附件 整理为一个附件 添加入list里 for (Object obj : jsonArray) {
if (!bool) { JSONObject object = JSON.parseObject(JSON.toJSONString(obj));
Map<String, Object> map = new HashMap<>(); if (!ValidationUtil.isEmpty(object)) {
map.put("fieldKey", "files"); object.getString("url");
map.put("fieldValue", array); object.put("url", object.getString("url"));
map.put("fieldName", name); json.add(object);
list.add(map); }
} }
array.addAll(json);
if (!ValidationUtil.isEmpty(count)) { }
result.put("groupCount", count); // 删除所有附件
} iterator.remove();
}
result.put("groupName", ApiModel.getString("description")); }
result.put("groupKey", ApiModel.getString("value")); // 如果有附件 整理为一个附件 添加入list里
result.put("groupValue", list); if (!bool) {
return result; Map<String, Object> map = new HashMap<>();
} map.put("fieldKey", "files");
map.put("fieldValue", array);
public String getStreet(String code) { map.put("fieldName", name);
List<LinkedHashMap<String, Object>> streetList = null; list.add(map);
if (redisUtil.hasKey(STREET)) { }
streetList = (List<LinkedHashMap<String, Object>>) redisUtil.get(STREET);
} if (!ValidationUtil.isEmpty(count)) {
if (!ObjectUtils.isEmpty(code) && !ObjectUtils.isEmpty(streetList)) { result.put("groupCount", count);
List<LinkedHashMap<String, Object>> collect = streetList.stream().filter(item -> item.get("regionCode").toString().equals(code)).collect(Collectors.toList()); }
if (!org.apache.commons.lang3.ObjectUtils.isEmpty(collect)) {
return String.valueOf(collect.get(0).get("regionName")); result.put("groupName", ApiModel.getString("description"));
} result.put("groupKey", ApiModel.getString("value"));
} result.put("groupValue", list);
return null; return result;
} }
/** public String getStreet(String code) {
* 获取焊口编号 List<LinkedHashMap<String, Object>> streetList = null;
* if (redisUtil.hasKey(STREET)) {
* @return streetList = (List<LinkedHashMap<String, Object>>) redisUtil.get(STREET);
*/ }
public JSONObject getQRCode(String code) { if (!ObjectUtils.isEmpty(code) && !ObjectUtils.isEmpty(streetList)) {
String url = ""; List<LinkedHashMap<String, Object>> collect = streetList.stream().filter(item -> item.get("regionCode").toString().equals(code)).collect(Collectors.toList());
JSONObject jsonObject = new JSONObject(); if (!org.apache.commons.lang3.ObjectUtils.isEmpty(collect)) {
byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(code, 50); return String.valueOf(collect.get(0).get("regionName"));
InputStream inputStream = new ByteArrayInputStream(bytes); }
try { }
MultipartFile file = new MockMultipartFile(code + ".jpg", code + ".jpg", ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream); return null;
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "ugp/qrcode"); }
if (date != null) {
Map<String, String> map = date.getResult(); /**
Iterator<String> it = map.keySet().iterator(); * 获取焊口编号
String urlString = it.next(); *
jsonObject.put("fileUrl", urlString); * @return
jsonObject.put("fileName", code); */
} public JSONObject getQRCode(String code) {
} catch (IOException e) { String url = "";
e.printStackTrace(); JSONObject jsonObject = new JSONObject();
} byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(code, 50);
return jsonObject; InputStream inputStream = new ByteArrayInputStream(bytes);
} try {
MultipartFile file = new MockMultipartFile(code + ".jpg", code + ".jpg", ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
public Object getEquipInfoBySuperviseCode(String supervisoryCode) { FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "ugp/qrcode");
CategoryOtherInfo categoryOtherInfo = categoryOtherInfoMapper.selectOne(new QueryWrapper<CategoryOtherInfo>().eq("SUPERVISORY_CODE", supervisoryCode)); if (date != null) {
return ObjectUtils.isEmpty(categoryOtherInfo) ? null : getEquipmentInfo(categoryOtherInfo.getRecord()); Map<String, String> map = date.getResult();
} Iterator<String> it = map.keySet().iterator();
String urlString = it.next();
public Map<String, Object> login(MobileLoginParam param) { jsonObject.put("fileUrl", urlString);
Map<String, Object> result = new LinkedHashMap<>(); jsonObject.put("fileName", code);
IdPasswordAuthModel idPasswordAuthModel = new IdPasswordAuthModel(); }
idPasswordAuthModel.setLoginId(param.getPhoneNo()); } catch (IOException e) {
idPasswordAuthModel.setPassword(param.getVerifyCode()); e.printStackTrace();
FeignClientResult<Map<String, String>> idpassword = new FeignClientResult<>(); }
RequestContext.setToken(""); return jsonObject;
RequestContext.setProduct(product); }
RequestContext.setAppKey(appKey);
try { public Object getEquipInfoBySuperviseCode(String supervisoryCode) {
idpassword = Privilege.authClient.idpassword(idPasswordAuthModel); CategoryOtherInfo categoryOtherInfo = categoryOtherInfoMapper.selectOne(new QueryWrapper<CategoryOtherInfo>().eq("SUPERVISORY_CODE", supervisoryCode));
} catch (Exception e) { return ObjectUtils.isEmpty(categoryOtherInfo) ? null : getEquipmentInfo(categoryOtherInfo.getRecord());
e.printStackTrace(); }
}
if (idpassword.getStatus() != successsCode) { public Map<String, Object> login(MobileLoginParam param) {
Map<String, Object> result = new LinkedHashMap<>();
log.error("远程调用Privilege服务失败", idpassword.getDevMessage()); IdPasswordAuthModel idPasswordAuthModel = new IdPasswordAuthModel();
String message = idpassword.getMessage(); idPasswordAuthModel.setLoginId(param.getPhoneNo());
if (StringUtils.isEmpty(message)) { idPasswordAuthModel.setPassword(param.getVerifyCode());
message = "账号或密码错误"; FeignClientResult<Map<String, String>> idpassword = new FeignClientResult<>();
} RequestContext.setToken("");
throw new CommonException(600001, message); RequestContext.setProduct(product);
} RequestContext.setAppKey(appKey);
if (ValidationUtil.isEmpty(idpassword) || ValidationUtil.isEmpty(idpassword.getResult()) || try {
ValidationUtil.isEmpty(idpassword.getResult().get("userId"))) { idpassword = Privilege.authClient.idpassword(idPasswordAuthModel);
log.error("未修改成功"); } catch (Exception e) {
return new HashMap<String, Object>(); e.printStackTrace();
} }
if (idpassword.getStatus() != successsCode) {
HashMap<Object, Object> authInfo = new HashMap<>();// 设置authInfo信息
authInfo.put("token", idpassword.getResult().get("token")); log.error("远程调用Privilege服务失败", idpassword.getDevMessage());
authInfo.put("personId", idpassword.getResult().get("userId")); String message = idpassword.getMessage();
authInfo.put("appKey", appKey); if (StringUtils.isEmpty(message)) {
authInfo.put("product", product); message = "账号或密码错误";
result.put("authInfo", authInfo); }
//查询用户信息 throw new CommonException(600001, message);
RequestContext.setToken(idpassword.getResult().get("token")); }
FeignClientResult<AgencyUserModel> getme = Privilege.agencyUserClient.getme(); if (ValidationUtil.isEmpty(idpassword) || ValidationUtil.isEmpty(idpassword.getResult()) ||
getme.getResult().setPassword(""); ValidationUtil.isEmpty(idpassword.getResult().get("userId"))) {
getme.getResult().setAppCodes(new ArrayList()); log.error("未修改成功");
result.put("userInfo", getme.getResult()); return new HashMap<String, Object>();
return result; }
}
HashMap<Object, Object> authInfo = new HashMap<>();// 设置authInfo信息
authInfo.put("token", idpassword.getResult().get("token"));
@SneakyThrows authInfo.put("personId", idpassword.getResult().get("userId"));
public JSONObject wxUserLogin(JSONObject wx) { authInfo.put("appKey", appKey);
JSONObject obj = getSessionKey(wx); authInfo.put("product", product);
String sessionKey = obj.getString("session_key"); result.put("authInfo", authInfo);
//被加密的数据 //查询用户信息
byte[] dataByte = Base64.getDecoder().decode(wx.getString("encryptedData")); RequestContext.setToken(idpassword.getResult().get("token"));
//加密秘钥 FeignClientResult<AgencyUserModel> getme = Privilege.agencyUserClient.getme();
byte[] keyByte = Base64.getDecoder().decode(sessionKey); getme.getResult().setPassword("");
//偏移量 getme.getResult().setAppCodes(new ArrayList());
byte[] ivByte = Base64.getDecoder().decode(wx.getString("iv")); result.put("userInfo", getme.getResult());
JSONObject res = null; return result;
// 如果密钥不足16位,那么就补足. 这个if 中的内容很重要 }
int base = 16;
if (keyByte.length % base != 0) {
int groups = keyByte.length / base + (keyByte.length % base != 0 ? 1 : 0); @SneakyThrows
byte[] temp = new byte[groups * base]; public JSONObject wxUserLogin(JSONObject wx) {
Arrays.fill(temp, (byte) 0); JSONObject obj = getSessionKey(wx);
System.arraycopy(keyByte, 0, temp, 0, keyByte.length); String sessionKey = obj.getString("session_key");
keyByte = temp; //被加密的数据
} byte[] dataByte = Base64.getDecoder().decode(wx.getString("encryptedData"));
// 初始化 //加密秘钥
Security.addProvider(new BouncyCastleProvider()); byte[] keyByte = Base64.getDecoder().decode(sessionKey);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding", "BC"); //偏移量
SecretKeySpec spec = new SecretKeySpec(keyByte, "AES"); byte[] ivByte = Base64.getDecoder().decode(wx.getString("iv"));
AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES"); JSONObject res = null;
parameters.init(new IvParameterSpec(ivByte)); // 如果密钥不足16位,那么就补足. 这个if 中的内容很重要
cipher.init(Cipher.DECRYPT_MODE, spec, parameters);// 初始化 int base = 16;
byte[] resultByte = cipher.doFinal(dataByte); if (keyByte.length % base != 0) {
if (null != resultByte && resultByte.length > 0) { int groups = keyByte.length / base + (keyByte.length % base != 0 ? 1 : 0);
String result = new String(resultByte, "UTF-8"); byte[] temp = new byte[groups * base];
res = JSONObject.parseObject(result); Arrays.fill(temp, (byte) 0);
return res; System.arraycopy(keyByte, 0, temp, 0, keyByte.length);
} keyByte = temp;
}
return res; // 初始化
Security.addProvider(new BouncyCastleProvider());
} Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding", "BC");
SecretKeySpec spec = new SecretKeySpec(keyByte, "AES");
AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES");
private JSONObject getSessionKey(JSONObject wx) { parameters.init(new IvParameterSpec(ivByte));
StringBuffer buffer = new StringBuffer("https://api.weixin.qq.com/sns/jscode2session?appid=") cipher.init(Cipher.DECRYPT_MODE, spec, parameters);// 初始化
.append(WxAppAppId).append("&secret=").append(WxAppSecret).append("&js_code=").append(wx.getString("js_code")) byte[] resultByte = cipher.doFinal(dataByte);
.append("&grant_type=").append(WxAppGrantType); if (null != resultByte && resultByte.length > 0) {
String responseStr = HttpUtils.doGet(buffer.toString()); String result = new String(resultByte, "UTF-8");
JSONObject response = JSONObject.parseObject(responseStr); res = JSONObject.parseObject(result);
return response; return res;
} }
return res;
public Page equipmentCount(String companyCode) {
Page page = new Page<>(); }
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(equipCategory);
List<Map<String, Object>> mapList = resourceJson.get(EquipmentClassifityEnum.BDLS.getCode());
List<Map<String, Object>> list = new ArrayList<>(); private JSONObject getSessionKey(JSONObject wx) {
SearchSourceBuilder builder = new SearchSourceBuilder(); StringBuffer buffer = new StringBuffer("https://api.weixin.qq.com/sns/jscode2session?appid=")
builder.trackTotalHits(true); .append(WxAppAppId).append("&secret=").append(WxAppSecret).append("&js_code=").append(wx.getString("js_code"))
SearchRequest request = new SearchRequest(); .append("&grant_type=").append(WxAppGrantType);
request.indices("idx_biz_view_jg_all"); String responseStr = HttpUtils.doGet(buffer.toString());
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); JSONObject response = JSONObject.parseObject(responseStr);
return response;
BoolQueryBuilder query = QueryBuilders.boolQuery(); }
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", companyCode));
boolMust.must(query);
public Page equipmentCount(String companyCode) {
TermsAggregationBuilder field1Aggregation = AggregationBuilders Page page = new Page<>();
.terms("group_by_code") Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(equipCategory);
.field("EQU_LIST_CODE") List<Map<String, Object>> mapList = resourceJson.get(EquipmentClassifityEnum.BDLS.getCode());
.size(1000); List<Map<String, Object>> list = new ArrayList<>();
SearchSourceBuilder builder = new SearchSourceBuilder();
TermsAggregationBuilder field2Aggregation = AggregationBuilders builder.trackTotalHits(true);
.terms("group_by_status") SearchRequest request = new SearchRequest();
.field("STATUS") request.indices("idx_biz_view_jg_all");
.size(1000); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
builder.query(boolMust);
field1Aggregation.subAggregation(field2Aggregation); BoolQueryBuilder query = QueryBuilders.boolQuery();
builder.aggregation(field1Aggregation); query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", companyCode));
builder.size(0); boolMust.must(query);
request.source(builder);
Map<String, Object> statusCountMap = new HashMap<>(); TermsAggregationBuilder field1Aggregation = AggregationBuilders
try { .terms("group_by_code")
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT); .field("EQU_LIST_CODE")
Terms field1Terms = response.getAggregations().get("group_by_code"); .size(1000);
for (Terms.Bucket field1Bucket : field1Terms.getBuckets()) {
Terms field2Terms = field1Bucket.getAggregations().get("group_by_status"); TermsAggregationBuilder field2Aggregation = AggregationBuilders
for (Terms.Bucket field2Bucket : field2Terms.getBuckets()) { .terms("group_by_status")
String field1Value = field1Bucket.getKeyAsString(); .field("STATUS")
String field2Value = EquipmentCategoryEnum.YRL.getName().equals(field2Bucket.getKeyAsString()) ? "alreadyClaim" : .size(1000);
EquipmentCategoryEnum.DRL.getName().equals(field2Bucket.getKeyAsString()) ? "waitClaim" : builder.query(boolMust);
EquipmentCategoryEnum.YJL.getName().equals(field2Bucket.getKeyAsString()) ? "refuseClaim" : "caogao"; field1Aggregation.subAggregation(field2Aggregation);
long docCount = field2Bucket.getDocCount(); builder.aggregation(field1Aggregation);
statusCountMap.put(field1Value + "|" + field2Value, docCount); builder.size(0);
} request.source(builder);
} Map<String, Object> statusCountMap = new HashMap<>();
} catch (IOException e) { try {
throw new BadRequest("es数据查询失败"); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
} Terms field1Terms = response.getAggregations().get("group_by_code");
for (Map<String, Object> item : mapList) { for (Terms.Bucket field1Bucket : field1Terms.getBuckets()) {
item.put("waitClaim", getCountNumber(item.get("code").toString(), "waitClaim", statusCountMap)); Terms field2Terms = field1Bucket.getAggregations().get("group_by_status");
item.put("alreadyClaim", getCountNumber(item.get("code").toString(), "alreadyClaim", statusCountMap)); for (Terms.Bucket field2Bucket : field2Terms.getBuckets()) {
item.put("refuseClaim", getCountNumber(item.get("code").toString(), "refuseClaim", statusCountMap)); String field1Value = field1Bucket.getKeyAsString();
item.put("sum", Long.parseLong(item.get("waitClaim").toString()) + Long.parseLong(item.get("alreadyClaim").toString()) + Long.parseLong(item.get("refuseClaim").toString())); String field2Value = EquipmentCategoryEnum.YRL.getName().equals(field2Bucket.getKeyAsString()) ? "alreadyClaim" :
list.add(item); EquipmentCategoryEnum.DRL.getName().equals(field2Bucket.getKeyAsString()) ? "waitClaim" :
} EquipmentCategoryEnum.YJL.getName().equals(field2Bucket.getKeyAsString()) ? "refuseClaim" : "caogao";
page.setCurrent(1); long docCount = field2Bucket.getDocCount();
page.setTotal(list.size()); statusCountMap.put(field1Value + "|" + field2Value, docCount);
page.setRecords(list); }
return page; }
} } catch (IOException e) {
throw new BadRequest("es数据查询失败");
private Long getCountNumber(String type, String status, Map<String, Object> statusCountMap) { }
String key = type + "|" + status; for (Map<String, Object> item : mapList) {
return Long.parseLong(statusCountMap.getOrDefault(key, "0").toString()); item.put("waitClaim", getCountNumber(item.get("code").toString(), "waitClaim", statusCountMap));
} item.put("alreadyClaim", getCountNumber(item.get("code").toString(), "alreadyClaim", statusCountMap));
item.put("refuseClaim", getCountNumber(item.get("code").toString(), "refuseClaim", statusCountMap));
public Page<Map<String, Object>> getTable(Map<String, Object> map) { item.put("sum", Long.parseLong(item.get("waitClaim").toString()) + Long.parseLong(item.get("alreadyClaim").toString()) + Long.parseLong(item.get("refuseClaim").toString()));
Page<Map<String, Object>> table = null; list.add(item);
String teqy = (String) map.get("teqy"); }
if (ValidationUtil.isEmpty(teqy)) { page.setCurrent(1);
table = equipmentCategoryServiceImpl.getTable(map); page.setTotal(list.size());
} else { page.setRecords(list);
map.remove("teqy"); return page;
table = idxFeignService.getPage(map).getResult(); }
}
return table; private Long getCountNumber(String type, String status, Map<String, Object> statusCountMap) {
} String key = type + "|" + status;
return Long.parseLong(statusCountMap.getOrDefault(key, "0").toString());
}
public JSONArray getRegionName() {
JSONArray jsonArray = new JSONArray(); public Page<Map<String, Object>> getTable(Map<String, Object> map) {
if (redisUtils.hasKey(regionRedis)) { Page<Map<String, Object>> table = null;
jsonArray = JSONArray.parseArray(redisUtils.get(regionRedis).toString()); String teqy = (String) map.get("teqy");
} else { if (ValidationUtil.isEmpty(teqy)) {
Collection<RegionModel> regionChild = new ArrayList<>(); table = equipmentCategoryServiceImpl.getTable(map);
RegionModel regionModel1 = new RegionModel(); } else {
regionChild.add(regionModel1); map.remove("teqy");
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L); table = idxFeignService.getPage(map).getResult();
Collection<RegionModel> result = collectionFeignClientResult.getResult(); }
for (RegionModel regionModel : result) { return table;
for (RegionModel child : regionModel.getChildren()) { }
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
} public JSONArray getRegionName() {
child.setChildren(regionChild); JSONArray jsonArray = new JSONArray();
jsonArray.add(child); if (redisUtils.hasKey(regionRedis)) {
} jsonArray = JSONArray.parseArray(redisUtils.get(regionRedis).toString());
regionModel.setChildren(regionChild); } else {
jsonArray.add(regionModel); Collection<RegionModel> regionChild = new ArrayList<>();
} RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
redisUtils.set(regionRedis, jsonArray); FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
} Collection<RegionModel> result = collectionFeignClientResult.getResult();
return jsonArray; for (RegionModel regionModel : result) {
} for (RegionModel child : regionModel.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
//查询字典值(只针对设备一码通详情字典,其他勿用) jsonArray.add(childChild);
public List<DataDictionary> getDictionary() { }
LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>(); child.setChildren(regionChild);
wrapper.ge(DataDictionary::getSequenceNbr, 5951L).le(DataDictionary::getSequenceNbr, 6529L); jsonArray.add(child);
List<DataDictionary> dataDictionaryList = dataDictionaryMapper.selectList(wrapper); }
return dataDictionaryList; regionModel.setChildren(regionChild);
} jsonArray.add(regionModel);
}
// 处理字典值
public void getCon(String fileName, JSONObject jsonObject, Map<String, Object> map, redisUtils.set(regionRedis, jsonArray);
List<DataDictionary> dictionaryList, List<EquipmentCategory> equipmentCategories) { }
if ("city".contains(fileName) || "county".contains(fileName)) { return jsonArray;
JSONArray regionName = getRegionName(); }
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
if (!ValidationUtil.isEmpty(list) && !ValidationUtil.isEmpty(jsonObject.getString(fileName))) { //查询字典值(只针对设备一码通详情字典,其他勿用)
String cityName = public List<DataDictionary> getDictionary() {
list.stream().filter(i -> i.getRegionCode().equals(Integer.valueOf(jsonObject.getString("city")))).findFirst().orElse(new RegionModel()).getRegionName(); LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>();
String countyName = wrapper.ge(DataDictionary::getSequenceNbr, 5951L).le(DataDictionary::getSequenceNbr, 6529L);
list.stream().filter(i -> i.getRegionCode().equals(Integer.valueOf(jsonObject.getString( List<DataDictionary> dataDictionaryList = dataDictionaryMapper.selectList(wrapper);
"county")))).findFirst().orElse(new RegionModel()).getRegionName(); return dataDictionaryList;
map.put("fieldValue", cityName + "/" + countyName); }
}
} // 处理字典值
public void getCon(String fileName, JSONObject jsonObject, Map<String, Object> map,
if ("designStandard".indexOf(fileName) != -1) { List<DataDictionary> dictionaryList, List<EquipmentCategory> equipmentCategories) {
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString(fileName)); if ("city".contains(fileName) || "county".contains(fileName)) {
map.put("fieldValue", jsonArray); JSONArray regionName = getRegionName();
} List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
if (!ValidationUtil.isEmpty(list) && !ValidationUtil.isEmpty(jsonObject.getString(fileName))) {
getIf("imported", fileName, "BOOLEN", dictionaryList, jsonObject, map); String cityName =
getIf("changes", fileName, "BGSX", dictionaryList, jsonObject, map); list.stream().filter(i -> i.getRegionCode().equals(Integer.valueOf(jsonObject.getString("city")))).findFirst().orElse(new RegionModel()).getRegionName();
getIf("usePlace", fileName, "ADDRESS", dictionaryList, jsonObject, map); String countyName =
getIf("equManageDt", fileName, "ZGBM", dictionaryList, jsonObject, map); list.stream().filter(i -> i.getRegionCode().equals(Integer.valueOf(jsonObject.getString(
getIf("equState", fileName, "SHZT", dictionaryList, jsonObject, map); "county")))).findFirst().orElse(new RegionModel()).getRegionName();
getIf("denselyPopulatedAreas", fileName, "BOOLEN", dictionaryList, jsonObject, map); map.put("fieldValue", cityName + "/" + countyName);
getIf("importantPlaces", fileName, "BOOLEN", dictionaryList, jsonObject, map); }
getIf("registerState", fileName, "ZC", dictionaryList, jsonObject, map); }
getIf("inspectType", fileName, "JYLX", dictionaryList, jsonObject, map);
getIf("inspectConclusion", fileName, "JYJL", dictionaryList, jsonObject, map); if ("designStandard".indexOf(fileName) != -1) {
getIf("constructionType", fileName, "SGLX", dictionaryList, jsonObject, map); JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString(fileName));
map.put("fieldValue", jsonArray);
for (EquipmentCategory equipmentCategory : equipmentCategories) { }
if ("equDefine".contains(fileName) && !ValidationUtil.isEmpty(equipmentCategory) && !ValidationUtil.isEmpty(equipmentCategory.getCode()) &&
!ValidationUtil.isEmpty(fileName) && !ValidationUtil.isEmpty(jsonObject.getString(fileName)) && equipmentCategory.getCode().contains(jsonObject.getString(fileName))) { getIf("imported", fileName, "BOOLEN", dictionaryList, jsonObject, map);
map.put("fieldValue", equipmentCategory.getName()); getIf("changes", fileName, "BGSX", dictionaryList, jsonObject, map);
} getIf("usePlace", fileName, "ADDRESS", dictionaryList, jsonObject, map);
if ("equCategory".contains(fileName) && !ValidationUtil.isEmpty(equipmentCategory) && !ValidationUtil.isEmpty(equipmentCategory.getCode()) && getIf("equManageDt", fileName, "ZGBM", dictionaryList, jsonObject, map);
!ValidationUtil.isEmpty(fileName) && !ValidationUtil.isEmpty(jsonObject.getString(fileName)) && equipmentCategory.getCode().contains(jsonObject.getString(fileName))) { getIf("equState", fileName, "SHZT", dictionaryList, jsonObject, map);
map.put("fieldValue", equipmentCategory.getName()); getIf("denselyPopulatedAreas", fileName, "BOOLEN", dictionaryList, jsonObject, map);
} getIf("importantPlaces", fileName, "BOOLEN", dictionaryList, jsonObject, map);
} getIf("registerState", fileName, "ZC", dictionaryList, jsonObject, map);
getIf("carrierLine", fileName, "YZS", dictionaryList, jsonObject, map); getIf("inspectType", fileName, "JYLX", dictionaryList, jsonObject, map);
getIf("deviceLevel", fileName, "GLJB", dictionaryList, jsonObject, map); getIf("inspectConclusion", fileName, "JYJL", dictionaryList, jsonObject, map);
getIf("fuelType", fileName, "GLZL", dictionaryList, jsonObject, map); getIf("constructionType", fileName, "SGLX", dictionaryList, jsonObject, map);
getIf("nameOfPressureParts", fileName, "GLBJMC", dictionaryList, jsonObject, map);
getIf("nonDestructiveTestingMethodsForPressureParts", fileName, "GLWSJCFF", dictionaryList, jsonObject, map); for (EquipmentCategory equipmentCategory : equipmentCategories) {
getIf("qpLossless", fileName, "RQJCFF", dictionaryList, jsonObject, map); if ("equDefine".contains(fileName) && !ValidationUtil.isEmpty(equipmentCategory) && !ValidationUtil.isEmpty(equipmentCategory.getCode()) &&
getIf("glLossless", fileName, "RQJCFF", dictionaryList, jsonObject, map); !ValidationUtil.isEmpty(fileName) && !ValidationUtil.isEmpty(jsonObject.getString(fileName)) && equipmentCategory.getCode().contains(jsonObject.getString(fileName))) {
getIf("mainStructureType", fileName, "RQJG", dictionaryList, jsonObject, map); map.put("fieldValue", equipmentCategory.getName());
getIf("checkLossless", fileName, "RQJCFF", dictionaryList, jsonObject, map); }
getIf("pipelineClass", fileName, "GDLB", dictionaryList, jsonObject, map); if ("equCategory".contains(fileName) && !ValidationUtil.isEmpty(equipmentCategory) && !ValidationUtil.isEmpty(equipmentCategory.getCode()) &&
getIf("deviceLevel", fileName, "GBI", dictionaryList, jsonObject, map); !ValidationUtil.isEmpty(fileName) && !ValidationUtil.isEmpty(jsonObject.getString(fileName)) && equipmentCategory.getCode().contains(jsonObject.getString(fileName))) {
getIf("workLevel", fileName, "GZJB", dictionaryList, jsonObject, map); map.put("fieldValue", equipmentCategory.getName());
getIf("mainStructureType", fileName, "JGS", dictionaryList, jsonObject, map); }
getIf("luffingMode", fileName, "BFFS", dictionaryList, jsonObject, map); }
getIf("towerStandardType", fileName, "JXS", dictionaryList, jsonObject, map); getIf("carrierLine", fileName, "YZS", dictionaryList, jsonObject, map);
getIf("baseType", fileName, "JZXS", dictionaryList, jsonObject, map); getIf("deviceLevel", fileName, "GLJB", dictionaryList, jsonObject, map);
getIf("outriggerType", fileName, "ZT", dictionaryList, jsonObject, map); getIf("fuelType", fileName, "GLZL", dictionaryList, jsonObject, map);
getIf("mainBeamType", fileName, "ZLXS", dictionaryList, jsonObject, map); getIf("nameOfPressureParts", fileName, "GLBJMC", dictionaryList, jsonObject, map);
getIf("boomType", fileName, "BJXS", dictionaryList, jsonObject, map); getIf("nonDestructiveTestingMethodsForPressureParts", fileName, "GLWSJCFF", dictionaryList, jsonObject, map);
getIf("boomStructureType", fileName, "BJJGXS", dictionaryList, jsonObject, map); getIf("qpLossless", fileName, "RQJCFF", dictionaryList, jsonObject, map);
getIf("gantryStructureType", fileName, "MJJG", dictionaryList, jsonObject, map); getIf("glLossless", fileName, "RQJCFF", dictionaryList, jsonObject, map);
getIf("use", fileName, "YT", dictionaryList, jsonObject, map); getIf("mainStructureType", fileName, "RQJG", dictionaryList, jsonObject, map);
getIf("controlMode", fileName, "CZFS", dictionaryList, jsonObject, map); getIf("checkLossless", fileName, "RQJCFF", dictionaryList, jsonObject, map);
getIf("hangingCagesNumber", fileName, "DLSL", dictionaryList, jsonObject, map); getIf("pipelineClass", fileName, "GDLB", dictionaryList, jsonObject, map);
getIf("driveMechanismType", fileName, "QDJG", dictionaryList, jsonObject, map); getIf("deviceLevel", fileName, "GBI", dictionaryList, jsonObject, map);
getIf("guideRailFrame", fileName, "DS", dictionaryList, jsonObject, map); getIf("workLevel", fileName, "GZJB", dictionaryList, jsonObject, map);
getIf("liftingDriveMode", fileName, "QD", dictionaryList, jsonObject, map); getIf("mainStructureType", fileName, "JGS", dictionaryList, jsonObject, map);
getIf("operationMode", fileName, "JXCZ", dictionaryList, jsonObject, map); getIf("luffingMode", fileName, "BFFS", dictionaryList, jsonObject, map);
getIf("liftingMode", fileName, "QSFS", dictionaryList, jsonObject, map); getIf("towerStandardType", fileName, "JXS", dictionaryList, jsonObject, map);
getIf("explosionProofGrade", fileName, "FBDJ", dictionaryList, jsonObject, map); getIf("baseType", fileName, "JZXS", dictionaryList, jsonObject, map);
getIf("hoistWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map); getIf("outriggerType", fileName, "ZT", dictionaryList, jsonObject, map);
getIf("bigcarTraveWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map); getIf("mainBeamType", fileName, "ZLXS", dictionaryList, jsonObject, map);
getIf("smallcarTraveWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map); getIf("boomType", fileName, "BJXS", dictionaryList, jsonObject, map);
getIf("hoistWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map); getIf("boomStructureType", fileName, "BJJGXS", dictionaryList, jsonObject, map);
getIf("smallcarSideswayWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map); getIf("gantryStructureType", fileName, "MJJG", dictionaryList, jsonObject, map);
getIf("partName", fileName, "ZYLBJ", dictionaryList, jsonObject, map); getIf("use", fileName, "YT", dictionaryList, jsonObject, map);
getIf("workType", fileName, "GZLX", dictionaryList, jsonObject, map); getIf("controlMode", fileName, "CZFS", dictionaryList, jsonObject, map);
getIf("controlMode", fileName, "KZFS", dictionaryList, jsonObject, map); getIf("hangingCagesNumber", fileName, "DLSL", dictionaryList, jsonObject, map);
getIf("jackingType", fileName, "DSXS", dictionaryList, jsonObject, map); getIf("driveMechanismType", fileName, "QDJG", dictionaryList, jsonObject, map);
getIf("explosionproofType", fileName, "FBXS", dictionaryList, jsonObject, map); getIf("guideRailFrame", fileName, "DS", dictionaryList, jsonObject, map);
getIf("explosionproofGrade", fileName, "FBDJ", dictionaryList, jsonObject, map); getIf("liftingDriveMode", fileName, "QD", dictionaryList, jsonObject, map);
getIf("xgxlMediaType", fileName, "XGJZZL", dictionaryList, jsonObject, map); getIf("operationMode", fileName, "JXCZ", dictionaryList, jsonObject, map);
getIf("designation", fileName, "KYSDBJMC", dictionaryList, jsonObject, map); getIf("liftingMode", fileName, "QSFS", dictionaryList, jsonObject, map);
getIf("designation", fileName, "CCFJDCLLBJMC", dictionaryList, jsonObject, map); getIf("explosionProofGrade", fileName, "FBDJ", dictionaryList, jsonObject, map);
getIf("isMonitor", fileName, "HAVE", dictionaryList, jsonObject, map); getIf("hoistWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map);
if ("equList".indexOf(fileName) != -1) { getIf("bigcarTraveWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map);
String equList = EquipmentClassifityEnum.getName.get(jsonObject.getString(fileName)); getIf("smallcarTraveWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map);
map.put("fieldValue", equList); getIf("hoistWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map);
} getIf("smallcarSideswayWorkingLevel", fileName, "GZJB", dictionaryList, jsonObject, map);
} getIf("partName", fileName, "ZYLBJ", dictionaryList, jsonObject, map);
getIf("workType", fileName, "GZLX", dictionaryList, jsonObject, map);
public void getIf(String name, String fileName, String type, List<DataDictionary> dictionaryList, JSONObject jsonObject, Map<String, Object> map) { getIf("controlMode", fileName, "KZFS", dictionaryList, jsonObject, map);
if (name.indexOf(fileName) != -1) { getIf("jackingType", fileName, "DSXS", dictionaryList, jsonObject, map);
List<DataDictionary> list = dictionaryList.stream().filter(t -> t.getType().equals(type) && t.getCode().equals(jsonObject.getString(fileName))).collect(Collectors.toList()); getIf("explosionproofType", fileName, "FBXS", dictionaryList, jsonObject, map);
if (list.size() > 0) { getIf("explosionproofGrade", fileName, "FBDJ", dictionaryList, jsonObject, map);
map.put("fieldValue", list.get(0).getName()); getIf("xgxlMediaType", fileName, "XGJZZL", dictionaryList, jsonObject, map);
} getIf("designation", fileName, "KYSDBJMC", dictionaryList, jsonObject, map);
} getIf("designation", fileName, "CCFJDCLLBJMC", dictionaryList, jsonObject, map);
} getIf("isMonitor", fileName, "HAVE", dictionaryList, jsonObject, map);
if ("equList".indexOf(fileName) != -1) {
String equList = EquipmentClassifityEnum.getName.get(jsonObject.getString(fileName));
map.put("fieldValue", equList);
}
}
public void getIf(String name, String fileName, String type, List<DataDictionary> dictionaryList, JSONObject jsonObject, Map<String, Object> map) {
if (name.indexOf(fileName) != -1) {
List<DataDictionary> list = dictionaryList.stream().filter(t -> t.getType().equals(type) && t.getCode().equals(jsonObject.getString(fileName))).collect(Collectors.toList());
if (list.size() > 0) {
map.put("fieldValue", list.get(0).getName());
}
}
}
} }
...@@ -248,7 +248,6 @@ public class TzsAuthServiceImpl implements TzsAuthService { ...@@ -248,7 +248,6 @@ public class TzsAuthServiceImpl implements TzsAuthService {
this.loginUser(weRobotUser, weRobotPassword, weChatToken); this.loginUser(weRobotUser, weRobotPassword, weChatToken);
} }
} }
String weToken = redisUtils.get(weChatToken).toString(); return redisUtils.get(weChatToken).toString();
return weToken;
} }
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.app.biz.service.impl;
import com.yeejoin.amos.boot.module.app.biz.strategy.ISearchDetailHandler;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.Map;
@Component
public class UnitSearchDetailDetailHandlerImpl implements ISearchDetailHandler<Map<String,Object>> {
@Override
public String manageType() {
return "unit";
}
@Override
public Map<String, Object> hanlder(String applyNo, String from) {
return Collections.emptyMap();
}
}
package com.yeejoin.amos.boot.module.app.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.module.app.api.annotation.Converter;
import com.yeejoin.amos.boot.module.app.api.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.module.app.api.dto.CylinderInfoForWX;
import com.yeejoin.amos.boot.module.app.api.dto.VehicleInfoForWX;
import com.yeejoin.amos.boot.module.app.api.mapper.AppCommonMapper;
import com.yeejoin.amos.boot.module.app.biz.strategy.ISearchDetailHandler;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.http.entity.ContentType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.*;
@Component
public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandler<Map<String, Object>> {
private final AppCommonMapper appCommonMapper;
public VehicleSearchDetailDetailHandlerImpl(AppCommonMapper appCommonMapper) {
this.appCommonMapper = appCommonMapper;
}
@Override
public String manageType() {
return "vehicle";
}
@Override
public Map<String, Object> hanlder(String applyNo, String from) {
return this.getQueryCarCylinderInfo(applyNo);
}
private Map<String, Object> getQueryCarCylinderInfo(String qrCode) {
VehicleInfoForWX baseInfo = appCommonMapper.queryVehicleBaseInfo(qrCode);
List<CylinderInfoForWX> cylinderInfos = appCommonMapper.queryCylinderIfoOfVehicle(qrCode);
fillEquDefine(baseInfo, cylinderInfos);
Map<String, Object> result = new LinkedHashMap<>();
JSONArray tabs = new JSONArray();
buildFixFields(qrCode, baseInfo, result);
buildOneItemTypeMap( baseInfo, tabs);
buildManyItemTypeTab(cylinderInfos, tabs);
result.put("tab", tabs);
return result;
}
private void fillEquDefine(VehicleInfoForWX baseInfo, List<CylinderInfoForWX> cylinderInfos) {
cylinderInfos.forEach(c-> c.setEquDefine(baseInfo.getEquDefine()));
}
private void buildFixFields(String qrCode, VehicleInfoForWX baseInfo, Map<String, Object> result) {
result.putAll(getQRCode(qrCode));
result.put("unitName", baseInfo.getUseUnitName());
result.put("equList", baseInfo.getEquList());
}
private void buildManyItemTypeTab(List<CylinderInfoForWX> cylinderInfos, JSONArray tabs) {
JSONObject tab = new JSONObject();
tab.put("title", "气瓶信息");
tab.put("tabValue", this.buildFieldsWithGroup(cylinderInfos));
tab.put("isGroup", true);
tabs.add(tab);
}
private void buildOneItemTypeMap(VehicleInfoForWX baseInfo, JSONArray tabs) {
JSONObject tab = new JSONObject();
tab.put("title", "基本信息");
tab.put("tabValue", this.buildFieldsNoGroup(baseInfo));
tab.put("isGroup", false);
tabs.add(tab);
}
private Object buildFieldsNoGroup(VehicleInfoForWX baseInfo) {
JSONArray fieldArray = new JSONArray();
Field[] fields = baseInfo.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
FieldDisplayDefine displayDefine = field.getAnnotation(FieldDisplayDefine.class);
try {
if (displayDefine != null && displayDefine.isExist()) {
String fieldName = displayDefine.value();
JSONObject json = new JSONObject();
json.put("fieldName", fieldName);
json.put("fieldKey", field.getName());
json.put("fieldValue", field.get(baseInfo));
fieldArray.add(json);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
return fieldArray;
}
private Object buildFieldsWithGroup(List<CylinderInfoForWX> cylinderInfos) {
JSONArray groupArray = new JSONArray();
for(CylinderInfoForWX cylinderInfo: cylinderInfos){
JSONObject group = new JSONObject();
JSONArray fieldArray = new JSONArray();
Field[] fields = cylinderInfo.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
FieldDisplayDefine displayDefine = field.getAnnotation(FieldDisplayDefine.class);
try {
if (displayDefine != null && displayDefine.isExist()) {
String fieldName = displayDefine.value();
JSONObject json = new JSONObject();
json.put("fieldName", fieldName);
json.put("fieldKey", field.getName());
Converter<String> converter = displayDefine.converter().newInstance();
if(field.get(cylinderInfo) != null){
json.put("fieldValue", converter.convertToLabelData((String)field.get(cylinderInfo)));
} else {
json.put("fieldValue", "");
}
fieldArray.add(json);
}
} catch (IllegalAccessException | InstantiationException e) {
throw new RuntimeException(e);
}
}
group.put("groupName", String.format("气瓶(%s)", cylinderInfo.getFactoryNum()));
group.put("groupFields", fieldArray);
groupArray.add(group);
}
return groupArray;
}
private JSONObject getQRCode(String code) {
JSONObject jsonObject = new JSONObject();
byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(code, 50);
InputStream inputStream = new ByteArrayInputStream(bytes);
try {
MultipartFile file = new MockMultipartFile(code + ".jpg", code + ".jpg", ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "ugp/qrcode");
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
String urlString = it.next();
jsonObject.put("fileUrl", urlString);
jsonObject.put("fileName", code);
}
} catch (IOException e) {
e.printStackTrace();
}
return jsonObject;
}
}
package com.yeejoin.amos.boot.module.app.biz.strategy;
import java.util.Map;
public interface ISearchDetailHandler<T extends Map<String, Object>> {
/**
* 可处理方式
* @return 处理方式
*/
String manageType();
/**
* 处理处理
* @param applyNo 单号
* @param from 来源
* @return T
*/
T hanlder(String applyNo, String from);
}
package com.yeejoin.amos.boot.module.app.biz.strategy;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
@Component
public class SearchDetailStrategyContext implements ApplicationContextAware {
private static final Map<String, ISearchDetailHandler> handlerMap = new ConcurrentHashMap<>();
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
Map<String, ISearchDetailHandler> searchHandlerMap = applicationContext.getBeansOfType(ISearchDetailHandler.class);
if (searchHandlerMap.isEmpty()) {
return;
}
for (ISearchDetailHandler handler : searchHandlerMap.values()) {
handlerMap.put(handler.manageType(), handler);
}
}
public static ISearchDetailHandler getHandler(String type) {
return Optional.ofNullable(handlerMap.get(type)).orElseThrow(() -> new RuntimeException(String.format("not found %s type strategy", type)));
}
}
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