| | |
| | | @PostMapping("/order/getOrderCountByAppUserId") |
| | | R<Long> getOrderCountByAppUserId(@RequestParam("id") Long appUserId); |
| | | |
| | | @GetMapping("/order/getOrderCountByAppUserId/") |
| | | @GetMapping("/order/getConsumeScoreAndPayAmount") |
| | | R<Map<String ,Object>> getConsumeScoreAndPayAmount(@RequestParam("userId") Long userId); |
| | | } |
| | |
| | | @ApiModelProperty(value = "评价id") |
| | | private Long evaluateId; |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String username; |
| | | |
| | | @ApiModelProperty("核销码BASE64") |
| | | private String writeOffCode; |
| | | |
| | |
| | | public static void main(String[] args) { |
| | | String myString = "a123456"; |
| | | System.err.println("MD5 of '" + myString + "' is: " + generateMD5(myString)); |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | String s = encryptPassword("dc483e80a7a0bd9ef71d8cf973673924"); |
| | | System.err.println(s); |
| | | String myString = "123456"; |
| | | String md5String = MD5Generator.generateMD5(myString); |
| | | System.err.println("MD5 of '" + myString + "' is: " + md5String); |
| | | String encryptPassword = encryptPassword(md5String); |
| | | |
| | | System.err.println(matchesPassword("dc483e80a7a0bd9ef71d8cf973673924", "$2a$10$2ZQZbvvVRq3DqaWJ9bzGAe4mQIpF/uGqb2GxMtINatKAP/n1ZKnNO")); |
| | | System.err.println(matchesPassword("", "$2a$10$Mg1l9OMJ/gFTQZmDql.21OVgGulPTQgze/cZWNe5plRpRDRjq79Ju")); |
| | | // a123456 dc483e80a7a0bd9ef71d8cf973673924 $2a$10$FcvtOLhWrHsBv9FsXvNJ2uF4X4KBttT2n.Zuw4wauBUo8HnOcr3PW |
| | | System.err.println(encryptPassword); |
| | | |
| | | System.err.println(matchesPassword(md5String, encryptPassword)); |
| | | System.err.println(matchesPassword(md5String, "$2a$10$D2X6q..oHBr6LwaT/RWAluDkE1TEIpoiNz48rpEaeNiJqz9oHhgci")); |
| | | } |
| | | } |
| | |
| | | return appUserService.mobileLogin(mobileLogin); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/registerAccount") |
| | | @ApiOperation(value = "注册新账号") |
| | | public R<LoginVo> registerAccount(@RequestBody RegisterAccount registerAccount) { |
| | | return appUserService.registerAccount(registerAccount); |
| | | } |
| | | |
| | | @GetMapping("/logout") |
| | | @ApiOperation(value = "登出") |
| | |
| | | userStatistics.setTotalUser(appUserList.size());//总用户数 |
| | | userStatistics.setConsumerUser((int) consumerUser);//消费过的用户 |
| | | |
| | | //用户类型统计门店 |
| | | long shopUserCount = appUserList.stream() |
| | | .filter(appUser -> appUser.getUserType() == 2) |
| | | .count(); |
| | | userStatistics.setShopUser((int) shopUserCount); |
| | | //拥有店铺用户数 |
| | | Integer shopUserCount = appUserShopService.getHaveShopUserNum(); |
| | | |
| | | userStatistics.setShopUser(shopUserCount); |
| | | |
| | | //门店总数 |
| | | long shopNum = shopClient.getAllShop().getData().size(); |
| | |
| | | }else { |
| | | userStatistics.setTotalScore((Long) result.get("total_points")); |
| | | } |
| | | |
| | | //统计消费积分和现金支付数 |
| | | Map<String, Object> data = orderClient.getConsumeScoreAndPayAmount(userId).getData(); |
| | | |
| | | //条件构造 消费积分现金支付金额 |
| | | queryWrapper.clear(); |
| | | QueryWrapper<AppUser> queryWrapper1 = new QueryWrapper<>(); |
| | | queryWrapper1.select("sum(exchange_point + transferable_out_point - cancel_point) as total_points"); |
| | | queryWrapper1.select("sum(shop_amount) as payment_amounts "); |
| | | queryWrapper1.eq("del_flag", 0);//未删除的 |
| | | queryWrapper1.ne("status", 3);//未注销的 |
| | | if (userId != null) { |
| | | queryWrapper1.eq("id", userId); |
| | | } |
| | | Map<String, Object> data = appUserShopService.getPointAndPayAmount(userId); |
| | | if (data == null || data.get("total_points") == null) { |
| | | userStatistics.setConsumeScore(0L); |
| | | }else { |
| | |
| | | }else { |
| | | userStatistics.setShopAmount(new BigDecimal(data.get("payment_amounts").toString())); |
| | | } |
| | | |
| | | |
| | | return R.ok(userStatistics); |
| | | } |
| | |
| | | public R<PageInfo<UserPointStatisticsPageVO>> getUserPointStatisticsPageList(@RequestParam(value = "types",required = false) Collection<Integer> types, |
| | | @RequestParam(value = "name",required = false) String name, |
| | | @RequestParam(value = "phone",required = false) String phone, |
| | | @RequestParam(value = "beginTime",required = false) LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime",required = false) LocalDateTime endTime, |
| | | @RequestParam(value = "beginTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime, |
| | | @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, |
| | | @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) { |
| | | //查找记录 |
| | |
| | | public R<UserPointStatisticsTopVO> getUserPointStatisticsTop(@RequestParam(value = "types",required = false) Collection<Integer> types, |
| | | @RequestParam(value = "name",required = false) String name, |
| | | @RequestParam(value = "phone",required = false) String phone, |
| | | @RequestParam(value = "beginTime",required = false) LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime",required = false) LocalDateTime endTime |
| | | @RequestParam(value = "beginTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime |
| | | ) { |
| | | UserPointStatisticsTopVO userPointStatisticsOutVO = new UserPointStatisticsTopVO(); |
| | | //充值绿电分 |
| | |
| | | @RequestParam(value = "types",required = false) Collection<Integer> types, |
| | | @RequestParam(value = "name",required = false) String name, |
| | | @RequestParam(value = "phone",required = false) String phone, |
| | | @RequestParam(value = "beginTime",required = false) LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime",required = false) LocalDateTime endTime){ |
| | | @RequestParam(value = "beginTime",required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime",required = false)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime){ |
| | | List<UserPointExcel> exportList =userPointMapper.userPointExcel(types,name,phone,beginTime,endTime); |
| | | exportList.forEach(x->{ |
| | | if (x.getType()==12||x.getType()==17){ |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.AppUserShop; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/12/2 9:20 |
| | | */ |
| | | public interface AppUserShopMapper extends BaseMapper<AppUserShop> { |
| | | Integer getHaveShopUserNum(); |
| | | |
| | | Map<String, Object> getPointAndPayAmount(@Param("userId") Long userId); |
| | | } |
| | |
| | | /** |
| | | * 注册账号 |
| | | */ |
| | | // R<LoginVo> registerAccount(RegisterAccount registerAccount); |
| | | R<LoginVo> registerAccount(RegisterAccount registerAccount); |
| | | |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.AppUserShop; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/12/2 9:20 |
| | | */ |
| | | public interface AppUserShopService extends IService<AppUserShop> { |
| | | Integer getHaveShopUserNum(); |
| | | |
| | | Map<String, Object> getPointAndPayAmount(Long userId); |
| | | } |
| | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | private static final String DEFAULT_AVATAR_URL = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/aedfbbb41280471f8d9fa7905298b65f.png"; |
| | | private static final String DEFAULT_AVATAR_URL = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/58084a0ce8c34dc79f9d8b4c0bc3774a.png"; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | String openid = map.get("openid").toString(); |
| | | String sessionKey = map.get("sessionKey").toString(); |
| | | //获取手机号 |
| | | String decrypt = WXCore.decrypt(appletLogin.getEncryptedData_phone(), sessionKey, appletLogin.getIv_phone()); |
| | | if (StringUtils.isEmpty(decrypt)) { |
| | | return R.fail("获取手机信息失败"); |
| | | } |
| | | JSONObject phone = JSON.parseObject(decrypt); |
| | | String purePhoneNumber = phone.getString("phoneNumber"); |
| | | //查询用户是否注册,没有注册则注册 |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getWxOpenid, openid).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, purePhoneNumber).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | if(null == appUser){ |
| | | appUser = new AppUser(); |
| | | //注册 |
| | | //获取手机号 |
| | | String decrypt = WXCore.decrypt(appletLogin.getEncryptedData_phone(), sessionKey, appletLogin.getIv_phone()); |
| | | if (StringUtils.isEmpty(decrypt)) { |
| | | return R.fail("获取手机信息失败"); |
| | | } |
| | | JSONObject phone = JSON.parseObject(decrypt); |
| | | String purePhoneNumber = phone.getString("phoneNumber"); |
| | | //新用户默认信息 |
| | | appUser.setName(purePhoneNumber.substring(0, 3) + "****" + purePhoneNumber.substring(7)); |
| | | appUser.setPhone(purePhoneNumber); |
| | |
| | | return R.fail("验证码错误"); |
| | | } |
| | | } |
| | | |
| | | //查询用户是否注册,没有注册则系统注册 |
| | | //查询用户是否注册,没有注册则跳转到注册页面 |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone()) |
| | | .ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | if(null == appUser){ |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(2); |
| | | loginVo.setPhone(mobileLogin.getPhone()); |
| | | return R.ok(loginVo); |
| | | } |
| | | //查询用户是否注册,没有注册则系统注册 |
| | | /*if(null == appUser){ |
| | | appUser=new AppUser(); |
| | | //注册 |
| | | //使用jscode获取微信openid |
| | |
| | | } |
| | | |
| | | this.save(appUser); |
| | | } |
| | | }*/ |
| | | //账户被冻结,给出提示 |
| | | if(2 == appUser.getStatus()){ |
| | | return R.fail("账户已被冻结,请联系管理员!"); |
| | |
| | | /** |
| | | * 注册账号 |
| | | */ |
| | | /* |
| | | @Override |
| | | public R<LoginVo> registerAccount(RegisterAccount registerAccount) { |
| | | //校验验证码 |
| | | // String code = redisService.getCacheObject(registerAccount.getPhone()); |
| | | // if(!"999999".equals(registerAccount.getCode())){ |
| | | // if(null == code || !code.equals(registerAccount.getCode())){ |
| | | // return R.fail("验证码错误"); |
| | | // } |
| | | // } |
| | | /* String code = redisService.getCacheObject(registerAccount.getPhone()); |
| | | if(!"999999".equals(registerAccount.getCode())){ |
| | | if(null == code || !code.equals(registerAccount.getCode())){ |
| | | return R.fail("验证码错误"); |
| | | } |
| | | }*/ |
| | | //使用jscode获取微信openid |
| | | Map<String, Object> map = weChatUtil.code2Session(registerAccount.getJscode()); |
| | | Integer errcode = Integer.valueOf(map.get("errcode").toString()); |
| | |
| | | |
| | | String avatar = registerAccount.getAvatar(); |
| | | if (StringUtils.isEmpty(avatar)){ |
| | | avatar = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/aedfbbb41280471f8d9fa7905298b65f.png"; |
| | | avatar = DEFAULT_AVATAR_URL; |
| | | } |
| | | |
| | | //如果手机号已注册,但是没有微信号,则将微信号添加到已有账户上 |
| | |
| | | appUser.setPhone(registerAccount.getPhone()); |
| | | appUser.setWxOpenid(openid); |
| | | //注册默认为普通会员 |
| | | appUser.setVipId(1); |
| | | appUser.setStatus(1); |
| | | appUser.setCreateTime(LocalDateTime.now()); |
| | | appUser.setDelFlag(false); |
| | | appUser.setFirstAdd(1); |
| | | appUser.setLastLoginTime(LocalDateTime.now()); |
| | | //绑定门店为推荐人绑定的门店 |
| | | AppUser appUser2 = this.getById(registerAccount.getPromoter()); |
| | | appUser.setInviteUserId(registerAccount.getPromoter()); |
| | | appUser.setShopId(appUser2.getShopId()); |
| | | appUser.setPartPoint(0); |
| | | appUser.setPartGrowPoint(0); |
| | | appUser.setShopPoint(0); |
| | | appUser.setSharePoint(0); |
| | | appUser.setShopAmount(BigDecimal.ZERO); |
| | | appUser.setWithdrawableAmount(BigDecimal.ZERO); |
| | | appUser.setWithdrawnAmount(BigDecimal.ZERO); |
| | | appUser.setTotalRechargeAmount(BigDecimal.ZERO); |
| | | appUser.setTotalRedPacketAmount(BigDecimal.ZERO); |
| | | appUser.setTotalDistributionAmount(BigDecimal.ZERO); |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | | //新用户才能奖励积分,老用户注销重新注册没有 |
| | | long old = this.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, registerAccount.getPhone()).eq(AppUser::getDelFlag, 0)); |
| | | R<PointSetting> pointSettingR = pointSettingClient.getPointSetting(1); |
| | | if (R.isError(pointSettingR)){ |
| | | throw new RuntimeException("获取积分设置失败"); |
| | | } |
| | | PointSetting pointSetting = pointSettingR.getData(); |
| | | if (pointSetting == null){ |
| | | throw new RuntimeException("积分设置不存在"); |
| | | } |
| | | Integer regisPoint = pointSetting.getRegisPoint(); |
| | | if(0 == old){ |
| | | Integer regisPoint1 = 0; |
| | | //计算可用积分比例 |
| | | if(1 == pointSetting.getGetRegisPointOpen()){ |
| | | regisPoint1 = new BigDecimal(regisPoint).multiply(pointSetting.getGetRegisPoint().divide(new BigDecimal(100))).intValue(); |
| | | } |
| | | appUser.setLavePoint(regisPoint); |
| | | appUser.setAvailablePoint(regisPoint1); |
| | | appUser.setTotalAvailablePoint(regisPoint1); |
| | | if(null != pointSetting && 1 == pointSetting.getGetRegisPointGift()){ |
| | | appUser.setTransferablePoint(regisPoint1); |
| | | } |
| | | appUser.setTotalRegisterPoint(regisPoint); |
| | | appUser.setTotalPoint(regisPoint); |
| | | } |
| | | //根据平台的配置未达标,则标注为可修改推广人 |
| | | appUser.setChangePromoter(0); |
| | | appUser.setLongitude(registerAccount.getLongitude()); |
| | | appUser.setLatitude(registerAccount.getLatitude()); |
| | | //调用地图获取省市区数据 |
| | |
| | | appUser.setProvinceCode(region.getCode()); |
| | | } |
| | | this.save(appUser); |
| | | |
| | | //增加积分变动记录 |
| | | if(0 == old && regisPoint > 0){ |
| | | //构建积分流水记录 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(7); |
| | | userPoint.setHistoricalPoint(0); |
| | | userPoint.setVariablePoint(regisPoint); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | |
| | | //拉新分佣 |
| | | if(0 == old && null != appUser2){ |
| | | pointSetting = pointSettingClient.getPointSetting(appUser2.getVipId()).getData(); |
| | | Integer newPoint = pointSetting.getNewPoint(); |
| | | Integer newPoint1 = 0; |
| | | if(1 == pointSetting.getGetNewPointOpen()){ |
| | | newPoint1 = new BigDecimal(newPoint).multiply(pointSetting.getGetNewPoint().divide(new BigDecimal(100))).intValue(); |
| | | } |
| | | appUser2.setLavePoint(appUser2.getLavePoint() + newPoint); |
| | | appUser2.setAvailablePoint(appUser2.getAvailablePoint() + newPoint1); |
| | | appUser2.setTotalAvailablePoint(appUser2.getTotalAvailablePoint() + newPoint1); |
| | | if(null != pointSetting && 1 == pointSetting.getGetNewPointGift()){ |
| | | appUser2.setTransferablePoint(appUser2.getTransferablePoint() + newPoint1); |
| | | } |
| | | appUser2.setTotalInvitePoint(appUser2.getTotalInvitePoint() + newPoint); |
| | | appUser2.setTotalPoint(appUser2.getTotalPoint() + newPoint); |
| | | this.updateById(appUser2); |
| | | if(newPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(3); |
| | | userPoint.setHistoricalPoint(appUser2.getLavePoint() - newPoint); |
| | | userPoint.setVariablePoint(newPoint); |
| | | userPoint.setBalance(appUser2.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser2.getId()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | |
| | | if(null != appUser2.getInviteUserId()){ |
| | | AppUser appUser3 = this.getById(appUser2.getInviteUserId()); |
| | | appUser3.setLavePoint(appUser3.getLavePoint() + newPoint); |
| | | appUser3.setAvailablePoint(appUser3.getAvailablePoint() + newPoint1); |
| | | appUser3.setTotalAvailablePoint(appUser3.getTotalAvailablePoint() + newPoint1); |
| | | if(null != pointSetting && 1 == pointSetting.getGetRegisPointGift()){ |
| | | appUser3.setTransferablePoint(appUser3.getTransferablePoint() + newPoint1); |
| | | } |
| | | appUser3.setTotalInvitePoint(appUser3.getTotalInvitePoint() + newPoint); |
| | | appUser3.setTotalPoint(appUser3.getTotalPoint() + newPoint); |
| | | this.updateById(appUser3); |
| | | if(newPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(3); |
| | | userPoint.setHistoricalPoint(appUser3.getLavePoint() - newPoint); |
| | | userPoint.setVariablePoint(newPoint); |
| | | userPoint.setBalance(appUser3.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser3.getId()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取微信推广二维码 |
| | | String fileName = UUID.randomUUID() + ".jpg"; |
| | | String getwxacodeunlimit = weChatUtil.getwxacodeunlimit("pages/start/start", "id=" + appUser.getId(), EnvVersion.RELEASE, filePath + fileName); |
| | | appUser.setQrCode(getwxacodeunlimit); |
| | | this.updateById(appUser); |
| | | |
| | | } |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(1); |
| | |
| | | return R.ok(loginVo); |
| | | } |
| | | |
| | | */ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | //查询门店,如果门店被冻结 |
| | | List<Shop> shopList = shopClient.getShopByUserId(userId).getData(); |
| | | user.setShopStatus(0);//未拥有门店 |
| | | |
| | | if (shopList != null && !shopList.isEmpty()) { |
| | | //走进来代表有门店 ,先设置为冻结中 |
| | | user.setShopStatus(2);//门店都被冻结 |
| | | for (Shop shop : shopList) { |
| | | if (shop.getStatus()==1) { |
| | |
| | | import com.ruoyi.account.service.AppUserShopService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/12/2 9:21 |
| | | */ |
| | | @Service |
| | | public class AppUserShopServiceImpl extends ServiceImpl<AppUserShopMapper, AppUserShop> implements AppUserShopService { |
| | | @Override |
| | | public Integer getHaveShopUserNum() { |
| | | return this.baseMapper.getHaveShopUserNum(); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getPointAndPayAmount(Long userId) { |
| | | |
| | | return this.baseMapper.getPointAndPayAmount(userId); |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor=Exception.class) |
| | | public void review(ApplyReviewDTO applyReviewDTO) { |
| | | ApplyForAdmission apply = userApplyForAdmissionMapper.selectById(applyReviewDTO.getId()); |
| | | if (apply == null) { |
| | |
| | | //先加入商店 |
| | | Shop shop = new Shop(); |
| | | BeanUtils.copyProperties(apply, shop); |
| | | shop.setId(null); |
| | | shop.setName(apply.getShopName()); |
| | | shop.setBusinessTime(apply.getBusinessTime()); |
| | | shop.setAppUserId(apply.getApplyUserId()); |
| | |
| | | try { |
| | | //必填,请参考"开发准备"获取如下数据,替换为实际值 |
| | | String url = "https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址+接口访问URI |
| | | String appKey = "wnFcPPf6B7EwrVCzGE5uRcwM8tmP"; //APP_Key |
| | | String appSecret = "Dw905FxIxX3CzYBeEO7htBRdqDB2"; //APP_Secret |
| | | String appKey = "wxe91f1af7638aa5dd"; //APP_Key |
| | | String appSecret = "a787e1a462715604e0c9528b6d8960d1"; //APP_Secret |
| | | |
| | | //条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 |
| | | //国际/港澳台短信不用关注该参数 |
| | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 微信小程序加解密 |
| | | * @author pzb |
| | | * @Date 2021/12/3 15:43 |
| | | */ |
| | | * 微信小程序加解密 |
| | | * @author pzb |
| | | * @Date 2021/12/3 15:43 |
| | | */ |
| | | public class WxPKCS7Encoder { |
| | | private static final Charset CHARSET = Charset.forName("utf-8"); |
| | | private static final int BLOCK_SIZE = 32; |
| | |
| | | private String detailsPicture; |
| | | private String certification; |
| | | private String fullAddress; |
| | | private String status; |
| | | private Integer status; |
| | | private LocalDateTime createTime; |
| | | private String remark; |
| | | private LocalDateTime updateTime; |
| | |
| | | public class RegisterAccount { |
| | | @ApiModelProperty(value = "微信jscode", required = true) |
| | | private String jscode; |
| | | @ApiModelProperty(value = "推广人id", required = true) |
| | | private Long promoter; |
| | | @ApiModelProperty(value = "头像", required = true) |
| | | private String avatar; |
| | | @ApiModelProperty(value = "姓名", required = true) |
| | | private String name; |
| | | @ApiModelProperty(value = "手机号", required = true) |
| | | private String phone; |
| | | @ApiModelProperty(value = "短信验证码", required = true) |
| | | private String code; |
| | | @ApiModelProperty(value = "经度", required = true) |
| | | private String longitude; |
| | | @ApiModelProperty(value = "纬度", required = true) |
| | |
| | | <mapper namespace="com.ruoyi.account.mapper.AppUserShopMapper"> |
| | | |
| | | |
| | | <select id="getHaveShopUserNum" resultType="java.lang.Integer"> |
| | | SELECT COUNT(DISTINCT app_user_id) FROM `t_app_user_shop` |
| | | </select> |
| | | <select id="getPointAndPayAmount" resultType="java.util.Map"> |
| | | SELECT |
| | | sum(exchange_point + transferable_out_point - cancel_point) as total_points , |
| | | sum(shop_amount) as payment_amounts |
| | | FROM |
| | | t_app_user WHERE del_flag =0 and status!=3 |
| | | <if test="null != userId and userId!='' "> |
| | | and id=#{userId} |
| | | </if> |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * 扫码校验 |
| | | */ |
| | | @ApiOperation(value = "扫码校验", tags = {"小程序-个人中心-门店管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "分享id", name = "shareId", required = true, dataType = "int", paramType = "query"), |
| | | }) |
| | | @GetMapping("/check/{orderNumber}/{shopId}") |
| | | public R<Boolean> check(@PathVariable("orderNumber") String orderNumber, @PathVariable("shopId") Integer shopId) { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | Order order = orderService.getOne(new LambdaQueryWrapper<Order>() |
| | | .eq(Order::getOrderNumber, orderNumber)); |
| | | .eq(Order::getId, orderNumber)); |
| | | return R.ok(orderService.check(order, shopId, loginUserApplet.getUserid())); |
| | | } |
| | | |
| | |
| | | * 订单核销 |
| | | */ |
| | | @ApiOperation(value = "订单核销", tags = {"小程序-个人中心-门店管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "String"), |
| | | }) |
| | | @GetMapping("/writeOff") |
| | | public R<Void> writeOff(String code, Integer shopId) { |
| | | orderService.writeOff(code, shopId); |
| | | public R<Void> writeOff(@ApiParam("id") String id, @ApiParam("shopId") Integer shopId) { |
| | | orderService.writeOff(id, shopId); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | orderPage.setAppUserIds(orderPage.getAppUserIds().stream().distinct().collect(Collectors.toList())); |
| | | } |
| | | |
| | | |
| | | //搜索条件 店铺名称 |
| | | if (StringUtils.isNotEmpty(orderPage.getShopName())){ |
| | | List<Integer> shopSet = new ArrayList<>(shopClient.getShopIdByName(orderPage.getShopName()).getData()); |
| | | if (CollectionUtils.isEmpty(shopSet)) { |
| | | return ; |
| | | } |
| | | if (null != orderPage.getShopIds()) { |
| | | List<Integer> shopIds = orderPage.getShopIds(); |
| | | if (!containsIntegerAny(shopIds, shopSet)) { |
| | | return ; |
| | | } |
| | | shopIds.addAll(shopSet); |
| | | orderPage.setShopIds(shopIds); |
| | | } else { |
| | | orderPage.setShopIds(shopSet); |
| | | } |
| | | } |
| | | if (null != orderPage.getShopIds()) { |
| | | orderPage.setShopIds(orderPage.getShopIds().stream().distinct().collect(Collectors.toList())); |
| | | } |
| | | |
| | | List<OrderExport> orderExportList = orderMapper.getOrderExportList(orderPage); |
| | | orderExportList.forEach(orderExport -> { |
| | |
| | | // 如果没有找到共同元素,返回 false |
| | | return false; |
| | | } |
| | | /** |
| | | * 判断 list1 是否包含 list2 中的至少一个元素 |
| | | * |
| | | * @param list1 第一个列表 |
| | | * @param list2 第二个列表 |
| | | * @return 如果 list1 包含 list2 中的至少一个元素,返回 true;否则返回 false |
| | | */ |
| | | private boolean containsIntegerAny(List<Integer> list1, List<Integer> list2) { |
| | | // 将 list1 转换为 HashSet 以提高查询效率 |
| | | Set<Integer> set1 = new HashSet<>(list1); |
| | | |
| | | // 遍历 list2,检查是否有元素存在于 set1 中 |
| | | for (Integer element : list2) { |
| | | if (set1.contains(element)) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | // 如果没有找到共同元素,返回 false |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | @PostMapping("/getOrderCountByAppUserId") |
| | | public R<Long> getOrderCountByAppUserId(@RequestParam("id") Long appUserId) { |
| | | long count = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getDelFlag, 0) |
| | | .eq(Order::getAppUserId, appUserId).in(Order::getOrderStatus, Arrays.asList(1, 2, 3, 4, 7, 8)) |
| | | .eq(Order::getPayStatus, 2)); |
| | | .eq(Order::getAppUserId, appUserId) |
| | | .in(Order::getOrderStatus, Arrays.asList(1, 2, 3, 4, 7, 8)) |
| | | .eq(Order::getPayStatus, 2) |
| | | ); |
| | | return R.ok(count); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | //折线图 |
| | | List<OrderStatisticsDetail> orderStatisticsDetailList=orderService.getOrderListGroupByDate(shopAnalysisDTO.getStartTime(), shopAnalysisDTO.getEndTime()); |
| | | List<OrderStatisticsDetail> orderStatisticsDetailList=orderService.getOrderListGroupByDate(shopAnalysisDTO.getStartTime(), shopAnalysisDTO.getEndTime(),shopAnalysisDTO.getShopId()); |
| | | shopAnalysisVO.setOrderStatisticsDetailList(orderStatisticsDetailList); |
| | | return R.ok(shopAnalysisVO); |
| | | } |
| | |
| | | /** |
| | | * 统计用户总消费积分数和现金支付金额 |
| | | */ |
| | | @GetMapping("/getOrderCountByAppUserId/") |
| | | @GetMapping("/getConsumeScoreAndPayAmount") |
| | | R<Map<String ,Object>> getConsumeScoreAndPayAmount(@RequestParam(value = "userId",required = false) Long userId){ |
| | | QueryWrapper<Order> queryWrapper = new QueryWrapper<>(); |
| | | // 条件构造 统计充值积分 |
| | |
| | | queryWrapper.in("order_status", Arrays.asList(3,4,8));//待核销 已完成 已评价 |
| | | queryWrapper.eq("pay_status",2); |
| | | if (userId != null) { |
| | | queryWrapper.eq("user_id", userId); |
| | | queryWrapper.eq("app_user_id", userId); |
| | | } |
| | | return R.ok(orderService.getMap(queryWrapper)); |
| | | } |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.Data; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | private String chargingStation; |
| | | private String powerStationOperator; |
| | | private String terminalCode; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime beginTime1; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime1; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime beginTime2; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime2; |
| | | private Integer pageCurr; |
| | | private Integer pageSize; |
| | |
| | | import java.util.List; |
| | | |
| | | public interface ChargeOrderMapper extends BaseMapper<ChargeOrder> { |
| | | List<ChargeOrder> getUserPointPageList(PageInfo<ChargeOrder> pageInfo,@Param("dto") GetImportOrderDTO dto); |
| | | List<ChargeOrder> getUserPointPageList(@Param("pageInfo") PageInfo<ChargeOrder> pageInfo,@Param("dto") GetImportOrderDTO dto); |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | List<OrderStatisticsDetail> getOrderListGroupByDate(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); |
| | | List<OrderStatisticsDetail> getOrderListGroupByDate(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime,@Param("shopId")Integer shopId); |
| | | } |
| | |
| | | /** |
| | | * 后台-工作台,订单折线图 |
| | | */ |
| | | List<OrderStatisticsDetail> getOrderListGroupByDate(LocalDate startTime, LocalDate endTime); |
| | | List<OrderStatisticsDetail> getOrderListGroupByDate(LocalDate startTime, LocalDate endTime,Integer shopId); |
| | | } |
| | |
| | | private UserPointClient userPointClient; |
| | | @Resource |
| | | private ChargeOrderService chargeOrderService; |
| | | private static final String DEFAULT_AVATAR_URL = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/aedfbbb41280471f8d9fa7905298b65f.png"; |
| | | private static final String DEFAULT_AVATAR_URL = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/58084a0ce8c34dc79f9d8b4c0bc3774a.png"; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | // 结束时间 |
| | | Cell endTimeCell = row.getCell(6); |
| | | Cell endTimeCell = row.getCell(7); |
| | | if (endTimeCell == null) { |
| | | throw new ServiceException("第" + (i + 1) + "行开始时间为空", 500); |
| | | } |
| | |
| | | appuser.setAvatar( DEFAULT_AVATAR_URL); |
| | | appuser.setCreateTime(LocalDateTime.now()); |
| | | appuser.setDelFlag(false); |
| | | appuser.setName(appuser.getPhone().substring(0, 3) + "****" + appuser.getPhone().substring(7)); |
| | | } |
| | | Integer chargePoint=appuser.getRechargePoint();//充值积分 |
| | | Integer availablePoint=appuser.getAvailablePoint();//可用积分 |
| | | Integer totalPoint=appuser.getTotalPoint();//总积分 |
| | | appuser.setRechargePoint(chargePoint==null?0:chargePoint +point);//充值积分增加 |
| | | appuser.setAvailablePoint(availablePoint==null?0:availablePoint+point);//可用积分增加 |
| | | appuser.setTotalPoint(totalPoint==null?0:totalPoint+point);//总积分增加 |
| | | Integer chargePoint=appuser.getRechargePoint()==null?0:appuser.getRechargePoint();//充值积分 |
| | | Integer availablePoint=appuser.getAvailablePoint()==null?0:appuser.getAvailablePoint();//可用积分 |
| | | Integer totalPoint=appuser.getTotalPoint()==null?0:appuser.getTotalPoint();//总积分 |
| | | appuser.setRechargePoint(chargePoint +point);//充值积分增加 |
| | | appuser.setAvailablePoint(availablePoint+point);//可用积分增加 |
| | | appuser.setTotalPoint(totalPoint+point);//总积分增加 |
| | | |
| | | Long userId = appUserClient.saveOrUpdateAppUser(appuser); |
| | | if (userId==null){ |
| | |
| | | |
| | | @Override |
| | | public OrderDetailVO getOrderDetail(Long orderId) { |
| | | OrderDetailVO orderDetailVO = new OrderDetailVO(); |
| | | Order order = orderMapper.selectById(orderId); |
| | | if (order == null) { |
| | | throw new ServiceException("订单不存在"); |
| | |
| | | if (!R.isSuccess(shopR)) { |
| | | throw new ServiceException("获取门店信息失败"); |
| | | } |
| | | |
| | | AppUser appUserById = appUserClient.getAppUserById(order.getAppUserId()); |
| | | if (appUserById != null) { |
| | | orderDetailVO.setUsername(appUserById.getName()); |
| | | } |
| | | // 商品 |
| | | OrderGood orderGood = orderGoodMapper.selectOne(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, orderId)); |
| | | String goodJson = orderGood.getGoodJson(); |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | GoodsSeckill goodsSeckill = JSON.parseObject(orderGood.getSeckillJson(), GoodsSeckill.class); |
| | | |
| | | OrderGoodsVO orderGoodsVO = new OrderGoodsVO(); |
| | | |
| | | orderGoodsVO.setGoodsId(goods.getId()); |
| | | orderGoodsVO.setGoodsName(goods.getName()); |
| | | orderGoodsVO.setGoodsPic(goods.getHomePagePicture()); |
| | |
| | | |
| | | orderGoodsVO.setOriginalPrice(goods.getOriginalPrice()); |
| | | |
| | | OrderDetailVO orderDetailVO = new OrderDetailVO(); |
| | | |
| | | orderDetailVO.setOrderGoodsVO(orderGoodsVO); |
| | | Shop shop = shopR.getData(); |
| | | |
| | |
| | | orderPageList.setAppUserIds(orderPageList.getAppUserIds().stream().distinct().collect(Collectors.toList())); |
| | | } |
| | | |
| | | //搜索条件 店铺名称 |
| | | if (StringUtils.isNotEmpty(orderPageList.getShopName())){ |
| | | List<Integer> shopSet = new ArrayList<>(shopClient.getShopIdByName(orderPageList.getShopName()).getData()); |
| | | if (CollectionUtils.isEmpty(shopSet)) { |
| | | return new PageInfo<>(); |
| | | } |
| | | if (null != orderPageList.getShopIds()) { |
| | | List<Integer> shopIds = orderPageList.getShopIds(); |
| | | if (!containsIntegerAny(shopIds, shopSet)) { |
| | | return new PageInfo<>(); |
| | | } |
| | | shopIds.addAll(shopSet); |
| | | orderPageList.setShopIds(shopIds); |
| | | } else { |
| | | orderPageList.setShopIds(shopSet); |
| | | } |
| | | } |
| | | if (null != orderPageList.getShopIds()) { |
| | | orderPageList.setShopIds(orderPageList.getShopIds().stream().distinct().collect(Collectors.toList())); |
| | | } |
| | | |
| | | PageInfo<OrderManagePageListVO> pageInfo = new PageInfo<>(orderPageList.getPageCurr(), orderPageList.getPageSize()); |
| | | |
| | |
| | | |
| | | // 遍历 list2,检查是否有元素存在于 set1 中 |
| | | for (Long element : list2) { |
| | | if (set1.contains(element)) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | // 如果没有找到共同元素,返回 false |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 判断 list1 是否包含 list2 中的至少一个元素 |
| | | * |
| | | * @param list1 第一个列表 |
| | | * @param list2 第二个列表 |
| | | * @return 如果 list1 包含 list2 中的至少一个元素,返回 true;否则返回 false |
| | | */ |
| | | private boolean containsIntegerAny(List<Integer> list1, List<Integer> list2) { |
| | | // 将 list1 转换为 HashSet 以提高查询效率 |
| | | Set<Integer> set1 = new HashSet<>(list1); |
| | | |
| | | // 遍历 list2,检查是否有元素存在于 set1 中 |
| | | for (Integer element : list2) { |
| | | if (set1.contains(element)) { |
| | | return true; |
| | | } |
| | |
| | | order.setPointDeductionAmount(pointDeductionAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setPaymentAmount(paymentMoney);//实际支付价格 |
| | | order.setPoint(orderPoint);//使用积分 |
| | | if (orderPayment.getPaymentType()==3 && orderPoint>0){//微信支付 但支付的积分也大于0 |
| | | if (orderPayment.getPaymentType()==1 && orderPoint>0){//微信支付 但支付的积分也大于0 |
| | | order.setPayMethod(4);//组合支付 |
| | | }else { |
| | | order.setPayMethod(orderPayment.getPaymentType());//积分或者微信 |
| | |
| | | UniPayResult uniPayResult = PaymentUtil.uniPay(order.getOrderNumber(), paymentMoney.doubleValue(), "购买单品商品", |
| | | goodsNames, "", "/order/order/orderPaymentCallback", appUser.getWxOpenid(), null); |
| | | if(null == uniPayResult || !"100".equals(uniPayResult.getRa_Code())){ |
| | | //支付失败,积分回退 ,删除订单 |
| | | //检查是否先有过积分抵扣了,是的话要返回订单已抵扣的积分,以及用户积分流水的删除 |
| | | if (order.getPoint()>0) { |
| | | //返回订单抵扣积分 |
| | | AppUser appUser2 = appUserClient.getAppUserById(order.getAppUserId()); |
| | | Integer availablePoint = appUser2.getAvailablePoint();//可用积分 |
| | | Integer variablePoint = order.getPoint();//变动积分 |
| | | Integer balance = appUser2.getAvailablePoint() + order.getPoint();//变动后积分 |
| | | Integer cancelPoint = appUser2.getCancelPoint() + order.getPoint();//取消订单积分 |
| | | appUser2.setAvailablePoint(availablePoint); |
| | | appUser2.setCancelPoint(cancelPoint); |
| | | appUser2.setTotalPoint(appUser2.getTotalPoint() + order.getPoint()); |
| | | |
| | | //构建积分流水记录 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(16);//取消订单 |
| | | userPoint.setHistoricalPoint(availablePoint); |
| | | userPoint.setVariablePoint(variablePoint); |
| | | userPoint.setBalance(balance); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser2.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | |
| | | appUserClient.editAppUserById(appUser2); |
| | | |
| | | //删除订单 |
| | | order.setDelFlag(1); |
| | | orderMapper.updateById(order); |
| | | } |
| | | //返回报错信息 |
| | | return R.fail(null == uniPayResult ? "支付失败" : uniPayResult.getRb_CodeMsg()); |
| | | } |
| | | String rc_result = uniPayResult.getRc_Result(); |
| | |
| | | log.error("关闭订单失败:{}---->{}", order.getOrderNumber(), JSON.toJSONString(closeOrderResult)); |
| | | } |
| | | redisTemplate.opsForZSet().remove("OrderPayment", order.getOrderNumber()); |
| | | //关闭订单后,检查是否先有过积分抵扣了,是的话要返回订单已抵扣的积分,以及用户积分流水的删除 |
| | | //关闭订单后,检查是否先有过积分抵扣了,是的话要返回订单已抵扣的积分,以及用户积分流水的删除, 删除订单 |
| | | if (order.getPoint()>0) { |
| | | //返回订单抵扣积分 |
| | | AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); |
| | |
| | | userPointClient.saveUserPoint(userPoint); |
| | | |
| | | appUserClient.editAppUserById(appUser); |
| | | |
| | | //删除订单 |
| | | order.setDelFlag(1); |
| | | orderMapper.updateById(order); |
| | | } |
| | | } |
| | | } |
| | |
| | | Page<Order> page = new Page<>(pageNum, pageSize); |
| | | // 构建查询条件 |
| | | QueryWrapper<Order> queryWrapper = new QueryWrapper<>(); |
| | | //添加基础条件 |
| | | queryWrapper.eq("del_flag", 0); |
| | | queryWrapper.eq("pay_status", 2); |
| | | queryWrapper.orderByDesc("create_time"); |
| | | // 添加门店ID条件 |
| | | if (shopId != null) { |
| | | queryWrapper.eq("shop_id", shopId); |
| | |
| | | } |
| | | // 模糊查询条件 |
| | | if (StringUtils.isNotBlank(content)) { |
| | | //根据手机号查询用户id |
| | | List<Long> ids= new ArrayList<>(); |
| | | List<AppUser> data = appUserClient.getAppUserByPhone(content).getData(); |
| | | if (data != null && !data.isEmpty()) { |
| | | ids=data.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | } |
| | | // 构建OR条件组:订单编号/商品名/手机号 |
| | | if (null != ids && !ids.isEmpty()) { |
| | | queryWrapper.in("app_user_id",ids); |
| | | } |
| | | |
| | | queryWrapper.and(wrapper -> wrapper |
| | | .like("order_number", content) // 订单编号 |
| | | .or() |
| | | .like("goods_name", content) // 商品名 |
| | | .or() |
| | | .inSql("app_user_id", "select id from t_app_user where phone like '%" + content + "%'") // 手机号 |
| | | .like("good_name", content) // 商品名 |
| | | ); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<OrderStatisticsDetail> getOrderListGroupByDate(LocalDate startTime, LocalDate endTime) { |
| | | public List<OrderStatisticsDetail> getOrderListGroupByDate(LocalDate startTime, LocalDate endTime,Integer shopId) { |
| | | // 查询数据库获取原始数据 |
| | | List<OrderStatisticsDetail> rawData = orderMapper.getOrderListGroupByDate( |
| | | startTime.atTime(0,0, 0), |
| | | endTime.atTime(23,59,59) |
| | | endTime.atTime(23,59,59), |
| | | shopId |
| | | ); |
| | | |
| | | // 创建完整日期范围的映射 |
| | |
| | | public class PaymentUtil { |
| | | |
| | | //微信公众号、微信小程序、微信 APP+/H5、云微小程序支付 |
| | | private static final String appId = "wxdeed472c98e42a54"; |
| | | private static final String appId = "wx049faf9c5234f31c"; |
| | | /** |
| | | * 商户密钥 |
| | | */ |
| | | private static final String key = "925899fcc374430f9e4b4ba3db05b448"; |
| | | private static final String key = "a2369875124965782f148539657823152"; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | private static final String merchantNo = "888122600004175"; |
| | | private static final String merchantNo = "1717539630"; |
| | | /** |
| | | * 平台-报备商户号 |
| | | */ |
| | | private static final String sysTradeMerchantNo = "777168500885852"; |
| | | private static final String sysTradeMerchantNo = ""; |
| | | /** |
| | | * 支付回调地址 |
| | | */ |
| | | private static final String callbackUrl = "https://www.qijisheng.top"; |
| | | private static final String callbackUrl = "https://221.182.45.100:8084"; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Excel(name = "商品售价") |
| | | private BigDecimal sellingPrice; |
| | | |
| | | @Excel(name = "支付方式",readConverterExp ="1=微信,2=账户余额,3=积分,4=组合") |
| | | private Integer pay_method; |
| | | private String payMethod; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | |
| | | private String point; |
| | | |
| | | private String goodJson; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | |
| | | @Excel(name = "商户号") |
| | | private String tradeMerchantNo = "729677708"; |
| | | private String tradeMerchantNo = "1717539630"; |
| | | |
| | | /** |
| | | * 发货方式 |
| | |
| | | @ApiModel |
| | | public class OrderPageList extends BasePage { |
| | | @ApiModelProperty("订单编号") |
| | | public String code; |
| | | public String orderNumber; |
| | | @ApiModelProperty("联系电话") |
| | | private String phone; |
| | | @ApiModelProperty("商品名称") |
| | | private String goodsName; |
| | | private String goodName; |
| | | |
| | | |
| | | @ApiModelProperty("所属店铺") |
| | | private Integer shopId; |
| | | private String shopName; |
| | | @ApiModelProperty("支付方式(1=微信,3=积分,4=组合支付)") |
| | | private Integer paymentType; |
| | | private Integer payMethod; |
| | | |
| | | @ApiModelProperty("订单状态(3待使用4已完成5已取消8已评价)") |
| | | private Integer status; |
| | | private Integer orderStatus; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | |
| | | private LocalDateTime endTime; |
| | | |
| | | List<Long> appUserIds; |
| | | List<Integer> shopIds; |
| | | } |
| | |
| | | COUNT(o.id) AS order_count |
| | | FROM |
| | | t_order o |
| | | <where> |
| | | where |
| | | pay_status = 2 |
| | | and |
| | | del_flag = 0 |
| | | <if test="status != null"> |
| | | <choose> |
| | | <when test="status == 4"> |
| | |
| | | <if test="userId != null"> |
| | | AND o.app_user_id = #{userId} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | o.id, |
| | | o.order_number, |
| | |
| | | app_user_id |
| | | from t_order |
| | | where del_flag = 0 and pay_status = 2 |
| | | <if test="null != item.code and '' != item.code"> |
| | | and order_number like CONCAT('%', #{item.code}, '%') |
| | | <if test="null != item.orderNumber and '' != item.orderNumber"> |
| | | and order_number like CONCAT('%', #{item.orderNumber}, '%') |
| | | </if> |
| | | |
| | | <if test="null != item.goodsName and '' != item.goodsName"> |
| | | and good_name like CONCAT('%', #{item.goodsName}, '%') |
| | | <if test="null != item.goodName and '' != item.goodName"> |
| | | and good_name like CONCAT('%', #{item.goodName}, '%') |
| | | </if> |
| | | |
| | | <if test="null != item.appUserIds and item.appUserIds.size() > 0"> |
| | |
| | | #{tem} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != item.paymentType"> |
| | | and pay_method = #{item.paymentType} |
| | | <if test="null != item.payMethod"> |
| | | and pay_method = #{item.payMethod} |
| | | </if> |
| | | <if test="null != item.status and 4 != item.status"> |
| | | and order_status = #{item.status} |
| | | <if test="null != item.orderStatus and 4 != item.orderStatus"> |
| | | and order_status = #{item.orderStatus} |
| | | </if> |
| | | <if test="null != item.status and 4 == item.status"> |
| | | <if test="null != item.orderStatus and 4 == item.orderStatus"> |
| | | and order_status in (4, 8) |
| | | </if> |
| | | |
| | | <if test="null != item.shopId"> |
| | | and shop_id = #{item.shopId} |
| | | <if test="null != item.shopIds and item.shopIds.size() > 0"> |
| | | and shop_id in |
| | | <foreach collection="item.shopIds" separator="," item="tem" index="index" open="(" close=")"> |
| | | #{tem} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != item.startTime and null != item.endTime"> |
| | | and create_time between #{item.startTime} and #{item.endTime} |
| | |
| | | from t_order_good a |
| | | left join t_order b on (a.order_id = b.id) |
| | | where b.del_flag = 0 and b.pay_status = 2 and b.order_status in ( 3, 4, 8) and a.goods_id = #{goodsId} |
| | | <if test="null != type"> |
| | | and a.type = #{type} |
| | | </if> |
| | | <if test="userId != null"> |
| | | and b.app_user_id = #{userId} |
| | | </if> |
| | |
| | | t_order_good og |
| | | LEFT JOIN t_order o ON og.order_id = o.id |
| | | where o.del_flag = 0 and o.pay_status = 2 |
| | | <if test="null != item.code and '' != item.code"> |
| | | and o.order_number like CONCAT('%', #{item.code}, '%') |
| | | <if test="null != item.orderNumber and '' != item.orderNumber"> |
| | | and o.order_number like CONCAT('%', #{item.orderNumber}, '%') |
| | | </if> |
| | | <if test="null != item.goodsName and '' != item.goodsName"> |
| | | and good_name like CONCAT('%', #{item.goodsName}, '%') |
| | | <if test="null != item.goodName and '' != item.goodName"> |
| | | and good_name like CONCAT('%', #{item.goodName}, '%') |
| | | </if> |
| | | |
| | | <if test="null != item.appUserIds and item.appUserIds.size() > 0"> |
| | |
| | | #{tem} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != item.paymentType"> |
| | | and o.pay_method = #{item.paymentType} |
| | | <if test="null != item.payMethod"> |
| | | and o.pay_method = #{item.payMethod} |
| | | </if> |
| | | <if test="null != item.status and 4 != item.status"> |
| | | and o.order_status = #{item.status} |
| | | <if test="null != item.orderStatus and 4 != item.orderStatus"> |
| | | and o.order_status = #{item.orderStatus} |
| | | </if> |
| | | <if test="null != item.status and 4 == item.status"> |
| | | <if test="null != item.orderStatus and 4 == item.orderStatus"> |
| | | and o.order_status in (4, 8) |
| | | </if> |
| | | <if test="null != item.shopId"> |
| | | and o.shop_id = #{item.shopId} |
| | | <if test="null != item.shopIds and item.shopIds.size() > 0"> |
| | | and shop_id in |
| | | <foreach collection="item.shopIds" separator="," item="tem" index="index" open="(" close=")"> |
| | | #{tem} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != item.startTime and null != item.endTime"> |
| | | and o.create_time between #{item.startTime} and #{item.endTime} |
| | |
| | | SELECT DATE_FORMAT(create_time, '%Y-%m-%d') AS `date_time`, COUNT(id) AS total, SUM(total_amount) AS total_money |
| | | FROM t_order WHERE del_flag = 0 AND order_status IN (3, 4, 8) AND pay_status = 2 |
| | | AND create_time BETWEEN #{startTime} AND #{endTime} |
| | | <if test="null != shopId"> |
| | | and shop_id=#{shopId} |
| | | </if> |
| | | GROUP BY `date_time` ORDER BY `date_time` ASC |
| | | </select> |
| | | |
| | |
| | | @DistributedLock(lockNamePre = "#goods_lock", lockNamePost = "#goodsId") |
| | | public R<Void> editGoodsNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("num") Integer num){ |
| | | Goods goods = goodsService.getById(goodsId); |
| | | goods.setSaleNum(goods.getSaleNum() + num); |
| | | goods.setSaleNum(goods.getSaleNum() + num); |
| | | goodsService.updateById(goods); |
| | | return R.ok(); |
| | | } |
| | |
| | | @ApiOperation(value = "评价详情", tags = {"小程序-查看自己的评价"}) |
| | | public R<GoodsEvaluate> detail(@PathVariable("orderId") Long orderId){ |
| | | GoodsEvaluate evaluate = goodsEvaluateService.getOne(new LambdaQueryWrapper<GoodsEvaluate>() |
| | | .eq(GoodsEvaluate::getStatus, 2) |
| | | .eq(GoodsEvaluate::getDelFlag, 0) |
| | | .eq(GoodsEvaluate::getOrderId, orderId)); |
| | | if(evaluate==null){ |
| | |
| | | //删除客服电话 |
| | | QueryWrapper<Phone> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("shop_id", shop.getId()); |
| | | queryWrapper.eq("type",2); |
| | | Phone one = phoneService.getOne(queryWrapper); |
| | | if (!one.getPhoneOne().equals(shop.getServiceTel())){ |
| | | phoneService.removeById(one.getId()); |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | |
| | | @ApiParam("手机号") String phone, |
| | | @ApiParam("审核状态(0=待审核,1=审核通过,2=审核失败)")Integer auditStatus) { |
| | | //模糊查询手机号 |
| | | List<Integer> shopIds=null; |
| | | List<Integer> shopIds=new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(phone)) { |
| | | QueryWrapper<Shop> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(phone),"phone", phone); |
| | |
| | | } |
| | | |
| | | private void baseWithdrawalApplication(BigDecimal money, Long userId, Integer shopId) { |
| | | money=money.setScale(2, BigDecimal.ROUND_HALF_DOWN); |
| | | Shop shop = shopService.getById(shopId); |
| | | if (money.compareTo(BigDecimal.ZERO)==0){ |
| | | throw new ServiceException("提现金额必须大于零"); |
| | |
| | | BigDecimal money = shopWithdraw1.getMoney(); |
| | | if(1 == shopWithdraw.getAuditStatus()){ |
| | | //通过 |
| | | //先检查账户余额是否充足 |
| | | // 先检查账户余额是否充足 todo 商户编号 |
| | | AccountBalanceQueryResult accountBalanceQueryResult = TransferUtil.accountBalanceQuery(); |
| | | if(null == accountBalanceQueryResult){ |
| | | return R.fail("查询账户余额出错"); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface GoodsEvaluateMapper extends BaseMapper<GoodsEvaluate> { |
| | | |
| | | GoodsEvaluate getGoodsEvaluateOne(@Param("goodsId") Integer goodsId); |
| | | } |
| | |
| | | } |
| | | } else { |
| | | //修改 |
| | | if (goodsEvaluate.getStatus()!=2){ |
| | | return R.fail("修改失败,评论已被下架"); |
| | | } |
| | | goodsEvaluate.setUpdateTime(LocalDateTime.now()); |
| | | updateById(goodsEvaluate); |
| | | } |
| | |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.dto.AddGoodsDTO; |
| | | import com.ruoyi.other.enums.GoodsStatus; |
| | | import com.ruoyi.other.mapper.GoodsEvaluateMapper; |
| | | import com.ruoyi.other.mapper.GoodsMapper; |
| | | import com.ruoyi.other.mapper.GoodsShopMapper; |
| | | import com.ruoyi.other.mapper.ShopMapper; |
| | | import com.ruoyi.other.service.*; |
| | | import com.ruoyi.other.util.GeodesyUtil; |
| | | import com.ruoyi.other.vo.GoodsEvaluateVO; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.system.api.domain.SysConfig; |
| | |
| | | @Resource |
| | | private ShopService shopService; |
| | | |
| | | @Resource |
| | | private GoodsEvaluateMapper goodsEvaluateMapper; |
| | | |
| | | /** |
| | | * 热门商品列表 |
| | |
| | | public PageInfo<GoodsVO> goodsList(Goods search) { |
| | | List<Long> shopIds=null; |
| | | if (null!=search.getLongitude()&&null!=search.getLatitude()){ |
| | | |
| | | //获取最近十家店的id |
| | | List<NearbyShopVO> nearbyShopVOS = shopService.nearbyShopList(search.getLongitude(), search.getLatitude(), new Shop()); |
| | | shopIds = nearbyShopVOS.subList(0, 10).stream().map(NearbyShopVO::getId).collect(Collectors.toList()); |
| | | int endIndex = Math.min(10, nearbyShopVOS.size()); |
| | | shopIds = nearbyShopVOS.subList(0, endIndex).stream().map(NearbyShopVO::getId).collect(Collectors.toList()); |
| | | } |
| | | //查找满足条件的商品 分类、名称、附近十家店 |
| | | List<GoodsVO> list = this.baseMapper.goodsList(search.getGoodsCategoryId(), search.getName(),shopIds); |
| | |
| | | goods.setEndTime(price.getEndTime()); |
| | | goods.setPurchaseLimit(price.getPurchaseLimit()); |
| | | } |
| | | //已售数量 |
| | | Integer data = orderClient.getGoodsSaleNum(goods.getGoodsId(), 1).getData(); |
| | | goods.setSaleNum(data); |
| | | } |
| | | //手动排序 |
| | | if(StringUtils.isNotEmpty(search.getOrderByColumn())){ |
| | |
| | | Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData(); |
| | | goodsVO.setSaleNum(integer); |
| | | |
| | | //商品评价 |
| | | GoodsEvaluate goodsEvaluate=goodsEvaluateMapper.getGoodsEvaluateOne(goods.getId()); |
| | | if (null != goodsEvaluate){ |
| | | AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId()); |
| | | goodsEvaluate.setAvatar(appUserById.getAvatar()); |
| | | goodsEvaluate.setUserName(appUserById.getName()); |
| | | goodsVO.setGoodsEvaluate(goodsEvaluate); |
| | | } |
| | | return goodsVO; |
| | | |
| | | } |
| | |
| | | public PageInfo<ShopBalanceStatementVO> getShopBalanceStatementList(Integer shopId, LocalDateTime startTime, LocalDateTime endTime, Integer type, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<ShopBalanceStatementVO> pageInfo = new PageInfo<>(pageCurr, pageSize); |
| | | List<ShopBalanceStatementVO> ShopBalanceStatementList = shopBalanceStatementMapper.getShopBalanceStatementList(pageInfo, shopId, startTime, endTime, type); |
| | | |
| | | for (ShopBalanceStatementVO shopBalanceStatementVO : ShopBalanceStatementList) { |
| | | log.error(shopBalanceStatementVO.toString()); |
| | | BigDecimal historicalBalance = shopBalanceStatementVO.getHistoricalBalance(); |
| | | BigDecimal balance = shopBalanceStatementVO.getBalance(); |
| | | if (historicalBalance != null && balance != null) { |
| | |
| | | //一个商品只有一个秒杀活动 |
| | | SeckillActivityInfo seckillActivityInfo = seckillActivityInfoService.getOne(new LambdaQueryWrapper<SeckillActivityInfo>() |
| | | .eq(SeckillActivityInfo::getGoodId, goodsId) |
| | | .eq(SeckillActivityInfo::getIsShelves,1) |
| | | .eq(SeckillActivityInfo::getDelFlag, 0)); |
| | | //商品是否开启秒杀活动 |
| | | goodsVO.setIsSkillActivity(0); |
| | |
| | | goodsShop.setGoodsId(goods.getId()); |
| | | goodsShop.setShopId(addGoodsDTO.getShopId()); |
| | | Shop shop = shopMapper.selectById(addGoodsDTO.getShopId()); |
| | | if(shop==null){ |
| | | throw new ServiceException("门店不存在"); |
| | | } |
| | | goodsShop.setShopName(shop.getName()); |
| | | goodsShop.setOwnerName(shop.getShopManager()); |
| | | goodsShop.setPhone(shop.getPhone()); |
| | |
| | | /** |
| | | * 商户密钥 |
| | | */ |
| | | private static final String key = "925899fcc374430f9e4b4ba3db05b448"; |
| | | private static final String key = "a2369875124965782f148539657823152"; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | private static final String merchantNo = "888122600004175"; |
| | | private static final String merchantNo = "1717539630"; |
| | | /** |
| | | * 平台-报备商户号 |
| | | */ |
| | | public static final String sysTradeMerchantNo = "777168500885852"; |
| | | public static final String sysTradeMerchantNo = ""; |
| | | |
| | | private static final String format = "yyyy-MM-dd HH:mm:ss"; |
| | | /** |
| | | * 支付回调地址 |
| | | */ |
| | | private static final String callbackUrl = "https://www.qijisheng.top"; |
| | | private static final String callbackUrl = "https://221.182.45.100:8084"; |
| | | |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ApiModelProperty(value = "门店") |
| | | private Shop shop; |
| | | |
| | | @ApiModelProperty(value = "评价") |
| | | private GoodsEvaluate goodsEvaluate; |
| | | |
| | | } |
| | |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "变动金额") |
| | | private Integer variableAmount; |
| | | private BigDecimal variableAmount; |
| | | |
| | | @ApiModelProperty(value = "变动时间") |
| | | private String createTime; |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.other.mapper.GoodsEvaluateMapper"> |
| | | |
| | | <select id="getGoodsEvaluateOne" resultType="com.ruoyi.other.api.domain.GoodsEvaluate"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | t_goods_evaluate |
| | | WHERE |
| | | goods_id = #{goodsId} |
| | | AND del_flag = 0 |
| | | and status=2 |
| | | and comment !='' |
| | | ORDER BY |
| | | grade DESC, create_time DESC |
| | | LIMIT 1; |
| | | </select> |
| | | </mapper> |
| | |
| | | ts.id AS shop_id, |
| | | tgc.name AS category_name |
| | | FROM |
| | | t_goods tg |
| | | t_goods_shop tgs |
| | | LEFT JOIN t_goods tg ON tgs.goods_id = tg.id |
| | | LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.id |
| | | LEFT JOIN t_goods_shop tgs ON tg.id = tgs.goods_id |
| | | LEFT JOIN t_shop ts ON tgs.shop_id = ts.id |
| | | <where> |
| | | tg.del_flag = 0 |
| | |
| | | <if test="null != shopIds and shopIds.size() > 0"> |
| | | inner join t_goods_shop gs on g.id = gs.goods_id |
| | | </if> |
| | | where g.status = 2 and g.del_flag = 0 and g.`type` = 2 |
| | | where g.status = 2 and g.del_flag = 0 |
| | | <if test="null != goodsCategoryId"> |
| | | and g.goods_category_id = #{goodsCategoryId} |
| | | </if> |
| | |
| | | #{shopId} |
| | | </foreach> |
| | | </if> |
| | | order by g.sort desc |
| | | order by g.sale_num desc |
| | | </select> |
| | | </mapper> |
| | |
| | | LEFT JOIN t_goods tg ON tsai.good_id = tg.id |
| | | LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id |
| | | WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0 and tsai.end_time >= now() |
| | | and tg.del_flag=0 and tg.status=2 |
| | | <if test="name != null and name != ''"> |
| | | AND tg.`name` LIKE concat('%',#{name},'%') |
| | | </if> |
| | |
| | | tsw.receiverAccountNoEnc, |
| | | tsw.receiverAccountType, |
| | | tsw.receiverBankChannelNo, |
| | | tsw.receiverNameEnc, |
| | | ts.name as shopName, |
| | | ts.phone |
| | | from `t_shop_withdraw` tsw |