Commit 17d6fa05 authored by chenzhao's avatar chenzhao

代扣优化项 批量生成 批量上传

parent 03d205a8
...@@ -29,6 +29,8 @@ public interface HygfIcbcRecordMapper extends BaseMapper<HygfIcbcRecord> { ...@@ -29,6 +29,8 @@ public interface HygfIcbcRecordMapper extends BaseMapper<HygfIcbcRecord> {
@UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and") @UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and")
List<HygfIcbcRecordDTO> pageList(@Param ("param") HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO); List<HygfIcbcRecordDTO> pageList(@Param ("param") HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO);
@UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and")
List<HygfIcbcRecordDTO> pageListSum(@Param ("param") HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO);
@UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and") @UserEmpower (field = {"ph.regional_companies_code"}, dealerField = {"ph.developer_code", "ph.regional_companies_code", "ph.developer_user_id"}, fieldConditions = {"in", "in", "in"}, relationship = "and")
List<HygfIcbcRecordExportDTO> exportTotal(String developerCode, String regionalCompaniesCode, String province, String city, String district); List<HygfIcbcRecordExportDTO> exportTotal(String developerCode, String regionalCompaniesCode, String province, String city, String district);
......
...@@ -19,6 +19,8 @@ public interface IcbcWithholdMapper extends BaseMapper<IcbcWithhold> { ...@@ -19,6 +19,8 @@ public interface IcbcWithholdMapper extends BaseMapper<IcbcWithhold> {
public List<IcbcWithholdDto> queryForIcbcWithholdPage( String uploader, String uploadStartTime, String uploadEndTime, String uploadStatus, String confirmator, String confirmationStartTime, String confirmationEndTime,String desc, String withholdStatus); public List<IcbcWithholdDto> queryForIcbcWithholdPage( String uploader, String uploadStartTime, String uploadEndTime, String uploadStatus, String confirmator, String confirmationStartTime, String confirmationEndTime,String desc, String withholdStatus);
public IcbcWithholdDto queryForIcbcWithholdAoumont( String uploader, String uploadStartTime, String uploadEndTime, String uploadStatus, String confirmator, String confirmationStartTime, String confirmationEndTime,String desc, String withholdStatus);
List<IcbcWithholdDto> queryForIcbcWithhold(@Param("dto") IcbcExcelDto icbcExcelDto); List<IcbcWithholdDto> queryForIcbcWithhold(@Param("dto") IcbcExcelDto icbcExcelDto);
List<IcbcWithholdDto> queryForIcbcWithholdBySequenceNbrs(@Param("list") List<String> sequenceNbrList); List<IcbcWithholdDto> queryForIcbcWithholdBySequenceNbrs(@Param("list") List<String> sequenceNbrList);
......
...@@ -161,6 +161,71 @@ ...@@ -161,6 +161,71 @@
ph.rec_date DESC ph.rec_date DESC
</select> </select>
<select id="pageListSum" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO">
SELECT
icbc.sequence_nbr,
ifnull( icbc.cust_name, ph.owners_name ) AS custName,
ifnull( icbc.phone, ph.telephone ) AS phone,
ifnull( icbc.id_card, ph.id_card ) AS idCard,
ph.amos_user_id,
icbc.open_account_status,
icbc.out_user_id as outUserId,
icbc.protocol_status,
icbc.medium_id,
ph.rec_date,
ph.regional_companies_name as regionalCompaniesName,
ph.regional_companies_code as regionalCompaniesCode,
wr.paymentAmount,
wr.payment_time as paymentTime
FROM
(
SELECT
amos_user_id,
MAX(developer_code) AS developer_code,
MAX(regional_companies_code ) AS regional_companies_code ,
MAX(is_delete) AS is_delete,
MAX(owners_name) AS owners_name,
MAX(telephone) AS telephone,
MAX(id_card) AS id_card,
MAX(regional_companies_name) AS regional_companies_name,
MAX(project_address) AS project_address,
MAX(rec_date) AS rec_date
FROM hygf_peasant_household GROUP BY amos_user_id
) ph
LEFT JOIN hygf_icbc_record icbc ON ph.amos_user_id = icbc.amos_user_id
LEFT JOIN ( SELECT amos_user_id, MAX ( payment_time ) payment_time, SUM ( payment_amount ) paymentAmount FROM hygf_icbc_withhold_record WHERE withhold_status = '成功' GROUP BY amos_user_id ) wr ON wr.amos_user_id = icbc.amos_user_id
<where>
ph.is_delete = 0
<if test="param.custName != null and param.custName != ''">
AND (ph.owners_name LIKE CONCAT('%', #{param.custName}, '%') OR icbc.cust_name LIKE CONCAT('%', #{param.custName}, '%'))
</if>
<if test="param.idCard != null and param.idCard != ''">
AND (ph.id_card LIKE CONCAT('%', #{param.idCard}, '%') OR icbc.id_card LIKE CONCAT('%', #{param.idCard}, '%'))
</if>
<if test="param.phone != null and param.phone != ''">
AND (ph.telephone LIKE CONCAT('%', #{param.phone}, '%') OR icbc.phone LIKE CONCAT('%', #{param.phone}, '%'))
</if>
<if test="param.regionalCompaniesName != null and param.regionalCompaniesName != ''">
AND ph.regional_companies_name LIKE CONCAT('%', #{param.regionalCompaniesName}, '%')
</if>
<if test="param.addressName != null and param.addressName != ''">
AND ph.project_address LIKE CONCAT('%', #{param.addressName}, '%')
</if>
<if test="param != null">
<if test="param.openAccountStatus != null and param.openAccountStatus != ''">
<if test="param.openAccountStatus != '00'">
AND icbc.open_account_status = #{param.openAccountStatus}
</if>
<if test="param.openAccountStatus == '00'">
AND (icbc.open_account_status = #{param.openAccountStatus} OR icbc.open_account_status is null)
</if>
</if>
</if>
</where>
</select>
<select id="exportTotal" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO"> <select id="exportTotal" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO">
SELECT SELECT
MAX(ph.owners_name) AS custName, MAX(ph.owners_name) AS custName,
...@@ -212,17 +277,6 @@ ...@@ -212,17 +277,6 @@
</select> </select>
<select id="paymentAmountExport" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO"> <select id="paymentAmountExport" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO">
WITH PaymentAmounts AS (
SELECT
iw.amos_user_id,
SUM(iw.payment_amount) AS paymentAmount
FROM
hygf_icbc_withhold_record iw
WHERE
iw.withhold_status = '成功'
GROUP BY
iw.amos_user_id
)
SELECT SELECT
MAX(ph.owners_name) AS custName, MAX(ph.owners_name) AS custName,
MAX(ph.telephone) AS phone, MAX(ph.telephone) AS phone,
...@@ -251,8 +305,15 @@ ...@@ -251,8 +305,15 @@
`hygf_peasant_household` ph `hygf_peasant_household` ph
LEFT JOIN LEFT JOIN
hygf_icbc_record re ON re.amos_user_id = ph.amos_user_id hygf_icbc_record re ON re.amos_user_id = ph.amos_user_id
LEFT JOIN LEFT JOIN( SELECT
PaymentAmounts pa ON pa.amos_user_id = ph.amos_user_id iw.amos_user_id,
SUM(iw.payment_amount) AS paymentAmount
FROM
hygf_icbc_withhold_record iw
WHERE
iw.withhold_status = '成功'
GROUP BY
iw.amos_user_id) pa ON pa.amos_user_id = ph.amos_user_id
<where> <where>
<if test="param.custName != null and param.custName != ''"> <if test="param.custName != null and param.custName != ''">
AND (ph.owners_name LIKE CONCAT('%', #{param.custName}, '%') OR re.cust_name LIKE CONCAT('%', #{param.custName}, '%')) AND (ph.owners_name LIKE CONCAT('%', #{param.custName}, '%') OR re.cust_name LIKE CONCAT('%', #{param.custName}, '%'))
...@@ -270,7 +331,7 @@ ...@@ -270,7 +331,7 @@
AND ph.project_address LIKE CONCAT('%', #{param.addressName}, '%') AND ph.project_address LIKE CONCAT('%', #{param.addressName}, '%')
</if> </if>
<if test="param.ids != null and param.ids.size() > 0"> <if test="param.ids != null and param.ids.size() > 0">
AND re.amos_user_id in AND ph.amos_user_id in
<foreach collection="param.ids" item="item" open="(" close=")" separator=","> <foreach collection="param.ids" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
......
...@@ -39,6 +39,44 @@ ...@@ -39,6 +39,44 @@
order by hygf_icbc_withhold.sequence_nbr desc order by hygf_icbc_withhold.sequence_nbr desc
</select> </select>
<select id="queryForIcbcWithholdAoumont" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdDto">
select sum(payment_amount) paymentAmount
from hygf_icbc_withhold
<where>
is_delete = 0
<if test="uploader != null and uploader != ''">
and uploader like concat('%',#{uploader},'%')
</if>
<if test="uploadStartTime != null and uploadStartTime != ''">
and upload_time > #{uploadStartTime}
</if>
<if test="uploadEndTime != null and uploadEndTime != ''">
and upload_time <![CDATA[<]]> #{uploadEndTime}
</if>
<if test="uploadStatus != null and uploadStatus != ''">
and upload_status = #{uploadStatus}
</if>
<if test="withholdStatus != null and withholdStatus != ''">
and withhold_status = #{withholdStatus}
</if>
<if test="confirmator != null and confirmator != ''">
and confirmator like concat('%',#{confirmator},'%')
</if>
<if test="desc != null and desc != ''">
and content like concat('%',#{desc},'%')
</if>
<if test="confirmationStartTime != null and confirmationStartTime != ''">
and confirmation_time > #{confirmationStartTime}
</if>
<if test="confirmationEndTime != null and confirmationEndTime != ''">
and confirmation_time <![CDATA[<]]> #{confirmationEndTime}
</if>
</where>
</select>
<select id="queryForIcbcWithhold" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdDto"> <select id="queryForIcbcWithhold" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdDto">
select *, select *,
content as desc content as desc
......
...@@ -155,6 +155,7 @@ public class HygfIcbcController extends BaseController { ...@@ -155,6 +155,7 @@ public class HygfIcbcController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "聚富通信息", notes = "聚富通信息") @ApiOperation(httpMethod = "GET",value = "聚富通信息", notes = "聚富通信息")
@GetMapping(value = "/exportExcel") @GetMapping(value = "/exportExcel")
@UserLimits
public void exportData( HttpServletResponse response,HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) { public void exportData( HttpServletResponse response,HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
hygfIcbcService.exportExcel(response,hygfIcbcRecordQueryDTO); hygfIcbcService.exportExcel(response,hygfIcbcRecordQueryDTO);
......
...@@ -178,6 +178,17 @@ public class IcbcWithholdController extends BaseController { ...@@ -178,6 +178,17 @@ public class IcbcWithholdController extends BaseController {
} }
return CommonResponseNewUtil.success(); return CommonResponseNewUtil.success();
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = " 聚富通代扣信息文件生成", notes = " 聚富通代扣信息文件生成")
@PostMapping(value = "/fileGenerations")
@Transactional
public ResponseModel fileGenerationS(@RequestBody List<Long> ids ) throws Exception {
icbcWithholdServiceImpl.fileGenerations(ids);
return CommonResponseNewUtil.success();
}
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
...@@ -187,14 +198,21 @@ public class IcbcWithholdController extends BaseController { ...@@ -187,14 +198,21 @@ public class IcbcWithholdController extends BaseController {
@ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息文件上传", notes = " 聚富通代扣信息文件上传") @ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息文件上传", notes = " 聚富通代扣信息文件上传")
@GetMapping(value = "/sftpUploadAndUnzip") @GetMapping(value = "/sftpUploadAndUnzip")
@Transactional @Transactional
public ResponseModel sftpUploadAndUnzip(List<Map<String,String>> maps) throws Exception { public ResponseModel sftpUploadAndUnzip(String fileUrl,String batchNo) throws Exception {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
for (Map<String, String> map : maps) { icbcWithholdServiceImpl.sftpUploadAndUnzip(fileUrl,batchNo,reginParams.getUserModel().getRealName());
icbcWithholdServiceImpl.sftpUploadAndUnzip(map.get("fileUrl"),map.get("batchNo"),reginParams.getUserModel().getRealName());
}
return CommonResponseNewUtil.success(); return CommonResponseNewUtil.success();
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = " 聚富通代扣信息文件批量上传", notes = " 聚富通代扣信息文件批量上传")
@GetMapping(value = "/sftpUploadAndUnzipFiles")
@Transactional
public ResponseModel sftpUploadAndUnzipFiles(List<Long> ids) throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
icbcWithholdServiceImpl.sftpUploadAndUnzipFiles(ids,reginParams.getUserModel().getRealName());
return CommonResponseNewUtil.success();
}
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
......
...@@ -458,7 +458,7 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc ...@@ -458,7 +458,7 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
public Map<String, Object> queryForPage(int current, int size, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) { public Map<String, Object> queryForPage(int current, int size, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
PageHelper.startPage(current, size); PageHelper.startPage(current, size);
List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.pageList(hygfIcbcRecordQueryDTO); List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.pageList(hygfIcbcRecordQueryDTO);
double sum = list.stream().filter(e->null != e.getPaymentAmount()).mapToDouble(HygfIcbcRecordDTO::getPaymentAmount).sum();
PageInfo<HygfIcbcRecordDTO> page = new PageInfo(list); PageInfo<HygfIcbcRecordDTO> page = new PageInfo(list);
...@@ -468,6 +468,9 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc ...@@ -468,6 +468,9 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
pagenew.setSize(size); pagenew.setSize(size);
pagenew.setRecords(toModels(page.getList())); pagenew.setRecords(toModels(page.getList()));
Map<String, Object> resultMap = BeanUtil.beanToMap(pagenew); Map<String, Object> resultMap = BeanUtil.beanToMap(pagenew);
List<HygfIcbcRecordDTO> list1 = hygfIcbcRecordMapper.pageListSum(hygfIcbcRecordQueryDTO);
double sum = list1.stream().filter(e->null != e.getPaymentAmount()).mapToDouble(HygfIcbcRecordDTO::getPaymentAmount).sum();
resultMap.put("paymentAmountAll",sum); resultMap.put("paymentAmountAll",sum);
return resultMap; return resultMap;
......
...@@ -652,19 +652,14 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -652,19 +652,14 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
Page<IcbcWithholdDto> page = new Page<>(); Page<IcbcWithholdDto> page = new Page<>();
PageHelper.startPage(current,size); PageHelper.startPage(current,size);
List<IcbcWithholdDto> icbcWithholdDtos = this.getBaseMapper().queryForIcbcWithholdPage(uploader,uploadStartTime,uploadEndTime,uploadStatus,confirmator,confirmationStartTime,confirmationEndTime,desc,withholdStatus); List<IcbcWithholdDto> icbcWithholdDtos = this.getBaseMapper().queryForIcbcWithholdPage(uploader,uploadStartTime,uploadEndTime,uploadStatus,confirmator,confirmationStartTime,confirmationEndTime,desc,withholdStatus);
IcbcWithholdDto dto= this.getBaseMapper().queryForIcbcWithholdAoumont(uploader,uploadStartTime,uploadEndTime,uploadStatus,confirmator,confirmationStartTime,confirmationEndTime,desc,withholdStatus);
PageInfo<IcbcWithholdDto> pageInfo = new PageInfo<>(icbcWithholdDtos); PageInfo<IcbcWithholdDto> pageInfo = new PageInfo<>(icbcWithholdDtos);
double sum = icbcWithholdDtos.stream()
.filter(e -> null != e.getPaymentAmount())
.map(e -> Double.parseDouble(e.getPaymentAmount()))
.mapToDouble(Double::doubleValue)
.sum();
page.setSize(pageInfo.getSize()); page.setSize(pageInfo.getSize());
page.setCurrent(pageInfo.getPageNum()); page.setCurrent(pageInfo.getPageNum());
page.setTotal(pageInfo.getTotal()); page.setTotal(pageInfo.getTotal());
page.setRecords(icbcWithholdDtos); page.setRecords(icbcWithholdDtos);
Map<String, Object> resultMap = BeanUtil.beanToMap(page); Map<String, Object> resultMap = BeanUtil.beanToMap(page);
resultMap.put("paymentAmountAll",sum); resultMap.put("paymentAmountAll",dto.getPaymentAmount());
return resultMap; return resultMap;
} }
...@@ -747,7 +742,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -747,7 +742,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
} }
if (CollectionUtil.isNotEmpty(datas)){ if (CollectionUtil.isNotEmpty(datas)){
ExcelUtil.createTemplate(response,icbcWithhold.getBatchNo()+"导出明细",icbcWithhold.getBatchNo()+"人员信息",datas,HygfIcbcWithholdRecordExportDTO.class,null,false); ExcelUtil.createTemplate(response,"付款记录明细","付款记录明细",datas,HygfIcbcWithholdRecordExportDTO.class,null,false);
} }
} }
...@@ -795,4 +790,28 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit ...@@ -795,4 +790,28 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
} }
} }
public void sftpUploadAndUnzipFiles(List<Long> ids, String realName) {
LambdaQueryWrapper<IcbcWithhold> wrapper = new LambdaQueryWrapper<>();
wrapper.in(BaseEntity::getSequenceNbr,ids);
List<IcbcWithhold> icbcWithholds = this.getBaseMapper().selectList(wrapper);
for (IcbcWithhold icbcWithhold : icbcWithholds) {
sftpUploadAndUnzip(icbcWithhold.getUploadFile(),icbcWithhold.getBatchNo(),realName);
}
}
public void fileGenerations(List<Long> ids) {
LambdaQueryWrapper<IcbcWithhold> wrapper = new LambdaQueryWrapper<>();
wrapper.in(BaseEntity::getSequenceNbr,ids);
List<IcbcWithhold> icbcWithholds = this.getBaseMapper().selectList(wrapper);
for (IcbcWithhold icbcWithhold : icbcWithholds) {
try {
fileGeneration(icbcWithhold);
} catch (Exception e) {
e.printStackTrace();
}
}
}
} }
\ No newline at end of file
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