Browse Source

1.皮阿诺数据处理逻辑优化 判断包件,不是判断订单

test
zhenghaoyu 2 years ago
parent
commit
b89ac952b4
  1. 3
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageInfo.java
  2. 23
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java
  3. 29
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

3
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageInfo.java

@ -66,4 +66,7 @@ public class PanPackageInfo extends BaseEntity {
@ApiModelProperty(value = "直发标识")
private String directSignage;
@ApiModelProperty(value = "是否补发")
private Integer reissueStatus;
}

23
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java

@ -22,6 +22,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.factory.comfac.service.IAsyncDataService;
import com.logpm.factory.comfac.service.IOrderStatusLogService;
import com.logpm.factory.pan.dto.PanFactoryOrderDTO;
import com.logpm.factory.pan.dto.PanPackageInfoDTO;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.factory.pan.service.IPanFactoryOrderService;
import com.logpm.factory.pan.service.IPanPackageInfoService;
@ -29,6 +30,7 @@ import com.logpm.factory.pan.service.IPanPackageListService;
import com.logpm.factory.snm.bean.Resp;
import com.logpm.factory.snm.entity.OrderStatusLog;
import com.logpm.factory.snm.entity.PanFactoryOrder;
import com.logpm.factory.snm.entity.PanPackageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -39,6 +41,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Objects;
/**
@ -116,8 +119,24 @@ public class PanFactoryDataController extends BladeController {
queryWrapper.eq("order_no",orderNo);
PanFactoryOrder one = factoryOrderService.getOne(queryWrapper);
if(!Objects.isNull(one)){
log.warn("############data: 订单数据已存在 orderNo={}",orderNo);
return Resp.fail(400,"订单数据已存在");
// log.warn("############data: 订单数据已存在 orderNo={}",orderNo);
// return Resp.fail(400,"订单数据已存在");
//如果订单已存在就去验证订单下面的包件信息
List<PanPackageInfoDTO> order_attributes = factoryOrderDTO.getORDER_ATTRIBUTES();
QueryWrapper<PanPackageInfo> qw = new QueryWrapper<>();
qw.eq("order_no",orderNo);
List<PanPackageInfo> list = packageInfoService.list(qw);
for(PanPackageInfo panPackageInfo:list){
String unitNo = panPackageInfo.getUnitNo();
for(int i = 0; i<order_attributes.size(); i++){
String newUnitNo = order_attributes.get(i).getUnitNo();
if(unitNo.equals(newUnitNo)){
order_attributes.remove(i);
break;
}
}
}
factoryOrderDTO.setORDER_ATTRIBUTES(order_attributes);
}
try{

29
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

@ -370,10 +370,25 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
@Transactional
@Override
public void saveData(PanFactoryOrderDTO factoryOrderDTO) {
PanFactoryOrder factoryOrder = new PanFactoryOrder();
BeanUtil.copyProperties(factoryOrderDTO,factoryOrder);
//保存订单数据
factoryOrderService.save(factoryOrder);
QueryWrapper<PanFactoryOrder> qw = new QueryWrapper<>();
qw.eq("order_no",factoryOrderDTO.getOrderNo());
//先查询订单是否存在
PanFactoryOrder factoryOrder = factoryOrderService.getOne(qw);
boolean flag = false;
if(Objects.isNull(factoryOrder)){
factoryOrder = new PanFactoryOrder();
BeanUtil.copyProperties(factoryOrderDTO,factoryOrder);
//保存订单数据
factoryOrderService.save(factoryOrder);
}else{
flag = true;
}
// PanFactoryOrder factoryOrder = new PanFactoryOrder();
// BeanUtil.copyProperties(factoryOrderDTO,factoryOrder);
// //保存订单数据
// factoryOrderService.save(factoryOrder);
List<PanPackageInfoDTO> packageInfos = factoryOrderDTO.getORDER_ATTRIBUTES();
List<PanPackageInfo> panPackageInfos = new ArrayList<>();
@ -383,7 +398,13 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
PanPackageInfo packageInfo = new PanPackageInfo();
BeanUtil.copyProperties(dto,packageInfo);
packageInfo.setOrderId(factoryOrder.getId());
if(flag){
packageInfo.setReissueStatus(1);
}else{
packageInfo.setReissueStatus(0);
}
panPackageInfos.add(packageInfo);
//保存包件信息数据
//因为需要先保存包件明细需要包件的id
// packageInfoService.save(packageInfo);

Loading…
Cancel
Save