Browse Source

订单修改

weifanli 2 years ago
parent
commit
23c0c9165a
16 changed files with 405 additions and 77 deletions
  1. 31 0
      cooleshow-common/src/main/java/com/yonge/cooleshow/common/constant/SysConfigConstant.java
  2. 29 36
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/UserWithdrawalController.java
  3. 28 8
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/excel/UserWithdrawalExport.java
  4. 15 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/OrderReq.java
  5. 22 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/TeacherWithdrawalSearch.java
  6. 22 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderDetail.java
  7. 11 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserWithdrawalService.java
  8. 34 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java
  9. 60 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserWithdrawalServiceImpl.java
  10. 4 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderDetailMapper.xml
  11. 38 7
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserWithdrawalController.java
  12. 35 0
      toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ErrMsg.java
  13. 5 10
      toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ExcelDataReader.java
  14. 10 0
      toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ExcelDataReaderProperty.java
  15. 56 0
      toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ExcelException.java
  16. 5 6
      toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ExcelUtils.java

+ 31 - 0
cooleshow-common/src/main/java/com/yonge/cooleshow/common/constant/SysConfigConstant.java

@@ -109,4 +109,35 @@ public interface SysConfigConstant {
      */
     String DEFAULT_HEARD_GIRL = "default_heard_girl";
 
+    /***
+     * 商品vip图片
+     * @author liweifan
+     * @updateTime 2022/4/20 11:43
+     */
+    String GOOD_LOGO_VIP = "good_logo_vip";
+    /***
+     * 商品视频课图片
+     * @author liweifan
+     * @updateTime 2022/4/20 11:43
+     */
+    String GOOD_LOGO_VIDEO = "good_logo_video";
+    /***
+     * 商品陪练课图片
+     * @author liweifan
+     * @updateTime 2022/4/20 11:43
+     */
+    String GOOD_LOGO_PRACTICE = "good_logo_practice";
+    /***
+     * 商品直播课图片
+     * @author liweifan
+     * @updateTime 2022/4/20 11:43
+     */
+    String GOOD_LOGO_LIVE = "good_logo_live";
+    /***
+     * 商品曲目图片
+     * @author liweifan
+     * @updateTime 2022/4/20 11:43
+     */
+    String GOOD_LOGO_MUSIC = "good_logo_music";
+
 }

+ 29 - 36
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/UserWithdrawalController.java

@@ -6,21 +6,25 @@ import com.yonge.cooleshow.biz.dal.dto.excel.UserWithdrawalExport;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.exception.BizException;
 import com.yonge.cooleshow.common.page.PageInfo;
-import com.yonge.toolset.utils.easyexcel.ExcelUtils;
+import com.yonge.toolset.utils.easyexcel.*;
+import com.yonge.toolset.utils.string.StringUtil;
 import io.swagger.annotations.*;
 import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.DigestUtils;
 import org.springframework.web.bind.annotation.*;
 
 import com.yonge.cooleshow.biz.dal.vo.UserWithdrawalVo;
 import com.yonge.cooleshow.biz.dal.dto.search.TeacherWithdrawalSearch;
 import com.yonge.cooleshow.biz.dal.service.UserWithdrawalService;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
 @RestController
 @RequestMapping("/userWithdrawal")
