@@ -87,6 +87,7 @@ public class FssPaccountPay extends StringUUIDEntity { | |||
private LocalDateTime enTime; | |||
/*** 出站时间*/ | |||
private LocalDateTime exTime; | |||
private String agentId; | |||
@Column(name = "version") | |||
public String getVersion() { | |||
@@ -382,4 +383,12 @@ public class FssPaccountPay extends StringUUIDEntity { | |||
public void setExTime(LocalDateTime exTime) { | |||
this.exTime = exTime; | |||
} | |||
@Column(name = "agent_id") | |||
public String getAgentId() { | |||
return agentId; | |||
} | |||
public void setAgentId(String agentId) { | |||
this.agentId = agentId; | |||
} | |||
} |
@@ -0,0 +1,99 @@ | |||
package com.qtzl.alterSales.dao.entity.second; | |||
import com.txffp.api.core.dao.entity.AbstractUpdateTimeEntity; | |||
import javax.persistence.Column; | |||
import javax.persistence.Entity; | |||
import javax.persistence.Table; | |||
/** | |||
* 部中心原始流水分类统计; | |||
* @author : zhangxin | |||
* @date : 2024-6-21 | |||
*/ | |||
@Entity | |||
@Table(name="AFL_PACCOUNT_REFUND_COUNT") | |||
public class AflPaccountRefundCount extends AbstractUpdateTimeEntity { | |||
/** 记账日期 */ | |||
private String accountDate ; | |||
/** 渠道编号 */ | |||
private String agentId ; | |||
/** 总条数 */ | |||
private Long numberTotal ; | |||
/** 总金额 */ | |||
private Long moneyTotal ; | |||
/** 已收取金额 */ | |||
private Long collectMoney ; | |||
/** 退款金额 */ | |||
private Long refundMoney ; | |||
public AflPaccountRefundCount() { | |||
} | |||
public AflPaccountRefundCount(String accountDate, String agentId, Long numberTotal, Long moneyTotal, Long collectMoney) { | |||
this.accountDate = accountDate; | |||
this.agentId = agentId; | |||
this.numberTotal = numberTotal; | |||
this.moneyTotal = moneyTotal; | |||
this.collectMoney = collectMoney; | |||
} | |||
/** 记账日期 */ | |||
@Column(name ="ACCOUNT_DATE") | |||
public String getAccountDate(){ | |||
return this.accountDate; | |||
} | |||
/** 记账日期 */ | |||
public void setAccountDate(String accountDate){ | |||
this.accountDate=accountDate; | |||
} | |||
/** 渠道编号 */ | |||
@Column(name ="AGENT_ID") | |||
public String getAgentId(){ | |||
return this.agentId; | |||
} | |||
/** 渠道编号 */ | |||
public void setAgentId(String agentId){ | |||
this.agentId=agentId; | |||
} | |||
/** 总条数 */ | |||
@Column(name ="NUMBER_TOTAL") | |||
public Long getNumberTotal(){ | |||
return this.numberTotal; | |||
} | |||
/** 总条数 */ | |||
public void setNumberTotal(Long numberTotal){ | |||
this.numberTotal=numberTotal; | |||
} | |||
/** 总金额 */ | |||
@Column(name ="MONEY_TOTAL") | |||
public Long getMoneyTotal(){ | |||
return this.moneyTotal; | |||
} | |||
/** 总金额 */ | |||
public void setMoneyTotal(Long moneyTotal){ | |||
this.moneyTotal=moneyTotal; | |||
} | |||
/** 已收取金额 */ | |||
@Column(name ="COLLECT_MONEY") | |||
public Long getCollectMoney(){ | |||
return this.collectMoney; | |||
} | |||
/** 已收取金额 */ | |||
public void setCollectMoney(Long collectMoney){ | |||
this.collectMoney=collectMoney; | |||
} | |||
/** 退款金额 */ | |||
@Column(name ="REFUND_MONEY") | |||
public Long getRefundMoney(){ | |||
return this.refundMoney; | |||
} | |||
/** 退款金额 */ | |||
public void setRefundMoney(Long refundMoney){ | |||
this.refundMoney=refundMoney; | |||
} | |||
} |
@@ -1,11 +1,13 @@ | |||
package com.qtzl.alterSales.dao.repo.jpa.primary; | |||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||
import com.qtzl.alterSales.dao.entity.primary.FssPaccountPay; | |||
import org.springframework.data.jpa.repository.JpaRepository; | |||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
import org.springframework.data.jpa.repository.Query; | |||
import java.util.List; | |||
import java.util.Map; | |||
/*** | |||
* <p> | |||
@@ -14,7 +16,9 @@ import java.util.List; | |||
* @author hou yi | |||
* {@code @date} 2023/10/12 11:42 | |||
**/ | |||
public interface FssPaccountPayRepo extends JpaRepository<FssPaccountPay, String>, JpaSpecificationExecutor<FssPaccountPay> { | |||
public interface FssPaccountPayRepo extends | |||
AbstractJpaRepo<FssPaccountPay, String>, | |||
JpaRepository<FssPaccountPay, String>, JpaSpecificationExecutor<FssPaccountPay> { | |||
/*** | |||
* 根据协议号查询扣款中流水 | |||
@@ -53,4 +57,10 @@ public interface FssPaccountPayRepo extends JpaRepository<FssPaccountPay, String | |||
*/ | |||
@Query("FROM FssPaccountPay WHERE payId IN (?1) ORDER BY chargeTime DESC") | |||
List<FssPaccountPay> findByPayIdIn(List<String> payIds); | |||
@Query(value = "select " + | |||
" DATE_FORMAT(insert_time, '%Y-%m-%d') as accountDate,agent_id as agentId , COUNT(1) as numberTotal ,SUM(receipt_Amt) as moneyTotal ,SUM(CASE WHEN `status` = 1 THEN receipt_Amt ELSE 0 END) as collectMoney ,0 as refundMoney " + | |||
" from fss_paccount_pay where Date(insert_time) = DATE_SUB(CURDATE(),INTERVAL 1 DAY) GROUP BY DATE_FORMAT(insert_time, '%Y-%m-%d'),agent_id ",nativeQuery = true ) | |||
List<Map<String,Object>> findCountTotal(); | |||
} |
@@ -2,8 +2,8 @@ package com.qtzl.alterSales.dao.repo.jpa.primary; | |||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||
import com.qtzl.alterSales.dao.entity.primary.FssPaccountRefund; | |||
import org.springframework.data.jpa.repository.JpaRepository; | |||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
import org.springframework.data.jpa.repository.Query; | |||
import java.util.List; | |||
@@ -20,5 +20,7 @@ public interface FssPaccountRefundRepo extends AbstractJpaRepo<FssPaccountRefund | |||
*/ | |||
List<FssPaccountRefund> findByPayId(String payId); | |||
@Query(value = " select SUM(fpr.refund_Amt) from fss_paccount_refund fpr left join fss_paccount_pay fpp on fpr.pay_id=fpp.pay_id " + | |||
" where fpp.agent_id =?1 and DATE(fpp.insert_time) = ?2 ",nativeQuery = true) | |||
Long findByCountRefundMoney(String agentId, String accountDate); | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.qtzl.alterSales.dao.repo.jpa.second; | |||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||
import com.qtzl.alterSales.dao.entity.second.AflPaccountRefundCount; | |||
import org.springframework.data.jpa.repository.JpaRepository; | |||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
import org.springframework.data.jpa.repository.Query; | |||
/*** | |||
* <p> | |||
* 部中心原始流水统计 | |||
* </p> | |||
**/ | |||
public interface AflPaccountRefundCountRepo extends | |||
AbstractJpaRepo<AflPaccountRefundCount, String>, | |||
JpaRepository<AflPaccountRefundCount, String> , | |||
JpaSpecificationExecutor<AflPaccountRefundCount> { | |||
@Query(value = " SELECT COUNT(1) FROM AFL_PACCOUNT_REFUND_COUNT GROUP BY ACCOUNT_DATE having ACCOUNT_DATE = DATE_SUB(CURDATE(),INTERVAL 1 DAY) ",nativeQuery = true) | |||
Integer findByToDay(); | |||
@Query(" from AflPaccountRefundCount where agentId = ?1 and accountDate=?2") | |||
AflPaccountRefundCount finByDateAndAgentId(String agentId, String accountDate); | |||
} |
@@ -0,0 +1,40 @@ | |||
package com.qtzl.alterSales.manager.handler; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.abstracts.AbstractAfterSalesManager; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountRefundCountFindPageViewRequest; | |||
import com.qtzl.alterSales.manager.service.AflPaccountRefundCountService; | |||
import com.qtzl.alterSales.manager.service.AfterSalesCmd; | |||
import com.txffp.api.core.manager.comm.annotation.ApiHandler; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.Resource; | |||
/** | |||
* 导出部中心原始流水统计信息 | |||
*/ | |||
@Service | |||
@ApiHandler | |||
public class AflPaccountRefundCountExportHandler extends AbstractAfterSalesManager<AflPaccountRefundCountFindPageViewRequest> { | |||
@Resource | |||
AflPaccountRefundCountService aflPaccountRefundCountService; | |||
public AflPaccountRefundCountExportHandler() { | |||
super(AfterSalesCmd.EXPORTPACCOUNTREFUNDCOUNT, AflPaccountRefundCountFindPageViewRequest.class); | |||
} | |||
@Override | |||
public String handleInternal(String filename, AflPaccountRefundCountFindPageViewRequest request) throws ServiceHandleException { | |||
logger.info("选装-导出部中心原始流水统计信息请求参数:{}", request.toString()); | |||
String fileUrl =null; | |||
try { | |||
fileUrl = aflPaccountRefundCountService.export(request, logger); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("导出失败"); | |||
} | |||
return fileUrl; | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
package com.qtzl.alterSales.manager.handler; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.taiji.common.pub.BeanTools; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.qtzl.alterSales.dao.repo.jpa.second.AflPaccountRefundCountRepo; | |||
import com.qtzl.alterSales.manager.abstracts.AbstractAfterSalesManager; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountRefundCountFindPageRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountRefundCountFindPageViewRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountRefundCountFindPageViewResponse; | |||
import com.qtzl.alterSales.manager.service.AfterSalesCmd; | |||
import com.qtzl.alterSales.manager.vo.AflPaccountRefundCountVo; | |||
import com.txffp.api.core.manager.comm.annotation.ApiHandler; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.Resource; | |||
/** | |||
* 查询部中心原始流水统计分页 | |||
*/ | |||
@Service | |||
@ApiHandler | |||
public class AflPaccountRefundCountFindPageHandler extends AbstractAfterSalesManager<AflPaccountRefundCountFindPageViewRequest> { | |||
@Resource | |||
AflPaccountRefundCountRepo aflPaccountRefundCountRepo; | |||
public AflPaccountRefundCountFindPageHandler() { | |||
super(AfterSalesCmd.FINDPAGEPACCOUNTREFUNDCOUNT, AflPaccountRefundCountFindPageViewRequest.class); | |||
} | |||
@Override | |||
public String handleInternal(String filename, AflPaccountRefundCountFindPageViewRequest request) throws ServiceHandleException { | |||
try { | |||
Pagination page =select(request); | |||
return toResponse(page).toJson(); | |||
} catch (Exception e) { | |||
if (e instanceof ServiceHandleException) { | |||
throw e; | |||
} | |||
logger.error("选装-查询部中心原始流水统计查询失败:{}", e.getMessage()); | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("查询部中心原始流水统计失败"); | |||
} | |||
} | |||
private AflPaccountRefundCountFindPageViewResponse toResponse(Pagination pagination) { | |||
final AflPaccountRefundCountFindPageViewResponse response = new AflPaccountRefundCountFindPageViewResponse(); | |||
BeanTools.copyProperties(pagination, response); | |||
if (isEmpty(pagination.getResult())) { | |||
return response; | |||
} | |||
response.setData(pagination.getResult(AflPaccountRefundCountVo.class)); | |||
return response; | |||
} | |||
private Pagination select(AflPaccountRefundCountFindPageViewRequest request) throws ServiceHandleException { | |||
if (request.getPageSize() > 100) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请求每页数量过大 " + request.getPageSize()); | |||
} | |||
AflPaccountRefundCountFindPageRequest queryRequest = new AflPaccountRefundCountFindPageRequest(); | |||
BeanUtil.copyProperties(request, queryRequest); | |||
return aflPaccountRefundCountRepo.page(queryRequest); | |||
} | |||
} |
@@ -0,0 +1,74 @@ | |||
package com.qtzl.alterSales.manager.model.protocol.sales; | |||
import cn.com.taiji.common.pub.dao.HqlBuilder; | |||
import cn.com.taiji.common.repo.request.jpa.JpaPageableDataRequest; | |||
import com.qtzl.alterSales.manager.vo.AflPaccountRefundCountVo; | |||
import org.apache.commons.lang3.StringUtils; | |||
/** | |||
* 查询UI配置管理分页请求 | |||
*/ | |||
public class AflPaccountRefundCountFindPageRequest extends JpaPageableDataRequest<AflPaccountRefundCountVo> { | |||
/** 记账日期 */ | |||
private String accountDate ; | |||
/** 渠道编号 */ | |||
private String agentId ; | |||
/** 渠道名称 */ | |||
private String agentName ; | |||
@Override | |||
public HqlBuilder toSelectHql() { | |||
HqlBuilder builder = new HqlBuilder("SELECT new com.qtzl.alterSales.manager.vo.AflPaccountRefundCountVo(aprc.id, aprc.accountDate, " + | |||
"aprc.agentId, qa.name, aprc.numberTotal," + | |||
" aprc.moneyTotal, aprc.collectMoney,aprc.refundMoney) from AflPaccountRefundCount aprc " + | |||
" left join QtlAgency qa on aprc.agentId = qa.agencyId "); | |||
appendParam(builder); | |||
builder.append(" ORDER BY aprc.accountDate DESC"); | |||
return builder; | |||
} | |||
@Override | |||
public String toCountHql() { | |||
HqlBuilder builder = new HqlBuilder("SELECT COUNT(1) FROM AflPaccountRefundCount aprc left join QtlAgency qa on aprc.agentId = qa.agencyId "); | |||
appendParam(builder); | |||
return builder.toString(); | |||
} | |||
private void appendParam(HqlBuilder builder) { | |||
if (!StringUtils.isEmpty(accountDate)){ | |||
builder.append(" AND aprc.accountDate = :accountDate", accountDate); | |||
} | |||
if (!StringUtils.isEmpty(agentName)){ | |||
builder.append(" AND qa.name LIKE :agentName",like(agentName)); | |||
} | |||
} | |||
public String getAccountDate() { | |||
return accountDate; | |||
} | |||
public void setAccountDate(String accountDate) { | |||
this.accountDate = accountDate; | |||
} | |||
public String getAgentId() { | |||
return agentId; | |||
} | |||
public void setAgentId(String agentId) { | |||
this.agentId = agentId; | |||
} | |||
public String getAgentName() { | |||
return agentName; | |||
} | |||
public void setAgentName(String agentName) { | |||
this.agentName = agentName; | |||
} | |||
} |
@@ -0,0 +1,37 @@ | |||
package com.qtzl.alterSales.manager.model.protocol.sales; | |||
import com.qtzl.alterSales.manager.model.protocol.AbstractAfterSalesPageRequest; | |||
public class AflPaccountRefundCountFindPageViewRequest extends AbstractAfterSalesPageRequest<AflPaccountRefundCountFindPageViewResponse> { | |||
/** 记账日期 */ | |||
private String accountDate ; | |||
/** 渠道编号 */ | |||
private String agentId ; | |||
/** 渠道名称 */ | |||
private String agentName ; | |||
public String getAccountDate() { | |||
return accountDate; | |||
} | |||
public void setAccountDate(String accountDate) { | |||
this.accountDate = accountDate; | |||
} | |||
public String getAgentId() { | |||
return agentId; | |||
} | |||
public void setAgentId(String agentId) { | |||
this.agentId = agentId; | |||
} | |||
public String getAgentName() { | |||
return agentName; | |||
} | |||
public void setAgentName(String agentName) { | |||
this.agentName = agentName; | |||
} | |||
} |
@@ -0,0 +1,7 @@ | |||
package com.qtzl.alterSales.manager.model.protocol.sales; | |||
import com.qtzl.alterSales.manager.model.protocol.AbstractAfterSalesPageResponse; | |||
import com.qtzl.alterSales.manager.vo.AflPaccountRefundCountVo; | |||
public class AflPaccountRefundCountFindPageViewResponse extends AbstractAfterSalesPageResponse<AflPaccountRefundCountVo> { | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.qtzl.alterSales.manager.quartz; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.service.AflPaccountRefundCountService; | |||
import com.qtzl.alterSales.manager.service.FssPaccountPayService; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import javax.annotation.Resource; | |||
/*** | |||
* <p> | |||
* 定时统计部中心原始流水表 | |||
* </p> | |||
**/ | |||
@Component | |||
public class FssPaccountPayCountTask { | |||
private static final Logger log = LoggerFactory.getLogger(FssPaccountPayCountTask.class); | |||
@Resource | |||
private FssPaccountPayService fssPaccountPayService; | |||
@Resource | |||
AflPaccountRefundCountService aflPaccountRefundCountService; | |||
/** | |||
* 定时统计部中心流水数据 | |||
*/ | |||
// @Scheduled(cron = "* */1 * * * ?") | |||
@Scheduled(cron = "0 0 5 ? * *") | |||
public void count(){ | |||
log.info("执行定时统计部中心原始流水表"); | |||
try { | |||
fssPaccountPayService.count(); | |||
} catch (ServiceHandleException e) { | |||
e.printStackTrace(); | |||
} | |||
log.info("执行定时统计部中心原始流水表"); | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountRefundCountFindPageViewRequest; | |||
import org.slf4j.Logger; | |||
public interface AflPaccountRefundCountService { | |||
String export(AflPaccountRefundCountFindPageViewRequest request, Logger logger) throws ServiceHandleException; | |||
void saveFind(String payId); | |||
} |
@@ -0,0 +1,132 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.qtzl.alterSales.dao.entity.primary.FssPaccountPay; | |||
import com.qtzl.alterSales.dao.entity.second.AflPaccountRefundCount; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.FssPaccountPayRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.second.AflPaccountRefundCountRepo; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountRefundCountFindPageRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountRefundCountFindPageViewRequest; | |||
import com.qtzl.alterSales.manager.service.third.ConstantConfig; | |||
import com.qtzl.alterSales.manager.service.third.FmsService; | |||
import com.qtzl.alterSales.manager.tools.ExcelUtils; | |||
import com.qtzl.alterSales.manager.vo.AflPaccountRefundCountVo; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.Resource; | |||
import java.io.File; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
import java.util.List; | |||
@Service | |||
public class AflPaccountRefundCountServiceImpl implements AflPaccountRefundCountService{ | |||
private static final Logger log = LoggerFactory.getLogger(AflPaccountRefundCountServiceImpl.class); | |||
@Resource | |||
AflPaccountRefundCountRepo aflPaccountRefundCountRepo; | |||
@Resource | |||
FssPaccountPayRepo fssPaccountPayRepo; | |||
@Resource | |||
FmsService fmsService; | |||
@Resource | |||
ConstantConfig constantConfig; | |||
@Override | |||
public String export(AflPaccountRefundCountFindPageViewRequest request, Logger logger) throws ServiceHandleException { | |||
String pathFile =null; | |||
try { | |||
AflPaccountRefundCountFindPageRequest queryRequest = new AflPaccountRefundCountFindPageRequest(); | |||
BeanUtil.copyProperties(request, queryRequest); | |||
List<AflPaccountRefundCountVo> aflPaccountRefundCountVos = aflPaccountRefundCountRepo.list(queryRequest); | |||
if (aflPaccountRefundCountVos==null||aflPaccountRefundCountVos.size()==0) { | |||
pathFile = ExcelUtils.export(null, "部中心请款流水统计",constantConfig.getFilePath() ,null, AflPaccountRefundCountVo.class); | |||
} else { | |||
logger.info("选装-部中心请款流水统计导出我进来了"); | |||
pathFile = ExcelUtils.export(null, "部中心请款流水统计",constantConfig.getFilePath(), aflPaccountRefundCountVos, AflPaccountRefundCountVo.class); | |||
} | |||
if (StringUtils.isEmpty(pathFile)){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("部中心请款流水统计导出失败"); | |||
} | |||
String s = null; | |||
try { | |||
s = fmsService.uploadFile(constantConfig.getUploadFile(),pathFile, 90000); | |||
} catch (ServiceHandleException e) { | |||
logger.error("选装-部中心请款流水统计导出失败:{}", e.getMessage()); | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(e.getMessage()); | |||
} | |||
if (StringUtils.isEmpty(s)){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("部中心请款流水统计导出失败"); | |||
} | |||
return s; | |||
} catch (Exception e) { | |||
if (e instanceof ServiceHandleException) { | |||
throw e; | |||
} | |||
logger.error("选装-部中心请款流水统计导出失败:{}", e.getMessage()); | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("部中心请款流水统计导出失败"); | |||
}finally { | |||
File file = null; | |||
try { | |||
file = new File(pathFile); | |||
} catch (Exception e) { | |||
} | |||
if (file!=null){ | |||
file.delete(); | |||
} | |||
} | |||
} | |||
@Override | |||
public void saveFind(String payId) { | |||
if (StringUtils.isEmpty(payId)){ | |||
log.error("请求查询流水信息请求参数为空"); | |||
return; | |||
} | |||
FssPaccountPay fssPaccountPay = fssPaccountPayRepo.findByPayId(payId); | |||
if (fssPaccountPay==null){ | |||
log.error("未查询到流水信息,payId ={}",payId); | |||
return; | |||
} | |||
if (fssPaccountPay.getStatus()==null ||fssPaccountPay.getStatus().equals(1)){ | |||
log.error("查询到流水信息状态为已补缴或状态为空,payId ={},status={}",payId,fssPaccountPay.getStatus()); | |||
return; | |||
} | |||
if (StringUtils.isEmpty(fssPaccountPay.getAgentId())||fssPaccountPay.getInserttime()==null||fssPaccountPay.getReceiptAmt()==null){ | |||
log.error("查询到流水信息渠道id不存在或者插入时间为空或金额为空,payId ={}",payId); | |||
return; | |||
} | |||
String format =null; | |||
try { | |||
format = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(fssPaccountPay.getInserttime()); | |||
} catch (Exception e) { | |||
log.error("查询到流水信息插入时间转换有误,payId ={}",payId); | |||
return; | |||
} | |||
if (StringUtils.isEmpty(format)){ | |||
log.error("查询到流水信息时间日期为空,payId ={}",payId); | |||
return; | |||
} | |||
AflPaccountRefundCount aflPaccountRefundCount =aflPaccountRefundCountRepo.finByDateAndAgentId(fssPaccountPay.getAgentId(),format); | |||
if (aflPaccountRefundCount==null){ | |||
log.error("未查询到部中心原始流水统计信息,AgentId ={},accountDate={}",fssPaccountPay.getAgentId(),format); | |||
return; | |||
} | |||
Long collectMoney = aflPaccountRefundCount.getCollectMoney(); | |||
log.info("查询到流水统计信息已收取金额为,collectMoney ={}",collectMoney); | |||
log.info("查询到流水信息扣款金额为,receiptAmt ={}",fssPaccountPay.getReceiptAmt()); | |||
Long newCollectMoney = collectMoney + fssPaccountPay.getReceiptAmt(); | |||
log.info("查询到流水统计信息最新已收取金额为,newCollectMoney ={}",newCollectMoney); | |||
aflPaccountRefundCount.setCollectMoney(newCollectMoney); | |||
aflPaccountRefundCount.setUpdateTime(LocalDateTime.now()); | |||
aflPaccountRefundCountRepo.save(aflPaccountRefundCount); | |||
} | |||
} |
@@ -3,6 +3,7 @@ package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.qtzl.alterSales.dao.entity.second.AflProductInfo; | |||
import com.qtzl.alterSales.dao.entity.second.AflSignChannelsInfo; | |||
import com.qtzl.alterSales.dao.repo.jpa.second.AflProductInfoRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.second.AflSignChannelsInfoRepo; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
@@ -208,13 +209,13 @@ public class AflProductInfoServiceImpl implements AflProductInfoService{ | |||
if (StringUtils.isEmpty(aflProductInfoImportVo.getChannelName())){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("导入失败,渠道不能为空"); | |||
} | |||
String channelCode= aflSignChannelsInfoRepo.findByChannelName(aflProductInfoImportVo.getChannelName()); | |||
if (StringUtils.isEmpty(channelCode)){ | |||
AflSignChannelsInfo byChannelName = aflSignChannelsInfoRepo.findByChannelName(aflProductInfoImportVo.getChannelName()); | |||
if (byChannelName==null||StringUtils.isEmpty(byChannelName.getChannelCode())){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("导入失败,未查询到渠道信息"); | |||
} | |||
AflProductInfo aflProductInfo = new AflProductInfo(); | |||
BeanUtil.copyProperties(aflProductInfoImportVo,aflProductInfo); | |||
aflProductInfo.setChannelCode(channelCode); | |||
aflProductInfo.setChannelCode(byChannelName.getChannelCode()); | |||
aflProductInfo.setInsertTime(new Date()); | |||
aflProductInfo.setAuditStatus(0); | |||
aflProductInfo.setGroundStatus(0); |
@@ -37,7 +37,8 @@ public class AflSupplementaryPayOrderServiceImpl implements AflSupplementaryPayO | |||
private FssPaccountPayRepo accountPayRepo; | |||
@Resource | |||
private AflBlackInfoManager aflBlackInfoManager; | |||
@Resource | |||
AflPaccountRefundCountService aflPaccountRefundCountService; | |||
@Override | |||
public void notifyHandler(AflSupplementaryNotifyRequest request) throws ServiceHandleException { | |||
// | |||
@@ -75,6 +76,9 @@ public class AflSupplementaryPayOrderServiceImpl implements AflSupplementaryPayO | |||
// 进行是否需要进行返白操作 | |||
userStateHandler(fssPaccountPay, request.getPayId()); | |||
// | |||
//进行统计累加已收款金额 | |||
aflPaccountRefundCountService.saveFind(request.getPayId()); | |||
supplementaryPayOrderRepo.save(supplementaryPayOrder); | |||
accountPayRepo.save(fssPaccountPay); | |||
} |
@@ -143,6 +143,8 @@ public enum AfterSalesCmd implements ApiCmd { | |||
FINDPAGEUSERNOTICEINFO("查询-用户通知分页查询接口", UcServiceType.AFTERSALES), | |||
ADDORUPDATEUSERNOTICEINFO("新增或修改-用户通知新增或修改接口", UcServiceType.AFTERSALES), | |||
UPDATESTATUSUSERNOTICEINFO("新增-用户通知状态修改接口", UcServiceType.AFTERSALES), | |||
FINDPAGEPACCOUNTREFUNDCOUNT("查询-部中心原始流水分页查询接口", UcServiceType.AFTERSALES), | |||
EXPORTPACCOUNTREFUNDCOUNT("导出-部中心原始流水导出接口", UcServiceType.AFTERSALES), | |||
// 部中心用户账户体系相关接口 | |||
SENDSMSCODE("业务短信验证码发送", UcServiceType.AFTERSALES), | |||
BIND("用户绑定手机号", UcServiceType.AFTERSALES), |
@@ -75,6 +75,8 @@ public class ChoiceBillsOperationServiceImpl implements ChoiceBillsOperationServ | |||
private AflSupplementaryPayOrderService supplementaryPayOrderService; | |||
@Resource | |||
private AflWechatSignRepo aflWechatSignRepo; | |||
@Resource | |||
AflPaccountRefundCountService aflPaccountRefundCountService; | |||
// 请不要改这个key | |||
private static final String REDIS_KEY = "PAY_FAIL_"; | |||
@@ -213,6 +215,8 @@ public class ChoiceBillsOperationServiceImpl implements ChoiceBillsOperationServ | |||
pay.setWxPayTime(payTime); | |||
pay.setWxOrderId(payOrder.getOrderNo()); | |||
// | |||
//进行统计累加已收款金额 | |||
aflPaccountRefundCountService.saveFind(pay.getPayId()); | |||
supplementaryPayOrderService.paySuccessNotify(pay.getPayId(), payTime, payOrder.getOrderNo()); | |||
}); | |||
accountPayRepo.saveAll(accountPayList); |
@@ -1,7 +1,6 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.vo.FssPaccountPayVo; | |||
import com.qtzl.alterSales.manager.vo.VehicleAgreementNumBillsVo; | |||
import java.util.List; | |||
@@ -30,4 +29,7 @@ public interface FssPaccountPayService { | |||
* @return 、 | |||
*/ | |||
List<VehicleAgreementNumBillsVo> findByPayId(List<String> payIds); | |||
void count() throws ServiceHandleException; | |||
} |
@@ -1,26 +1,32 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.alibaba.fastjson.JSON; | |||
import com.google.common.collect.Lists; | |||
import com.qtzl.alterSales.dao.entity.primary.AflSupplementaryPayOrder; | |||
import com.qtzl.alterSales.dao.entity.primary.FssPaccountPay; | |||
import com.qtzl.alterSales.dao.entity.primary.WechatBillPayApply; | |||
import com.qtzl.alterSales.dao.entity.second.AflPaccountRefundCount; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.AflSupplementaryPayOrderRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.FssPaccountPayRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.FssPaccountRefundRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.WechatBillPayApplyRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.second.AflPaccountRefundCountRepo; | |||
import com.qtzl.alterSales.manager.enums.VehiclePlateColorEnum; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.vo.AflPaccountRefundCountVo; | |||
import com.qtzl.alterSales.manager.vo.VehicleAgreementNumBillsVo; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.data.domain.Page; | |||
import org.springframework.data.domain.PageRequest; | |||
import org.springframework.data.domain.Sort; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.CollectionUtils; | |||
import javax.annotation.Resource; | |||
import java.time.LocalDateTime; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.UUID; | |||
/*** | |||
* <p> | |||
@@ -32,8 +38,15 @@ import java.util.List; | |||
@Service | |||
public class FssPaccountPayServiceImpl implements FssPaccountPayService { | |||
private static final Logger log = LoggerFactory.getLogger(FssPaccountPayServiceImpl.class); | |||
@Resource | |||
private FssPaccountPayRepo paccountPayRepo; | |||
@Resource | |||
private AflPaccountRefundCountRepo aflPaccountRefundCountRepo; | |||
@Resource | |||
private FssPaccountRefundRepo fssPaccountRefundRepo; | |||
@Resource | |||
private AflSupplementaryPayOrderRepo supplementaryPayOrderRepo; | |||
@Resource | |||
@@ -68,6 +81,36 @@ public class FssPaccountPayServiceImpl implements FssPaccountPayService { | |||
return toVo(paccountPayRepo.findByPayIdIn(payIds)); | |||
} | |||
@Override | |||
public void count() throws ServiceHandleException { | |||
Integer i= aflPaccountRefundCountRepo.findByToDay(); | |||
if (i!=null&&i>0){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+1天记录已存在"); | |||
} | |||
List<Map<String, Object>> countTotal = paccountPayRepo.findCountTotal(); | |||
List<AflPaccountRefundCount> list = new ArrayList<AflPaccountRefundCount>(); | |||
for (Map<String, Object> stringObjectMap : countTotal) { | |||
AflPaccountRefundCount aflPaccountRefundCount = new AflPaccountRefundCount(); | |||
AflPaccountRefundCountVo aflPaccountRefundCountVo = JSON.parseObject(JSON.toJSONString(stringObjectMap), AflPaccountRefundCountVo.class); | |||
System.out.println(aflPaccountRefundCountVo.toString()); | |||
BeanUtils.copyProperties(aflPaccountRefundCountVo,aflPaccountRefundCount); | |||
list.add(aflPaccountRefundCount); | |||
} | |||
if (list==null||list.size()<1){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+1天记录无数据"); | |||
} | |||
log.info("本次处理数据:{}", JSON.toJSON(list)); | |||
for (AflPaccountRefundCount aflPaccountRefundCount : list) { | |||
Long refundMoney = fssPaccountRefundRepo.findByCountRefundMoney(aflPaccountRefundCount.getAgentId(),aflPaccountRefundCount.getAccountDate()); | |||
aflPaccountRefundCount.setRefundMoney(refundMoney); | |||
aflPaccountRefundCount.setId(UUID.randomUUID().toString().replace("-", "")); | |||
aflPaccountRefundCount.setUpdateTime(LocalDateTime.now()); | |||
aflPaccountRefundCount.setInsertTime(LocalDateTime.now()); | |||
aflPaccountRefundCountRepo.save(aflPaccountRefundCount); | |||
} | |||
} | |||
private List<VehicleAgreementNumBillsVo> toVo(List<FssPaccountPay> payList) { | |||
if (CollectionUtils.isEmpty(payList)) { | |||
return Lists.newArrayList(); |
@@ -0,0 +1,130 @@ | |||
package com.qtzl.alterSales.manager.vo; | |||
import cn.com.taiji.common.entity.BaseEntity; | |||
import com.qtzl.alterSales.manager.model.protocol.center.excel.ExcelExport; | |||
/** | |||
* 部中心原始流水分类统计Vo; | |||
* @author : zhangxin | |||
* @date : 2024-6-21 | |||
*/ | |||
public class AflPaccountRefundCountVo extends BaseEntity { | |||
private String id; | |||
/** 记账日期 */ | |||
@ExcelExport("记账日期") | |||
private String accountDate ; | |||
/** 渠道编号 */ | |||
@ExcelExport("渠道编号") | |||
private String agentId ; | |||
/** 渠道名称 */ | |||
@ExcelExport("渠道名称") | |||
private String agentName ; | |||
/** 总条数 */ | |||
@ExcelExport("总条数") | |||
private Long numberTotal ; | |||
/** 总金额 */ | |||
@ExcelExport("总金额") | |||
private Long moneyTotal ; | |||
/** 已收取金额 */ | |||
@ExcelExport("已收取金额") | |||
private Long collectMoney ; | |||
/** 退款金额 */ | |||
@ExcelExport("退款金额") | |||
private Long refundMoney ; | |||
public AflPaccountRefundCountVo() { | |||
} | |||
public AflPaccountRefundCountVo(String id, String accountDate, String agentId, String agentName, Long numberTotal, Long moneyTotal, Long collectMoney, Long refundMoney) { | |||
this.id = id; | |||
this.accountDate = accountDate; | |||
this.agentId = agentId; | |||
this.agentName = agentName; | |||
this.numberTotal = numberTotal; | |||
this.moneyTotal = moneyTotal; | |||
this.collectMoney = collectMoney; | |||
this.refundMoney = refundMoney; | |||
} | |||
public String getId() { | |||
return id; | |||
} | |||
public void setId(String id) { | |||
this.id = id; | |||
} | |||
public String getAgentName() { | |||
return agentName; | |||
} | |||
public void setAgentName(String agentName) { | |||
this.agentName = agentName; | |||
} | |||
/** 记账日期 */ | |||
public String getAccountDate(){ | |||
return this.accountDate; | |||
} | |||
/** 记账日期 */ | |||
public void setAccountDate(String accountDate){ | |||
this.accountDate=accountDate; | |||
} | |||
/** 渠道编号 */ | |||
public String getAgentId(){ | |||
return this.agentId; | |||
} | |||
/** 渠道编号 */ | |||
public void setAgentId(String agentId){ | |||
this.agentId=agentId; | |||
} | |||
/** 总条数 */ | |||
public Long getNumberTotal() { | |||
return numberTotal; | |||
} | |||
public void setNumberTotal(Long numberTotal) { | |||
this.numberTotal = numberTotal; | |||
} | |||
public Long getMoneyTotal() { | |||
return moneyTotal; | |||
} | |||
public void setMoneyTotal(Long moneyTotal) { | |||
this.moneyTotal = moneyTotal; | |||
} | |||
public Long getCollectMoney() { | |||
return collectMoney; | |||
} | |||
public void setCollectMoney(Long collectMoney) { | |||
this.collectMoney = collectMoney; | |||
} | |||
public Long getRefundMoney() { | |||
return refundMoney; | |||
} | |||
public void setRefundMoney(Long refundMoney) { | |||
this.refundMoney = refundMoney; | |||
} | |||
@Override | |||
public String toString() { | |||
return "AflPaccountRefundCountVo{" + | |||
"id='" + id + '\'' + | |||
", accountDate='" + accountDate + '\'' + | |||
", agentId='" + agentId + '\'' + | |||
", agentName='" + agentName + '\'' + | |||
", numberTotal=" + numberTotal + | |||
", moneyTotal=" + moneyTotal + | |||
", collectMoney=" + collectMoney + | |||
", refundMoney=" + refundMoney + | |||
'}'; | |||
} | |||
} |