李天标 3 سال پیش
والد
کامیت
41cd33ced7

+ 21 - 0
pom.xml

@@ -209,6 +209,27 @@
 			<artifactId>easypoi-base</artifactId>
 			<version>RELEASE</version>
 		</dependency>
+		<!--定时任务-->
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.projectlombok</groupId>
+			<artifactId>lombok</artifactId>
+			<optional>true</optional>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-test</artifactId>
+			<scope>test</scope>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 42 - 0
src/main/java/com/szwl/controller/ScheduledService.java

@@ -0,0 +1,42 @@
+package com.szwl.controller;
+
+import com.szwl.service.TDepartmentService;
+import com.szwl.service.TShandeMchService;
+import com.szwl.service.es.EsTCoinOrderService;
+import com.szwl.service.es.EsTOrderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.text.ParseException;
+import java.util.Calendar;
+
+
+@Configuration //1.主要用于标记配置类,兼备Component的效果。
+@Component
+@EnableScheduling // 2.开启定时任务
+public class ScheduledService {
+
+    @Autowired
+    private TShandeMchService tShandeMchService;
+    @Autowired
+    EsTCoinOrderService esTCoinOrderService;
+    @Autowired
+    EsTOrderService esTOrderService;
+    //每天凌晨统计/核对杉德支付的金额表
+    @Scheduled(cron = "30 05 0 * * ?")
+    public void shandejiesuan(){
+        tShandeMchService.jiesuan();
+    }
+
+    //在每小时的20分执行一次 es同步数据
+    @Scheduled(cron = "0 20 * * * ?")
+    public void tongbuEs() throws ParseException {
+        esTOrderService.tongbuByHour();
+        esTCoinOrderService.tongbuByHour();
+    }
+
+
+}

+ 21 - 0
src/main/java/com/szwl/controller/TDepartmentController.java

@@ -0,0 +1,21 @@
+package com.szwl.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 部门表(用于研发部值日通知) 前端控制器
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+@RestController
+@RequestMapping("/tDepartment")
+public class TDepartmentController {
+
+}
+

+ 21 - 0
src/main/java/com/szwl/controller/TShandeMchController.java

@@ -0,0 +1,21 @@
+package com.szwl.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 杉德支付收款信息 前端控制器
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+@RestController
+@RequestMapping("/tShandeMch")
+public class TShandeMchController {
+
+}
+

+ 5 - 0
src/main/java/com/szwl/feign/SzwlFeign.java

@@ -6,6 +6,7 @@ import com.szwl.model.bo.ResponseModel;
 import com.szwl.model.entity.TAdmin;
 import com.szwl.model.entity.TAdminEquipment;
 import com.szwl.model.entity.TEquipment;
+import com.szwl.model.entity.TShandeMch;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -40,4 +41,8 @@ public interface SzwlFeign {
     ResponseModel<IPage<TAdmin>>  pageAdmin2(@RequestParam(value = "current") long current, @RequestParam(value = "size") long size);
     @GetMapping("/tEquipment/pageEquipment2")
     ResponseModel<IPage<TEquipment>>  pageEquipment2(@RequestParam(value = "current") long current, @RequestParam(value = "size") long size);
+    @GetMapping("/tShandeMch/getShandeMch")
+    ResponseModel<TShandeMch> getShandeMch(String adminId);
+    @PostMapping("/tShandeMch/updateShandeMch")
+    ResponseModel<TShandeMch> updateShandeMch(@RequestBody TShandeMch shandeMch);
 }

+ 16 - 0
src/main/java/com/szwl/mapper/TDepartmentMapper.java

@@ -0,0 +1,16 @@
+package com.szwl.mapper;
+
+import com.szwl.model.entity.TDepartment;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 部门表(用于研发部值日通知) Mapper 接口
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+public interface TDepartmentMapper extends BaseMapper<TDepartment> {
+
+}

+ 16 - 0
src/main/java/com/szwl/mapper/TShandeMchMapper.java

@@ -0,0 +1,16 @@
+package com.szwl.mapper;
+
+import com.szwl.model.entity.TShandeMch;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 杉德支付收款信息 Mapper 接口
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+public interface TShandeMchMapper extends BaseMapper<TShandeMch> {
+
+}

