|
|
@@ -588,19 +588,11 @@ public class InquiryForSaleServiceImpl implements InquiryForSaleService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ModelMap allotEnRemind(Long userUU, Long enRemindId, Long itemId) {
|
|
|
- if (StringUtils.isEmpty(userUU) && (StringUtils.isEmpty(enRemindId) || StringUtils.isEmpty(itemId))) {
|
|
|
+ public ModelMap allotEnRemind(Long userUU, Long enRemindId) {
|
|
|
+ if (StringUtils.isEmpty(userUU) && StringUtils.isEmpty(enRemindId)) {
|
|
|
throw new IllegalAccessError("缺少参数");
|
|
|
}
|
|
|
ModelMap result = new ModelMap();
|
|
|
- // 从公共询价列表直接分配到个人
|
|
|
- if (!StringUtils.isEmpty(enRemindId) && StringUtils.isEmpty(itemId)) {
|
|
|
- PurcInquiryItem purcInquiryItem = purcInquiryItemDao.findOne(itemId);
|
|
|
- if (!StringUtils.isEmpty(purcInquiryItem)) {
|
|
|
- InquiryEnRemind inquiryEnRemind = new InquiryEnRemind();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// 从公司商机分配到个人
|
|
|
InquiryEnRemind inquiryEnRemind = inquiryEnRemindDao.findOne(enRemindId);
|
|
|
if (!StringUtils.isEmpty(inquiryEnRemind)) {
|
|
|
@@ -610,10 +602,81 @@ public class InquiryForSaleServiceImpl implements InquiryForSaleService {
|
|
|
inquiryEnRemind.setRemindStatus(1);
|
|
|
inquiryEnRemindDao.save(inquiryEnRemind);
|
|
|
result.put("success", true);
|
|
|
+ } else {
|
|
|
+ result.put("success", false);
|
|
|
+ result.put("message", "企业商机不存在");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ModelMap allotInquiry(Long userUU, Long enUU, Long itemId) {
|
|
|
+ if (StringUtils.isEmpty(userUU) && StringUtils.isEmpty(enUU) && StringUtils.isEmpty(itemId)) {
|
|
|
+ throw new IllegalAccessError("缺少参数");
|
|
|
+ }
|
|
|
+ ModelMap result = new ModelMap();
|
|
|
+ // 判断当前商机是否在企业商机
|
|
|
+ InquiryEnRemind oldEnRemind = inquiryEnRemindDao.findByItemIdAndEnUU(itemId, enUU);
|
|
|
+ if (StringUtils.isEmpty(oldEnRemind)) { // 不存在
|
|
|
+ PurcInquiryItem item = purcInquiryItemDao.findOne(itemId);
|
|
|
+ Enterprise enterprise = enterpriseDao.findOne(enUU);
|
|
|
+ InquiryEnRemind enRemind = itemConvertEnRemind(item);
|
|
|
+ enRemind.setEnName(enterprise.getEnName());
|
|
|
+ enRemind.setVendUU(enUU);
|
|
|
+ enRemind.setRemindStatus(1);
|
|
|
+ inquiryEnRemindDao.save(enRemind);
|
|
|
+ // 再分配给个人
|
|
|
+ InquiryRemind remind = enRemindConvertRemind(enRemind);
|
|
|
+ remind.setVendUserUU(userUU);
|
|
|
+ remindDao.save(remind);
|
|
|
+ result.put("success", true);
|
|
|
+ } else { // 存在
|
|
|
+ // 判断个人商机是否存在
|
|
|
+ List<InquiryRemind> oldRemind = remindDao.findByVendUserUUAndVendUUAndItemId(userUU, enUU, itemId);
|
|
|
+ if (CollectionUtils.isEmpty(oldRemind)) {
|
|
|
+ InquiryRemind remind = enRemindConvertRemind(oldEnRemind);
|
|
|
+ oldEnRemind.setRemindStatus(1);
|
|
|
+ inquiryEnRemindDao.save(oldEnRemind);
|
|
|
+ remind.setVendUserUU(userUU);
|
|
|
+ remindDao.save(remind);
|
|
|
+ result.put("success", true);
|
|
|
+ } else {
|
|
|
+ result.put("success", false);
|
|
|
+ result.put("message", "已存在当前用户的个人商机中");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private InquiryEnRemind itemConvertEnRemind(PurcInquiryItem item) {
|
|
|
+ InquiryEnRemind remind = new InquiryEnRemind();
|
|
|
+ //remind.setEnName(enterprise.getEnName());
|
|
|
+ remind.setEnUU(item.getInquiry().getEnUU());
|
|
|
+ remind.setUserName(item.getUserName());
|
|
|
+ remind.setUserTel(item.getUserTel());
|
|
|
+ remind.setCode(item.getInquiry().getCode());
|
|
|
+ remind.setBrand(item.getInbrand());
|
|
|
+ remind.setInbrand(item.getInbrand());
|
|
|
+ remind.setCmpCode(item.getCmpCode());
|
|
|
+ remind.setSpec(item.getSpec());
|
|
|
+ remind.setProdTitle(item.getProdTitle());
|
|
|
+ remind.setInid(item.getInquiry().getId());
|
|
|
+ if (item.getProduct() != null) {
|
|
|
+ remind.setBrand(item.getProduct().getBrand());
|
|
|
+ remind.setCmpCode(item.getProduct().getCmpCode());
|
|
|
+ remind.setSpec(item.getProduct().getSpec());
|
|
|
+ remind.setProdTitle(item.getProduct().getTitle());
|
|
|
+ }
|
|
|
+ remind.setItemId(item.getId());
|
|
|
+ remind.setNeedQty(item.getNeedquantity());
|
|
|
+ remind.setReDate(item.getInquiry().getDate());
|
|
|
+ remind.setEndDate(item.getInquiry().getEndDate());
|
|
|
+ //remind.setVendUU(u.getEnuu());
|
|
|
+ remind.setDate(new Date(System.currentTimeMillis()));
|
|
|
+ remind.setStatus(Status.INPUTTING.value());
|
|
|
+ return remind;
|
|
|
+ }
|
|
|
+
|
|
|
private InquiryRemind enRemindConvertRemind(InquiryEnRemind inquiryEnRemind) {
|
|
|
InquiryRemind remind = new InquiryRemind();
|
|
|
remind.setEnName(inquiryEnRemind.getEnName());
|