中扬CRM客户关系管理系统
#
LSH
2023-11-17 470ae430433a79c68e115fdc94fc16291f034749
src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java
@@ -57,6 +57,9 @@
    @Autowired
    private UserService userService;
    @Autowired
    private PriOnline2FollService priOnline2FollService;
    String PZH = " ———————————————————————————————————————————————————————————————————————————————— ";
    @RequestMapping(value = "/priOnline2/{id}/auth")
@@ -86,12 +89,22 @@
                  @RequestParam(defaultValue = "10") Integer limit,
                  @RequestParam(required = false) String orderByField,
                  @RequestParam(required = false) String orderByType,
                  @RequestParam(required = false) String allSwitch,
                  @RequestParam(required = false) String condition,
                  @RequestParam Map<String, Object> param) {
                  @RequestParam Map<String, Object> paramSou) {
        EntityWrapper<PriOnline2> wrapper = new EntityWrapper<>();
        wrapper.setSqlSelect("id,title,create_time as createTime,assistant_plan_id as assistantPlanId,host_plan_id as hostPlanId,assistant_host_sign as assistantHostSign,filepath,settle,settle_size as settleSize,item_id as itemId,order_num as orderNum,template_name as templateName,user_id as userId,dept_id as deptId,status,update_time as updateTime,check_data as checkData,update_user_id as updateUserId,member_id as memberId");
//        wrapper.in("member_id", getUserRoleBelongsToUserId("allopen"));
        excludeTrash(param);
        excludeTrash(paramSou);
        Map<String, Object> param = convertallSwitch(paramSou);
        if (!Cools.isEmpty(allSwitch)){
            List<PriOnline2> priOnline2List = priOnline2Service.listByAll(getUserId());
            Page<PriOnline2> page1 = new Page<PriOnline2>(curr, limit).setRecords(priOnline2List);
            page1.setTotal(priOnline2Service.listByAllTotal(getUserId()));
            return R.ok(page1);
        }
        convert(param, wrapper);
        allLike(PriOnline2.class, param.keySet(), wrapper, condition);
        wrapper.or().eq("member_id", getUserId());
@@ -101,6 +114,14 @@
        return R.ok(priOnline2Service.selectPage(new Page<>(curr, limit), wrapper));
    }
    private Map<String, Object>  convertallSwitch(Map<String, Object> map) {
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            if (entry.getKey().equals("allSwitch")) {
                map.remove("allSwitch");
            }
        }
        return map;
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) {
        boolean signUserId = false;
        boolean signDeptId = false;
@@ -225,7 +246,10 @@
        User userUp = userService.selectById(plan.getUserId());
        priOnline2.setAssistantHostSign(plan.getAssistantHostSign());
        priOnline2.setAssistantPlanId(plan.getAssistantPlanId());
        priOnline2.setHostPlanId(plan.getHostPlanId());
        priOnline2.setHostPlanId(plan.getId());
        if (plan.getAssistantHostSign()==1){
            priOnline2.setHostPlanId(plan.getHostPlanId());
        }
        //业务员
@@ -283,6 +307,19 @@
        planService.updateById(plan);
        priOnline2Service.insert(priOnline2);
        // 自动添加跟进人
        for (User user:users){
            List<PriOnline2Foll> priOnline2Folls = priOnline2FollService.selectList(new EntityWrapper<PriOnline2Foll>().eq("pri_online2_id", priOnline2.getId()).eq("user_id", user.getId()));
            if (Cools.isEmpty(priOnline2Folls) || priOnline2Folls.size()==0){
                PriOnline2Foll priOnline2Foll = new PriOnline2Foll();
                priOnline2Foll.setPriOnline2Id(priOnline2.getId());
                priOnline2Foll.setUserId(user.getId());
                if (!priOnline2FollService.insert(priOnline2Foll)) {
                    throw new CoolException("保存失败,请重试");
                }
            }
        }
        if (plan.getAssistantHostSign()==1){
@@ -716,8 +753,8 @@
    @ManagerAuth
    public R priOnline2priQuoteAdd(@RequestParam Long planId) {
        List<KeyValueVo> vos = new ArrayList<>();
        vos.add(new KeyValueVo("报价模板1", 1L));
        vos.add(new KeyValueVo("报价模板2", 2L));
        vos.add(new KeyValueVo("货架模板", 1L));
        vos.add(new KeyValueVo("集成模板", 2L));
        return R.ok().add(vos);
    }