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 949b70455..9b7ee8d01 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 @@ -2,7 +2,11 @@ package com.stdiet.web.controller; import com.stdiet.common.config.AliyunOSSConfig; import com.stdiet.common.utils.oss.AliyunOSSUtils; +import com.stdiet.custom.domain.SysWxUserInfo; +import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper; +import com.stdiet.custom.mapper.SysWxUserInfoMapper; +import com.stdiet.custom.mapper.SysWxUserLogMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; @@ -10,18 +14,36 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import java.io.File; +import java.util.List; @Component @Order(value = 1) public class MyApplicationRunner implements ApplicationRunner { @Autowired - private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper; + private SysWxUserLogMapper sysWxUserLogMapper; + + @Autowired + private SysWxUserInfoMapper sysWxUserInfoMapper; @Override public void run(ApplicationArguments args) throws Exception { - System.out.println("项目启动调用方法"); -// String path = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix,"ceshi.png",new File("D:\\ceshi.png")); -// System.out.println(path); + /*System.out.println("项目启动调用方法"); + List phoneList = sysWxUserLogMapper.getAllSysWxUserLogPhone(); + SysWxUserLog sysWxUserLog = new SysWxUserLog(); + if(phoneList.size() > 0){ + for (String phone : phoneList) { + System.out.println(phone); + SysWxUserInfo sysWxUserInfo = new SysWxUserInfo(); + sysWxUserInfo.setPhone(phone); + List list = sysWxUserInfoMapper.selectSysWxUserInfoList(sysWxUserInfo); + if(list != null && list.size() > 0){ + sysWxUserLog.setOpenid(list.get(0).getOpenid()); + sysWxUserLog.setPhone(phone); + sysWxUserLogMapper.updateSysWxUserLog(sysWxUserLog); + } + } + }*/ + } } 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 a7454ae6a..0faf52b4a 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 @@ -14,6 +14,7 @@ import com.stdiet.custom.page.WxLogInfo; import com.stdiet.custom.service.ISysOrderService; import com.stdiet.custom.service.ISysWxUserInfoService; import com.stdiet.custom.service.ISysWxUserLogService; +import org.aspectj.weaver.loadtime.Aj; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -47,14 +48,8 @@ public class SysWxUserLogController extends BaseController { List list = sysWxUserLogService.selectSysWxUserLogList(sysWxUserLog); for (SysWxUserLog userLog : list) { - if(userLog.getCustomerMessage() != null){ - String[] message = userLog.getCustomerMessage().split(","); - userLog.setCustomer(message[0]); - userLog.setNutritionist(message.length > 1 ? message[1] : ""); - } if (StringUtils.isNotEmpty(userLog.getPhone())) { userLog.setPhone(StringUtils.hiddenPhoneNumber(userLog.getPhone())); - //userLog.setPhone(userLog.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")); } } @@ -69,6 +64,11 @@ public class SysWxUserLogController extends BaseController { @GetMapping("/export") public AjaxResult export(SysWxUserLog sysWxUserLog) { List list = sysWxUserLogService.selectSysWxUserLogList(sysWxUserLog); + for (SysWxUserLog userLog : list) { + if (StringUtils.isNotEmpty(userLog.getPhone())) { + userLog.setPhone(StringUtils.hiddenPhoneNumber(userLog.getPhone())); + } + } ExcelUtil util = new ExcelUtil(SysWxUserLog.class); return util.exportExcel(list, "wxUserLog"); } @@ -77,9 +77,11 @@ public class SysWxUserLogController extends BaseController { * 获取微信用户记录详细信息 */ @PreAuthorize("@ss.hasPermi('custom:wxUserLog:query')") - @GetMapping(value = "/{openid}") - public AjaxResult getInfo(@PathVariable("openid") String openid) { - return AjaxResult.success(sysWxUserLogService.selectSysWxUserLogById(openid)); + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { + SysWxUserLog sysWxUserLog = sysWxUserLogService.selectSysWxUserLogById(id); + System.out.println(sysWxUserLog.getPhone()); + return AjaxResult.success(sysWxUserLog); } /** @@ -89,7 +91,9 @@ public class SysWxUserLogController extends BaseController { @Log(title = "微信用户记录", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysWxUserLog sysWxUserLog) { - return toAjax(sysWxUserLogService.insertSysWxUserLog(sysWxUserLog)); + //暂时不开放后台增加打卡,因为无法获取到openid + //return toAjax(sysWxUserLogService.insertSysWxUserLog(sysWxUserLog)); + return AjaxResult.error("新增打卡功能暂时关闭"); } /** @@ -99,7 +103,15 @@ public class SysWxUserLogController extends BaseController { @Log(title = "微信用户记录", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysWxUserLog sysWxUserLog) { - return toAjax(sysWxUserLogService.updateSysWxUserLog(sysWxUserLog)); + 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 toAjax(sysWxUserLogService.updateSysWxUserLog(sysWxUserLog)); + }else{ + return AjaxResult.error("修改失败"); + } } /** @@ -107,9 +119,9 @@ public class SysWxUserLogController extends BaseController { */ @PreAuthorize("@ss.hasPermi('custom:wxUserLog:remove')") @Log(title = "微信用户记录", businessType = BusinessType.DELETE) - @DeleteMapping("/{openids}") - public AjaxResult remove(@PathVariable String[] openids) { - return toAjax(sysWxUserLogService.deleteSysWxUserLogByIds(openids)); + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) { + return toAjax(sysWxUserLogService.deleteSysWxUserLogByIds(ids)); } @GetMapping(value = "/wx/logs/list") 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 new file mode 100644 index 000000000..3ece761f1 --- /dev/null +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -0,0 +1,181 @@ +package com.stdiet.web.controller.custom; + +import com.itextpdf.io.util.DateTimeUtil; +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.DateUtils; +import com.stdiet.common.utils.StringUtils; +import com.stdiet.common.utils.oss.AliyunOSSUtils; +import com.stdiet.common.utils.sign.AesUtils; +import com.stdiet.custom.domain.*; +import com.stdiet.custom.dto.response.CustomerCaseResponse; +import com.stdiet.custom.page.WxLogInfo; +import com.stdiet.custom.service.ISysCustomerCaseService; +import com.stdiet.custom.service.ISysOrderService; +import com.stdiet.custom.service.ISysWxUserInfoService; +import com.stdiet.custom.service.ISysWxUserLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.*; + +/** + * 微信小程序统一Controller + */ +@RestController +@RequestMapping("/wx/applet") +public class WechatAppletController extends BaseController { + + + @Autowired + private ISysCustomerCaseService sysCustomerCaseService; + + @Autowired + private ISysWxUserLogService sysWxUserLogService; + + @Autowired + private ISysWxUserInfoService sysWxUserInfoService; + + @Autowired + private ISysOrderService sysOrderService; + + /** + * 查询微信小程序中展示的客户案例 + */ + @GetMapping("/caseList") + public TableDataInfo caseList(SysCustomerCase sysCustomerCase) + { + startPage(); + sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null); + List list = sysCustomerCaseService.getWxCustomerCaseList(sysCustomerCase); + //处理ID加密 + dealIdEnc(list); + return getDataTable(list); + } + + /** + * 查询客户案例文件列表 + */ + @GetMapping("/getFileByCaseId") + public AjaxResult getFileByCaseId(@RequestParam("caseId")String caseId) + { + Long id = StringUtils.isNotEmpty(caseId) ? Long.parseLong(AesUtils.decrypt(caseId, null)) : null; + CustomerCaseResponse customerCaseResponse = new CustomerCaseResponse(); + customerCaseResponse.setId(caseId); + if(id != null){ + List list = sysCustomerCaseService.getFileListByCaseId(id); + List fileUrl = new ArrayList<>(); + for (SysCustomerCaseFile caseFile : list) { + fileUrl.add(caseFile.getFileUrl()); + } + List downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl); + customerCaseResponse.setFileList(downUrlList); + }else{ + customerCaseResponse.setFileList(new ArrayList<>()); + } + return AjaxResult.success(customerCaseResponse); + } + + /** + * 同步客户信息,返回订单数量 + * @param sysWxUserInfo + * @return + */ + @PostMapping("/synchroCustomerInfo") + public AjaxResult synchroCustomerInfo(@RequestBody SysWxUserInfo sysWxUserInfo) { + if(StringUtils.isEmpty(sysWxUserInfo.getOpenid()) || StringUtils.isEmpty(sysWxUserInfo.getPhone())){ + return AjaxResult.error("手机号为空"); + } + // 查询微信用户 + SysWxUserInfo userInfo = sysWxUserInfoService.selectSysWxUserInfoById(sysWxUserInfo.getOpenid()); + if(userInfo != null){ + //更新数据 + sysWxUserInfoService.updateSysWxUserInfo(sysWxUserInfo); + }else{ + sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo); + } + return AjaxResult.success(); + } + + /** + * 微信小程序获取客户打卡记录 + * @param sysWxUserLog + * @return + */ + @GetMapping(value = "/getPunchLogs") + public AjaxResult getPunchLogs(SysWxUserLog sysWxUserLog) { + if(StringUtils.isEmpty(sysWxUserLog.getPhone()) && StringUtils.isEmpty(sysWxUserLog.getOpenid())){ + return AjaxResult.error(5001, "缺少参数"); + } + //查询是否下单 + SysCustomer param = new SysCustomer(); + param.setPhone(sysWxUserLog.getPhone()); + int orderCount = sysOrderService.getOrderCountByCustomer(param); + if(orderCount > 0){ + Map result = new HashMap<>(); + //今日是否已打卡 + boolean isPunch = false; + startPage(); + List list = sysWxUserLogService.getWxLogInfoList(sysWxUserLog); + if(list.size() > 0){ + WxLogInfo lastLog = list.get(0); + if(lastLog.getDate() != null && ChronoUnit.DAYS.between(DateUtils.stringToLocalDate(lastLog.getDate(), "yyyy-MM-dd"), LocalDate.now()) == 0) { + isPunch = true; + } + } + Collections.reverse(list); + TableDataInfo tableDataInfo = getDataTable(list); + result.put("isPunch", isPunch); + result.put("tableDataInfo", tableDataInfo); + return AjaxResult.success(result); + }else{ + return AjaxResult.error(5002, "未查询到相关订单信息"); + } + } + + /** + * 今日是否打卡 + * @param openid + * @return + */ + @GetMapping(value = "/checkNowPunchLog/{openid}") + public AjaxResult checkNowPunchLog(@PathVariable String openid) { + int count = StringUtils.isEmpty(openid) ? 0 : sysWxUserLogService.checkWxLogInfoCount(openid); + return AjaxResult.success(count); + } + + /** + * 微信小程序打卡 + * @param sysWxUserLog + * @return + */ + @PostMapping(value = "/addPunchLog") + public AjaxResult addPunchLog(@RequestBody SysWxUserLog sysWxUserLog) { + // 查询微信用户 + SysWxUserInfo userInfo = StringUtils.isEmpty(sysWxUserLog.getOpenid()) ? null : sysWxUserInfoService.selectSysWxUserInfoById(sysWxUserLog.getOpenid()); + if (userInfo == null || StringUtils.isEmpty(userInfo.getPhone())) { + return AjaxResult.error("不存在客户"); + } + //查询今日是否已打卡 + int count = sysWxUserLogService.checkWxLogInfoCount(sysWxUserLog.getOpenid()); + if(count > 0){ + return AjaxResult.error("今日已打卡,不可重复打卡"); + } + sysWxUserLog.setLogTime(DateTimeUtil.getCurrentTimeDate()); + return toAjax(sysWxUserLogService.insertSysWxUserLog(sysWxUserLog)); + } + + /** + * 处理返回值的ID加密 + * @param list + * @return + */ + private void dealIdEnc(List list){ + for (CustomerCaseResponse cus : list) { + cus.setId(AesUtils.encrypt(cus.getId()+"", null)); + } + } +} 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 a3f414f65..ab9e62641 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 @@ -3,6 +3,7 @@ package com.stdiet.custom.domain; import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.stdiet.common.annotation.Excel; @@ -14,10 +15,13 @@ import com.stdiet.common.core.domain.BaseEntity; * @author wonder * @date 2020-11-29 */ +@Data public class SysWxUserLog extends BaseEntity { private static final long serialVersionUID = 1L; + private Long id; + /** 微信openid */ private String openid; @@ -68,183 +72,18 @@ public class SysWxUserLog extends BaseEntity @JsonFormat(pattern = "yyyy-MM-dd") private Date logTime; - /** 非持久字段,客户姓名 + 营养师姓名,使用 , 隔开,用于接收sql查询返回字段 */ - private String customerMessage; - /** - * 非持久化字段,营养师 + * 非持久化字段,客户姓名 */ @Excel(name = "姓名") - private String customer; + private String customerName; + + //营养师ID + private Long nutritionistId; /** * 非持久化字段,营养师 */ @Excel(name = "营养师") private String nutritionist; - - public void setLogTime(Date logTime) { - this.logTime = logTime; - } - - public Date getLogTime() { - return logTime; - } - - public void setOpenid(String openid) - { - this.openid = openid; - } - - public String getOpenid() - { - return openid; - } - public void setWeight(BigDecimal weight) - { - this.weight = weight; - } - - public BigDecimal getWeight() - { - return weight; - } - public void setAppid(String appid) - { - this.appid = appid; - } - - public String getAppid() - { - return appid; - } - public void setPhone(String phone) - { - this.phone = phone; - } - - public String getPhone() - { - return phone; - } - public void setSleepTime(String sleepTime) - { - this.sleepTime = sleepTime; - } - - public String getSleepTime() - { - return sleepTime; - } - public void setWakeupTime(String wakeupTime) - { - this.wakeupTime = wakeupTime; - } - - public String getWakeupTime() - { - return wakeupTime; - } - public void setSport(String sport) - { - this.sport = sport; - } - - public String getSport() - { - return sport; - } - public void setAvatarUrl(String avatarUrl) - { - this.avatarUrl = avatarUrl; - } - - public String getAvatarUrl() - { - return avatarUrl; - } - public void setDiet(String diet) - { - this.diet = diet; - } - - public String getDiet() - { - return diet; - } - public void setInsomnia(String insomnia) - { - this.insomnia = insomnia; - } - - public String getInsomnia() - { - return insomnia; - } - public void setDefecation(String defecation) - { - this.defecation = defecation; - } - - public String getDefecation() - { - return defecation; - } - public void setWater(Long water) - { - this.water = water; - } - - public Long getWater() - { - return water; - } - - public String getCustomerMessage() { - return customerMessage; - } - - public void setCustomerMessage(String customerMessage) { - this.customerMessage = customerMessage; - } - - public String getCustomer() { - return customer; - } - - public void setCustomer(String customer) { - this.customer = customer; - } - - public String getNutritionist() { - return nutritionist; - } - - public void setNutritionist(String nutritionist) { - this.nutritionist = nutritionist; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("openid", getOpenid()) - .append("weight", getWeight()) - .append("appid", getAppid()) - .append("phone", getPhone()) - .append("sleepTime", getSleepTime()) - .append("wakeupTime", getWakeupTime()) - .append("sport", getSport()) - .append("avatarUrl", getAvatarUrl()) - .append("diet", getDiet()) - .append("insomnia", getInsomnia()) - .append("defecation", getDefecation()) - .append("water", getWater()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .append("logTime", getLogTime()) - .toString(); - } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java index e23a0259e..8662f4b91 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java @@ -5,6 +5,7 @@ import java.util.List; import com.stdiet.custom.domain.SysCommision; import com.stdiet.custom.domain.SysCommissionDayDetail; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysOrder; import com.stdiet.custom.dto.request.SysOrderCommision; import org.apache.ibatis.annotations.Param; @@ -77,4 +78,11 @@ public interface SysOrderMapper * @return */ List selectSimpleOrderMessage(SysCommision sysCommision); + + /** + * 查询客户订单数量 + * @param sysCustomer + * @return + */ + int getOrderCountByCustomer(SysCustomer sysCustomer); } \ No newline at end of file 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 7659f8368..4cb68978e 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 @@ -41,7 +41,7 @@ public interface SysWxUserLogMapper public int insertSysWxUserLog(SysWxUserLog sysWxUserLog); /** - * 修改微信用户记录 + * 修改微信用户打卡记录 * * @param sysWxUserLog 微信用户记录 * @return 结果 @@ -49,21 +49,33 @@ public interface SysWxUserLogMapper public int updateSysWxUserLog(SysWxUserLog sysWxUserLog); /** - * 删除微信用户记录 - * - * @param openid 微信用户记录ID - * @return 结果 + * 根据ID删除打卡记录 + * @param id + * @return */ - public int deleteSysWxUserLogById(String openid); + public int deleteSysWxUserLogById(Long id); /** - * 批量删除微信用户记录 + * 批量删除微信用户打卡记录 * - * @param openids 需要删除的数据ID + * @param ids 需要删除的数据ID * @return 结果 */ - public int deleteSysWxUserLogByIds(String[] openids); + public int deleteSysWxUserLogByIds(String[] ids); public int checkWxLogInfoCount(String openid); + /** + * 根据openid和手机号查询打卡记录 + * @return + */ + public List getWxLogInfoList(SysWxUserLog sysWxUserLog); + + /** + * 根据日期和openid查询打卡记录 + * @param sysWxUserLog + * @return + */ + SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderService.java index e641dcb76..8daa51afe 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderService.java @@ -3,6 +3,8 @@ package com.stdiet.custom.service; import java.math.BigDecimal; import java.util.Date; import java.util.List; + +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysOrder; /** @@ -75,4 +77,11 @@ public interface ISysOrderService * @return */ int updateOrderServerEndDate(Long orderId, boolean updatePlan); + + /** + * 查询客户订单数量 + * @param sysCustomer + * @return + */ + int getOrderCountByCustomer(SysCustomer sysCustomer); } \ 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 13f586caa..4d0041035 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 @@ -17,10 +17,10 @@ public interface ISysWxUserLogService /** * 查询微信用户记录 * - * @param openid 微信用户记录ID + * @param id 微信用户记录ID * @return 微信用户记录 */ - public SysWxUserLog selectSysWxUserLogById(String openid); + public SysWxUserLog selectSysWxUserLogById(String id); /** * 查询微信用户记录列表 @@ -51,18 +51,32 @@ public interface ISysWxUserLogService /** * 批量删除微信用户记录 * - * @param openids 需要删除的微信用户记录ID + * @param ids 需要删除的微信用户记录ID * @return 结果 */ - public int deleteSysWxUserLogByIds(String[] openids); + public int deleteSysWxUserLogByIds(String[] ids); /** * 删除微信用户记录信息 * - * @param openid 微信用户记录ID + * @param id 微信用户记录ID * @return 结果 */ - public int deleteSysWxUserLogById(String openid); + public int deleteSysWxUserLogById(Long id); public int checkWxLogInfoCount(String openid); + + /** + * 根据openid和手机号查询打卡记录 + * @return + */ + public List getWxLogInfoList(SysWxUserLog sysWxUserLog); + + /** + * 根据日期和openid查询打卡记录 + * @param sysWxUserLog + * @return + */ + SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java index c822e243c..27c17c8e9 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java @@ -4,6 +4,7 @@ import com.stdiet.common.annotation.Excel; import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.SecurityUtils; import com.stdiet.common.utils.StringUtils; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysOrder; import com.stdiet.custom.mapper.SysOrderMapper; import com.stdiet.custom.service.ISysCommissionDayService; @@ -326,4 +327,13 @@ public class SysOrderServiceImpl implements ISysOrderService { //删除食谱计划 sysRecipesPlanService.delRecipesPlanByOrderId(orderIds); } + + /** + * 查询客户订单数量 + * @param sysCustomer + * @return + */ + public int getOrderCountByCustomer(SysCustomer sysCustomer){ + return sysOrderMapper.getOrderCountByCustomer(sysCustomer); + } } \ 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 bb0e5e4db..00fb9602d 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 @@ -25,12 +25,12 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService { /** * 查询微信用户记录 * - * @param openid 微信用户记录ID + * @param id 微信用户记录ID * @return 微信用户记录 */ @Override - public SysWxUserLog selectSysWxUserLogById(String openid) { - return sysWxUserLogMapper.selectSysWxUserLogById(openid); + public SysWxUserLog selectSysWxUserLogById(String id) { + return sysWxUserLogMapper.selectSysWxUserLogById(id); } /** @@ -76,23 +76,23 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService { /** * 批量删除微信用户记录 * - * @param openids 需要删除的微信用户记录ID + * @param ids 需要删除的微信用户记录ID * @return 结果 */ @Override - public int deleteSysWxUserLogByIds(String[] openids) { - return sysWxUserLogMapper.deleteSysWxUserLogByIds(openids); + public int deleteSysWxUserLogByIds(String[] ids) { + return sysWxUserLogMapper.deleteSysWxUserLogByIds(ids); } /** * 删除微信用户记录信息 * - * @param openid 微信用户记录ID + * @param id 微信用户记录ID * @return 结果 */ @Override - public int deleteSysWxUserLogById(String openid) { - return sysWxUserLogMapper.deleteSysWxUserLogById(openid); + public int deleteSysWxUserLogById(Long id) { + return sysWxUserLogMapper.deleteSysWxUserLogById(id); } @Override @@ -100,5 +100,22 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService { return sysWxUserLogMapper.checkWxLogInfoCount(openid); } + /** + * 根据openid和手机号查询打卡记录 + * @return + */ + @Override + public List getWxLogInfoList(SysWxUserLog sysWxUserLog){ + return sysWxUserLogMapper.getWxLogInfoList(sysWxUserLog); + } + + /** + * 根据日期和openid查询打卡记录 + * @param sysWxUserLog + * @return + */ + public SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog){ + return sysWxUserLogMapper.selectSysWxUserLogByDateAndOpenId(sysWxUserLog); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index 89ef8a168..4c14602a2 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -35,15 +35,15 @@ diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml index dbe0d15f2..dff79ab11 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml @@ -408,4 +408,16 @@ order by o.order_time desc + + + \ 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 e14a6e8f8..c726b5f43 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml @@ -5,6 +5,7 @@ + @@ -25,7 +26,9 @@ - + + + @@ -41,28 +44,30 @@ - select openid, weight, appid, phone, log_time, sleep_time, wakeup_time, sport, avatar_url, diet, insomnia, defecation, water, create_by, create_time, update_by, update_time, remark from sys_wx_user_log - - - - swul.openid, swul.weight, swul.appid, swul.phone, swul.log_time, swul.sleep_time, swul.wakeup_time, swul.sport, swul.avatar_url, swul.diet, swul.insomnia, - swul.defecation, swul.water, swul.create_by, swul.create_time, swul.update_by, swul.update_time, swul.remark + select id,openid, weight, appid, phone, log_time, sleep_time, wakeup_time, sport, avatar_url, diet, insomnia, defecation, water, create_by, create_time, update_by, update_time, remark from sys_wx_user_log + - where openid = #{openid} + where id = #{id} @@ -133,6 +138,7 @@ update sys_wx_user_log + openid = #{openid}, weight = #{weight}, appid = #{appid}, phone = #{phone}, @@ -151,18 +157,30 @@ update_time = #{updateTime}, remark = #{remark}, - where openid = #{openid} + where id = #{id} - - delete from sys_wx_user_log where openid = #{openid} + + delete from sys_wx_user_log where id = #{id} - delete from sys_wx_user_log where openid in - - #{openid} + delete from sys_wx_user_log where id in + + #{id} + + + + + \ No newline at end of file diff --git a/stdiet-ui/src/views/custom/wxUserLog/index.vue b/stdiet-ui/src/views/custom/wxUserLog/index.vue index 584d657b4..cc8bd7433 100644 --- a/stdiet-ui/src/views/custom/wxUserLog/index.vue +++ b/stdiet-ui/src/views/custom/wxUserLog/index.vue @@ -11,10 +11,10 @@ /> - + - + @@ -86,21 +86,21 @@ - + - + - + - + @@ -114,7 +114,6 @@ {{`${scope.row.water} ml`}} -