|
|
@@ -2,6 +2,11 @@ package com.usoftchina.saas.sale.service.impl;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.usoftchina.inquiry.api.InquiryApi;
|
|
|
+import com.usoftchina.inquiry.po.IPage;
|
|
|
+import com.usoftchina.inquiry.po.InquiryEnRemind;
|
|
|
+import com.usoftchina.saas.account.api.AccountApi;
|
|
|
+import com.usoftchina.saas.account.api.CompanyApi;
|
|
|
import com.usoftchina.saas.base.Result;
|
|
|
import com.usoftchina.saas.commons.api.CommonService;
|
|
|
import com.usoftchina.saas.commons.api.MaxnumberService;
|
|
|
@@ -28,6 +33,7 @@ import com.usoftchina.saas.sale.service.SaleService;
|
|
|
import com.usoftchina.saas.storage.po.ProdIODetail;
|
|
|
import com.usoftchina.saas.storage.po.ProdInOut;
|
|
|
import com.usoftchina.saas.utils.BeanMapper;
|
|
|
+import com.usoftchina.saas.utils.CollectionUtils;
|
|
|
import com.usoftchina.saas.utils.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -63,6 +69,12 @@ public class SaleServiceImpl implements SaleService{
|
|
|
private CommonService commonService;
|
|
|
@Autowired
|
|
|
private PurchaseService purchaseService;
|
|
|
+ @Autowired
|
|
|
+ private InquiryApi inquiryApi;
|
|
|
+ @Autowired
|
|
|
+ private AccountApi accountApi;
|
|
|
+ @Autowired
|
|
|
+ private CompanyApi companyApi;
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<SaleList> getListData(@PageDefault(size = 10) PageRequest page, ListReqDTO req) {
|
|
|
@@ -650,6 +662,54 @@ public class SaleServiceImpl implements SaleService{
|
|
|
return baseDTO;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取企业商机
|
|
|
+ * @param enremindReqDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<EnremindRspDTO> getEnremind(EnremindReqDTO enremindReqDTO) {
|
|
|
+ /*Long userUU = accountApi.getAccountById(BaseContextHolder.getUserId()).getData().getUu();
|
|
|
+ if (userUU == null){
|
|
|
+ userUU = 0L;
|
|
|
+ }
|
|
|
+ Long enUU = companyApi.getCompanyById(BaseContextHolder.getCompanyId()).getData().getUu();
|
|
|
+ */
|
|
|
+ Long userUU = 1000002503L, enUU = 10041559L;
|
|
|
+ IPage<InquiryEnRemind> inquiryEnRemindIPage = inquiryApi.findEnRemind(userUU, enUU, enremindReqDTO.getPageNumber(),
|
|
|
+ enremindReqDTO.getPageSize(), enremindReqDTO.getEnableOffer(), enremindReqDTO.getKeyword(), enremindReqDTO.getQuoted());
|
|
|
+ List<InquiryEnRemind> inquiryEnRemindList = inquiryEnRemindIPage.getContent();
|
|
|
+ if (CollectionUtils.isEmpty(inquiryEnRemindList)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ List<EnremindRspDTO> enremindRspDTOList = convertToEnremindRspDTO(inquiryEnRemindList);
|
|
|
+ return enremindRspDTOList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将平台返回的结果集转成SAAS的传输对象
|
|
|
+ * @param inquiryEnRemindList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<EnremindRspDTO> convertToEnremindRspDTO(List<InquiryEnRemind> inquiryEnRemindList) {
|
|
|
+ List<EnremindRspDTO> enremindRspDTOList = new ArrayList<EnremindRspDTO>();
|
|
|
+ EnremindRspDTO enremindRspDTO = null;
|
|
|
+ for (InquiryEnRemind inquiryEnRemind : inquiryEnRemindList){
|
|
|
+ enremindRspDTO = new EnremindRspDTO();
|
|
|
+ enremindRspDTO.setCustName(inquiryEnRemind.getEnName());
|
|
|
+ enremindRspDTO.setProdBrand(inquiryEnRemind.getInbrand());
|
|
|
+ enremindRspDTO.setProdName(inquiryEnRemind.getProdTitle());
|
|
|
+ enremindRspDTO.setProdOrispeccode(inquiryEnRemind.getCmpCode());
|
|
|
+ enremindRspDTO.setProdSpec(inquiryEnRemind.getSpec());
|
|
|
+ //enremindRspDTO.setProdUnit(inquiryEnRemind.get);
|
|
|
+ enremindRspDTO.setNeedQty(inquiryEnRemind.getNeedQty());
|
|
|
+ enremindRspDTO.setStartDate(inquiryEnRemind.getReDate());
|
|
|
+ enremindRspDTO.setEndDate(inquiryEnRemind.getEndDate());
|
|
|
+ enremindRspDTOList.add(enremindRspDTO);
|
|
|
+ }
|
|
|
+ return enremindRspDTOList;
|
|
|
+ }
|
|
|
+
|
|
|
//更新最新销售总额
|
|
|
private void updateTotal(Long id) {
|
|
|
if (null == id) {
|