!151 客户案例修改

Merge pull request !151 from 德仔/xzj
This commit is contained in:
德仔 2021-03-19 18:13:23 +08:00 committed by Gitee
commit 76d2b5b2fb
10 changed files with 185 additions and 27 deletions

View File

@ -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

View File

@ -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<SysCustomerCase> list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase);
//List<CustomerCaseResponse> resultList = dealSysCustomerCase(list);
List<CustomerCaseResponse> 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<SysCustomerCaseFile> list = sysCustomerCaseService.getFileListByCaseId(caseId);
customerCaseResponse.setId(caseId);
if(id != null){
List<SysCustomerCaseFile> list = sysCustomerCaseService.getFileListByCaseId(id);
List<String> fileUrl = new ArrayList<>();
for (SysCustomerCaseFile caseFile : list) {
fileUrl.add(caseFile.getFileUrl());
}
List<String> downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl);
customerCaseResponse.setFileList(downUrlList);
}else{
customerCaseResponse.setFileList(new ArrayList<>());
}
return AjaxResult.success(customerCaseResponse);
}
/**
* 处理返回值
* 处理返回值的ID加密
* @param list
* @return
*/
private List<CustomerCaseResponse> dealSysCustomerCase(List<SysCustomerCase> list){
List<CustomerCaseResponse> 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<CustomerCaseResponse> list){
for (CustomerCaseResponse cus : list) {
cus.setId(AesUtils.encrypt(cus.getId()+"", null));
}
return resultList;
}
}

View File

@ -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;

View File

@ -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<String> fileList;
}

View File

@ -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<CustomerCaseResponse> getWxCustomerCaseList(SysCustomerCase sysCustomerCase);
/**
* 更新微信展示状态
* @param wxShow 是否展示 0不展示 1展示
* @param ids id数组
* @return
*/
public int updateWxShowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
}

View File

@ -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<SysCustomerCaseFile> getFileListByCaseId(Long caseId);
/**
* 查询微信小程序上展示的客户案例
* @param sysCustomerCase
* @return
*/
List<CustomerCaseResponse> getWxCustomerCaseList(SysCustomerCase sysCustomerCase);
/**
* 更新微信展示状态
* @param wxShow 是否展示 0不展示 1展示
* @param ids id数组
* @return
*/
int updateWxShowByIds(Integer wxShow, Long[] ids);
}

View File

@ -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<SysCustomerCaseFile> getFileListByCaseId(Long caseId){
return sysCustomerCaseFileMapper.selectSysCustomerCaseFileListByCaseId(caseId);
}
/**
* 查询微信小程序上展示的客户案例
* @param sysCustomerCase
* @return
*/
@Override
public List<CustomerCaseResponse> 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);
}
}

View File

@ -10,6 +10,7 @@
<result property="keyword" column="keyword" />
<result property="remark" column="remark" />
<result property="customerId" column="customer_id" />
<result property="wxShow" column="wx_show" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
@ -19,8 +20,16 @@
<result property="customerName" column="customer_name"></result>
</resultMap>
<resultMap type="com.stdiet.custom.dto.response.CustomerCaseResponse" id="SysCustomerCaseResponseResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="keyword" column="keyword" />
<result property="remark" column="remark" />
<result property="wxShow" column="wx_show" />
</resultMap>
<sql id="selectSysCustomerCaseVo">
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
</sql>
<sql id="searchKey">
@ -34,7 +43,7 @@
</sql>
<select id="selectSysCustomerCaseList" parameterType="SysCustomerCase" resultMap="SysCustomerCaseResult">
select scc.id, scc.name, scc.keyword, scc.remark, scc.customer_id, scc.create_time,sc.name as customer_name from sys_customer_case scc
select scc.id, scc.name, scc.keyword, scc.remark, scc.customer_id, scc.wx_show, scc.create_time,sc.name as customer_name from sys_customer_case scc
left join sys_customer sc on sc.id = scc.customer_id and sc.del_flag = 0
where scc.del_flag = 0
<include refid="searchKey">
@ -50,7 +59,7 @@
</select>
<select id="selectSysCustomerCaseById" parameterType="Long" resultMap="SysCustomerCaseResult">
select scc.id, scc.name, scc.keyword, scc.remark, scc.customer_id, scc.create_time,sc.name as customer_name from sys_customer_case scc
select scc.id, scc.name, scc.keyword, scc.remark, scc.customer_id, scc.wx_show, scc.create_time,sc.name as customer_name from sys_customer_case scc
left join sys_customer sc on sc.id = scc.customer_id and sc.del_flag = 0
where scc.id = #{id} and scc.del_flag = 0
</select>
@ -62,6 +71,7 @@
<if test="keyword != null">keyword,</if>
<if test="remark != null">remark,</if>
<if test="customerId != null">customer_id,</if>
<if test="wxShow != null">wx_show,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
@ -73,6 +83,7 @@
<if test="keyword != null">#{keyword},</if>
<if test="remark != null">#{remark},</if>
<if test="customerId != null">#{customerId},</if>
<if test="wxShow != null">#{wxShow},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
@ -88,6 +99,7 @@
<if test="keyword != null">keyword = #{keyword},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="wxShow != null">wx_show = #{wxShow},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
@ -108,4 +120,22 @@
</foreach>
</update>
<!-- 获取在微信小程序上展示的客户案例 -->
<select id="getWxCustomerCaseList" parameterType="SysCustomerCase" resultMap="SysCustomerCaseResponseResult">
select scc.id, scc.name, scc.keyword, scc.remark, scc.wx_show from sys_customer_case scc
where scc.del_flag = 0 and scc.wx_show = 1
<include refid="searchKey">
<property name="keywordArray" value="#{keywordArray}"/>
</include>
order by id desc
</select>
<!-- 更新是否在微信小程序上展示 -->
<update id="updateWxShowByIds">
update sys_customer_case set wx_show = #{wxShow} where del_flag = 0 and id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@ -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
})
}

