From 78399c52e794b1a87dc09ea0139cf220ee3723fa Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Sat, 10 Apr 2021 18:10:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=A1=A3=E6=A1=88=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E6=89=93=E5=8D=A1=E8=AE=B0=E5=BD=95=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E4=BD=93=E9=87=8D=E8=B6=8B=E5=8A=BF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/SysWxUserLogController.java | 13 +- .../stdiet/custom/domain/SysWxUserLog.java | 3 + .../custom/mapper/SysWxUserLogMapper.java | 7 + .../custom/service/ISysWxUserLogService.java | 7 + .../service/impl/SysWxUserLogServiceImpl.java | 9 + .../mapper/custom/SysWxUserLogMapper.xml | 18 +- stdiet-ui/package.json | 2 + stdiet-ui/src/api/custom/wxUserLog.js | 11 + .../Highcharts/LineCharts/index.vue | 114 ++++++++ .../PunchLog/CustomerPunchLog/index.vue | 190 ++++++++++++ .../PunchLog/PunchLogChart/index.vue | 89 ++++++ .../PunchLog/PunchLogDetail/index.vue | 13 +- .../PunchLog/PunchLogEdit/index.vue | 271 ++++++++++++++++++ stdiet-ui/src/main.js | 6 + stdiet-ui/src/views/custom/customer/index.vue | 25 ++ .../src/views/custom/wxUserLog/index.vue | 174 +++-------- 16 files changed, 802 insertions(+), 150 deletions(-) create mode 100644 stdiet-ui/src/components/Highcharts/LineCharts/index.vue create mode 100644 stdiet-ui/src/components/PunchLog/CustomerPunchLog/index.vue create mode 100644 stdiet-ui/src/components/PunchLog/PunchLogChart/index.vue create mode 100644 stdiet-ui/src/components/PunchLog/PunchLogEdit/index.vue diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java index cf4eb42d9..a69ddc3c6 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java @@ -6,6 +6,7 @@ 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.enums.BusinessType; +import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.oss.AliyunOSSUtils; import com.stdiet.common.utils.poi.ExcelUtil; @@ -107,7 +108,7 @@ public class SysWxUserLogController extends BaseController { if( sysWxUserLog != null && StringUtils.isNotEmpty(sysWxUserLog.getOpenid())){ SysWxUserLog dateLog = sysWxUserLogService.selectSysWxUserLogByDateAndOpenId(sysWxUserLog); if(dateLog != null && dateLog.getId().intValue() != sysWxUserLog.getId().intValue()){ - return AjaxResult.error("今日该用户已打卡,无法重复打卡"); + return AjaxResult.error("该用户在"+ DateUtils.dateTime(sysWxUserLog.getLogTime())+"已打卡,无法重复打卡"); } return toAjax(sysWxUserLogService.updateSysWxUserLog(sysWxUserLog)); }else{ @@ -189,4 +190,14 @@ public class SysWxUserLogController extends BaseController { sysWxUserLog.setImagesUrl(downUrlList); return AjaxResult.success(sysWxUserLog); } + + /** + * 根据客户ID查询对应打卡体重数据 + */ + @PreAuthorize("@ss.hasPermi('custom:wxUserLog:list')") + @GetMapping("/getAllPunchLogByCustomerId") + public AjaxResult getAllPunchLogByCustomerId(SysWxUserLog sysWxUserLog) { + List list = sysWxUserLogService.getWxUserLogListByCustomerId(sysWxUserLog); + return AjaxResult.success(list); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysWxUserLog.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysWxUserLog.java index 9cb4ce4c8..91fcae3ff 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysWxUserLog.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysWxUserLog.java @@ -73,6 +73,9 @@ public class SysWxUserLog extends BaseEntity @JsonFormat(pattern = "yyyy-MM-dd") private Date logTime; + //客户ID + private Long customerId; + /** * 非持久化字段,客户姓名 */ diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java index 4cb68978e..bccd05b00 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java @@ -78,4 +78,11 @@ public interface SysWxUserLogMapper */ SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog); + /** + * 根据客户ID查询对应打卡体重数据 + * @param sysWxUserLog + * @return + */ + List getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java index 558b6314a..46e29275a 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java @@ -80,4 +80,11 @@ public interface ISysWxUserLogService */ SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog); + /** + * 根据客户ID查询对应打卡体重数据 + * @param sysWxUserLog + * @return + */ + List getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java index d4db23f59..b40daad6a 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java @@ -124,4 +124,13 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService { return sysWxUserLogMapper.selectSysWxUserLogByDateAndOpenId(sysWxUserLog); } + /** + * 根据客户ID查询对应打卡体重数据 + * @param sysWxUserLog + * @return + */ + public List getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog){ + return sysWxUserLogMapper.getWxUserLogListByCustomerId(sysWxUserLog); + } + } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml index 1ceef353a..c6d7fc47b 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml @@ -84,6 +84,9 @@ and wxlog.id = #{id} + + and sc.id = #{customerId} + and (sc.name like concat('%',#{phone},'%') or wxinfo.phone like concat('%',#{phone},'%') ) and wxinfo.appid = #{appid} @@ -94,7 +97,9 @@ and su_atferSale.user_id = #{afterNutritionistId} - order by wxlog.create_time desc + and date_format(wxlog.log_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d') + and date_format(wxlog.log_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') + order by wxlog.log_time desc + + + \ No newline at end of file diff --git a/stdiet-ui/package.json b/stdiet-ui/package.json index 3d9272a77..c5cccb06c 100644 --- a/stdiet-ui/package.json +++ b/stdiet-ui/package.json @@ -50,6 +50,8 @@ "element-ui": "2.13.2", "file-saver": "^2.0.5", "fuse.js": "3.4.4", + "highcharts": "^9.0.1", + "highcharts-vue": "^1.3.5", "html2canvas": "^1.0.0-rc.7", "immer": "^8.0.1", "js-beautify": "1.10.2", diff --git a/stdiet-ui/src/api/custom/wxUserLog.js b/stdiet-ui/src/api/custom/wxUserLog.js index 9ef6d2ecb..e6a11ef64 100644 --- a/stdiet-ui/src/api/custom/wxUserLog.js +++ b/stdiet-ui/src/api/custom/wxUserLog.js @@ -60,3 +60,14 @@ export function getPunchLogDetail(id) { params: {} }) } + +// 根据用户ID查询打卡日志详情 +export function getAllPunchLogByCustomerId(query) { + return request({ + url: '/custom/wxUserLog/getAllPunchLogByCustomerId', + method: 'get', + params: query + }) +} + + diff --git a/stdiet-ui/src/components/Highcharts/LineCharts/index.vue b/stdiet-ui/src/components/Highcharts/LineCharts/index.vue new file mode 100644 index 000000000..2fb5c3321 --- /dev/null +++ b/stdiet-ui/src/components/Highcharts/LineCharts/index.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/stdiet-ui/src/components/PunchLog/CustomerPunchLog/index.vue b/stdiet-ui/src/components/PunchLog/CustomerPunchLog/index.vue new file mode 100644 index 000000000..d948f6dc4 --- /dev/null +++ b/stdiet-ui/src/components/PunchLog/CustomerPunchLog/index.vue @@ -0,0 +1,190 @@ + + + diff --git a/stdiet-ui/src/components/PunchLog/PunchLogChart/index.vue b/stdiet-ui/src/components/PunchLog/PunchLogChart/index.vue new file mode 100644 index 000000000..0abc248e6 --- /dev/null +++ b/stdiet-ui/src/components/PunchLog/PunchLogChart/index.vue @@ -0,0 +1,89 @@ + + + + diff --git a/stdiet-ui/src/components/PunchLog/PunchLogDetail/index.vue b/stdiet-ui/src/components/PunchLog/PunchLogDetail/index.vue index e5e9203c6..b51b6adaa 100644 --- a/stdiet-ui/src/components/PunchLog/PunchLogDetail/index.vue +++ b/stdiet-ui/src/components/PunchLog/PunchLogDetail/index.vue @@ -27,7 +27,7 @@

二、图片信息

-
+

早餐

-
+

午餐

-
+

晚餐

-
+

加餐

-
+

体型对比照

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stdiet-ui/src/main.js b/stdiet-ui/src/main.js index 52a08d53a..28ac40c5a 100644 --- a/stdiet-ui/src/main.js +++ b/stdiet-ui/src/main.js @@ -19,6 +19,11 @@ import { getDicts } from "@/api/system/dict/data"; import { getConfigKey } from "@/api/system/config"; import VueScrollTo from "vue-scrollto"; import VueResource from "vue-resource" +import HighchartsVue from 'highcharts-vue' +import Highcharts from 'highcharts' +//图片导出模块 +import exportingInit from 'highcharts/modules/exporting' +exportingInit(Highcharts) import { addDateRange, @@ -69,6 +74,7 @@ Vue.component("Pagination", Pagination); Vue.component("RightToolbar", RightToolbar); Vue.use(permission); +Vue.use(HighchartsVue); /** * If you don't want to use mock-server diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue index 8150bdd56..535ac2ec2 100644 --- a/stdiet-ui/src/views/custom/customer/index.vue +++ b/stdiet-ui/src/views/custom/customer/index.vue @@ -235,10 +235,27 @@ + + + + + @@ -394,6 +413,7 @@ import PhysicalSignsDialog from "@/components/PhysicalSignsDialog"; import ContractDrawer from "@/components/ContractDrawer"; import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer"; import RecipesPlanDrawer from "@/components/RecipesPlanDrawer"; +import CustomerPunchLogDrawer from "@/components/PunchLog/CustomerPunchLog"; import { mapGetters } from "vuex"; export default { @@ -404,6 +424,7 @@ export default { "contract-drawer": ContractDrawer, heatStatisticsDrawer: HeatStatisticsDrawer, RecipesPlanDrawer, + CustomerPunchLogDrawer }, data() { const userId = store.getters && store.getters.userId; @@ -552,6 +573,10 @@ export default { handleClickHeatStatistics(row) { this.$refs["heatStatisticsRef"].showDrawer(row); }, + handleClickCustomerPunchLog(row) { + this.$refs["customerPunchLogDrawerRef"].showDrawer(row); + }, + // 取消按钮 cancel() { this.open = false; diff --git a/stdiet-ui/src/views/custom/wxUserLog/index.vue b/stdiet-ui/src/views/custom/wxUserLog/index.vue index 78fbb22ab..0e10a3769 100644 --- a/stdiet-ui/src/views/custom/wxUserLog/index.vue +++ b/stdiet-ui/src/views/custom/wxUserLog/index.vue @@ -52,6 +52,20 @@ + + + + + @@ -415,7 +303,9 @@ import { } from "@/api/custom/wxUserLog"; import { mapGetters } from "vuex"; import PunchLogDetail from "@/components/PunchLog/PunchLogDetail"; +import PunchLogEdit from "@/components/PunchLog/PunchLogEdit"; import AutoHideMessage from "@/components/AutoHideMessage"; +import dayjs from "dayjs"; export default { name: "WxUserLog", data() { @@ -463,13 +353,14 @@ export default { rules: {}, logTimePickerOptions: { disabledDate(time) { - return time.getTime() > Date.now(); + return time.getTime() > dayjs() }, }, + logTimeScope: null }; }, components:{ - PunchLogDetail,AutoHideMessage + PunchLogDetail,AutoHideMessage,PunchLogEdit }, created() { this.getList(); @@ -500,7 +391,9 @@ export default { methods: { /** 查询微信用户记录列表 */ getList() { - this.loading = true; + this.loading = true; + this.queryParams.beginTime = this.logTimeScope && this.logTimeScope.length > 0 ? this.logTimeScope[0] : null; + this.queryParams.endTime = this.logTimeScope && this.logTimeScope.length > 0 ? this.logTimeScope[1] : null; listWxUserLog(this.queryParams).then((response) => { this.wxUserLogList = response.rows; this.total = response.total; @@ -573,6 +466,7 @@ export default { /** 重置按钮操作 */ resetQuery() { this.resetForm("queryForm"); + this.logTimeScope = null; this.handleQuery(); }, // 多选框选中数据 @@ -589,12 +483,8 @@ export default { }, /** 修改按钮操作 */ handleUpdate(row) { - this.reset(); - const id = row.id || this.ids; - getWxUserLog(id).then((response) => { - this.form = response.data; - this.open = true; - this.title = "修改微信用户记录"; + this.$refs.punchLogEditRef.showDialog(row, () => { + this.getList(); }); }, /** 提交按钮 */ @@ -626,7 +516,7 @@ export default { handleDelete(row) { const ids = row.id || this.ids; this.$confirm( - '是否确认删除微信用户记录编号为"' + ids + '"的数据项?', + '是否确认删除该用户的打卡记录?', "警告", { confirmButtonText: "确定",