Commit 16d9ad23 authored by hezhuozhi's avatar hezhuozhi

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

parents 8e3d7963 1d674b93
...@@ -4,7 +4,7 @@ import lombok.Data; ...@@ -4,7 +4,7 @@ import lombok.Data;
@Data @Data
public class CylinderFillingRecordStatisticsDto { public class CylinderFillingRecordStatisticsDto {
private String time; private String fillingTime;
private String fillingQuantity; private String fillingQuantity;
private String offloadingVolume; private String offloadingVolume;
} }
...@@ -183,4 +183,7 @@ public class JgUseRegistrationDto extends BaseDto { ...@@ -183,4 +183,7 @@ public class JgUseRegistrationDto extends BaseDto {
@ApiModelProperty(value = " 监察处置机构代码") @ApiModelProperty(value = " 监察处置机构代码")
private String supervisionOrgCode; private String supervisionOrgCode;
@ApiModelProperty(value = "属地监管机构代码")
private String orgBranchCode;
} }
...@@ -273,5 +273,4 @@ public class JgUseRegistration extends BaseEntity { ...@@ -273,5 +273,4 @@ public class JgUseRegistration extends BaseEntity {
*/ */
@TableField("origin_project_contraption_ids") @TableField("origin_project_contraption_ids")
private String originProjectContraptionIds; private String originProjectContraptionIds;
} }
...@@ -73,6 +73,9 @@ ...@@ -73,6 +73,9 @@
<if test="param.useUnitCreditCode != null and param.useUnitCreditCode != ''"> <if test="param.useUnitCreditCode != null and param.useUnitCreditCode != ''">
AND isn.use_unit_credit_code = #{param.useUnitCreditCode} AND isn.use_unit_credit_code = #{param.useUnitCreditCode}
</if> </if>
<if test="param.orgBranchCode != null and param.orgBranchCode != ''">
AND isn.org_branch_code LIKE concat(#{param.orgBranchCode},'%')
</if>
</if> </if>
<if test="type == 'supervision'"> <if test="type == 'supervision'">
<choose> <choose>
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
ur.audit_status as auditStatus, ur.audit_status as auditStatus,
date_format(ur.reg_date,'%Y-%m-%d') as regDate, date_format(ur.reg_date,'%Y-%m-%d') as regDate,
ur.use_unit_name as useUnitName, ur.use_unit_name as useUnitName,
ur.supervision_org_code as supervisionOrgCode,
ur.status, ur.status,
ur.receive_org_name as receiveOrgName, ur.receive_org_name as receiveOrgName,
ur.use_address as place, ur.use_address as place,
...@@ -181,6 +182,9 @@ ...@@ -181,6 +182,9 @@
<if test="dto.useUnitCode != null and dto.useUnitCode != ''"> <if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and use_unit_credit_code = #{dto.useUnitCode} and use_unit_credit_code = #{dto.useUnitCode}
</if> </if>
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
and supervisionOrgCode like concat(#{dto.orgBranchCode},'%')
</if>
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null"> <if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd} AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if> </if>
......
...@@ -98,7 +98,8 @@ ...@@ -98,7 +98,8 @@
tjvi.gas_num as gasNum, tjvi.gas_num as gasNum,
date_format(tjvi.create_date,'%Y-%m-%d') as createDate, date_format(tjvi.create_date,'%Y-%m-%d') as createDate,
tjvi.cancel_reason as cancelReason, tjvi.cancel_reason as cancelReason,
tjvi.reg_type as regType tjvi.reg_type as regType,
tjvi.org_branch_code as orgBranchCode
from tzs_jg_vehicle_information tjvi from tzs_jg_vehicle_information tjvi
</sql> </sql>
......
...@@ -197,6 +197,22 @@ public class CommonController extends BaseController { ...@@ -197,6 +197,22 @@ public class CommonController extends BaseController {
return ResponseHelper.buildResponse(commonService.equipmentClassification(type)); return ResponseHelper.buildResponse(commonService.equipmentClassification(type));
} }
/**
* 设备分类
*
* @param type 1,设备种类 2,设备类别 3,设备品种
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentClassificationByParentCode")
@ApiOperation(httpMethod = "GET", value = "设备分类", notes = "1,设备种类 2,设备类别 3,设备品种")
public ResponseModel<List<EquipmentCategoryDto>> equipmentClassificationByParentCode(@RequestParam(value = "type") String type, @RequestParam(value = "parentCode", required = false) String parentCode) {
return ResponseHelper.buildResponse(commonService.equipmentClassificationByParentCode(type, parentCode));
}
/** /**
* 设备分类 去掉管道分类 * 设备分类 去掉管道分类
* *
...@@ -211,6 +227,18 @@ public class CommonController extends BaseController { ...@@ -211,6 +227,18 @@ public class CommonController extends BaseController {
} }
/** /**
* 根据设备种类code获取设备类别
* @param type 1,设备种类 2,设备类别 3,设备品种
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentClassificationNoPipelineByParentCode")
@ApiOperation(httpMethod = "GET", value = "设备分类", notes = "1,设备种类 2,设备类别 3,设备品种")
public ResponseModel<List<EquipmentCategoryDto>> equipmentClassificationNoPipelineByParentCode(@RequestParam(value = "type") String type, @RequestParam(value = "parentCode", required = false) String parentCode) {
return ResponseHelper.buildResponse(commonService.equipmentClassificationNoPipelineByParentCode(type, parentCode));
}
/**
* 设备品种 * 设备品种
* *
* @param parentId 父级ID * @param parentId 父级ID
...@@ -392,6 +420,19 @@ public class CommonController extends BaseController { ...@@ -392,6 +420,19 @@ public class CommonController extends BaseController {
return ResponseHelper.buildResponse(commonService.getCreatTree()); return ResponseHelper.buildResponse(commonService.getCreatTree());
} }
/**
* 获取当前登录人单位及以下管辖分局树
*
* @return result
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/loginUnitAndBelow/getCreatTree")
@ApiOperation(httpMethod = "GET", value = "获取当前登录人单位及以下管辖分局树", notes = "获取当前登录人单位及以下管辖分局树")
public ResponseModel<Object> loginUnitAndBelowGetTree() {
String orgCode = getSelectedOrgInfo().getCompany().getOrgCode();
return ResponseHelper.buildResponse(commonService.loginUnitAndBelowGetTree(orgCode));
}
/** /**
* 获取管辖分局树 * 获取管辖分局树
......
...@@ -144,7 +144,7 @@ public class JgVehicleInformationController extends BaseController { ...@@ -144,7 +144,7 @@ public class JgVehicleInformationController extends BaseController {
dto.setDataType(BaseController.COMPANY_TYPE_COMPANY); dto.setDataType(BaseController.COMPANY_TYPE_COMPANY);
} else { } else {
dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION); dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION);
dto.setOrgBranchCode(info.getCompany().getOrgCode()); dto.setOrgBranchCode(dto.getOrgBranchCode() != null ? dto.getOrgBranchCode() : info.getCompany().getOrgCode());
} }
Page<Map<String, Object>> list = jgVehicleInformationServiceImpl.getPageList(dto,sort, page, dto.getRoleIds(), client); Page<Map<String, Object>> list = jgVehicleInformationServiceImpl.getPageList(dto,sort, page, dto.getRoleIds(), client);
list.getRecords().forEach(x -> { list.getRecords().forEach(x -> {
......
...@@ -80,6 +80,8 @@ public interface ICommonService { ...@@ -80,6 +80,8 @@ public interface ICommonService {
List<LinkedHashMap> getCreatTree(); List<LinkedHashMap> getCreatTree();
List<LinkedHashMap> loginUnitAndBelowGetTree(String orgCode);
List<LinkedHashMap> getCreatTreeByInstallation(); List<LinkedHashMap> getCreatTreeByInstallation();
List<LinkedHashMap> getCreatTreeByInstallationTree(); List<LinkedHashMap> getCreatTreeByInstallationTree();
...@@ -188,6 +190,8 @@ public interface ICommonService { ...@@ -188,6 +190,8 @@ public interface ICommonService {
*/ */
List<EquipmentCategoryDto> equipmentClassification(String type); List<EquipmentCategoryDto> equipmentClassification(String type);
List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode);
/** /**
* 套打使用标志生成 * 套打使用标志生成
* *
...@@ -241,6 +245,8 @@ public interface ICommonService { ...@@ -241,6 +245,8 @@ public interface ICommonService {
List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type); List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type);
List<EquipmentCategoryDto> equipmentClassificationNoPipelineByParentCode(String type, String parentCode);
List<EquipmentCategoryDto> getEquDefineByParentId(String parentId); List<EquipmentCategoryDto> getEquDefineByParentId(String parentId);
List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode); List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode);
......
...@@ -422,6 +422,13 @@ public class CommonServiceImpl implements ICommonService { ...@@ -422,6 +422,13 @@ public class CommonServiceImpl implements ICommonService {
} }
@Override @Override
public List<LinkedHashMap> loginUnitAndBelowGetTree(String orgCode) {
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE + "_" + orgCode);
// 判断redis是否存在管辖机构树
return !ObjectUtils.isEmpty(result) ? result : creatlLoginUnitAndBelowGetTree(orgCode);
}
@Override
public List<LinkedHashMap> getCreatTreeByInstallation() { public List<LinkedHashMap> getCreatTreeByInstallation() {
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE_ALL); List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE_ALL);
// 判断redis是否存在管辖机构树 // 判断redis是否存在管辖机构树
...@@ -632,6 +639,34 @@ public class CommonServiceImpl implements ICommonService { ...@@ -632,6 +639,34 @@ public class CommonServiceImpl implements ICommonService {
return resultTree; return resultTree;
} }
public List<LinkedHashMap> creatlLoginUnitAndBelowGetTree(String orgCode) {
FeignClientResult tree = privilegeFeginService.queryAgencyTreeForCache(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteTreeData(result, REGULATOR_UNIT);
List<LinkedHashMap> supervisionTree = orgCodeAndBelowGetTree(treeData, orgCode);
List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree);
redisUtils.set(REGULATOR_UNIT_TREE + "_" + orgCode, resultTree);
return resultTree;
}
private List<LinkedHashMap> orgCodeAndBelowGetTree(List<LinkedHashMap> treeData, String orgCode) {
if (treeData != null) {
for (LinkedHashMap node : treeData) {
if (orgCode.equals(node.get("orgCode"))) {
return Collections.singletonList(node);
}
if (node.get("children") != null) {
List<LinkedHashMap> result = orgCodeAndBelowGetTree((List<LinkedHashMap>) node.get("children"), orgCode);
if (!result.isEmpty()) {
return result;
}
}
}
}
return Collections.emptyList();
}
private List<LinkedHashMap> creatReceiveUnitTree(String bizType) { private List<LinkedHashMap> creatReceiveUnitTree(String bizType) {
FeignClientResult tree = privilegeFeginService.queryAgencyTreeForCache(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct()); FeignClientResult tree = privilegeFeginService.queryAgencyTreeForCache(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult(); List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
...@@ -2099,6 +2134,30 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2099,6 +2134,30 @@ public class CommonServiceImpl implements ICommonService {
return result; return result;
} }
/**
* 设备分类
*
* @param type 1,设备种类 2,设备类别 3,设备品种
* .c@return
*/
@Override
public List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode) {
List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyNoStart7ByParentCode(parentCode);
List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) {
case "1":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
case "2":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*00$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
case "3":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0A-Za-z]*[A-Za-z0-9]*[^0]0$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
}
return result;
}
@Override @Override
public List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type) { public List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type) {
List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyNoStart7And8(); List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyNoStart7And8();
...@@ -2118,6 +2177,24 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2118,6 +2177,24 @@ public class CommonServiceImpl implements ICommonService {
} }
@Override @Override
public List<EquipmentCategoryDto> equipmentClassificationNoPipelineByParentCode(String type, String parentCode) {
List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyNoStart7And8ByParentCode(parentCode);
List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) {
case "1":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
case "2":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*00$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
case "3":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0A-Za-z]*[A-Za-z0-9]*[^0]0$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
}
return result;
}
@Override
public List<EquipmentCategoryDto> getEquDefineByParentId(String parentId) { public List<EquipmentCategoryDto> getEquDefineByParentId(String parentId) {
return equipmentCategoryMapper.getEquDefineByParentId(parentId); return equipmentCategoryMapper.getEquDefineByParentId(parentId);
} }
......
...@@ -445,14 +445,16 @@ public class CylinderDPStatisticsServiceImpl { ...@@ -445,14 +445,16 @@ public class CylinderDPStatisticsServiceImpl {
fillingRecord = cylinderInfoMapper.queryFillingRecordByOrgCode(orgCode, LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null); fillingRecord = cylinderInfoMapper.queryFillingRecordByOrgCode(orgCode, LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null);
offloading = cylinderInfoMapper.queryoffloadingByOrgCode(orgCode, LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null); offloading = cylinderInfoMapper.queryoffloadingByOrgCode(orgCode, LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null);
} }
Map<String, String> fillingRecordMap = fillingRecord.stream().collect(Collectors.toMap(CylinderFillingRecordStatisticsDto::getTime, CylinderFillingRecordStatisticsDto::getFillingQuantity)); Map<String, String> fillingRecordMap = fillingRecord.stream().collect(Collectors.toMap(CylinderFillingRecordStatisticsDto::getFillingTime, CylinderFillingRecordStatisticsDto::getFillingQuantity));
Map<String, String> offloadingMap = offloading.stream().collect(Collectors.toMap(CylinderFillingRecordStatisticsDto::getTime, CylinderFillingRecordStatisticsDto::getOffloadingVolume)); Map<String, String> offloadingMap = offloading.stream().collect(Collectors.toMap(CylinderFillingRecordStatisticsDto::getFillingTime, CylinderFillingRecordStatisticsDto::getOffloadingVolume));
List<CylinderFillingRecordStatisticsDto> data = new ArrayList<>(); List<CylinderFillingRecordStatisticsDto> data = new ArrayList<>();
for (String key : times) { for (String key : times) {
CylinderFillingRecordStatisticsDto dayData = new CylinderFillingRecordStatisticsDto(); CylinderFillingRecordStatisticsDto dayData = new CylinderFillingRecordStatisticsDto();
dayData.setTime(key); dayData.setFillingTime(key);
dayData.setFillingQuantity(fillingRecordMap.getOrDefault(key, "0")); String filling = fillingRecordMap.getOrDefault(key, "0");
dayData.setOffloadingVolume(offloadingMap.getOrDefault(key, "0")); dayData.setFillingQuantity(filling.equals("0") ? filling : Double.valueOf(filling).toString());
String offloadingRecord = offloadingMap.getOrDefault(key, "0");
dayData.setOffloadingVolume(offloadingRecord.equals("0") ? offloadingRecord : Double.valueOf(offloadingRecord).toString());
data.add(dayData); data.add(dayData);
} }
return data; return data;
......
...@@ -15,11 +15,15 @@ public class DateUtils { ...@@ -15,11 +15,15 @@ public class DateUtils {
public static Date calculateEndOfMonth(Date currentDate) { public static Date calculateEndOfMonth(Date currentDate) {
LocalDateTime localDateTime = toLocalDateTime(currentDate); LocalDateTime localDateTime = toLocalDateTime(currentDate);
LocalDateTime endOfMonth = localDateTime.with(localDateTime.withDayOfMonth(localDateTime.getMonth().maxLength()) // 获取当前月份的实际天数(考虑闰年)
int lastDay = localDateTime.getMonth().length(localDateTime.toLocalDate().isLeapYear());
// 直接设置为本月最后一天 23:59:59.999
LocalDateTime endOfMonth = localDateTime
.withDayOfMonth(lastDay)
.withHour(23) .withHour(23)
.withMinute(59) .withMinute(59)
.withSecond(59) .withSecond(59)
.withNano(999999999)); .withNano(999_999_999);
return toDate(endOfMonth); return toDate(endOfMonth);
} }
......
...@@ -26,9 +26,15 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -26,9 +26,15 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
@Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' ORDER BY parent_id") @Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' ORDER BY parent_id")
List<EquipmentCategoryDto> selectClassifyNoStart7(); List<EquipmentCategoryDto> selectClassifyNoStart7();
List<EquipmentCategoryDto> selectClassifyNoStart7ByParentCode(@Param("parentCode") String parentCode);
@Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' AND code NOT LIKE '8%' ORDER BY parent_id") @Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' AND code NOT LIKE '8%' ORDER BY parent_id")
List<EquipmentCategoryDto> selectClassifyNoStart7And8(); List<EquipmentCategoryDto> selectClassifyNoStart7And8();
List<EquipmentCategoryDto> selectClassifyNoStart7And8ByParentCode(@Param("parentCode") String parentCode);
@Select("select * from tz_equipment_category where code in('1000','2000','3000','4000','5000','6000','8000','9000')") @Select("select * from tz_equipment_category where code in('1000','2000','3000','4000','5000','6000','8000','9000')")
List<EquipmentCategoryDto> selectClassify(); List<EquipmentCategoryDto> selectClassify();
......
...@@ -682,4 +682,26 @@ ...@@ -682,4 +682,26 @@
AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL ) AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL )
AND "CLAIM_STATUS" = '已认领'; AND "CLAIM_STATUS" = '已认领';
</select> </select>
<select id="selectClassifyNoStart7ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code NOT LIKE '7%'
<if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if>
</where>
ORDER BY parent_id
</select>
<select id="selectClassifyNoStart7And8ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code NOT LIKE '7%' AND code NOT LIKE '8%'
<if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if>
</where>
ORDER BY parent_id
</select>
</mapper> </mapper>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
register.EQU_CODE, register.EQU_CODE,
register.EQU_LIST, register.EQU_LIST,
supervision.ORG_BRANCH_CODE, supervision.ORG_BRANCH_CODE,
(select date_format(di.NEXT_INSPECT_DATE, 'yyyy-mm-dd') from idx_biz_jg_inspection_detection_info di where di."RECORD" = register."RECORD" and di.NEXT_INSPECT_DATE is not null and di."INSPECT_TYPE" <![CDATA[<>]]> '' order by di.REC_DATE desc limit 1) as NEXT_INSPECT_DATE (select date_format(di.NEXT_INSPECT_DATE, 'yyyy-mm-dd') from idx_biz_jg_inspection_detection_info di where di."RECORD" = register."RECORD" and di.NEXT_INSPECT_DATE is not null and di."INSPECT_TYPE" <![CDATA[<>]]> '' order by di.INSPECT_DATE desc limit 1) as NEXT_INSPECT_DATE
FROM FROM
idx_biz_jg_use_info use idx_biz_jg_use_info use
LEFT JOIN idx_biz_jg_register_info register on register.RECORD = use.RECORD LEFT JOIN idx_biz_jg_register_info register on register.RECORD = use.RECORD
......
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