Merge pull request 'master' (#29) from master into develop
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/29
This commit is contained in:
commit
711f504386
@ -11,12 +11,17 @@
|
||||
|
||||
package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -58,22 +63,24 @@ public class EmisCommissionDtlController extends BaseController
|
||||
*
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisCommissionDtl:list')")
|
||||
@JacksonFilter(include= {
|
||||
"id","feeType","money","billMonth", "billType","billCode","quoteId","quoteName"
|
||||
,"exprId","calcExpr","feeRemark","empCode","empName","createTime"
|
||||
,"waybillDetail.sendSiteName","waybillDetail.dispatchUnderlingSiteName"
|
||||
,"waybillDetail.sendCountryName","waybillDetail.receiveCountryName"
|
||||
,"waybillDetail.paymentType","waybillDetail.sendDate"
|
||||
,"waybillDetail.sendCompany","waybillDetail.transLineTypeName"
|
||||
,"waybillDetail.productTypeName","waybillDetail.timeType"
|
||||
,"waybillDetail.sendName","waybillDetail.parcelQty"
|
||||
,"waybillDetail.billWeight","waybillDetail.totalVolume"
|
||||
,"waybillDetail.volumeWeight","waybillDetail.settlementWeight"
|
||||
,"waybillDetail.billFee","waybillDetail.realFee"
|
||||
,"waybillDetail.freight","waybillDetail.paymentStatus"
|
||||
,"waybillDetail.feeRemark","waybillDetail.remark"
|
||||
,"waybillDetail.payee","waybillDetail.salesmen"
|
||||
},value= EmisCommissionDtl.class,type= JacksonFilter.JscksonFilterType.RESPONSE)
|
||||
// @JacksonFilter(include= {
|
||||
// "id","feeType","money","billMonth", "billType","billCode","quoteId","quoteName"
|
||||
// ,"exprId","calcExpr","feeRemark","empCode","empName","createTime"
|
||||
// },value= EmisCommissionDtl.class,type= JacksonFilter.JscksonFilterType.RESPONSE)
|
||||
// @JacksonFilter(include= {
|
||||
// "waybillDetail.sendSiteName","waybillDetail.dispatchUnderlingSiteName"
|
||||
// ,"waybillDetail.sendCountryName","waybillDetail.receiveCountryName"
|
||||
// ,"waybillDetail.paymentType","waybillDetail.sendDate"
|
||||
// ,"waybillDetail.sendCompany","waybillDetail.transLineTypeName"
|
||||
// ,"waybillDetail.productTypeName","waybillDetail.timeType"
|
||||
// ,"waybillDetail.sendName","waybillDetail.parcelQty"
|
||||
// ,"waybillDetail.billWeight","waybillDetail.totalVolume"
|
||||
// ,"waybillDetail.volumeWeight","waybillDetail.settlementWeight"
|
||||
// ,"waybillDetail.billFee","waybillDetail.realFee"
|
||||
// ,"waybillDetail.freight","waybillDetail.paymentStatus"
|
||||
// ,"waybillDetail.feeRemark","waybillDetail.remark"
|
||||
// ,"waybillDetail.payee","waybillDetail.salesmen"
|
||||
// },value= EmisCommissionDtl.class,type= JacksonFilter.JscksonFilterType.RESPONSE)
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EmisCommissionDtl emisCommissionDtl)
|
||||
{
|
||||
@ -90,6 +97,31 @@ public class EmisCommissionDtlController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出JSON数据
|
||||
* @param emisCommissionDtl
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/mapDtlList")
|
||||
public TableDataInfo mapDtlList(EmisCommissionDtl emisCommissionDtl)
|
||||
{
|
||||
startPage();
|
||||
if(!StringUtils.isEmpty(emisCommissionDtl.getBillCode())){
|
||||
emisCommissionDtl.setBillCode(WaybillHelper.formatQueryValue(emisCommissionDtl.getBillCode()));
|
||||
String[] billCodeSortList = emisCommissionDtl.getBillCode().split(",");
|
||||
if(billCodeSortList.length>1){
|
||||
emisCommissionDtl.getParams().put("billCodeSortList", Arrays.asList(billCodeSortList));
|
||||
}
|
||||
}
|
||||
|
||||
List<Map> list = emisCommissionDtlService.selectCommissionDtlMapList(emisCommissionDtl);
|
||||
|
||||
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 按批次查询明细
|
||||
* @param emisCommissionDtl
|
||||
|
||||
@ -118,6 +118,74 @@ public class EmisCommonController extends EmisBaseController
|
||||
@Autowired
|
||||
RedissonService redissonService;
|
||||
|
||||
@Autowired
|
||||
private IEmisSettleBillPayLogService emisSettleBillPayLogService;
|
||||
|
||||
/**
|
||||
* 在线支付回调
|
||||
* @param method
|
||||
* @param data
|
||||
* @param sign_type
|
||||
* @param sign
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/payNotifyCallback")
|
||||
public String payNotifyCallback(String method,String data,String sign_type,String sign){
|
||||
|
||||
log.info("payNotifyCallback start");
|
||||
if(StringUtils.isAnyEmpty(method,data,sign)){
|
||||
return "param error";
|
||||
}
|
||||
|
||||
/*
|
||||
order_no String 订单号
|
||||
mer_id String 进件返回的商户ID
|
||||
amount Integer 支付金额(分)
|
||||
fee Integer 手续费(分为单位)。
|
||||
到账金额为:amount-fee
|
||||
time_created String 订单创建时间,yyyy-MM-dd HH:mm:ss
|
||||
time_expire String 订单超时时间,yyyy-MM-dd HH:mm:ss
|
||||
transaction_no String 支付渠道流水号
|
||||
channel String 支付渠道
|
||||
channel_type String 通道类型,请联系业务配置 例如 klt01
|
||||
trans_no String 平台交易流水号
|
||||
status Integer 交易状态
|
||||
0 订单创建
|
||||
10 未支付(待支付)
|
||||
11 用户支付中
|
||||
20 支付成功
|
||||
30 已关闭
|
||||
31 已撤销(刷卡支付)
|
||||
40 支付失败
|
||||
50 转入退款
|
||||
|
||||
err_msg String 错误消息
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject jobjRst = JSONObject.parseObject(data);
|
||||
String payId = jobjRst.getString("order_no");
|
||||
if(StringUtils.isEmpty(payId)){
|
||||
return "payId error";
|
||||
}
|
||||
|
||||
String lockKey="payNotifyCallback_"+payId;
|
||||
redissonService.lock(lockKey,300);
|
||||
try {
|
||||
log.info("payNotifyCallback start");
|
||||
emisSettleBillPayLogService.checkPayStatus(payId);
|
||||
} catch (EmisBizError emisBizError) {
|
||||
redissonService.unlock(lockKey);
|
||||
emisBizError.printStackTrace();
|
||||
return emisBizError.getMessage();
|
||||
}
|
||||
redissonService.unlock(lockKey);
|
||||
log.info("payNotifyCallback end");
|
||||
return "success";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取中心可用简单数
|
||||
* @param prefix
|
||||
@ -878,6 +946,7 @@ public class EmisCommonController extends EmisBaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/notifyTraceByKD100")
|
||||
public String notifyTraceByKD100(){
|
||||
String lockKey="notifyTraceByKD100";
|
||||
|
||||
@ -106,21 +106,7 @@ public class EmisSettleBillController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收款统计
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryPayBackStatList")
|
||||
public TableDataInfo queryPayBackStatList(EmisSettleBill emisSettleBill)
|
||||
{
|
||||
startPage();
|
||||
|
||||
setPrivParams(emisSettleBill);
|
||||
|
||||
List<Map> list = emisSettleBillService.queryPayBackStatList(emisSettleBill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -254,6 +240,23 @@ public class EmisSettleBillController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序支付
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/genWxPayFromWxApp")
|
||||
public AjaxResult genWxPayFromWxApp(EmisSettleBill emisSettleBill)
|
||||
{
|
||||
try {
|
||||
String qrPicUrl=emisSettleBillPayLogService.genWxPayFromWxApp(emisSettleBill.getSettleBillNo(),emisSettleBill.getOpenId());
|
||||
return AjaxResult.success("成功",qrPicUrl);
|
||||
} catch (EmisBizError emisBizError) {
|
||||
emisBizError.printStackTrace();
|
||||
return AjaxResult.error(emisBizError.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/sumbitWxPay")
|
||||
public AjaxResult sumbitWxPay(@RequestBody EmisSettleBill emisSettleBill)
|
||||
@ -300,6 +303,43 @@ public class EmisSettleBillController extends BaseController
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 收款统计
|
||||
* @param emisSettleBill
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryPayBackStatList")
|
||||
public TableDataInfo queryPayBackStatList(EmisSettleBill emisSettleBill)
|
||||
{
|
||||
startPage();
|
||||
|
||||
setPrivParams(emisSettleBill);
|
||||
|
||||
String billCodeStr = MapUtil.getStr(emisSettleBill.getParams(),"billCode");
|
||||
if(!StringUtils.isEmpty(billCodeStr)){
|
||||
emisSettleBill.getParams().put("billCode",WaybillHelper.formatQueryValue(billCodeStr));
|
||||
String[] billCodeSortList = billCodeStr.split(",");
|
||||
if(billCodeSortList.length>1){
|
||||
emisSettleBill.getParams().put("billCodeSortList", Arrays.asList(billCodeSortList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!StringUtils.isEmpty(emisSettleBill.getSettleBillNo())){
|
||||
emisSettleBill.setSettleBillNo(WaybillHelper.formatQueryValue(emisSettleBill.getSettleBillNo()));
|
||||
String[] settleBillNoSortList = emisSettleBill.getSettleBillNo().split(",");
|
||||
if(settleBillNoSortList.length>1){
|
||||
emisSettleBill.getParams().put("settleBillNoSortList",Arrays.asList(settleBillNoSortList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<Map> list = emisSettleBillService.queryPayBackStatList(emisSettleBill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增运单总账单
|
||||
*/
|
||||
|
||||
@ -92,6 +92,37 @@ public class EmisSettlePayRecordController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收款统计Map
|
||||
*/
|
||||
@GetMapping("/getSettlePayStatInfoMap")
|
||||
public AjaxResult getSettlePayStatInfoMap(EmisSettlePayRecord emisSettlePayRecord)
|
||||
{
|
||||
setPrivParams(emisSettlePayRecord);
|
||||
|
||||
|
||||
String billCodeStr = MapUtil.getStr(emisSettlePayRecord.getParams(),"billCode");
|
||||
if(!StringUtils.isEmpty(billCodeStr)){
|
||||
emisSettlePayRecord.getParams().put("billCode", WaybillHelper.formatQueryValue(billCodeStr));
|
||||
String[] billCodeSortList = billCodeStr.split(",");
|
||||
if(billCodeSortList.length>1){
|
||||
emisSettlePayRecord.getParams().put("billCodeSortList", Arrays.asList(billCodeSortList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!StringUtils.isEmpty(emisSettlePayRecord.getSettleBillNo())){
|
||||
emisSettlePayRecord.setSettleBillNo(WaybillHelper.formatQueryValue(emisSettlePayRecord.getSettleBillNo()));
|
||||
String[] settleBillNoSortList = emisSettlePayRecord.getSettleBillNo().split(",");
|
||||
if(settleBillNoSortList.length>1){
|
||||
emisSettlePayRecord.getParams().put("settleBillNoSortList",Arrays.asList(settleBillNoSortList));
|
||||
}
|
||||
}
|
||||
|
||||
Map rstMap = emisSettlePayRecordService.getSettlePayStatInfoMap(emisSettlePayRecord);
|
||||
return AjaxResult.success("查询成功",rstMap);
|
||||
}
|
||||
|
||||
@GetMapping("/queryPayBackRecordList")
|
||||
public TableDataInfo queryPayBackRecordList(EmisSettlePayRecord emisSettlePayRecord)
|
||||
{
|
||||
@ -114,7 +145,6 @@ public class EmisSettlePayRecordController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查是否重复
|
||||
*
|
||||
@ -162,7 +192,7 @@ public class EmisSettlePayRecordController extends BaseController
|
||||
public AjaxResult add(@RequestBody EmisSettlePayRecord emisSettlePayRecord)
|
||||
{
|
||||
try {
|
||||
return toAjax(emisSettlePayRecordService.insertEmisSettlePayRecord(emisSettlePayRecord));
|
||||
return toAjax(emisSettlePayRecordService.insertEmisSettlePayRecord(emisSettlePayRecord,null));
|
||||
}
|
||||
catch (DuplicateKeyException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -59,10 +59,13 @@ public class EmisTmsCostProfitController extends BaseController
|
||||
public TableDataInfo list(EmisTmsCostProfit emisTmsCostProfit)
|
||||
{
|
||||
startPage();
|
||||
emisTmsCostProfit.setBillCode(WaybillHelper.formatQueryValue(emisTmsCostProfit.getBillCode()));
|
||||
String[] billCodeSortList = emisTmsCostProfit.getBillCode().split(",");
|
||||
if(billCodeSortList.length>1){
|
||||
emisTmsCostProfit.getParams().put("billCodeSortList", Arrays.asList(billCodeSortList));
|
||||
|
||||
if(!StringUtils.isEmpty(emisTmsCostProfit.getBillCode())) {
|
||||
emisTmsCostProfit.setBillCode(WaybillHelper.formatQueryValue(emisTmsCostProfit.getBillCode()));
|
||||
String[] billCodeSortList = emisTmsCostProfit.getBillCode().split(",");
|
||||
if (billCodeSortList.length > 1) {
|
||||
emisTmsCostProfit.getParams().put("billCodeSortList", Arrays.asList(billCodeSortList));
|
||||
}
|
||||
}
|
||||
|
||||
List<EmisTmsCostProfit> list = emisTmsCostProfitService.selectEmisTmsCostProfitList(emisTmsCostProfit);
|
||||
|
||||
@ -193,7 +193,8 @@ public class EmisSettleBill extends BaseEntity
|
||||
|
||||
// 支付二维码图片
|
||||
private String qrCodePayPicUrl;
|
||||
|
||||
// 支付人openId
|
||||
private String openId;
|
||||
|
||||
List<EmisSettleSubBill> subBillList;
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisCommissionDtl;
|
||||
/**
|
||||
@ -36,6 +38,7 @@ public interface EmisCommissionDtlMapper extends BaseMapper<EmisCommissionDtl>
|
||||
*/
|
||||
public List<EmisCommissionDtl> selectEmisCommissionDtlList(EmisCommissionDtl emisCommissionDtl);
|
||||
|
||||
public List<Map> selectCommissionDtlMapList(EmisCommissionDtl emisCommissionDtl);
|
||||
|
||||
/**
|
||||
* 批次提成明细
|
||||
|
||||
@ -41,6 +41,8 @@ public interface EmisSettlePayRecordMapper extends BaseMapper<EmisSettlePayRecor
|
||||
*/
|
||||
public List<EmisSettlePayRecord> selectEmisSettlePayRecordList(EmisSettlePayRecord emisSettlePayRecord);
|
||||
|
||||
public Map getSettlePayStatInfoMap(EmisSettlePayRecord emisSettlePayRecord);
|
||||
|
||||
|
||||
public List<EmisSettlePayRecord> selectSettlePayRecordListBySettleBillNo(String settleBillNo);
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ package com.xdadan.erp.emis.service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
@ -2344,9 +2346,9 @@ public class EmisBaseService {
|
||||
startDate=currentTime;
|
||||
}
|
||||
|
||||
// 开单当天不算时效
|
||||
Date newEstDate = getEstimateDate(
|
||||
startDate,oldEmisWaybill.getProductType(),
|
||||
// 计算延长时间
|
||||
Date newEstDate = getEstimateDateByProm(
|
||||
startDate,
|
||||
oldEmisWaybill.getSendCountry(),
|
||||
oldEmisWaybill.getReceiveCountry(),emisProblemType.getDelayDay());
|
||||
|
||||
@ -3780,14 +3782,14 @@ public class EmisBaseService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算预估到达时间
|
||||
* @param sendDate 开单时间
|
||||
* @param prodCode
|
||||
* @param receiveCountry
|
||||
* @param sendCountry
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 计算预估到达时间,根据产品时效来计算
|
||||
* @param sendDate 开单时间
|
||||
* @param prodCode
|
||||
* @param receiveCountry
|
||||
* @param sendCountry
|
||||
* @return
|
||||
*/
|
||||
public Date getEstimateDate(Date sendDate,String prodCode,String receiveCountry,String sendCountry,Integer otherAddDay) {
|
||||
Date estDate = null;
|
||||
|
||||
@ -3823,7 +3825,7 @@ public class EmisBaseService {
|
||||
startDate,
|
||||
endDate);
|
||||
|
||||
// 1+1+
|
||||
// 1+1+ 5+0-1+2+0
|
||||
int totalDays=(emisTransProduct.getMaxAging()+otherAddDay-1)+weekDays+notCaclDays;
|
||||
log.info("计算预估到达时间:[maxAging="+emisTransProduct.getMaxAging()+",weekDays="+weekDays+",notCaclDays="+notCaclDays);
|
||||
// 预估达到时间
|
||||
@ -3831,6 +3833,53 @@ public class EmisBaseService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据问题件时间延长时效
|
||||
* @param sendDate 开单时间
|
||||
* @param receiveCountry
|
||||
* @param sendCountry
|
||||
* @return
|
||||
*/
|
||||
public Date getEstimateDateByProm(Date sendDate,String receiveCountry,String sendCountry,Integer otherAddDay) {
|
||||
Date estDate = null;
|
||||
|
||||
if(otherAddDay==null){
|
||||
otherAddDay=0;
|
||||
}
|
||||
// 发件时间+1天,从下一天的0点开始算
|
||||
sendDate = DateUtils.addDays(sendDate,1);
|
||||
|
||||
// 初始化0点时间
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(sendDate);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
Date startDate=calendar.getTime();
|
||||
|
||||
// 预估到达时间 startData+最大时效
|
||||
Date endDate = DateUtils.addDays(startDate, otherAddDay-1);
|
||||
|
||||
// 计算周末
|
||||
int weekDays = computeWeekDays(startDate,endDate,true);
|
||||
|
||||
// 计算不计较时效的时间
|
||||
int notCaclDays=emisNotCalcAgingMapper.getNotCalcAgingDays(
|
||||
receiveCountry,
|
||||
sendCountry,
|
||||
startDate,
|
||||
endDate);
|
||||
|
||||
// 1+1+ 5+0-1+2+0
|
||||
int totalDays=(otherAddDay-1)+weekDays+notCaclDays;
|
||||
log.info("计算预估到达时间:[weekDays="+weekDays+",notCaclDays="+notCaclDays);
|
||||
// 预估达到时间
|
||||
return DateUtils.addDays(startDate, totalDays);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -4001,11 +4050,13 @@ public class EmisBaseService {
|
||||
return copy;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Date startDate = new Date();
|
||||
// Date endDate = DateUtils.addDays(startDate, 10);
|
||||
// int weekDays = computeWeekDays(startDate,endDate,true);
|
||||
//// System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
|
||||
public static void main(String[] args) throws ParseException {
|
||||
// Date startDate = new Date("202");
|
||||
Date startDate= new SimpleDateFormat("yyyy-MM-dd").parse("2025-05-11");
|
||||
Date endDate = DateUtils.addDays(startDate, 5);
|
||||
int weekDays = computeWeekDays(startDate,endDate,true);
|
||||
System.out.println(weekDays);
|
||||
// System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
|
||||
//
|
||||
// System.out.println(startDate);
|
||||
// System.out.println(endDate);
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisCommissionDtl;
|
||||
|
||||
/**
|
||||
@ -35,6 +37,8 @@ public interface IEmisCommissionDtlService
|
||||
*/
|
||||
public List<EmisCommissionDtl> selectEmisCommissionDtlList(EmisCommissionDtl emisCommissionDtl);
|
||||
|
||||
public List<Map> selectCommissionDtlMapList(EmisCommissionDtl emisCommissionDtl);
|
||||
|
||||
/**
|
||||
* 批次提成明细
|
||||
* @param emisCommissionDtl
|
||||
|
||||
@ -87,6 +87,16 @@ public interface IEmisSettleBillPayLogService
|
||||
public String genWxPayQR(String settleBillNo) throws EmisBizError;
|
||||
|
||||
|
||||
/**
|
||||
* 公众号/小程序支付
|
||||
* @param settleBillNo
|
||||
* @param openId
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public String genWxPayFromWxApp(String settleBillNo,String openId) throws EmisBizError;
|
||||
|
||||
|
||||
/**
|
||||
* 检查支付状态
|
||||
* @param orderNo
|
||||
|
||||
@ -40,6 +40,8 @@ public interface IEmisSettlePayRecordService
|
||||
*/
|
||||
public List<EmisSettlePayRecord> selectEmisSettlePayRecordList(EmisSettlePayRecord emisSettlePayRecord);
|
||||
|
||||
public Map getSettlePayStatInfoMap(EmisSettlePayRecord emisSettlePayRecord);
|
||||
|
||||
public List<PayBackRecordDtl> queryPayBackRecordList(EmisSettlePayRecord emisSettlePayRecord);
|
||||
|
||||
public List<PayBackRecordDtl> queryNoPayBackRecordList(EmisSettlePayRecord emisSettlePayRecord);
|
||||
@ -58,7 +60,7 @@ public interface IEmisSettlePayRecordService
|
||||
* @param emisSettlePayRecord 账单收退款记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord) throws EmisBizError;
|
||||
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord,String payId) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 修改账单收退款记录
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisCommissionDtl;
|
||||
@ -54,6 +56,13 @@ public class EmisCommissionDtlServiceImpl implements IEmisCommissionDtlService
|
||||
return emisCommissionDtlMapper.selectEmisCommissionDtlList(emisCommissionDtl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> selectCommissionDtlMapList(EmisCommissionDtl emisCommissionDtl)
|
||||
{
|
||||
return emisCommissionDtlMapper.selectCommissionDtlMapList(emisCommissionDtl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询批次提成明细表列表
|
||||
|
||||
@ -12,6 +12,7 @@ package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -23,17 +24,20 @@ import com.xdadan.erp.common.core.pay.vitepay.sdk.ApiRes;
|
||||
import com.xdadan.erp.common.core.pay.vitepay.sdk.Config;
|
||||
import com.xdadan.erp.common.core.pay.vitepay.sdk.VitePayOnlineSdk;
|
||||
import com.xdadan.erp.common.utils.idgen.SnowflakeIdUtils;
|
||||
import com.xdadan.erp.emis.domain.EmisSettleBill;
|
||||
import com.xdadan.erp.emis.domain.*;
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.mapper.EmisSettleBillMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisSettlePayRelMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisSettleSubBillMapper;
|
||||
import com.xdadan.erp.emis.service.IEmisSettlePayRecordService;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
import com.xdadan.erp.system.domain.SysAccount;
|
||||
import com.xdadan.erp.system.domain.SysPayOrder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisSettleBillPayLog;
|
||||
import com.xdadan.erp.emis.mapper.EmisSettleBillPayLogMapper;
|
||||
import com.xdadan.erp.emis.service.IEmisSettleBillPayLogService;
|
||||
|
||||
@ -53,6 +57,16 @@ public class EmisSettleBillPayLogServiceImpl implements IEmisSettleBillPayLogSer
|
||||
@Autowired
|
||||
private EmisSettleBillMapper emisSettleBillMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IEmisSettlePayRecordService emisSettlePayRecordService;
|
||||
|
||||
@Autowired
|
||||
private EmisSettlePayRelMapper emisSettlePayRelMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisSettleSubBillMapper emisSettleSubBillMapper;
|
||||
|
||||
/**
|
||||
* 查询支付订单表
|
||||
*
|
||||
@ -185,7 +199,7 @@ public class EmisSettleBillPayLogServiceImpl implements IEmisSettleBillPayLogSer
|
||||
EmisSettleBillPayLog emisSettleBillPayLogUpd = new EmisSettleBillPayLog();
|
||||
emisSettleBillPayLogUpd.setId(emisSettleBillPayLog.getId());
|
||||
try {
|
||||
res = VitePayOnlineSdk.onlinePay(channel,payId,merId,amount,fee,notifyUrl,appId,authCode,openId);
|
||||
res = VitePayOnlineSdk.onlinePay(channel,payId,merId,amount,fee,notifyUrl,appId,authCode,openId,"运费",emisSettleBill.getSettleBillName()+"-运费");
|
||||
log.info("账单支付生成支付二维码==>{}",JSONObject.toJSONString(res));
|
||||
emisSettleBillPayLogUpd.setResponseExtra(JSON.toJSONString(res));
|
||||
if(res.isSuccess()){
|
||||
@ -214,6 +228,84 @@ public class EmisSettleBillPayLogServiceImpl implements IEmisSettleBillPayLogSer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序支付
|
||||
* @param settleBillNo
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
@Override
|
||||
public String genWxPayFromWxApp(String settleBillNo,String openId) throws EmisBizError {
|
||||
|
||||
EmisSettleBill emisSettleBill=emisSettleBillMapper.selectSettleBillBySettleBillNo(settleBillNo);
|
||||
|
||||
BigDecimal thisPayMoney=emisSettleBill.getRecMoney().subtract(emisSettleBill.getRecedMoney());
|
||||
|
||||
int amount= (int) (thisPayMoney.floatValue()*100.0f);
|
||||
|
||||
String merId="1";
|
||||
float feeRate=0.0065f;
|
||||
|
||||
int fee= (int) (thisPayMoney.floatValue()*feeRate);
|
||||
String authCode="";
|
||||
|
||||
String payId= WaybillHelper.genPayId();
|
||||
// 产生支付订单
|
||||
EmisSettleBillPayLog emisSettleBillPayLog = new EmisSettleBillPayLog();
|
||||
emisSettleBillPayLog.setPayId(payId);
|
||||
emisSettleBillPayLog.setSettleBillNo(settleBillNo);
|
||||
emisSettleBillPayLog.setAmount(amount);
|
||||
emisSettleBillPayLog.setPayType("wx");
|
||||
emisSettleBillPayLog.setStatus(0);
|
||||
emisSettleBillPayLog.setStatusDesc("初始");
|
||||
emisSettleBillPayLog.setFee(fee);
|
||||
emisSettleBillPayLog.setCurrency("CNY");
|
||||
emisSettleBillPayLog.setSubject("账单支付");
|
||||
emisSettleBillPayLog.setBody("账单支付");
|
||||
emisSettleBillPayLog.setRemark("账单支付");
|
||||
|
||||
emisSettleBillPayLogMapper.insertEmisSettleBillPayLog(emisSettleBillPayLog);
|
||||
|
||||
// 公众号及小程序支付
|
||||
String channel="wxpay_pub";
|
||||
String appId="";
|
||||
String notifyUrl= Config.ERP_API_PAY_NOTIFY_URL;
|
||||
ApiRes res= null;
|
||||
|
||||
EmisSettleBillPayLog emisSettleBillPayLogUpd = new EmisSettleBillPayLog();
|
||||
emisSettleBillPayLogUpd.setId(emisSettleBillPayLog.getId());
|
||||
try {
|
||||
res = VitePayOnlineSdk.onlinePay(channel,payId,merId,amount,fee,notifyUrl,appId,authCode,openId,"运费",emisSettleBill.getSettleBillName()+"-运费");
|
||||
log.info("支付代码生成==>{}",JSONObject.toJSONString(res));
|
||||
emisSettleBillPayLogUpd.setResponseExtra(JSON.toJSONString(res));
|
||||
if(res.isSuccess()){
|
||||
String payCode=((Map)res.getData().get("credential")).get("qr_image_url").toString();
|
||||
emisSettleBillPayLogUpd.setCredential(JSON.toJSONString(res.getData().get("credential")));
|
||||
|
||||
emisSettleBillPayLogUpd.setStatus(10);
|
||||
emisSettleBillPayLogUpd.setStatusDesc("支付中");
|
||||
emisSettleBillPayLogMapper.updateEmisSettleBillPayLog(emisSettleBillPayLogUpd);
|
||||
|
||||
return payCode;
|
||||
}
|
||||
else{
|
||||
emisSettleBillPayLogUpd.setStatus(40);
|
||||
emisSettleBillPayLogUpd.setStatusDesc(res.getMessage());
|
||||
emisSettleBillPayLogMapper.updateEmisSettleBillPayLog(emisSettleBillPayLogUpd);
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,res.getMessage());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
emisSettleBillPayLogUpd.setStatus(40);
|
||||
emisSettleBillPayLogUpd.setStatusDesc("exception:"+e.getMessage());
|
||||
emisSettleBillPayLogMapper.updateEmisSettleBillPayLog(emisSettleBillPayLogUpd);
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"支付异常");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查支付订单
|
||||
* @param payId
|
||||
@ -224,6 +316,7 @@ public class EmisSettleBillPayLogServiceImpl implements IEmisSettleBillPayLogSer
|
||||
|
||||
EmisSettleBillPayLog emisSettleBillPayLog=emisSettleBillPayLogMapper.selectEmisSettleBillPayLogByPayId(payId);
|
||||
|
||||
|
||||
if(emisSettleBillPayLog == null){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"支付单不存在");
|
||||
}
|
||||
@ -241,6 +334,19 @@ public class EmisSettleBillPayLogServiceImpl implements IEmisSettleBillPayLogSer
|
||||
String status=rstObj.getString("status");
|
||||
String errMsg=rstObj.getString("err_msg");
|
||||
if("20".equals(status)){
|
||||
EmisSettleBill oldSettleBill=emisSettleBillMapper.selectSettleBillBySettleBillNo(emisSettleBillPayLog.getSettleBillNo());
|
||||
if(oldSettleBill==null){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"账单不存在");
|
||||
}
|
||||
|
||||
String payMan="";
|
||||
// 现金账单支付人为寄件公司,月结账单支付人为客户
|
||||
if("1".equals(oldSettleBill.getSettleType())){
|
||||
payMan=oldSettleBill.getCustomerName();
|
||||
}else{
|
||||
payMan=oldSettleBill.getCustName();
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
emisSettleBillPayLog.setPaid(1);
|
||||
emisSettleBillPayLog.setStatus(20);
|
||||
@ -248,9 +354,50 @@ public class EmisSettleBillPayLogServiceImpl implements IEmisSettleBillPayLogSer
|
||||
emisSettleBillPayLog.setPaySuccTime(new Date());
|
||||
emisSettleBillPayLogMapper.updateEmisSettleBillPayLog(emisSettleBillPayLog);
|
||||
|
||||
// 更新账单状态,插入支付微信支付收款记录,更新账单状态
|
||||
// 调整账户余额
|
||||
// sysAccountService.adjustAmount(emisSettleBillPayLog.getOrderNo(),emisSettleBillPayLog.getAccId(),emisSettleBillPayLog.getOwnerId(),emisSettleBillPayLog.getAmount(),"充值");
|
||||
// 获取支付账单,转为为真实支付单
|
||||
EmisSettlePayRecord emisSettlePayRecord=new EmisSettlePayRecord();
|
||||
emisSettlePayRecord.setSettleBillNo(emisSettleBillPayLog.getSettleBillNo());
|
||||
emisSettlePayRecord.setPayId(emisSettleBillPayLog.getPayId());
|
||||
emisSettlePayRecord.setPayType("7"); // 在线支付(微信)
|
||||
emisSettlePayRecord.setPayMan(payMan);
|
||||
emisSettlePayRecord.setPayMoney(new BigDecimal(emisSettleBillPayLog.getAmount()).divide(new BigDecimal(100)));
|
||||
emisSettlePayRecord.setTradeDate(emisSettleBillPayLog.getPaySuccTime());
|
||||
emisSettlePayRecord.setRecType("1");
|
||||
emisSettlePayRecord.setPayStatus("2");
|
||||
emisSettlePayRecord.setSettleType(oldSettleBill.getSettleType());
|
||||
emisSettlePayRecord.setRecManCode("1");
|
||||
emisSettlePayRecord.setCustomerCode(oldSettleBill.getCustomerCode());
|
||||
emisSettlePayRecord.setCustomerName(oldSettleBill.getCustomerName());
|
||||
emisSettlePayRecord.setCreateBy("1");
|
||||
emisSettlePayRecord.setCreateTime(new Date());
|
||||
|
||||
// 设置为支付的单子
|
||||
List<EmisSettlePayRel> payRelList=new ArrayList<EmisSettlePayRel>();
|
||||
|
||||
EmisSettleSubBill qParam = new EmisSettleSubBill();
|
||||
qParam.setSettleBillNo(emisSettleBillPayLog.getSettleBillNo());
|
||||
List<EmisSettleSubBill> listSubBill=emisSettleSubBillMapper.selectEmisSettleSubBillList(qParam);
|
||||
if(!CollectionUtils.isEmpty(listSubBill)){
|
||||
for (EmisSettleSubBill itemSubBill:listSubBill) {
|
||||
BigDecimal hasPayMoney = itemSubBill.getRecedMoney();
|
||||
if(hasPayMoney==null){
|
||||
hasPayMoney=BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
BigDecimal noPayMoney=itemSubBill.getBillFee().subtract(hasPayMoney);
|
||||
if(noPayMoney.compareTo(BigDecimal.ZERO)>0){
|
||||
EmisSettlePayRel payRel = new EmisSettlePayRel();
|
||||
payRel.setPayId(emisSettleBillPayLog.getPayId());
|
||||
payRel.setBillNo(itemSubBill.getBillNo());
|
||||
payRel.setPayMoney(noPayMoney);
|
||||
payRelList.add(payRel);
|
||||
}
|
||||
}
|
||||
}
|
||||
emisSettlePayRecord.setPayRelList(payRelList);
|
||||
|
||||
emisSettlePayRecordService.insertEmisSettlePayRecord(emisSettlePayRecord,emisSettleBillPayLog.getPayId());
|
||||
|
||||
}else if("10".equals(status)){
|
||||
emisSettleBillPayLog.setPaid(0);
|
||||
emisSettleBillPayLog.setStatus(10);
|
||||
|
||||
@ -761,11 +761,8 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
// 获取收款记录
|
||||
List<EmisSettlePayRecord> payRecordList=emisSettlePayRecordMapper.selectSettlePayRecordListBySettleBillNo(settleBillNo);
|
||||
|
||||
// 全部收款金额
|
||||
BigDecimal totalAllPayMoney = BigDecimal.ZERO;
|
||||
|
||||
// 计算已收款金额
|
||||
BigDecimal totalPayMoney = BigDecimal.ZERO;
|
||||
BigDecimal totalHasPayMoney = BigDecimal.ZERO;
|
||||
|
||||
// 抵扣金额
|
||||
BigDecimal satisfyMoney = BigDecimal.ZERO;
|
||||
@ -782,9 +779,8 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
log.debug("reCalcSettleBillPayStatus===>应收:{}",oldBill.getRecMoney());
|
||||
|
||||
for(EmisSettlePayRecord item:payRecordList){
|
||||
|
||||
if("1".equals(item.getRecType())) {
|
||||
totalPayMoney = totalPayMoney.add(item.getPayMoney());
|
||||
totalHasPayMoney = totalHasPayMoney.add(item.getPayMoney());
|
||||
satisfyMoney = satisfyMoney.add(item.getSatisfyMoney() == null ? BigDecimal.ZERO : item.getSatisfyMoney());
|
||||
allowanceMoney = allowanceMoney.add(item.getAllowanceMoney() == null ? BigDecimal.ZERO : item.getAllowanceMoney());
|
||||
deductionMoney = deductionMoney.add(item.getDeductionMoney() == null ? BigDecimal.ZERO : item.getDeductionMoney());
|
||||
@ -795,54 +791,13 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
}
|
||||
}
|
||||
|
||||
// 总应收金额
|
||||
log.debug("reCalcSettleBillPayStatus===>totalPayMoney:{},satisfyMoney:{},allowanceMoney:{},deductionMoney:{},otherMoney:{}"
|
||||
,totalPayMoney,satisfyMoney,allowanceMoney,allowanceMoney,deductionMoney,otherMoney);
|
||||
|
||||
// 收款金额-退款金额
|
||||
totalAllPayMoney=totalAllPayMoney
|
||||
.add(totalPayMoney)
|
||||
.add(satisfyMoney)
|
||||
.add(allowanceMoney)
|
||||
.add(deductionMoney)
|
||||
.add(otherMoney)
|
||||
.subtract(refundMoney)
|
||||
;
|
||||
|
||||
EmisSettleBill newBill = new EmisSettleBill();
|
||||
newBill.setId(oldBill.getId());
|
||||
newBill.setRecedMoney(totalPayMoney.subtract(refundMoney));
|
||||
newBill.setSatisfyMoney(satisfyMoney);
|
||||
newBill.setAllowanceMoney(allowanceMoney);
|
||||
newBill.setOtherMoney(otherMoney);
|
||||
// 退款金额
|
||||
newBill.setRefundMoney(refundMoney);
|
||||
|
||||
// 更新账单收款状态 收款金额
|
||||
int rstDif=totalAllPayMoney.compareTo(oldBill.getRecMoney());
|
||||
log.debug("reCalcSettleBillPayStatus===>收款金额:{},应收:{}",totalAllPayMoney,oldBill.getRecMoney());
|
||||
if( totalAllPayMoney.compareTo(BigDecimal.ZERO) == 0 ){
|
||||
newBill.setPaymentStatus("0");
|
||||
}else{
|
||||
if( rstDif >= 0 ){
|
||||
// 已收款
|
||||
newBill.setPaymentStatus("1");
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
}
|
||||
else{
|
||||
// 部分收款
|
||||
newBill.setPaymentStatus("2");
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
}
|
||||
}
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
|
||||
// 更新运单的收款状态
|
||||
if(totalAllPayMoney.compareTo(BigDecimal.ZERO) > 0){
|
||||
if(totalHasPayMoney.compareTo(BigDecimal.ZERO) > 0){
|
||||
BigDecimal totalMoney = BigDecimal.ZERO;
|
||||
// 更新运单收款记录
|
||||
List<Map> listRel=emisSettlePayRelMapper.selectHasPayMapList(settleBillNo);
|
||||
if(!CollectionUtils.isEmpty(listRel)) {
|
||||
|
||||
for(Map item:listRel){
|
||||
|
||||
String billNo= MapUtils.getString(item,"billNo",null);
|
||||
@ -896,9 +851,88 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
// emisBizError.printStackTrace();
|
||||
// }
|
||||
}
|
||||
|
||||
// 全部收款金额
|
||||
BigDecimal totalAllPayMoney = BigDecimal.ZERO;
|
||||
|
||||
// 收款金额-退款金额
|
||||
totalAllPayMoney=totalMoney
|
||||
.add(satisfyMoney)
|
||||
.add(allowanceMoney)
|
||||
.add(deductionMoney)
|
||||
.add(otherMoney)
|
||||
.subtract(refundMoney);
|
||||
|
||||
EmisSettleBill newBill = new EmisSettleBill();
|
||||
newBill.setId(oldBill.getId());
|
||||
newBill.setRecedMoney(totalMoney);
|
||||
newBill.setSatisfyMoney(satisfyMoney);
|
||||
newBill.setAllowanceMoney(allowanceMoney);
|
||||
newBill.setOtherMoney(otherMoney);
|
||||
// 退款金额
|
||||
newBill.setRefundMoney(refundMoney);
|
||||
|
||||
// 更新账单收款状态 收款金额
|
||||
int rstDif=totalMoney.compareTo(oldBill.getRecMoney());
|
||||
log.debug("reCalcSettleBillPayStatus===>收款金额:{},应收:{}",totalMoney,oldBill.getRecMoney());
|
||||
if( totalAllPayMoney.compareTo(BigDecimal.ZERO) == 0 ){
|
||||
newBill.setPaymentStatus("0");
|
||||
}else{
|
||||
if( rstDif >= 0 ){
|
||||
// 已收款
|
||||
newBill.setPaymentStatus("1");
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
}
|
||||
else{
|
||||
// 部分收款
|
||||
newBill.setPaymentStatus("2");
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
}
|
||||
}
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
// 全部收款金额
|
||||
BigDecimal totalAllPayMoney = BigDecimal.ZERO;
|
||||
BigDecimal totalMoney = BigDecimal.ZERO;
|
||||
// 收款金额-退款金额
|
||||
totalAllPayMoney=totalMoney
|
||||
.add(satisfyMoney)
|
||||
.add(allowanceMoney)
|
||||
.add(deductionMoney)
|
||||
.add(otherMoney)
|
||||
.subtract(refundMoney);
|
||||
|
||||
EmisSettleBill newBill = new EmisSettleBill();
|
||||
newBill.setId(oldBill.getId());
|
||||
newBill.setRecedMoney(totalMoney);
|
||||
newBill.setSatisfyMoney(satisfyMoney);
|
||||
newBill.setAllowanceMoney(allowanceMoney);
|
||||
newBill.setOtherMoney(otherMoney);
|
||||
// 退款金额
|
||||
newBill.setRefundMoney(refundMoney);
|
||||
|
||||
// 更新账单收款状态 收款金额
|
||||
int rstDif=totalMoney.compareTo(oldBill.getRecMoney());
|
||||
log.debug("reCalcSettleBillPayStatus===>收款金额:{},应收:{}",totalMoney,oldBill.getRecMoney());
|
||||
if( totalAllPayMoney.compareTo(BigDecimal.ZERO) == 0 ){
|
||||
newBill.setPaymentStatus("0");
|
||||
}else{
|
||||
if( rstDif >= 0 ){
|
||||
// 已收款
|
||||
newBill.setPaymentStatus("1");
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
}
|
||||
else{
|
||||
// 部分收款
|
||||
newBill.setPaymentStatus("2");
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
}
|
||||
}
|
||||
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||
|
||||
// 未收款则更新运单状态未收款状态
|
||||
List<EmisSettleSubBill> list = emisBaseService.selectSubBillListBySettleBillNo(settleBillNo);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
|
||||
@ -92,6 +92,12 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
|
||||
return emisSettlePayRecordMapper.selectEmisSettlePayRecordList(emisSettlePayRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getSettlePayStatInfoMap(EmisSettlePayRecord emisSettlePayRecord)
|
||||
{
|
||||
return emisSettlePayRecordMapper.getSettlePayStatInfoMap(emisSettlePayRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PayBackRecordDtl> queryPayBackRecordList(EmisSettlePayRecord emisSettlePayRecord)
|
||||
{
|
||||
@ -124,7 +130,7 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord) throws EmisBizError {
|
||||
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord,String payId) throws EmisBizError {
|
||||
|
||||
if(StringUtils.isEmpty(emisSettlePayRecord.getSettleBillNo())){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"账单编号不能为空");
|
||||
@ -159,7 +165,11 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
|
||||
}
|
||||
|
||||
// 不重复的 id流水号
|
||||
String payId= WaybillHelper.genPayId();
|
||||
// 如果支付单是空的则生成新的支付单
|
||||
if(StringUtils.isEmpty(payId)) {
|
||||
payId = WaybillHelper.genPayId();
|
||||
}
|
||||
|
||||
emisSettlePayRecord.setPayId(payId);
|
||||
|
||||
// 退款时支付金额记录负值
|
||||
|
||||
@ -2001,6 +2001,7 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
|
||||
}else{
|
||||
waybillProblemInfo.setBlSubBill("0");
|
||||
}
|
||||
// 登记问题件并计算延期时间
|
||||
registerWaybillProblemInfo(waybillProblemInfo);
|
||||
if(waybillProblemInfo.getId()!=null) {
|
||||
emisTmsScanRecord.setRelId(waybillProblemInfo.getId().toString());
|
||||
|
||||
@ -86,6 +86,98 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCommissionDtlMapList" parameterType="EmisCommissionDtl" resultType="map">
|
||||
SELECT
|
||||
a.id,
|
||||
a.fee_type AS feeType,
|
||||
a.money,
|
||||
a.bill_month AS billMonth,
|
||||
a.bill_type AS billType,
|
||||
a.bill_code AS billCode,
|
||||
a.quote_id AS quoteId,
|
||||
a.quote_name AS quoteName,
|
||||
a.expr_id AS exprId,
|
||||
a.calc_expr AS calcExpr,
|
||||
a.fee_remark AS feeRemark,
|
||||
a.emp_code AS empCode,
|
||||
a.emp_name AS empName,
|
||||
a.remark,
|
||||
a.del_flag AS delFlag,
|
||||
a.create_time AS createTime,
|
||||
b.payment_type AS paymentType,
|
||||
b.send_date AS sendDate,
|
||||
b.send_company AS sendCompany,
|
||||
b.time_type AS timeType,
|
||||
b.send_name AS sendName,
|
||||
b.parcel_qty AS parcelQty,
|
||||
b.bill_weight AS billWeight,
|
||||
b.total_volume AS totalVolume,
|
||||
b.volume_weight AS volumeWeight,
|
||||
b.settlement_weight AS settlementWeight,
|
||||
b.real_fee AS realFee,
|
||||
b.freight,
|
||||
b.payment_status AS paymentStatus,
|
||||
b.fee_remark AS waybillFeeRemark,
|
||||
b.remark as waybillRemark,
|
||||
b.cust_name as custName,
|
||||
b.payee,
|
||||
b.salesmen,
|
||||
c.site_name AS sendSiteName,
|
||||
d.site_name AS dispatchUnderlingSiteName,
|
||||
e.NAME AS sendCountryName,
|
||||
f.NAME AS receiveCountryName,
|
||||
g.line_name AS transLineTypeName,
|
||||
h.prod_name AS productTypeName
|
||||
FROM
|
||||
emis_commission_dtl a,
|
||||
emis_waybill b
|
||||
LEFT JOIN emis_site c ON b.send_site_code = c.site_code AND c.del_flag = '0'
|
||||
LEFT JOIN emis_site d ON b.destination_center_code = d.site_code AND d.del_flag = '0'
|
||||
LEFT JOIN emis_country e ON b.send_country = e.CODE AND e.del_flag = '0'
|
||||
LEFT JOIN emis_country f ON b.receive_country = f.CODE AND f.del_flag = '0'
|
||||
LEFT JOIN emis_trans_line g ON b.trans_line_type = g.line_code AND g.del_flag = '0'
|
||||
LEFT JOIN emis_trans_product h ON b.product_type = h.prod_code AND h.del_flag = '0'
|
||||
<where>
|
||||
a.del_flag='0' and a.bill_code=b.bill_code and bill_type='1'
|
||||
<if test="id != null "> and a.id = #{id}</if>
|
||||
<if test="feeType != null and feeType != ''"> and a.fee_type=#{feeType}</if>
|
||||
<if test="money != null "> and a.money = #{money}</if>
|
||||
<if test="billMonth != null and billMonth != ''"> and a.bill_month=#{billMonth} </if>
|
||||
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(a.bill_code,#{billCode}) or a.bill_code like concat('%', #{billCode}, '%') )</if>
|
||||
<if test="feeRemark != null and feeRemark != ''"> and a.fee_remark like concat('%', #{feeRemark}, '%')</if>
|
||||
<if test="empCode != null and empCode != ''"> and a.emp_code=#{empCode}</if>
|
||||
<if test="empName != null and empName != ''"> and a.emp_name=#{empName}</if>
|
||||
<if test="blConfirmCenter != null and blConfirmCenter != ''"> and a.bl_confirm_center=#{blConfirmCenter}</if>
|
||||
<if test="confirmCenterDate != null "> and a.confirm_center_date = #{confirmCenterDate}</if>
|
||||
<if test="confirmCenterNote != null and confirmCenterNote != ''"> and a.confirm_center_note like concat('%', #{confirmCenterNote}, '%')</if>
|
||||
<if test="confirmCenterManCode != null and confirmCenterManCode != ''"> and a.confirm_center_man_code= #{confirmCenterManCode}</if>
|
||||
<if test="confirmCenterCode != null and confirmCenterCode != ''"> and a.confirm_center_code=#{confirmCenterCode}</if>
|
||||
<if test="blConfirmSite != null and blConfirmSite != ''"> and a.bl_confirm_site=#{blConfirmSite}</if>
|
||||
<if test="confirmSiteDate != null "> and a.confirm_site_date = #{confirmSiteDate}</if>
|
||||
<if test="confirmSiteManCode != null and confirmSiteManCode != ''"> and a.confirm_site_man_code=#{confirmSiteManCode}</if>
|
||||
<if test="confirmSiteNote != null and confirmSiteNote != ''"> and a.confirm_site_note like concat('%', #{confirmSiteNote}, '%')</if>
|
||||
<if test="confirmSiteCode != null and confirmSiteCode != ''"> and a.confirm_site_code=#{confirmSiteCode}</if>
|
||||
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and a.del_flag like concat('%', #{delFlag}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and a.create_by like concat('%', #{createBy}, '%')</if>
|
||||
<if test="createTime != null "> and a.create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and a.update_by like concat('%', #{updateBy}, '%')</if>
|
||||
<if test="updateTime != null "> and a.update_time = #{updateTime}</if>
|
||||
<if test="createSite != null and createSite != ''"> and a.create_site like concat('%', #{createSite}, '%')</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and a.update_site like concat('%', #{updateSite}, '%')</if>
|
||||
|
||||
|
||||
<if test="params.beginSendDate != null and params.beginSendDate != ''">
|
||||
and b.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
||||
</if>
|
||||
<if test="params.endSendDate != null and params.endSendDate != ''">
|
||||
and b.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectBatchCommissionDtlList" parameterType="EmisCommissionDtl" resultMap="EmisBatchCommissionDtlResult">
|
||||
<include refid="selectEmisCommissionDtlVo"/>
|
||||
@ -117,6 +209,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
||||
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
@ -111,6 +111,18 @@
|
||||
|
||||
</resultMap>
|
||||
|
||||
<!-- 按月统计-->
|
||||
<select id="queryBillPayMonthList" parameterType="EmisSettleBill" resultType="map">
|
||||
SELECT
|
||||
bill_month as billMonth,
|
||||
round(sum(rec_money),2) as recMoney,
|
||||
round(sum(reced_money),2) as recedMoney,
|
||||
(round(sum(rec_money),2)-round(sum(reced_money),2) ) as noRecedMoney
|
||||
FROM emis_settle_bill
|
||||
WHERE del_flag = '0'
|
||||
GROUP BY bill_month
|
||||
ORDER BY bill_month
|
||||
</select>
|
||||
|
||||
<!-- 收款统计-PMS需求:379-->
|
||||
<select id="queryPayBackStatList" parameterType="EmisSettleBill" resultType="map">
|
||||
@ -134,6 +146,8 @@
|
||||
tba.salesmen as salesmen,
|
||||
tba.payee as payee,
|
||||
tba.create_time as createTime,
|
||||
|
||||
IFNULL( tbb.totalPayMoney, 0 ) AS totalPayMoney,
|
||||
IFNULL( tbb.recdMoneyIn, 0 ) AS recdMoneyIn,
|
||||
IFNULL( tbb.recdPayMoney60D, 0 ) recdPayMoney60D,
|
||||
IFNULL( tbb.recdPayMoneyGreat60D, 0 ) recdPayMoneyGreat60D,
|
||||
@ -187,6 +201,13 @@
|
||||
and espr.trade_date <![CDATA[ >= ]]> #{params.beginTradeDate}
|
||||
)
|
||||
</if>
|
||||
<if test="params.endTradeDate != null and params.endTradeDate != ''">
|
||||
and exists (
|
||||
select 1 from emis_settle_pay_record espr,emis_settle_pay_bill_rel espbr
|
||||
where espr.del_flag='0' and espbr.del_flag='0' and a.settle_bill_no=espr.settle_bill_no and espr.pay_id = espbr.pay_id
|
||||
and espr.trade_date <![CDATA[ <= ]]> #{params.endTradeDate}
|
||||
)
|
||||
</if>
|
||||
<if test="params.payCreateBy != null and params.payCreateBy != ''">
|
||||
and exists (
|
||||
select 1 from emis_settle_pay_record espr,emis_settle_pay_bill_rel espbr
|
||||
@ -194,13 +215,7 @@
|
||||
and espr.create_by = #{params.payCreateBy}
|
||||
)
|
||||
</if>
|
||||
<if test="params.endTradeDate != null and params.endTradeDate != ''">
|
||||
and exists (
|
||||
select 1 from emis_settle_pay_record espr,emis_settle_pay_bill_rel espbr
|
||||
where espr.del_flag='0' and espbr.del_flag='0' and a.settle_bill_no=espr.settle_bill_no and espr.pay_id = espbr.pay_id
|
||||
and espr.trade_date <![CDATA[ <= ]]> #{params.endTradeDate}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
a.salesmen=#{params.privEmpName}
|
||||
@ -215,18 +230,26 @@
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
a.settle_bill_no,
|
||||
sum( if( b.trade_date <![CDATA[ <= ]]> a.payment_due_date,b.pay_money,0) ) AS recdMoneyIn,
|
||||
sum( if(b.trade_date <![CDATA[ > ]]> a.payment_due_date and b.trade_date <![CDATA[ <= ]]> DATE_SUB( a.payment_due_date, INTERVAL - 30 DAY ),b.pay_money,0) ) AS recdPayMoney60D,
|
||||
sum( if(b.trade_date <![CDATA[ > ]]> DATE_SUB( a.payment_due_date, INTERVAL - 30 DAY ),b.pay_money,0) ) AS recdPayMoneyGreat60D
|
||||
sum( d.pay_money) AS totalPayMoney,
|
||||
sum( if(b.trade_date <![CDATA[ <= ]]> a.payment_due_date,d.pay_money,0) ) AS recdMoneyIn,
|
||||
sum( if(a.settle_type='2' and a.credit_period <![CDATA[ >= ]]> 30 and b.trade_date <![CDATA[ > ]]> a.payment_due_date and b.trade_date <![CDATA[ > ]]> a.payment_due_date and b.trade_date <![CDATA[ < ]]> DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ),d.pay_money,0) ) AS recdPayMoney60D,
|
||||
sum( if( (a.settle_type='2' and a.credit_period <![CDATA[ >= ]]> 30 and b.trade_date <![CDATA[ > ]]> a.payment_due_date and b.trade_date <![CDATA[ >= ]]> DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ) ) or ( ( (a.settle_type='2' and a.credit_period <![CDATA[ < ]]> 30) or a.settle_type='1' ) and b.trade_date <![CDATA[ > ]]> a.payment_due_date ),d.pay_money,0) ) AS recdPayMoneyGreat60D
|
||||
FROM
|
||||
emis_settle_bill a,
|
||||
emis_settle_pay_record b,
|
||||
emis_settle_pay_bill_rel c
|
||||
emis_settle_pay_bill_rel c,
|
||||
emis_settle_pay_rel d,
|
||||
emis_settle_sub_bill e
|
||||
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
AND b.del_flag = '0'
|
||||
AND c.del_flag = '0'
|
||||
and d.del_flag ='0'
|
||||
AND a.settle_bill_no = c.settle_bill_no
|
||||
and d.pay_id=b.pay_id
|
||||
and d.bill_no=e.bill_code
|
||||
and e.settle_bill_no=a.settle_bill_no
|
||||
AND b.pay_id = c.pay_id
|
||||
<if test="settleBillNo != null and settleBillNo != ''"> and FIND_IN_SET(a.`settle_bill_no`,#{settleBillNo})</if>
|
||||
<if test="custNo != null and custNo != ''"> and a.cust_no = #{custNo}</if>
|
||||
@ -237,11 +260,7 @@
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.billCode != null and params.billCode != ''">
|
||||
and exists (
|
||||
select 1 from emis_settle_sub_bill b
|
||||
where a.settle_bill_no=b.settle_bill_no
|
||||
and ( FIND_IN_SET(b.`bill_code`,#{params.billCode}) or b.bill_code like concat('%', #{params.billCode}, '%') )
|
||||
)
|
||||
and ( FIND_IN_SET(e.`bill_code`,#{params.billCode}) or e.bill_code like concat('%', #{params.billCode}, '%') )
|
||||
</if>
|
||||
<if test="params.payCreateBy != null and params.payCreateBy != ''">
|
||||
and b.create_by = #{params.payCreateBy}
|
||||
|
||||
@ -85,6 +85,107 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select id, pay_id, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_pay_record
|
||||
</sql>
|
||||
|
||||
<select id="getSettlePayStatInfoMap" parameterType="EmisSettlePayRecord" resultType="map">
|
||||
select sum(pay_money) as totalPayMoney
|
||||
from emis_settle_pay_record
|
||||
<where>
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="payId != null and payId != ''"> and pay_id = #{payId}</if>
|
||||
<if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
|
||||
<if test="recType != null and recType != ''"> and rec_type = #{recType}</if>
|
||||
<if test="payMan != null and payMan != ''"> and pay_man like concat('%', #{payMan}, '%')</if>
|
||||
<if test="payManCode != null and payManCode != ''"> and pay_man_code like concat('%', #{payManCode}, '%')</if>
|
||||
|
||||
<if test="blAudit != null and blAudit != ''"> and bl_audit = #{blAudit}</if>
|
||||
<if test="auditDate != null "> and audit_date = #{auditDate}</if>
|
||||
<if test="auditManCode != null and auditManCode != ''"> and audit_man_code = #{auditManCode}</if>
|
||||
<if test="auditSiteCode != null and auditSiteCode != ''"> and audit_site_code = #{auditSiteCode}</if>
|
||||
<if test="customerCode != null and customerCode != ''"> and customer_code = #{customerCode}</if>
|
||||
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
||||
<if test="payMoney != null "> and pay_money = #{payMoney}</if>
|
||||
<if test="payStatus != null and payStatus != ''"> and pay_status = #{payStatus}</if>
|
||||
<if test="payStatusDesc != null and payStatusDesc != ''"> and pay_status_desc like concat('%', #{payStatusDesc}, '%')</if>
|
||||
<if test="breakType != null and breakType != ''"> and break_type = #{breakType}</if>
|
||||
<if test="breakReason != null and breakReason != ''"> and break_reason like concat('%', #{breakReason}, '%')</if>
|
||||
<if test="breakEmpCode != null and breakEmpCode != ''"> and break_emp_code = #{breakEmpCode}</if>
|
||||
<if test="recManCode != null and recManCode != ''"> and rec_man_code = #{recManCode}</if>
|
||||
<if test="settleType != null and settleType != ''"> and settle_type = #{settleType}</if>
|
||||
<if test="refundDate != null "> and refund_date = #{refundDate}</if>
|
||||
<if test="refundManCode != null and refundManCode != ''"> and refund_man_code = #{refundManCode}</if>
|
||||
<if test="refundSeq != null and refundSeq != ''"> and refund_seq = #{refundSeq}</if>
|
||||
<if test="refundMode != null and refundMode != ''"> and refund_mode = #{refundMode}</if>
|
||||
<if test="refundMoney != null "> and refund_money = #{refundMoney}</if>
|
||||
<if test="refundReason != null and refundReason != ''"> and refund_reason like concat('%', #{refundReason}, '%')</if>
|
||||
<if test="refundRemark != null and refundRemark != ''"> and refund_remark like concat('%', #{refundRemark}, '%')</if>
|
||||
<if test="refundOpManCode != null and refundOpManCode != ''"> and refund_op_man_code = #{refundOpManCode}</if>
|
||||
<if test="refundRegisterSiteCode != null and refundRegisterSiteCode != ''"> and refund_register_site_code = #{refundRegisterSiteCode}</if>
|
||||
<if test="refundRegisterManCode != null and refundRegisterManCode != ''"> and refund_register_man_code = #{refundRegisterManCode}</if>
|
||||
<if test="satisfyMoney != null "> and satisfy_money = #{satisfyMoney}</if>
|
||||
<if test="satisfyReason != null and satisfyReason != ''"> and satisfy_reason like concat('%', #{satisfyReason}, '%')</if>
|
||||
<if test="allowanceMoney != null "> and allowance_money = #{allowanceMoney}</if>
|
||||
<if test="allowanceReason != null and allowanceReason != ''"> and allowance_reason = #{allowanceReason}</if>
|
||||
<if test="deductionMoney != null "> and deduction_money = #{deductionMoney}</if>
|
||||
<if test="deductionReason != null and deductionReason != ''"> and deduction_reason = #{deductionReason}</if>
|
||||
<if test="otherMoney != null "> and other_money = #{otherMoney}</if>
|
||||
<if test="otherReason != null and otherReason != ''"> and other_reason like concat('%', #{otherReason}, '%')</if>
|
||||
<if test="tradeDate != null "> and trade_date = #{tradeDate}</if>
|
||||
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
||||
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
||||
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
|
||||
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
|
||||
</if>
|
||||
<if test="params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
|
||||
</if>
|
||||
|
||||
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
|
||||
and trade_date <![CDATA[ >= ]]> #{params.beginTradeDate}
|
||||
</if>
|
||||
<if test="params.endTradeDate != null and params.endTradeDate != ''">
|
||||
and trade_date <![CDATA[ <= ]]> #{params.endTradeDate}
|
||||
</if>
|
||||
|
||||
<if test="params.billCode != null and params.billCode != ''">
|
||||
and pay_id in(
|
||||
select pay_id from emis_settle_pay_rel espr
|
||||
where espr.del_flag='0'
|
||||
and FIND_IN_SET(espr.`bill_no`,#{params.billCode})
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="settleBillNo != null and settleBillNo != ''">
|
||||
and pay_id in(
|
||||
select pay_id from emis_settle_pay_bill_rel espbr
|
||||
where espbr.del_flag='0'
|
||||
and FIND_IN_SET(espbr.settle_bill_no,#{settleBillNo})
|
||||
)
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and settle_bill_no in(
|
||||
select bill_no from emis_settle_sub_bill b where del_flag='0'
|
||||
and (
|
||||
b.salesmen=#{params.privEmpName}
|
||||
or b.payee=#{params.privEmpName}
|
||||
or b.salesmen in(
|
||||
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectEmisSettlePayRecordList" parameterType="EmisSettlePayRecord" resultMap="EmisSettlePayRecordResult">
|
||||
<include refid="selectEmisSettlePayRecordVo"/>
|
||||
<where>
|
||||
@ -156,7 +257,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and pay_id in(
|
||||
select pay_id from emis_settle_pay_rel espr
|
||||
where espr.del_flag='0'
|
||||
and FIND_IN_SET(espr.`bill_code`,#{params.billCode})
|
||||
and FIND_IN_SET(espr.`bill_no`,#{params.billCode})
|
||||
)
|
||||
</if>
|
||||
|
||||
@ -218,13 +319,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and b.trade_date <![CDATA[ <= ]]> esb.payment_due_date
|
||||
</if>
|
||||
<if test="params.queryDataType != null and params.queryDataType == 2">
|
||||
and ( b.trade_date <![CDATA[ > ]]> esb.payment_due_date and b.trade_date <![CDATA[ <= ]]> DATE_SUB( esb.payment_due_date, INTERVAL - 30 DAY ) )
|
||||
and ( esb.settle_type='2' and esb.credit_period <![CDATA[ >= ]]> 30 and b.trade_date <![CDATA[ > ]]> esb.payment_due_date and b.trade_date <![CDATA[ > ]]> esb.payment_due_date and b.trade_date <![CDATA[ < ]]> DATE_SUB( esb.payment_due_date, INTERVAL (esb.credit_period-60) DAY ) )
|
||||
</if>
|
||||
<if test="params.queryDataType != null and params.queryDataType == 3">
|
||||
and b.trade_date <![CDATA[ > ]]> DATE_SUB( esb.payment_due_date, INTERVAL - 30 DAY )
|
||||
and ( ( esb.settle_type='2' and esb.credit_period <![CDATA[ >= ]]> 30 and b.trade_date <![CDATA[ > ]]> esb.payment_due_date and b.trade_date <![CDATA[ >= ]]> DATE_SUB( esb.payment_due_date, INTERVAL (esb.credit_period-60) DAY ) ) or ( ( (esb.settle_type='2' and esb.credit_period <![CDATA[ < ]]> 30) or esb.settle_type='1' ) and b.trade_date <![CDATA[ > ]]> esb.payment_due_date ) )
|
||||
</if>
|
||||
|
||||
<if test="settleBillNo != null and settleBillNo != ''">
|
||||
and espbr.settle_bill_no=#{settleBillNo}
|
||||
</if>
|
||||
<if test="payId != null and payId != ''">
|
||||
and espbr.pay_id=#{payId}
|
||||
</if>
|
||||
and FIND_IN_SET(espbr.settle_bill_no,#{settleBillNo})
|
||||
)
|
||||
<if test="settleBillNo != null and settleBillNo != ''">
|
||||
and a.settle_bill_no=#{settleBillNo}
|
||||
</if>
|
||||
<if test="payId != null and payId != ''">
|
||||
and b.pay_id=#{payId}
|
||||
</if>
|
||||
|
||||
order by b.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user