From 4247860f691a2ee857824c5ba63dc1b8e019c31c Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Thu, 18 Mar 2021 16:11:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=9F=A5=E8=AF=A2=E6=A1=88=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/WxCustomerCaseController.java | 75 +++++++++++++++++++ .../dto/response/CustomerCaseResponse.java | 19 +++++ .../mapper/custom/SysCustomerCaseMapper.xml | 4 - 3 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WxCustomerCaseController.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerCaseResponse.java 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 new file mode 100644 index 000000000..95f1725e4 --- /dev/null +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WxCustomerCaseController.java @@ -0,0 +1,75 @@ +package com.stdiet.web.controller.custom; + +import com.stdiet.common.core.controller.BaseController; +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.custom.domain.SysCustomerCase; +import com.stdiet.custom.domain.SysCustomerCaseFile; +import com.stdiet.custom.dto.response.CustomerCaseResponse; +import com.stdiet.custom.service.ISysCustomerCaseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/wx/customerCase") +public class WxCustomerCaseController extends BaseController{ + + @Autowired + private ISysCustomerCaseService sysCustomerCaseService; + + /** + * 查询微信小程序中展示的客户案例 + */ + @GetMapping("/caseList") + public TableDataInfo caseList(SysCustomerCase sysCustomerCase) + { + startPage(); + sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null); + List list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase); + List resultList = dealSysCustomerCase(list); + return getDataTable(resultList); + } + + /** + * 查询客户案例文件列表 + */ + @GetMapping("/getFileByCaseId") + public AjaxResult getFileByCaseId(@RequestParam("caseId")Long caseId) + { + CustomerCaseResponse customerCaseResponse = new CustomerCaseResponse(); + List list = sysCustomerCaseService.getFileListByCaseId(caseId); + List fileUrl = new ArrayList<>(); + for (SysCustomerCaseFile caseFile : list) { + fileUrl.add(caseFile.getFileUrl()); + } + List downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl); + customerCaseResponse.setFileList(downUrlList); + return AjaxResult.success(customerCaseResponse); + } + + /** + * 处理返回值 + * @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); + } + return resultList; + } +} 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 new file mode 100644 index 000000000..be3f224fa --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerCaseResponse.java @@ -0,0 +1,19 @@ +package com.stdiet.custom.dto.response; + +import lombok.Data; + +import java.util.List; + +@Data +public class CustomerCaseResponse { + + private Long id; + + private String name; + + private String keyword; + + private String remark; + + private List fileList; +} diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml index 73827a0f3..b82963900 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml @@ -37,16 +37,12 @@ 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 left join sys_customer sc on sc.id = scc.customer_id and sc.del_flag = 0 where scc.del_flag = 0 - and sc.name like concat('%', #{customerName}, '%') - OR scc.keyword like concat('%', #{name}, '%') order by id desc From 9cc0ad82cd2aace27bede73942d85142c7d70e79 Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Thu, 18 Mar 2021 18:48:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=A3=9F=E8=B0=B1?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E6=97=B6=E9=97=B4=E9=99=90=E5=88=B6?= =?UTF-8?q?=EF=BC=8C=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=8E=B7=E5=8F=96=E6=A1=88?= =?UTF-8?q?=E4=BE=8B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/custom/WxCustomerCaseController.java | 5 +++-- .../main/java/com/stdiet/custom/domain/SysCustomerCase.java | 3 +++ .../custom/service/impl/SysRecipesPlanServiceImpl.java | 2 +- .../main/resources/mapper/custom/SysCustomerCaseMapper.xml | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) 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 95f1725e4..dd45de035 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 @@ -33,9 +33,10 @@ 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); - return getDataTable(resultList); + //List resultList = dealSysCustomerCase(list); + return getDataTable(list); } /** 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 1bc94bf0a..7c8e0a51d 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 @@ -36,6 +36,9 @@ public class SysCustomerCase extends BaseEntity @Excel(name = "所属客户") private String customerName; + //是否显示到微信小程序 + private Integer wxShow; + /** 删除标识 0未删除 1已删除,默认0 */ private Long delFlag; diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java index 27697a26b..035811af6 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java @@ -132,7 +132,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { } SysOrder sysOrder = sysOrderService.selectSysOrderById(orderId); //订单为空、金额小于0、订单未审核不进行食谱生成、更新,只对2021年开始的订单进行食谱计划生成,判断订单金额、开始时间、结束时间,为空则直接返回,不重新生成食谱计划 - if (sysOrder == null || !sysOrder.getReviewStatus().equals("yes") || DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear() < 2021 + if (sysOrder == null || !sysOrder.getReviewStatus().equals("yes") /*|| DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear() < 2021*/ || sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) { return; } diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml index b82963900..5783a7191 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml @@ -43,6 +43,9 @@ and sc.name like concat('%', #{customerName}, '%') + + and scc.wx_show = #{wxShow} + order by id desc