|
@@ -7,12 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.management.platform.entity.*;
|
|
|
import com.management.platform.entity.vo.DepartmentVO;
|
|
|
import com.management.platform.entity.vo.UserVO;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.CustomService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.management.platform.service.SysFunctionService;
|
|
|
import com.management.platform.service.WxCorpInfoService;
|
|
|
import com.management.platform.util.ExcelUtil;
|
|
@@ -26,6 +26,7 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
@@ -100,6 +101,9 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
@Resource
|
|
|
private CompanyDingdingMapper companyDingdingMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ApplicationContext applicationContext;
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg insertAndUpdate(Custom custom, HttpServletRequest request) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
@@ -999,6 +1003,58 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg delete(Custom custom) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ String ids1 = custom.getIds();
|
|
|
+ List<Integer> ids = new ArrayList<>();
|
|
|
+ if (!ids1.isEmpty()) {
|
|
|
+ for (String id : ids1.split(",")) {
|
|
|
+ ids.add(Integer.parseInt(id));
|
|
|
+ }
|
|
|
+ Integer contactsCount = contactsMapper.selectCount(new LambdaQueryWrapper<Contacts>()
|
|
|
+ .eq(Contacts::getIsDelete, 0)
|
|
|
+ .in(Contacts::getCustomId, ids));
|
|
|
+ if(null!=contactsCount&&contactsCount>0){
|
|
|
+ msg.setError("选中客户仍有关联联系人,无法删除");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ //任务
|
|
|
+ Integer taskCount = taskMapper.selectCount(new LambdaQueryWrapper<Task>()
|
|
|
+ .ne(Task::getStatus,2)
|
|
|
+ .eq(Task::getIsDelete,0)
|
|
|
+ .in(Task::getCustomId, ids));
|
|
|
+ if(null!=taskCount&&taskCount>0){
|
|
|
+ msg.setError("选中客户仍有任务,无法删除");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ //商机
|
|
|
+ Integer boCount = businessOpportunityMapper.selectCount(new LambdaQueryWrapper<BusinessOpportunity>()
|
|
|
+ .eq(BusinessOpportunity::getIsDelete,0)
|
|
|
+ .in(BusinessOpportunity::getCustomerId, ids)
|
|
|
+ );
|
|
|
+ if(null!=boCount&&boCount>0){
|
|
|
+ msg.setError("选中客户仍有商机,无法删除");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ //销售订单
|
|
|
+ Integer salesCount = salesOrderMapper.selectCount(new LambdaQueryWrapper<SalesOrder>()
|
|
|
+ .eq(SalesOrder::getIsDelete,0)
|
|
|
+ .in(SalesOrder::getCustomId, ids));
|
|
|
+ if(null!=salesCount&&salesCount>0){
|
|
|
+ msg.setError("选中客户仍有销售订单,无法删除");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ CustomService proxy = applicationContext.getBean(CustomService.class);
|
|
|
+ proxy.isDelete(ids);
|
|
|
+ msg.setMsg("操作成功");
|
|
|
+ } else {
|
|
|
+ msg.setError("请选择客户");
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private Custom setNull(Custom clue) {
|
|
|
if (clue.getPlate1() == "") {
|