中扬CRM客户关系管理系统
#
LSH
2023-11-24 a57112aee7438f4f550d1dd5a1b93e2a28fb386c
#
9个文件已修改
337 ■■■■■ 已修改文件
src/main/java/com/zy/crm/manager/controller/PlanUrlController.java 235 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/entity/PlanUrl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/mapper/PlanUrlMapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/service/PlanUrlService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/service/impl/PlanUrlServiceImpl.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/PlanUrlMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/plan/plan.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/priOnline2/priOnline.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/priQuote/priQuote.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/controller/PlanUrlController.java
@@ -7,8 +7,8 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.crm.common.utils.FileSaveExampleUtil;
import com.zy.crm.manager.entity.PlanUrl;
import com.zy.crm.manager.service.PlanUrlService;
import com.zy.crm.manager.entity.*;
import com.zy.crm.manager.service.*;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
@@ -26,6 +26,191 @@
    @Autowired
    private PlanUrlService planUrlService;
    @Autowired
    private PlanService planService;
    @Autowired
    private PriOnline2Service priOnline2Service;
    @Autowired
    private PriQuoteService priQuoteService;
    @Autowired
    private PlanTypeService planTypeService;
    @Autowired
    private ProcessPermissionsService processPermissionsService;
    Integer PBN = 6;
    @RequestMapping(value = "/plan/url/view/file/auth")
    @ManagerAuth
    public R viewFile(@RequestParam("planId") String planId){
        List<FileSaveExampleUtil.FileDTO> fileDTOS = new ArrayList<>();
        if (Cools.isEmpty(planId)){
            return R.ok(fileDTOS);
        }
        Long id = Long.parseLong(planId);
        Plan plan = planService.selectById(id);
        PlanType planType = planTypeService.selectById(plan.getPlanType());
//        String savePath = "D:/crm/plan/file/"+id+"/"; // 指定保存文件的路径
        try{
            List<PlanUrl> planUrls = planUrlService.selectPlanUrlByPlanId(id,0,planType.getType(),0);
            for (PlanUrl planUrl : planUrls){
                FileSaveExampleUtil.FileDTO dto = new FileSaveExampleUtil.FileDTO(planUrl);
                fileDTOS.add(dto);
            }
//            List<FileSaveExampleUtil.FileDTO> fileDTOS = FileSaveExampleUtil.viewFileList(savePath);
            return R.ok(fileDTOS);
        }catch (Exception e){
            return R.error();
        }
    }
    @RequestMapping(value = "/plan/url/insert/file/auth")
    @ManagerAuth
    public R insertFile(@RequestParam("planId") String planId, @RequestParam("filename") String filename,
                        @RequestParam("filesize") Long filesize) {
        try {
            User user = getUser();
            String[] split = planId.split("-");
            Long id = Long.parseLong(split[1]);
            Long idPlan = Long.parseLong(split[2]);
            Plan plan = planService.selectById(idPlan);
            PlanType planType = planTypeService.selectById(plan.getPlanType());
            int status = 0;
            if (plan.getUserId().equals(getUserId())){
                status=1;
            }else {
                status=2;
            }
            String url = "http://zhongyang-ftpserver.oss-cn-hangzhou.aliyuncs.com/" + filename;
            PlanUrl planUrl = new PlanUrl(id, url, filename, filesize,user.getNickname(),user.getId(),1,planType.getType(),status);
            planUrlService.insert(planUrl);
            return R.ok();
        } catch (Exception e) {
            System.out.println(e);
            return R.error();
        }
    }
    @RequestMapping(value = "/pri/online/url/view/file/auth")
    @ManagerAuth
    public R viewFilePriOnline(@RequestParam("planId") String planId){
        List<FileSaveExampleUtil.FileDTO> fileDTOS = new ArrayList<>();
        if (Cools.isEmpty(planId)){
            return R.ok(fileDTOS);
        }
        Long id = Long.parseLong(planId);
        int planType =0;
        Plan plan = planService.selectById(id);
        if (!plan.getUserId().equals(getUserId())){
            List<ProcessPermissions> processPermissionsList = processPermissionsService.selectList(new EntityWrapper<ProcessPermissions>().eq("process_memo", 4).or().eq("process_memo", 5));//2:核价流程
            for (ProcessPermissions processPermissions:processPermissionsList){
                if (getUserId().equals(processPermissions.getUserId())){
                    planType=PBN-processPermissions.getProcessMemo();
                    break;
                }
            }
        }
//        String savePath = "D:/crm/plan/file/"+id+"/"; // 指定保存文件的路径
        try{
            List<PlanUrl> planUrls = planUrlService.selectPlanUrlByPlanId(id,0,planType,0);
            for (PlanUrl planUrl : planUrls){
                if (!plan.getUserId().equals(getUserId())){
                    if (planUrl.getType()==3){
                        continue;
                    }
                }
                FileSaveExampleUtil.FileDTO dto = new FileSaveExampleUtil.FileDTO(planUrl);
                fileDTOS.add(dto);
            }
//            List<FileSaveExampleUtil.FileDTO> fileDTOS = FileSaveExampleUtil.viewFileList(savePath);
            return R.ok(fileDTOS);
        }catch (Exception e){
            return R.error();
        }
    }
    @RequestMapping(value = "/pri/online/url/insert/file/auth")
    @ManagerAuth
    public R insertFilePriOnline(@RequestParam("planId") String planId, @RequestParam("filename") String filename,
                                 @RequestParam("filesize") Long filesize) {
        try {
            User user = getUser();
            String[] split = planId.split("-");
            Long id = Long.parseLong(split[1]);
            Long idPriOnline = Long.parseLong(split[2]);
            PriOnline2 priOnline2 = priOnline2Service.selectById(idPriOnline);
            Plan plan = planService.selectById(priOnline2.getItemId());
            PlanType planType = planTypeService.selectById(plan.getPlanType());
            int status = 0;
            if (plan.getUserId().equals(getUserId())){
                status=1;
            }else {
                status=2;
            }
            String url = "http://zhongyang-ftpserver.oss-cn-hangzhou.aliyuncs.com/" + filename;
            PlanUrl planUrl = new PlanUrl(id, url, filename, filesize,user.getNickname(),user.getId(),2,planType.getType(),status);
            planUrlService.insert(planUrl);
            return R.ok();
        } catch (Exception e) {
            System.out.println(e);
            return R.error();
        }
    }
    @RequestMapping(value = "/pri/quote/url/view/file/auth")
    @ManagerAuth
    public R viewFilePriQuote(@RequestParam("planId") String planId){
        List<FileSaveExampleUtil.FileDTO> fileDTOS = new ArrayList<>();
        if (Cools.isEmpty(planId)){
            return R.ok(fileDTOS);
        }
        Long id = Long.parseLong(planId);
//        String savePath = "D:/crm/plan/file/"+id+"/"; // 指定保存文件的路径
        try{
            List<PlanUrl> planUrls = planUrlService.selectPlanUrlByPlanId(id,0,0,0);
            for (PlanUrl planUrl : planUrls){
                FileSaveExampleUtil.FileDTO dto = new FileSaveExampleUtil.FileDTO(planUrl);
                fileDTOS.add(dto);
            }
//            List<FileSaveExampleUtil.FileDTO> fileDTOS = FileSaveExampleUtil.viewFileList(savePath);
            return R.ok(fileDTOS);
        }catch (Exception e){
            return R.error();
        }
    }
    @RequestMapping(value = "/pri/quote/url/insert/file/auth")
    @ManagerAuth
    public R insertFilePriQuote(@RequestParam("planId") String planId, @RequestParam("filename") String filename,
                                @RequestParam("filesize") Long filesize) {
        try {
            User user = getUser();
            String[] split = planId.split("-");
            Long id = Long.parseLong(split[1]);
            Long idPriQuote = Long.parseLong(split[2]);
            PriQuote priQuote = priQuoteService.selectById(idPriQuote);
            Plan plan = planService.selectById(priQuote.getItemId());
            PlanType planType = planTypeService.selectById(plan.getPlanType());
            int status = 0;
            if (plan.getUserId().equals(getUserId())){
                status=1;
            }else {
                status=2;
            }
            String url = "http://zhongyang-ftpserver.oss-cn-hangzhou.aliyuncs.com/" + filename;
            PlanUrl planUrl = new PlanUrl(id, url, filename, filesize,user.getNickname(),user.getId(),3,planType.getType(),status);
            planUrlService.insert(planUrl);
            return R.ok();
        } catch (Exception e) {
            System.out.println(e);
            return R.error();
        }
    }
