Prechádzať zdrojové kódy

工单详情,备件材料

lyhzzz 2 rokov pred
rodič
commit
8d6700d8c3

+ 3 - 0
src/main/java/com/fdkankan/sale/entity/RepairPay.java

@@ -68,6 +68,9 @@ public class RepairPay implements Serializable {
     @TableField("trade_no")
     private String tradeNo;
 
+    @TableField("order_type")
+    private Integer orderType;
+
     @TableField("rec_status")
     @TableLogic(value = "A",delval = "I")
     private String recStatus;

+ 18 - 4
src/main/java/com/fdkankan/sale/pay/wx/WechatPayService.java

@@ -50,24 +50,38 @@ public class WechatPayService {
         if(repair == null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        if(repair.getStatus() != 9){
+        if(repair.getStatus() != 9 || repair.getStatus() != 4){
             throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
         }
         RepairPay repairPay = repairPayService.getByRepairId(param.getRepairId(),1);
         if(repairPay != null  ){
             throw new BusinessException(ResultCode.ORDER_PAY_ERROR);
         }
-        String orderSn = "sale_"+DateUtil.getDate();
-        BigDecimal amount = priceListService.getAmountByRepairId(param.getRepairId());
+        String orderSn = null;
+        BigDecimal amount = BigDecimal.ZERO;
+        String subject = null;
+        Integer orderType = null;
+        if(repair.getStatus() == 9){
+            amount = priceListService.getAmountByRepairId(param.getRepairId());
+            orderSn = "sale_"+DateUtil.getDate();
+            subject = "维修订单";
+            orderType = 0;
+        }
+        if(repair.getStatus() == 3){
+            amount = priceListService.getRobAmountByRepairId(param.getRepairId());
+            orderSn = "sale_cancel_"+DateUtil.getDate();
+            subject = "取消维修订单";
+            orderType = 1;
+        }
 
         repairPay = new RepairPay();
         repairPay.setRepairId(param.getRepairId());
         repairPay.setPayType(1);
         repairPay.setOrderSn(orderSn);
         repairPay.setPayAmount(amount);
+        repairPay.setOrderType(orderType);
         repairPayService.save(repairPay);
 
-        String subject = "维修订单";
         BigDecimal totalFee = amount.multiply(new BigDecimal(100));
         String body = subject;
         return this.wechatH5Pay(param.getRepairId(),orderSn, subject, body, totalFee, ip);

+ 4 - 0
src/main/java/com/fdkankan/sale/service/IPriceListService.java

@@ -23,4 +23,8 @@ public interface IPriceListService extends IService<PriceList> {
     void updateStatusByRepairId(String repairId);
 
     List<PriceList> getByRepairIdAndStatus(String repairId, Integer status);
+
+    BigDecimal getRobAmountByRepairId(String repairId);
+
+    List<PriceList> getByRepairIdAndStatusAndType(String repairId, Integer type);
 }

+ 18 - 0
src/main/java/com/fdkankan/sale/service/impl/PriceListServiceImpl.java

@@ -40,6 +40,16 @@ public class PriceListServiceImpl extends ServiceImpl<IPriceListMapper, PriceLis
     }
 
     @Override
+    public BigDecimal getRobAmountByRepairId(String repairId) {
+        BigDecimal amount = BigDecimal.ZERO;
+        List<PriceList> byRepairId = this.getByRepairIdAndStatusAndType(repairId,1);
+        for (PriceList priceList : byRepairId) {
+            amount = amount.add(priceList.getPrice().multiply(new BigDecimal(priceList.getCount())));
+        }
+        return amount;
+    }
+
+    @Override
     public void updateStatusByRepairId(String repairId) {
         LambdaUpdateWrapper<PriceList> wrapper = new LambdaUpdateWrapper<>();
         wrapper.eq(PriceList::getRepairId,repairId);
@@ -54,4 +64,12 @@ public class PriceListServiceImpl extends ServiceImpl<IPriceListMapper, PriceLis
         wrapper.eq(PriceList::getStatus,1);
         return list(wrapper);
     }
+
+    @Override
+    public List<PriceList> getByRepairIdAndStatusAndType(String repairId, Integer type) {
+        LambdaQueryWrapper<PriceList> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(PriceList::getRepairId,repairId);
+        wrapper.eq(PriceList::getType,1);
+        return list(wrapper);
+    }
 }

+ 1 - 1
src/main/java/com/fdkankan/sale/service/impl/RepairCustomerService.java

@@ -61,7 +61,7 @@ public class RepairCustomerService {
             repairLogService.saveBySysUser(null,repair.getRepairId(),5,"确认维修");
         }
         if(param.getConfirm() == 1) {
-            repairLogService.saveBySysUser(null,repair.getRepairId(),4,"取消维修");
+            repairLogService.saveBySysUser(null,repair.getRepairId(),4,"拒绝报价");
             //存在确认过的报价单,返回维修中
             List<PriceList> priceLists = priceListService.getByRepairIdAndStatus(repair.getRepairId(),1);
             if(priceLists !=null && priceLists.size() >0){

+ 17 - 1
src/main/java/com/fdkankan/sale/service/impl/RepairRegisterServiceImpl.java

@@ -14,6 +14,7 @@ import com.fdkankan.sale.util.DateUtil;
 import com.fdkankan.sale.vo.response.CheckRegisterVo;
 import com.fdkankan.sale.vo.response.RepairRegisterPartVo;
 import com.fdkankan.sale.vo.response.RepairRegisterVo;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -83,6 +84,21 @@ public class RepairRegisterServiceImpl extends ServiceImpl<IRepairRegisterMapper
 
     @Override
     public RepairRegisterVo getVoByRepairId(String repairId) {
-        return this.getBaseMapper().getVoByRepairId( repairId);
+        RepairRegisterVo vo = this.getBaseMapper().getVoByRepairId(repairId);
+        List<RepairRegisterPart> partList = repairRegisterPartService.getByRepairId(repairId);
+        StringBuilder partNamesList = new StringBuilder();
+        for (RepairRegisterPart repairRegisterPart : partList) {
+            Integer partId = repairRegisterPart.getPartId();
+            Part part = partService.getById(partId);
+            if(part == null){
+                continue;
+            }
+            partNamesList.append(part.getPartName()).append("x").append(repairRegisterPart.getPartCount()).append(",");
+        }
+        if(StringUtils.isNotBlank(partNamesList.toString()) && partNamesList.toString().contains(",")){
+             partNamesList.deleteCharAt(partNamesList.lastIndexOf(","));
+        }
+        vo.setPartNamesStr(partNamesList.toString());
+        return vo;
     }
 }

+ 0 - 1
src/main/java/com/fdkankan/sale/vo/request/WechatMobileParam.java

@@ -5,6 +5,5 @@ import lombok.Data;
 @Data
 public class WechatMobileParam {
     private String repairId;
-    private Integer payType;
     private String orderSn;
 }

+ 1 - 0
src/main/java/com/fdkankan/sale/vo/response/RepairRegisterVo.java

@@ -6,4 +6,5 @@ import lombok.Data;
 @Data
 public class RepairRegisterVo extends RepairRegister {
     private String sysUserName;
+    private String partNamesStr;
 }