Commit c8793d07 authored by lisong's avatar lisong

修改批量导出监管码

parent a2a9da81
package com.yeejoin.amos.boot.module.tzs.api.mapper; package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipExportDto; import com.yeejoin.amos.boot.module.tzs.api.dto.EquipExportDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto; import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.UseUnitCreditCodeCategoryDto; import com.yeejoin.amos.boot.module.tzs.api.dto.UseUnitCreditCodeCategoryDto;
...@@ -50,4 +51,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -50,4 +51,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List<EquipExportVo> getEquipExportData (@Param("dto") EquipExportDto dto); List<EquipExportVo> getEquipExportData (@Param("dto") EquipExportDto dto);
Page<EquipExportVo> exportImageZip (@Param("page")Page<EquipExportVo> page, @Param("dto") EquipExportDto dto);
} }
...@@ -362,4 +362,44 @@ ...@@ -362,4 +362,44 @@
</where> </where>
</select> </select>
<select id="exportImageZip" resultType="com.yeejoin.amos.boot.module.tzs.api.vo.EquipExportVo">
select ORG_BRANCH_NAME as orgBranchName,
USE_UNIT_NAME as useUnitName,
EQU_LIST as equList,
EQU_CATEGORY as equCategory,
USE_ORG_CODE as useOrgCode,
CODE96333 as code96333,
SUPERVISORY_CODE as supervisoryCode,
USE_PLACE as usePlace,
EQU_CODE as equCode,
CASE when EQU_STATE = 0 then '未登记'
when EQU_STATE = 1 then '在用'
when EQU_STATE = 2 then '停用'
when EQU_STATE = 3 then '报废'
when EQU_STATE = 4 then '注销'
ELSE EQU_STATE
END as equState
from ${dto.tableName}
<where>
<if test="dto.CODE96333 != '' and dto.CODE96333 != null">CODE96333 like concat('%', #{dto.CODE96333},'%')</if>
<if test="dto.EQU_CODE != '' and dto.EQU_CODE != null">and EQU_CODE like concat('%', #{dto.EQU_CODE},'%')</if>
<if test="dto.SUPERVISORY_CODE != '' and dto.SUPERVISORY_CODE != null">and SUPERVISORY_CODE like concat('%', #{dto.SUPERVISORY_CODE},'%')</if>
<if test="dto.USE_UNIT_NAME != '' and dto.USE_UNIT_NAME != null">and USE_UNIT_NAME like concat('%', #{dto.USE_UNIT_NAME},'%')</if>
<if test="dto.USE_ORG_CODE != '' and dto.USE_ORG_CODE != null">and USE_ORG_CODE like concat('%', #{dto.USE_ORG_CODE},'%')</if>
<if test="dto.EQU_LIST_CODE != '' and dto.EQU_LIST_CODE != null">and EQU_LIST_CODE = #{dto.EQU_LIST_CODE}</if>
<if test="dto.EQU_STATE != '' and dto.EQU_STATE != null">and EQU_STATE = #{dto.EQU_STATE}</if>
<if test="dto.ORG_BRANCH_NAME != '' and dto.ORG_BRANCH_NAME != null">and ORG_BRANCH_NAME = #{dto.ORG_BRANCH_NAME}</if>
<if test="dto.USE_PLACE != '' and dto.USE_PLACE != null">and USE_PLACE = #{dto.USE_PLACE}</if>
<if test="dto.STATUS != '' and dto.STATUS != null">and STATUS = #{dto.STATUS}</if>
<if test="dto.EQU_CATEGORY != '' and dto.EQU_CATEGORY != null">and EQU_CATEGORY = #{dto.EQU_CATEGORY}</if>
<if test="dto.USE_UNIT_CREDIT_CODE != '' and dto.USE_UNIT_CREDIT_CODE != null">and USE_UNIT_CREDIT_CODE like concat('%', #{dto.USE_UNIT_CREDIT_CODE},'%')</if>
<if test="dto.ORG_BRANCH_CODE != '' and dto.ORG_BRANCH_CODE != null">and ORG_BRANCH_CODE like concat('%', #{dto.ORG_BRANCH_CODE},'%')</if>
<if test='dto.ids != null'> and SEQUENCE_NBR in
<foreach collection="dto.ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
...@@ -397,11 +397,11 @@ public class EquipmentCategoryController extends BaseController { ...@@ -397,11 +397,11 @@ public class EquipmentCategoryController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/exportImageZip") @GetMapping(value = "/exportImageZip")
@ApiOperation(httpMethod = "GET", value = "设备监管码、电梯码批量导出压缩包", notes = "设备监管码、电梯码批量导出压缩包") @ApiOperation(httpMethod = "GET", value = "设备监管码、电梯码批量导出压缩包", notes = "设备监管码、电梯码批量导出压缩包")
public void exportImageZip(HttpServletResponse response, EquipExportDto dto, @RequestParam("type") String type) throws IOException { public void exportImageZip(HttpServletResponse response, EquipExportDto dto, @RequestParam("type") String type, @RequestParam("pageNum") Long pageNum, @RequestParam("size") Long size) throws IOException {
ImageSizeEnums imageSizeEnums = ImageSizeEnums.getEnumByCode(type); ImageSizeEnums imageSizeEnums = ImageSizeEnums.getEnumByCode(type);
//创建list 存放图片 //创建list 存放图片
List<File> fileList = new ArrayList<>(); List<File> fileList = new ArrayList<>();
List<EquipExportVo> equipExportData = equipmentCategoryServiceImpl.getEquipExportData(dto); List<EquipExportVo> equipExportData = equipmentCategoryServiceImpl.exportImageZip(dto, pageNum, size);
List<EquipExportVo> unique = equipExportData.stream().filter(item -> !ObjectUtils.isEmpty(item.getSupervisoryCode())).collect( List<EquipExportVo> unique = equipExportData.stream().filter(item -> !ObjectUtils.isEmpty(item.getSupervisoryCode())).collect(
Collectors.collectingAndThen( Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(EquipExportVo::getSupervisoryCode))), ArrayList::new) Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(EquipExportVo::getSupervisoryCode))), ArrayList::new)
......
...@@ -799,6 +799,35 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -799,6 +799,35 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return list; return list;
} }
public List<EquipExportVo> exportImageZip(EquipExportDto dto, Long pageNum, Long size) {
ArrayList<EquipExportVo> list = new ArrayList<>();
List<JSONObject> objectList = getCompanyType();
if (!ValidationUtil.isEmpty(dto.getEQU_STATE())) {
dto.setEQU_STATE(EquimentEnum.getCode.get(dto.getEQU_STATE()).toString());
}
for (JSONObject object : objectList) {
String level = object.getString("level");
String orgCode = object.getString("orgCode");
String companyCode = object.getString("companyCode");
if (!ValidationUtil.isEmpty(level)) {
Page<EquipExportVo> equipExportVoPage = new Page<>(pageNum, size);
if (LEVEL.equals(level)) {
//企业
dto.setUSE_UNIT_CREDIT_CODE(companyCode);
} else {
//监管单位
dto.setORG_BRANCH_CODE(orgCode);
}
Page<EquipExportVo> equipExportData = equipmentCategoryMapper.exportImageZip(equipExportVoPage, dto);
if (!ObjectUtils.isEmpty(equipExportData) && !ObjectUtils.isEmpty(equipExportData.getRecords())) {
list.addAll(equipExportData.getRecords());
}
}
}
return list;
}
/** /**
* 设备字典,通过设备父类code,获得子类 * 设备字典,通过设备父类code,获得子类
*/ */
......
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