+ 21 - 0
src/main/java/com/szwl/mapper/xml/TDepartmentMapper.xml

@@ -0,0 +1,21 @@
+<?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.szwl.mapper.TDepartmentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.szwl.model.entity.TDepartment">
+        <id column="id" property="id" />
+        <result column="create_date" property="createDate" />
+        <result column="modify_date" property="modifyDate" />
+        <result column="name" property="name" />
+        <result column="phone" property="phone" />
+        <result column="flag" property="flag" />
+        <result column="type" property="type" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, create_date, modify_date, name, phone, flag, type
+    </sql>
+
+</mapper>

+ 28 - 0
src/main/java/com/szwl/mapper/xml/TShandeMchMapper.xml

@@ -0,0 +1,28 @@
+<?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.szwl.mapper.TShandeMchMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.szwl.model.entity.TShandeMch">
+        <id column="id" property="id" />
+        <result column="create_date" property="createDate" />
+        <result column="modify_date" property="modifyDate" />
+        <result column="bank_name" property="bankName" />
+        <result column="bank_no" property="bankNo" />
+        <result column="type" property="type" />
+        <result column="admin_id" property="adminId" />
+        <result column="settleable_balance" property="settleableBalance" />
+        <result column="today_balance" property="todayBalance" />
+        <result column="total_settleable_balance" property="totalSettleableBalance" />
+        <result column="settleable_date" property="settleableDate" />
+        <result column="last_settleable_balance" property="lastSettleableBalance" />
+        <result column="bank_channel_no" property="bankChannelNo" />
+        <result column="bank_channel_name" property="bankChannelName" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, create_date, modify_date, bank_name, bank_no, type, admin_id, settleable_balance, today_balance, total_settleable_balance, settleable_date, last_settleable_balance, bank_channel_no, bank_channel_name
+    </sql>
+
+</mapper>

+ 43 - 0
src/main/java/com/szwl/model/entity/TDepartment.java

@@ -0,0 +1,43 @@
+package com.szwl.model.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 部门表(用于研发部值日通知)
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="TDepartment对象", description="部门表(用于研发部值日通知)")
+public class TDepartment implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private Long id;
+
+    private Date createDate;
+
+    private Date modifyDate;
+
+    private String name;
+
+    private String phone;
+
+    private String flag;
+
+    private String type;
+
+
+}

+ 69 - 0
src/main/java/com/szwl/model/entity/TShandeMch.java

@@ -0,0 +1,69 @@
+package com.szwl.model.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 杉德支付收款信息
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="TShandeMch对象", description="杉德支付收款信息")
+public class TShandeMch implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    private Date createDate;
+
+    private Date modifyDate;
+
+    @ApiModelProperty(value = "收款人名称;")
+    private String bankName;
+
+    @ApiModelProperty(value = "收款人账号;")
+    private String bankNo;
+
+    @ApiModelProperty(value = "0:企业杉德宝;1:个人杉德宝")
+    private String type;
+
+    @ApiModelProperty(value = "商家id;")
+    private Long adminId;
+
+    @ApiModelProperty(value = "待清算余额;")
+    private BigDecimal settleableBalance;
+
+    @ApiModelProperty(value = "今日收款余额;")
+    private BigDecimal todayBalance;
+
+    @ApiModelProperty(value = "已清算余额;")
+    private BigDecimal totalSettleableBalance;
+
+    @ApiModelProperty(value = "上一次结算时间;")
+    private Date settleableDate;
+
+    @ApiModelProperty(value = "上一次清算余额;")
+    private BigDecimal lastSettleableBalance;
+
+    @ApiModelProperty(value = "联行号")
+    private String bankChannelNo;
+
+    @ApiModelProperty(value = "开户行名称")
+    private String bankChannelName;
+
+
+}

+ 16 - 0
src/main/java/com/szwl/service/TDepartmentService.java

@@ -0,0 +1,16 @@
+package com.szwl.service;
+
+import com.szwl.model.entity.TDepartment;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 部门表(用于研发部值日通知) 服务类
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+public interface TDepartmentService extends IService<TDepartment> {
+
+}

+ 17 - 0
src/main/java/com/szwl/service/TShandeMchService.java

