From 791db583ef7fd91b88d7b56f0d2ca049c708252d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B8=85?= Date: Fri, 30 May 2025 17:44:20 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/WxClockController.java | 43 +++ .../business/domain/WxPayRecord.java | 4 - .../business/domain/bo/CodeLoginBo.java | 10 + .../business/domain/bo/WxPayRecordBo.java | 6 - .../domain/bo/WxProprietorLedgerBo.java | 2 - .../business/domain/vo/WxPayRecordVo.java | 6 - .../business/service/WxUserLoginService.java | 12 +- .../service/impl/WxPayRecordServiceImpl.java | 4 +- propertyManagement-ui/package.json | 1 + .../src/api/business/clock.js | 9 + .../src/views/business/clock/index.vue | 29 +- .../src/views/business/clock/info/index.vue | 267 ++++++++++++++++++ .../src/views/business/payRecord/index.vue | 20 +- .../views/business/proprietorLedger/index.vue | 14 +- 14 files changed, 385 insertions(+), 42 deletions(-) create mode 100644 propertyManagement-ui/src/views/business/clock/info/index.vue diff --git a/propertyManagement-admin/src/main/java/com/propertyManagement/web/controller/business/WxClockController.java b/propertyManagement-admin/src/main/java/com/propertyManagement/web/controller/business/WxClockController.java index dadb3bf..856e61d 100644 --- a/propertyManagement-admin/src/main/java/com/propertyManagement/web/controller/business/WxClockController.java +++ b/propertyManagement-admin/src/main/java/com/propertyManagement/web/controller/business/WxClockController.java @@ -1,9 +1,17 @@ package com.propertyManagement.web.controller.business; import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.propertyManagement.business.domain.WxClock; import com.propertyManagement.business.domain.bo.WxClockBo; import com.propertyManagement.business.domain.vo.WxClockVo; +import com.propertyManagement.business.domain.vo.WxClockVo2; +import com.propertyManagement.business.mapper.WxClockMapper; import com.propertyManagement.business.service.IWxClockService; +import com.propertyManagement.business.support.util.AuthUtil; import com.propertyManagement.common.annotation.Log; import com.propertyManagement.common.annotation.RepeatSubmit; import com.propertyManagement.common.core.controller.BaseController; @@ -22,7 +30,9 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.Arrays; +import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 打卡 @@ -38,6 +48,8 @@ public class WxClockController extends BaseController { private final IWxClockService iWxClockService; + private final WxClockMapper wxClockMapper; + /** * 查询打卡列表 */ @@ -47,6 +59,37 @@ public class WxClockController extends BaseController { return iWxClockService.queryPageList(bo, pageQuery); } + /** + * 查询打卡列表 + */ + @GetMapping("/info") + public R info(@NotNull Long accountId ,@NotNull(message = "日期不能为空") String date) { + WxClockVo2 wxClockVo2 = new WxClockVo2(); + // 解析传入的日期参数 + DateTime inputDate = DateUtil.parse(date, "yyyy-MM"); + // 获取本月第一天和最后一天 + DateTime beginOfMonth = DateUtil.beginOfMonth(inputDate); + DateTime endOfMonth = DateUtil.endOfMonth(inputDate); + // 生成本月所有日期列表 + List dateTimes = DateUtil.rangeToList(beginOfMonth, endOfMonth, DateField.DAY_OF_MONTH); + // 并行处理提高效率 + List clockRecordList = dateTimes.parallelStream() + .map(item -> { + String dateStr = DateUtil.format(item, "yyyy-MM-dd"); + int count = Math.toIntExact(wxClockMapper.selectCount(Wrappers.lambdaQuery() + .apply("DATE(clock_time) = {0}", dateStr) + .eq(WxClock::getAccountId, accountId))); + return new WxClockVo2.ClockRecord(dateStr, count > 0 ? 1 : 0); + }) + .collect(Collectors.toList()); + // 计算打卡和缺卡天数 + long clockDays = clockRecordList.stream().filter(r -> r.getClockState() == 1).count(); + wxClockVo2.setClockDay((int) clockDays); + wxClockVo2.setNoRecordDay(clockRecordList.size() - (int) clockDays); + wxClockVo2.setClockRecordList(clockRecordList); + return R.ok(wxClockVo2); + } + /** * 导出打卡列表 */ diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/WxPayRecord.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/WxPayRecord.java index 7f34fd2..dd2fd10 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/WxPayRecord.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/WxPayRecord.java @@ -100,9 +100,5 @@ public class WxPayRecord extends BaseEntity { * 平台支付流水号 */ private String outTradeNo; - /** - * 通道支付流水号 - */ - private String tradeNo; } diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/CodeLoginBo.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/CodeLoginBo.java index f6dc3b1..93a0b95 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/CodeLoginBo.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/CodeLoginBo.java @@ -25,4 +25,14 @@ public class CodeLoginBo { private double longitude; // 经度 private double latitude; // 纬度 + /** + * 加密数据 + */ + private String encryptedData; + + /** + * 偏移量 + */ + private String iv; + } diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/WxPayRecordBo.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/WxPayRecordBo.java index fa5d3b4..cb7fea8 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/WxPayRecordBo.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/WxPayRecordBo.java @@ -133,10 +133,4 @@ public class WxPayRecordBo extends BaseEntity { */ private String outTradeNo; - /** - * 通道支付流水号 - */ - private String tradeNo; - - } diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/WxProprietorLedgerBo.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/WxProprietorLedgerBo.java index 262df98..3f89122 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/WxProprietorLedgerBo.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/bo/WxProprietorLedgerBo.java @@ -96,7 +96,6 @@ public class WxProprietorLedgerBo extends BaseEntity { * 出生日期 */ @JsonFormat(pattern = "YYYY-MM-dd") - @NotNull(message = "出生日期不能为空", groups = { AddGroup.class, EditGroup.class }) private Date birthDate; /** @@ -108,7 +107,6 @@ public class WxProprietorLedgerBo extends BaseEntity { /** * 户籍地 */ - @NotBlank(message = "户籍地不能为空", groups = { AddGroup.class, EditGroup.class }) private String registerAddress; /** diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/vo/WxPayRecordVo.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/vo/WxPayRecordVo.java index a0aaef8..805c173 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/vo/WxPayRecordVo.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/domain/vo/WxPayRecordVo.java @@ -122,11 +122,5 @@ public class WxPayRecordVo implements Serializable { @ExcelProperty(value = "平台支付流水号") private String outTradeNo; - /** - * 通道支付流水号 - */ - @ExcelProperty(value = "通道支付流水号") - private String tradeNo; - } diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/service/WxUserLoginService.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/service/WxUserLoginService.java index 9270a18..1e316b6 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/service/WxUserLoginService.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/service/WxUserLoginService.java @@ -3,7 +3,9 @@ package com.propertyManagement.business.service; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; +import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.propertyManagement.business.domain.WxFamilyMember; import com.propertyManagement.business.domain.WxProprietorLedger; @@ -145,8 +147,14 @@ public class WxUserLoginService { } newUser.setOpenId(openId); newUser.setMobile(phoneNumber); - newUser.setNickName(phoneNumber); - newUser.setAvatar("https://llwy-1356792742.cos.ap-beijing.myqcloud.com/%E5%88%A9%E9%BE%99%E7%89%A9%E4%B8%9A%20logo.png"); + if (StringUtils.isNotBlank(bo.getEncryptedData()) && StringUtils.isNotBlank(bo.getIv())) { + WxMaUserInfo userInfo = wxMaDormService.getUserService().getUserInfo(session.getSessionKey(), bo.getEncryptedData(), bo.getIv()); + newUser.setNickName(userInfo.getNickName() + "_" + phoneNumber); + newUser.setAvatar(userInfo.getAvatarUrl()); + }else { + newUser.setNickName(phoneNumber); + newUser.setAvatar("https://llwy-1356792742.cos.ap-beijing.myqcloud.com/%E5%88%A9%E9%BE%99%E7%89%A9%E4%B8%9A%20logo.png"); + } if (bo.getLongitude() > 0 && bo.getLatitude() > 0) { newUser.setLongitude(bo.getLongitude()); newUser.setLatitude(bo.getLatitude()); diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/service/impl/WxPayRecordServiceImpl.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/service/impl/WxPayRecordServiceImpl.java index a8b73a1..80a2a76 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/service/impl/WxPayRecordServiceImpl.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/service/impl/WxPayRecordServiceImpl.java @@ -155,6 +155,9 @@ public class WxPayRecordServiceImpl implements IWxPayRecordService { recordLambdaQueryWrapper.eq(WxPayRecord::getOrderId, orderId); WxPayRecord record = baseMapper.selectOne(recordLambdaQueryWrapper); record.setPayState(PayState.YES.getCode()); + record.setPayChannelCode(payChannelCode); + record.setPayMchCode(payMchCode); + record.setPayAppCode(payAppCode); baseMapper.updateById(record); /** * 更新订单状态 @@ -258,7 +261,6 @@ public class WxPayRecordServiceImpl implements IWxPayRecordService { lqw.eq(bo.getPayAmount() != null, WxPayRecord::getPayAmount, bo.getPayAmount()); lqw.eq(bo.getPayState() != null, WxPayRecord::getPayState, bo.getPayState()); lqw.eq(StringUtils.isNotBlank(bo.getOutTradeNo()), WxPayRecord::getOutTradeNo, bo.getOutTradeNo()); - lqw.eq(StringUtils.isNotBlank(bo.getTradeNo()), WxPayRecord::getTradeNo, bo.getTradeNo()); return lqw; } diff --git a/propertyManagement-ui/package.json b/propertyManagement-ui/package.json index 98f5a26..dc56b01 100644 --- a/propertyManagement-ui/package.json +++ b/propertyManagement-ui/package.json @@ -40,6 +40,7 @@ "axios": "0.24.0", "clipboard": "2.0.8", "core-js": "3.25.3", + "dayjs": "^1.11.13", "echarts": "5.4.0", "element-ui": "2.15.13", "file-saver": "2.0.5", diff --git a/propertyManagement-ui/src/api/business/clock.js b/propertyManagement-ui/src/api/business/clock.js index 83fdee6..125fca7 100644 --- a/propertyManagement-ui/src/api/business/clock.js +++ b/propertyManagement-ui/src/api/business/clock.js @@ -9,6 +9,15 @@ export function listClock(query) { }) } +// 查询打卡列表 +export function listClockInfo(params) { + return request({ + url: '/business/clock/info', + method: 'get', + params: params + }) +} + // 查询打卡详细 export function getClock(clockId) { return request({ diff --git a/propertyManagement-ui/src/views/business/clock/index.vue b/propertyManagement-ui/src/views/business/clock/index.vue index 3123364..46a1249 100644 --- a/propertyManagement-ui/src/views/business/clock/index.vue +++ b/propertyManagement-ui/src/views/business/clock/index.vue @@ -114,8 +114,8 @@ - - + + + 取 消 + + + + + + diff --git a/propertyManagement-ui/src/views/business/payRecord/index.vue b/propertyManagement-ui/src/views/business/payRecord/index.vue index 117426e..76e9399 100644 --- a/propertyManagement-ui/src/views/business/payRecord/index.vue +++ b/propertyManagement-ui/src/views/business/payRecord/index.vue @@ -22,14 +22,14 @@ @keyup.enter.native="handleQuery" /> - - - + + + + + + + + - + - +