From 321cfdeb1a770c040e70eb7116d9311078000c9a Mon Sep 17 00:00:00 2001 From: "382696293@qq.com" <382696293@qq.com> Date: Tue, 5 Mar 2024 11:53:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=A1=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/domain/entity/WxMemberClockLog.java | 10 + .../core/domain/export/WxClockLogExport.java | 118 ++++++ .../core/domain/req/WxClockLogExportVm.java | 31 ++ .../resources/mapper/WxClockLogMapper.xml | 2 + .../controller/WxClockLogController.java | 98 ++++- .../system/service/IWxClockLogService.java | 2 +- .../service/impl/WxClockLogServiceImpl.java | 8 +- flossom-ui/src/api/system/clockLog.js | 17 + .../src/views/system/clockLog/index.vue | 363 +++++++++++++++++- 9 files changed, 621 insertions(+), 28 deletions(-) create mode 100644 flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/export/WxClockLogExport.java create mode 100644 flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxClockLogExportVm.java diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxMemberClockLog.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxMemberClockLog.java index ea6bfc8..586edb4 100644 --- a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxMemberClockLog.java +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxMemberClockLog.java @@ -41,6 +41,8 @@ public class WxMemberClockLog { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date lastClockTime; + private String instrumentName; + public Integer getClockNum() { return clockNum; @@ -113,4 +115,12 @@ public class WxMemberClockLog { public void setLastClockTime(Date lastClockTime) { this.lastClockTime = lastClockTime; } + + public String getInstrumentName() { + return instrumentName; + } + + public void setInstrumentName(String instrumentName) { + this.instrumentName = instrumentName; + } } diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/export/WxClockLogExport.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/export/WxClockLogExport.java new file mode 100644 index 0000000..4f2db51 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/export/WxClockLogExport.java @@ -0,0 +1,118 @@ +package com.flossom.common.core.domain.export; + +import com.flossom.common.core.annotation.Excel; + +import java.time.LocalTime; +import java.util.Date; + +/** + * 用户护理日志对象 + * + * @author flossom + * @date 2024-01-29 + */ +public class WxClockLogExport { + + @Excel(name = "会员昵称") + private String nickname; + + @Excel(name = "用户编号") + private Long userId; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "仪器名称") + private String instrumentName; + + @Excel(name = "最新打卡时间", dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lastClockTime; + + @Excel(name = "小程序标签") + private String miniProgramTagListStr; + + @Excel(name = "累计打卡天数") + private Integer clockNum; + + @Excel(name = "外部标签") + private String wecomTagListStr; + + @Excel(name = "用户注册时间", dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date memberRegisterDate; + + + public WxClockLogExport() { + } + + public String getNickname() { + return nickname; + } + + public void setNickname(String nickname) { + this.nickname = nickname; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getInstrumentName() { + return instrumentName; + } + + public void setInstrumentName(String instrumentName) { + this.instrumentName = instrumentName; + } + + public Date getLastClockTime() { + return lastClockTime; + } + + public void setLastClockTime(Date lastClockTime) { + this.lastClockTime = lastClockTime; + } + + public String getMiniProgramTagListStr() { + return miniProgramTagListStr; + } + + public void setMiniProgramTagListStr(String miniProgramTagListStr) { + this.miniProgramTagListStr = miniProgramTagListStr; + } + + public Integer getClockNum() { + return clockNum; + } + + public void setClockNum(Integer clockNum) { + this.clockNum = clockNum; + } + + public String getWecomTagListStr() { + return wecomTagListStr; + } + + public void setWecomTagListStr(String wecomTagListStr) { + this.wecomTagListStr = wecomTagListStr; + } + + public Date getMemberRegisterDate() { + return memberRegisterDate; + } + + public void setMemberRegisterDate(Date memberRegisterDate) { + this.memberRegisterDate = memberRegisterDate; + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxClockLogExportVm.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxClockLogExportVm.java new file mode 100644 index 0000000..d6a1d12 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxClockLogExportVm.java @@ -0,0 +1,31 @@ +package com.flossom.common.core.domain.req; + +import java.util.ArrayList; +import java.util.List; + +public class WxClockLogExportVm extends UserClockLogReq { + + /** + * 自定导出字段 + */ + private List exportFields = new ArrayList<>(); + + private List idList = new ArrayList<>(); + + + public List getExportFields() { + return exportFields; + } + + public void setExportFields(List exportFields) { + this.exportFields = exportFields; + } + + public List getIdList() { + return idList; + } + + public void setIdList(List idList) { + this.idList = idList; + } +} diff --git a/flossom-common/flossom-common-core/src/main/resources/mapper/WxClockLogMapper.xml b/flossom-common/flossom-common-core/src/main/resources/mapper/WxClockLogMapper.xml index 4deabdb..4f3a7ac 100644 --- a/flossom-common/flossom-common-core/src/main/resources/mapper/WxClockLogMapper.xml +++ b/flossom-common/flossom-common-core/src/main/resources/mapper/WxClockLogMapper.xml @@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -93,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT user_id, MAX( update_time ) AS last_clock_time, + GROUP_CONCAT(instrument_name) AS instrument_name, count( 1 ) AS clock_num FROM wx_clock_log diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxClockLogController.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxClockLogController.java index ade7dfc..0ec3809 100644 --- a/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxClockLogController.java +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxClockLogController.java @@ -1,27 +1,31 @@ package com.flossom.system.controller; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; +import com.flossom.common.core.domain.R; import com.flossom.common.core.domain.entity.WxClockLog; import com.flossom.common.core.domain.entity.WxMemberClockLog; +import com.flossom.common.core.domain.export.WxClockLogExport; import com.flossom.common.core.domain.req.UserClockLogReq; +import com.flossom.common.core.domain.req.WxClockLogExportVm; +import com.flossom.common.core.exception.ServiceException; +import com.flossom.common.core.utils.poi.ExcelUtil; import com.flossom.common.core.web.controller.BaseController; import com.flossom.common.core.web.domain.AjaxResult; import com.flossom.common.core.web.page.TableDataInfo; import com.flossom.common.log.annotation.Log; import com.flossom.common.log.enums.BusinessType; import com.flossom.common.security.annotation.RequiresPermissions; +import com.flossom.system.service.IWxUserMemberService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.flossom.system.service.IWxClockLogService; +import javax.servlet.http.HttpServletResponse; + /** * 用户打卡Controller * @@ -35,13 +39,16 @@ public class WxClockLogController extends BaseController { @Autowired private IWxClockLogService wxClockLogService; + @Autowired + private IWxUserMemberService wxUserMemberService; + /** * 查询用户打卡列表 */ @RequiresPermissions("system:clockLog:list") @GetMapping("/list") public TableDataInfo list(UserClockLogReq userClockLogReq) { - List list = wxClockLogService.selectWxClockLogList(userClockLogReq); + List list = wxClockLogService.selectWxClockLogList(userClockLogReq, true); return getDataTable(list); } @@ -95,4 +102,77 @@ public class WxClockLogController extends BaseController { public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(wxClockLogService.deleteWxClockLogByIds(ids)); } + + /** + * 全量添加小程序标签 + */ + @PostMapping("/allAddMiniProgramTag") + public R allAddMiniProgramTag(@RequestParam("tagIdList") List tagIdList, @RequestBody UserClockLogReq userClockLogReq) { + if (tagIdList == null || tagIdList.size() == 0) { + logger.error("参数有误"); + throw new ServiceException("参数有误"); + } + List list = wxClockLogService.selectWxClockLogList(userClockLogReq, true); + if (list != null && list.size() > 0) { + List collect = list.stream().map(wxMemberClockLog -> wxMemberClockLog.getUserId().intValue()).collect(Collectors.toList()); + wxUserMemberService.batchAddMiniProgramTag(tagIdList, collect); + } + return R.ok(); + } + + /** + * 全量 删除小程序标签 + */ + @PostMapping("/allDelMiniProgramTag") + public R allDelMiniProgramTag(@RequestParam("tagIdList") List tagIdList, @RequestBody UserClockLogReq userClockLogReq) { + if (tagIdList == null || tagIdList.size() == 0) { + logger.error("参数有误"); + throw new ServiceException("参数有误"); + } + List list = wxClockLogService.selectWxClockLogList(userClockLogReq, true); + if (list != null && list.size() > 0) { + List collect = list.stream().map(wxMemberClockLog -> wxMemberClockLog.getUserId().intValue()).collect(Collectors.toList()); + wxUserMemberService.batchDelMiniProgramTag(tagIdList, collect); + } + return R.ok(); + } + + + /** + * 批量导出护理记录数据 + */ + @RequiresPermissions("system:nursingLog:export") + @PostMapping("/batchExport") + public void batchExport(HttpServletResponse response, WxClockLogExportVm wxClockLogExportVm) { + List idList = wxClockLogExportVm.getIdList(); + if (idList == null || idList.size() == 0) { + throw new ServiceException("请选择导出数据"); + } + UserClockLogReq userClockLogReq = new UserClockLogReq(); + userClockLogReq.setQueryUserIdList(wxClockLogExportVm.getIdList().stream().map(Integer::longValue).collect(Collectors.toList())); + List list = wxClockLogService.selectWxClockLogList(userClockLogReq, false); + export(response, list, wxClockLogExportVm.getExportFields()); + } + + /** + * 全量导出护理记录数据 + */ + @RequiresPermissions("system:nursingLog:export") + @PostMapping("/allExport") + public void allExport(HttpServletResponse response, WxClockLogExportVm wxClockLogExportVm) { + List list = wxClockLogService.selectWxClockLogList(wxClockLogExportVm, false); + export(response, list, wxClockLogExportVm.getExportFields()); + } + + private static void export(HttpServletResponse response, List list, List exportFields) { + List exportList = new ArrayList<>(); + WxClockLogExport export; + for (WxMemberClockLog wxMemberClockLog : list) { + export = new WxClockLogExport(); + BeanUtils.copyProperties(wxMemberClockLog, export); + exportList.add(export); + } + ExcelUtil util = new ExcelUtil(WxClockLogExport.class); + util.exportExcel(response, exportList, "打卡记录数据", exportFields); + } } diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxClockLogService.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxClockLogService.java index 421d90d..11a2c5d 100644 --- a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxClockLogService.java +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxClockLogService.java @@ -29,7 +29,7 @@ public interface IWxClockLogService { * @param userClockLogReq 用户打卡 * @return 用户打卡集合 */ - public List selectWxClockLogList(UserClockLogReq userClockLogReq); + public List selectWxClockLogList(UserClockLogReq userClockLogReq, boolean isPage); /** * 新增用户打卡 diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxClockLogServiceImpl.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxClockLogServiceImpl.java index 684c37c..267b71f 100644 --- a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxClockLogServiceImpl.java +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxClockLogServiceImpl.java @@ -59,7 +59,7 @@ public class WxClockLogServiceImpl implements IWxClockLogService { * @return 用户打卡 */ @Override - public List selectWxClockLogList(UserClockLogReq userClockLogReq) { + public List selectWxClockLogList(UserClockLogReq userClockLogReq, boolean isPage) { // 查询条件 WxUserMemberVm wxUserMemberVm = new WxUserMemberVm(); if (!(userClockLogReq.getUserIdList() == null && userClockLogReq.getNickname() == null @@ -89,7 +89,9 @@ public class WxClockLogServiceImpl implements IWxClockLogService { } } - PageUtils.startPage(); + if(isPage) { + PageUtils.startPage(); + } List wxClockLogList = wxClockLogMapper.selectMemberClockLogList(userClockLogReq); wxClockLogList.forEach(wxMemberClockLog -> { WxUserMember wxUserMember = wxUserMemberMapper.selectWxUserMemberById(wxMemberClockLog.getUserId()); @@ -162,4 +164,6 @@ public class WxClockLogServiceImpl implements IWxClockLogService { public int deleteWxClockLogById(Long id) { return wxClockLogMapper.deleteWxClockLogById(id); } + + } diff --git a/flossom-ui/src/api/system/clockLog.js b/flossom-ui/src/api/system/clockLog.js index d2d2d48..e02ecca 100644 --- a/flossom-ui/src/api/system/clockLog.js +++ b/flossom-ui/src/api/system/clockLog.js @@ -42,3 +42,20 @@ export function delClockLog(id) { method: 'delete' }) } + +export function allAddMiniProgramTag(tagIdList, data) { + return request({ + url: '/system/clockLog/allAddMiniProgramTag?tagIdList=' + tagIdList, + method: 'post', + data: data + }) +} + +// 全量删除小程序标签 +export function allDelMiniProgramTag(tagIdList, data) { + return request({ + url: '/system/clockLog/allDelMiniProgramTag?tagIdList=' + tagIdList, + method: 'post', + data: data + }) +} diff --git a/flossom-ui/src/views/system/clockLog/index.vue b/flossom-ui/src/views/system/clockLog/index.vue index d2e6a0d..a6fbd82 100644 --- a/flossom-ui/src/views/system/clockLog/index.vue +++ b/flossom-ui/src/views/system/clockLog/index.vue @@ -201,14 +201,7 @@ - - - - - - - - + @@ -218,6 +211,7 @@ plain icon="el-icon-warning" size="mini" + @click="batchOperate()" >确认 @@ -238,7 +232,17 @@ - + + + @@ -253,22 +257,98 @@ :limit.sync="queryParams.pageSize" @pagination="getList" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +