中扬CRM客户关系管理系统
#
LSH
2023-11-07 609591f8e300dda2bde32aa3c3990e540afcdb3c
src/main/java/com/zy/crm/manager/controller/PlanController.java
@@ -59,6 +59,7 @@
    private ProcessPermissionsService processPermissionsService;
    String PZH=" ————————————————— ";
    Integer PBN = 6;
    @GetMapping(value = "/plan/{id}/auth")
@@ -256,31 +257,23 @@
    @RequestMapping(value = "/plan/insert/file/auth")
//    @ManagerAuth
    public R insertFile(@RequestParam("planId") String planId,@RequestParam MultipartFile file){
        try{
            InputStream inputStream = file.getInputStream();
            // 获取文件的内容类型
            String contentType = file.getContentType();
            String suffix = getFileSuffix(file.getOriginalFilename());
            String url = ossService.upload(inputStream, suffix,contentType);
//            String url = "http://tjdt.oss-cn-hangzhou.aliyuncs.com/"+file.getOriginalFilename();
            String[] names = url.split("com/");
            String name= names[1];
    public R insertFile(@RequestParam("planId") String planId, @RequestParam("filename") String filename, @RequestParam("filesize") Long filesize) {
        try {
//            InputStream inputStream = file.getInputStream();
//            // 获取文件的内容类型
//            String contentType = file.getContentType();
//            String url = ossService.upload(inputStream, file.getOriginalFilename(), contentType);
////            String url = "http://tjdt.oss-cn-hangzhou.aliyuncs.com/"+file.getOriginalFilename();
//            String[] names = url.split("com/");
//            String name= names[1];
            String[] split = planId.split("-");
            int id = Integer.parseInt(split[1]);
            planService.increasePlanUrl(id,url,name,file.getSize());
            /*String[] split = planId.split("-");
            int id = Integer.parseInt(split[1]);
            System.out.println("---开始---");
            String savePath = "D:/crm/plan/file/"+id+"/"; // 指定保存文件的路径
            try{
                FileSaveExampleUtil.saveFile(file, savePath);
            }catch (Exception e){
                return R.error();
            }*/
            String url = "http://zhongyang-ftpserver.oss-cn-hangzhou.aliyuncs.com/" + filename;
            planService.increasePlanUrl(id, url, filename, filesize);
            return R.ok();
        }catch (Exception e){
        } catch (Exception e) {
            System.out.println(e);
            return R.error();
        }
@@ -640,6 +633,11 @@
        List<User> users = userService.selectList(new EntityWrapper<User>().eq("dept_id", planLeader.getDeptId()));
        List<KeyValueVo> vos = new ArrayList<>();
        users.forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getNickname()), item.getId())));
        if (planType.getType().equals(2)){
            ProcessPermissions processPermissions= processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 101).eq("process", "1-1"));//2:核价流程
            User manager = userService.selectById(processPermissions.getUserId());       // 获取核价流程节点1确认人
            vos.add(new KeyValueVo(String.valueOf(manager.getNickname()), manager.getId()));
        }
        return R.ok().add(vos);
    }
@@ -691,30 +689,20 @@
        wrapper.like("name", condition);
        wrapper.eq("status",1);
        ProcessPermissions processPermissions1 = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5).eq("process", "1-1"));//2:核价流程
        User manager1 = userService.selectById(processPermissions1.getUserId());       // 获取核价流程节点1确认人
        ProcessPermissions processPermissions2 = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5).eq("process", "1-2"));//2:核价流程
        User manager2 = userService.selectById(processPermissions2.getUserId());       // 获取核价流程节点1确认人
        ProcessPermissions processPermissions3= processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5).eq("process", "1-3"));//2:核价流程
        User manager3 = userService.selectById(processPermissions3.getUserId());       // 获取核价流程节点1确认人
        List<ProcessPermissions> processPermissionsList = processPermissionsService.selectList(new EntityWrapper<ProcessPermissions>().eq("process_memo", 4).or().eq("process_memo", 5));//2:核价流程
        int type =0;
        if (getUserId().equals(manager1.getId())){
            type=1;//(货架)
        }else if (getUserId().equals(manager2.getId()) || getUserId().equals(manager3.getId())){
            type = 2;//(集成)
        }else {
        for (ProcessPermissions processPermissions:processPermissionsList){
            if (getUserId().equals(processPermissions.getUserId())){
                type=PBN-processPermissions.getProcessMemo();
                break;
            }
        }
        if (type==0){
            return R.error("你不是核价员,无权接任务");
        }
        List<Long> typeList = new ArrayList<>();
        List<PlanType> planTypes = planTypeService.selectList(new EntityWrapper<PlanType>().eq("type", type));
        if (type==1){
            planTypes = planTypeService.selectList(new EntityWrapper<PlanType>());
        }
        if (Cools.isEmpty(planTypes) || planTypes.size()==0){
            return R.ok();
        }