Commit 2ca8f728 authored by huyuchen's avatar huyuchen

派单导出修改

parent ca8c334b
...@@ -336,6 +336,29 @@ public class TDispatchInfoController { ...@@ -336,6 +336,29 @@ public class TDispatchInfoController {
tDispatchInfoService.listExport(response,searchVo); tDispatchInfoService.listExport(response,searchVo);
} }
/**
* 派单审核记录批量导出
* @author huyc
* @date 2022-10-25 15:01:56
**/
@Operation(description = "导出派单审核记录 hasPermission('tdispatchinfo-export')")
@PostMapping("/auditExport")
@PreAuthorize("@pms.hasPermission('tdispatchinfo-export')")
public void auditExport(HttpServletResponse response, @RequestBody TDispatchInfoSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql())) {
if (searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN"));
}
if (searchVo.getAuthSql().contains("1=2 EXISTS")) {
searchVo.setAuthSql(searchVo.getAuthSql().replace("1=2 EXISTS", "EXISTS"));
}
}
searchVo.setCreateBy(user.getId());
tDispatchInfoService.listAuditExport(response,searchVo);
}
/** /**
* 派单信息记录表 批量导入-派减 * 派单信息记录表 批量导入-派减
* *
......
...@@ -52,6 +52,13 @@ public interface TDispatchInfoMapper extends BaseMapper<TDispatchInfo> { ...@@ -52,6 +52,13 @@ public interface TDispatchInfoMapper extends BaseMapper<TDispatchInfo> {
**/ **/
List<TDispatchInfoExportVo> exportDispatch(@Param("tDispatchInfo") TDispatchInfoSearchVo tDispatchInfo); List<TDispatchInfoExportVo> exportDispatch(@Param("tDispatchInfo") TDispatchInfoSearchVo tDispatchInfo);
/**
* @Description: 派单审核导出
* @Author: huyc
* @Date: 2022/10/22 14:45
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchAuditExportVo>
**/
List<TDispatchAuditExportVo> exportAuditDispatch(@Param("tDispatchInfo") TDispatchInfoSearchVo tDispatchInfo);
/** /**
* 导出社保花名册数据查询 * 导出社保花名册数据查询
......
...@@ -52,6 +52,8 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> { ...@@ -52,6 +52,8 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
void listExport(HttpServletResponse response, TDispatchInfoSearchVo searchVo); void listExport(HttpServletResponse response, TDispatchInfoSearchVo searchVo);
void listAuditExport(HttpServletResponse response, TDispatchInfoSearchVo searchVo);
List<TDispatchInfo> noPageDiy(TDispatchInfoSearchVo searchVo); List<TDispatchInfo> noPageDiy(TDispatchInfoSearchVo searchVo);
@Transactional @Transactional
......
...@@ -193,6 +193,65 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -193,6 +193,65 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
} }
@Override
public void listAuditExport(HttpServletResponse response, TDispatchInfoSearchVo searchVo) {
String fileName = "派单审核导出" + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<TDispatchAuditExportVo> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchAuditExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = exportAuditDispatch(searchVo);
if (Common.isNotNull(list)) {
ExcelUtil<TDispatchAuditExportVo> util = new ExcelUtil<>(TDispatchAuditExportVo.class);
for (TDispatchAuditExportVo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("派单审核" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("派单审核" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
@Override @Override
public List<TDispatchInfo> noPageDiy(TDispatchInfoSearchVo searchVo) { public List<TDispatchInfo> noPageDiy(TDispatchInfoSearchVo searchVo) {
LambdaQueryWrapper<TDispatchInfo> wrapper = buildQueryWrapper(searchVo); LambdaQueryWrapper<TDispatchInfo> wrapper = buildQueryWrapper(searchVo);
...@@ -219,6 +278,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -219,6 +278,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return baseMapper.exportDispatch(searchVo); return baseMapper.exportDispatch(searchVo);
} }
private List<TDispatchAuditExportVo> exportAuditDispatch(TDispatchInfoSearchVo searchVo) {
return baseMapper.exportAuditDispatch(searchVo);
}
private Long noPageCountDiy(TDispatchInfoSearchVo searchVo) { private Long noPageCountDiy(TDispatchInfoSearchVo searchVo) {
LambdaQueryWrapper<TDispatchInfo> wrapper = buildQueryWrapper(searchVo); LambdaQueryWrapper<TDispatchInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList; List<String> idList;
...@@ -229,12 +292,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -229,12 +292,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
idList = searchVo.getIdList(); idList = searchVo.getIdList();
wrapper.in(TDispatchInfo::getId, idList); wrapper.in(TDispatchInfo::getId, idList);
} }
if (Common.isNotNull(searchVo.getCreateTimeStart())) {
wrapper.ge(TDispatchInfo::getCreateTime, searchVo.getCreateTimeStart());
}
if (Common.isNotNull(searchVo.getCreateTimeEnd())) {
wrapper.le(TDispatchInfo::getCreateTime, searchVo.getCreateTimeEnd());
}
wrapper.eq(TDispatchInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL); wrapper.eq(TDispatchInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL);
return baseMapper.selectCount(wrapper); return baseMapper.selectCount(wrapper);
} }
......
...@@ -133,7 +133,6 @@ ...@@ -133,7 +133,6 @@
<result property="createTime" column="CREATE_TIME"/> <result property="createTime" column="CREATE_TIME"/>
</resultMap> </resultMap>
<resultMap id="fundSupplementaryMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.FundSupplementaryExportVo"> <resultMap id="fundSupplementaryMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.FundSupplementaryExportVo">
<result property="providentStart" column="PROVIDENT_START"/> <result property="providentStart" column="PROVIDENT_START"/>
<result property="unitProvidengCardinal" column="UNIT_PROVIDENG_CARDINAL"/> <result property="unitProvidengCardinal" column="UNIT_PROVIDENG_CARDINAL"/>
...@@ -145,6 +144,47 @@ ...@@ -145,6 +144,47 @@
<result property="empName" column="EMP_NAME"/> <result property="empName" column="EMP_NAME"/>
</resultMap> </resultMap>
<!-- 派单审核导出vo -->
<resultMap id="exportAuditMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchAuditExportVo">
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="empType" column="EMP_TYPE"/>
<result property="belongUnitName" column="BELONG_UNIT_NAME"/>
<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
<result property="type" column="TYPE"/>
<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="contractStart" column="CONTRACT_START"/>
<result property="contractEnd" column="CONTRACT_END"/>
<result property="trustRemark" column="TRUST_REMARK"/>
<result property="contractName" column="CONTRACT_NAME"/>
<result property="workingHours" column="WORKING_HOURS"/>
<result property="socialReduceDate" column="SOCIAL_REDUCE_DATE"/>
<result property="fundReduceDate" column="FUND_REDUCE_DATE"/>
<result property="leaveDate" column="LEAVE_DATE"/>
<result property="reduceReason" column="REDUCE_REASON"/>
<result property="paymentType" column="PAYMENT_TYPE"/>
<result property="recordBase" column="RECORD_BASE"/>
<result property="unitPensionCardinal" column="UNIT_PENSION_CARDINAL"/>
<result property="unitMedicalCardinal" column="UNIT_MEDICAL_CARDINAL"/>
<result property="unitUnemploymentCardinal" column="UNIT_UNEMPLOYMENT_CARDINAL"/>
<result property="unitWorkInjuryCardinal" column="UNIT_WORK_INJURY_CARDINAL"/>
<result property="unitBirthCardinal" column="UNIT_BIRTH_CARDINAL"/>
<result property="personalPensionCardinal" column="PERSONAL_PENSION_CARDINAL"/>
<result property="personalMedicalCardinal" column="PERSONAL_MEDICAL_CARDINAL"/>
<result property="personalUnemploymentCardinal" column="PERSONAL_UNEMPLOYMENT_CARDINAL"/>
<result property="personalBigailmentMoney" column="PERSONAL_BIGAILMENT_MONEY"/>
<result property="unitBigailmentMoney" column="UNIT_BIGAILMENT_MONEY"/>
<result property="unitProvidengCardinal" column="UNIT_PROVIDENG_CARDINAL"/>
<result property="personalProvidentCardinal" column="PERSONAL_PROVIDENT_CARDINAL"/>
<result property="unitProvidentPer" column="UNIT_PROVIDENT_PER"/>
<result property="personalProvidentPer" column="PERSONAL_PROVIDENT_PER"/>
</resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
a.EMP_ID, a.EMP_ID,
...@@ -434,6 +474,66 @@ ...@@ -434,6 +474,66 @@
</if> </if>
</if> </if>
</sql> </sql>
<sql id="tDispatchInfoAudit_where">
<if test="tDispatchInfo != null">
<if test="tDispatchInfo.idList != null and tDispatchInfo.idList.size >0">
AND a.ID in
<foreach item="idStr" index="index" collection="tDispatchInfo.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="tDispatchInfo.empName != null and tDispatchInfo.empName.trim() != ''">
AND a.EMP_NAME = #{tDispatchInfo.empName}
</if>
<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD = #{tDispatchInfo.empIdcard}
</if>
<if test="tDispatchInfo.settleDomainName != null and tDispatchInfo.settleDomainName.trim() != ''">
AND a.SETTLE_DOMAIN_NAME like CONCAT(#{tDispatchInfo.settleDomainName}, '%')
</if>
<if test="tDispatchInfo.settleDomainCode != null and tDispatchInfo.settleDomainCode.trim() != ''">
AND a.SETTLE_DOMAIN_CODE = #{tDispatchInfo.settleDomainCode}
</if>
<if test="tDispatchInfo.socialProvince != null and tDispatchInfo.socialProvince.trim() != ''">
AND a.SOCIAL_PROVINCE = #{tDispatchInfo.socialProvince}
</if>
<if test="tDispatchInfo.socialCity != null and tDispatchInfo.socialCity.trim() != ''">
AND a.SOCIAL_CITY = #{tDispatchInfo.socialCity}
</if>
<if test="tDispatchInfo.socialTown != null and tDispatchInfo.socialTown.trim() != ''">
AND a.SOCIAL_TOWN = #{tDispatchInfo.socialTown}
</if>
<if test="tDispatchInfo.fundProvince != null and tDispatchInfo.fundProvince.trim() != ''">
AND a.FUND_PROVINCE = #{tDispatchInfo.fundProvince}
</if>
<if test="tDispatchInfo.fundCity != null and tDispatchInfo.fundCity.trim() != ''">
AND a.FUND_CITY = #{tDispatchInfo.fundCity}
</if>
<if test="tDispatchInfo.fundTown != null and tDispatchInfo.fundTown.trim() != ''">
AND a.FUND_TOWN = #{tDispatchInfo.fundTown}
</if>
<if test="tDispatchInfo.createName != null and tDispatchInfo.createName.trim() != ''">
AND a.CREATE_NAME = #{tDispatchInfo.createName}
</if>
<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
AND a.SOCIAL_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.socialHouseholdName}), '%')
</if>
<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
AND a.PROVIDENT_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.providentHouseholdName}), '%')
</if>
<if test="tDispatchInfo.createTimeStart != null">
AND a.CREATE_TIME <![CDATA[ >= ]]> #{tDispatchInfo.createTimeStart}
</if>
<if test="tDispatchInfo.createTimeEnd != null">
AND a.CREATE_TIME <![CDATA[ <= ]]> #{tDispatchInfo.createTimeEnd}
</if>
<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
${tDispatchInfo.authSql}
</if>
</if>
</sql>
<!--tDispatchInfo简单分页查询--> <!--tDispatchInfo简单分页查询-->
<select id="getTDispatchInfoPage" resultMap="dispatchPageMap"> <select id="getTDispatchInfoPage" resultMap="dispatchPageMap">
SELECT SELECT
...@@ -507,6 +607,58 @@ ...@@ -507,6 +607,58 @@
limit #{tDispatchInfo.limitStart},#{tDispatchInfo.limitEnd} limit #{tDispatchInfo.limitStart},#{tDispatchInfo.limitEnd}
</if> </if>
</select> </select>
<!-- 派单审核导出 -->
<select id="exportAuditDispatch" resultMap="exportAuditMap">
select
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_TYPE,
a.BELONG_UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.TYPE,
a.SOCIAL_HOUSEHOLD_NAME,
a.PROVIDENT_HOUSEHOLD_NAME,
a.CREATE_NAME,
a.CREATE_TIME,
a.CONTRACT_START,
a.CONTRACT_END,
a.TRUST_REMARK,
a.CONTRACT_NAME,
a.WORKING_HOURS,
a.SOCIAL_REDUCE_DATE,
a.FUND_REDUCE_DATE,
a.LEAVE_DATE,
a.REDUCE_REASON,
b.PAYMENT_TYPE,
b.RECORD_BASE,
b.UNIT_PENSION_CARDINAL,
b.UNIT_MEDICAL_CARDINAL,
b.UNIT_UNEMPLOYMENT_CARDINAL,
b.UNIT_WORK_INJURY_CARDINAL,
b.UNIT_BIRTH_CARDINAL,
b.PERSONAL_PENSION_CARDINAL,
b.PERSONAL_MEDICAL_CARDINAL,
b.PERSONAL_UNEMPLOYMENT_CARDINAL,
b.PERSONAL_BIGAILMENT_MONEY,
b.UNIT_BIGAILMENT_MONEY,
c.UNIT_PROVIDENG_CARDINAL,
c.PERSONAL_PROVIDENT_CARDINAL,
c.UNIT_PROVIDENT_PER,
c.PERSONAL_PROVIDENT_PER
from t_dispatch_info a
left join t_social_info b on a.SOCIAL_ID = b.ID
left join t_provident_fund c on a.FUND_ID = C.ID
<where>
a.DELETE_FLAG = '0'
<include refid="tDispatchInfo_where"/>
</where>
order by a.CREATE_TIME desc
<if test="tDispatchInfo.limitStart != null">
limit #{tDispatchInfo.limitStart},#{tDispatchInfo.limitEnd}
</if>
</select>
<resultMap id="socialHandleExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.SocialHandleExportVo"> <resultMap id="socialHandleExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.SocialHandleExportVo">
<result property="empName" column="EMP_NAME"/> <result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/> <result property="empIdcard" column="EMP_IDCARD"/>
......
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