中扬CRM客户关系管理系统
LSH
2023-08-11 b48383cfbab275b7b5c870549d11903908128a07
src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
@@ -13,9 +13,11 @@
import com.core.domain.KeyValueVo;
import com.zy.crm.common.web.BaseController;
import com.zy.crm.manager.entity.Item;
import com.zy.crm.manager.entity.Plan;
import com.zy.crm.manager.entity.PriQuote;
import com.zy.crm.manager.entity.PriQuoteBudget;
import com.zy.crm.manager.service.ItemService;
import com.zy.crm.manager.service.PlanService;
import com.zy.crm.manager.service.PriQuoteBudgetService;
import com.zy.crm.manager.service.PriQuoteService;
import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -37,7 +39,7 @@
    private PriQuoteService priQuoteService;
    @Autowired
    private ItemService itemService;
    private PlanService planService;
    @Autowired
    private PriQuoteBudgetService priQuoteBudgetService;
@@ -67,15 +69,33 @@
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
        Long deptId = getDeptId();
        boolean signUserId = false;
        boolean signDeptId = false;
        for (Map.Entry<String, Object> entry : map.entrySet()){
            if (entry.getKey().equals("dept_id")){
                signDeptId = true;
            }
        }
        for (Map.Entry<String, Object> entry : map.entrySet()){
            String val = String.valueOf(entry.getValue());
            if (val.contains(RANGE_TIME_LINK)){
                String[] dates = val.split(RANGE_TIME_LINK);
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
            } else if (entry.getKey().equals("dept_id")){
                if (!val.equals("19")){
                    wrapper.eq(entry.getKey(), val);
                }
            } else if (entry.getKey().equals("user_id") && !signDeptId){
                signUserId = true;
                wrapper.eq(entry.getKey(), val);
            } else {
                wrapper.like(entry.getKey(), val);
            }
        }
        if (!signUserId && !signDeptId){
            wrapper.eq("user_id", getUserId());
        }
    }
@@ -102,12 +122,12 @@
        priQuote.setUpdateTime(new Date());
        //业务员
        Item item = itemService.selectById(priQuote.getItemId());
        priQuote.setMemberId(item.getMember());
        Plan plan = planService.selectById(priQuote.getItemId());
        priQuote.setMemberId(plan.getUserId());
        //设置项目流程
        item.setStep(5);
        itemService.updateById(item);
        plan.setStep(5);
        planService.updateById(plan);
        priQuoteService.insert(priQuote);
        return R.ok();
@@ -137,8 +157,8 @@
        priQuote.setUpdateTime(new Date());
        //业务员
        Item item = itemService.selectById(priQuote.getItemId());
        priQuote.setMemberId(item.getMember());
        Plan plan = planService.selectById(priQuote.getItemId());
        priQuote.setMemberId(plan.getUserId());
        priQuoteService.insert(priQuote);
        return R.ok();