Browse Source

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu 5 months ago
parent
commit
49de737ce1

+ 16 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/worker/WorkerWarrantyDetal.java

@@ -0,0 +1,16 @@
+package com.gree.mall.miniapp.bean.worker;
+
+import com.gree.mall.miniapp.plus.entity.WorkerWarranty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@ApiModel
+public class WorkerWarrantyDetal extends WorkerWarranty {
+
+    @ApiModelProperty(value = "质保金明细")
+    private List<WorkerWarrantyPrice> workerWarrantyPrices;
+}

+ 23 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/worker/WorkerWarrantyPrice.java

@@ -0,0 +1,23 @@
+package com.gree.mall.miniapp.bean.worker;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@ApiModel
+public class WorkerWarrantyPrice {
+
+    @ApiModelProperty(value = "金额")
+    private BigDecimal price;
+
+    @ApiModelProperty(value = "时间")
+    private Date time;
+
+
+    @ApiModelProperty(value = "类型 A退还 B扣除")
+    private String type;
+}

+ 12 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/controller/user/UserController.java

@@ -8,6 +8,7 @@ import com.gree.mall.miniapp.bean.common.WxJsApiSignBean;
 import com.gree.mall.miniapp.bean.settle.OrderShareBean;
 import com.gree.mall.miniapp.bean.settle.OrderShareBean;
 import com.gree.mall.miniapp.bean.user.*;
 import com.gree.mall.miniapp.bean.user.*;
 import com.gree.mall.miniapp.bean.websit.AdminWebsitApplyCount;
 import com.gree.mall.miniapp.bean.websit.AdminWebsitApplyCount;
+import com.gree.mall.miniapp.bean.worker.WorkerWarrantyDetal;
 import com.gree.mall.miniapp.constant.Constant;
 import com.gree.mall.miniapp.constant.Constant;
 import com.gree.mall.miniapp.exception.RemoteServiceException;
 import com.gree.mall.miniapp.exception.RemoteServiceException;
 import com.gree.mall.miniapp.helper.ResponseHelper;
 import com.gree.mall.miniapp.helper.ResponseHelper;
@@ -17,6 +18,7 @@ import com.gree.mall.miniapp.logic.common.outside.WechatLogic;
 import com.gree.mall.miniapp.logic.user.UserLogic;
 import com.gree.mall.miniapp.logic.user.UserLogic;
 import com.gree.mall.miniapp.plus.entity.SettleExpenseItem;
 import com.gree.mall.miniapp.plus.entity.SettleExpenseItem;
 import com.gree.mall.miniapp.plus.entity.User;
 import com.gree.mall.miniapp.plus.entity.User;
+import com.gree.mall.miniapp.plus.entity.WorkerWarranty;
 import com.gree.mall.miniapp.plus.service.UserService;
 import com.gree.mall.miniapp.plus.service.UserService;
 import com.gree.mall.miniapp.utils.CommonUtils;
 import com.gree.mall.miniapp.utils.CommonUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -420,4 +422,14 @@ public class UserController {
         userLogic.workerMobileLogout(request);
         userLogic.workerMobileLogout(request);
         return ResponseHelper.success();
         return ResponseHelper.success();
     }
     }
+
+    @PostMapping("/warranty")
+    @ApiOperation(value = "质保金")
+    public ResponseHelper<WorkerWarrantyDetal> warranty(
+
+    ) {
+        WorkerWarrantyDetal warrantyDetail = userLogic.warranty();
+        return ResponseHelper.success(warrantyDetail);
+    }
+
 }
 }

+ 47 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/user/UserLogic.java

@@ -12,6 +12,8 @@ import com.gree.mall.miniapp.bean.settle.OrderShareBean;
 import com.gree.mall.miniapp.bean.user.*;
 import com.gree.mall.miniapp.bean.user.*;
 import com.gree.mall.miniapp.bean.websit.AdminWebsitApplyCount;
 import com.gree.mall.miniapp.bean.websit.AdminWebsitApplyCount;
 import com.gree.mall.miniapp.bean.websit.WebsitVO;
 import com.gree.mall.miniapp.bean.websit.WebsitVO;