//    @RequestMapping(value = "/planUrl/{id}/auth")
//    @ManagerAuth
@@ -133,51 +318,5 @@
//        planUrlService.selectPage(new Page<>(1, 30), wrapper).getRecords().forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getId()), item.getId())));
//        return R.ok().add(vos);
//    }
    @RequestMapping(value = "/plan/url/view/file/auth")
//    @ManagerAuth
    public R viewFile(@RequestParam("planId") String planId){
        List<FileSaveExampleUtil.FileDTO> fileDTOS = new ArrayList<>();
        if (Cools.isEmpty(planId)){
            return R.ok(fileDTOS);
        }
        Long id = Long.parseLong(planId);
//        String savePath = "D:/crm/plan/file/"+id+"/"; // 指定保存文件的路径
        try{
            List<PlanUrl> planUrls = planUrlService.selectPlanUrlByPlanId(id);
            for (PlanUrl planUrl : planUrls){
                FileSaveExampleUtil.FileDTO dto = new FileSaveExampleUtil.FileDTO(planUrl);
                fileDTOS.add(dto);
            }
//            List<FileSaveExampleUtil.FileDTO> fileDTOS = FileSaveExampleUtil.viewFileList(savePath);
            return R.ok(fileDTOS);
        }catch (Exception e){
            return R.error();
        }
    }
    @RequestMapping(value = "/plan/url/insert/file/auth")
