|
@@ -0,0 +1,88 @@
|
|
|
+package com.fdkankan.sale.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.fdkankan.sale.common.PageInfo;
|
|
|
+import com.fdkankan.sale.common.RepairStatusEnum;
|
|
|
+import com.fdkankan.sale.common.ResultCode;
|
|
|
+import com.fdkankan.sale.entity.Repair;
|
|
|
+import com.fdkankan.sale.entity.RepairCheckAccount;
|
|
|
+import com.fdkankan.sale.entity.RepairPay;
|
|
|
+import com.fdkankan.sale.exception.BusinessException;
|
|
|
+import com.fdkankan.sale.service.*;
|
|
|
+import com.fdkankan.sale.util.DateUtil;
|
|
|
+import com.fdkankan.sale.util.StatusUtil;
|
|
|
+import com.fdkankan.sale.vo.request.RepairParam;
|
|
|
+import com.fdkankan.sale.vo.response.RepairRegisterPartVo;
|
|
|
+import com.fdkankan.sale.vo.response.RepairerVo;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class RepairCheckAccountService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IRepairService repairService;
|
|
|
+ @Autowired
|
|
|
+ IRepairLogService repairLogService;
|
|
|
+ @Autowired
|
|
|
+ ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ IRepairCheckAccountService repairCheckAccountService;
|
|
|
+ @Autowired
|
|
|
+ RepairSupplyService repairSupplyService;
|
|
|
+ @Autowired
|
|
|
+ IRepairPayService repairPayService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 维修备件管理 供应链
|
|
|
+ * statusParam 0 待备料,1已备料,2待回收
|
|
|
+ * * status 0待接单,10待检测,20待报价,30待确认,40已取消,50待备料,60维修中,70待测试,
|
|
|
+ * * 80待支付(已完结),90待回收,100待发货,110已发货
|
|
|
+ */
|
|
|
+ public Object checkAccountList(RepairParam param) {
|
|
|
+ List<Integer> repairStatus = StatusUtil.getCheckAccountStatus(param.getStatusParam());
|
|
|
+ param.setStatusList(repairStatus);
|
|
|
+ Page<RepairerVo> voPage = repairService.checkAccountList(param);
|
|
|
+ sysUserService.setSaleNameAndRepairManName(voPage.getRecords());
|
|
|
+ return PageInfo.PageInfo(voPage);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void checkAccount(RepairCheckAccount param) {
|
|
|
+ if(StringUtils.isBlank(param.getRepairId())){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ Repair repair = repairService.getById(param.getRepairId());
|
|
|
+ if(repair == null){
|
|
|
+ throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
|
+ }
|
|
|
+ if(!repair.getStatus().equals(RepairStatusEnum.TO_BE_PAID_OVER.status())){
|
|
|
+ throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
|
+ }
|
|
|
+ RepairPay repairPay = repairPayService.getByRepairId(repair.getRepairId(), 1);
|
|
|
+ if(repairPay == null){
|
|
|
+ throw new BusinessException(ResultCode.NOt_PAY);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<RepairRegisterPartVo> partVoList = repairSupplyService.partInfo(repair.getRepairId(), 1);
|
|
|
+
|
|
|
+ Integer status = null;
|
|
|
+ if(repairPay.getOrderType() == 0){
|
|
|
+ status = RepairStatusEnum.TO_BE_RECOVERED.status();
|
|
|
+ }
|
|
|
+ if(repairPay.getOrderType() == 1){
|
|
|
+ status = RepairStatusEnum.TO_BE_CANCELED_RECOVERED.status();
|
|
|
+ }
|
|
|
+ if(partVoList.size() <=0){
|
|
|
+ status = RepairStatusEnum.TO_BE_SHIPPED.status();
|
|
|
+ }
|
|
|
+
|
|
|
+ repairLogService.saveBySysUser(param.getSysUserId(),param.getRepairId(),status,repair.getStatus(),"到账登记");
|
|
|
+
|
|
|
+ repairCheckAccountService.save(param);
|
|
|
+
|
|
|
+ }
|
|
|
+}
|