+import com.gree.mall.miniapp.bean.worker.WorkerWarrantyDetal;
+import com.gree.mall.miniapp.bean.worker.WorkerWarrantyPrice;
 import com.gree.mall.miniapp.commonmapper.CommonMapper;
 import com.gree.mall.miniapp.commonmapper.CommonMapper;
 import com.gree.mall.miniapp.commonmapper.MyProfitMapper;
 import com.gree.mall.miniapp.commonmapper.MyProfitMapper;
 import com.gree.mall.miniapp.commonmapper.OrderShareRankMapper;
 import com.gree.mall.miniapp.commonmapper.OrderShareRankMapper;
@@ -119,6 +121,15 @@ public class UserLogic {
     @Autowired
     @Autowired
     UserWaitWorkerImgService userWaitWorkerImgService;
     UserWaitWorkerImgService userWaitWorkerImgService;
 
 
+    @Autowired
+    WorkerWarrantyService workerWarrantyService;
+
+    @Autowired
+    WorkerWarrantyPayService workerWarrantyPayService;
+
+    @Autowired
+    WorkerWarrantyRefundService workerWarrantyRefundService;
+
     /**
     /**
      * 微信小程序授权
      * 微信小程序授权
      *
      *
@@ -1598,4 +1609,40 @@ public class UserLogic {
         return adminWebsitApplyCount;
         return adminWebsitApplyCount;
 
 
     }
     }
+
+    public WorkerWarrantyDetal warranty() {
+        CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
+
+        WorkerWarranty workerWarranty = workerWarrantyService.lambdaQuery().eq(WorkerWarranty::getWorkerId, currentCompanyWechat.getUser())
+                .last("limit 1").one();
+
+        if (workerWarranty == null)
+            return new WorkerWarrantyDetal();
+
+        WorkerWarrantyDetal workerWarrantyDetal = BeanUtil.toBean(workerWarranty, WorkerWarrantyDetal.class);
+
+        List<WorkerWarrantyRefund> workerWarrantyRefunds = workerWarrantyRefundService.lambdaQuery().eq(WorkerWarrantyRefund::getWarrantyId, workerWarranty.getWarrantyId()).list();
+        List<WorkerWarrantyPay> workerWarrantyPays = workerWarrantyPayService.lambdaQuery().eq(WorkerWarrantyPay::getWarrantyId, workerWarranty.getWarrantyId()).list();
+
+        List<WorkerWarrantyPrice> workerWarrantyPrices = new ArrayList<>();
+
+        for (WorkerWarrantyRefund workerWarrantyRefund : workerWarrantyRefunds) {
+            WorkerWarrantyPrice workerWarrantyPrice = new WorkerWarrantyPrice();
+            workerWarrantyPrice.setPrice(workerWarrantyRefund.getRefundAmout());
+            workerWarrantyPrice.setTime(workerWarrantyRefund.getRefundTime());
+            workerWarrantyPrice.setType("A");
+            workerWarrantyPrices.add(workerWarrantyPrice);
+        }
+        for (WorkerWarrantyPay workerWarrantyPay : workerWarrantyPays) {
+            WorkerWarrantyPrice workerWarrantyPrice = new WorkerWarrantyPrice();
+            workerWarrantyPrice.setPrice(workerWarrantyPay.getPayAmount());
+            workerWarrantyPrice.setTime(workerWarrantyPay.getPayTime());
+            workerWarrantyPrice.setType("B");
+            workerWarrantyPrices.add(workerWarrantyPrice);
+        }
+
+        List<WorkerWarrantyPrice> collect = workerWarrantyPrices.stream().sorted(Comparator.comparing(WorkerWarrantyPrice::getTime).reversed()).collect(Collectors.toList());
+        workerWarrantyDetal.setWorkerWarrantyPrices(collect);
+        return workerWarrantyDetal;
+    }
 }
 }

+ 23 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/worker/WorkerWarrantyDetail.java

@@ -0,0 +1,23 @@
+package com.gree.mall.manager.bean.worker;
+
+import com.gree.mall.manager.plus.entity.WorkerWarranty;
+import com.gree.mall.manager.plus.entity.WorkerWarrantyPay;
+import com.gree.mall.manager.plus.entity.WorkerWarrantyRefund;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@ApiModel
+public class WorkerWarrantyDetail extends WorkerWarranty {
+
+    @ApiModelProperty(value = "缴费记录")
+    private List<WorkerWarrantyPay> workerWarrantyPays;
+
+
+    @ApiModelProperty(value = "退款记录")
+    private List<WorkerWarrantyRefund> workerWarrantyRefunds;
+
+}

+ 37 - 4
mall-server-api/src/main/java/com/gree/mall/manager/controller/worker/WorkerWarrantyController.java

@@ -8,6 +8,7 @@ import com.gree.mall.manager.bean.notice.NoticeWebsitBean;
 import com.gree.mall.manager.bean.notice.NoticeWebsitVO;
 import com.gree.mall.manager.bean.notice.NoticeWebsitVO;
 import com.gree.mall.manager.bean.worker.WebsitWorkerBean;
 import com.gree.mall.manager.bean.worker.WebsitWorkerBean;
 import com.gree.mall.manager.bean.worker.WorkerTeamVO;
 import com.gree.mall.manager.bean.worker.WorkerTeamVO;
+import com.gree.mall.manager.bean.worker.WorkerWarrantyDetail;
 import com.gree.mall.manager.bean.worker.WorkerWarrantyVO;
 import com.gree.mall.manager.bean.worker.WorkerWarrantyVO;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
 import com.gree.mall.manager.helper.ResponseHelper;
@@ -16,6 +17,7 @@ import com.gree.mall.manager.logic.worker.WorkerTeamLogic;
 import com.gree.mall.manager.logic.worker.WorkerWarrantyLogic;
 import com.gree.mall.manager.logic.worker.WorkerWarrantyLogic;
 import com.gree.mall.manager.plus.entity.NoticeWebsit;
 import com.gree.mall.manager.plus.entity.NoticeWebsit;
 import com.gree.mall.manager.plus.entity.WorkerTeam;
 import com.gree.mall.manager.plus.entity.WorkerTeam;
+import com.gree.mall.manager.plus.entity.WorkerWarrantyRefund;
 import com.gree.mall.manager.zfire.bean.WorkerTeamParamBean;
 import com.gree.mall.manager.zfire.bean.WorkerTeamParamBean;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import com.gree.mall.manager.zfire.util.FieldUtils;
@@ -30,6 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 @Slf4j
 @Slf4j
@@ -68,11 +71,41 @@ public class WorkerWarrantyController {
         FieldUtils.exportData(stockBeanIPage.getRecords(), zfireParam.getExportFields(), request, response);
         FieldUtils.exportData(stockBeanIPage.getRecords(), zfireParam.getExportFields(), request, response);
     }
     }
 
 
+    @PostMapping("/detail")
+    @ApiOperation(value = "详情")
+    public ResponseHelper<WorkerWarrantyDetail> detail(@ApiParam(value = "质保id", required = true) @RequestParam String warrantyId
 
 
-/*    @PostMapping("/refund")
+    ) {
+        WorkerWarrantyDetail warrantyDetail = workerWarrantyLogic.detail(warrantyId);
+        return ResponseHelper.success(warrantyDetail);
+    }
+
+    @PostMapping("/add")
+    @ApiOperation(value = "新增")
+    public ResponseHelper add(@ApiParam(value = "质保金额", required = true) @RequestParam BigDecimal shouldAmount,
+                              @ApiParam(value = "每期扣款金额") @RequestParam(required = true) BigDecimal everyAmount,
+                              @ApiParam(value = "师傅id") @RequestParam(required = true) List<String> websitUserId
+    ) {
+        workerWarrantyLogic.add(shouldAmount,everyAmount,websitUserId);
+        return ResponseHelper.success();
+    }
+
+
+    @PostMapping("/refund")
     @ApiOperation(value = "退款")
     @ApiOperation(value = "退款")
-    public ResponseHelper refund(@RequestBody NoticeWebsitBean noticeBean) {
-        workerWarrantyLogic.refund(noticeBean);
+    public ResponseHelper refund(@RequestBody WorkerWarrantyRefund workerWarrantyRefund) {
+        workerWarrantyLogic.refund(workerWarrantyRefund);
         return ResponseHelper.success();
         return ResponseHelper.success();
-    }*/
+    }
+
+    @PostMapping("/import")
+    @ApiOperation(value = "新增质保金导入")
+    public ResponseHelper<String> importData(
+            @RequestPart("file") MultipartFile file
+    ) throws Exception {
+        workerWarrantyLogic.importData(file);
+        return ResponseHelper.success();
+    }
+
+
 }
 }

