From 8c3eb7ab9c2e33bdec416592b7eca417ca2b1d9f Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Fri, 19 Mar 2021 16:02:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=A1=88=E4=BE=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/SysCustomerCaseController.java | 14 ++++++ .../custom/WxCustomerCaseController.java | 42 ++++++++--------- .../stdiet/custom/domain/SysCustomerCase.java | 4 +- .../dto/response/CustomerCaseResponse.java | 4 +- .../custom/mapper/SysCustomerCaseMapper.java | 17 +++++++ .../service/ISysCustomerCaseService.java | 16 +++++++ .../impl/SysCustomerCaseServiceImpl.java | 23 +++++++++ .../mapper/custom/SysCustomerCaseMapper.xml | 36 ++++++++++++-- stdiet-ui/src/api/custom/customerCase.js | 9 ++++ .../src/views/custom/customerCase/index.vue | 47 ++++++++++++++++++- 10 files changed, 185 insertions(+), 27 deletions(-) diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java index 38ff8e102..099d0afa9 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java @@ -141,6 +141,20 @@ public class SysCustomerCaseController extends BaseController return getDataTable(list); } + /** + * 修改客户案例是否微信展示状态 + */ + //@PreAuthorize("@ss.hasPermi('custom:customerCase:wxShow')") + @Log(title = "微信展示状态修改", businessType = BusinessType.UPDATE) + @PostMapping("/updateWxShow") + public AjaxResult updateWxShow(@RequestBody SysCustomerCase sysCustomerCase) + { + if(sysCustomerCase.getWxShow() == null || sysCustomerCase.getIds() == null || sysCustomerCase.getIds().length == 0){ + return AjaxResult.error(); + } + return toAjax(sysCustomerCaseService.updateWxShowByIds(sysCustomerCase.getWxShow() ? 1 : 0, sysCustomerCase.getIds())); + } + // 转移到SysFileUploadController.java // /** // * 上传文件到OSS返回URL diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WxCustomerCaseController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WxCustomerCaseController.java index dd45de035..f9cdad085 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WxCustomerCaseController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WxCustomerCaseController.java @@ -5,6 +5,7 @@ import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.oss.AliyunOSSUtils; +import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.custom.domain.SysCustomerCase; import com.stdiet.custom.domain.SysCustomerCaseFile; import com.stdiet.custom.dto.response.CustomerCaseResponse; @@ -33,9 +34,9 @@ public class WxCustomerCaseController extends BaseController{ { startPage(); sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null); - //sysCustomerCase.setWxShow(1); - List list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase); - //List resultList = dealSysCustomerCase(list); + List list = sysCustomerCaseService.getWxCustomerCaseList(sysCustomerCase); + //处理ID加密 + dealIdEnc(list); return getDataTable(list); } @@ -43,34 +44,33 @@ public class WxCustomerCaseController extends BaseController{ * 查询客户案例文件列表 */ @GetMapping("/getFileByCaseId") - public AjaxResult getFileByCaseId(@RequestParam("caseId")Long caseId) + public AjaxResult getFileByCaseId(@RequestParam("caseId")String caseId) { + Long id = StringUtils.isNotEmpty(caseId) ? Long.parseLong(AesUtils.decrypt(caseId, null)) : null; CustomerCaseResponse customerCaseResponse = new CustomerCaseResponse(); - List list = sysCustomerCaseService.getFileListByCaseId(caseId); - List fileUrl = new ArrayList<>(); - for (SysCustomerCaseFile caseFile : list) { - fileUrl.add(caseFile.getFileUrl()); + customerCaseResponse.setId(caseId); + if(id != null){ + List list = sysCustomerCaseService.getFileListByCaseId(id); + List fileUrl = new ArrayList<>(); + for (SysCustomerCaseFile caseFile : list) { + fileUrl.add(caseFile.getFileUrl()); + } + List downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl); + customerCaseResponse.setFileList(downUrlList); + }else{ + customerCaseResponse.setFileList(new ArrayList<>()); } - List downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl); - customerCaseResponse.setFileList(downUrlList); return AjaxResult.success(customerCaseResponse); } /** - * 处理返回值 + * 处理返回值的ID加密 * @param list * @return */ - private List dealSysCustomerCase(List list){ - List resultList = new ArrayList<>(); - for (SysCustomerCase customerCase : list) { - CustomerCaseResponse customerCaseResponse = new CustomerCaseResponse(); - customerCaseResponse.setId(customerCase.getId()); - customerCaseResponse.setKeyword(customerCase.getKeyword()); - customerCaseResponse.setName(customerCase.getName()); - customerCaseResponse.setRemark(customerCase.getRemark()); - resultList.add(customerCaseResponse); + private void dealIdEnc(List list){ + for (CustomerCaseResponse cus : list) { + cus.setId(AesUtils.encrypt(cus.getId()+"", null)); } - return resultList; } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java index 7c8e0a51d..4cb800dff 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java @@ -20,6 +20,8 @@ public class SysCustomerCase extends BaseEntity /** $column.columnComment */ private Long id; + private Long[] ids; + /** 案例名称 */ @Excel(name = "案例名称") private String name; @@ -37,7 +39,7 @@ public class SysCustomerCase extends BaseEntity private String customerName; //是否显示到微信小程序 - private Integer wxShow; + private Boolean wxShow; /** 删除标识 0未删除 1已删除,默认0 */ private Long delFlag; diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerCaseResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerCaseResponse.java index be3f224fa..08a6a8d65 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerCaseResponse.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerCaseResponse.java @@ -7,7 +7,7 @@ import java.util.List; @Data public class CustomerCaseResponse { - private Long id; + private String id; private String name; @@ -15,5 +15,7 @@ public class CustomerCaseResponse { private String remark; + private Boolean wxShow; + private List fileList; } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseMapper.java index 0cc4a0b97..9a5927622 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseMapper.java @@ -2,6 +2,8 @@ package com.stdiet.custom.mapper; import java.util.List; import com.stdiet.custom.domain.SysCustomerCase; +import com.stdiet.custom.dto.response.CustomerCaseResponse; +import org.apache.ibatis.annotations.Param; /** * 客户案例管理Mapper接口 @@ -58,4 +60,19 @@ public interface SysCustomerCaseMapper * @return 结果 */ public int deleteSysCustomerCaseByIds(Long[] ids); + + /** + * 查询微信小程序上展示的客户案例 + * @param sysCustomerCase + * @return + */ + public List getWxCustomerCaseList(SysCustomerCase sysCustomerCase); + + /** + * 更新微信展示状态 + * @param wxShow 是否展示 0不展示 1展示 + * @param ids id数组 + * @return + */ + public int updateWxShowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerCaseService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerCaseService.java index 149c833ef..f17e6518e 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerCaseService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerCaseService.java @@ -3,6 +3,7 @@ package com.stdiet.custom.service; import java.util.List; import com.stdiet.custom.domain.SysCustomerCase; import com.stdiet.custom.domain.SysCustomerCaseFile; +import com.stdiet.custom.dto.response.CustomerCaseResponse; /** * 客户案例管理Service接口 @@ -66,4 +67,19 @@ public interface ISysCustomerCaseService { */ List getFileListByCaseId(Long caseId); + /** + * 查询微信小程序上展示的客户案例 + * @param sysCustomerCase + * @return + */ + List getWxCustomerCaseList(SysCustomerCase sysCustomerCase); + + /** + * 更新微信展示状态 + * @param wxShow 是否展示 0不展示 1展示 + * @param ids id数组 + * @return + */ + int updateWxShowByIds(Integer wxShow, Long[] ids); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerCaseServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerCaseServiceImpl.java index 2b2c18ed5..bcd95bc91 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerCaseServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerCaseServiceImpl.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import com.stdiet.common.utils.DateUtils; import com.stdiet.custom.domain.SysCustomerCaseFile; +import com.stdiet.custom.dto.response.CustomerCaseResponse; import com.stdiet.custom.mapper.SysCustomerCaseFileMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -154,7 +155,29 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService * @param caseId * @return */ + @Override public List getFileListByCaseId(Long caseId){ return sysCustomerCaseFileMapper.selectSysCustomerCaseFileListByCaseId(caseId); } + + /** + * 查询微信小程序上展示的客户案例 + * @param sysCustomerCase + * @return + */ + @Override + public List getWxCustomerCaseList(SysCustomerCase sysCustomerCase){ + return sysCustomerCaseMapper.getWxCustomerCaseList(sysCustomerCase); + } + + /** + * 更新微信展示状态 + * @param wxShow 是否展示 0不展示 1展示 + * @param ids id数组 + * @return + */ + @Override + public int updateWxShowByIds(Integer wxShow, Long[] ids){ + return sysCustomerCaseMapper.updateWxShowByIds(wxShow, ids); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml index 5783a7191..7ed96cf76 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml @@ -10,6 +10,7 @@ + @@ -19,8 +20,16 @@ + + + + + + + + - select id, name, keyword, remark, customer_id, create_time from sys_customer_case + select id, name, keyword, remark, customer_id, wx_show, create_time from sys_customer_case @@ -34,7 +43,7 @@ @@ -62,6 +71,7 @@ keyword, remark, customer_id, + wx_show, create_time, create_by, update_time, @@ -73,6 +83,7 @@ #{keyword}, #{remark}, #{customerId}, + #{wxShow}, #{createTime}, #{createBy}, #{updateTime}, @@ -88,6 +99,7 @@ keyword = #{keyword}, remark = #{remark}, customer_id = #{customerId}, + wx_show = #{wxShow}, create_time = #{createTime}, create_by = #{createBy}, update_time = #{updateTime}, @@ -108,4 +120,22 @@ + + + + + + update sys_customer_case set wx_show = #{wxShow} where del_flag = 0 and id in + + #{id} + + + \ No newline at end of file diff --git a/stdiet-ui/src/api/custom/customerCase.js b/stdiet-ui/src/api/custom/customerCase.js index 0f388c098..7a58862b1 100644 --- a/stdiet-ui/src/api/custom/customerCase.js +++ b/stdiet-ui/src/api/custom/customerCase.js @@ -75,6 +75,15 @@ export function downCaseFile(downUrl) { window.location.href = downUrl; } +// 修改客户案例微信小程序展示状态 +export function updateWxShow(data) { + return request({ + url: '/custom/customerCase/updateWxShow', + method: 'post', + data: data + }) +} + diff --git a/stdiet-ui/src/views/custom/customerCase/index.vue b/stdiet-ui/src/views/custom/customerCase/index.vue index 53800dc9f..73441fb61 100644 --- a/stdiet-ui/src/views/custom/customerCase/index.vue +++ b/stdiet-ui/src/views/custom/customerCase/index.vue @@ -36,6 +36,18 @@ + + + + + + + + + + + @@ -259,6 +283,16 @@ > + + + + + +
提示:小程序展示的案例需要隐藏客户隐私
+