소스 검색

新增接口维护

shuiqilin
zhangxin 1 년 전
부모
커밋
74847100b2

+ 43
- 0
src/main/java/com/qtzl/alterSales/manager/handler/AflMaintenanceFssPaccountPayCountHandler.java 파일 보기

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.NoAttributeResponse;
import com.qtzl.alterSales.manager.model.protocol.sales.AflMaintenanceFssPaccountPayCountRequest;
import com.qtzl.alterSales.manager.service.AfterSalesCmd;
import com.qtzl.alterSales.manager.service.FssPaccountPayService;
import com.txffp.api.core.manager.comm.annotation.ApiHandler;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* 维护定时统计部中心原始流水
* @author zhangxin
*/
@Service
@ApiHandler
public class AflMaintenanceFssPaccountPayCountHandler extends AbstractAfterSalesManager<AflMaintenanceFssPaccountPayCountRequest> {

@Resource
FssPaccountPayService fssPaccountPayService;

public AflMaintenanceFssPaccountPayCountHandler() {
super(AfterSalesCmd.MAINTENANCEFSSPACCOUNTPAYCOUNT, AflMaintenanceFssPaccountPayCountRequest.class);
}

@Override
public String handleInternal(String filename, AflMaintenanceFssPaccountPayCountRequest aflMaintenanceFssPaccountPayCountRequest) throws ServiceHandleException {
logger.info("维护定时统计部中心原始流水进行中");
int number=0;
if (aflMaintenanceFssPaccountPayCountRequest!=null&&aflMaintenanceFssPaccountPayCountRequest.getDayNum()>0){
logger.info("维护定时统计部中心原始流水进行中 dayNUm="+aflMaintenanceFssPaccountPayCountRequest.getDayNum());
for (int dayNum = aflMaintenanceFssPaccountPayCountRequest.getDayNum(); dayNum > 0; dayNum--) {
fssPaccountPayService.newCount(dayNum);
number++;
}
logger.info("维护定时统计部中心原始流水完成");
}
return new NoAttributeResponse().toJson();
}
}

+ 19
- 0
src/main/java/com/qtzl/alterSales/manager/model/protocol/sales/AflMaintenanceFssPaccountPayCountRequest.java 파일 보기

package com.qtzl.alterSales.manager.model.protocol.sales;

import cn.com.taiji.common.model.BaseModel;

/**
* @author zhangxin
*/
public class AflMaintenanceFssPaccountPayCountRequest extends BaseModel {

private int dayNum;

public int getDayNum() {
return dayNum;
}

public void setDayNum(int dayNum) {
this.dayNum = dayNum;
}
}

+ 1
- 0
src/main/java/com/qtzl/alterSales/manager/service/AfterSalesCmd.java 파일 보기

FINDBYIDORDERINFO("查询-订单信息管理详情查询接口", UcServiceType.AFTERSALES), FINDBYIDORDERINFO("查询-订单信息管理详情查询接口", UcServiceType.AFTERSALES),
EXPORTORDERINFO("导出-订单信息管理导出接口", UcServiceType.AFTERSALES), EXPORTORDERINFO("导出-订单信息管理导出接口", UcServiceType.AFTERSALES),
VEHICLESTATUSLISTCHANGE("下黑或反白-车辆状态名单下黑或放反白接口", UcServiceType.AFTERSALES), VEHICLESTATUSLISTCHANGE("下黑或反白-车辆状态名单下黑或放反白接口", UcServiceType.AFTERSALES),
MAINTENANCEFSSPACCOUNTPAYCOUNT("维护定时统计部中心原始流水-更新", UcServiceType.AFTERSALES),
// 部中心用户账户体系相关接口 // 部中心用户账户体系相关接口
SENDSMSCODE("业务短信验证码发送", UcServiceType.AFTERSALES), SENDSMSCODE("业务短信验证码发送", UcServiceType.AFTERSALES),
BIND("用户绑定手机号", UcServiceType.AFTERSALES), BIND("用户绑定手机号", UcServiceType.AFTERSALES),

+ 1
- 0
src/main/java/com/qtzl/alterSales/manager/service/FssPaccountPayService.java 파일 보기



void count(int day) throws ServiceHandleException; void count(int day) throws ServiceHandleException;


void newCount(int day) throws ServiceHandleException;
} }

+ 95
- 0
src/main/java/com/qtzl/alterSales/manager/service/FssPaccountPayServiceImpl.java 파일 보기

} }
} }



