|
|
@@ -2,6 +2,7 @@ package com.usoftchina.saas.purchase.service.impl;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.usoftchina.saas.commons.cache.ConfigsCache;
|
|
|
import com.usoftchina.saas.inquiry.api.InquiryApi;
|
|
|
import com.usoftchina.saas.inquiry.api.SearchApi;
|
|
|
import com.usoftchina.saas.inquiry.po.inquiry.*;
|
|
|
@@ -36,6 +37,8 @@ import com.usoftchina.saas.purchase.mapper.*;
|
|
|
import com.usoftchina.saas.purchase.po.*;
|
|
|
import com.usoftchina.saas.purchase.service.ProdInOutService;
|
|
|
import com.usoftchina.saas.purchase.service.PurchaseService;
|
|
|
+import com.usoftchina.saas.transfers.api.SendMessageApi;
|
|
|
+import com.usoftchina.saas.transfers.dto.MessageInfo;
|
|
|
import com.usoftchina.saas.utils.BeanMapper;
|
|
|
import com.usoftchina.saas.utils.CollectionUtils;
|
|
|
import com.usoftchina.saas.utils.JsonUtils;
|
|
|
@@ -84,6 +87,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
private CompanyApi companyApi;
|
|
|
@Autowired
|
|
|
private AccountApi accountApi;
|
|
|
+ @Autowired
|
|
|
+ private SendMessageApi sendMessageApi;
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(PurchaseServiceImpl.class);
|
|
|
|
|
|
@@ -189,6 +194,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
calcPurchase(pu_id);
|
|
|
//日志记录
|
|
|
messageLogService.save(baseDTO);
|
|
|
+
|
|
|
+ //上传至B2B
|
|
|
+ uploadB2B(pu_id);
|
|
|
+
|
|
|
return baseDTO;
|
|
|
}
|
|
|
//校验有来源的验收验退币别是否与源单据一致
|
|
|
@@ -233,6 +242,37 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
return baseDTO;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 上传至B2B
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ private void uploadB2B(Long id) {
|
|
|
+ Long userId = BaseContextHolder.getUserId();
|
|
|
+ Long companyId = BaseContextHolder.getCompanyId();
|
|
|
+ //是否启用B2B
|
|
|
+ boolean enable = ConfigsCache.current().enableB2B();
|
|
|
+ if (enable) {
|
|
|
+ //更新上传状态
|
|
|
+ updateB2BStatus(id, "待上传");
|
|
|
+ //生成消息
|
|
|
+ MessageInfo messageInfo = new MessageInfo(userId, BillCodeSeq.PURCHASE.name(), String.valueOf(id), companyId);
|
|
|
+ sendMessageApi.sendMsg(messageInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新采购案B2B上传状态
|
|
|
+ * @param id
|
|
|
+ * @param status
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void updateB2BStatus(Long id, String status){
|
|
|
+ Purchase purchase = new Purchase();
|
|
|
+ purchase.setId(id);
|
|
|
+ purchase.setB2bStatus(status);
|
|
|
+ getMapper().updateByPrimaryKeySelective(purchase);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|