//    @ManagerAuth
    public R insertFile(@RequestParam("planId") String planId, @RequestParam("filename") String filename,
                        @RequestParam("filesize") Long filesize,@RequestParam("token") String token) {
        try {
            String nickname = null;
            Long userId = null;
            if (!Cools.isEmpty(token)) {
                User user = getUser(token);
                nickname = user.getNickname();
                userId = user.getId();
            }
            String[] split = planId.split("-");
            Long id = Long.parseLong(split[1]);
            String url = "http://zhongyang-ftpserver.oss-cn-hangzhou.aliyuncs.com/" + filename;
            PlanUrl planUrl = new PlanUrl(id, url, filename, filesize,nickname,userId,0,0,0);
            planUrlService.insert(planUrl);
            return R.ok();
        } catch (Exception e) {
            System.out.println(e);
            return R.error();
        }
    }
}
src/main/java/com/zy/crm/manager/entity/PlanUrl.java
@@ -50,14 +50,14 @@
    @TableField("user_id")
    private Long userId;
    @ApiModelProperty(value= "分类")
    @ApiModelProperty(value= "分类 1:规划 2:核价 3:报价 4:其它")
    private Integer type;
    @ApiModelProperty(value= "隐藏")
    @ApiModelProperty(value= "隐藏  1:货架 2:集成 3:其它")
    @TableField("hide_url")
    private Integer hideUrl;
    @ApiModelProperty(value= "状态")
    @ApiModelProperty(value= "状态 1:业务 2:其它")
    private Integer status;
    public PlanUrl() {}