@@ -0,0 +1,17 @@
+package com.szwl.service;
+
+import com.szwl.model.entity.TShandeMch;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 杉德支付收款信息 服务类
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+public interface TShandeMchService extends IService<TShandeMch> {
+
+    void jiesuan();
+}

+ 20 - 0
src/main/java/com/szwl/service/impl/TDepartmentServiceImpl.java

@@ -0,0 +1,20 @@
+package com.szwl.service.impl;
+
+import com.szwl.model.entity.TDepartment;
+import com.szwl.mapper.TDepartmentMapper;
+import com.szwl.service.TDepartmentService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 部门表(用于研发部值日通知) 服务实现类
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+@Service
+public class TDepartmentServiceImpl extends ServiceImpl<TDepartmentMapper, TDepartment> implements TDepartmentService {
+
+}

+ 263 - 0
src/main/java/com/szwl/service/impl/TShandeMchServiceImpl.java

@@ -0,0 +1,263 @@
+package com.szwl.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.szwl.feign.SzwlFeign;
+import com.szwl.mapper.TOrderMapper;
+import com.szwl.model.bo.R;
+import com.szwl.model.entity.TAdmin;
+import com.szwl.model.entity.TEquipment;
+import com.szwl.model.entity.TOrder;
+import com.szwl.model.entity.TShandeMch;
+import com.szwl.mapper.TShandeMchMapper;
+import com.szwl.service.TShandeMchService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+
+/**
+ * <p>
+ * 杉德支付收款信息 服务实现类
+ * </p>
+ *
+ * @author wuhs
+ * @since 2022-07-14
+ */
+@Service
+public class TShandeMchServiceImpl extends ServiceImpl<TShandeMchMapper, TShandeMch> implements TShandeMchService {
+    @Autowired
+    TOrderMapper orderMapper;
+    @Autowired
+    SzwlFeign szwlFeign;
+
+    //24点更新结算表
+    @Override
+    public void jiesuan() {
+        //1,查出杉德金额表中今日交易金额大于0的人
+//		TShandeMchExample example = new TShandeMchExample();
+//		TShandeMchExample.Criteria criteria = example.createCriteria();
+//		criteria.andTodayBalanceGreaterThan(0.00f);
+//		List<TShandeMch> tShandeMches = tShandeMchMapper.selectByExample(example);
+        //2,并把这些人的adminId整合到一个list中
+//		List<Long> list = new ArrayList<>();
+//		if(tShandeMches.size()>0){
+//			for(TShandeMch shandeMch : tShandeMches){
+//				list.add(shandeMch.getAdminId());
+//			}
+//		}
+        Set<Long> set = new HashSet<>();
+        //昨天起始时间 因为是第二天才去查的
+        Date startDate = getStartTime();
+        Date endDate = getEndTime();
+        //1,找出今天用杉德支付的订单
+        LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
+        query.eq(TOrder::getPayPlatform,"1");
+        query.eq(TOrder::getStatus,1);
+        query.gt(TOrder::getPayDate,startDate);
+        query.lt(TOrder::getPayDate,endDate);
+        List<TOrder> orderList = orderMapper.selectList(query);
+        if(orderList.size()>0){
+            for(TOrder order:orderList){
+                set.add(order.getAdminId());
+            }
+        }
+        //3,根据adminId去order表里查今日的支付,退款的订单
+        //昨天起始时间 因为是第二天才去查的
+//		Date startDate = getStartTime();
+//		Date endDate = getEndTime();
+        if(set.size()>0){
+            for(Long adminId : set){
+                //支付订单
+                List<TOrder> orderPayList = getOrderlist(startDate,endDate,adminId,1);
+                //退款订单---主要查不是今天支付的退款订单,隔天退款
+                List<TOrder> orderRefuseList = getOrderlist(startDate,endDate,adminId,3);
+                //根据订单表去更新金额表
+                if(orderPayList.size()>0){
+                    updateShandeMchList(orderPayList,1);
+                }
+                if(orderRefuseList.size()>0){
+                    updateShandeMchList(orderRefuseList,3);
+                }
+            }
+        }
+    }
+    //根据订单表去更新金额表
+    private void updateShandeMchList(List<TOrder> orderList, int type) {
+        BigDecimal agencyTotal = new BigDecimal(0.00);
+        BigDecimal merchantTotal = new BigDecimal(0.00);
+        BigDecimal personageTotal = new BigDecimal(0.00);
+        TOrder tOrder = orderList.get(0);
+        TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(tOrder.getAdminId())));
+        Integer orderType = tOrder.getType();
+        switch (orderType) {
+            case 1:
+                for(TOrder order:orderList){
+                    BigDecimal agencyProportion = order.getAgencyProportion();
+                    BigDecimal price = order.getPrice();
+                    // 代理分销获得利润
+                    BigDecimal agencyPrice = price.multiply(agencyProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
+                    agencyTotal = agencyTotal.add(agencyPrice);
+                }
+                //修改金额表的今日金额
+                TShandeMch shandeMch = R.getDataIfSuccess(szwlFeign.getShandeMch(String.valueOf(tOrder.getAdminId())));
+                BigDecimal settleableBalance = shandeMch.getSettleableBalance();
+                if(type==1){
+                    settleableBalance = settleableBalance.add(agencyTotal).setScale(2, RoundingMode.HALF_DOWN);
+                }
+                if(type == 3){
+                    settleableBalance = settleableBalance.subtract(agencyTotal).setScale(2, RoundingMode.HALF_DOWN);
+                }
+                shandeMch.setSettleableBalance(settleableBalance);
+                shandeMch.setTodayBalance(BigDecimal.valueOf(0));
+                shandeMch.setModifyDate(new Date());
+                szwlFeign.updateShandeMch(shandeMch);
+                break;
+            case 2:
+                for(TOrder order:orderList){
+                    BigDecimal agencyProportion = order.getAgencyProportion();
+                    BigDecimal merchantProportion = order.getMerchantProportion();
+                    BigDecimal price = order.getPrice();
+                    // 代理分销获得利润
+                    BigDecimal agencyPrice = price.multiply(agencyProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
+                    // 经销商分销获得利润
+                    BigDecimal merchantAmount = price.multiply(merchantProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
+                    agencyTotal = agencyTotal.add(agencyPrice);
+                    merchantTotal = merchantTotal.add(merchantAmount);
+                }
+                //修改金额表的今日金额
+                //省级
+                TShandeMch shandeMch1 = R.getDataIfSuccess(szwlFeign.getShandeMch(String.valueOf(admin.getParentId())));
+                    BigDecimal settleableBalance1 = shandeMch1.getSettleableBalance();
+                    if(type==1){
+                        settleableBalance1 = settleableBalance1.add(agencyTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                    if(type == 3){
+                        settleableBalance1 = settleableBalance1.subtract(agencyTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                shandeMch1.setSettleableBalance(settleableBalance1);
+                shandeMch1.setTodayBalance(BigDecimal.valueOf(0));
+                shandeMch1.setModifyDate(new Date());
+                szwlFeign.updateShandeMch(shandeMch1);
+                //市级
+                TShandeMch shandeMch2 = R.getDataIfSuccess(szwlFeign.getShandeMch(String.valueOf(admin.getId())));
+                    BigDecimal settleableBalance2 = shandeMch2.getSettleableBalance();
+                    if(type==1){
+                        settleableBalance2 = settleableBalance2.add(merchantTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                    if(type == 3){
+                        settleableBalance2 = settleableBalance2.subtract(merchantTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                shandeMch2.setSettleableBalance(settleableBalance2);
+                shandeMch2.setTodayBalance(BigDecimal.valueOf(0));
+                shandeMch2.setModifyDate(new Date());
+                szwlFeign.updateShandeMch(shandeMch2);
+                break;
+            case 3:
+                for(TOrder order:orderList){
+                    BigDecimal agencyProportion = order.getAgencyProportion();
+                    BigDecimal merchantProportion = order.getMerchantProportion();
+                    BigDecimal personageProportion = order.getPersonageProportion();
+                    BigDecimal price = order.getPrice();
+                    // 代理分销获得利润
+                    BigDecimal agencyPrice = price.multiply(agencyProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
+                    // 经销商分销获得利润
+                    BigDecimal merchantAmount = price.multiply(merchantProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
+                    // 经销商分销获得利润
+                    BigDecimal personageAmount = price.multiply(personageProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
+
+                    agencyTotal = agencyTotal.add(agencyPrice);
+                    merchantTotal = merchantTotal.add(merchantAmount);
+                    personageTotal = personageTotal.add(personageAmount);
+                }
+                //修改金额表的今日金额
+                //省级
+
+                TShandeMch shandeMch3 = R.getDataIfSuccess(szwlFeign.getShandeMch(String.valueOf(admin.getAgencyId())));
+
+                    BigDecimal settleableBalance3 = shandeMch3.getSettleableBalance();
+                    if(type==1){
+                        settleableBalance3 = settleableBalance3.add(agencyTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                    if(type == 3){
+                        settleableBalance3 = settleableBalance3.subtract(agencyTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                shandeMch3.setSettleableBalance(settleableBalance3);
+                shandeMch3.setTodayBalance(BigDecimal.valueOf(0));
+                shandeMch3.setModifyDate(new Date());
+                szwlFeign.updateShandeMch(shandeMch3);
+                //市级
+;
+                TShandeMch shandeMch4 = R.getDataIfSuccess(szwlFeign.getShandeMch(String.valueOf(admin.getMerchantId())));
+                    BigDecimal settleableBalance4 =shandeMch4.getSettleableBalance();
+                    if(type==1){
+                        settleableBalance4 = settleableBalance4.add(merchantTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                    if(type == 3){
+                        settleableBalance4 = settleableBalance4.subtract(merchantTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                shandeMch4.setSettleableBalance(settleableBalance4);
+                shandeMch4.setTodayBalance(BigDecimal.valueOf(0));
+                shandeMch4.setModifyDate(new Date());
+                szwlFeign.updateShandeMch(shandeMch4);
+                //终端
+                TShandeMch shandeMch5 = R.getDataIfSuccess(szwlFeign.getShandeMch(String.valueOf(admin.getId())));
+                    BigDecimal settleableBalance5 =shandeMch5.getSettleableBalance();
+                    if(type==1){
+                        settleableBalance5 = settleableBalance5.add(personageTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                    if(type == 3){
+                        settleableBalance5 = settleableBalance5.subtract(personageTotal).setScale(2, RoundingMode.HALF_DOWN);
+                    }
+                shandeMch5.setSettleableBalance(settleableBalance5);
+                shandeMch5.setTodayBalance(BigDecimal.valueOf(0));
+                shandeMch5.setModifyDate(new Date());
+                szwlFeign.updateShandeMch(shandeMch5);
+                break;
+        }
+
+    }
+    //查询订单列表
+    private List<TOrder> getOrderlist(Date startDate, Date endDate, Long adminId, int type) {
+        LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
+        query.eq(TOrder::getAdminId,adminId);
+        if(type==1){
+            query.gt(TOrder::getPayDate,startDate);
+            query.lt(TOrder::getPayDate,endDate);
+        }
+        if(type == 3){
+
+            query.gt(TOrder::getRefundDate,startDate);
+            query.lt(TOrder::getRefundDate,endDate);
+            query.lt(TOrder::getPayDate,startDate);
+
+        }
+        query.eq(TOrder::getStatus,type);
+        query.eq(TOrder::getPayPlatform,"1");
+        List<TOrder> orderList = orderMapper.selectList(query);
+        return orderList;
+    }
+
+    private static Date getStartTime() {
+        Calendar todayStart = Calendar.getInstance();
+        todayStart.add(Calendar.DATE,   -1);
+        todayStart.set(Calendar.HOUR_OF_DAY, 0);
+        todayStart.set(Calendar.MINUTE, 0);
+        todayStart.set(Calendar.SECOND, 0);
+        todayStart.set(Calendar.MILLISECOND, 0);
+        return todayStart.getTime();
+    }
+
+    private static Date getEndTime() {
+        Calendar todayEnd = Calendar.getInstance();
+        todayEnd.add(Calendar.DATE,   -1);
+        todayEnd.set(Calendar.HOUR_OF_DAY, 23);
+        todayEnd.set(Calendar.MINUTE, 59);
+        todayEnd.set(Calendar.SECOND, 59);
+        todayEnd.set(Calendar.MILLISECOND, 999);
+        return todayEnd.getTime();
+    }
+}