|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.fdkankan.sale.common.PageInfo;
|
|
import com.fdkankan.sale.common.PageInfo;
|
|
|
|
+import com.fdkankan.sale.common.RepairStatusEnum;
|
|
import com.fdkankan.sale.common.ResultCode;
|
|
import com.fdkankan.sale.common.ResultCode;
|
|
import com.fdkankan.sale.common.ResultData;
|
|
import com.fdkankan.sale.common.ResultData;
|
|
import com.fdkankan.sale.entity.*;
|
|
import com.fdkankan.sale.entity.*;
|
|
@@ -57,8 +58,8 @@ public class RepairSaleService {
|
|
/**
|
|
/**
|
|
* 售后工程师
|
|
* 售后工程师
|
|
* statusParam 0 待接单,1待跟进,2已完结
|
|
* statusParam 0 待接单,1待跟进,2已完结
|
|
- * status 0待接单,1待检测,2待报价,3待确认,4已取消,5待备料,6待回收,7维修中,8待测试,
|
|
|
|
- * 9待支付(已完结),10待发货,11已发货,12已评价
|
|
|
|
|
|
+ * * status 0待接单,10待检测,20待报价,30待确认,40已取消,50待备料,60维修中,70待测试,
|
|
|
|
+ * * 80待支付(已完结),90待回收,100待发货,110已发货
|
|
*/
|
|
*/
|
|
public PageInfo saleOrderList(RepairParam param) {
|
|
public PageInfo saleOrderList(RepairParam param) {
|
|
List<Integer> repairStatus = StatusUtil.getSaleStatus(param.getStatusParam());
|
|
List<Integer> repairStatus = StatusUtil.getSaleStatus(param.getStatusParam());
|
|
@@ -67,7 +68,7 @@ public class RepairSaleService {
|
|
sysUserService.setSaleNameAndRepairManName(voPage.getRecords());
|
|
sysUserService.setSaleNameAndRepairManName(voPage.getRecords());
|
|
BigDecimal payAmount;
|
|
BigDecimal payAmount;
|
|
for (RepairerVo record : voPage.getRecords()) {
|
|
for (RepairerVo record : voPage.getRecords()) {
|
|
- if(record.getStatus() == 4){
|
|
|
|
|
|
+ if(record.getStatus().equals(RepairStatusEnum.TO_BE_CANCELED.status())){
|
|
payAmount = priceListService.getRobAmountByRepairId(param.getRepairId());
|
|
payAmount = priceListService.getRobAmountByRepairId(param.getRepairId());
|
|
}else {
|
|
}else {
|
|
payAmount = priceListService.getAmountByRepairId(record.getRepairId());
|
|
payAmount = priceListService.getAmountByRepairId(record.getRepairId());
|
|
@@ -86,7 +87,7 @@ public class RepairSaleService {
|
|
if(repair == null){
|
|
if(repair == null){
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
}
|
|
}
|
|
- if(repair.getStatus() !=0 ){
|
|
|
|
|
|
+ if(!repair.getStatus().equals(RepairStatusEnum.TO_BE_RECEIVED.status())){
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
}
|
|
}
|
|
param.setSysUserId(sysUserId);
|
|
param.setSysUserId(sysUserId);
|
|
@@ -95,7 +96,7 @@ public class RepairSaleService {
|
|
param.setOrderFaultImg(param.getImageUrl());
|
|
param.setOrderFaultImg(param.getImageUrl());
|
|
orderReceivingService.save(param);
|
|
orderReceivingService.save(param);
|
|
|
|
|
|
- repairLogService.saveBySysUser(sysUserId,param.getRepairId(),1,"接单");
|
|
|
|
|
|
+ repairLogService.saveBySysUser(sysUserId,param.getRepairId(), RepairStatusEnum.TO_BE_CHECK.status(),"接单");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -150,7 +151,7 @@ public class RepairSaleService {
|
|
customerAddressService.save(customerAddress);
|
|
customerAddressService.save(customerAddress);
|
|
|
|
|
|
repairService.save(repair);
|
|
repairService.save(repair);
|
|
- repairLogService.saveBySysUser(userId,repair.getRepairId(),0,"录单");
|
|
|
|
|
|
+ repairLogService.saveBySysUser(userId,repair.getRepairId(),RepairStatusEnum.TO_BE_RECEIVED.status(),"录单");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -165,7 +166,8 @@ public class RepairSaleService {
|
|
if(repair == null){
|
|
if(repair == null){
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
}
|
|
}
|
|
- if(repair.getStatus() !=2 && repair.getStatus() !=3){
|
|
|
|
|
|
+ if(!repair.getStatus().equals(RepairStatusEnum.TO_BE_QUOTED.status())
|
|
|
|
+ && !repair.getStatus().equals(RepairStatusEnum.TO_BE_CONFIRMED.status())){
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -178,11 +180,11 @@ public class RepairSaleService {
|
|
}
|
|
}
|
|
if(priceList.getType() == 0){
|
|
if(priceList.getType() == 0){
|
|
if(priceList.getPartId() == null || partMap.get(priceList.getPartId()) == null
|
|
if(priceList.getPartId() == null || partMap.get(priceList.getPartId()) == null
|
|
- || priceList.getPriceListId() == null){
|
|
|
|
|
|
+ || priceList.getPriceListId() == null || priceList.getDiscount() == null){
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
}
|
|
}
|
|
Part part = partMap.get(priceList.getPartId());
|
|
Part part = partMap.get(priceList.getPartId());
|
|
- priceList.setPrice(part.getPartPrice());
|
|
|
|
|
|
+ priceList.setPrice(priceList.getDiscount() == 0?part.getPartPrice() : part.getPartPriceDiscount());
|
|
priceList.setName(part.getPartName());
|
|
priceList.setName(part.getPartName());
|
|
|
|
|
|
}
|
|
}
|
|
@@ -206,7 +208,7 @@ public class RepairSaleService {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- repairLogService.saveBySysUser(userId,param.getRepairId(),3,"维修报价");
|
|
|
|
|
|
+ repairLogService.saveBySysUser(userId,param.getRepairId(),RepairStatusEnum.TO_BE_CONFIRMED.status(),"维修报价");
|
|
}
|
|
}
|
|
|
|
|
|
public PriceListVo getPriceList(String repairId) {
|
|
public PriceListVo getPriceList(String repairId) {
|
|
@@ -214,7 +216,7 @@ public class RepairSaleService {
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
}
|
|
}
|
|
List<PriceList> priceLists = priceListService.getByRepairId(repairId);
|
|
List<PriceList> priceLists = priceListService.getByRepairId(repairId);
|
|
- List<RepairLog> repairLogs = repairLogService.getByRepairIdAndStatus(repairId, 3);
|
|
|
|
|
|
+ List<RepairLog> repairLogs = repairLogService.getByRepairIdAndStatus(repairId, RepairStatusEnum.TO_BE_CONFIRMED.status());
|
|
PriceListVo priceListVo = new PriceListVo();
|
|
PriceListVo priceListVo = new PriceListVo();
|
|
priceListVo.setPriceLists(priceLists);
|
|
priceListVo.setPriceLists(priceLists);
|
|
priceListVo.setCount(repairLogs.size() +1);
|
|
priceListVo.setCount(repairLogs.size() +1);
|
|
@@ -230,11 +232,11 @@ public class RepairSaleService {
|
|
if(repair == null){
|
|
if(repair == null){
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
}
|
|
}
|
|
- if(repair.getStatus() != 4 && repair.getStatus() !=9){
|
|
|
|
|
|
+ if(!repair.getStatus().equals(RepairStatusEnum.TO_BE_CANCELED.status()) && !repair.getStatus().equals(RepairStatusEnum.TO_BE_PAID.status())){
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
}
|
|
}
|
|
BigDecimal payAmount;
|
|
BigDecimal payAmount;
|
|
- if(repair.getStatus() == 4){
|
|
|
|
|
|
+ if(repair.getStatus().equals(RepairStatusEnum.TO_BE_CANCELED.status())){
|
|
payAmount = priceListService.getRobAmountByRepairId(repair.getRepairId());
|
|
payAmount = priceListService.getRobAmountByRepairId(repair.getRepairId());
|
|
}else {
|
|
}else {
|
|
payAmount = priceListService.getAmountByRepairId(repair.getRepairId());
|
|
payAmount = priceListService.getAmountByRepairId(repair.getRepairId());
|
|
@@ -250,7 +252,7 @@ public class RepairSaleService {
|
|
repairPay.setOrderType(0);
|
|
repairPay.setOrderType(0);
|
|
repairPay.setOrderSn("se_s"+DateUtil.getDate(DateUtil.repairIdFmt));
|
|
repairPay.setOrderSn("se_s"+DateUtil.getDate(DateUtil.repairIdFmt));
|
|
repairPayService.save(repairPay);
|
|
repairPayService.save(repairPay);
|
|
- repairLogService.saveBySysUser(userId,param.getRepairId(),10,"付款登记");
|
|
|
|
|
|
+ repairLogService.saveBySysUser(userId,param.getRepairId(),RepairStatusEnum.TO_BE_RECOVERED.status(), "付款登记");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -262,11 +264,11 @@ public class RepairSaleService {
|
|
if(repair == null){
|
|
if(repair == null){
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
}
|
|
}
|
|
- if(repair.getStatus() !=10){
|
|
|
|
|
|
+ if(!repair.getStatus().equals(RepairStatusEnum.TO_BE_SHIPPED.status())){
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
}
|
|
}
|
|
customerAddressService.setTrackingNumByRepairId(repair.getRepairId(),param.getGetType(),param.getTrackingNum());
|
|
customerAddressService.setTrackingNumByRepairId(repair.getRepairId(),param.getGetType(),param.getTrackingNum());
|
|
- repairLogService.saveBySysUser(userId,param.getRepairId(),11,"发货登记");
|
|
|
|
|
|
+ repairLogService.saveBySysUser(userId,param.getRepairId(),RepairStatusEnum.OVER_SHIPPED.status(),"发货登记");
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|