src/main/java/com/zy/crm/manager/mapper/PlanUrlMapper.java
@@ -12,8 +12,8 @@
@Repository
public interface PlanUrlMapper extends BaseMapper<PlanUrl> {
    List<Integer> selectPlanUrlIdByPlanId(@Param("planId") Long planId);
    List<Integer> selectPlanUrlIdByPlanId2(@Param("planId") Long planId,@Param("type") int type,@Param("hideUrl") int hideUrl);
    List<PlanUrl> selectPlanUrlByPlanId(@Param("planId") Long planId);
    List<PlanUrl> selectPlanUrlByPlanId2(@Param("planId") Long planId,@Param("type") int type,@Param("hideUrl") int hideUrl);
    List<Integer> selectPlanUrlIdByPlanId(@Param("planId") Long planId,@Param("type") int type,@Param("hideUrl") int hideUrl,@Param("status") int status);
    List<PlanUrl> selectPlanUrlByPlanId(@Param("planId") Long planId,@Param("type") int type,@Param("hideUrl") int hideUrl,@Param("status") int status);
}
src/main/java/com/zy/crm/manager/service/PlanUrlService.java
@@ -8,9 +8,7 @@
public interface PlanUrlService extends IService<PlanUrl> {
    List<Integer> selectPlanUrlIdByPlanId(Long planId);
    List<Integer> selectPlanUrlIdByPlanId(Long planId,int type,int hideUrl);
    List<PlanUrl> selectPlanUrlByPlanId(Long planId);
    List<PlanUrl> selectPlanUrlByPlanId(Long planId,int type,int hideUrl);
    List<Integer> selectPlanUrlIdByPlanId(Long planId,int type,int hideUrl,int status);
    List<PlanUrl> selectPlanUrlByPlanId(Long planId,int type,int hideUrl,int status);
}
src/main/java/com/zy/crm/manager/service/impl/PlanUrlServiceImpl.java
@@ -12,22 +12,13 @@
public class PlanUrlServiceImpl extends ServiceImpl<PlanUrlMapper, PlanUrl> implements PlanUrlService {
    @Override
    public List<Integer> selectPlanUrlIdByPlanId(Long planId) {
        return this.baseMapper.selectPlanUrlIdByPlanId(planId);
    }
    @Override
    public List<Integer> selectPlanUrlIdByPlanId(Long planId,int type,int hideUrl) {
        return this.baseMapper.selectPlanUrlIdByPlanId2(planId,type,hideUrl);
    public List<Integer> selectPlanUrlIdByPlanId(Long planId,int type,int hideUrl,int status) {
        return this.baseMapper.selectPlanUrlIdByPlanId(planId,type,hideUrl,status);
    }
    @Override
    public List<PlanUrl> selectPlanUrlByPlanId(Long planId) {
        return this.baseMapper.selectPlanUrlByPlanId(planId);
    }
    @Override
    public List<PlanUrl> selectPlanUrlByPlanId(Long planId,int type,int hideUrl) {
        return this.baseMapper.selectPlanUrlByPlanId2(planId,type,hideUrl);
    public List<PlanUrl> selectPlanUrlByPlanId(Long planId,int type,int hideUrl,int status) {
        return this.baseMapper.selectPlanUrlByPlanId(planId,type,hideUrl,status);
    }
}
src/main/resources/mapper/PlanUrlMapper.xml
@@ -21,28 +21,32 @@
        select id from man_plan_url
        where 1=1
        and plan_id=#{planId}
    </select>
    <select id="selectPlanUrlIdByPlanId2" resultType="java.lang.Integer">
        select id from man_plan_url
        where 1=1
        and plan_id=#{planId}
        and type = #{type}
        and hide_url = #{hideUrl}
        <if test="type != 0">
            and type=#{type}
        </if>
        <if test="hideUrl != 0">
            and hide_url=#{hideUrl}
        </if>
        <if test="status != 0">
            and status=#{status}
        </if>
        or (plan_id=#{planId} and hide_url=0 )
    </select>
    <select id="selectPlanUrlByPlanId" resultMap="BaseResultMap">
        select * from man_plan_url
        where 1=1
        and plan_id=#{planId}
    </select>
    <select id="selectPlanUrlByPlanId2" resultMap="BaseResultMap">
        select * from man_plan_url
        where 1=1
        and plan_id=#{planId}
        and type = #{type}
        and hide_url = #{hideUrl}
        <if test="type != 0">
            and type=#{type}
        </if>
        <if test="hideUrl != 0">
            and hide_url=#{hideUrl}
        </if>
        <if test="status != 0">
            and status=#{status}
        </if>
        or (plan_id=#{planId} and hide_url=0 )
    </select>
</mapper>
src/main/webapp/static/js/plan/plan.js
@@ -307,8 +307,7 @@
                data: {
                    'planId': $('.layui-layer-title').text(),
                    'filename': filename,
                    'filesize': file.size,
                    'token': token
                    'filesize': file.size
                },
                method: 'POST',
                success: function (res) {
@@ -639,12 +638,13 @@
                // 构建带参数的内容
                layer.open({
                    type: 1,
                    title: '上传文件-'+planIdSign,
                    title: '上传文件-'+planIdSign+'-'+data.id,
                    content: $('#myModal')
                });
                // 获取路径下的文件列表,使用 jQuery 的 ajax 方法
                $.ajax({
                    url: '/plan/url/view/file/auth',
                    headers: {'token': localStorage.getItem('token')},
                    data:{
                        planId:planIdSign
                    },
src/main/webapp/static/js/priOnline2/priOnline.js
@@ -330,13 +330,12 @@
            $("#upload-filename-id-" + file.lastModified).html(filename)
            let token = localStorage.getItem("token");
            $.ajax({
                url: baseUrl+"/plan/url/insert/file/auth",
                url: baseUrl+"/pri/online/url/insert/file/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {
                    'planId': $('.layui-layer-title').text(),
                    'filename': filename,
                    'filesize': file.size,
                    'token': token
                    'filesize': file.size
                },
                method: 'POST',
                success: function (res) {
@@ -618,12 +617,14 @@
                }
                layer.open({
                    type: 1,
                    title: '上传文件-'+planIdSign,
                    content: $('#myModal')
                    title: '上传文件-'+planIdSign+'-'+data.id,
                    content: $('#myModal'),
                });
                // 获取路径下的文件列表,使用 jQuery 的 ajax 方法
                $.ajax({
                    url: '/plan/url/view/file/auth',
                    url: '/pri/online/url/view/file/auth',
                    headers: {'token': localStorage.getItem('token')},
                    data:{
                        planId:planIdSign
                    },
src/main/webapp/static/js/priQuote/priQuote.js
@@ -214,13 +214,12 @@
            $("#upload-filename-id-" + file.lastModified).html(filename)
            let token = localStorage.getItem("token");
            $.ajax({
                url: baseUrl+"/plan/url/insert/file/auth",
                url: baseUrl+"/pri/quote/url/insert/file/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {
                    'planId': $('.layui-layer-title').text(),
                    'filename': filename,
                    'filesize': file.size,
                    'token': token
                    'filesize': file.size
                },
                method: 'POST',
                success: function (res) {
@@ -464,12 +463,13 @@
                console.log(data)
                layer.open({
                    type: 1,
                    title: '上传文件-'+data.itemId,
                    title: '上传文件-'+data.itemId+'-'+data.id,
                    content: $('#myModal')
                });
                // 获取路径下的文件列表,使用 jQuery 的 ajax 方法
                $.ajax({
                    url: '/plan/url/view/file/auth',
                    url: '/pri/quote/url/view/file/auth',
                    headers: {'token': localStorage.getItem('token')},
                    data:{
                        planId:data.itemId
                    },