+ 237 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/worker/WorkerWarrantyLogic.java

@@ -1,20 +1,44 @@
 package com.gree.mall.manager.logic.worker;
 package com.gree.mall.manager.logic.worker;
 
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.notice.NoticeWebsitVO;
 import com.gree.mall.manager.bean.notice.NoticeWebsitVO;
+import com.gree.mall.manager.bean.worker.WorkerWarrantyDetail;
 import com.gree.mall.manager.bean.worker.WorkerWarrantyVO;
 import com.gree.mall.manager.bean.worker.WorkerWarrantyVO;
 import com.gree.mall.manager.commonmapper.NoticeRecordBeanMapper;
 import com.gree.mall.manager.commonmapper.NoticeRecordBeanMapper;
+import com.gree.mall.manager.enums.admin.AdminWebsitTypeEnum;
+import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.plus.entity.*;
+import com.gree.mall.manager.plus.service.*;
+import com.gree.mall.manager.utils.StringUtil;
+import com.gree.mall.manager.utils.excel.ExcelUtils;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
 
 
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 
 @Service
 @Service
 @Slf4j
 @Slf4j
@@ -27,6 +51,25 @@ public class WorkerWarrantyLogic {
     @Autowired
     @Autowired
     CommonLogic commonLogic;
     CommonLogic commonLogic;
 
 
+    @Autowired
+    WorkerWarrantyService workerWarrantyService;
+
+    @Autowired
+    WorkerWarrantyRefundService workerWarrantyRefundService;
+
+    @Autowired
+    WebsitUserService websitUserService;
+
+    @Autowired
+    UserService userService;
+
+    @Autowired
+    AdminWebsitService adminWebsitService;
+
+
+    @Autowired
+    WorkerWarrantyPayService workerWarrantyPayService;
+
     public IPage<WorkerWarrantyVO> list(Page page, ZfireParamBean zfireParam) {
     public IPage<WorkerWarrantyVO> list(Page page, ZfireParamBean zfireParam) {
 
 
         //获取当前登录企业id
         //获取当前登录企业id
@@ -40,4 +83,198 @@ public class WorkerWarrantyLogic {
 
 
         return workerWarrantyVOIPage;
         return workerWarrantyVOIPage;
     }
     }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void refund(WorkerWarrantyRefund workerWarrantyRefund) {
+        WorkerWarranty workerWarranty = workerWarrantyService.getById(workerWarrantyRefund.getWarrantyId());
+
+        if (workerWarranty.getRefundAmount().add(workerWarrantyRefund.getRefundAmout()).doubleValue() > workerWarranty.getPayableAmount().doubleValue()) {
+            throw new RemoteServiceException("总退金额大于了缴纳金额");
+        }
+
+        workerWarranty.setRefundAmount(workerWarranty.getRefundAmount().add(workerWarrantyRefund.getRefundAmout()));
+        workerWarranty.updateById();
+        workerWarrantyRefund.insert();
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void add(BigDecimal shouldAmount, BigDecimal everyAmount, List<String> websitUserId) {
+        List<WorkerWarranty> workerWarranties = new ArrayList<>();
+
+        for (String s : websitUserId) {
+            WebsitUser websitUser = websitUserService.getById(s);
+            User user = userService.getById(websitUser.getUserId());
+            if (workerWarrantyService.lambdaQuery().eq(WorkerWarranty::getMobile,user.getMobile())
+                    .count() > 0) {
+                throw new RemoteServiceException(user.getNickName()+"师傅已经添加过质保金");
+            }
+            WorkerWarranty workerWarranty = new WorkerWarranty();
+            workerWarranty.setWebsitId(websitUser.getWebsitId());
+            workerWarranty.setWebsitName(websitUser.getWebsitName());
+            workerWarranty.setCompanyWechatId(websitUser.getCompanyWechatId());
+            workerWarranty.setCompanyWechatName(websitUser.getCompanyWechatName());
+            workerWarranty.setWorkerId(websitUser.getUserId());
+            workerWarranty.setWorkerNumber(websitUser.getWorkerNumber());
+            workerWarranty.setWorkerName(user.getNickName());
+            workerWarranty.setIdCard(user.getIdCard());
+            workerWarranty.setMobile(user.getMobile());
+            workerWarranty.setEveryAmount(everyAmount);
+            workerWarranty.setShouldAmount(shouldAmount);
+            workerWarranties.add(workerWarranty);
+        }
+
+        workerWarrantyService.saveBatch(workerWarranties);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void importData(MultipartFile file) throws IOException {
+
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        List<Object> objects = ExcelUtils.importExcel(file);
+
+        List<WorkerWarranty> workerWarranties = new ArrayList<>();
+        List<WorkerWarrantyRefund> workerWarrantyRefunds = new ArrayList<>();
+        List<WorkerWarrantyPay> workerWarrantyPays = new ArrayList<>();
+
+        List<WorkerWarranty> workerWarrantyList = workerWarrantyService.lambdaQuery()
+                .eq(WorkerWarranty::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .in(adminUser.getType() == 0, WorkerWarranty::getWebsitId, adminUser.getAdminWebsitIds())
+                .list();
+
+        //网点名称
+        Map<String, AdminWebsit> adminWebsitMap = adminWebsitService.lambdaQuery()
+                .eq(AdminWebsit::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .in(adminUser.getType() == 0, AdminWebsit::getWebsitId, adminUser.getAdminWebsitIds())
+                .eq(AdminWebsit::getType, AdminWebsitTypeEnum.C.getKey())
+                .list().stream().collect(Collectors.toMap(AdminWebsit::getWebsitId, Function.identity()));
+
+
+
+        //网点名称
+        Map<String, User> userMap = userService.lambdaQuery()
+                .eq(User::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .list().stream().collect(Collectors.toMap(User::getMobile, Function.identity()));
+
+        for (int i = 0; i < objects.size(); i++) {
+            int rowIndex = i + 2;
+            List<Object> row = (List<Object>) objects.get(i);
+
+            AdminWebsit adminWebsit = adminWebsitMap.get((String) row.get(0));
+            User user = userMap.get((String) row.get(8));
+
+
+            WorkerWarranty workerWarranty = new WorkerWarranty();
+
+
+            workerWarranty.setWebsitId(adminWebsit.getWebsitId());
+            workerWarranty.setWebsitName(adminWebsit.getName());
+
+
+
+            workerWarranty.setInTime(DateUtil.parse((String)row.get(4), "yyyy-MM-dd"));
+            if (!StringUtil.isEmpty((String)row.get(5)))
+             workerWarranty.setOutTime(DateUtil.parse((String)row.get(5), "yyyy-MM-dd"));
+
+            if (!StringUtil.isEmpty((String)row.get(3))) {
+                workerWarranty.setRefundAmount(Convert.toBigDecimal(row.get(3)));
+                workerWarranty.setRefundTime(DateUtil.parse((String) row.get(2), "yyyy-MM-dd"));
+            }
+
+
+
+            workerWarranty.setCompanyWechatId(adminWebsit.getCompanyWechatId());
+            workerWarranty.setCompanyWechatName(adminWebsit.getCompanyWechatName());
+            workerWarranty.setWorkerNumber(user.getWorkerNumber());
+            workerWarranty.setWorkerName(user.getNickName());
+            workerWarranty.setIdCard(user.getIdCard());
+            workerWarranty.setMobile(user.getMobile());
+            workerWarranty.setWorkerId(user.getUserId());
+            if (!StringUtil.isEmpty((String)row.get(11)))
+                workerWarranty.setEveryAmount(Convert.toBigDecimal(row.get(11)));
+
+
+            if (!StringUtil.isEmpty((String)row.get(12)))
+                workerWarranty.setPayableNum(Convert.toInt(row.get(12)));
+
+            workerWarranty.setShouldAmount(Convert.toBigDecimal(row.get(10)));
+
+            List<WorkerWarranty> workerWarrantyListUp = workerWarrantyList.stream().filter(item -> item.getMobile().equals(workerWarranty.getMobile())
+
+            ).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(workerWarrantyListUp))
+                workerWarranty.setWarrantyId(workerWarrantyListUp.get(0).getWarrantyId());
+            else
+                workerWarranty.setWarrantyId(IdWorker.getIdStr());
+
+            WorkerWarrantyRefund workerWarrantyRefund = new WorkerWarrantyRefund();
+            workerWarrantyRefund.setWarrantyId(workerWarranty.getWarrantyId());
+            workerWarrantyRefund.setRefundAmout(workerWarranty.getRefundAmount());
+            workerWarrantyRefund.setRefundTime(workerWarranty.getRefundTime());
+            workerWarrantyRefunds.add(workerWarrantyRefund);
+
+            if (row.size() > 11) {
+                List<WorkerWarrantyPay> workerWarrantyPays1 = this.importPayAmount(row, workerWarranty.getWarrantyId(), rowIndex);
+                workerWarrantyPays.addAll(workerWarrantyPays1);
+            }
+
+            workerWarranties.add(workerWarranty);
+
+        }
+
+        if (CollectionUtils.isNotEmpty(workerWarranties))
+            workerWarrantyService.saveOrUpdateBatch(workerWarranties);
+        if (CollectionUtils.isNotEmpty(workerWarrantyPays))
+            workerWarrantyPayService.saveBatch(workerWarrantyPays);
+        if (CollectionUtils.isNotEmpty(workerWarrantyRefunds))
+            workerWarrantyRefundService.saveBatch(workerWarrantyRefunds);
+    }
+
+
+    private List<WorkerWarrantyPay> importPayAmount(List<Object> row, String id, int index) {
+
+        List<WorkerWarrantyPay> workerWarrantyPays = new ArrayList<>();
+        //默认最多10个机型
+        for (int i = 0; i < 24; i++) {
+            String payAmount = (String) row.get(2 * i + 12);
+            String payAmountTime = (String) row.get(2 * i + 13);
+
+            if (StringUtils.isBlank(payAmount)) {
+                continue;
+            }
+
+            WorkerWarrantyPay workerWarrantyPay = new WorkerWarrantyPay();
+            workerWarrantyPay.setWarrantyId(id);
+            workerWarrantyPay.setPayAmount(Convert.toBigDecimal(payAmount));
+            workerWarrantyPay.setPayTime(DateUtil.parse(payAmountTime, "yyyy-MM-dd"));
+
+            workerWarrantyPays.add(workerWarrantyPay);
+
+        }
+
+        return workerWarrantyPays;
+
+    }
+
+
+    public WorkerWarrantyDetail detail(String warrantyId) {
+        WorkerWarranty workerWarranty = workerWarrantyService.getById(warrantyId);
+
+        WorkerWarrantyDetail workerWarrantyDetail = BeanUtil.toBean(workerWarranty, WorkerWarrantyDetail.class);
+
+        List<WorkerWarrantyRefund> workerWarrantyRefunds = workerWarrantyRefundService.lambdaQuery()
+                .eq(WorkerWarrantyRefund::getWarrantyId, warrantyId)
+                .orderByDesc(WorkerWarrantyRefund::getRefundTime)
+                .list();
+        List<WorkerWarrantyPay> workerWarrantyPays = workerWarrantyPayService.lambdaQuery()
+                .eq(WorkerWarrantyPay::getWarrantyId, warrantyId)
+                .orderByDesc(WorkerWarrantyPay::getPayTime)
+                .list();
+
+        workerWarrantyDetail.setWorkerWarrantyPays(workerWarrantyPays);
+        workerWarrantyDetail.setWorkerWarrantyRefunds(workerWarrantyRefunds);
+
+        return workerWarrantyDetail;
+
+    }
 }
 }

+ 4 - 2
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/ChangeOrderLogic.java

@@ -177,6 +177,7 @@ public class ChangeOrderLogic {
 
 
         }
         }
 
 
+/*
         List<String> orderIds = new ArrayList<>();
         List<String> orderIds = new ArrayList<>();
 
 
         for (String id : ids) {
         for (String id : ids) {
@@ -197,10 +198,11 @@ public class ChangeOrderLogic {
 
 
         if (CollectionUtils.isEmpty(orderIds))
         if (CollectionUtils.isEmpty(orderIds))
             return;
             return;
+*/
 
 
 
 
         pgOrderBaseService.lambdaUpdate()
         pgOrderBaseService.lambdaUpdate()
-                .in(PgOrderBase::getId, orderIds)
+                .in(PgOrderBase::getId, ids)
                 .set(PgOrderBase::getWorkerName, userOne.getNickName())
                 .set(PgOrderBase::getWorkerName, userOne.getNickName())
                 .set(PgOrderBase::getWebsitId, websitId)
                 .set(PgOrderBase::getWebsitId, websitId)
                 .set(PgOrderBase::getWebsitName, adminWebsit.getName())
                 .set(PgOrderBase::getWebsitName, adminWebsit.getName())
@@ -216,7 +218,7 @@ public class ChangeOrderLogic {
                 .update();
                 .update();
 
 
         List<PgOrderBase> list = pgOrderBaseService.lambdaQuery()
         List<PgOrderBase> list = pgOrderBaseService.lambdaQuery()
-                .in(PgOrderBase::getId, orderIds).list();
+                .in(PgOrderBase::getId, ids).list();
 
 
         for (PgOrderBase pgOrderBase : list) {
         for (PgOrderBase pgOrderBase : list) {
             if (pgOrderBase.getIsImportExcel()) {
             if (pgOrderBase.getIsImportExcel()) {