From 8b109f923dc7c2d5c5bd351a03a5277670962aac Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 04 十二月 2023 13:05:04 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/crm/manager/controller/PlanUrlController.java | 253 +++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 205 insertions(+), 48 deletions(-)
diff --git a/src/main/java/com/zy/crm/manager/controller/PlanUrlController.java b/src/main/java/com/zy/crm/manager/controller/PlanUrlController.java
index 714ce88..3c964d5 100644
--- a/src/main/java/com/zy/crm/manager/controller/PlanUrlController.java
+++ b/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,209 @@
@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,@RequestParam("planIdI") String planIdI){
+ List<FileSaveExampleUtil.FileDTO> fileDTOS = new ArrayList<>();
+ if (Cools.isEmpty(planId)){
+ return R.ok(fileDTOS);
+ }
+ Long id = Long.parseLong(planId);
+ Long idPlanIdI = Long.parseLong(planIdI);
+ Plan plan = planService.selectById(idPlanIdI);
+ PlanType planType = planTypeService.selectById(plan.getPlanType());
+ if (plan.getAssistantHostSign()==1){
+ planType.setType(1);
+ }
+// 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;
+ }
+ if (plan.getAssistantHostSign()==1){
+ planType.setType(1);
+ }
+ 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,@RequestParam("planIdI") String planIdI){
+ List<FileSaveExampleUtil.FileDTO> fileDTOS = new ArrayList<>();
+ if (Cools.isEmpty(planId)){
+ return R.ok(fileDTOS);
+ }
+ Long id = Long.parseLong(planId);
+ Long idPlanIdI = Long.parseLong(planIdI);
+ int planType =0;
+ Plan plan = planService.selectById(idPlanIdI);
+ if (plan.getAssistantHostSign()==1){
+ planType=1;
+ }else {
+ 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;
+ }
+ if (plan.getAssistantHostSign()==1){
+ planType.setType(1);
+ }
+ 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;
+ }
+ if (plan.getAssistantHostSign()==1){
+ planType.setType(1);
+ }
+ 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 +336,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();
- }
- }
}
--
Gitblit v1.9.1