View File

@ -36,6 +36,18 @@
</el-select>
</el-form-item>
<el-form-item label="展示状态" prop="wxShow">
<el-select
v-model="queryParams.wxShow"
placeholder="请选择展示状态"
clearable
size="small"
>
<el-option key="false" label="不展示" value="false"/>
<el-option key="true" label="展示" value="true"/>
</el-select>
</el-form-item>
<el-form-item label="客户姓名" prop="customerName">
<el-input
v-model.trim="queryParams.customerName"
@ -139,6 +151,7 @@
</template>
</el-table-column>
<el-table-column label="所属客户" align="center" prop="customerName" />
<el-table-column label="文件" align="center">
<template slot-scope="scope">
<el-button
@ -161,6 +174,17 @@
}}</span>
</template>
</el-table-column>
<el-table-column label="小程序展示状态" align="center" prop="wxShow" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.wxShow"
active-text="展示"
inactive-text="不展示"
@change="handleWxShow($event, scope.row)"
>
</el-switch>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
@ -241,7 +265,7 @@
placeholder="请输入案例备注"
v-model.trim="form.remark"
maxlength="200"
rows="4"
rows="3"
show-word-limit
></el-input>
</el-form-item>
@ -259,6 +283,16 @@
></span
>
</el-form-item>
<el-form-item label="展示状态" prop="wxShow">
<el-switch
v-model="form.wxShow"
active-text="小程序展示"
inactive-text="小程序不展示">
</el-switch>
<div>提示小程序展示的案例需要隐藏客户隐私</div>
</el-form-item>
<el-form-item label="案例文件" prop="file">
<DragUpload
v-if="form.id == null || form.id <= 0"
@ -301,6 +335,7 @@ import {
updateCustomerCase,
exportCustomerCase,
getFileListByCaseId,
updateWxShow
} from "@/api/custom/customerCase";
import DragUpload from "@/components/FileUpload/DragUpload";
import DragUploadEdit from "@/components/FileUpload/DragUploadEdit";
@ -337,6 +372,7 @@ export default {
pageSize: 10,
name: null,
keyword: null,
wxShow: null,
customerName: null,
},
//
@ -398,6 +434,7 @@ export default {
remark: null,
customerId: null,
customerName: null,
wxShow: false,
caseFileList: [],
caseFileUrl: [],
caseFileName: [],
@ -437,6 +474,7 @@ export default {
keywordArray: response.data.keyword.split(","),
remark: response.data.remark,
customerId: response.data.customerId,
wxShow: response.data.wxShow == 1 ? true : false,
customerName: response.data.customerName,
caseFileList: response.data.caseFileList,
caseFileUrl: [],
@ -560,6 +598,13 @@ export default {
})
.catch(function () {});
},
handleWxShow(newWxshow, row){
let param = {
ids:[row.id],
wxShow: newWxshow
};
updateWxShow(param);
}
},
};
</script>