| | |
| | | */ |
| | | @GetMapping("/user/getUserIdsByDept/{userId}") |
| | | public R<List<Long>> getUserIdsByDept(@PathVariable("userId") Long userId); |
| | | |
| | | |
| | | /** |
| | | * 根据部门id获取用户 |
| | | * @param deptId |
| | | * @return |
| | | */ |
| | | @PostMapping("/user/getUsersByDeptId") |
| | | R<List<SysUser>> getUsersByDeptId(@RequestBody Long deptId); |
| | | } |
| | |
| | | if(!coupon.getSendType().equals(mgtCouponEditDto.getSendType())){ |
| | | throw new ServiceException("不能修改优惠券发放方式"); |
| | | } |
| | | if(null != mgtCouponEditDto.getMoneyThreshold() && !coupon.getMoneyThreshold().equals(mgtCouponEditDto.getMoneyThreshold())){ |
| | | if(null != mgtCouponEditDto.getMoneyThreshold() && coupon.getMoneyThreshold().compareTo(mgtCouponEditDto.getMoneyThreshold()) != 0){ |
| | | throw new ServiceException("不能修改优惠券金额"); |
| | | } |
| | | if(null != mgtCouponEditDto.getDiscountMoney() && !coupon.getDiscountMoney().equals(mgtCouponEditDto.getDiscountMoney())){ |
| | | if(null != mgtCouponEditDto.getDiscountMoney() && coupon.getDiscountMoney().compareTo(mgtCouponEditDto.getDiscountMoney()) != 0){ |
| | | throw new ServiceException("不能修改优惠券金额"); |
| | | } |
| | | if(null != mgtCouponEditDto.getDiscountPercent() && !coupon.getDiscountPercent().equals(mgtCouponEditDto.getDiscountPercent())){ |
| | | if(null != mgtCouponEditDto.getDiscountPercent() && coupon.getDiscountPercent().compareTo(mgtCouponEditDto.getDiscountPercent()) != 0){ |
| | | throw new ServiceException("不能修改优惠券折扣"); |
| | | } |
| | | if(null != mgtCouponEditDto.getValidTimeType() && !coupon.getValidTimeType().equals(mgtCouponEditDto.getValidTimeType())){ |
| | | if(coupon.getSendType() == 2 && coupon.getSendTimeType() == 2 && mgtCouponEditDto.getSendTimeType() == 2 && System.currentTimeMillis() >= coupon.getSendTime().getTime() && null != mgtCouponEditDto.getValidTimeType() && !coupon.getValidTimeType().equals(mgtCouponEditDto.getValidTimeType())){ |
| | | throw new ServiceException("不能修改优惠券适用期限类型"); |
| | | } |
| | | if(null != mgtCouponEditDto.getValidTimeType() && coupon.getValidTimeType() == 1 && !coupon.getValidStartTime().equals(mgtCouponEditDto.getValidStartTime())){ |
| | | if(coupon.getSendType() == 2 && coupon.getSendTimeType() == 2 && mgtCouponEditDto.getSendTimeType() == 2 && System.currentTimeMillis() >= coupon.getSendTime().getTime() && null != mgtCouponEditDto.getValidTimeType() && coupon.getValidTimeType() == 1 && !coupon.getValidStartTime().equals(mgtCouponEditDto.getValidStartTime())){ |
| | | throw new ServiceException("不能修改优惠券有效期开始时间"); |
| | | } |
| | | if(coupon.getSendType() == 2 && coupon.getSendTimeType() == 1 && mgtCouponEditDto.getSendTimeType() != 1){ |
| | |
| | | if(coupon.getSendType() == 2 && coupon.getSendTimeType() == 2 && mgtCouponEditDto.getSendTimeType() != 2 && System.currentTimeMillis() <= coupon.getSendTime().getTime()){ |
| | | throw new ServiceException("不能修改优惠券发放方式"); |
| | | } |
| | | if(coupon.getSendType() == 2 && coupon.getSendTimeType() == 2 && mgtCouponEditDto.getSendTimeType() == 2 && !mgtCouponEditDto.getSendTime().equals(coupon.getSendTime()) && System.currentTimeMillis() <= coupon.getSendTime().getTime()){ |
| | | if(coupon.getSendType() == 2 && coupon.getSendTimeType() == 2 && mgtCouponEditDto.getSendTimeType() == 2 && System.currentTimeMillis() >= coupon.getSendTime().getTime()){ |
| | | throw new ServiceException("不能修改优惠券发放时间"); |
| | | } |
| | | if(coupon.getUseScope() == 1 && !coupon.getUseScope().equals(mgtCouponEditDto.getUseScope())){ |
| | | if(coupon.getSendType() == 2 && coupon.getSendTimeType() == 2 && mgtCouponEditDto.getSendTimeType() == 2 && System.currentTimeMillis() >= coupon.getSendTime().getTime() && coupon.getUseScope() == 1 && !coupon.getUseScope().equals(mgtCouponEditDto.getUseScope())){ |
| | | throw new ServiceException("不能修改优惠券适用范围"); |
| | | } |
| | | |
| | | if(coupon.getUseScope() == 2 && coupon.getUseScope().equals(mgtCouponEditDto.getUseScope())){ |
| | | List<String> relGoodsIdList = mgtCouponEditDto.getRelGoodsIdList(); |
| | | List<CouponRelGoods> list = couponRelGoodsService.list(new QueryWrapper<CouponRelGoods>().eq("coupon_id", coupon.getCouponId()).eq("del_flag", 0)); |
| | |
| | | if(coupon.getSendLimitFlag() == 0 && mgtCouponEditDto.getSendLimitFlag() != 0){ |
| | | throw new ServiceException("不能修改优惠券发放数量限制"); |
| | | } |
| | | if(coupon.getSendLimitFlag() == 1 && !coupon.getSendLimitNumber().equals(mgtCouponEditDto.getSendLimitNumber())){ |
| | | if(coupon.getSendLimitFlag() == 1 && mgtCouponEditDto.getSendLimitFlag() == 1 && coupon.getSendLimitNumber().compareTo(mgtCouponEditDto.getSendLimitNumber()) > 0){ |
| | | throw new ServiceException("不能修改优惠券发放数量限制"); |
| | | } |
| | | if(coupon.getLimitNumber().compareTo(mgtCouponEditDto.getLimitNumber()) < 0){ |
| | | if(coupon.getLimitNumber().compareTo(mgtCouponEditDto.getLimitNumber()) > 0){ |
| | | throw new ServiceException("只能增加优惠券领取数量"); |
| | | } |
| | | List<CouponRelUser> list = couponRelUserService.list(new QueryWrapper<CouponRelUser>().eq("coupon_id", coupon.getCouponId()).eq("del_flag", 0)); |
| | |
| | | throw new ServiceException("只能修改优惠发放对象"); |
| | | } |
| | | |
| | | couponRelUserService.deleteCouponRelByCouponId(coupon.getCouponId()); |
| | | couponRelGoodsService.deleteCouponRelByCouponId(coupon.getCouponId()); |
| | | |
| | | // couponRelUserService.deleteCouponRelByCouponId(coupon.getCouponId()); |
| | | // couponRelGoodsService.deleteCouponRelByCouponId(coupon.getCouponId()); |
| | | }else{ |
| | | coupon = new Coupon(); |
| | | String couponId = IdUtils.simpleUUID(); |
| | |
| | | coupon.setRelUserIds(userIdSj.toString()); |
| | | } |
| | | //处理优惠券发放 |
| | | if(coupon.getSendType()==2&&coupon.getSendTimeType()==1){ |
| | | if(coupon.getSendFlag() == 0 && coupon.getSendType()==2&&coupon.getSendTimeType()==1){ |
| | | sendCoupon(coupon,relUserIdList); |
| | | coupon.setSendFlag(1); |
| | | this.saveOrUpdate(coupon); |
| | |
| | | tuc.deadline_time deadlineTime, |
| | | tuc.rel_goods_ids relGoodsIds |
| | | FROM t_member_coupon tuc |
| | | WHERE tuc.del_flag = 0 AND tuc.coupon_status = 1 AND tuc.user_id = #{param.userId} AND (tuc.coupon_from = 1 OR (tuc.coupon_from = 2 AND tuc.shop_id = #{param.shopId})) AND tuc.coupon_type IN (1,2,3) |
| | | WHERE tuc.del_flag = 0 AND tuc.coupon_status = 1 AND tuc.user_id = #{param.userId} AND (tuc.coupon_from = 1 OR (tuc.coupon_from = 2 AND tuc.shop_id = #{param.shopId})) AND tuc.coupon_type IN (1,2,3) AND CURRENT_DATE() < deadline_time |
| | | ORDER BY tuc.receive_time DESC |
| | | </select> |
| | | |
| | |
| | | <select id="listTodayBirthday" resultType="com.ruoyi.system.api.domain.poji.member.Member"> |
| | | SELECT * |
| | | FROM t_member |
| | | WHERE del_flag = 0 AND binding_flag = 1 AND birthday = CURRENT_DATE() |
| | | WHERE del_flag = 0 AND DATE_FORMAT(birthday, '%m%d') = DATE_FORMAT(now(), '%m%d') |
| | | </select> |
| | | </mapper> |
| | |
| | | //获取会员商品总数 |
| | | List<ServiceRecordDetail> serviceRecordDetailList = new ArrayList<>(); |
| | | ServiceRecordDetail serviceRecordDetail; |
| | | //MerMemberConsumerGoodsTotalVo memberGoodsTotal = this.getMemberConsumerGoodsTotalVo(merSureConsumerGoodsDto.getMemberUserId(), merSureConsumerGoodsDto.getShopId()); |
| | | List<String> consumerGoodsList = new ArrayList<>(); |
| | | List<Map<String, Object>> sendData = new ArrayList<>(); |
| | | for (MerSureConsumerGoodsListDto goodsDto : goodsList) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | consumerGoods = this.getById(goodsDto.getConsumerGoodsId()); |
| | | serviceRecordDetail = new ServiceRecordDetail(); |
| | | serviceNum = consumerGoods.getServiceNum(); |
| | |
| | | |
| | | int number = consumerGoods.getServiceNum() - consumerGoods.getUsedNum(); |
| | | if(number < 3){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("product", consumerGoods.getGoodsName()); |
| | | map.put("number", number); |
| | | sendData.add(map); |
| | |
| | | } |
| | | serviceRecordDetailList.add(serviceRecordDetail); |
| | | } |
| | | |
| | | //判断是否减人 |
| | | /*if (cycleService > 0 && memberGoodsTotal.getCycleOrder() - cycleService < 1) { |
| | | cyclePerson = 1; |
| | | } |
| | | if (serviceService > 0 && memberGoodsTotal.getServiceOrder() - serviceService < 1) { |
| | | servicePerson = 1; |
| | | } |
| | | if (experienceService > 0 && memberGoodsTotal.getExperienceOrder() - experienceService < 1) { |
| | | experiencePerson = 1; |
| | | }*/ |
| | | serviceCount = cycleService + serviceService + experienceService; |
| | | UserServiceRecord serviceRecord = new UserServiceRecord(); |
| | | serviceRecord.setCreateTime(new Date()); |
| | |
| | | memberTotalChange.setTypeService(2); |
| | | memberTotalChange.setServiceCount(serviceCount); |
| | | remoteMemberService.changeMemberTotal(memberTotalChange); |
| | | /*ShopTotalChangeDto shopTotalChange = new ShopTotalChangeDto(); |
| | | shopTotalChange.setShopId(merSureConsumerGoodsDto.getShopId()); |
| | | shopTotalChange.setTypeCycleService(2); |
| | | shopTotalChange.setCycleService(cycleService); |
| | | shopTotalChange.setCyclePerson(cyclePerson); |
| | | shopTotalChange.setTypeServiceService(2); |
| | | shopTotalChange.setServiceService(serviceService); |
| | | shopTotalChange.setServicePerson(servicePerson); |
| | | shopTotalChange.setTypeExperienceService(2); |
| | | shopTotalChange.setExperienceService(experienceService); |
| | | shopTotalChange.setExperiencePerson(experiencePerson); |
| | | remoteShopService.changeShopTotal(shopTotalChange);*/ |
| | | if(!sendData.isEmpty()){ |
| | | Member member = remoteMemberService.getMember(userId).getData(); |
| | | R<Shop> r = remoteShopService.getShop(shopId); |
| | |
| | | @ApiModelProperty(value = "推荐人") |
| | | private String recommendPerson; |
| | | |
| | | @ApiModelProperty(value = "部门id") |
| | | private Long deptId; |
| | | |
| | | @ApiModelProperty(value = "归属员工") |
| | | private Long belongUserId; |
| | | |
| | |
| | | * @param mgtShopPageDto |
| | | * @return |
| | | */ |
| | | List<MgtShopPageVo> pageMgtShop(Page page, @Param("param") MgtShopPageDto mgtShopPageDto); |
| | | List<MgtShopPageVo> pageMgtShop(Page page, @Param("param") MgtShopPageDto mgtShopPageDto, @Param("belongUserIds") List<Long> belongUserIds); |
| | | |
| | | |
| | | /** |
| | |
| | | if (StringUtils.isNotBlank(mgtShopPageDto.getShopTags())) { |
| | | mgtShopPageDto.setShopTags(mgtShopPageDto.getShopTags().replace(",", "|")); |
| | | } |
| | | List<Long> belongUserIds = null; |
| | | if(null != mgtShopPageDto.getDeptId()){ |
| | | if(null != mgtShopPageDto.getBelongUserId()){ |
| | | belongUserIds = new ArrayList<>(); |
| | | belongUserIds.add(mgtShopPageDto.getBelongUserId()); |
| | | }else{ |
| | | R<List<SysUser>> r = sysUserService.getUsersByDeptId(mgtShopPageDto.getDeptId()); |
| | | if(r.getCode() != 200){ |
| | | throw new RuntimeException(r.getMsg()); |
| | | } |
| | | belongUserIds = r.getData().stream().map(SysUser::getUserId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | // 分页查询商铺信息 |
| | | List<MgtShopPageVo> mgtShopPageVoList = shopMapper.pageMgtShop(page, mgtShopPageDto); |
| | | List<MgtShopPageVo> mgtShopPageVoList = shopMapper.pageMgtShop(page, mgtShopPageDto, belongUserIds); |
| | | // 如果查询结果不为空 |
| | | if (!mgtShopPageVoList.isEmpty()) { |
| | | // 创建签约用户ID集合和所属用户ID集合 |
| | |
| | | <if test="param.recommendPerson!=null and param.recommendPerson!=''"> |
| | | AND ts.recommend_person = #{param.recommendPerson} |
| | | </if> |
| | | <if test="param.belongUserId!=null and param.belongUserId!=''"> |
| | | AND ts.belong_user_id = #{param.belongUserId} |
| | | <if test="belongUserIds != null and belongUserIds.size() > 0"> |
| | | AND ts.belong_user_id in |
| | | <foreach collection="belongUserIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="param.belongShopId!=null and param.belongShopId!=''"> |
| | | AND ts.belong_shop_id = #{param.belongShopId} |
| | |
| | | package com.ruoyi.system.controller.sys; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | return R.ok(userIds); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据部门id获取用户列表 |
| | | * @param deptId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getUsersByDeptId") |
| | | R<List<SysUser>> getUsersByDeptId(@RequestBody Long deptId){ |
| | | List<SysUser> list = userService.list(new QueryWrapper<SysUser>().eq("dept_id", deptId).eq("del_flag", 0)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | |
| | | } |
| | | } |
| | | if(mgtClassNumDto.getSubClassId()!=null){ |
| | | SysClassification subSysClassification = this.getById(mgtClassNumDto.getAddClassId()); |
| | | SysClassification subSysClassification = this.getById(mgtClassNumDto.getSubClassId()); |
| | | if(subSysClassification!=null){ |
| | | subSysClassification.setRelationNum(subSysClassification.getRelationNum()-1); |
| | | this.saveOrUpdate(subSysClassification); |
| | |
| | | -- ---------------------------- |
| | | -- Records of sys_dept |
| | | -- ---------------------------- |
| | | INSERT INTO `sys_dept` VALUES (100, 0, '0', '鸿瑞堂总部', 0, '洪瑞堂', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2023-05-23 10:08:01', 'admin', '2023-08-03 15:43:22', 1, NULL); |
| | | INSERT INTO `sys_dept` VALUES (101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2023-05-23 10:08:01', 'admin', '2023-08-04 17:57:45', NULL, NULL); |
| | | INSERT INTO `sys_dept` VALUES (102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2023-05-23 10:08:01', 'admin', '2023-07-26 19:35:43', 4, NULL); |
| | | INSERT INTO `sys_dept` VALUES (100, 0, '0', '鸿瑞堂总部', 0, '洪瑞堂', '15888888888', '', '0', '0', 'admin', '2023-05-23 10:08:01', 'admin', '2023-08-03 15:43:22', 1, NULL); |
| | | INSERT INTO `sys_dept` VALUES (101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', '', '0', '0', 'admin', '2023-05-23 10:08:01', 'admin', '2023-08-04 17:57:45', NULL, NULL); |
| | | INSERT INTO `sys_dept` VALUES (102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', '', '0', '0', 'admin', '2023-05-23 10:08:01', 'admin', '2023-07-26 19:35:43', 4, NULL); |
| | | INSERT INTO `sys_dept` VALUES (110, 100, '0,100', '测试部门名称1', 1, NULL, NULL, NULL, '0', '2', 'admin', '2023-06-25 15:54:39', '', NULL, NULL, NULL); |
| | | INSERT INTO `sys_dept` VALUES (111, 100, '0,100', '测试部门名称2', 1, NULL, NULL, NULL, '0', '2', 'admin', '2023-06-25 15:55:57', '', NULL, NULL, NULL); |
| | | INSERT INTO `sys_dept` VALUES (114, 100, '0,100', '测试部门名称3', 1, NULL, NULL, NULL, '0', '2', 'admin', '2023-06-25 16:12:19', '', NULL, NULL, NULL); |