Commit 6f34caa8 authored by hekaiwen's avatar hekaiwen

bug3058 新增使用登记按办理日期筛选条件 导出新增登记证来源字段

parent 9fe38b9b
......@@ -60,6 +60,15 @@ public class JgUseRegistrationDto extends BaseDto {
@ApiModelProperty(value = "终审通过时间")
private Date auditPassDate;
@ApiModelProperty(value = "办理日期范围")
private String auditPassDateRange;
@ApiModelProperty(value = "办理日期起始日期")
private Date auditPassDateStart;
@ApiModelProperty(value = "办理日期结束日期")
private Date auditPassDateEnd;
@ApiModelProperty(value = "登记类别")
private String regType;
......
......@@ -31,7 +31,7 @@ public interface JgUseRegistrationMapper extends BaseMapper<JgUseRegistration> {
@Param("dto") JgUseRegistrationDto dto,
@Param("roleIds") List<String> roleIds);
List<RegistrationVo> queryRegistrationInIds(@Param("ids") List<String> ids);
List<RegistrationVo> queryRegistrationInIds(@Param("dto") JgUseRegistrationDto dto);
Map<String, Object> getDetail(@Param("id") String id);
......
......@@ -14,49 +14,52 @@ public class RegistrationVo {
@ExcelProperty(value = "申请日期", index = 1)
String createDate;
@ExcelProperty(value = "登记证来源", index = 2)
String regType;
@ExcelProperty(value = "设备种类", index = 2)
@ExcelProperty(value = "设备种类", index = 3)
String equListName;
@ExcelProperty(value = "设备类别", index = 3)
@ExcelProperty(value = "设备类别", index = 4)
String equCategory;
@ExcelProperty(value = "设备品种", index = 4)
@ExcelProperty(value = "设备品种", index = 5)
String equDefine;
@ExcelProperty(value = "设备代码", index = 5)
@ExcelProperty(value = "设备代码", index = 6)
String equCode;
@ExcelProperty(value = "使用登记证编号", index = 6)
@ExcelProperty(value = "使用登记证编号", index = 7)
String useRegistrationCode;
@ExcelProperty(value = "96333识别码", index = 7)
@ExcelProperty(value = "96333识别码", index = 8)
String code96333;
@ExcelProperty(value = "监管码", index = 8)
@ExcelProperty(value = "监管码", index = 9)
String supervisoryCode;
@ExcelProperty(value = "设备地址", index = 9)
@ExcelProperty(value = "设备地址", index = 10)
String fullAddress;
@ExcelProperty(value = "详细地址", index = 10)
@ExcelProperty(value = "详细地址", index = 11)
String detailedAddress;
@ExcelProperty(value = "使用单位", index = 11)
@ExcelProperty(value = "使用单位", index = 12)
String useUnitName;
@ExcelProperty(value = "接收机构", index = 12)
@ExcelProperty(value = "接收机构", index = 13)
String receiveOrgName;
@ExcelProperty(value = "属地监管部门", index = 13)
@ExcelProperty(value = "属地监管部门", index = 14)
String orgBranchName;
@ExcelProperty(value = "作废原因", index = 14)
@ExcelProperty(value = "作废原因", index = 15)
String cancelReason;
@ExcelProperty(value = "办理状态", index = 15)
@ExcelProperty(value = "办理状态", index = 16)
String status;
@ExcelProperty(value = "办理日期", index = 16)
@ExcelProperty(value = "办理日期", index = 17)
String auditPassDate;
}
......@@ -182,6 +182,9 @@
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if test="dto.dataType == 'supervision' ">
AND (receive_company_code = #{dto.receiveCompanyCode} or transfer_to_user_ids LIKE concat ('%',
#{dto.currentUserId}, '%'))
......@@ -203,19 +206,73 @@
</select>
<select id="queryRegistrationInIds" resultType="com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.RegistrationVo">
<include refid="page-list"/>
select
*
from
(
<include refid="page-list-sub-select"/>
)
<where>
<if test='ids != null'>
and ur.sequence_nbr in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
is_delete = 0
<if test="dto.equList != null and dto.equList != ''">
and equListCode= #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
and equCategoryCode = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
and equDefineCode = #{dto.equDefine}
</if>
<if test="dto.status != null and dto.status != ''">
and status = #{dto.status}
</if>
<if test="dto.applicationDate != null">
and create_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%')
</if>
<if test="dto.equCode != null and dto.equCode != ''">
and equCode like concat('%',#{dto.equCode},'%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
and code96333 like concat('%',#{dto.code96333},'%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
and supervisoryCode like concat('%',#{dto.supervisoryCode},'%')
</if>
<if test="dto.fullAddress != null and dto.fullAddress != ''">
AND fullAddress LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if>
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
AND receive_company_code = #{dto.receiveCompanyCode}
</if>
<if test="dto.useUnitName != null and dto.useUnitName != ''">
and useUnitName like concat('%',#{dto.useUnitName},'%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
and applyNo like concat('%',#{dto.applyNo},'%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and useRegistrationCode like concat('%',#{dto.useRegistrationCode},'%')
</if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if test="dto.dataType == 'supervision' ">
AND (receive_company_code = #{dto.receiveCompanyCode} or transfer_to_user_ids LIKE concat ('%',
#{dto.currentUserId}, '%'))
AND status <![CDATA[<>]]> '使用单位待提交'
</if>
<if test="dto.dataType == 'company' ">
AND (use_unit_credit_code = #{dto.unitCode} or transfer_to_user_ids LIKE concat ('%',#{dto.currentUserId}, '%'))
</if>
</where>
GROUP BY
re.equip_transfer_id
-- GROUP BY
-- re.equip_transfer_id
order by
ur.create_date DESC, ur.apply_no DESC
create_date DESC, applyNo DESC
</select>
<select id="getDetail" resultType="java.util.Map">
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.biz.service.IJgTableDataExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -91,9 +94,18 @@ public class JgTableDataExportController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/registration")
@ApiOperation(httpMethod = "GET", value = "使用登记列表数据导出", notes = "使用登记列表数据导出")
public void registrationExport(HttpServletResponse response, String ids) {
Assert.hasText(ids,"未选择导出数据");
iJgTableDataExportService.registration(response, Arrays.asList(ids.split(",")));
public void registrationExport(HttpServletResponse response, JgUseRegistrationDto dto) {
ReginParams info = getSelectedOrgInfo();
dto.setCurrentUserId(info.getUserModel().getUserId());
if (info.getCompany().getLevel().equals(BaseController.COMPANY_TYPE_COMPANY)) {
dto.setDataType(BaseController.COMPANY_TYPE_COMPANY);
dto.setUnitCode(CompanyTypeEnum.INDIVIDUAL.getName().equals(info.getCompany().getCompanyType()) ?
info.getCompany().getCompanyCode().split("_")[1] : info.getCompany().getCompanyCode());
} else {
dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION);
dto.setReceiveCompanyCode(info.getCompany().getCompanyCode());
}
iJgTableDataExportService.registration(response, dto);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -27,6 +27,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
......@@ -111,6 +113,26 @@ public class JgUseRegistrationController extends BaseController {
dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION);
dto.setReceiveCompanyCode(info.getCompany().getCompanyCode());
}
if (dto.getAuditPassDateRange() != null && !dto.getAuditPassDateRange().isEmpty() && !dto.getAuditPassDateRange().equals("[, ]")) {
String dateRangeStr = dto.getAuditPassDateRange();
String[] dates = dateRangeStr.replace("[", "").replace("]", "").split(", ");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date start = null;
Date end = null;
try {
start = dateFormat.parse(dates[0]);
end = dateFormat.parse(dates[1]);
} catch (ParseException e) {
throw new RuntimeException(e);
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(start);
calendar.add(Calendar.DAY_OF_MONTH, -1);
start = calendar.getTime();
dto.setAuditPassDateStart(start);
dto.setAuditPassDateEnd(end);
}
Page<Map<String, Object>> list = jgUseRegistrationServiceImpl.getList(dto, sort, page, dto.getRoleIds());
list.getRecords().forEach(x -> {
x.put("companyType", info.getCompany().getCompanyType());
......@@ -252,6 +274,7 @@ public class JgUseRegistrationController extends BaseController {
/**
* 使用登记流程错误数据处理
*
* @param applyNo applyNo
* @return s
*/
......@@ -260,7 +283,7 @@ public class JgUseRegistrationController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "使用登记流程错误数据处理", notes = "使用登记流程错误数据处理")
public ResponseModel<Object> handleErrorForm(@RequestParam("applyNo") String applyNo) {
jgUseRegistrationServiceImpl.handleErrorForm(applyNo);
return ResponseHelper.buildResponse("申请单【"+applyNo+"】处理成功");
return ResponseHelper.buildResponse("申请单【" + applyNo + "】处理成功");
}
......@@ -271,12 +294,13 @@ public class JgUseRegistrationController extends BaseController {
public ResponseModel<Object> saveHistoryEquip(@RequestBody JSONObject map) {
JSONObject firstMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("first")));
JSONObject secondMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("second")));
secondMap.put("type",firstMap.get("type"));
secondMap.put("type", firstMap.get("type"));
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.saveHistoryEquip(secondMap));
}
/**
* 根据使用登记证查询工程装置名称
*
* @param useRegistrationCode 使用登记证
* @return projectContraption
*/
......@@ -287,7 +311,7 @@ public class JgUseRegistrationController extends BaseController {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String companyCode = selectedOrgInfo.getCompany().getCompanyCode();
String companyType = selectedOrgInfo.getCompany().getCompanyType();
String useUnitCreditCode = "个人主体".equals(companyType) && companyCode.contains("_")? companyCode.split("_", 2)[1]
String useUnitCreditCode = "个人主体".equals(companyType) && companyCode.contains("_") ? companyCode.split("_", 2)[1]
: companyCode;
HashMap<String, Object> map = new HashMap<>();
map.put("useRegistrationCode", useRegistrationCode);
......
package com.yeejoin.amos.boot.module.jg.biz.service;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
......@@ -23,7 +25,7 @@ public interface IJgTableDataExportService {
void transfer(HttpServletResponse response, List<String> ids);
void registration(HttpServletResponse response, List<String> ids);
void registration(HttpServletResponse response, JgUseRegistrationDto dto);
void changeRegistrationUnit(HttpServletResponse response, List<String> ids);
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.*;
import com.yeejoin.amos.boot.module.jg.biz.service.IJgTableDataExportService;
......@@ -16,6 +17,10 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
......@@ -226,11 +231,37 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 使用登记列表数据导出
*
* @param response 响应
* @param ids 数据id
* @param dto 筛选面板数据
*/
@Override
public void registration(HttpServletResponse response, List<String> ids) {
List<RegistrationVo> exportData = registrationMapper.queryRegistrationInIds(ids);
public void registration(HttpServletResponse response, JgUseRegistrationDto dto) {
if (dto.getAuditPassDateRange() != null && !dto.getAuditPassDateRange().isEmpty() && !dto.getAuditPassDateRange().equals("[, ]")) {
String dateRangeStr = dto.getAuditPassDateRange();
String[] dates = dateRangeStr.replace("[", "").replace("]", "").split(", ");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date start = null;
Date end = null;
try {
start = dateFormat.parse(dates[0]);
end = dateFormat.parse(dates[1]);
} catch (ParseException e) {
throw new RuntimeException(e);
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(start);
calendar.add(Calendar.DAY_OF_MONTH, -1); // 减去一天
start = calendar.getTime();
dto.setAuditPassDateStart(start);
dto.setAuditPassDateEnd(end);
}
List<RegistrationVo> exportData = registrationMapper.queryRegistrationInIds(dto);
for (RegistrationVo vo : exportData) {
if (vo.getRegType()== null) {
vo.setRegType("新增登记");
} else if(vo.getRegType().equals("1")){
vo.setRegType("历史登记");
}
}
ExcelUtil.createTemplate(response, "使用登记列表数据", "使用登记列表", exportData, RegistrationVo.class, null, false);
}
......
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