1.对账功能
2.订单改价关闭订单
This commit is contained in:
parent
5f50bf6b0b
commit
6555e10eab
|
@ -17,6 +17,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
|
|||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.pay.tm.TmPayService;
|
||||
import com.ruoyi.common.utils.CommonUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
|
@ -120,6 +121,12 @@ public class AppVerifyController extends BaseController
|
|||
@Resource
|
||||
private SysDeptMapper deptMapper;
|
||||
|
||||
@Autowired
|
||||
private EtChannelService etChannelService;
|
||||
|
||||
@Autowired
|
||||
private TmPayService tmPayService;
|
||||
|
||||
|
||||
/**
|
||||
* 故障上报
|
||||
|
@ -295,6 +302,13 @@ public class AppVerifyController extends BaseController
|
|||
if(!ServiceConstants.ORDER_STATUS_RIDING_END.equals(etOrder1.getStatus()) && !ServiceConstants.ORDER_STATUS_CANCEL_APPOINTMENT.equals(etOrder1.getStatus())){
|
||||
throw new ServiceException("改价失败,订单未结束,订单状态:"+etOrder1.getStatus());
|
||||
}
|
||||
String outTradeNo = etOrder1.getOutTradeNo();
|
||||
ChannelVO channelVO = etChannelService.selectSmChannelByChannelId(etOrder1.getPayChannel());
|
||||
if(StrUtil.isNotBlank(outTradeNo)){
|
||||
// 如果有outtradeno,则关闭订单
|
||||
tmPayService.closeOrder(channelVO,outTradeNo);
|
||||
logger.info("【订单改价】订单【{}】,有outTradeNo = 【{}】,查询订单未支付,关闭订单:{}", etOrder1.getOrderNo(),outTradeNo);
|
||||
}
|
||||
BigDecimal payFee = BigDecimal.ZERO;
|
||||
if(ObjectUtil.isNotNull(etOrder.getDispatchFee())){
|
||||
payFee = payFee.add(etOrder.getDispatchFee());
|
||||
|
@ -735,6 +749,17 @@ public class AppVerifyController extends BaseController
|
|||
return success(operatingDataVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台对账
|
||||
*/
|
||||
@GetMapping(value = "/selfReconciliation")
|
||||
public AjaxResult selfReconciliation(String timeStart,String timeEnd,String areaId)
|
||||
{
|
||||
logger.info("【平台对账】请求参数:timeStart={},timeEnd={},areaId={}", timeStart,timeEnd,areaId);
|
||||
List<SelfReconciliationVO> selfReconciliation = etOrderService.selfReconciliation(timeStart,timeEnd,areaId);
|
||||
return success(selfReconciliation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 收入对账
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.EtReconciliation;
|
||||
import com.ruoyi.system.service.IEtReconciliationService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 平台对账Controller
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/reconciliation2")
|
||||
public class EtReconciliationController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEtReconciliationService etReconciliationService;
|
||||
|
||||
/**
|
||||
* 查询平台对账列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:reconciliation2:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EtReconciliation etReconciliation)
|
||||
{
|
||||
startPage();
|
||||
List<EtReconciliation> list = etReconciliationService.selectEtReconciliationList(etReconciliation);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出平台对账列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:reconciliation2:export')")
|
||||
@Log(title = "平台对账", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EtReconciliation etReconciliation)
|
||||
{
|
||||
List<EtReconciliation> list = etReconciliationService.selectEtReconciliationList(etReconciliation);
|
||||
ExcelUtil<EtReconciliation> util = new ExcelUtil<EtReconciliation>(EtReconciliation.class);
|
||||
util.exportExcel(response, list, "平台对账数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取平台对账详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:reconciliation2:query')")
|
||||
@GetMapping(value = "/{reconciliationId}")
|
||||
public AjaxResult getInfo(@PathVariable("reconciliationId") Long reconciliationId)
|
||||
{
|
||||
return success(etReconciliationService.selectEtReconciliationByReconciliationId(reconciliationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增平台对账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:reconciliation2:add')")
|
||||
@Log(title = "平台对账", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EtReconciliation etReconciliation)
|
||||
{
|
||||
return toAjax(etReconciliationService.insertEtReconciliation(etReconciliation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改平台对账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:reconciliation2:edit')")
|
||||
@Log(title = "平台对账", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EtReconciliation etReconciliation)
|
||||
{
|
||||
return toAjax(etReconciliationService.updateEtReconciliation(etReconciliation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除平台对账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:reconciliation2:remove')")
|
||||
@Log(title = "平台对账", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reconciliationIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] reconciliationIds)
|
||||
{
|
||||
return toAjax(etReconciliationService.deleteEtReconciliationByReconciliationIds(reconciliationIds));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 平台对账对象 et_reconciliation
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-03
|
||||
*/
|
||||
@Data
|
||||
public class EtReconciliation extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 对账id */
|
||||
private Long reconciliationId;
|
||||
|
||||
/** 总收入 */
|
||||
@Excel(name = "总收入")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/** 订单支付 */
|
||||
@Excel(name = "订单支付")
|
||||
private BigDecimal orderPaid;
|
||||
|
||||
/** 押金支付 */
|
||||
@Excel(name = "押金支付")
|
||||
private BigDecimal depositPaid;
|
||||
|
||||
/** 支付渠道id */
|
||||
@Excel(name = "支付渠道id")
|
||||
private Long payChannel;
|
||||
|
||||
/** 对账日期 */
|
||||
@Excel(name = "对账日期")
|
||||
private String day;
|
||||
|
||||
/** 押金退款 */
|
||||
@Excel(name = "押金退款")
|
||||
private BigDecimal depositRefund;
|
||||
|
||||
/** 押金抵扣金额 */
|
||||
@Excel(name = "押金抵扣金额")
|
||||
private BigDecimal deductionAmount;
|
||||
|
||||
/** 手续费 */
|
||||
@Excel(name = "手续费")
|
||||
private BigDecimal handlingCharge;
|
||||
|
||||
/** 用户账变 */
|
||||
@Excel(name = "用户账变")
|
||||
private BigDecimal userReceipts;
|
||||
|
||||
/** 结算金额 */
|
||||
@Excel(name = "结算金额")
|
||||
private BigDecimal settlementAmount;
|
||||
|
||||
/** 平台服务费 */
|
||||
@Excel(name = "平台服务费")
|
||||
private BigDecimal platformServiceFee;
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 平台对账
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-10-02
|
||||
*/
|
||||
@Data
|
||||
public class SelfReconciliationVO {
|
||||
|
||||
//日期 格式:yyyy-MM-dd
|
||||
private String day;
|
||||
|
||||
//押金余额
|
||||
private BigDecimal depositBalance= BigDecimal.ZERO;
|
||||
|
||||
//总流水
|
||||
private BigDecimal totalFlowAmount= BigDecimal.ZERO;
|
||||
|
||||
//订单支付 包含押金抵扣
|
||||
private BigDecimal orderPaid= BigDecimal.ZERO;
|
||||
|
||||
//押金充值
|
||||
private BigDecimal depositPaid= BigDecimal.ZERO;
|
||||
|
||||
//押金抵扣金额
|
||||
private BigDecimal deductionAmount= BigDecimal.ZERO;
|
||||
|
||||
//总支出
|
||||
private BigDecimal totalExpenditure= BigDecimal.ZERO;
|
||||
|
||||
//订单退款
|
||||
private BigDecimal orderRefund= BigDecimal.ZERO;
|
||||
|
||||
//押金退款
|
||||
private BigDecimal depositRefund= BigDecimal.ZERO;
|
||||
|
||||
//押金变化
|
||||
private BigDecimal depositChange= BigDecimal.ZERO;
|
||||
|
||||
//用户账变收入
|
||||
private BigDecimal userReceipts= BigDecimal.ZERO;
|
||||
|
||||
//手续费
|
||||
private BigDecimal handlingCharge= BigDecimal.ZERO;
|
||||
|
||||
// 平台服务费
|
||||
private BigDecimal platformServiceFee= BigDecimal.ZERO;
|
||||
|
||||
//结算金额
|
||||
private BigDecimal settlementAmount= BigDecimal.ZERO;
|
||||
}
|
|
@ -81,6 +81,14 @@ public interface EtCapitalFlowMapper
|
|||
*/
|
||||
BigDecimal getHandlingFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId);
|
||||
|
||||
/**
|
||||
* 手续费
|
||||
*
|
||||
* @param areaId 运营区id
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getHandlingFee2(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
|
||||
/**
|
||||
* 平台服务费
|
||||
*
|
||||
|
@ -88,6 +96,13 @@ public interface EtCapitalFlowMapper
|
|||
* @return
|
||||
*/
|
||||
BigDecimal getServiceFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId);
|
||||
/**
|
||||
* 平台服务费
|
||||
*
|
||||
* @param areaId 运营区id
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getServiceFee2(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
|
||||
/**
|
||||
* 骑行订单收入
|
||||
|
@ -104,4 +119,20 @@ public interface EtCapitalFlowMapper
|
|||
* @return
|
||||
*/
|
||||
BigDecimal getDeductionAmount(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId);
|
||||
|
||||
/**
|
||||
* 已支付骑行订单
|
||||
*
|
||||
* @param areaId 运营区id
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getOrderPaidAmount(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
|
||||
/**
|
||||
* 统计所有用户今日账变
|
||||
*
|
||||
* @param areaId 运营区id
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getAllUserReceipts(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.EtModelRule;
|
||||
|
||||
/**
|
||||
|
@ -16,14 +18,15 @@ public interface EtModelRuleMapper extends BaseMapper<EtModelRule>
|
|||
* @param areaId 运营区id
|
||||
* @return 结果
|
||||
*/
|
||||
@Log(title = "mapper中,根据车型id删除车型与收费方式关系", businessType = BusinessType.DELETE)
|
||||
public int deleteModelRuleByModelId(Long areaId);
|
||||
|
||||
/**
|
||||
* 通过用ruleId删除区域与收费方式关联
|
||||
*
|
||||
* @param ruleId 运营区id
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteModelRuleByRuleId(Long ruleId);
|
||||
// /**
|
||||
// * 通过用ruleId删除区域与收费方式关联
|
||||
// *
|
||||
// * @param ruleId 运营区id
|
||||
// * @return 结果
|
||||
// */
|
||||
// public int deleteModelRuleByRuleId(Long ruleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -252,10 +252,15 @@ public interface EtOrderMapper
|
|||
*/
|
||||
BigDecimal getRefundFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("sn") String sn, @Param("areaId") Long areaId);
|
||||
|
||||
/**
|
||||
* 已退款
|
||||
*/
|
||||
BigDecimal getRefundFee2(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("sn") String sn, @Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
|
||||
/**
|
||||
* 押金退款
|
||||
*/
|
||||
BigDecimal getDepositRefundFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("sn") String sn, @Param("areaId") Long areaId);
|
||||
BigDecimal getDepositRefundFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("sn") String sn, @Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
|
||||
/**
|
||||
* 收入
|
||||
|
@ -313,7 +318,7 @@ public interface EtOrderMapper
|
|||
/**
|
||||
* 押金订单收入
|
||||
*/
|
||||
BigDecimal getDepositAmount(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("areaId") Long areaId);
|
||||
BigDecimal getDepositAmount(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
|
||||
// /**
|
||||
// * 平台服务费
|
||||
|
@ -344,4 +349,15 @@ public interface EtOrderMapper
|
|||
* 押金抵扣不成功的修复
|
||||
*/
|
||||
List<EtOrder> deductionErrorOrderList();
|
||||
|
||||
/**
|
||||
* 平台对账--总支付流水(包含订单+押金)
|
||||
*/
|
||||
BigDecimal getTotalPaidFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr ,@Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
|
||||
/**
|
||||
* 平台对账--押金抵扣金额
|
||||
*/
|
||||
BigDecimal getDepositDeductionAmount(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr ,@Param("areaId") Long areaId,@Param("channelId") Long channelId);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EtReconciliation;
|
||||
|
||||
/**
|
||||
* 平台对账Mapper接口
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-03
|
||||
*/
|
||||
public interface EtReconciliationMapper
|
||||
{
|
||||
/**
|
||||
* 查询平台对账
|
||||
*
|
||||
* @param reconciliationId 平台对账主键
|
||||
* @return 平台对账
|
||||
*/
|
||||
public EtReconciliation selectEtReconciliationByReconciliationId(Long reconciliationId);
|
||||
|
||||
/**
|
||||
* 查询平台对账列表
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 平台对账集合
|
||||
*/
|
||||
public List<EtReconciliation> selectEtReconciliationList(EtReconciliation etReconciliation);
|
||||
|
||||
/**
|
||||
* 新增平台对账
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEtReconciliation(EtReconciliation etReconciliation);
|
||||
|
||||
/**
|
||||
* 修改平台对账
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEtReconciliation(EtReconciliation etReconciliation);
|
||||
|
||||
/**
|
||||
* 删除平台对账
|
||||
*
|
||||
* @param reconciliationId 平台对账主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtReconciliationByReconciliationId(Long reconciliationId);
|
||||
|
||||
/**
|
||||
* 批量删除平台对账
|
||||
*
|
||||
* @param reconciliationIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtReconciliationByReconciliationIds(Long[] reconciliationIds);
|
||||
}
|
|
@ -154,6 +154,12 @@ public interface IEtOrderService
|
|||
*/
|
||||
ReconciliationVo reconciliation(String timeStart, String timeEnd, String type,String sn,String areaId);
|
||||
|
||||
|
||||
/**
|
||||
* 平台对账
|
||||
*/
|
||||
List<SelfReconciliationVO> selfReconciliation(String timeStart, String timeEnd, String areaId);
|
||||
|
||||
/**
|
||||
* 最近一笔订单
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EtReconciliation;
|
||||
|
||||
/**
|
||||
* 平台对账Service接口
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-03
|
||||
*/
|
||||
public interface IEtReconciliationService
|
||||
{
|
||||
/**
|
||||
* 查询平台对账
|
||||
*
|
||||
* @param reconciliationId 平台对账主键
|
||||
* @return 平台对账
|
||||
*/
|
||||
public EtReconciliation selectEtReconciliationByReconciliationId(Long reconciliationId);
|
||||
|
||||
/**
|
||||
* 查询平台对账列表
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 平台对账集合
|
||||
*/
|
||||
public List<EtReconciliation> selectEtReconciliationList(EtReconciliation etReconciliation);
|
||||
|
||||
/**
|
||||
* 新增平台对账
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEtReconciliation(EtReconciliation etReconciliation);
|
||||
|
||||
/**
|
||||
* 修改平台对账
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEtReconciliation(EtReconciliation etReconciliation);
|
||||
|
||||
/**
|
||||
* 批量删除平台对账
|
||||
*
|
||||
* @param reconciliationIds 需要删除的平台对账主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtReconciliationByReconciliationIds(Long[] reconciliationIds);
|
||||
|
||||
/**
|
||||
* 删除平台对账信息
|
||||
*
|
||||
* @param reconciliationId 平台对账主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtReconciliationByReconciliationId(Long reconciliationId);
|
||||
}
|
|
@ -167,10 +167,10 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService
|
|||
@Override
|
||||
public int updateEtFeeRule(EtFeeRule etFeeRule)
|
||||
{
|
||||
int i = etModelRuleMapper.deleteModelRuleByModelId(etFeeRule.getRuleId());
|
||||
if(ObjectUtil.isNotNull(etFeeRule.getModelId()) && etFeeRule.getModelId() != 0){
|
||||
etModelRuleMapper.insert(EtModelRule.builder().modelId(etFeeRule.getModelId()).ruleId(etFeeRule.getRuleId()).build());
|
||||
}
|
||||
// int i = etModelRuleMapper.deleteModelRuleByModelId(etFeeRule.getRuleId());
|
||||
// if(ObjectUtil.isNotNull(etFeeRule.getModelId()) && etFeeRule.getModelId() != 0){
|
||||
// etModelRuleMapper.insert(EtModelRule.builder().modelId(etFeeRule.getModelId()).ruleId(etFeeRule.getRuleId()).build());
|
||||
// }
|
||||
return etFeeRuleMapper.updateEtFeeRule(etFeeRule);
|
||||
}
|
||||
|
||||
|
|
|
@ -1406,7 +1406,10 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
*/
|
||||
@Override
|
||||
public OperatingDataVo2 getOperatingData2(String timeStart,String timeEnd,String areaId) {
|
||||
long aLong = Long.parseLong(areaId);
|
||||
long aLong = 0;
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
aLong = Long.parseLong(areaId);
|
||||
}
|
||||
OperatingDataVo2 operatingDataVo = new OperatingDataVo2();
|
||||
if(StrUtil.isNotBlank(timeStart) && StrUtil.isNotBlank(timeEnd)){
|
||||
/*收入相关*/
|
||||
|
@ -1414,7 +1417,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
/** 总收入*/
|
||||
BigDecimal totalAmount = defaultIfNull(etCapitalFlowMapper.getTotalAmount(timeStart, timeEnd, null, aLong),BigDecimal.ZERO);// 骑行订单收入
|
||||
BigDecimal deductionAmount = defaultIfNull(etCapitalFlowMapper.getDeductionAmount(timeStart, timeEnd, null, aLong),BigDecimal.ZERO);// 押金抵扣金额
|
||||
BigDecimal depositAmount = defaultIfNull(etOrderMapper.getDepositAmount(timeStart, timeEnd, aLong),BigDecimal.ZERO);// 押金收入
|
||||
BigDecimal depositAmount = defaultIfNull(etOrderMapper.getDepositAmount(timeStart, timeEnd, aLong,null),BigDecimal.ZERO);// 押金收入 25123
|
||||
BigDecimal totalFlowAmount = totalAmount.add(depositAmount).add(deductionAmount);// 总流水
|
||||
income.setTotalFlowAmount(totalFlowAmount);
|
||||
income.setDeductionAmount(deductionAmount);
|
||||
|
@ -1423,9 +1426,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
|
||||
/** 总支出*/
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(timeStart, timeEnd, null, aLong), BigDecimal.ZERO);//订单退款
|
||||
BigDecimal depositRefundFee = defaultIfNull(etOrderMapper.getDepositRefundFee(timeStart, timeEnd, null, aLong), BigDecimal.ZERO);//押金退款
|
||||
BigDecimal serviceFee = defaultIfNull(etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, Long.parseLong(areaId)),BigDecimal.ZERO);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = defaultIfNull(etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,Long.parseLong(areaId)),BigDecimal.ZERO);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal depositRefundFee = defaultIfNull(etOrderMapper.getDepositRefundFee(timeStart, timeEnd, null, aLong,null), BigDecimal.ZERO);//押金退款 24795
|
||||
BigDecimal serviceFee = defaultIfNull(etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, aLong),BigDecimal.ZERO);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = defaultIfNull(etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,aLong),BigDecimal.ZERO);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal totalExpenditure = defaultIfNull(refundFee.add(depositRefundFee).add(serviceFee).add(platformServiceFee), BigDecimal.ZERO);
|
||||
|
||||
income.setOrderRefund(refundFee);
|
||||
|
@ -1605,6 +1608,72 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
return reconciliationVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台对账
|
||||
* */
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<SelfReconciliationVO> selfReconciliation(String timeStart, String timeEnd, String areaId) {
|
||||
long aLong = 0;
|
||||
// if(StrUtil.isNotBlank(areaId)){
|
||||
// aLong = Long.parseLong(areaId);
|
||||
// }
|
||||
// if(StrUtil.isNotBlank(timeStart) && StrUtil.isNotBlank(timeEnd)){
|
||||
// List<SelfReconciliationVO> selfReconciliationVOS = new ArrayList<>();
|
||||
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// int limit = DateUtils.differentDaysByMillisecond(timeStart, timeEnd) + 1;
|
||||
//
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// calendar.setTime(dateFormat.parse(timeEnd));
|
||||
//
|
||||
// for (int i = 0; i < limit; i++) {
|
||||
// SelfReconciliationVO selfReconciliationVO = new SelfReconciliationVO();
|
||||
// String formattedDate = dateFormat.format(calendar.getTime());
|
||||
// String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
|
||||
// String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
|
||||
//
|
||||
// /** 总收入*/
|
||||
// selfReconciliationVO.setDay(formattedDate);
|
||||
// BigDecimal totalFlowAmount = defaultIfNull(etOrderMapper.getTotalPaidFee(startDateStr, endDateStr, aLong),BigDecimal.ZERO);// 骑行订单收入 29835.51
|
||||
// BigDecimal totalAmount = defaultIfNull(etCapitalFlowMapper.getOrderPaidAmount(startDateStr, endDateStr, aLong),BigDecimal.ZERO);// 骑行订单收入 4712.51
|
||||
// BigDecimal deductionAmount = defaultIfNull(etOrderMapper.getDepositDeductionAmount(startDateStr, endDateStr, aLong),BigDecimal.ZERO);// 押金抵扣金额 538
|
||||
// BigDecimal depositAmount = defaultIfNull(etOrderMapper.getDepositAmount(startDateStr, endDateStr, aLong),BigDecimal.ZERO);// 押金收入 25123
|
||||
// BigDecimal handlingFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, aLong);//手续费,扣除掉退款部分的
|
||||
// BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,aLong);//平台服务费 ,扣除掉退款部分的
|
||||
//
|
||||
// selfReconciliationVO.setOrderPaid(totalAmount);
|
||||
// selfReconciliationVO.setTotalFlowAmount(totalFlowAmount);
|
||||
// selfReconciliationVO.setDeductionAmount(deductionAmount);
|
||||
// selfReconciliationVO.setDepositPaid(depositAmount);
|
||||
// selfReconciliationVO.setHandlingCharge(handlingFee);
|
||||
// selfReconciliationVO.setPlatformServiceFee(platformServiceFee);
|
||||
//
|
||||
// /** 总支出*/
|
||||
// BigDecimal orderRefund = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, aLong), BigDecimal.ZERO);//订单退款
|
||||
// BigDecimal depositRefundFee = defaultIfNull(etOrderMapper.getDepositRefundFee(startDateStr, endDateStr, null, aLong), BigDecimal.ZERO);//押金退款 24795 25386
|
||||
// // depositChange 等于depositAmount减去deductionAmount减去depositRefundFee
|
||||
// selfReconciliationVO.setDepositChange(depositAmount.subtract(deductionAmount).subtract(depositRefundFee));
|
||||
// // 统计所有用户今日账变 进账
|
||||
// BigDecimal userReceipts = defaultIfNull(etCapitalFlowMapper.getAllUserReceipts(startDateStr, endDateStr, aLong),BigDecimal.ZERO);
|
||||
//
|
||||
// selfReconciliationVO.setOrderRefund(orderRefund);
|
||||
// selfReconciliationVO.setDepositRefund(depositRefundFee);
|
||||
// BigDecimal depositBalance = depositAmount.subtract(depositRefundFee).subtract(deductionAmount);
|
||||
// selfReconciliationVO.setDepositBalance(depositBalance);
|
||||
// selfReconciliationVO.setUserReceipts(userReceipts);
|
||||
// // 结算金额等于totalFlowAmount减去orderRefund减去depositRefundFee
|
||||
// selfReconciliationVO.setSettlementAmount(totalFlowAmount.subtract(orderRefund).subtract(depositRefundFee));
|
||||
// calendar.add(Calendar.DATE, -1);
|
||||
//
|
||||
// selfReconciliationVOS.add(selfReconciliationVO);
|
||||
// }
|
||||
// return selfReconciliationVOS;
|
||||
// }else{
|
||||
// throw new ServiceException("请选择时间");
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
private ReconciliationVo handleReconciliationByDate(String timeStart, String timeEnd, List<ReconciliationVo.Reconciliation> reconciliations,String areaId) throws Exception {
|
||||
ReconciliationVo reconciliationVo = new ReconciliationVo();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.EtReconciliationMapper;
|
||||
import com.ruoyi.system.domain.EtReconciliation;
|
||||
import com.ruoyi.system.service.IEtReconciliationService;
|
||||
|
||||
/**
|
||||
* 平台对账Service业务层处理
|
||||
*
|
||||
* @author qzz
|
||||
* @date 2024-10-03
|
||||
*/
|
||||
@Service
|
||||
public class EtReconciliationServiceImpl implements IEtReconciliationService
|
||||
{
|
||||
@Autowired
|
||||
private EtReconciliationMapper etReconciliationMapper;
|
||||
|
||||
/**
|
||||
* 查询平台对账
|
||||
*
|
||||
* @param reconciliationId 平台对账主键
|
||||
* @return 平台对账
|
||||
*/
|
||||
@Override
|
||||
public EtReconciliation selectEtReconciliationByReconciliationId(Long reconciliationId)
|
||||
{
|
||||
return etReconciliationMapper.selectEtReconciliationByReconciliationId(reconciliationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询平台对账列表
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 平台对账
|
||||
*/
|
||||
@Override
|
||||
public List<EtReconciliation> selectEtReconciliationList(EtReconciliation etReconciliation)
|
||||
{
|
||||
return etReconciliationMapper.selectEtReconciliationList(etReconciliation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增平台对账
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEtReconciliation(EtReconciliation etReconciliation)
|
||||
{
|
||||
etReconciliation.setCreateTime(DateUtils.getNowDate());
|
||||
return etReconciliationMapper.insertEtReconciliation(etReconciliation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改平台对账
|
||||
*
|
||||
* @param etReconciliation 平台对账
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEtReconciliation(EtReconciliation etReconciliation)
|
||||
{
|
||||
return etReconciliationMapper.updateEtReconciliation(etReconciliation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除平台对账
|
||||
*
|
||||
* @param reconciliationIds 需要删除的平台对账主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEtReconciliationByReconciliationIds(Long[] reconciliationIds)
|
||||
{
|
||||
return etReconciliationMapper.deleteEtReconciliationByReconciliationIds(reconciliationIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除平台对账信息
|
||||
*
|
||||
* @param reconciliationId 平台对账主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEtReconciliationByReconciliationId(Long reconciliationId)
|
||||
{
|
||||
return etReconciliationMapper.deleteEtReconciliationByReconciliationId(reconciliationId);
|
||||
}
|
||||
}
|
|
@ -26,9 +26,11 @@ import com.ruoyi.common.utils.uuid.IdUtils;
|
|||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.vo.AsDeviceVO;
|
||||
import com.ruoyi.system.domain.vo.OperatingDataVo;
|
||||
import com.ruoyi.system.domain.vo.SelfReconciliationVO;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.*;
|
||||
import com.wechat.pay.java.service.refund.model.Refund;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -43,6 +45,7 @@ import java.math.BigDecimal;
|
|||
import java.math.RoundingMode;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
@ -105,6 +108,15 @@ public class EtTask {
|
|||
@Resource
|
||||
private EtCouponClaimLogMapper etCouponClaimLogMapper;
|
||||
|
||||
@Resource
|
||||
private EtCapitalFlowMapper etCapitalFlowMapper;
|
||||
|
||||
@Resource
|
||||
private EtReconciliationMapper etReconciliationMapper;
|
||||
|
||||
@Autowired
|
||||
private EtChannelService smEtChannelService;
|
||||
|
||||
@Value(value = "${iot.deviceUrl}")
|
||||
private String deviceUrl;
|
||||
|
||||
|
@ -795,4 +807,94 @@ public class EtTask {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 平台对账
|
||||
* */
|
||||
@SneakyThrows
|
||||
public void selfReconciliation(String timeStart, String timeEnd, String areaId) {
|
||||
long aLong = 0;
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
aLong = Long.parseLong(areaId);
|
||||
}
|
||||
if(StrUtil.isNotBlank(timeStart) && StrUtil.isNotBlank(timeEnd)){
|
||||
List<ChannelVO> channelVOS = smEtChannelService.selectSmChannelList(new ChannelQuery());
|
||||
for (ChannelVO channel:channelVOS) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
int limit = DateUtils.differentDaysByMillisecond(timeStart, timeEnd) + 1;
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(dateFormat.parse(timeEnd));
|
||||
for (int i = 0; i < limit; i++) {
|
||||
String formattedDate = dateFormat.format(calendar.getTime());
|
||||
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
|
||||
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
|
||||
/** 总收入*/
|
||||
SelfReconciliationVO selfReconciliationVO = buildSelfReconciliation(startDateStr,endDateStr, formattedDate,aLong,channel.getChannelId());
|
||||
// 保存
|
||||
saveRecon(formattedDate, selfReconciliationVO,channel.getChannelId());
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
throw new ServiceException("请选择时间");
|
||||
}
|
||||
}
|
||||
|
||||
private SelfReconciliationVO buildSelfReconciliation(String startDateStr, String endDateStr, String formattedDate, Long aLong, Long channelId) {
|
||||
SelfReconciliationVO selfReconciliationVO = new SelfReconciliationVO();
|
||||
selfReconciliationVO.setDay(formattedDate);
|
||||
BigDecimal totalFlowAmount = defaultIfNull(etOrderMapper.getTotalPaidFee(startDateStr, endDateStr, aLong,channelId),BigDecimal.ZERO);// 骑行订单收入 29835.51
|
||||
BigDecimal totalAmount = defaultIfNull(etCapitalFlowMapper.getOrderPaidAmount(startDateStr, endDateStr, aLong,channelId),BigDecimal.ZERO);// 骑行订单收入 4712.51
|
||||
BigDecimal deductionAmount = defaultIfNull(etOrderMapper.getDepositDeductionAmount(startDateStr, endDateStr, aLong,channelId),BigDecimal.ZERO);// 押金抵扣金额 538
|
||||
BigDecimal depositAmount = defaultIfNull(etOrderMapper.getDepositAmount(startDateStr, endDateStr, aLong,channelId),BigDecimal.ZERO);// 押金收入 25123
|
||||
BigDecimal handlingFee = etCapitalFlowMapper.getHandlingFee2(startDateStr, endDateStr, null, aLong,channelId);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee2(startDateStr, endDateStr, null,aLong,channelId);//平台服务费 ,扣除掉退款部分的
|
||||
|
||||
selfReconciliationVO.setOrderPaid(totalAmount);
|
||||
selfReconciliationVO.setTotalFlowAmount(totalFlowAmount);
|
||||
selfReconciliationVO.setDeductionAmount(deductionAmount);
|
||||
selfReconciliationVO.setDepositPaid(depositAmount);
|
||||
selfReconciliationVO.setHandlingCharge(handlingFee);
|
||||
selfReconciliationVO.setPlatformServiceFee(platformServiceFee);
|
||||
|
||||
/** 总支出*/
|
||||
BigDecimal orderRefund = defaultIfNull(etOrderMapper.getRefundFee2(startDateStr, endDateStr, null, aLong,channelId), BigDecimal.ZERO);//订单退款
|
||||
BigDecimal depositRefundFee = defaultIfNull(etOrderMapper.getDepositRefundFee(startDateStr, endDateStr, null, aLong,channelId), BigDecimal.ZERO);//押金退款 24795 25386
|
||||
// depositChange 等于depositAmount减去deductionAmount减去depositRefundFee
|
||||
selfReconciliationVO.setDepositChange(depositAmount.subtract(deductionAmount).subtract(depositRefundFee));
|
||||
// 统计所有用户今日账变 进账
|
||||
BigDecimal userReceipts = defaultIfNull(etCapitalFlowMapper.getAllUserReceipts(startDateStr, endDateStr, aLong,channelId),BigDecimal.ZERO);
|
||||
|
||||
selfReconciliationVO.setOrderRefund(orderRefund);
|
||||
selfReconciliationVO.setDepositRefund(depositRefundFee);
|
||||
BigDecimal depositBalance = depositAmount.subtract(depositRefundFee).subtract(deductionAmount);
|
||||
selfReconciliationVO.setDepositBalance(depositBalance);
|
||||
selfReconciliationVO.setUserReceipts(userReceipts);
|
||||
// 结算金额等于totalFlowAmount减去orderRefund减去depositRefundFee
|
||||
selfReconciliationVO.setSettlementAmount(totalFlowAmount.subtract(orderRefund).subtract(depositRefundFee));
|
||||
return selfReconciliationVO;
|
||||
}
|
||||
|
||||
private void saveRecon(String formattedDate,SelfReconciliationVO selfReconciliationVO,Long channelId) {
|
||||
EtReconciliation etReconciliation = new EtReconciliation();
|
||||
etReconciliation.setDay(formattedDate);
|
||||
etReconciliation.setTotalAmount(selfReconciliationVO.getTotalFlowAmount());
|
||||
etReconciliation.setHandlingCharge(selfReconciliationVO.getHandlingCharge());
|
||||
etReconciliation.setPlatformServiceFee(selfReconciliationVO.getPlatformServiceFee());
|
||||
etReconciliation.setDepositPaid(selfReconciliationVO.getDepositPaid());
|
||||
etReconciliation.setOrderPaid(selfReconciliationVO.getOrderPaid());
|
||||
etReconciliation.setDepositRefund(selfReconciliationVO.getDepositRefund());
|
||||
etReconciliation.setDeductionAmount(selfReconciliationVO.getDeductionAmount());
|
||||
etReconciliation.setUserReceipts(selfReconciliationVO.getUserReceipts());
|
||||
etReconciliation.setSettlementAmount(selfReconciliationVO.getSettlementAmount());
|
||||
etReconciliation.setCreateTime(DateUtils.getNowDate());
|
||||
etReconciliation.setPayChannel(channelId);
|
||||
int i1 = etReconciliationMapper.insertEtReconciliation(etReconciliation);
|
||||
log.info("【平台对账】保存对账数据结果:【{}】",i1);
|
||||
}
|
||||
|
||||
private BigDecimal defaultIfNull(BigDecimal value, BigDecimal defaultValue) {
|
||||
return value != null ? value : defaultValue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="timeEnd != null and timeEnd != ''">
|
||||
AND date_format(f.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''"> and f.area_id = #{areaId}</if>
|
||||
<if test="areaId != null and areaId != 0"> and f.area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getHandlingFee2" resultType="java.math.BigDecimal">
|
||||
select
|
||||
COALESCE(SUM(CASE
|
||||
WHEN f.type = '1' AND f.bus_type = '1' THEN f.handling_charge -- 收入手续费
|
||||
WHEN f.type = '2' AND f.bus_type = '4' THEN -f.handling_charge -- 退款手续费 (负数)
|
||||
ELSE 0
|
||||
END), 0) AS net_fee
|
||||
from et_capital_flow f
|
||||
LEFT JOIN et_order o on o.order_no = f.order_no
|
||||
where f.bus_type != '5' and f.bus_type != '6'
|
||||
<if test="sn != null and sn != ''"> and o.sn = #{sn}</if>
|
||||
<if test="timeStart != null and timeStart != ''">
|
||||
AND date_format(f.create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
</if>
|
||||
<if test="timeEnd != null and timeEnd != ''">
|
||||
AND date_format(f.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</if>
|
||||
<if test="areaId != null and areaId != 0"> and f.area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">and o.pay_channel = #{channelId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getServiceFee" resultType="java.math.BigDecimal">
|
||||
|
@ -151,7 +172,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="timeEnd != null and timeEnd != ''">
|
||||
AND date_format(f.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''"> and f.area_id = #{areaId}</if>
|
||||
<if test="areaId != null and areaId != 0"> and f.area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getServiceFee2" resultType="java.math.BigDecimal">
|
||||
select
|
||||
COALESCE(SUM(CASE WHEN f.type = 1 THEN f.platform_service_fee ELSE 0 END), 0)
|
||||
- COALESCE(SUM(CASE WHEN f.type = 2 THEN f.platform_service_fee ELSE 0 END), 0) AS net_fee
|
||||
from et_capital_flow f
|
||||
LEFT JOIN et_order o on o.order_no = f.order_no
|
||||
where f.area_id != 14
|
||||
<if test="sn != null and sn != ''"> and o.sn = #{sn}</if>
|
||||
<if test="timeStart != null and timeStart != ''">
|
||||
AND date_format(f.create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
</if>
|
||||
<if test="timeEnd != null and timeEnd != ''">
|
||||
AND date_format(f.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</if>
|
||||
<if test="areaId != null and areaId != 0"> and f.area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">and o.pay_channel = #{channelId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getTotalAmount" resultType="java.math.BigDecimal">
|
||||
|
@ -162,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="timeEnd != null and timeEnd != ''">
|
||||
AND date_format(f.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''"> and f.area_id = #{areaId}</if>
|
||||
<if test="areaId != null and areaId != 0"> and f.area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getDeductionAmount" resultType="java.math.BigDecimal">
|
||||
|
@ -173,7 +212,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="timeEnd != null and timeEnd != ''">
|
||||
AND date_format(f.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''"> and f.area_id = #{areaId}</if>
|
||||
<if test="areaId != null and areaId != 0"> and f.area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getOrderPaidAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
COALESCE(SUM(pay_fee), 0)
|
||||
FROM
|
||||
et_order
|
||||
WHERE 1=1
|
||||
<if test="channelId != 3 or (channelId == null)">and area_id != 14 </if>
|
||||
<if test="areaId != null and areaId != 0"> and area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">AND pay_channel = #{channelId}</if>
|
||||
<if test="timeStart != null and timeStart != ''">
|
||||
AND date_format(pay_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
</if>
|
||||
<if test="timeEnd != null and timeEnd != ''">
|
||||
AND date_format(pay_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</if>
|
||||
AND STATUS = 4
|
||||
AND type = 1
|
||||
AND paid = 1
|
||||
and total_fee != 0
|
||||
AND deposit_deduction = '0'
|
||||
</select>
|
||||
|
||||
<select id="getAllUserReceipts" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
COALESCE(SUM(CASE WHEN f.type = 1 THEN f.operator_dividend ELSE 0 END), 0)
|
||||
+ COALESCE(SUM(CASE WHEN f.type = 2 and f.bus_type = 4 THEN f.operator_dividend ELSE 0 END), 0) AS net_fee
|
||||
FROM
|
||||
et_capital_flow f
|
||||
left join et_order o on o.order_no = f.order_no
|
||||
where
|
||||
f.pay_type = 'wx' and f.area_id != 14
|
||||
<if test="areaId != null and areaId != 0"> and f.area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">and o.pay_channel = #{channelId}</if>
|
||||
<if test="timeStart != null and timeStart != ''">
|
||||
AND date_format(o.pay_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
</if>
|
||||
<if test="timeEnd != null and timeEnd != ''">
|
||||
AND date_format(o.pay_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
delete from et_model_rule where model_id=#{modelId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteModelRuleByRuleId">
|
||||
delete from et_model_rule where rule_id=#{ruleId}
|
||||
</delete>
|
||||
<!-- <delete id="deleteModelRuleByRuleId">-->
|
||||
<!-- delete from et_model_rule where rule_id=#{ruleId}-->
|
||||
<!-- </delete>-->
|
||||
</mapper>
|
||||
|
|
|
@ -696,10 +696,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<where>
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
AND date_format(pay_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="endDateStr != null and endDateStr != ''">
|
||||
AND date_format(create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
AND date_format(pay_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
</if>
|
||||
AND status = 4 and type = 1
|
||||
</where>
|
||||
|
@ -726,13 +726,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getDepositAmount" resultType="java.math.BigDecimal">
|
||||
select COALESCE(SUM(pay_fee), 0) from et_order o
|
||||
<where>
|
||||
<if test="areaId != null"> and o.area_id = #{areaId}</if>
|
||||
<if test="areaId != null and areaId != 0"> and o.area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">AND o.pay_channel = #{channelId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(o.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="endDateStr != null and endDateStr != ''">
|
||||
AND date_format(o.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="channelId != 3 or (channelId == null)">and o.area_id != 14 </if>
|
||||
AND o.status = 4 and o.type = 2 and o.paid = 1
|
||||
</where>
|
||||
</select>
|
||||
|
@ -775,7 +777,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join et_order o on o.order_no = ref.order_no
|
||||
<where>
|
||||
<if test="sn != null and sn != ''"> and o.sn = #{sn}</if>
|
||||
<if test="areaId != null"> and o.area_id = #{areaId}</if>
|
||||
<if test="areaId != null and areaId != 0"> and o.area_id = #{areaId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(ref.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
|
@ -786,18 +788,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getRefundFee2" resultType="java.math.BigDecimal">
|
||||
select COALESCE(SUM(amount), 0) from et_refund ref
|
||||
left join et_order o on o.order_no = ref.order_no
|
||||
<where>
|
||||
<if test="sn != null and sn != ''"> and o.sn = #{sn}</if>
|
||||
<if test="areaId != null and areaId != 0"> and o.area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">and o.pay_channel = #{channelId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(ref.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="endDateStr != null and endDateStr != ''">
|
||||
AND date_format(ref.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
</if>
|
||||
AND ref.type = 1 AND ref.refund_result = 'SUCCESS'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getDepositRefundFee" resultType="java.math.BigDecimal">
|
||||
select COALESCE(SUM(amount), 0) from et_refund ref
|
||||
left join et_order o on o.order_no = ref.order_no
|
||||
<where>
|
||||
<if test="sn != null and sn != ''"> and o.sn = #{sn}</if>
|
||||
<if test="areaId != null"> and o.area_id = #{areaId}</if>
|
||||
<if test="areaId != null and areaId != 0"> and o.area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">and o.pay_channel = #{channelId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(o.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
AND date_format(ref.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="endDateStr != null and endDateStr != ''">
|
||||
AND date_format(o.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
AND date_format(ref.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="channelId != 3 or (channelId == null)">and o.area_id != 14 </if>
|
||||
AND ref.type = 2 AND ref.refund_result = 'SUCCESS'
|
||||
</where>
|
||||
</select>
|
||||
|
@ -1168,5 +1190,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where status = 3 and pay_type = 'yj' and pay_time is not null
|
||||
</select>
|
||||
|
||||
<select id="getTotalPaidFee" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
total_order_fee - COALESCE(deposit_deduction_fee, 0) AS total_fee_after_deduction
|
||||
FROM
|
||||
(SELECT
|
||||
COALESCE(SUM(pay_fee), 0) AS total_order_fee
|
||||
FROM
|
||||
et_order
|
||||
WHERE 1=1
|
||||
<if test="channelId != 3 or (channelId == null)">and area_id != 14 </if>
|
||||
<if test="areaId != null and areaId != 0"> and area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">AND pay_channel = #{channelId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(pay_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="endDateStr != null and endDateStr != ''">
|
||||
AND date_format(pay_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
</if>
|
||||
AND STATUS = 4
|
||||
AND paid = 1
|
||||
AND total_fee != 0
|
||||
) AS total_order,
|
||||
(SELECT
|
||||
COALESCE(SUM(pay_fee), 0) AS deposit_deduction_fee
|
||||
FROM
|
||||
et_order
|
||||
WHERE 1=1
|
||||
<if test="channelId != null and channelId != 3">and area_id != 14</if>
|
||||
<if test="areaId != null and areaId != 0"> and area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">AND pay_channel = #{channelId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(pay_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="endDateStr != null and endDateStr != ''">
|
||||
AND date_format(pay_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
</if>
|
||||
AND STATUS = 4
|
||||
AND type = 1
|
||||
AND deposit_deduction = '1'
|
||||
AND paid = 1
|
||||
AND total_fee != 0
|
||||
) AS deduction
|
||||
</select>
|
||||
|
||||
<select id="getDepositDeductionAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
COALESCE(SUM(pay_fee), 0) AS deposit_deduction_fee
|
||||
FROM
|
||||
et_order
|
||||
WHERE 1=1
|
||||
<if test="channelId != 3 or (channelId == null)">and area_id != 14 </if>
|
||||
<if test="areaId != null and areaId != 0"> and area_id = #{areaId}</if>
|
||||
<if test="channelId != null ">and pay_channel = #{channelId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(pay_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="endDateStr != null and endDateStr != ''">
|
||||
AND date_format(pay_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
</if>
|
||||
AND STATUS = 4
|
||||
AND type = 1
|
||||
AND deposit_deduction = '1'
|
||||
AND paid = 1
|
||||
AND total_fee != 0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.EtReconciliationMapper">
|
||||
|
||||
<resultMap type="EtReconciliation" id="EtReconciliationResult">
|
||||
<result property="reconciliationId" column="reconciliation_id" />
|
||||
<result property="orderPaid" column="order_paid" />
|
||||
<result property="totalAmount" column="total_amount" />
|
||||
<result property="depositPaid" column="deposit_paid" />
|
||||
<result property="payChannel" column="pay_channel" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="day" column="day" />
|
||||
<result property="depositRefund" column="deposit_refund" />
|
||||
<result property="deductionAmount" column="deduction_amount" />
|
||||
<result property="handlingCharge" column="handling_charge" />
|
||||
<result property="userReceipts" column="user_receipts" />
|
||||
<result property="settlementAmount" column="settlement_amount" />
|
||||
<result property="platformServiceFee" column="platform_service_fee" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEtReconciliationVo">
|
||||
select reconciliation_id, order_paid, total_amount, deposit_paid, pay_channel, create_time, day, deposit_refund, deduction_amount, handling_charge, user_receipts, settlement_amount, platform_service_fee from et_reconciliation
|
||||
</sql>
|
||||
|
||||
<select id="selectEtReconciliationList" parameterType="EtReconciliation" resultMap="EtReconciliationResult">
|
||||
<include refid="selectEtReconciliationVo"/>
|
||||
<where>
|
||||
<if test="orderPaid != null "> and order_paid = #{orderPaid}</if>
|
||||
<if test="depositPaid != null "> and deposit_paid = #{depositPaid}</if>
|
||||
<if test="payChannel != null "> and pay_channel = #{payChannel}</if>
|
||||
<if test="day != null "> and day = #{day}</if>
|
||||
<if test="depositRefund != null "> and deposit_refund = #{depositRefund}</if>
|
||||
<if test="deductionAmount != null "> and deduction_amount = #{deductionAmount}</if>
|
||||
<if test="handlingCharge != null "> and handling_charge = #{handlingCharge}</if>
|
||||
<if test="userReceipts != null "> and user_receipts = #{userReceipts}</if>
|
||||
<if test="settlementAmount != null "> and settlement_amount = #{settlementAmount}</if>
|
||||
<if test="platformServiceFee != null "> and platform_service_fee = #{platformServiceFee}</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND `day` >= #{params.beginTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND `day` <= #{params.endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectEtReconciliationByReconciliationId" parameterType="Long" resultMap="EtReconciliationResult">
|
||||
<include refid="selectEtReconciliationVo"/>
|
||||
where reconciliation_id = #{reconciliationId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEtReconciliation" parameterType="EtReconciliation" useGeneratedKeys="true" keyProperty="reconciliationId">
|
||||
insert into et_reconciliation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="orderPaid != null">order_paid,</if>
|
||||
<if test="totalAmount != null">total_amount,</if>
|
||||
<if test="depositPaid != null">deposit_paid,</if>
|
||||
<if test="payChannel != null">pay_channel,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="day != null">day,</if>
|
||||
<if test="depositRefund != null">deposit_refund,</if>
|
||||
<if test="deductionAmount != null">deduction_amount,</if>
|
||||
<if test="handlingCharge != null">handling_charge,</if>
|
||||
<if test="userReceipts != null">user_receipts,</if>
|
||||
<if test="settlementAmount != null">settlement_amount,</if>
|
||||
<if test="platformServiceFee != null">platform_service_fee,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderPaid != null">#{orderPaid},</if>
|
||||
<if test="totalAmount != null">#{totalAmount},</if>
|
||||
<if test="depositPaid != null">#{depositPaid},</if>
|
||||
<if test="payChannel != null">#{payChannel},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="day != null">#{day},</if>
|
||||
<if test="depositRefund != null">#{depositRefund},</if>
|
||||
<if test="deductionAmount != null">#{deductionAmount},</if>
|
||||
<if test="handlingCharge != null">#{handlingCharge},</if>
|
||||
<if test="userReceipts != null">#{userReceipts},</if>
|
||||
<if test="settlementAmount != null">#{settlementAmount},</if>
|
||||
<if test="platformServiceFee != null">#{platformServiceFee},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEtReconciliation" parameterType="EtReconciliation">
|
||||
update et_reconciliation
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="orderPaid != null">order_paid = #{orderPaid},</if>
|
||||
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
||||
<if test="depositPaid != null">deposit_paid = #{depositPaid},</if>
|
||||
<if test="payChannel != null">pay_channel = #{payChannel},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="day != null">day = #{day},</if>
|
||||
<if test="depositRefund != null">deposit_refund = #{depositRefund},</if>
|
||||
<if test="deductionAmount != null">deduction_amount = #{deductionAmount},</if>
|
||||
<if test="handlingCharge != null">handling_charge = #{handlingCharge},</if>
|
||||
<if test="userReceipts != null">user_receipts = #{userReceipts},</if>
|
||||
<if test="settlementAmount != null">settlement_amount = #{settlementAmount},</if>
|
||||
<if test="platformServiceFee != null">platform_service_fee = #{platformServiceFee},</if>
|
||||
</trim>
|
||||
where reconciliation_id = #{reconciliationId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEtReconciliationByReconciliationId" parameterType="Long">
|
||||
delete from et_reconciliation where reconciliation_id = #{reconciliationId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEtReconciliationByReconciliationIds" parameterType="String">
|
||||
delete from et_reconciliation where reconciliation_id in
|
||||
<foreach item="reconciliationId" collection="array" open="(" separator="," close=")">
|
||||
#{reconciliationId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user