@@ -30,24 +34,24 @@ public class UserWithdrawalController extends BaseController {
     @Autowired
     private UserWithdrawalService userWithdrawalService;
 
-	/**
+    /**
      * 查询单条
      */
     @GetMapping("/detail/{id}")
     @ApiOperation(value = "详情", notes = "传入id")
     public HttpResponseResult<UserWithdrawalVo> detail(@PathVariable("id") Long id) {
-    	return succeed(userWithdrawalService.detail(id));
-	}
-    
+        return succeed(userWithdrawalService.detail(id));
+    }
+
     /**
      * 查询分页
      */
     @PostMapping("/page")
     @ApiOperation(value = "查询分页", notes = "传入teacherWithdrawalSearch")
     public HttpResponseResult<PageInfo<UserWithdrawalVo>> page(@RequestBody TeacherWithdrawalSearch query) {
-		IPage<UserWithdrawalVo> pages = userWithdrawalService.selectPage(PageUtil.getPage(query), query);
+        IPage<UserWithdrawalVo> pages = userWithdrawalService.selectPage(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
-	}
+    }
 
     /**
      * 查询导出
@@ -57,11 +61,12 @@ public class UserWithdrawalController extends BaseController {
     public void exportExcel(@RequestBody TeacherWithdrawalSearch query) {
         List<UserWithdrawalVo> withdrawalVoList = userWithdrawalService.selectList(query);
         List<UserWithdrawalExport> list = new ArrayList<>();
-        withdrawalVoList.forEach(o-> {
+        withdrawalVoList.forEach(o -> {
             UserWithdrawalExport export = new UserWithdrawalExport();
             try {
-                BeanUtils.copyProperties(export,o);
+                BeanUtils.copyProperties(export, o);
                 StringBuffer buffer = new StringBuffer(export.getId().toString());
+                buffer.append(export.getUserId());
                 buffer.append(export.getAmount());
                 buffer.append(export.getActualAmount());
                 String s = DigestUtils.md5DigestAsHex(buffer.toString().getBytes());
@@ -77,35 +82,23 @@ public class UserWithdrawalController extends BaseController {
                 "列表数据");
     }
 
-
     /**
-     * 查询导出
+     * 导入
      */
     @PostMapping("/importExcel")
-    @ApiOperation(value = "查询导出", notes = "传入TeacherWithdrawalSearch")
-    public void importExcel(@RequestBody TeacherWithdrawalSearch query) {
-        List<UserWithdrawalVo> withdrawalVoList = userWithdrawalService.selectList(query);
-        List<UserWithdrawalExport> list = new ArrayList<>();
-        withdrawalVoList.forEach(o-> {
-            UserWithdrawalExport export = new UserWithdrawalExport();
-            try {
-                BeanUtils.copyProperties(export,o);
-                StringBuffer buffer = new StringBuffer(export.getId().toString());
-                buffer.append(export.getAmount());
-                buffer.append(export.getActualAmount());
-                String s = DigestUtils.md5DigestAsHex(buffer.toString().getBytes());
-                export.setSign(s);
-                list.add(export);
-            } catch (IllegalAccessException e) {
-                e.printStackTrace();
-            } catch (InvocationTargetException e) {
-                e.printStackTrace();
-            }
-        });
-        ExcelUtils.exportExcel(list, "提现列表数据" + System.currentTimeMillis(),
-                "列表数据");
+    @ApiOperation(value = "导入", notes = "传入file")
+    public HttpResponseResult<List<ErrMsg>> importExcel(@RequestParam("file") MultipartFile file) {
+        if (null == file) {
+            return HttpResponseResult.failed("请上传文件");
+        }
+        ExcelDataReader<UserWithdrawalExport> reader = ExcelUtils.getReader(UserWithdrawalExport.class, file);
+        try {
+            userWithdrawalService.importExcel(reader.getDataList());
+            return HttpResponseResult.succeed();
+        }catch (ExcelException e){
+            return HttpResponseResult.failed(HttpStatus.INTERNAL_SERVER_ERROR,e.getErrMsgList(),"导入文件异常");
+        }
     }
 
-    
 
 }

+ 28 - 8
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/excel/UserWithdrawalExport.java

