Commit 5a25666e authored by lisong's avatar lisong

添加一码通设备列表导出

parent c853e378
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.util.List;
@Data
public class EquipExportDto {
String ORG_BRANCH_NAME;
String USE_UNIT_NAME;
String EQU_LIST;
String EQU_CATEGORY;
String USE_ORG_CODE;
String CODE96333;
String SUPERVISORY_CODE;
String USE_PLACE;
String EQU_STATE;
String STATUS;
String USE_UNIT_CREDIT_CODE;
String ORG_BRANCH_CODE;
String EQU_CODE;
String EQU_LIST_CODE;
List<String> ids;
String tableName;
}
package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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.UseUnitCreditCodeCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.tzs.api.vo.EquipExportVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
......@@ -45,4 +47,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List<UseUnitCreditCodeCategoryDto> useUnitCreditCodeCategoryCount();
List<EquipExportVo> getEquipExportData (@Param("dto") EquipExportDto dto);
}
package com.yeejoin.amos.boot.module.tzs.api.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class EquipExportVo {
@ExcelProperty(value = "管辖机构", index = 0)
String orgBranchName;
@ExcelProperty(value = "使用单位", index = 1)
String useUnitName;
@ExcelProperty(value = "设备种类", index = 2)
String equList;
@ExcelProperty(value = "设备类别", index = 3)
String equCategory;
@ExcelProperty(value = "使用登记证编号", index = 4)
String useOrgCode;
@ExcelProperty(value = "96333识别码", index = 5)
String code96333;
@ExcelProperty(value = "监管码", index = 6)
String supervisoryCode;
@ExcelProperty(value = "所属区域", index = 7)
String usePlace;
@ExcelProperty(value = "设备状态", index = 8)
String equState;
}
......@@ -316,4 +316,43 @@
GROUP BY ibjui."USE_UNIT_CREDIT_CODE", ibjoi."CLAIM_STATUS",ibjri."EQU_LIST"
ORDER BY ibjui."USE_UNIT_CREDIT_CODE"
</select>
<select id="getEquipExportData" 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.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>
......@@ -6,13 +6,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
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.entity.CategoryOtherInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.tzs.api.vo.EquipExportVo;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -26,6 +29,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
......@@ -297,6 +301,14 @@ public class EquipmentCategoryController extends BaseController {
return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.getTable(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/exportData")
@ApiOperation(httpMethod = "GET", value = "设备信息导出", notes = "设备信息导出")
public void exportData(HttpServletResponse response, EquipExportDto dto) {
List<EquipExportVo> equipExportData = equipmentCategoryServiceImpl.getEquipExportData(dto);
ExcelUtil.createTemplate(response, "设备信息", "设备信息", equipExportData, EquipExportVo.class, null, false);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -10,16 +10,14 @@ import com.google.common.collect.Lists;
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.tzs.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquInfoDto;
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.*;
import com.yeejoin.amos.boot.module.tzs.api.entity.*;
import com.yeejoin.amos.boot.module.tzs.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentCategoryEnum;
import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.tzs.api.mapper.*;
import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.tzs.api.vo.EquipExportVo;
import com.yeejoin.amos.boot.module.tzs.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.tzs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.IdxFeignService;
......@@ -790,6 +788,32 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return list;
}
public List<EquipExportVo> getEquipExportData(EquipExportDto dto){
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)) {
if (LEVEL.equals(level)) {
//企业
dto.setUSE_UNIT_CREDIT_CODE(companyCode);
} else {
//监管单位
dto.setORG_BRANCH_CODE(orgCode);
}
List<EquipExportVo> equipExportData = equipmentCategoryMapper.getEquipExportData(dto);
if (!ObjectUtils.isEmpty(equipExportData) ) {
list.addAll(equipExportData);
}
}
}
return list;
}
/**
* 设备字典,通过设备父类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