|
|
@@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.usoftchina.inquiry.api.PublicProductApi;
|
|
|
+import com.usoftchina.saas.account.api.AccountApi;
|
|
|
+import com.usoftchina.saas.account.api.CompanyApi;
|
|
|
import com.usoftchina.saas.base.Result;
|
|
|
import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
|
|
|
import com.usoftchina.saas.commons.api.MaxnumberService;
|
|
|
@@ -18,21 +21,16 @@ import com.usoftchina.saas.commons.po.DataImportDetail;
|
|
|
import com.usoftchina.saas.commons.po.Operation;
|
|
|
import com.usoftchina.saas.commons.po.Status;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
-import com.usoftchina.saas.document.dto.ProductDTO;
|
|
|
-import com.usoftchina.saas.document.dto.ProductListDTO;
|
|
|
-import com.usoftchina.saas.document.dto.ProductReserveCostDTO;
|
|
|
-import com.usoftchina.saas.document.dto.ProductUploadDTO;
|
|
|
+import com.usoftchina.saas.document.dto.*;
|
|
|
import com.usoftchina.saas.document.entities.*;
|
|
|
-import com.usoftchina.saas.document.mapper.DataImportMapper;
|
|
|
-import com.usoftchina.saas.document.mapper.ProductDetailMapper;
|
|
|
-import com.usoftchina.saas.document.mapper.ProductMapper;
|
|
|
-import com.usoftchina.saas.document.mapper.WarehouseMapper;
|
|
|
+import com.usoftchina.saas.document.mapper.*;
|
|
|
import com.usoftchina.saas.document.service.*;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
import com.usoftchina.saas.page.PageRequest;
|
|
|
import com.usoftchina.saas.transfers.api.SendMessageApi;
|
|
|
import com.usoftchina.saas.transfers.dto.MessageInfo;
|
|
|
import com.usoftchina.saas.utils.CollectionUtils;
|
|
|
+import com.usoftchina.saas.utils.JsonUtils;
|
|
|
import com.usoftchina.saas.utils.ObjectUtils;
|
|
|
import com.usoftchina.saas.utils.RegexpUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -42,8 +40,6 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
-import static java.util.Arrays.asList;
|
|
|
-
|
|
|
@Service
|
|
|
public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Product> implements ProductService {
|
|
|
|
|
|
@@ -67,6 +63,14 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
private ProducttypeService producttypeService;
|
|
|
@Autowired
|
|
|
private SendMessageApi sendMessageApi;
|
|
|
+ @Autowired
|
|
|
+ private PublicProductApi publicProductApi;
|
|
|
+ @Autowired
|
|
|
+ private CompanyApi companyApi;
|
|
|
+ @Autowired
|
|
|
+ private AccountApi accountApi;
|
|
|
+ @Autowired
|
|
|
+ private ProductSalerMapper productSalerMapper;
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<ProductDTO> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO) {
|
|
|
@@ -762,12 +766,54 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
return getMapper().selectUploadProdByCompanyId(BaseContextHolder.getCompanyId());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新物料传输状态
|
|
|
+ * @param ids 物料ids
|
|
|
+ * @param status 状态: 待上传 已上传
|
|
|
+ */
|
|
|
@Override
|
|
|
public void updateB2BStatus(String ids, String status){
|
|
|
List<String> idsList = new ArrayList<String>(Arrays.asList(ids.split(",")));
|
|
|
getMapper().updateB2BStatus(idsList, status);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 产品库列表
|
|
|
+ * @param page
|
|
|
+ * @param listReqDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public PageInfo<ProdStorageDTO> getProdStorage(PageRequest page, ListReqDTO listReqDTO){
|
|
|
+ Long companyId = BaseContextHolder.getCompanyId();
|
|
|
+ Long userId = BaseContextHolder.getUserId();
|
|
|
+ PageHelper.startPage(page.getNumber(), page.getSize());
|
|
|
+ String condition = listReqDTO.getFinalCondition();
|
|
|
+ List<ProdStorageDTO> prodStorageDTOList = getMapper().getProdStorage(condition, companyId, userId);
|
|
|
+ PageInfo<ProdStorageDTO> pageInfo = new PageInfo<ProdStorageDTO>(prodStorageDTOList);
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 绑定/解绑 个人物料库
|
|
|
+ * @param productSalerDTO
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void createProdSaler(ProductSalerDTO productSalerDTO){
|
|
|
+ Long enUU = companyApi.getCompanyById(BaseContextHolder.getCompanyId()).getData().getUu();
|
|
|
+ Long userUU = accountApi.getAccountById(BaseContextHolder.getUserId()).getData().getUu();
|
|
|
+ ProductSalerUploadDTO productSalerUploadDTO = new ProductSalerUploadDTO(productSalerDTO.getProdId(), productSalerDTO.getProdCode(), enUU, userUU);
|
|
|
+ if (productSalerDTO.getOperate() == 0){
|
|
|
+ //解绑
|
|
|
+ publicProductApi.uploadProductSalerForCancel(JsonUtils.toJsonString(productSalerDTO));
|
|
|
+ productSalerMapper.unbind(productSalerDTO.getProdId(), BaseContextHolder.getUserId(), BaseContextHolder.getCompanyId());
|
|
|
+ }else if (productSalerDTO.getOperate() == 1){
|
|
|
+ //绑定
|
|
|
+ publicProductApi.updateProdSaler(JsonUtils.toJsonString(productSalerDTO));
|
|
|
+ productSalerMapper.bind(productSalerDTO.getProdId(), BaseContextHolder.getUserId(), BaseContextHolder.getCompanyId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private List<ProductReserveCostDTO> geReserveCost(ListReqDTO listReqDTO) {
|
|
|
Long companyId = BaseContextHolder.getCompanyId();
|
|
|
String condition = listReqDTO.getFinalCondition();
|