diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java index e82f72c5a..c1fa43118 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java @@ -1,27 +1,13 @@ package com.stdiet.web.controller; -import com.stdiet.common.config.AliyunOSSConfig; -import com.stdiet.common.core.domain.AjaxResult; -import com.stdiet.common.core.domain.entity.SysUser; import com.stdiet.common.utils.StringUtils; -import com.stdiet.common.utils.oss.AliyunOSSUtils; import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.custom.domain.SysNutritionQuestion; import com.stdiet.custom.domain.SysNutritionalVideo; -import com.stdiet.custom.domain.SysWxUserInfo; -import com.stdiet.custom.domain.SysWxUserLog; -import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper; -import com.stdiet.custom.mapper.SysNutritionQuestionMapper; import com.stdiet.custom.mapper.SysWxUserInfoMapper; import com.stdiet.custom.mapper.SysWxUserLogMapper; import com.stdiet.custom.service.ISysNutritionQuestionService; import com.stdiet.custom.service.ISysNutritionalVideoService; -import com.stdiet.custom.service.ISysWxUserLogService; -import com.stdiet.custom.utils.LuceneIndexUtils; -import com.stdiet.framework.web.domain.server.Sys; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.document.TextField; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; @@ -37,11 +23,11 @@ import java.util.Map; @Order(value = 1) public class MyApplicationRunner implements ApplicationRunner { - @Autowired - private SysWxUserLogMapper sysWxUserLogMapper; +// @Autowired +// private SysWxUserLogMapper sysWxUserLogMapper; - @Autowired - private SysWxUserInfoMapper sysWxUserInfoMapper; +// @Autowired +// private SysWxUserInfoMapper sysWxUserInfoMapper; @Autowired private ISysNutritionQuestionService sysNutritionQuestionService; @@ -50,7 +36,6 @@ public class MyApplicationRunner implements ApplicationRunner { private ISysNutritionalVideoService sysNutritionalVideoService; - @Override public void run(ApplicationArguments args) throws Exception { System.out.println("--------------项目启动调用方法开始----------"); @@ -59,11 +44,10 @@ public class MyApplicationRunner implements ApplicationRunner { } - /** * 从微信用户表中查询openid更新到用户打卡日志表中 */ - public void dealWxUserLog(){ + public void dealWxUserLog() { /*List phoneList = sysWxUserLogMapper.getAllSysWxUserLogPhone(); SysWxUserLog sysWxUserLog = new SysWxUserLog(); if(phoneList.size() > 0){ @@ -83,10 +67,11 @@ public class MyApplicationRunner implements ApplicationRunner { /** * 导入营养小知识方法 + * * @param path */ - public void importNutritionQuestion(String path){ - try{ + public void importNutritionQuestion(String path) { + try { int count = 0; ExcelUtil util = new ExcelUtil(SysNutritionQuestion.class); File file = new File(path); @@ -94,11 +79,11 @@ public class MyApplicationRunner implements ApplicationRunner { System.out.println(questionList.size()); for (SysNutritionQuestion sysNutritionQuestion : questionList) { //System.out.println(sysNutritionQuestion); - if(StringUtils.isNotEmpty(sysNutritionQuestion.getTitle()) - && StringUtils.isNotEmpty(sysNutritionQuestion.getContent())){ + if (StringUtils.isNotEmpty(sysNutritionQuestion.getTitle()) + && StringUtils.isNotEmpty(sysNutritionQuestion.getContent())) { //System.out.println(sysNutritionQuestion.getTitle() + "\n"); sysNutritionQuestion.setShowFlag(1); - if(sysNutritionQuestionService.insertSysNutritionQuestion(sysNutritionQuestion) > 0){ + if (sysNutritionQuestionService.insertSysNutritionQuestion(sysNutritionQuestion) > 0) { count++; Thread.sleep(100); System.out.println(count); @@ -106,18 +91,18 @@ public class MyApplicationRunner implements ApplicationRunner { } } - System.out.println("结束:"+count); - }catch (Exception e){ + System.out.println("结束:" + count); + } catch (Exception e) { e.printStackTrace(); } } - public void updateVideo(){ - Map map = sysNutritionalVideoService.searchVideo(null, null, 1,100, null); - if(map != null){ - List list = (List)map.get("nutritionalVideoList"); - if(list != null && list.size() > 0){ + public void updateVideo() { + Map map = sysNutritionalVideoService.searchVideo(null, null, 1, 100, null); + if (map != null) { + List list = (List) map.get("nutritionalVideoList"); + if (list != null && list.size() > 0) { for (SysNutritionalVideo video : list) { sysNutritionalVideoService.insertSysNutritionalVideo(video); } @@ -126,5 +111,4 @@ public class MyApplicationRunner implements ApplicationRunner { } - } diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java index 404dc8c54..ef71c7968 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java @@ -1,4 +1,4 @@ -package com.stdiet.custom.controller; +package com.stdiet.web.controller.custom; import java.util.List; diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionQuestionController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionQuestionController.java index b34f3fbc9..69f1d1538 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionQuestionController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionQuestionController.java @@ -1,4 +1,4 @@ -package com.stdiet.custom.controller; +package com.stdiet.web.controller.custom; import java.util.List; diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderNutritionistReplaceRecordController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderNutritionistReplaceRecordController.java index c552d29e2..51855fe2a 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderNutritionistReplaceRecordController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderNutritionistReplaceRecordController.java @@ -1,4 +1,4 @@ -package com.stdiet.custom.controller; +package com.stdiet.web.controller.custom; import java.time.temporal.ChronoUnit; import java.util.List; diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysServiceQuestionController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysServiceQuestionController.java new file mode 100644 index 000000000..17dec89bf --- /dev/null +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysServiceQuestionController.java @@ -0,0 +1,26 @@ +package com.stdiet.web.controller.custom; + +import com.stdiet.common.core.controller.BaseController; +import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.custom.domain.SysServicesQuestion; +import com.stdiet.custom.service.ISysServicesQuestionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/services/question") +public class SysServiceQuestionController extends BaseController { + + @Autowired + private ISysServicesQuestionService sysServicesQuestionService; + + @PostMapping(value = "/list") + public AjaxResult list(@RequestBody SysServicesQuestion sysServicesQuestion) { + return AjaxResult.success(sysServicesQuestionService.selectSysServicesQuestionByUserIdAndRole(sysServicesQuestion)); + } + + @PutMapping(value = "/updateStatus") + public AjaxResult reply(@RequestBody SysServicesQuestion sysServicesQuestion) { + return toAjax(sysServicesQuestionService.updateSysServicesQuestionStatus(sysServicesQuestion)); + } +} diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index d30ca7002..690faedbc 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -68,6 +68,8 @@ public class WechatAppletController extends BaseController { private ISysDictTypeService iSysDictTypeService; @Autowired private IWechatAppletService iWechatAppletService; + @Autowired + private ISysServicesQuestionService iSysServicesQuestionService; /** * 查询微信小程序中展示的客户案例 @@ -571,9 +573,12 @@ public class WechatAppletController extends BaseController { // } @GetMapping("/trans") - public AjaxResult transId(@RequestParam String customerId) { - Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; - return AjaxResult.success(String.valueOf(cusId)); + public AjaxResult transId(@RequestParam String customerId, @RequestParam Long cusId) { + if (StringUtils.isNotEmpty(customerId)) { + return AjaxResult.success(AesUtils.decrypt(customerId)); + } + + return AjaxResult.success(AesUtils.encrypt(String.valueOf(cusId))); } @GetMapping("/subscribe") @@ -587,6 +592,19 @@ public class WechatAppletController extends BaseController { return AjaxResult.success(sysRecipesPlanService.updateSysRecipesPlan(info)); } + @GetMapping("/fetchServiceQuestion") + public AjaxResult fetchServiceQuestion(@RequestParam String customerId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) { + startPage(); + + Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; + + SysServicesQuestion servicesQuestion = new SysServicesQuestion(); + servicesQuestion.setRole("customer"); + servicesQuestion.setUserId(cusId); + + return AjaxResult.success(iSysServicesQuestionService.selectSysServicesQuestionByUserIdAndRole(servicesQuestion)); + } + } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysServicesQuestion.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysServicesQuestion.java new file mode 100644 index 000000000..0c711d4bc --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysServicesQuestion.java @@ -0,0 +1,75 @@ +package com.stdiet.custom.domain; + +import com.alibaba.fastjson.JSONArray; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class SysServicesQuestion { + /** + * 问题状态id + */ + String id; + + /** + * 问题id(搜索用) + */ + String queId; + + /** + * 客户id + */ + Long cusId; + + /** + * 问题内容 + */ + String content; + + + /** + * 图片地址 + */ + JSONArray img; + + /** + * 问题类型 + */ + Integer type; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + Date createTime; + + /** + * 0-未读 1-已读 + */ + Integer read; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + Date updateTime; + + /** + * 角色 + */ + String role; + + // 非持久化字段 + /** + * 角色名字 + */ + String name; + + /** + * 角色id + */ + Long userId; + +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysServicesQuestionMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysServicesQuestionMapper.java new file mode 100644 index 000000000..c68c4b63c --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysServicesQuestionMapper.java @@ -0,0 +1,15 @@ +package com.stdiet.custom.mapper; + +import com.stdiet.custom.domain.SysServicesQuestion; + +import java.util.List; + +public interface SysServicesQuestionMapper { + List selectSysServicesQuestionByUserIdAndRole(SysServicesQuestion servicesQuestion); + + int insertSysServicesQuestion(SysServicesQuestion servicesQuestion); + + int insertSysServicesQuestionStatus(List sysServicesQuestion); + + int updateSysServicesQuestionStatus(SysServicesQuestion sysServicesQuestion); +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysServicesQuestionService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysServicesQuestionService.java new file mode 100644 index 000000000..344de4c0b --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysServicesQuestionService.java @@ -0,0 +1,14 @@ +package com.stdiet.custom.service; + +import com.stdiet.custom.domain.SysServicesQuestion; + +import java.util.List; + +public interface ISysServicesQuestionService { + + List selectSysServicesQuestionByUserIdAndRole(SysServicesQuestion servicesQuestion); + + int insertSysServicesQuestion(SysServicesQuestion servicesQuestion); + + int updateSysServicesQuestionStatus(SysServicesQuestion sysServicesQuestion); +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesQuestionServiceImp.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesQuestionServiceImp.java new file mode 100644 index 000000000..07b61add0 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysServicesQuestionServiceImp.java @@ -0,0 +1,66 @@ +package com.stdiet.custom.service.impl; + +import com.stdiet.custom.domain.SysCustomer; +import com.stdiet.custom.domain.SysServicesQuestion; +import com.stdiet.custom.mapper.SysCustomerMapper; +import com.stdiet.custom.mapper.SysServicesQuestionMapper; +import com.stdiet.custom.service.ISysServicesQuestionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class SysServicesQuestionServiceImp implements ISysServicesQuestionService { + @Autowired + SysServicesQuestionMapper servicesQuestionMapper; + + @Autowired + SysCustomerMapper sysCustomerMapper; + + @Override + public List selectSysServicesQuestionByUserIdAndRole(SysServicesQuestion servicesQuestion) { + return servicesQuestionMapper.selectSysServicesQuestionByUserIdAndRole(servicesQuestion); + } + + @Override + public int insertSysServicesQuestion(SysServicesQuestion servicesQuestion) { + servicesQuestionMapper.insertSysServicesQuestion(servicesQuestion); + + SysCustomer customer = sysCustomerMapper.selectSysCustomerById(servicesQuestion.getCusId()); + + List statusList = new ArrayList<>(); + SysServicesQuestion customerStatus = new SysServicesQuestion(); + customerStatus.setUserId(customer.getId()); + customerStatus.setRole("customer"); + customerStatus.setQueId(servicesQuestion.getId()); + statusList.add(customerStatus); + + SysServicesQuestion dieticianStatus = new SysServicesQuestion(); + dieticianStatus.setUserId(customer.getMainDietitian()); + dieticianStatus.setRole("dietician"); + dieticianStatus.setQueId(servicesQuestion.getId()); + statusList.add(dieticianStatus); + + SysServicesQuestion afterSaleStatus = new SysServicesQuestion(); + afterSaleStatus.setUserId(customer.getAfterDietitian()); + afterSaleStatus.setRole("after_sale"); + afterSaleStatus.setQueId(servicesQuestion.getId()); + statusList.add(afterSaleStatus); + + SysServicesQuestion dieticianAssistantStatus = new SysServicesQuestion(); + dieticianAssistantStatus.setUserId(customer.getAssistantDietitian()); + dieticianAssistantStatus.setRole("dietician_assistant"); + dieticianAssistantStatus.setQueId(servicesQuestion.getId()); + statusList.add(dieticianAssistantStatus); + + return servicesQuestionMapper.insertSysServicesQuestionStatus(statusList); + } + + + @Override + public int updateSysServicesQuestionStatus(SysServicesQuestion sysServicesQuestion) { + return servicesQuestionMapper.updateSysServicesQuestionStatus(sysServicesQuestion); + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/WeChartAppletServiceImp.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/WeChartAppletServiceImp.java index 9cf84060a..73a40ee88 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/WeChartAppletServiceImp.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/WeChartAppletServiceImp.java @@ -97,7 +97,7 @@ public class WeChartAppletServiceImp implements IWechatAppletService { dataParam.put("thing1", JSONObject.parse("{\"value\":\"" + name + "\"}")); dataParam.put("time2", JSONObject.parse("{\"value\":\"" + startDate + "\"}")); dataParam.put("time3", JSONObject.parse("{\"value\":\"" + endDate + "\"}")); - String mRemark = StringUtils.isNull(remark) ? " " : remark; + String mRemark = StringUtils.isNull(remark) ? "无" : remark; dataParam.put("thing4", JSONObject.parse("{\"value\":\"" + mRemark + "\"}")); param.put("data", dataParam); diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysServicesQuestionMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysServicesQuestionMapper.xml new file mode 100644 index 000000000..dea35d763 --- /dev/null +++ b/stdiet-custom/src/main/resources/mapper/custom/SysServicesQuestionMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + insert into sys_services_question + + id, + cus_id, + content, + type, + create_time, + + + replace(uuid(), '-', ''), + #{cusId}, + #{content}, + #{type}, + now(), + + + + + + insert into sys_services_question (que_id, user_id, role, create_time, update_time) values + + (#{status.queId}, #{status.userId}, #{status.role}, now(), now()) + + + + + + update sys_services_question_status + + read = #{read} + update_time = now() + + where id = ${id} + + + + \ No newline at end of file diff --git a/stdiet-system/src/main/resources/mapper/system/SysUserMapper.xml b/stdiet-system/src/main/resources/mapper/system/SysUserMapper.xml index 27d26aa21..ce1f92365 100644 --- a/stdiet-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/stdiet-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -1,58 +1,58 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - -- select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u -- left join sys_dept d on u.dept_id = d.dept_id -- where u.del_flag = '0' @@ -61,11 +61,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE del_flag = '0' - select user_id, nick_name from sys_user where dept_id='103' - + -- select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, -- d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status, -- r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status, p.post_id, p.post_name @@ -89,138 +89,141 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + WHERE del_flag = '0' + + AND (user_name like concat('%', #{userName}, '%') OR nick_name like concat('%', #{userName}, '%')) + + + AND status = #{status} + + + AND phonenumber like concat('%', #{phonenumber}, '%') + + + AND date_format(create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d') + + + AND date_format(create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') + + + AND (dept_id = #{deptId} OR dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, + ancestors) )) + + + ${params.dataScope} + - + - + - select count(1) from sys_user where user_name = #{userName} limit 1 - select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1 - select user_id, email from sys_user where email = #{email} limit 1 - - insert into sys_user( - user_id, - dept_id, - user_name, - nick_name, - email, - avatar, - phonenumber, - sex, - password, - status, - create_by, - remark, - create_time - )values( - #{userId}, - #{deptId}, - #{userName}, - #{nickName}, - #{email}, - #{avatar}, - #{phonenumber}, - #{sex}, - #{password}, - #{status}, - #{createBy}, - #{remark}, - sysdate() - ) - + + insert into sys_user( + user_id, + dept_id, + user_name, + nick_name, + email, + avatar, + phonenumber, + sex, + password, + status, + create_by, + remark, + create_time + )values( + #{userId}, + #{deptId}, + #{userName}, + #{nickName}, + #{email}, + #{avatar}, + #{phonenumber}, + #{sex}, + #{password}, + #{status}, + #{createBy}, + #{remark}, + sysdate() + ) + - - update sys_user - - dept_id = #{deptId}, - user_name = #{userName}, - nick_name = #{nickName}, - email = #{email}, - phonenumber = #{phonenumber}, - sex = #{sex}, - avatar = #{avatar}, - password = #{password}, - status = #{status}, - login_ip = #{loginIp}, - login_date = #{loginDate}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where user_id = #{userId} - + + update sys_user + + dept_id = #{deptId}, + user_name = #{userName}, + nick_name = #{nickName}, + email = #{email}, + phonenumber = #{phonenumber}, + sex = #{sex}, + avatar = #{avatar}, + password = #{password}, + status = #{status}, + login_ip = #{loginIp}, + login_date = #{loginDate}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + where user_id = #{userId} + - + update sys_user set status = #{status} where user_id = #{userId} - + update sys_user set avatar = #{avatar} where user_name = #{userName} - + update sys_user set password = #{password} where user_name = #{userName} - + delete from sys_user where user_id = #{userId} - - update sys_user set del_flag = '2' where user_id in - - #{userId} + + update sys_user set del_flag = '2' where user_id in + + #{userId} - + \ No newline at end of file