Merge remote-tracking branch 'origin/master'
| | |
| | | public R<CouponInfoVo> getCouponInfo(Long userCouponId) { |
| | | return R.fail("根据用户优惠券id获取优惠券详情失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> getCouponCount(Integer couponId) { |
| | | return R.fail("根据优惠券id获取优惠券数量失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | */ |
| | | @PostMapping("/user-coupon/getCouponInfo") |
| | | R<CouponInfoVo> getCouponInfo(@RequestParam("userCouponId") Long userCouponId); |
| | | |
| | | @GetMapping("/user-coupon/getCouponCount") |
| | | R<Long> getCouponCount(@RequestParam("couponId") Integer couponId); |
| | | } |
| | |
| | | private Integer status; |
| | | |
| | | |
| | | @ApiModelProperty(value = "领取用户姓名") |
| | | @TableField(exist = false) |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "领取用户手机号") |
| | | @TableField(exist = false) |
| | | private String phone; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @TableField("object_id") |
| | | private Long objectId; |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | @TableField(exist = false) |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField(exist = false) |
| | | private String phone; |
| | | |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField(exist = false) |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField(exist = false) |
| | | private LocalDateTime endTime; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Long> userIds; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("积分支付") |
| | | private Boolean pointPayment; |
| | | @ApiModelProperty("配送方式(1=自提,2=快递)") |
| | | private Integer distributionMode; |
| | | private String distributionMode; |
| | | /** |
| | | * 可获得消费积分 |
| | | */ |
| | |
| | | private BigDecimal paymentAmount; |
| | | |
| | | @ApiModelProperty(value = "配送方式(1=自提,2=快递)") |
| | | private Integer distributionMode; |
| | | private String distributionMode; |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | private String shopName; |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | @TableField("period_start_time") |
| | | private LocalDateTime periodStartTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate periodStartTime; |
| | | |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | @TableField("period_end_time") |
| | | private LocalDateTime periodEndTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate periodEndTime; |
| | | |
| | | @ApiModelProperty(value = "领取后x天有效") |
| | | @TableField("period_days") |
| | |
| | | |
| | | @ApiModelProperty(value = "开始发放时间") |
| | | @TableField("send_start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime sendStartTime; |
| | | |
| | | @ApiModelProperty(value = "结束发放时间") |
| | | @TableField("send_end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime sendEndTime; |
| | | |
| | | @ApiModelProperty(value = "1免费发放2积分兑换") |
| | |
| | | @TableField("person_ids") |
| | | private String personIds; |
| | | |
| | | @ApiModelProperty(value = "上架状态:0-下架 1-上架") |
| | | @TableField("shelf_status") |
| | | private Integer shelfStatus; |
| | | |
| | | @ApiModelProperty(value = "已发放数量") |
| | | @TableField(exist = false) |
| | | private Long sendNumNow; |
| | | |
| | | @ApiModelProperty(value = "指定会员等级,逗号隔开") |
| | | private String vipIds; |
| | | |
| | | public String getIdStr() { |
| | | return String.valueOf(id); |
| | | } |
| | | } |
| | |
| | | @TableField("purchase_limit") |
| | | private Integer purchaseLimit; |
| | | |
| | | @ApiModelProperty(value = "配送方式(1=自提,2=快递)") |
| | | @ApiModelProperty(value = "配送方式(1=自提,2=快递,1,2 = 自提+快递)") |
| | | @TableField("distribution_mode") |
| | | private Integer distributionMode; |
| | | private String distributionMode; |
| | | |
| | | @ApiModelProperty(value = "指定门店(1=指定,2=所有)") |
| | | @TableField("appoint_store") |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "活动开始日期") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "活动结束日期") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "满x元") |
| | |
| | | @TableField(exist = false) |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "主键字符串") |
| | | @TableField(exist = false) |
| | | private String idStr; |
| | | |
| | | @ApiModelProperty(value = "会员名称") |
| | | @TableField(exist = false) |
| | | private String vipName; |
| | | |
| | | public String getIdStr() { |
| | | return String.valueOf(id); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @TableField("end_time") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "是否上架:0否 1是") |
| | | @TableField("is_shelves") |
| | | private Integer isShelves; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private List<GoodsSeckill> goodsSeckills; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "店长姓名") |
| | | @TableField(exist = false) |
| | | private String managerName; |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.other.api.feignClient.VipSettingClient; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/12/10 13:53 |
| | |
| | | public R<VipSetting> getVipSetting(Integer id) { |
| | | return R.fail("查询会员配置失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<VipSetting>> info() { |
| | | return R.fail("获取会员配置失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | import com.ruoyi.other.api.factory.BaseSettingClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/base-setting/getBaseSetting") |
| | | @GetMapping("/base-setting/getBaseSetting") |
| | | R<BaseSetting> getBaseSetting(@RequestParam("id") Integer id); |
| | | } |
| | |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.factory.VipSettingClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @PostMapping("/vip-setting/getVipSetting") |
| | | R<VipSetting> getVipSetting(@RequestParam("id") Integer id); |
| | | |
| | | @GetMapping("/vip-setting/info") |
| | | R<List<VipSetting>> info(); |
| | | } |
| | |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="forbiddenRemark" column="forbidden_remark"/> |
| | | <result property="remark" column="remark" /> |
| | | <result property="roleType" column="roleType" /> |
| | | <result property="roleType" column="role_type" /> |
| | | <result property="objectId" column="objectId" /> |
| | | <association property="dept" column="dept_id" javaType="com.ruoyi.system.api.domain.SysDept" resultMap="deptResult" /> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.role_type, u.create_by, u.create_time, u.remark, |
| | | d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, |
| | | r.role_id, r.role_name, r.role_key, r.data_scope, r.status as role_status ,u.roleType as roleType,u.objectId AS objectId |
| | | r.role_id, r.role_name, r.role_key, r.data_scope, r.status as role_status ,u.role_type as roleType,u.objectId AS objectId |
| | | from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | |
| | | <if test="null != req.status"> |
| | | and status = #{req.status} |
| | | </if> |
| | | and del_flag = '0' and roleType =1 |
| | | and del_flag = '0' and role_type =1 |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getAllList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select *,user_id userId,nick_name userName ,create_time createTime ,login_date loginDate from sys_user where roleType=3 and user_id in |
| | | select *,user_id userId,nick_name userName ,create_time createTime ,login_date loginDate from sys_user where role_type=3 and user_id in |
| | | |
| | | <foreach collection="ids" separator="," open="(" item="id" index="index" close=")" > |
| | | #{id} |
| | |
| | | AND nick_name LIKE concat('%',#{query.nickName},'%') |
| | | </if> |
| | | AND del_flag = '0' |
| | | AND roleType = 1 |
| | | AND role_type = 1 |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | |
| | | <if test="password != null and password != ''">password,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="roleType != null and roleType != ''">roleType,</if> |
| | | <if test="roleType != null and roleType != ''">role_type,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="objectId != null and objectId != ''">objectId,</if> |
| | | create_time |
| | |
| | | |
| | | |
| | | @GetMapping("/mine/list") |
| | | @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵"}) |
| | | @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵","后台管理-活动管理-优惠券管理"}) |
| | | public R<Page<UserCoupon>> minelist(@RequestParam Integer pageNum, @RequestParam Integer pageSize, @ApiParam("1未使用2已使用3已过期") Integer status) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | Page<UserCoupon> page = userCouponService.lambdaQuery() |
| | |
| | | }else { |
| | | record.setStatus(2); |
| | | } |
| | | |
| | | |
| | | AppUser appUser = appUserService.getById(record.getAppUserId()); |
| | | record.setUserName(appUser.getName()); |
| | | record.setPhone(appUser.getPhone()); |
| | | } |
| | | return R.ok(page); |
| | | } |
| | |
| | | BeanUtils.copyProperties(data, couponInfoVo); |
| | | return R.ok(couponInfoVo); |
| | | } |
| | | |
| | | /** |
| | | * 获取优惠券发放数量 |
| | | */ |
| | | @GetMapping("/getCouponCount") |
| | | public R<Long> getCouponCount(@RequestParam Integer couponId){ |
| | | return R.ok(userCouponService.lambdaQuery().eq(UserCoupon::getCouponId, couponId).count()); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointStatistics; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | public class UserPointController extends BaseController { |
| | | @Resource |
| | | private UserPointService userPointService; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | /** |
| | |
| | | userPointService.save(userPoint); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 积分统计 |
| | | */ |
| | | @GetMapping("/statistics") |
| | | @ApiOperation(value = "积分统计", tags = "管理后台-财务统计-用户积分统计") |
| | | public R<UserPointStatistics> statistics(UserPoint userPoint) { |
| | | return R.ok(userPointService.getStatistics(userPoint)); |
| | | } |
| | | |
| | | /** |
| | | * 变更记录 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "积分变更记录", tags = "管理后台-财务统计-用户积分统计") |
| | | public R<IPage<UserPoint>> list(@ApiParam("页码") @RequestParam Integer pageNum, @ApiParam("大小") Integer pageSize, UserPoint userPoint) { |
| | | IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(pageNum, pageSize), userPoint); |
| | | return R.ok(userPointPage); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出 |
| | | */ |
| | | @GetMapping("/export") |
| | | @ApiOperation(value = "积分变更记录导出", tags = "管理后台-财务统计-用户积分统计") |
| | | public void export(HttpServletResponse response, UserPoint userPoint) { |
| | | IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(1, Integer.MAX_VALUE), userPoint); |
| | | List<UserPoint> userPointList = userPointPage.getRecords(); |
| | | ExcelUtil<UserPoint> util = new ExcelUtil<>(UserPoint.class); |
| | | util.exportExcel(response, userPointList, "用户积分统计"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.feignClient.BaseSettingClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsVipClient; |
| | | import com.ruoyi.other.api.feignClient.RemoteVipSettingClient; |
| | | import com.ruoyi.other.api.feignClient.VipGoodClient; |
| | | import com.ruoyi.other.api.feignClient.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | private VipCenterService vipCenterService; |
| | | @Resource |
| | | private VipGoodClient vipGoodClient; |
| | | @Resource |
| | | private GoodsClient goodsClient; |
| | | |
| | | |
| | | @GetMapping("getVipLevelList") |
| | |
| | | if (vipGoodList != null && !vipGoodList.isEmpty()) { |
| | | List<String> goodsNames = new ArrayList<>(); |
| | | vipGoodList.forEach(vipGood -> { |
| | | String goodJson = vipGood.getGoodJson(); |
| | | if (isValidJson(goodJson)) { |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | goodsNames.add(goods.getName()); |
| | | } else { |
| | | log.warn("JSON无效: " + goodJson); |
| | | Integer goodId = vipGood.getGoodId(); |
| | | R<Goods> goodsR = goodsClient.getGoodsById(goodId); |
| | | if (R.isError(goodsR)) { |
| | | throw new ServiceException("商品信息获取失败"); |
| | | } |
| | | Goods goods = goodsR.getData(); |
| | | goodsNames.add(goods.getName()); |
| | | }); |
| | | level.setGoodsNames(goodsNames); |
| | | } |
| | |
| | | public interface UserPointMapper extends BaseMapper<UserPoint> { |
| | | |
| | | List<UserPoint> findLatestUserPointByTypeForUser(Long userId); |
| | | |
| | | List<UserPoint> findLatestChangeByType(UserPoint userPoint); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointStatistics; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | |
| | | List<UserPointDetailVO> getUserPointDetail(Long userId, LocalDateTime startTime, LocalDateTime endTime, Integer type); |
| | | |
| | | void transferPoint(BigDecimal point, String phone); |
| | | |
| | | UserPointStatistics getStatistics(UserPoint userPoint); |
| | | |
| | | |
| | | IPage<UserPoint> getUserPointPage(Page<UserPoint> page, UserPoint userPoint); |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.account.service.VipSettingService; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointStatistics; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.PhoneNumberValidator; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.PointSetting; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private VipSettingService vipSettingService; |
| | | @Resource |
| | | private PointSettingService pointSettingService; |
| | | @Resource |
| | | private UserPointMapper userPointMapper; |
| | | |
| | | @Override |
| | | public UserPointVO getUserPoint(Long userId) { |
| | |
| | | } |
| | | Integer buyPointOpen = pointSetting.getBuyPointOpen(); |
| | | |
| | | List<UserPoint> userPointList = list(new LambdaQueryWrapper<UserPoint>() |
| | | .eq(UserPoint::getAppUserId, userid)); |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setAppUserId(userid); |
| | | List<UserPoint> userPointList = userPointMapper.findLatestChangeByType(userPoint); |
| | | Map<Integer, Integer> userBalanceMap = userPointList.stream() |
| | | .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance)); |
| | | |
| | |
| | | private int getAdjustedPoint(Map<Integer, Integer> userBalanceMap, int pointTypeCode, boolean isOpen) { |
| | | return isOpen ? 0 : Optional.ofNullable(userBalanceMap.get(pointTypeCode)).orElse(0); |
| | | } |
| | | |
| | | @Override |
| | | public UserPointStatistics getStatistics(UserPoint userPoint) { |
| | | |
| | | List<Long> userIds = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(userPoint.getUserName())) { |
| | | userIds = appUserService.listObjs(new LambdaQueryWrapper<AppUser>() |
| | | .select(AppUser::getId) |
| | | .like(AppUser::getName, userPoint.getUserName())) |
| | | .stream() |
| | | .map(appUserId -> (Long) appUserId) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | List<UserPoint> userPointList = userPointMapper.findLatestChangeByType(userPoint); |
| | | Map<Integer, Integer> userBalanceMap = userPointList.stream() |
| | | .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance)); |
| | | |
| | | |
| | | |
| | | Integer consumePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.CONSUME.getCode())).orElse(0); |
| | | Integer sharePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.COMMISSION_RETURN.getCode())).orElse(0); |
| | | Integer pullNewPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.NEW_USER_REFERRAL.getCode())).orElse(0); |
| | | Integer registerPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.REGISTRATION.getCode())).orElse(0); |
| | | Integer workPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.WORK_PERFORMANCE.getCode())).orElse(0); |
| | | Integer shopAchievementPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.TECHNICIAN_PERFORMANCE.getCode())).orElse(0); |
| | | Integer exchangeGoodsPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.EXCHANGE_GOODS.getCode())).orElse(0); |
| | | Integer storeAchievementPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.STORE_PERFORMANCE.getCode())).orElse(0); |
| | | Integer storeCommissionPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.STORE_COMMISSION_RETURN.getCode())).orElse(0); |
| | | Integer transferPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.TRANSFER_POINTS.getCode())).orElse(0); |
| | | Integer totalPoint = consumePoint + sharePoint + pullNewPoint + registerPoint + workPoint + shopAchievementPoint + exchangeGoodsPoint + storeAchievementPoint + storeCommissionPoint + transferPoint; |
| | | |
| | | |
| | | UserPointStatistics userPointStatistics = new UserPointStatistics(); |
| | | userPointStatistics.setTotalPoint(totalPoint); |
| | | userPointStatistics.setConsumePoint(consumePoint); |
| | | userPointStatistics.setSharePoint(sharePoint); |
| | | userPointStatistics.setPullNewPoint(pullNewPoint); |
| | | userPointStatistics.setRegisterPoint(registerPoint); |
| | | userPointStatistics.setWorkPoint(workPoint); |
| | | userPointStatistics.setShopAchievementPoint(shopAchievementPoint); |
| | | return userPointStatistics; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<UserPoint> getUserPointPage(Page<UserPoint> page, UserPoint userPoint) { |
| | | List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .eq(AppUser::getPhone, userPoint.getPhone()) |
| | | .like(AppUser::getName, userPoint.getUserName())); |
| | | List<Long> userIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | |
| | | Page<UserPoint> userPointPage = page(page, new LambdaQueryWrapper<UserPoint>() |
| | | .in(!CollectionUtils.isEmpty(userIds), UserPoint::getAppUserId, userIds) |
| | | .eq(UserPoint::getType, userPoint.getType()) |
| | | .between(UserPoint::getCreateTime, userPoint.getStartTime(), userPoint.getEndTime()) |
| | | .orderByDesc(UserPoint::getCreateTime)); |
| | | |
| | | userPointPage.getRecords().forEach(userPoint1 -> appUserList.stream() |
| | | .filter(appUser -> appUser.getId().equals(userPoint1.getAppUserId())) |
| | | .findFirst().ifPresent(appUser -> { |
| | | userPoint1.setUserName(appUser.getName()); |
| | | userPoint1.setPhone(appUser.getPhone()); |
| | | })); |
| | | return userPointPage; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.VipGood; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.other.api.feignClient.VipGoodClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | |
| | | private ShopClient shopClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private GoodsClient goodsClient; |
| | | |
| | | |
| | | @Override |
| | |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | String goodJson = vipGood.getGoodJson(); |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | Integer goodId = vipGood.getGoodId(); |
| | | R<Goods> goodsR = goodsClient.getGoodsById(goodId); |
| | | if (R.isError(goodsR)){ |
| | | throw new ServiceException("商品信息获取失败"); |
| | | } |
| | | Goods goods = goodsR.getData(); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
| | |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | String goodJson = vipGood.getGoodJson(); |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | R<Goods> goodsR = goodsClient.getGoodsById(vipGood.getGoodId()); |
| | | if (R.isError(goodsR)){ |
| | | throw new ServiceException("商品信息获取失败"); |
| | | } |
| | | |
| | | Goods goods = goodsR.getData(); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
| | |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | String goodJson = vipGood.getGoodJson(); |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | R<Goods> goodsR = goodsClient.getGoodsById(vipGood.getGoodId()); |
| | | if (R.isError(goodsR)){ |
| | | throw new ServiceException("商品信息获取失败"); |
| | | } |
| | | Goods goods = goodsR.getData(); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Api("积分统计") |
| | | public class UserPointStatistics { |
| | | |
| | | @ApiModelProperty(value = "总积分") |
| | | private Integer totalPoint; |
| | | |
| | | @ApiModelProperty(value = "消费积分总数") |
| | | private Integer consumePoint; |
| | | |
| | | @ApiModelProperty(value = "返佣积分总数") |
| | | private Integer sharePoint; |
| | | |
| | | @ApiModelProperty(value = "拉新人积分总数") |
| | | private Integer pullNewPoint; |
| | | |
| | | @ApiModelProperty(value = "注册积分总数") |
| | | private Integer registerPoint; |
| | | |
| | | @ApiModelProperty(value = "做工积分总数") |
| | | private Integer workPoint; |
| | | |
| | | @ApiModelProperty(value = "技师业绩积分总数") |
| | | private Integer shopAchievementPoint; |
| | | |
| | | } |
| | |
| | | t1.* |
| | | FROM |
| | | t_user_point t1 |
| | | INNER JOIN ( SELECT type, MAX( create_time ) AS max_create_time FROM t_user_point WHERE app_user_id = 1864118151377129473 GROUP BY type ) t2 ON t1.type = t2.type |
| | | INNER JOIN ( SELECT type, MAX( create_time ) AS max_create_time FROM t_user_point WHERE app_user_id = #{userId} GROUP BY type ) t2 ON t1.type = t2.type |
| | | AND t1.create_time = t2.max_create_time |
| | | WHERE |
| | | t1.app_user_id = #{userId} |
| | | </select> |
| | | <select id="findLatestChangeByType" resultType="com.ruoyi.account.api.model.UserPoint"> |
| | | SELECT |
| | | id, |
| | | type, |
| | | historical_point, |
| | | variable_point, |
| | | balance, |
| | | create_time, |
| | | app_user_id, |
| | | object_id |
| | | FROM ( |
| | | SELECT |
| | | id, |
| | | type, |
| | | historical_point, |
| | | variable_point, |
| | | balance, |
| | | create_time, |
| | | app_user_id, |
| | | object_id, |
| | | ROW_NUMBER() OVER (PARTITION BY type ORDER BY create_time DESC) AS rn |
| | | FROM |
| | | t_user_point |
| | | ) AS subquery |
| | | WHERE |
| | | rn = 1 |
| | | <if test="type != null"> |
| | | AND type = #{type} |
| | | </if> |
| | | <if test="appUserId != null"> |
| | | AND app_user_id = #{appUserId} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, appUser.getId()).eq(Order::getDelFlag, 0).in(Order::getOrderStatus, Arrays.asList(4, 8))); |
| | | List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList()); |
| | | int sum = 0; |
| | | if(orderIds.size() > 0){ |
| | | if(!orderIds.isEmpty()){ |
| | | List<OrderGood> orderGoodList = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().in(OrderGood::getOrderId, orderIds) |
| | | .eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0)); |
| | | sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum(); |
| | |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | import com.ruoyi.other.service.BaseSettingService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getBaseSetting") |
| | | @GetMapping("/getBaseSetting") |
| | | @ApiOperation(value = "获取基础配置", tags = {"管理后台-基础配置"}) |
| | | public R<BaseSetting> getBaseSetting(@RequestParam("id") Integer id){ |
| | | BaseSetting baseSetting = baseSettingService.getById(id); |
| | | return R.ok(baseSetting); |
| | |
| | | /** |
| | | * 保存设置 |
| | | */ |
| | | @ApiOperation(value = "保存设置", tags = {"管理后台-基础配置"}) |
| | | @PostMapping("/save") |
| | | public R saveActivityConfig(@RequestBody String json){ |
| | | JSONObject jsonObject = JSONObject.parseObject(json); |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.UserCouponClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.service.CouponInfoService; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private UserCouponClient userCouponClient; |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "优惠劵管理-列表", tags = {"管理后台-活动管理"}) |
| | | public R<IPage<CouponInfo>> list(@RequestParam("pageNum") Integer pageNum, |
| | | @RequestParam("pageSize") Integer pageSize, |
| | | CouponInfo couponInfo) { |
| | | IPage<CouponInfo> couponInfoIPage = couponInfoService.queryCouponInfoPage(Page.of(pageNum, pageSize), couponInfo); |
| | | for (CouponInfo record : couponInfoIPage.getRecords()) { |
| | | R<Long> r = userCouponClient.getCouponCount(record.getId()); |
| | | record.setSendNumNow(r.getData()); |
| | | } |
| | | return R.ok(couponInfoIPage); |
| | | } |
| | | |
| | | |
| | | //查看详情 |
| | | @PostMapping("/detail") |
| | | @ApiOperation(value = "活动管理-优惠劵管理-详情", tags = {"管理后台"}) |
| | | public R<CouponInfo> detail(@RequestParam("id") Integer id){ |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "优惠劵管理-详情", tags = {"管理后台-活动管理"}) |
| | | public R<CouponInfo> detail(@RequestParam("id") Integer id) { |
| | | CouponInfo byId = couponInfoService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | // 删除优惠劵 |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "优惠劵管理-删除", tags = {"管理后台-活动管理"}) |
| | | public R<Void> delete(@RequestParam("id") Integer id) { |
| | | couponInfoService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 编辑优惠劵 |
| | | @PostMapping("/edit") |
| | | @ApiOperation(value = "优惠劵管理-编辑", tags = {"管理后台-活动管理"}) |
| | | public R<Void> edit(@RequestBody CouponInfo couponInfo) { |
| | | couponInfoService.updateById(couponInfo); |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 修改上/下架状态 |
| | | @PostMapping("/editStatus") |
| | | @ApiOperation(value = "优惠劵管理-修改上/下架状态", tags = {"管理后台-活动管理"}) |
| | | public R<Void> editStatus(@RequestParam("id") Integer id, |
| | | @RequestParam("shelfStatus") Integer shelfStatus) { |
| | | CouponInfo couponInfo = new CouponInfo(); |
| | | couponInfo.setId(id); |
| | | couponInfo.setShelfStatus(shelfStatus); |
| | | couponInfoService.updateById(couponInfo); |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 添加优惠券 |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "优惠劵管理-添加", tags = {"管理后台-活动管理"}) |
| | | public R<Void> add(@RequestBody CouponInfo couponInfo) { |
| | | couponInfo.setShelfStatus(0); |
| | | couponInfoService.save(couponInfo); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/gift/list") |
| | | @ApiOperation(value = "待领取列表", tags = {"小程序-个人中心-优惠劵"}) |
| | | public R<List<CouponInfo>> giftlist(){ |
| | | public R<List<CouponInfo>> giftlist() { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser appUserById = appUserClient.getAppUserById(userid); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | |
| | | List<CouponInfo> list1 = couponInfoService.lambdaQuery().le(CouponInfo::getSendStartTime, now).ge(CouponInfo::getSendEndTime, now).eq(CouponInfo::getPersonType, 2).apply("FIND_IN_SET('" + appUserById.getId() + "', person_ids)").list(); |
| | | //查出指定会员可领取优惠劵 |
| | | List<CouponInfo> list2 = couponInfoService.lambdaQuery().le(CouponInfo::getSendStartTime, now).ge(CouponInfo::getSendEndTime, now).eq(CouponInfo::getPersonType, 3).apply("FIND_IN_SET('" + appUserById.getVipId() + "', person_ids)").list(); |
| | | List<CouponInfo> returnList= new ArrayList<>(); |
| | | List<CouponInfo> returnList = new ArrayList<>(); |
| | | count(userid, list, returnList); |
| | | count(userid, list1, returnList); |
| | | count(userid, list2, returnList); |
| | |
| | | private void count(Long userid, List<CouponInfo> list1, List<CouponInfo> returnList) { |
| | | for (CouponInfo couponInfo : list1) { |
| | | Long count = appUserClient.getCouponCount(userid, couponInfo.getId()).getData(); |
| | | couponInfo.setMaxNum(couponInfo.getMaxNum()-count.intValue()); |
| | | couponInfo.setMaxNum(couponInfo.getMaxNum() - count.intValue()); |
| | | for (int i = 0; i < couponInfo.getMaxNum(); i++) { |
| | | returnList.add(couponInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据id获取优惠券数据 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getCouponInfoList") |
| | | public R<List<CouponInfo>> getCouponInfoList(@RequestParam("ids") List<Integer> ids){ |
| | | List<CouponInfo> couponInfos = couponInfoService.listByIds(ids); |
| | | return R.ok(couponInfos); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取优惠券数据 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getCouponInfoList") |
| | | public R<List<CouponInfo>> getCouponInfoList(@RequestParam("ids") List<Integer> ids) { |
| | | List<CouponInfo> couponInfos = couponInfoService.listByIds(ids); |
| | | return R.ok(couponInfos); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | /** |
| | | * 根据商品id和会员等级获取门店特价 |
| | | * |
| | | * @param goodsBargainPrice |
| | | * @return |
| | | */ |
| | | @PostMapping("/getGoodsBargainPrice") |
| | | public R<GoodsBargainPriceDetail> getGoodsBargainPrice(@RequestBody GetGoodsBargainPrice goodsBargainPrice) { |
| | |
| | | .eq(!CollectionUtils.isEmpty(goodsIds), GoodsBargainPrice::getGoodsId, goodsId) |
| | | .eq(auditStatus != null, GoodsBargainPrice::getAuditStatus, auditStatus)); |
| | | |
| | | page.getRecords().forEach(goodsBargainPrice -> { |
| | | goodsList.stream() |
| | | .filter(goods -> goods.getId().equals(goodsBargainPrice.getGoodsId())) |
| | | .findFirst().ifPresent(g -> { |
| | | GoodsCategory goodsCategory = goodsCategoryService.getById(g.getGoodsCategoryId()); |
| | | Integer shopId = goodsBargainPrice.getShopId(); |
| | | Shop shop = shopService.getById(shopId); |
| | | R<AppUser> r = appUserClient.getAppUserByPhone(shop.getPhone()); |
| | | if (R.isError(r)){ |
| | | throw new RuntimeException("获取店长信息失败"); |
| | | } |
| | | goodsBargainPrice.setOwnerName(r.getData().getName()); |
| | | goodsBargainPrice.setOwnerPhone(shop.getPhone()); |
| | | goodsBargainPrice.setShopName(shop.getName()); |
| | | goodsBargainPrice.setGoodsName(g.getName()); |
| | | goodsBargainPrice.setCategoryName(goodsCategory.getName()); |
| | | }); |
| | | }); |
| | | page.getRecords().forEach(goodsBargainPrice -> goodsList.stream() |
| | | .filter(goods -> goods.getId().equals(goodsBargainPrice.getGoodsId())) |
| | | .findFirst().ifPresent(g -> { |
| | | GoodsCategory goodsCategory = goodsCategoryService.getById(g.getGoodsCategoryId()); |
| | | Integer shopId = goodsBargainPrice.getShopId(); |
| | | Shop shop = shopService.getById(shopId); |
| | | R<AppUser> r = appUserClient.getAppUserByPhone(shop.getPhone()); |
| | | if (R.isError(r)){ |
| | | throw new RuntimeException("获取店长信息失败"); |
| | | } |
| | | goodsBargainPrice.setOwnerName(r.getData().getName()); |
| | | goodsBargainPrice.setOwnerPhone(shop.getPhone()); |
| | | goodsBargainPrice.setShopName(shop.getName()); |
| | | goodsBargainPrice.setGoodsName(g.getName()); |
| | | goodsBargainPrice.setCategoryName(goodsCategory.getName()); |
| | | })); |
| | | |
| | | return R.ok(page); |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.VipSettingClient; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import io.swagger.annotations.Api; |
| | |
| | | public class GoodsController extends BaseController { |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | @Resource |
| | | private VipSettingClient settingClient; |
| | | |
| | | /** |
| | | * 添加商品 |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取会员等级信息 |
| | | */ |
| | | @GetMapping("/getVipSetting") |
| | | @ApiOperation(value = "会员等级信息", tags = {"管理后台-商品管理"}) |
| | | public R<List<VipSetting>> getVipSetting(){ |
| | | return settingClient.info(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.other.api.domain.OrderActivityInfo; |
| | | import com.ruoyi.other.service.OrderActivityInfoService; |
| | | import com.ruoyi.other.service.VipSettingService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | |
| | | @Resource |
| | | private OrderActivityInfoService orderActivityInfoService; |
| | | @Resource |
| | | private VipSettingService vipSettingService; |
| | | |
| | | |
| | | /** |
| | |
| | | * 添加活动 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperation(value = "添加活动", tags = {"管理后台-活动管理-订单优惠活动"}) |
| | | @ApiOperation(value = "订单优惠活动-添加活动", tags = {"管理后台-活动管理"}) |
| | | public R<Void> saveActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){ |
| | | orderActivityInfo.setIsShelf(0); |
| | | orderActivityInfoService.save(orderActivityInfo); |
| | | return R.ok(); |
| | | } |
| | |
| | | /** |
| | | * 删除活动 |
| | | */ |
| | | @PostMapping("/delete") |
| | | @ApiOperation(value = "删除活动", tags = {"管理后台-活动管理-订单优惠活动-"}) |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "订单优惠活动-删除活动", tags = {"管理后台-活动管理"}) |
| | | public R<Void> deleteActivityConfig(@RequestParam("id") Long id){ |
| | | orderActivityInfoService.removeById(id); |
| | | return R.ok(); |
| | |
| | | * 修改活动 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperation(value = "修改活动", tags = {"管理后台-活动管理-订单优惠活动-"}) |
| | | @ApiOperation(value = "修改活动", tags = {"管理后台-活动管理"}) |
| | | public R<Void> updateActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){ |
| | | orderActivityInfo.setId(Long.valueOf(orderActivityInfo.getIdStr())); |
| | | orderActivityInfoService.updateById(orderActivityInfo); |
| | | return R.ok(); |
| | | } |
| | |
| | | * 获取活动列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取活动列表", tags = {"管理后台-活动管理-订单优惠活动"}) |
| | | @ApiOperation(value = "订单优惠活动-获取活动列表", tags = {"管理后台-活动管理"}) |
| | | public R<Page<OrderActivityInfo>> list(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | OrderActivityInfo orderActivityInfo){ |
| | | |
| | | return R.ok(orderActivityInfoService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<OrderActivityInfo>() |
| | | Page<OrderActivityInfo> page = orderActivityInfoService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<OrderActivityInfo>() |
| | | .eq(orderActivityInfo.getId() != null, OrderActivityInfo::getId, orderActivityInfo.getId()) |
| | | .eq(StringUtils.isNotEmpty(orderActivityInfo.getActivityName()), OrderActivityInfo::getActivityName, orderActivityInfo.getActivityName()) |
| | | .lt(orderActivityInfo.getStatus() == 0, OrderActivityInfo::getStartTime, orderActivityInfo.getStartTime()) |
| | | .ge(orderActivityInfo.getStatus() == 1, OrderActivityInfo::getEndTime, orderActivityInfo.getStartTime()) |
| | | .eq(orderActivityInfo.getIsShelf() != null, OrderActivityInfo::getIsShelf, orderActivityInfo.getIsShelf()))); |
| | | .lt(orderActivityInfo.getStatus() != null && orderActivityInfo.getStatus() == 0, OrderActivityInfo::getStartTime, orderActivityInfo.getStartTime()) |
| | | .ge(orderActivityInfo.getStatus() != null && orderActivityInfo.getStatus() == 1, OrderActivityInfo::getEndTime, orderActivityInfo.getStartTime()) |
| | | .eq(orderActivityInfo.getIsShelf() != null, OrderActivityInfo::getIsShelf, orderActivityInfo.getIsShelf())); |
| | | page.getRecords().forEach(item -> { |
| | | LocalDateTime startTime = item.getStartTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime endTime = item.getEndTime(); |
| | | if (endTime.isBefore(now)){ |
| | | item.setStatus(2); //已结束 |
| | | }else if (startTime.isBefore(now)){ |
| | | item.setStatus(1); // 已开始 |
| | | }else { |
| | | item.setStatus(0); // 未开始 |
| | | } |
| | | |
| | | String vipIds = item.getVipIds(); |
| | | if (StringUtils.isNotEmpty(vipIds)){ |
| | | String[] vipIdArr = vipIds.split(","); |
| | | if (vipIdArr.length == 7){ |
| | | item.setVipName("全部"); |
| | | }else { |
| | | List<String> vipNameList = new ArrayList<>(); |
| | | for (String vipId : vipIdArr) { |
| | | String vipName = vipSettingService.getById(Long.parseLong(vipId)).getVipName(); |
| | | vipNameList.add(vipName); |
| | | } |
| | | item.setVipName(String.join(",", vipNameList)); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | /** |
| | | * 获取活动详情 |
| | | */ |
| | | @GetMapping("/getDetailById") |
| | | @ApiOperation(value = "获取活动详情", tags = {"管理后台-活动管理-订单优惠活动"}) |
| | | public R<OrderActivityInfo> getDetailById(@RequestParam("id") Long id){ |
| | | return R.ok(orderActivityInfoService.getById(id)); |
| | | @ApiOperation(value = "订单优惠活动-获取活动详情", tags = {"管理后台-活动管理"}) |
| | | public R<OrderActivityInfo> getDetailById(@RequestParam("id") String id){ |
| | | return R.ok(orderActivityInfoService.getById(Long.parseLong(id))); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取红包配置 |
| | | */ |
| | | @ApiOperation(value = "获取红包配置", tags = {"管理后台-活动管理-签到红包"}) |
| | | @GetMapping("/getRedPackegeSet") |
| | | public R<RedPackegeSet> getRedPackegeSet(){ |
| | | return R.ok(redPackegeSetService.getOne(null)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加红包配置 |
| | | */ |
| | | @ApiOperation(value = "添加红包配置", tags = {"管理后台-活动管理-签到红包"}) |
| | | @GetMapping("/addRedPackegeSet") |
| | | public R<Void> addRedPackegeSet(RedPackegeSet redPackegeSet){ |
| | | RedPackegeSet one = redPackegeSetService.getOne(null); |
| | | if (one==null){ |
| | | redPackegeSet.setId(1); |
| | | redPackegeSetService.save(redPackegeSet); |
| | | }else { |
| | | if (one.getId()==null){ |
| | | return R.fail("参数错误"); |
| | | } |
| | | redPackegeSetService.updateById(redPackegeSet); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除红包配置 |
| | | */ |
| | | @ApiOperation(value = "删除红包配置", tags = {"管理后台-活动管理-签到红包"}) |
| | | @GetMapping("/delRedPackegeSet") |
| | | public R<Void> delRedPackegeSet(){ |
| | | redPackegeSetService.removeById(1); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/region") |
| | | @Api("地区") |
| | | @Api(tags = "地区") |
| | | public class RegionController { |
| | | @Resource |
| | | private RegionService regionService; |
| | | |
| | | /** |
| | | * 获取省份列表 |
| | | * 省市区级联 |
| | | */ |
| | | @GetMapping("/getProvinceList") |
| | | @ApiOperation("获取省份列表") |
| | | public R<List<Region>> getProvinceList() { |
| | | @ApiOperation("省市区级联") |
| | | public R<List<Region>> getProvinceList(@ApiParam("父级id") @RequestParam Long parentId) { |
| | | return R.ok(regionService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId, 0))); |
| | | .eq(Region::getParentId, parentId))); |
| | | } |
| | | |
| | | /** |
| | | * 获取下级地区列表 |
| | | */ |
| | | @GetMapping("/getNextRegionList") |
| | | @ApiOperation("获取下级地区列表") |
| | | public R<List<Region>> getNextRegionList(@ApiParam("父级id") @RequestParam Long id) { |
| | | return R.ok(regionService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId, id))); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | |
| | | * 秒杀活动列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页"}) |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) |
| | | public R<TableDataInfo> list(Goods goods) |
| | | { |
| | | startPage(); |
| | |
| | | } |
| | | return R.ok(goodsSeckill); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 新增秒杀活动 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperation(value = "新增秒杀活动", tags = {"后台管理-活动管理-秒杀活动" }) |
| | | public R<Void> save(@RequestBody SeckillActivityInfo seckillActivityInfo) |
| | | { |
| | | seckillActivityInfoService.saveSeckillActivityInfo(seckillActivityInfo); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改秒杀活动 |
| | | */ |
| | | @PutMapping("/update") |
| | | @ApiOperation(value = "修改秒杀活动", tags = {"后台管理-活动管理-秒杀活动" }) |
| | | public R<Void> update(@RequestBody SeckillActivityInfo seckillActivityInfo) |
| | | { |
| | | seckillActivityInfoService.updateSeckillActivityInfo(seckillActivityInfo); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除秒杀活动 |
| | | */ |
| | | @DeleteMapping("/remove/{id}") |
| | | @ApiOperation(value = "删除秒杀活动", tags = {"后台管理-活动管理-秒杀活动" }) |
| | | public R<Void> remove(@PathVariable Integer id) |
| | | { |
| | | seckillActivityInfoService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取秒杀活动明细 |
| | | */ |
| | | @GetMapping("/getSeckillActivityDetail") |
| | | @ApiOperation(value = "获取秒杀活动明细", tags = {"后台管理-活动管理-秒杀活动" }) |
| | | public R<SeckillActivityInfo> getSeckillActivityDetail(Integer id) |
| | | { |
| | | SeckillActivityInfo seckillActivityInfo = seckillActivityInfoService.getById(id); |
| | | List<GoodsSeckill> goodsSeckills = goodsSeckillService.list(new LambdaQueryWrapper<GoodsSeckill>() |
| | | .eq(GoodsSeckill::getSeckillActivityInfoId, id)); |
| | | seckillActivityInfo.setGoodsSeckills(goodsSeckills); |
| | | return R.ok(seckillActivityInfo); |
| | | } |
| | | |
| | | /** |
| | | * 修改上/下架状态 |
| | | */ |
| | | @PutMapping("/updateShowStatus") |
| | | @ApiOperation(value = "修改上/下架状态", tags = {"后台管理-活动管理-秒杀活动" }) |
| | | public R<Void> updateShowStatus(@RequestBody SeckillActivityVO seckillActivityVO) |
| | | { |
| | | seckillActivityInfoService.update(new LambdaUpdateWrapper<SeckillActivityInfo>() |
| | | .eq(SeckillActivityInfo::getId, seckillActivityVO.getId()) |
| | | .set(SeckillActivityInfo::getIsShelves, seckillActivityVO.getShowStatus())); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | |
| | | @ApiImplicitParam(value = "对象id(addType=1:平台添加,addType=2:推广人添加,addType=3:门店添加)", name = "objectId", required = true, dataType = "int"), |
| | | }) |
| | | @GetMapping("/list") |
| | | public R<List<Share>> list(@RequestParam Integer objectId){ |
| | | public R<List<Share>> list(@RequestParam Integer objectId) { |
| | | return R.ok(shareService.list(new LambdaQueryWrapper<Share>() |
| | | .eq(Share::getObjectId, objectId))); |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "分享页列表", tags = {"小程序-推广中心"}) |
| | | @GetMapping("/recommand/list") |
| | | public R<List<Share>> recommandlist(){ |
| | | public R<List<Share>> recommandlist() { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | return R.ok(shareService.list(new LambdaQueryWrapper<Share>().eq(Share::getAddType,2) |
| | | return R.ok(shareService.list(new LambdaQueryWrapper<Share>().eq(Share::getAddType, 2) |
| | | .eq(Share::getObjectId, userid))); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "分享添加", tags = {"小程序-个人中心-门店管理"}) |
| | | @PostMapping |
| | | public R<Void> add(@RequestBody Share share){ |
| | | public R<Void> add(@RequestBody Share share) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | if (share.getAddType()==1) { |
| | | if (share.getAddType() == 1) { |
| | | share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); |
| | | }else if (share.getAddType()==2){ |
| | | } else if (share.getAddType() == 2) { |
| | | share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); |
| | | share.setObjectId(userid.toString()); |
| | | } |
| | |
| | | */ |
| | | @ApiOperation(value = "分享删除", tags = {"小程序-个人中心-门店管理"}) |
| | | @DeleteMapping |
| | | public R<Void> delete(@RequestBody Share share){ |
| | | public R<Void> delete(@RequestBody Share share) { |
| | | shareService.removeById(share); |
| | | return R.ok(); |
| | | } |
| | |
| | | */ |
| | | @ApiOperation(value = "分享编辑", tags = {"小程序-个人中心-门店管理"}) |
| | | @PutMapping |
| | | public R<Void> edit(@RequestBody Share share){ |
| | | public R<Void> edit(@RequestBody Share share) { |
| | | share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); |
| | | shareService.updateById(share); |
| | | return R.ok(); |
| | |
| | | */ |
| | | @ApiOperation(value = "分享详情", tags = {"小程序-个人中心-门店管理"}) |
| | | @GetMapping("/detail/{id}") |
| | | public R<Share> detail(@PathVariable("id") Integer id){ |
| | | public R<Share> detail(@PathVariable("id") Integer id) { |
| | | return R.ok(shareService.getById(id)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-添加", tags = {"管理后台"}) |
| | | @PostMapping("/manage/add") |
| | | public R<Void> manage(@RequestBody Share share){ |
| | | public R<Void> manage(@RequestBody Share share) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long userid = loginUser.getSysUser().getUserId(); |
| | | share.setAddType(1); |
| | | share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode()); |
| | | share.setObjectId(userid.toString()); |
| | | share.setAppletShare(0); |
| | | share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode()); |
| | | share.setObjectId(userid.toString()); |
| | | share.setDelFlag(0); |
| | | shareService.save(share); |
| | | return R.ok(); |
| | |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-编辑", tags = {"管理后台"}) |
| | | @PostMapping("/manage/edit") |
| | | public R<Void> manageedit(@RequestBody Share share){ |
| | | public R<Void> manageedit(@RequestBody Share share) { |
| | | |
| | | shareService.updateById(share); |
| | | return R.ok(); |
| | |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-删除", tags = {"管理后台"}) |
| | | @GetMapping("/manage/delete") |
| | | public R<Void> managedelete(@RequestParam Integer id){ |
| | | public R<Void> managedelete(@RequestParam Integer id) { |
| | | |
| | | shareService.removeById(id); |
| | | return R.ok(); |
| | |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-列表", tags = {"管理后台"}) |
| | | @GetMapping("/manage/list") |
| | | public R<Page<Share>> managelist(String name,Integer addType,@RequestParam Integer PageNum,Integer pageSize){ |
| | | Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus,1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageSize, pageSize)); |
| | | public R<Page<Share>> managelist(String name, Integer addType, @RequestParam Integer pageNum, Integer pageSize) { |
| | | Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus, 1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-设为小程序分享", tags = {"管理后台"}) |
| | | @GetMapping("/manage/set") |
| | | public R<Void> set(@RequestParam Integer id){ |
| | | public R<Void> set(@RequestParam Integer id) { |
| | | //将所有分享设为不是小程序分享 |
| | | List<Share> list = shareService.lambdaQuery().list(); |
| | | if (!list.isEmpty()){ |
| | | if (!list.isEmpty()) { |
| | | for (Share share : list) { |
| | | share.setAppletShare(0); |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-审核列表", tags = {"管理后台"}) |
| | | @GetMapping("/manage/auth/list") |
| | | public R<Page<Share>> authmanagelist(String name,Integer addType,@RequestParam Integer pageNum,Integer pageSize){ |
| | | Page<Share> page = shareService.lambdaQuery().ne(Share::getAuditStatus,1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageNum, pageSize)); |
| | | public R<Page<Share>> authmanagelist(String name, Integer addType, @RequestParam Integer pageNum, Integer pageSize) { |
| | | Page<Share> page = shareService.lambdaQuery().ne(Share::getAuditStatus, 1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageNum, pageSize)); |
| | | for (Share record : page.getRecords()) { |
| | | if (record.getAddType()==2) { |
| | | if (record.getAddType() == 2) { |
| | | AppUser appUserById = appUserClient.getAppUserById(Long.valueOf(record.getObjectId())); |
| | | record.setAuthName(appUserById.getName()); |
| | | record.setAuthPhone(appUserById.getPhone()); |
| | | } |
| | | if (record.getAddType()==3) { |
| | | if (record.getAddType() == 3) { |
| | | R<Shop> shopById = shopClient.getShopById(Integer.valueOf(record.getObjectId())); |
| | | if (shopById.getData()!=null){ |
| | | if (shopById.getData() != null) { |
| | | record.setAuthName(shopById.getData().getName()); |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-详情", tags = {"管理后台"}) |
| | | @GetMapping("/manage/auth/detail") |
| | | public R<Share> authmanagelist(Integer id){ |
| | | public R<Share> authmanagelist(Integer id) { |
| | | Share byId = shareService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-审核", tags = {"管理后台"}) |
| | | @GetMapping("/manage/auth/check") |
| | | public R<Share> authmanagecheck(Integer id, @ApiParam("1=审核通过,2=审核失败") Integer auditStatus, @ApiParam("备注") String auditMsg){ |
| | | public R<Share> authmanagecheck(Integer id, @ApiParam("1=审核通过,2=审核失败") Integer auditStatus, @ApiParam("备注") String auditMsg) { |
| | | Share byId = shareService.getById(id); |
| | | byId.setAuditStatus(auditStatus); |
| | | byId.setAuditMsg(auditMsg); |
| | | shareService.updateById(byId); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @PutMapping("/editShop") |
| | | @ApiOperation(value = "门店管理-编辑门店", tags = {"管理后台"}) |
| | | @ApiOperation(value = "门店管理-编辑门店", tags = {"管理后台-门店管理"}) |
| | | public R<Void> editShop(@RequestBody Shop shop){ |
| | | shopService.updateById(shop); |
| | | return R.ok(); |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.other.service.ShopPointService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/shop-point") |
| | | @Api(tags = "管理后台-财务统计-门店积分统计") |
| | | public class ShopPointController { |
| | | @Resource |
| | | private ShopPointService shopPointService; |
| | | |
| | | |
| | | /** |
| | | * 门店积分统计 |
| | | */ |
| | | public Object statistics() { |
| | | return shopPointService.statistics(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | |
| | | /** |
| | |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface CouponInfoMapper extends BaseMapper<CouponInfo> { |
| | | |
| | | IPage<CouponInfo> queryCouponInfoPage(IPage<CouponInfo> page, CouponInfo couponInfo); |
| | | } |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | |
| | |
| | | */ |
| | | public interface CouponInfoService extends IService<CouponInfo> { |
| | | |
| | | IPage<CouponInfo> queryCouponInfoPage(IPage<CouponInfo> page, CouponInfo couponInfo); |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface GoodsSeckillService extends IService<GoodsSeckill> { |
| | | |
| | | |
| | | } |
| | |
| | | List<SeckillActivityVO> listSeckillActivity(Goods goods); |
| | | |
| | | SeckillActivityDetailVO detail(Integer seckillActivityId); |
| | | |
| | | void saveSeckillActivityInfo(SeckillActivityInfo seckillActivityInfo); |
| | | |
| | | void updateSeckillActivityInfo(SeckillActivityInfo seckillActivityInfo); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import com.ruoyi.other.vo.ShopPointStatistics; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface ShopPointService extends IService<ShopPoint> { |
| | | |
| | | ShopPointStatistics statistics(); |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.CouponInfoMapper; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | |
| | | @Service |
| | | public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponInfo> implements CouponInfoService { |
| | | |
| | | @Override |
| | | public IPage<CouponInfo> queryCouponInfoPage(IPage<CouponInfo> page, CouponInfo couponInfo) { |
| | | return this.baseMapper.queryCouponInfoPage(page, couponInfo); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.GoodsShop; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.mapper.GoodsShopMapper; |
| | | import com.ruoyi.other.mapper.SeckillActivityInfoMapper; |
| | | import com.ruoyi.other.mapper.ShopMapper; |
| | | import com.ruoyi.other.service.GoodsSeckillService; |
| | | import com.ruoyi.other.service.SeckillActivityInfoService; |
| | | import com.ruoyi.other.vo.SeckillActivityDetailVO; |
| | | import com.ruoyi.other.vo.SeckillActivityVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private GoodsSeckillService goodsSeckillService; |
| | | |
| | | @Override |
| | | public List<SeckillActivityVO> listSeckillActivity(Goods goods) { |
| | |
| | | seckillActivityDetailVO.setShopList(shopNames); |
| | | return seckillActivityDetailVO; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveSeckillActivityInfo(SeckillActivityInfo seckillActivityInfo) { |
| | | this.baseMapper.insert(seckillActivityInfo); |
| | | List<GoodsSeckill> goodsSeckills = seckillActivityInfo.getGoodsSeckills(); |
| | | goodsSeckills.forEach(goodsSeckill -> goodsSeckill.setSeckillActivityInfoId(seckillActivityInfo.getId())); |
| | | goodsSeckillService.saveBatch(goodsSeckills); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateSeckillActivityInfo(SeckillActivityInfo seckillActivityInfo) { |
| | | this.baseMapper.updateById(seckillActivityInfo); |
| | | goodsSeckillService.remove(new LambdaQueryWrapper<GoodsSeckill>().eq(GoodsSeckill::getSeckillActivityInfoId, seckillActivityInfo.getId())); |
| | | List<GoodsSeckill> goodsSeckills = seckillActivityInfo.getGoodsSeckills(); |
| | | goodsSeckills.forEach(goodsSeckill -> goodsSeckill.setSeckillActivityInfoId(seckillActivityInfo.getId())); |
| | | goodsSeckillService.saveBatch(goodsSeckills); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.other.mapper.ShopPointMapper; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import com.ruoyi.other.service.ShopPointService; |
| | | import com.ruoyi.other.vo.ShopPointStatistics; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class ShopPointServiceImpl extends ServiceImpl<ShopPointMapper, ShopPoint> implements ShopPointService { |
| | | |
| | | @Override |
| | | public ShopPointStatistics statistics() { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | Page<Shop> page = new Page<>(); |
| | | page.setCurrent(PageNum); |
| | | page.setSize(pageSize); |
| | | IPage<Shop> shopIPage = shopMapper.selectShopList(page, shop); |
| | | return shopIPage; |
| | | return shopMapper.selectShopList(page, shop); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @ApiModelProperty(value = "商品简介") |
| | | private String introduction; |
| | | |
| | | @ApiModelProperty(value = "商品类型") |
| | | private String goodsType; |
| | | |
| | | @ApiModelProperty(value = "商品分类名称") |
| | | private String goodsCategoryName; |
| | | |
| | | @ApiModelProperty(value = "运营成本") |
| | | private BigDecimal operatingCost; |
| | | |
| | | @ApiModelProperty(value = "门店成本") |
| | | private BigDecimal shopCost; |
| | | |
| | | @ApiModelProperty(value = "限购数量") |
| | | private Integer maxNum; |
| | | |
| | | @ApiModelProperty(value = "销量") |
| | | private Integer saleNum; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | private String homePagePicture; |
| | | |
| | |
| | | @ApiModelProperty(value = "基础售价") |
| | | private BigDecimal sellingPrice; |
| | | |
| | | @ApiModelProperty(value = "已售数量") |
| | | private Integer saleNum; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "状态:1未开始 2已开始 3已结束") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "展示状态:0下架中 1上架中") |
| | | private Integer showStatus; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("门店积分统计") |
| | | public class ShopPointStatistics { |
| | | |
| | | /** |
| | | * 门店获得总积分 |
| | | */ |
| | | @ApiModelProperty("门店获得总积分") |
| | | private Integer totalPoint; |
| | | |
| | | /** |
| | | * 门店业绩积分 |
| | | */ |
| | | @ApiModelProperty("门店业绩积分") |
| | | private Integer shopPoint; |
| | | |
| | | /** |
| | | * 门店返佣积分 |
| | | */ |
| | | @ApiModelProperty("门店返佣积分") |
| | | private Integer shopCommissionPoint; |
| | | |
| | | /** |
| | | * 下级门店返佣积分 |
| | | */ |
| | | @ApiModelProperty("下级门店返佣积分") |
| | | private Integer subShopCommissionPoint; |
| | | |
| | | private List<ShopPoint> shopPointList; |
| | | } |
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.CouponInfoMapper"> |
| | | |
| | | <select id="queryCouponInfoPage" resultType="com.ruoyi.other.api.domain.CouponInfo"> |
| | | SELECT |
| | | tci.id, |
| | | tci.create_time, |
| | | tci.coupon_name, |
| | | tci.coupon_type, |
| | | tci.condition_amount, |
| | | tci.discount_amount, |
| | | tci.money_amount, |
| | | tci.discount, |
| | | tci.for_good_ids, |
| | | tci.send_num, |
| | | tci.max_num, |
| | | tci.period_type, |
| | | tci.period_start_time, |
| | | tci.period_end_time, |
| | | tci.period_days, |
| | | tci.send_start_time, |
| | | tci.send_end_time, |
| | | tci.send_type, |
| | | tci.need_point, |
| | | tci.person_type, |
| | | tci.person_ids |
| | | FROM |
| | | t_coupon_info tci |
| | | <where> |
| | | tci.del_flag = 0 |
| | | <if test="couponInfo.couponName != null and couponInfo.couponName != ''"> |
| | | AND tci.coupon_name LIKE concat('%', #{couponInfo.couponName}, '%') |
| | | </if> |
| | | <if test="couponInfo.couponType != null"> |
| | | AND tci.coupon_type = #{couponInfo.couponType} |
| | | </if> |
| | | <if test="couponInfo.send_type != null"> |
| | | AND tci.send_type = #{couponInfo.send_type} |
| | | </if> |
| | | <if test="couponInfo.personType != null"> |
| | | AND tci.person_type = #{couponInfo.personType} |
| | | </if> |
| | | <if test="couponInfo.shelfStatus != null"> |
| | | AND tci.shelf_status = #{couponInfo.shelfStatus} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | ts.id, |
| | | ts.`name`, |
| | | ts.business_date, |
| | | tau.`name` managerName, |
| | | ts.start_time, |
| | | ts.end_time, |
| | | ts.phone, |
| | | ts.address, |
| | | ts.`status` |
| | | ts.`status`, |
| | | ts.shop_manager |
| | | FROM |
| | | `qijisheng_other`.t_shop ts |
| | | LEFT JOIN `qijisheng_account`.t_app_user tau ON ts.app_user_id = tau.id |
| | | t_shop ts |
| | | <where> |
| | | ts.del_flag = 0 |
| | | <if test="shop.name != null and shop.name != ''"> |
| | | and ts.name like concat('%',#{shop.name},'%') |
| | | </if> |
| | | <if test="shop.managerName != null and shop.managerName != ''"> |
| | | and tau.name like concat('%',#{shop.managerName},'%') |
| | | <if test="shop.shopManager != null and shop.shopManager != ''"> |
| | | and ts.shop_manager like concat('%',#{shop.shopManager},'%') |
| | | </if> |
| | | <if test="shop.phone != null and shop.phone != ''"> |
| | | and ts.phone like concat('%',#{shop.phone},'%') |