Commit bbd589a1 authored by 韩桐桐's avatar 韩桐桐

fix(statistics):接口迁移

parent ea45f266
package com.yeejoin.amos.boot.module.statistics.api.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-12-13
*/
@Mapper
public interface EnterpriseBizMapper {
Map<String, Object> getProblemInfoBySourceId(@Param("sourceId")String sourceId);
}
<?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.statistics.api.mapper.EnterpriseBizMapper">
<select id="getProblemInfoBySourceId" resultType="java.util.Map">
select * from tzs_safety_problem_tracing where source_id = #{sourceId} order by rec_date desc limit 1
</select>
</mapper>
......@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.EnterpriseBizServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzBaseEnterpriseInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,13 +26,10 @@ import java.util.Map;
public class EnterpriseBizController {
private final EnterpriseBizServiceImpl enterpriseBizService;
private final ITzBaseEnterpriseInfoService iTzBaseEnterpriseInfoService;
@Autowired
public EnterpriseBizController(EnterpriseBizServiceImpl enterpriseBizService,
ITzBaseEnterpriseInfoService iTzBaseEnterpriseInfoService) {
public EnterpriseBizController(EnterpriseBizServiceImpl enterpriseBizService) {
this.enterpriseBizService = enterpriseBizService;
this.iTzBaseEnterpriseInfoService = iTzBaseEnterpriseInfoService;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......@@ -44,10 +40,10 @@ public class EnterpriseBizController {
return ResponseHelper.buildResponse(enterpriseBizService.page(pageParam, tzBaseEnterpriseInfoDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getInfoByUseCode/map", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据统一信用代码查询企业详情返回map", notes = "根据统一信用代码查询企业详情返回map")
public ResponseModel<Map<String, Object>> getInfoByUseCodeMap(String useCode) {
return ResponseHelper.buildResponse(iTzBaseEnterpriseInfoService.getInfoByUseCodeMap(useCode));
}
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @RequestMapping(value = "/getInfoByUseCode/map", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "根据统一信用代码查询企业详情返回map", notes = "根据统一信用代码查询企业详情返回map")
// public ResponseModel<Map<String, Object>> getInfoByUseCodeMap(String useCode) {
// return ResponseHelper.buildResponse(enterpriseBizService.getInfoByUseCodeMap(useCode));
// }
}
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.EquipmentBizServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.service.IEquipmentCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,14 +22,12 @@ import java.util.Map;
@Api(tags = "大屏-设备相关-业务API")
public class EquipmentBizController {
private final IEquipmentCategoryService equipmentCategoryService;
private final EquipmentBizServiceImpl equipmentBizServiceImpl;
@Autowired
public EquipmentBizController(IEquipmentCategoryService equipmentCategoryService,EquipmentBizServiceImpl equipmentBizServiceImpl) {
this.equipmentCategoryService = equipmentCategoryService;
public EquipmentBizController(EquipmentBizServiceImpl equipmentBizServiceImpl) {
this.equipmentBizServiceImpl = equipmentBizServiceImpl;
}
......@@ -38,7 +35,7 @@ public class EquipmentBizController {
@RequestMapping(value = "/getFormRecordById/map", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "表格查询详情", notes = "表格查询详情")
public ResponseModel<Object> getFormRecordByIdMap(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(equipmentCategoryService.getFormRecordByIdMap(map));
return ResponseHelper.buildResponse(equipmentBizServiceImpl.getFormRecordByIdMap(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -48,17 +45,4 @@ public class EquipmentBizController {
return ResponseHelper.buildResponse(equipmentBizServiceImpl.getChildren(code));
}
/**
* 获取管辖分局树
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/creatTree")
@ApiOperation(httpMethod = "GET", value = "获取管辖分局树", notes = "获取管辖分局树")
public ResponseModel<Object> creatTree() {
return ResponseHelper.buildResponse(equipmentCategoryService.getTree());
}
}
......@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl;
import com.yeejoin.amos.boot.module.tcm.flc.api.service.IRegUnitInfoService;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -14,7 +13,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Collection;
import java.util.List;
@RestController
......@@ -23,12 +21,9 @@ import java.util.List;
public class StCommonController extends BaseController {
private StCommonServiceImpl commonService;
private IRegUnitInfoService iregUnitInfoService;
public StCommonController(StCommonServiceImpl commonService,
IRegUnitInfoService iregUnitInfoService) {
public StCommonController(StCommonServiceImpl commonService) {
this.commonService = commonService;
this.iregUnitInfoService = iregUnitInfoService;
}
/**
......@@ -54,13 +49,4 @@ public class StCommonController extends BaseController {
objects.add(commonService.getEquCategoryTree(paramDto));
return ResponseHelper.buildResponse(objects);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/management-unit/tree")
@ApiOperation(httpMethod = "GET", value = "管辖机构树", notes = "管辖机构树")
public ResponseModel<Collection> managementUnitTree(@RequestParam(required = false) String orgCode) {
Collection result = iregUnitInfoService.getManagementUnitTree(orgCode);
return ResponseHelper.buildResponse(result);
}
}
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.statistics.api.mapper.EnterpriseBizMapper;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
......@@ -32,10 +33,15 @@ public class EnterpriseBizServiceImpl {
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
public EnterpriseBizServiceImpl(RedisUtils redisUtils, StCommonServiceImpl stCommonService, TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper) {
private EnterpriseBizMapper enterpriseBizMapper;
public EnterpriseBizServiceImpl(RedisUtils redisUtils, StCommonServiceImpl stCommonService,
TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper,
EnterpriseBizMapper enterpriseBizMapper) {
this.redisUtils = redisUtils;
this.stCommonService = stCommonService;
this.tzBaseEnterpriseInfoMapper = tzBaseEnterpriseInfoMapper;
this.enterpriseBizMapper = enterpriseBizMapper;
}
public IPage<TzBaseEnterpriseInfoDto> page(PageParam pageParam, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto) {
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
......@@ -13,6 +21,9 @@ import java.util.List;
@Service
public class EquipmentBizServiceImpl {
// 一码通复制功能url参数key
private static final String COPY_KEY = "stashType";
private final EquipmentCategoryMapper equipmentCategoryMapper;
public EquipmentBizServiceImpl(EquipmentCategoryMapper equipmentCategoryMapper) {
......@@ -31,4 +42,281 @@ public class EquipmentBizServiceImpl {
List<EquipmentCategory> equipmentCategories = equipmentCategoryMapper.selectList(wrapper2);
return equipmentCategories;
}
public Map<String, Object> getFormRecordByIdMap(Map<String, Object> map) {
String alias = String.valueOf(map.get("alias"));
if (ObjectUtils.isEmpty(alias)) {
return new HashMap<>();
}
EquipmentTypeEnum equipmentMessage = EquipmentTypeEnum.getEnumByCode(alias);
if (equipmentMessage == null && ObjectUtils.isEmpty(equipmentMessage)) {
return new HashMap<>();
}
HashMap<String, Map<String, Object>> result = new HashMap<>();
// 使用信息
Map<String, Object> useInfo = getUseInfo(map);
result.put(equipmentMessage.getUseInfo(), useInfo);
// 设计信息
Map<String, Object> desInfo = getDesInfo(map);
result.put(equipmentMessage.getDesInfo(), desInfo);
// 监督管理信息
Map<String, Object> supInfo = getSupInfo(map);
if(!ValidationUtil.isEmpty(supInfo.get("produceDate"))){
LocalDate produceDate = LocalDate.parse(supInfo.get("produceDate").toString().substring(0, 10), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDate localDate = LocalDate.now().minusYears(15);
if(produceDate.isBefore(localDate)){
supInfo.put("OVER_FIFTEEN_YEARS","0");
}else{
supInfo.put("OVER_FIFTEEN_YEARS","1");
}
}
if ("1".equals(useInfo.get("IS_NOT_XIXIAN"))) {
supInfo.put("CITY", "咸阳");
} else {
supInfo.put("CITY", useInfo.get("CITY_NAME"));
}
result.put(equipmentMessage.getSupInfo(), supInfo);
// 施工信息
Map<String, Object> comInfo = getComInfo(map);
result.put(equipmentMessage.getComInfo(), comInfo);
// 维保信息(只有电梯有)
if (!ObjectUtils.isEmpty(map) && EquipmentTypeEnum.DT.getCode().equals(alias)) {
Map<String, Object> mainInfo = getMainInfo(map);
result.put(equipmentMessage.getMainInfo(), mainInfo);
}
// 检验检测信息
Map<String, Object> insInfo = getInsInfo(map);
result.put(equipmentMessage.getInsInfo(), insInfo);
// 注册信息
Map<String, Object> jriInfo = getJriInfo(map, equipmentMessage);
result.put(equipmentMessage.getJriInfo(), jriInfo);
if (!ObjectUtils.isEmpty(map.get(COPY_KEY))) {
result.get(EquipmentTypeEnum.DT.getSupInfo()).remove("CLAIM_STATUS");
result.get(EquipmentTypeEnum.DT.getSupInfo()).remove("CODE96333");
result.get(EquipmentTypeEnum.DT.getSupInfo()).remove("SUPERVISORY_CODE");
}
Map<String,Object> resultMapNew = new HashMap<>();
result.forEach((key, value) -> {
resultMapNew.putAll(value);
});
return resultMapNew;
}
/**
* 使用信息
*
* @param map
* @return
*/
private Map<String, Object> getUseInfo(Map<String, Object> map) {
Map<String, Object> useInfo = equipmentCategoryMapper.selectTzsUseInfo(String.valueOf(map.get("id")));
if (ObjectUtils.isEmpty(useInfo)) {
return new HashMap<>();
}
useInfo.put("LONGITUDE_LATITUDE", JSON.parse(String.valueOf(useInfo.get("LONGITUDE_LATITUDE"))));
return useInfo;
}
/**
* 施工信息
*
* @param map
* @return
*/
private Map<String, Object> getComInfo(Map<String, Object> map) {
List<Map<String, Object>> comList = equipmentCategoryMapper.selectTzsConInfo(String.valueOf(map.get("id")));
if (ObjectUtils.isEmpty(comList)) {
return new HashMap<>();
}
HashMap<String, Object> comMap = new HashMap<>();
comList.forEach(item -> {
if (!comMap.containsKey("id")) {
comMap.put("id", item.get("RECORD"));
}
if (!comMap.containsKey("sequenceNbr")) {
comMap.put("sequenceNbr", item.get("SEQUENCE_NBR"));
}
item.put("Symbol_key", item.get("SEQUENCE_NBR"));
});
comMap.put("subForm_b2x2wmcy2s", comList);
return comMap;
}
/**
* 设计信息
*
* @param map
* @return
*/
private Map<String, Object> getDesInfo(Map<String, Object> map) {
Map<String, Object> desInfo = equipmentCategoryMapper.selectTzsDesInfo(String.valueOf(map.get("id")));
if (ObjectUtils.isEmpty(desInfo)) {
return new HashMap<>();
}
desInfo.put("DESIGN_DOC", JSON.parseArray(String.valueOf(desInfo.get("DESIGN_DOC"))));
desInfo.put("SUPERVISION_AGENCY_CREDENTIAL", JSON.parseArray(String.valueOf(desInfo.get("SUPERVISION_AGENCY_CREDENTIAL"))));
desInfo.put("INS_USE_MAINTAIN_EXPLAIN", JSON.parseArray(String.valueOf(desInfo.get("INS_USE_MAINTAIN_EXPLAIN"))));
desInfo.put("TYPE_TEST_CREDENTIAL", JSON.parseArray(String.valueOf(desInfo.get("TYPE_TEST_CREDENTIAL"))));
desInfo.put("FACTORY_STANDARD", JSON.parseArray(String.valueOf(desInfo.get("FACTORY_STANDARD"))));
desInfo.put("DESIGN_STANDARD", JSON.parseArray(String.valueOf(desInfo.get("DESIGN_STANDARD"))));
desInfo.put("PRODUCT_QUALITY_YIELD_PROVE", JSON.parseArray(String.valueOf(desInfo.get("PRODUCT_QUALITY_YIELD_PROVE"))));
return desInfo;
}
/**
* 检验检测信息
*
* @param map
* @return
*/
private Map<String, Object> getInsInfo(Map<String, Object> map) {
List<Map<String, Object>> InsInfo = equipmentCategoryMapper.selectTzsInsInfo(String.valueOf(map.get("id")));
if (ObjectUtils.isEmpty(InsInfo)) {
return new HashMap<>();
}
HashMap<String, Object> insInfoMap = new HashMap<>();
InsInfo.forEach(item -> {
item.put("INSPECT_REPORT", JSON.parseArray(String.valueOf(item.get("INSPECT_REPORT"))));
if (!insInfoMap.containsKey("id")) {
insInfoMap.put("id", item.get("RECORD"));
}
if (!insInfoMap.containsKey("sequenceNbr")) {
insInfoMap.put("sequenceNbr", item.get("SEQUENCE_NBR"));
}
item.put("Symbol_key", item.get("SEQUENCE_NBR"));
});
insInfoMap.put("subForm_pbim1pfid8", InsInfo);
return insInfoMap;
}
/**
* 维保信息
*
* @param map
* @return
*/
private Map<String, Object> getMainInfo(Map<String, Object> map) {
List<Map<String, Object>> mainInfo = equipmentCategoryMapper.selectTzsMainInfo(String.valueOf(map.get("id")));
if (ObjectUtils.isEmpty(mainInfo)) {
return new HashMap<>();
}
HashMap<String, Object> mainInfoMap = new HashMap<>();
mainInfo.forEach(item -> {
item.put("REPAIR_INFORM", JSON.parseArray(String.valueOf(item.get("REPAIR_INFORM"))));
if (!mainInfoMap.containsKey("id")) {
mainInfoMap.put("id", item.get("RECORD"));
}
if (!mainInfoMap.containsKey("sequenceNbr")) {
mainInfoMap.put("sequenceNbr", item.get("SEQUENCE_NBR"));
}
item.put("Symbol_key", item.get("SEQUENCE_NBR"));
});
mainInfoMap.put("subForm_6i16fox27e", mainInfo);
return mainInfoMap;
}
/**
* 监督管理信息
*
* @param map
* @return
*/
private Map<String, Object> getSupInfo(Map<String, Object> map) {
Map<String, Object> supInfo = equipmentCategoryMapper.selectTzsSupInfo(String.valueOf(map.get("id")));
return supInfo;
}
/**
* 注册信息
*
* @param map
* @return
*/
private Map<String, Object> getJriInfo(Map<String, Object> map, EquipmentTypeEnum equipmentMessage) {
Map<String, Object> result;
switch (equipmentMessage.getCode()) {
case "3000":
// 电梯
result = equipmentCategoryMapper.selectTzsqzjJriInfo(String.valueOf(map.get("id")), equipmentMessage.getTableName());
if (ObjectUtils.isEmpty(result)) {
return new HashMap<>();
}
result.put("EXPLOSIONPROOF_SIGN_COMPLETE", JSON.parseArray(String.valueOf(result.get("EXPLOSIONPROOF_SIGN_COMPLETE"))));
break;
case "4000":
// 起重机械
result = equipmentCategoryMapper.selectTzsqzjJriInfo(String.valueOf(map.get("id")), equipmentMessage.getTableName());
if (ObjectUtils.isEmpty(result)) {
return new HashMap<>();
}
List<Map<String, Object>> lbjJriInfo = equipmentCategoryMapper.selectTzslbjJriInfo(String.valueOf(map.get("id")));
List<Map<String, Object>> aqfjJriInfo = equipmentCategoryMapper.selectTzsaqfjJriInfo(String.valueOf(map.get("id")));
result.put("subForm_bqirdyvztt", lbjJriInfo);
result.put("subForm_29yy3pdzhl", aqfjJriInfo);
result.put("subForm_h5h4x0zhur", aqfjJriInfo);
break;
case "5000":
// 厂车
result = equipmentCategoryMapper.selectTzsqzjJriInfo(String.valueOf(map.get("id")), equipmentMessage.getTableName());
if (ObjectUtils.isEmpty(result)) {
return new HashMap<>();
}
List<Map<String, Object>> celbjJriInfo = equipmentCategoryMapper.selectTzslbjJriInfo(String.valueOf(map.get("id")));
result.put("subForm_sey164b51a", celbjJriInfo);
result.put("subForm_tef7yf5fbr", celbjJriInfo);
break;
case "1000":
// 锅炉
result = equipmentCategoryMapper.selectTzsqzjJriInfo(String.valueOf(map.get("id")), equipmentMessage.getTableName());
if (ObjectUtils.isEmpty(result)) {
return new HashMap<>();
}
List<Map<String, Object>> glaqfjJriInfo = equipmentCategoryMapper.selectTzsaqfjJriInfo(String.valueOf(map.get("id")));
result.put("subForm_1hh88r4m69", glaqfjJriInfo);
break;
case "2000":
// 压力容器
result = equipmentCategoryMapper.selectTzsqzjJriInfo(String.valueOf(map.get("id")), equipmentMessage.getTableName());
if (ObjectUtils.isEmpty(result)) {
return new HashMap<>();
}
List<Map<String, Object>> ylrqaqfjJriInfo = equipmentCategoryMapper.selectTzsaqfjJriInfo(String.valueOf(map.get("id")));
List<Map<String, Object>> ylrqjJriInfo = equipmentCategoryMapper.selectTzslbjJriInfo(String.valueOf(map.get("id")));
result.put("subForm_fie04854f2", ylrqjJriInfo);
result.put("subForm_d4xdzhsgdj", ylrqaqfjJriInfo);
break;
case "8000":
// 压力容器
result = equipmentCategoryMapper.selectTzsqzjJriInfo(String.valueOf(map.get("id")), equipmentMessage.getTableName());
if (ObjectUtils.isEmpty(result)) {
return new HashMap<>();
}
List<Map<String, Object>> ylgdjJriInfo = equipmentCategoryMapper.selectTzslbjJriInfo(String.valueOf(map.get("id")));
result.put("subForm_9n7nu55z8r", ylgdjJriInfo);
break;
case "6000":
// 游乐设施
result = equipmentCategoryMapper.selectTzsqzjJriInfo(String.valueOf(map.get("id")), equipmentMessage.getTableName());
if (ObjectUtils.isEmpty(result)) {
return new HashMap<>();
}
break;
case "9000":
// 游乐设施
result = equipmentCategoryMapper.selectTzsqzjJriInfo(String.valueOf(map.get("id")), equipmentMessage.getTableName());
if (ObjectUtils.isEmpty(result)) {
return new HashMap<>();
}
List<Map<String, Object>> sdJriLbjInfo = equipmentCategoryMapper.selectTzslbjJriInfo(String.valueOf(map.get("id")));
result.put("subForm_5fi0jewuyh", sdJriLbjInfo);
break;
default:
result = new HashMap<>();
}
result.put("PRODUCT_PHOTO", JSON.parseArray(String.valueOf(result.get("PRODUCT_PHOTO"))));
result.put("USE_REGISTRATION_CERTIFICATE", JSON.parseArray(String.valueOf(result.get("USE_REGISTRATION_CERTIFICATE"))));
result.put("USE_SIGN", JSON.parseArray(String.valueOf(result.get("USE_SIGN"))));
return result;
}
}
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