@@ -1,9 +1,13 @@
 package com.yonge.cooleshow.biz.dal.dto.excel;
 
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.yonge.cooleshow.biz.dal.convert.WithdrawalStatusConvert;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
+import io.swagger.annotations.ApiModelProperty;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -12,25 +16,33 @@ import java.util.Date;
  * @Data: 2022/4/15 18:01
  */
 public class UserWithdrawalExport {
+    @NotNull(message = "提现编号不能为空")
     @ExcelProperty(value = "提现编号", index = 0)
     private Long id;
     @ExcelProperty(value = "提现人", index = 1)
     private String	withdrawaUser;
-    @ExcelProperty(value = "提现金额", index = 2)
+    @ExcelProperty(value = "提现人编号", index = 2)
+    @NotNull(message = "提现人编号不能为空")
+    private Long userId;
+    @NotNull(message = "提现金额不能为空")
+    @ExcelProperty(value = "提现金额", index = 3)
     private BigDecimal amount;
-    @ExcelProperty(value = "发起时间", index = 3)
+    @ExcelProperty(value = "发起时间", index = 4)
     private Date createTime;
-    @ExcelProperty(value = "开户行", index = 4)
+    @ExcelProperty(value = "开户行", index = 5)
     private String bankName;
-    @ExcelProperty(value = "银行卡号", index = 5)
+    @ExcelProperty(value = "银行卡号", index = 6)
     private String bankCard;
-    @ExcelProperty(value = "转账金额", index = 6)
+    @ExcelProperty(value = "转账金额", index = 7)
     private BigDecimal actualAmount;
-    @ExcelProperty(value = "银行流水号", index = 7)
+    @NotBlank(message = "银行流水号不能为空")
+    @ExcelProperty(value = "银行流水号", index = 8)
     private String bankFlowNo;
-    @ExcelProperty(value = "提现状态 DOING、审核中 PASS、通过 UNPASS、不通过", index = 8,converter = WithdrawalStatusConvert.class)
+    @NotNull(message = "提现状态不能为空")
+    @ExcelProperty(value = "提现状态 审核中/通过/不通过", index = 9,converter = WithdrawalStatusConvert.class)
     private AuthStatusEnum status;
-    @ExcelProperty(value = "签名", index = 9)
+    @NotBlank(message = "签名不能为空")
+    @ExcelProperty(value = "签名", index = 10)
     private String sign;
 
     public Long getId() {
@@ -49,6 +61,14 @@ public class UserWithdrawalExport {
         this.withdrawaUser = withdrawaUser;
     }
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     public BigDecimal getAmount() {
         return amount;
     }

+ 15 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/OrderReq.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.dto.req;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.OrderTypeEnum;
 import io.swagger.annotations.ApiModel;
@@ -39,12 +40,14 @@ public class OrderReq {
     @ApiModelProperty(value = "业务请求详情", required = true)
     private List<OrderReqInfo> orderInfos;
 
-    @ApiModel(value = "OrderReqInfo", description = "下单请求业务详情对象")
-    public static class OrderReqInfo {
+    @ApiModel(value = "OrderReqInfo对象", description = "下单请求业务详情对象")
+    public class OrderReqInfo {
         private Long userId;
         @NotNull(message = "商品类型不能为空")
         @ApiModelProperty(value = "商品类型:  VIP、开通会员  PRACTICE、陪练课购买  LIVE、直播课购买 VIDEO、视频课购买 MUSIC、单曲点播 ", required = true)
         private GoodTypeEnum goodType;
+        @ApiModelProperty("商品名称 ")
+        private String goodName;
         @ApiModelProperty(value = "业务内容 订单业务内容json")
         private String bizContent;
 
@@ -71,6 +74,14 @@ public class OrderReq {
         public void setBizContent(String bizContent) {
             this.bizContent = bizContent;
         }
+
+        public String getGoodName() {
+            return goodName;
+        }
+
+        public void setGoodName(String goodName) {
+            this.goodName = goodName;
+        }
     }
 
     public Long getUserId() {
@@ -136,4 +147,6 @@ public class OrderReq {
     public void setActualPrice(BigDecimal actualPrice) {
         this.actualPrice = actualPrice;
     }
+
+
 }

+ 22 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/TeacherWithdrawalSearch.java

@@ -16,7 +16,6 @@ import java.util.Date;
 @ApiModel(value = "TeacherWithdrawalSearch对象", description = "老师账户提现表查询对象")
 public class TeacherWithdrawalSearch extends QueryInfo{
 	private static final long serialVersionUID = 1L;
-
 	@ApiModelProperty("银行(交易)流水号 ")
 	private String bankFlowNo;
 	@ApiModelProperty("状态 DOING、审核中 PASS、通过 UNPASS、不通过")
@@ -30,6 +29,12 @@ public class TeacherWithdrawalSearch extends QueryInfo{
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
 	private Date endTime;
 
+
+	@ApiModelProperty("提现时间(yyyy-mm) ")
+	private String withdrawalDate;
+
+	private Long userId;
+
 	public String getBankFlowNo() {
 		return bankFlowNo;
 	}
@@ -61,4 +66,20 @@ public class TeacherWithdrawalSearch extends QueryInfo{
 	public void setEndTime(Date endTime) {
 		this.endTime = endTime;
 	}
+
+	public String getWithdrawalDate() {
+		return withdrawalDate;
+	}
+
+	public void setWithdrawalDate(String withdrawalDate) {
+		this.withdrawalDate = withdrawalDate;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
 }

+ 22 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderDetail.java

@@ -38,6 +38,12 @@ public class UserOrderDetail implements Serializable {
     @ApiModelProperty("业务内容 ")
 	@TableField(value = "biz_content_")
     private String bizContent;
+    @ApiModelProperty("商品名称 ")
+    @TableField(value = "good_name_")
+    private String goodName;
+    @ApiModelProperty("商品图片 ")
+    @TableField(value = "good_url_")
+    private String goodUrl;
     @ApiModelProperty("原价 ")
     @TableField(value = "original_price_")
     private BigDecimal originalPrice;
@@ -114,6 +120,22 @@ public class UserOrderDetail implements Serializable {
         this.bizContent = bizContent;
     }
 
+    public String getGoodName() {
+        return goodName;
+    }
+
+    public void setGoodName(String goodName) {
+        this.goodName = goodName;
+    }
+
+    public String getGoodUrl() {
+        return goodUrl;
+    }
+
+    public void setGoodUrl(String goodUrl) {
+        this.goodUrl = goodUrl;
+    }
+
     public BigDecimal getOriginalPrice() {
         return originalPrice;
     }

+ 11 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserWithdrawalService.java

@@ -2,12 +2,15 @@ package com.yonge.cooleshow.biz.dal.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.yonge.cooleshow.biz.dal.dto.excel.UserWithdrawalExport;
 import com.yonge.cooleshow.biz.dal.dto.req.WithdrawalReq;
 import com.yonge.cooleshow.biz.dal.vo.UserWithdrawalVo;
 import com.yonge.cooleshow.biz.dal.dto.search.TeacherWithdrawalSearch;
 import com.yonge.cooleshow.biz.dal.entity.UserWithdrawal;
 import com.yonge.cooleshow.biz.dal.vo.res.WithdrawalInfoRes;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.toolset.utils.easyexcel.ErrMsg;
+import com.yonge.toolset.utils.easyexcel.ExcelDataReaderProperty;
 
 import java.util.List;
 
@@ -57,5 +60,12 @@ public interface UserWithdrawalService extends IService<UserWithdrawal>  {
 	 */
 	HttpResponseResult<Boolean> withdrawal(Long userId, WithdrawalReq withdrawalReq);
 
-
+	/***
+	 * 导入
+	 * @author liweifan
+	 * @param: dataList
+	 * @updateTime 2022/4/20 9:45
+	 * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<java.util.List<com.yonge.toolset.utils.easyexcel.ErrMsg>>
+	 */
+    void importExcel(List<ExcelDataReaderProperty<UserWithdrawalExport>> dataList);
 }

+ 34 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -131,11 +131,11 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
             info.setUserId(orderReq.getUserId());
             HttpResponseResult<OrderCreateRes> createResult = createFunction.apply(info);
             OrderCreateRes createRes = createResult.getData();
-            createRes.setGoodType(info.getGoodType());
             if (!createResult.getStatus() || null == createRes || !createRes.getRes()) {
                 log.info("订单[创建订单] Res:{}", JSONObject.toJSONString(createResult));
                 return HttpResponseResult.failed("订单商品信息获取失败");
             }
+            createRes.setGoodType(info.getGoodType());
             resList.add(createRes);
         }
 
@@ -382,6 +382,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         userOrder.setPlantformFee(new BigDecimal(0));
         List<UserOrderDetailVo> orderDetailList = new ArrayList<>();
         for (OrderCreateRes res : resList) {
+
             UserOrderDetailVo orderDetail = new UserOrderDetailVo();
             orderDetail.setOrderNo(userOrder.getOrderNo());
             orderDetail.setMerchId(res.getMerchId());
@@ -402,6 +403,14 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
             orderDetail.setPlantformFeeRate(serviceFeeRate);
             orderDetail.setBizParam(res.getBizParam());
             orderDetail.setCreateTime(new Date());
+
+            orderReq.getOrderInfos().forEach(o->{
+                if(o.getGoodType().equals(res.getGoodType())){
+                    orderDetail.setGoodName(o.getGoodName());
+                }
+            });
+            orderDetail.setGoodUrl(getGoodUrlByType(res.getGoodType()));
+
             orderDetailService.save(orderDetail);
             orderDetailList.add(orderDetail);
 
@@ -456,6 +465,30 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         return new BigDecimal(configValue).divide(new BigDecimal(100));
     }
 
+    /***
+     * 获取商品图片
+     * @author liweifan
+     * @param: orderTypeEnum
+     * @updateTime 2022/3/31 16:49
+     * @return: java.math.BigDecimal
+     */
+
+    private String getGoodUrlByType(GoodTypeEnum goodTypeEnum) {
+        String configValue = "";
+        if (GoodTypeEnum.VIP.equals(goodTypeEnum)) {
+            configValue = sysConfigService.findConfigValue(SysConfigConstant.GOOD_LOGO_VIP);
+        } else if (GoodTypeEnum.VIDEO.equals(goodTypeEnum)) {
+            configValue = sysConfigService.findConfigValue(SysConfigConstant.GOOD_LOGO_VIDEO);
+        } else if (GoodTypeEnum.PRACTICE.equals(goodTypeEnum)) {
+            configValue = sysConfigService.findConfigValue(SysConfigConstant.GOOD_LOGO_PRACTICE);
+        } else if (GoodTypeEnum.LIVE.equals(goodTypeEnum)) {
+            configValue = sysConfigService.findConfigValue(SysConfigConstant.GOOD_LOGO_LIVE);
+        } else if (GoodTypeEnum.MUSIC.equals(goodTypeEnum)) {
+            configValue = sysConfigService.findConfigValue(SysConfigConstant.GOOD_LOGO_MUSIC);
+        }
+        return configValue;
+    }
+
     private Boolean checkPositiveOrZero(BigDecimal amount) {
         if (null == amount) {
             return false;

+ 60 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserWithdrawalServiceImpl.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yonge.cooleshow.biz.dal.dto.excel.UserWithdrawalExport;
 import com.yonge.cooleshow.biz.dal.enums.FrozenTypeEnum;
 import com.yonge.cooleshow.common.constant.SysConfigConstant;
 import com.yonge.cooleshow.biz.dal.dao.UserBankCardDao;
@@ -18,6 +19,10 @@ import com.yonge.cooleshow.biz.dal.vo.UserBankCardVo;
 import com.yonge.cooleshow.biz.dal.vo.res.WithdrawalInfoRes;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.exception.BizException;
+import com.yonge.toolset.utils.easyexcel.ErrMsg;
+import com.yonge.toolset.utils.easyexcel.ExcelDataReaderProperty;
+import com.yonge.toolset.utils.easyexcel.ExcelException;
+import com.yonge.toolset.utils.string.StringUtil;
 import com.yonge.toolset.utils.string.ValueUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,8 +34,12 @@ import com.yonge.cooleshow.biz.dal.dto.search.TeacherWithdrawalSearch;
 import com.yonge.cooleshow.biz.dal.dao.UserWithdrawalDao;
 import com.yonge.cooleshow.biz.dal.service.UserWithdrawalService;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.DigestUtils;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 
@@ -55,7 +64,9 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
 
     @Override
     public IPage<UserWithdrawalVo> selectPage(IPage<UserWithdrawalVo> page, TeacherWithdrawalSearch query) {
-        return page.setRecords(baseMapper.selectPage(page, query));
+        List<UserWithdrawalVo> withdrawalVoList = baseMapper.selectPage(page, query);
+        withdrawalVoList.forEach(o -> o.setBankCard(ValueUtil.fuzzyBankCard(o.getBankCard())));
+        return page.setRecords(withdrawalVoList);
     }
 
     @Override
@@ -109,13 +120,59 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
         );
         accountRecordDto.setFrozenType(FrozenTypeEnum.FROZEN);
         HttpResponseResult<UserAccountRecord> accountChange = userAccountService.accountChange(accountRecordDto);
-        if(accountChange.getStatus()){
+        if (accountChange.getStatus()) {
             return HttpResponseResult.succeed(true);
-        }else{
+        } else {
             throw new BizException("提现失败");
         }
     }
 
+    @Override
+    @Transactional
+    public void importExcel(List<ExcelDataReaderProperty<UserWithdrawalExport>> dataList) {
+        List<ErrMsg> errMsgList = new ArrayList<>();
+        dataList.sort(Comparator.comparingInt(ExcelDataReaderProperty::getRowIndex));
+        List<UserWithdrawal> userWithdrawalList = new ArrayList<>();
+        for (ExcelDataReaderProperty<UserWithdrawalExport> dataReaderProperty : dataList) {
+            String errMsg = dataReaderProperty.getErrorMessage();
+            if (StringUtil.isEmpty(errMsg)) {
+                errMsgList.add(new ErrMsg(dataReaderProperty.getRowIndex(), errMsg));
+                continue;
+            }
+            UserWithdrawalExport data = dataReaderProperty.getClazz();
+            StringBuffer buffer = new StringBuffer(data.getId().toString());
+            buffer.append(data.getUserId());
+            buffer.append(data.getAmount());
+            buffer.append(data.getActualAmount());
+            String sign = DigestUtils.md5DigestAsHex(buffer.toString().getBytes());
+            if (!data.getSign().equals(sign)) {
+                errMsgList.add(new ErrMsg(dataReaderProperty.getRowIndex(), "验签失败"));
+                continue;
+            }
+            UserWithdrawal userWithdrawal = new UserWithdrawal();
+            userWithdrawal.setId(data.getId());
+            userWithdrawal.setBankFlowNo(data.getBankFlowNo());
+            userWithdrawal.setStatus(data.getStatus());
+            userWithdrawalList.add(userWithdrawal);
+        }
+        if (!CollectionUtils.isEmpty(errMsgList)) {
+            throw new ExcelException("导入异常", errMsgList);
+        }
+        authWithdrawalBancth(userWithdrawalList);
+    }
+
+    /***
+     * 审核
+     * @author liweifan
+     * @param: userWithdrawalList
+     * @updateTime 2022/4/20 11:18
+     */
+    private void authWithdrawalBancth(List<UserWithdrawal> userWithdrawalList) {
+        for (UserWithdrawal userWithdrawal : userWithdrawalList) {
+            baseMapper.updateById(userWithdrawal);
+        }
+    }
+
     /***
      * 入提现表
      * @author liweifan
@@ -135,8 +192,6 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
         BigDecimal actualAmount = withdrawalReq.getAmountWithdrawal().subtract(withdrawalServiceFee);
         userWithdrawal.setActualAmount(actualAmount);
         userWithdrawal.setBankCard(bankCardVo.getBankCard());
-        //todo 银行流水号
-
         userWithdrawal.setCreateTime(new Date());
         userWithdrawal.setUpdateTime(new Date());
         userWithdrawal.setStatus(AuthStatusEnum.DOING);

+ 4 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderDetailMapper.xml

@@ -8,6 +8,8 @@
             <result column="good_type_" property="goodType" />
             <result column="biz_id_" property="bizId" />
 	        <result column="biz_content_" property="bizContent" />
+            <result column="good_name_" property="goodName" />
+            <result column="good_url_" property="goodUrl" />
             <result column="original_price_" property="originalPrice" />
             <result column="expect_price_" property="expectPrice" />
             <result column="good_num_" property="goodNum" />
@@ -26,6 +28,8 @@
         , t.good_type_ as goodType
         , t.biz_id_ as bizId
         , t.biz_content_ as bizContent
+        , t.good_name_ as goodName
+        , t.good_url_ as goodUrl
         , t.original_price_ as originalPrice
         , t.expect_price_ as expectPrice
         , t.good_num_ as goodNum

+ 38 - 7
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserWithdrawalController.java

@@ -1,26 +1,32 @@
 package com.yonge.cooleshow.teacher.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.req.WithdrawalReq;
-import com.yonge.cooleshow.biz.dal.entity.UserBankCard;
-import com.yonge.cooleshow.biz.dal.entity.UserOrder;
-import com.yonge.cooleshow.biz.dal.enums.CacheNameEnum;
+import com.yonge.cooleshow.biz.dal.dto.search.TeacherWithdrawalSearch;
 import com.yonge.cooleshow.biz.dal.service.UserWithdrawalService;
-import com.yonge.cooleshow.biz.dal.support.DistributedLock;
+import com.yonge.cooleshow.biz.dal.support.PageUtil;
+import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
+import com.yonge.cooleshow.biz.dal.vo.UserWithdrawalVo;
 import com.yonge.cooleshow.biz.dal.vo.res.WithdrawalInfoRes;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.exception.BizException;
+import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.toolset.utils.date.DateUtil;
+import com.yonge.toolset.utils.string.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import java.time.LocalDate;
+import java.time.temporal.TemporalAdjusters;
+import java.util.Calendar;
+import java.util.Date;
 
 @RestController
 @RequestMapping("/userWithdrawal")
@@ -50,4 +56,29 @@ public class UserWithdrawalController extends BaseController {
         }
         return userWithdrawalService.withdrawal(user.getId(), withdrawalReq);
     }
+
+    @PostMapping("/withdrawalPage")
+    @ApiOperation(value = "提现记录")
+    public HttpResponseResult<PageInfo<UserWithdrawalVo>> withdrawalPage(@RequestBody TeacherWithdrawalSearch withdrawalSearch) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        withdrawalSearch.setUserId(user.getId());
+        if (StringUtil.isEmpty(withdrawalSearch.getWithdrawalDate())) {
+            withdrawalSearch.setWithdrawalDate(DateUtil.format(new Date(), "yyyy-MM"));
+        }
+        try {
+            Calendar calendar = Calendar.getInstance();
+            String[] classDateSp = withdrawalSearch.getWithdrawalDate().split("-");
+            calendar.set(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1, 0, 0, 0);
+            withdrawalSearch.setStartTime(calendar.getTime());
+            withdrawalSearch.setEndTime(DateUtil.dayEnd(DateUtil.getLastDayOfMonth(calendar.getTime())));
+        } catch (Exception e) {
+            throw new BizException("查询时间格式不正确 [" + withdrawalSearch.getWithdrawalDate() + "]");
+        }
+        IPage<UserWithdrawalVo> pages = userWithdrawalService.selectPage(PageUtil.getPage(withdrawalSearch), withdrawalSearch);
+        return succeed(PageUtil.pageInfo(pages));
+    }
+
 }

+ 35 - 0
toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ErrMsg.java

@@ -0,0 +1,35 @@
+package com.yonge.toolset.utils.easyexcel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/19 17:08
+ */
+public class ErrMsg {
+    @ExcelProperty(value = "异常行号", index = 0)
+    private int row;
+    @ExcelProperty(value = "异常信息", index = 0)
+    private String msg;
+
+    public ErrMsg(int row, String msg) {
+        this.row = row;
+        this.msg = msg;
+    }
+
+    public int getRow() {
+        return row;
+    }
+
+    public void setRow(int row) {
+        this.row = row;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 5 - 10
toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ExcelDataReader.java

@@ -1,5 +1,6 @@
 package com.yonge.toolset.utils.easyexcel;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
 import org.apache.commons.collections.CollectionUtils;
@@ -9,8 +10,10 @@ import org.slf4j.LoggerFactory;
 import javax.validation.ConstraintViolation;
 import javax.validation.Validation;
 import javax.validation.Validator;
+import javax.websocket.Session;
 import java.util.*;
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
@@ -22,7 +25,6 @@ import java.util.stream.Collectors;
  */
 public class ExcelDataReader<T> extends AnalysisEventListener<T> {
     private static final Logger log = LoggerFactory.getLogger(ExcelDataReader.class);
-
     //数据
     private final List<ExcelDataReaderProperty<T>> dataList = new ArrayList<>();
     //文件名称
@@ -35,8 +37,6 @@ public class ExcelDataReader<T> extends AnalysisEventListener<T> {
     private final AtomicInteger rows = new AtomicInteger(0);
     //异步执行的集合
     private final List<CompletableFuture<ExcelDataReaderProperty<T>>> futureList = new ArrayList<>();
-    //所有异常的集合 key excel文件
-    private final Map<Integer, String> totalErrorList = new HashMap<>();
     //校验
     private final Validator vf;
 
@@ -58,10 +58,6 @@ public class ExcelDataReader<T> extends AnalysisEventListener<T> {
         return rows.get();
     }
 
-    public Map<Integer, String> getTotalErrorList() {
-        return totalErrorList;
-    }
-
     @Override
     public void invoke(T data, AnalysisContext context) {
         //支持多sheet数据导入,每次换sheet后要清除上一个sheet的数据
@@ -98,11 +94,10 @@ public class ExcelDataReader<T> extends AnalysisEventListener<T> {
             String collect = set.stream()
                     .map(ConstraintViolation::getMessage)
                     .collect(Collectors.joining());
-            property.setErrorMessage(collect);
             Integer rowIndex = context.readRowHolder().getRowIndex();
-            totalErrorList.put(rowIndex, collect);
+            property.setRowIndex(rowIndex);
+            property.setErrorMessage(collect);
         }
         return property;
     }
-
 }

+ 10 - 0
toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ExcelDataReaderProperty.java

@@ -10,6 +10,8 @@ public class ExcelDataReaderProperty<T> implements Serializable {
 
     private T clazz;
 
+    private Integer rowIndex;
+
     private String errorMessage;
 
     public T getClazz() {
@@ -20,6 +22,14 @@ public class ExcelDataReaderProperty<T> implements Serializable {
         this.clazz = clazz;
     }
 
+    public Integer getRowIndex() {
+        return rowIndex;
+    }
+
+    public void setRowIndex(Integer rowIndex) {
+        this.rowIndex = rowIndex;
+    }
+
     public String getErrorMessage() {
         return errorMessage;
     }

+ 56 - 0
toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ExcelException.java

@@ -0,0 +1,56 @@
+package com.yonge.toolset.utils.easyexcel;
+
+import com.yonge.toolset.utils.string.MessageFormatter;
+
+import java.util.List;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/20 10:09
+ */
+public class ExcelException extends RuntimeException{
+
+    private List<ErrMsg> errMsgList;
+    /**
+     *
+     */
+    private static final long serialVersionUID = -4562885563376566463L;
+
+    public ExcelException() {
+        super();
+    }
+
+    public ExcelException(String message) {
+        super(message);
+    }
+
+    public ExcelException(Throwable cause) {
+        super(cause);
+    }
+
+    public ExcelException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ExcelException(String message, Object... arguments) {
+        super(MessageFormatter.arrayFormat(message, arguments));
+    }
+
+    public ExcelException(String message, Throwable cause, Object... args) {
+        super(MessageFormatter.arrayFormat(message, args), cause);
+    }
+
+    public ExcelException(String message,List<ErrMsg> errMsgList) {
+        super(message);
+        this.errMsgList = errMsgList;
+    }
+
+
+    public List<ErrMsg> getErrMsgList() {
+        return errMsgList;
+    }
+
+    public void setErrMsgList(List<ErrMsg> errMsgList) {
+        this.errMsgList = errMsgList;
+    }
+}

+ 5 - 6
toolset/utils/src/main/java/com/yonge/toolset/utils/easyexcel/ExcelUtils.java

@@ -1,9 +1,11 @@
 package com.yonge.toolset.utils.easyexcel;
 
 import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.alibaba.excel.util.CollectionUtils;
 import com.alibaba.excel.util.DateUtils;
+import com.yonge.toolset.utils.string.StringUtil;
 import org.apache.commons.codec.Charsets;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -18,10 +20,8 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 导入数据工具包
@@ -136,12 +136,11 @@ public class ExcelUtils {
             response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
             if (!CollectionUtils.isEmpty(data)) {
                 EasyExcel.write(response.getOutputStream(), data.get(0).getClass()).sheet(sheetName).doWrite(data);
-            }else{
+            } else {
                 throw new RuntimeException("没有数据导出!");
             }
         } catch (IOException e) {
             throw new RuntimeException("导出数据异常!", e.getCause());
         }
     }
-
 }