|
|
@@ -1,24 +1,30 @@
|
|
|
package com.dk.mdm.service.mst;
|
|
|
|
|
|
import com.dk.common.infrastructure.annotaiton.Pagination;
|
|
|
+import com.dk.common.infrastructure.constant.Constant;
|
|
|
import com.dk.common.model.pojo.PageList;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
|
import com.dk.mdm.infrastructure.convert.mst.FollowPlanConvert;
|
|
|
+import com.dk.mdm.infrastructure.util.AuthUtils;
|
|
|
+import com.dk.mdm.mapper.mst.CustomerMapper;
|
|
|
+import com.dk.mdm.model.pojo.mst.Customer;
|
|
|
import com.dk.mdm.model.pojo.mst.FollowPlan;
|
|
|
import com.dk.mdm.mapper.mst.FollowPlanMapper;
|
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
-import com.dk.mdm.model.query.mst.DictionaryDataQuery;
|
|
|
import com.dk.mdm.model.query.mst.FollowPlanQuery;
|
|
|
-import com.dk.mdm.model.response.mst.DictionaryDataResponse;
|
|
|
import com.dk.mdm.model.response.mst.FollowPlanResponse;
|
|
|
-import com.dk.mdm.model.vo.mst.DictionaryDataVO;
|
|
|
import com.dk.mdm.model.vo.mst.FollowPlanVO;
|
|
|
+import com.dk.mdm.service.common.CommonService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class FollowPlanService extends BaseService<FollowPlan> {
|
|
|
@@ -35,6 +41,17 @@ public class FollowPlanService extends BaseService<FollowPlan> {
|
|
|
@Autowired
|
|
|
private FollowPlanConvert followPlanConvert;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CustomerService customerService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AuthUtils authUtils;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CustomerMapper customerMapper;
|
|
|
|
|
|
/**
|
|
|
* @desc : 条件查询
|
|
|
@@ -51,13 +68,34 @@ public class FollowPlanService extends BaseService<FollowPlan> {
|
|
|
/**
|
|
|
* @desc : 新建
|
|
|
* @author : 于继渤
|
|
|
- * @date : 2023/1/5 9:39
|
|
|
+ * @date : 2024/7/9 8:45
|
|
|
*/
|
|
|
@Transactional(
|
|
|
rollbackFor = {Exception.class}
|
|
|
)
|
|
|
public ResponseResultVO<?> insert(FollowPlanVO followPlanVO) {
|
|
|
FollowPlan followPlan = followPlanConvert.convertToPo(followPlanVO);
|
|
|
+ //设置ID
|
|
|
+ Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.FOLLOWPLAN.getName(), true);
|
|
|
+ followPlan.setPlanId(uniqueNoteCode.get("outId").toString());
|
|
|
+ //查询客户信息
|
|
|
+ Customer customer = customerMapper.selectById(new Customer().setCusId(followPlanVO.getCusId()));
|
|
|
+
|
|
|
+ Customer customerSave = new Customer();
|
|
|
+ if (Constant.saleCustomerStatusConstant.SALE_STATUS_INTE.getName().equals(followPlanVO.getSaleStatus())) {
|
|
|
+ customerSave.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_POTE.getName());
|
|
|
+ //当前客户部门是否为空
|
|
|
+ if (customer.getOrgId() == null) {
|
|
|
+ customerSave.setOrgId(authUtils.getStaff().getOrgId());
|
|
|
+ }
|
|
|
+ List<Long> wxUsers = new ArrayList<>();
|
|
|
+ List arrList = new ArrayList(wxUsers);
|
|
|
+ arrList.add(authUtils.getStaff().getStaffId());
|
|
|
+ customerSave.setFollowStaffs(arrList);
|
|
|
+ //更新客户信息
|
|
|
+ customerService.updateByUuid(customerSave);
|
|
|
+ }
|
|
|
+
|
|
|
followPlanMapper.insert(followPlan);
|
|
|
return ResponseResultUtil.success(followPlan);
|
|
|
}
|