File was renamed from rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ErpApiServiceImpl.java |
| | |
| | | import com.vincent.rsf.server.manager.service.PurchaseItemService; |
| | | import com.vincent.rsf.server.manager.service.PurchaseService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.api.controller.params.Order; |
| | | import com.vincent.rsf.server.api.controller.params.OrderParams; |
| | | import com.vincent.rsf.server.system.entity.Fields; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import com.vincent.rsf.server.api.service.ErpApiService; |
| | | import com.vincent.rsf.server.api.service.ReceiveMsgService; |
| | | import com.vincent.rsf.server.manager.entity.Purchase; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service("erpApiService") |
| | | public class ErpApiServiceImpl implements ErpApiService { |
| | | public class ReceiveMsgServiceImpl implements ReceiveMsgService { |
| | | |
| | | @Autowired |
| | | private PurchaseService purchaseService; |
| | | @Autowired |
| | | private PurchaseItemService purchaseItemService; |
| | | |
| | | @Autowired |
| | | private AsnOrderService asnOrderService; |
| | | |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | @Autowired |
| | |
| | | private RemotesInfoProperties remotesInfoProperties; |
| | | @Autowired |
| | | private RemotesInfoProperties.ApiInfo apiInfo; |
| | | @Autowired |
| | | private FieldsService fieldsService; |
| | | @Autowired |
| | | private FieldsItemService fieldsItemService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean syncPurchasee(List<Order> orders) { |
| | | public boolean syncPurchasee(List<OrderParams> orders) { |
| | | if (orders.isEmpty()) { |
| | | throw new CoolException("单据内容不能为空!!"); |
| | | } |
| | |
| | | if (!purchaseService.save(purchase)) { |
| | | throw new CoolException("采购单据保存失败"); |
| | | } |
| | | |
| | | //查询扩展字段是否存在 |
| | | List<Fields> fields = fieldsService.list(new LambdaQueryWrapper<Fields>().eq(Fields::getStatus, 1).eq(Fields::getFlagEnable, 1)); |
| | | |
| | | //判断子列表不为空 |
| | | if (!ors.getChildren().isEmpty()) { |
| | | ArrayList<PurchaseItem> list = new ArrayList<>(); |
| | | ors.getChildren().forEach(orderItem -> { |
| | | PurchaseItem item = new PurchaseItem(); |
| | | BeanUtils.copyProperties(orderItem, item); |
| | | // if (!fields.isEmpty()) { |
| | | // List<String> fieldValue = fields.stream().map(Fields::getFields).collect(Collectors.toList()); |
| | | // fieldValue.forEach(value -> { |
| | | // |
| | | // }); |
| | | // } |
| | | item.setPurchaseId(purchase.getId()); |
| | | list.add(item); |
| | | }); |