/**
* 更新统计
* @param day
* @throws ServiceHandleException
*/
@Override
public void newCount(int day) throws ServiceHandleException {
// 获取当前日期前一天的日期
//1代表提前多少天
LocalDate localDate = LocalDate.now().minusDays(day);
String yesterday = localDate.toString();
log.info("当前导入记录日期="+yesterday);
List<Map<String, Object>> countTotal = paccountPayRepo.findCountTotal(yesterday+" 00:00:00",yesterday+" 23:59:59");
List<AflPaccountRefundCountFindVo> list = new ArrayList<AflPaccountRefundCountFindVo>();
for (Map<String, Object> stringObjectMap : countTotal) {
AflPaccountRefundCountFindVo aflPaccountRefundCountVo = JSON.parseObject(JSON.toJSONString(stringObjectMap), AflPaccountRefundCountFindVo.class);
list.add(aflPaccountRefundCountVo);
}
if (list==null||list.size()<1){
log.error("当前n+"+day+"天记录无数据");
return;
// throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+"+day+"天记录无数据");
}
log.info("本次处理数据:{}", JSON.toJSON(list));
AflPaccountRefundCount bydAflPaccountRefundCount = null;
for (AflPaccountRefundCountFindVo aflPaccountRefundCountVo : list) {
Integer newAccountDate1 =null;
if (!StringUtils.isEmpty(aflPaccountRefundCountVo.getAccountDate())){
String accountDate=aflPaccountRefundCountVo.getAccountDate().replaceAll("-","");
newAccountDate1 = Integer.parseInt(accountDate);
}
AflPaccountRefundCount aflPaccountRefundCount= null;
if("52010188999".equals(aflPaccountRefundCountVo.getAgentId())&&newAccountDate1!=null){
aflPaccountRefundCount= aflPaccountRefundCountRepo.finByDateAndAgentId("52010188930",newAccountDate1);
}else {
aflPaccountRefundCount= aflPaccountRefundCountRepo.finByDateAndAgentId(aflPaccountRefundCountVo.getAgentId(),newAccountDate1);
}
if (aflPaccountRefundCount==null){
aflPaccountRefundCount = new AflPaccountRefundCount();
}
Long refundMoney = fssPaccountRefundRepo.findByCountRefundMoney(aflPaccountRefundCountVo.getAgentId(),aflPaccountRefundCountVo.getAccountDate());

aflPaccountRefundCountVo.setId(aflPaccountRefundCount.getId());
BeanUtils.copyProperties(aflPaccountRefundCountVo,aflPaccountRefundCount);
aflPaccountRefundCount.setRefundMoney(refundMoney);
if (!StringUtils.isEmpty(aflPaccountRefundCountVo.getAccountDate())){
String accountDate=aflPaccountRefundCountVo.getAccountDate().replaceAll("-","");
Integer newAccountDate = Integer.parseInt(accountDate);
aflPaccountRefundCount.setAccountDate(newAccountDate);
}
if ("52010188999".equals(aflPaccountRefundCount.getAgentId())&&aflPaccountRefundCount.getAccountDate()!=null){
bydAflPaccountRefundCount=aflPaccountRefundCount;
AflPaccountRefundCount bydNewAflPaccountRefundCount= aflPaccountRefundCountRepo.finByDateAndAgentId("52010188930",aflPaccountRefundCount.getAccountDate());
if (bydNewAflPaccountRefundCount!=null){
if (bydAflPaccountRefundCount.getMoneyTotal()!=null){
bydNewAflPaccountRefundCount.setMoneyTotal(bydNewAflPaccountRefundCount.getMoneyTotal()+bydAflPaccountRefundCount.getMoneyTotal());
}
if (bydAflPaccountRefundCount.getRefundMoney()!=null){
bydNewAflPaccountRefundCount.setRefundMoney(bydNewAflPaccountRefundCount.getRefundMoney()+bydAflPaccountRefundCount.getRefundMoney());
}
if (bydAflPaccountRefundCount.getCollectMoney()!=null){
bydNewAflPaccountRefundCount.setCollectMoney(bydNewAflPaccountRefundCount.getCollectMoney()+bydAflPaccountRefundCount.getCollectMoney());
}
if (bydAflPaccountRefundCount.getNumberTotal()!=null){
bydNewAflPaccountRefundCount.setNumberTotal(bydNewAflPaccountRefundCount.getNumberTotal()+bydAflPaccountRefundCount.getNumberTotal());
}
aflPaccountRefundCountRepo.save(bydNewAflPaccountRefundCount);
}
continue;
}
if ("52010188930".equals(aflPaccountRefundCount.getAgentId())&&bydAflPaccountRefundCount!=null){
if (bydAflPaccountRefundCount.getMoneyTotal()!=null){
aflPaccountRefundCount.setMoneyTotal(aflPaccountRefundCount.getMoneyTotal()+bydAflPaccountRefundCount.getMoneyTotal());
}
if (bydAflPaccountRefundCount.getRefundMoney()!=null){
aflPaccountRefundCount.setRefundMoney(aflPaccountRefundCount.getRefundMoney()+bydAflPaccountRefundCount.getRefundMoney());
}
if (bydAflPaccountRefundCount.getCollectMoney()!=null){
aflPaccountRefundCount.setCollectMoney(aflPaccountRefundCount.getCollectMoney()+bydAflPaccountRefundCount.getCollectMoney());
}
if (bydAflPaccountRefundCount.getNumberTotal()!=null){
aflPaccountRefundCount.setCollectMoney(aflPaccountRefundCount.getCollectMoney()+bydAflPaccountRefundCount.getCollectMoney());
}
}
if (StringUtils.isEmpty(aflPaccountRefundCount.getId())){
aflPaccountRefundCount.setId(UUID.randomUUID().toString().replace("-", ""));
aflPaccountRefundCount.setInsertTime(LocalDateTime.now());
}
aflPaccountRefundCount.setUpdateTime(LocalDateTime.now());

aflPaccountRefundCountRepo.save(aflPaccountRefundCount);
}
}

private List<VehicleAgreementNumBillsVo> toVo(List<FssPaccountPay> payList) { private List<VehicleAgreementNumBillsVo> toVo(List<FssPaccountPay> payList) {
if (CollectionUtils.isEmpty(payList)) { if (CollectionUtils.isEmpty(payList)) {
return Lists.newArrayList(); return Lists.newArrayList();

Loading…
취소
저장