Commit 016ed367 authored by suhuiguang's avatar suhuiguang

1.增加证扫描逻辑

parent aae3334d
...@@ -10,6 +10,12 @@ public @interface FieldDisplayDefine { ...@@ -10,6 +10,12 @@ public @interface FieldDisplayDefine {
String value(); String value();
/**
* 字段别名 兼容前端使用
* @return 别名key
*/
String alias() default "";
boolean isExist() default true; boolean isExist() default true;
Class<? extends Converter> converter() default DefaultConverter.class; Class<? extends Converter> converter() default DefaultConverter.class;
......
...@@ -22,7 +22,7 @@ public class CylinderInfoForWX { ...@@ -22,7 +22,7 @@ public class CylinderInfoForWX {
@FieldDisplayDefine(value = "制造单位") @FieldDisplayDefine(value = "制造单位")
private String produceUnitName; private String produceUnitName;
@FieldDisplayDefine(value = "制造年月") @FieldDisplayDefine(value = "制造年月", alias="produceDateStr")
private String produceDate; private String produceDate;
@FieldDisplayDefine(value = "充装介质", converter = ChargeMediaConverter.class) @FieldDisplayDefine(value = "充装介质", converter = ChargeMediaConverter.class)
...@@ -34,10 +34,10 @@ public class CylinderInfoForWX { ...@@ -34,10 +34,10 @@ public class CylinderInfoForWX {
@FieldDisplayDefine(value = "容积(L)") @FieldDisplayDefine(value = "容积(L)")
private String singleBottleVolume; private String singleBottleVolume;
@FieldDisplayDefine(value = "最近一次检验日期") @FieldDisplayDefine(value = "最近一次检验日期", alias="lastInspectDateStr")
private String lastInspectDate; private String lastInspectDate;
@FieldDisplayDefine(value = "下次检验日期") @FieldDisplayDefine(value = "下次检验日期", alias="nextInspectDateStr")
private String nextInspectDate; private String nextInspectDate;
@FieldDisplayDefine(value = "检验结果" ,converter = InspectResultConverter.class) @FieldDisplayDefine(value = "检验结果" ,converter = InspectResultConverter.class)
......
...@@ -10,9 +10,12 @@ public class VehicleInfoForWX { ...@@ -10,9 +10,12 @@ public class VehicleInfoForWX {
@FieldDisplayDefine(value = "车牌号") @FieldDisplayDefine(value = "车牌号")
private String carNumber; private String carNumber;
@FieldDisplayDefine(value = "使用登记证编号") @FieldDisplayDefine(value = "使用登记证编号" ,isExist = false)
private String useRegistrationCode; private String useRegistrationCode;
@FieldDisplayDefine(value = "使用登记证状态" ,isExist = false)
private String certificateStatus;
@FieldDisplayDefine(value = "设备类别") @FieldDisplayDefine(value = "设备类别")
private String equCategory; private String equCategory;
......
...@@ -85,7 +85,8 @@ ...@@ -85,7 +85,8 @@
equ_category, equ_category,
gas_num, gas_num,
use_unit_address, use_unit_address,
use_unit_name use_unit_name,
certificate_status
FROM FROM
"tzs_jg_use_registration_manage" "tzs_jg_use_registration_manage"
where where
......
...@@ -130,11 +130,11 @@ public class TzsAppController { ...@@ -130,11 +130,11 @@ public class TzsAppController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/certInfoWX") @GetMapping(value = "/{certSeq}/certInfo")
@ApiOperation(httpMethod = "GET", value = "小程序获取登记证或者使用标志详情", notes = "小程序获取登记证或者使用标志详情") @ApiOperation(httpMethod = "GET", value = "小程序获取登记证或者使用标志详情", notes = "小程序获取登记证或者使用标志详情")
public ResponseModel<Map> getCertInfoForWX(@RequestParam String applyNo, public ResponseModel<Map> getCertInfoForWX(@PathVariable String certSeq,
@RequestParam String from) { @RequestParam(required = false) String certType) {
return ResponseHelper.buildResponse(appService.getCertInfoForWX(applyNo,from)); return ResponseHelper.buildResponse(appService.getCertInfoForWX(certSeq,certType));
} }
......
...@@ -7,7 +7,7 @@ import java.util.Collections; ...@@ -7,7 +7,7 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
@Component @Component
public class SetSearchDetailDetailHandlerImpl implements ISearchDetailHandler<Map<String, Object>> { public class SetSearchDetailDetailHandlerImpl implements ISearchDetailHandler {
@Override @Override
public String manageType() { public String manageType() {
return "set"; return "set";
......
...@@ -264,17 +264,19 @@ public class TzsAppService { ...@@ -264,17 +264,19 @@ public class TzsAppService {
return map; return map;
} }
public Map<String, Object> getCertInfoForWX(String applyNo, String from) { public Map<String, Object> getCertInfoForWX(String certSeq, String certType) {
// 单位办理方式[unit](气瓶、压力管道)、台套办理方式[set](7大类,不包含压力管道)、车用气瓶(压力容器->气瓶) return SearchDetailStrategyContext.getHandler(this.getManageType(certSeq)).hanlder(certSeq, certType);
}
private String getManageType(String applyNo) {
// 3类:单位办理方式[unit](气瓶、压力管道)、台套办理方式[set](7大类,不包含压力管道)、车用气瓶[vehicle](压力容器->气瓶)
JgUseRegistrationManageDto jgUseRegistrationManage = commonMapper.selectOneCert(applyNo); JgUseRegistrationManageDto jgUseRegistrationManage = commonMapper.selectOneCert(applyNo);
// 使用登记、车用气瓶登记 // 使用登记、车用气瓶登记
String regType = jgUseRegistrationManage.getRegType(); String regType = jgUseRegistrationManage.getRegType();
// unit、set、null
String manageType = jgUseRegistrationManage.getManageType() == null ? "set" : jgUseRegistrationManage.getManageType();
if (REG_TYPE_VEHICLE.equals(regType)) { if (REG_TYPE_VEHICLE.equals(regType)) {
return SearchDetailStrategyContext.getHandler("vehicle").hanlder(applyNo, from); return "vehicle";
} }
return SearchDetailStrategyContext.getHandler(manageType).hanlder(applyNo, from); return jgUseRegistrationManage.getManageType() == null ? "set" : jgUseRegistrationManage.getManageType();
} }
......
...@@ -7,7 +7,7 @@ import java.util.Collections; ...@@ -7,7 +7,7 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
@Component @Component
public class UnitSearchDetailDetailHandlerImpl implements ISearchDetailHandler<Map<String,Object>> { public class UnitSearchDetailDetailHandlerImpl implements ISearchDetailHandler {
@Override @Override
public String manageType() { public String manageType() {
return "unit"; return "unit";
......
...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.app.api.mapper.AppCommonMapper; ...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.app.api.mapper.AppCommonMapper;
import com.yeejoin.amos.boot.module.app.biz.strategy.ISearchDetailHandler; import com.yeejoin.amos.boot.module.app.biz.strategy.ISearchDetailHandler;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.springframework.mock.web.MockMultipartFile; import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -23,7 +24,7 @@ import java.lang.reflect.Field; ...@@ -23,7 +24,7 @@ import java.lang.reflect.Field;
import java.util.*; import java.util.*;
@Component @Component
public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandler<Map<String, Object>> { public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandler {
private final AppCommonMapper appCommonMapper; private final AppCommonMapper appCommonMapper;
...@@ -38,17 +39,17 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle ...@@ -38,17 +39,17 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle
} }
@Override @Override
public Map<String, Object> hanlder(String applyNo, String from) { public Map<String, Object> hanlder(String certSeq, String certType) {
return this.getQueryCarCylinderInfo(applyNo); return this.getQueryCarCylinderInfo(certSeq);
} }
private Map<String, Object> getQueryCarCylinderInfo(String qrCode) { private Map<String, Object> getQueryCarCylinderInfo(String certSeq) {
VehicleInfoForWX baseInfo = appCommonMapper.queryVehicleBaseInfo(qrCode); VehicleInfoForWX baseInfo = appCommonMapper.queryVehicleBaseInfo(certSeq);
List<CylinderInfoForWX> cylinderInfos = appCommonMapper.queryCylinderIfoOfVehicle(qrCode); List<CylinderInfoForWX> cylinderInfos = appCommonMapper.queryCylinderIfoOfVehicle(certSeq);
fillEquDefine(baseInfo, cylinderInfos); fillEquDefine(baseInfo, cylinderInfos);
Map<String, Object> result = new LinkedHashMap<>(); Map<String, Object> result = new LinkedHashMap<>();
JSONArray tabs = new JSONArray(); JSONArray tabs = new JSONArray();
buildFixFields(qrCode, baseInfo, result); buildFixFields(baseInfo, result);
buildOneItemTypeMap( baseInfo, tabs); buildOneItemTypeMap( baseInfo, tabs);
buildManyItemTypeTab(cylinderInfos, tabs); buildManyItemTypeTab(cylinderInfos, tabs);
result.put("tab", tabs); result.put("tab", tabs);
...@@ -59,29 +60,34 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle ...@@ -59,29 +60,34 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle
cylinderInfos.forEach(c-> c.setEquDefine(baseInfo.getEquDefine())); cylinderInfos.forEach(c-> c.setEquDefine(baseInfo.getEquDefine()));
} }
private void buildFixFields(String qrCode, VehicleInfoForWX baseInfo, Map<String, Object> result) { private void buildFixFields(VehicleInfoForWX baseInfo, Map<String, Object> result) {
result.putAll(getQRCode(qrCode)); result.put("useUnitName", baseInfo.getUseUnitName());
result.put("unitName", baseInfo.getUseUnitName());
result.put("equList", baseInfo.getEquList()); result.put("equList", baseInfo.getEquList());
result.put("useRegistrationCode", baseInfo.getUseRegistrationCode());
result.put("status", baseInfo.getCertificateStatus());
// 控制颜色 扩展证状态使用
result.put("color", "#00FF00");
} }
private void buildManyItemTypeTab(List<CylinderInfoForWX> cylinderInfos, JSONArray tabs) { private void buildManyItemTypeTab(List<CylinderInfoForWX> cylinderInfos, JSONArray tabs) {
JSONObject tab = new JSONObject(); JSONObject tab = new JSONObject();
tab.put("title", "气瓶信息"); tab.put("title", "气瓶信息");
tab.put("tabKey", "cylinderInfo");
tab.put("tabValue", this.buildFieldsWithGroup(cylinderInfos)); tab.put("tabValue", this.buildFieldsWithGroup(cylinderInfos));
tab.put("isGroup", true);
tabs.add(tab); tabs.add(tab);
} }
private void buildOneItemTypeMap(VehicleInfoForWX baseInfo, JSONArray tabs) { private void buildOneItemTypeMap(VehicleInfoForWX baseInfo, JSONArray tabs) {
JSONObject tab = new JSONObject(); JSONObject tab = new JSONObject();
tab.put("title", "基本信息"); tab.put("title", "基本信息");
tab.put("tabValue", this.buildFieldsNoGroup(baseInfo)); tab.put("tabKey", "baseInfo");
tab.put("isGroup", false); tab.put("tabValue", this.buildFieldsOneGroup(baseInfo));
tabs.add(tab); tabs.add(tab);
} }
private Object buildFieldsNoGroup(VehicleInfoForWX baseInfo) { private JSONArray buildFieldsOneGroup(VehicleInfoForWX baseInfo) {
JSONArray groupArray = new JSONArray();
JSONObject group = new JSONObject();
JSONArray fieldArray = new JSONArray(); JSONArray fieldArray = new JSONArray();
Field[] fields = baseInfo.getClass().getDeclaredFields(); Field[] fields = baseInfo.getClass().getDeclaredFields();
for (Field field : fields) { for (Field field : fields) {
...@@ -92,7 +98,7 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle ...@@ -92,7 +98,7 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle
String fieldName = displayDefine.value(); String fieldName = displayDefine.value();
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("fieldName", fieldName); json.put("fieldName", fieldName);
json.put("fieldKey", field.getName()); json.put("fieldKey", StringUtils.isNotBlank(displayDefine.alias()) ? displayDefine.alias() : field.getName());
json.put("fieldValue", field.get(baseInfo)); json.put("fieldValue", field.get(baseInfo));
fieldArray.add(json); fieldArray.add(json);
} }
...@@ -100,7 +106,11 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle ...@@ -100,7 +106,11 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
return fieldArray; group.put("groupKey", "baseInfo");
group.put("groupName", "");
group.put("groupValue", fieldArray);
groupArray.add(group);
return groupArray;
} }
private Object buildFieldsWithGroup(List<CylinderInfoForWX> cylinderInfos) { private Object buildFieldsWithGroup(List<CylinderInfoForWX> cylinderInfos) {
...@@ -117,7 +127,7 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle ...@@ -117,7 +127,7 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle
String fieldName = displayDefine.value(); String fieldName = displayDefine.value();
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("fieldName", fieldName); json.put("fieldName", fieldName);
json.put("fieldKey", field.getName()); json.put("fieldKey", StringUtils.isNotBlank(displayDefine.alias()) ? displayDefine.alias() : field.getName());
Converter<String> converter = displayDefine.converter().newInstance(); Converter<String> converter = displayDefine.converter().newInstance();
if(field.get(cylinderInfo) != null){ if(field.get(cylinderInfo) != null){
json.put("fieldValue", converter.convertToLabelData((String)field.get(cylinderInfo))); json.put("fieldValue", converter.convertToLabelData((String)field.get(cylinderInfo)));
...@@ -130,8 +140,9 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle ...@@ -130,8 +140,9 @@ public class VehicleSearchDetailDetailHandlerImpl implements ISearchDetailHandle
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
group.put("groupKey", cylinderInfo.getEquCode());
group.put("groupName", String.format("气瓶(%s)", cylinderInfo.getFactoryNum())); group.put("groupName", String.format("气瓶(%s)", cylinderInfo.getFactoryNum()));
group.put("groupFields", fieldArray); group.put("groupValue", fieldArray);
groupArray.add(group); groupArray.add(group);
} }
return groupArray; return groupArray;
......
...@@ -2,7 +2,7 @@ package com.yeejoin.amos.boot.module.app.biz.strategy; ...@@ -2,7 +2,7 @@ package com.yeejoin.amos.boot.module.app.biz.strategy;
import java.util.Map; import java.util.Map;
public interface ISearchDetailHandler<T extends Map<String, Object>> { public interface ISearchDetailHandler {
/** /**
* 可处理方式 * 可处理方式
...@@ -16,5 +16,5 @@ public interface ISearchDetailHandler<T extends Map<String, Object>> { ...@@ -16,5 +16,5 @@ public interface ISearchDetailHandler<T extends Map<String, Object>> {
* @param from 来源 * @param from 来源
* @return T * @return T
*/ */
T hanlder(String applyNo, String from); Map<String, Object> hanlder(String applyNo, String from);
} }
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