springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/MicroCommercialStreetApi.java
@@ -5,6 +5,8 @@ import javax.annotation.Resource; import javax.validation.Valid; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsEvaluateDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -148,4 +150,22 @@ public R deleteMcsInfo(@RequestParam("infoId") Long infoId) { return communityService.deleteMcsInfo(infoId, this.getUserId()); } @ApiOperation(value = "分页查询评价记录", response = McsEvaluateVO.class) @PostMapping("/evaluate/page") public R pageMcsEvaluate(@RequestBody @Valid PageMcsEvaluateDTO pageMcsEvaluateDTO) { return communityService.pageMcsEvaluate(pageMcsEvaluateDTO); } @ApiOperation(value = "查询评价记录详情", response = McsEvaluateVO.class) @GetMapping("/evaluate/get") public R getMcsEvaluate(@RequestParam("evaluateId") Long evaluateId) { return communityService.getMcsEvaluate(evaluateId); } @ApiOperation(value = "删除评价记录") @DeleteMapping("/evaluate/delete") public R deleteMcsEvaluate(@RequestParam("evaluateId") Long evaluateId) { return communityService.deleteMcsEvaluate(evaluateId); } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/McsGameDTO.java
New file @@ -0,0 +1,83 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import java.util.Date; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import com.panzhihua.common.validated.AddGroup; import com.panzhihua.common.validated.PutGroup; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsGameDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 新增/编辑戳戳游戏 * @author: hans * @date: 2021/12/31 15:42 */ @Data @ApiModel("新增/编辑戳戳游戏") public class McsGameDTO { @ApiModelProperty("游戏ID") @NotNull(groups = {PutGroup.class}, message = "游戏ID不能为空") private Long id; @ApiModelProperty("游戏名称") @NotBlank(groups = {AddGroup.class}, message = "游戏名称不能为空") private String name; @ApiModelProperty("戳戳卷数量") @NotNull(groups = {AddGroup.class}, message = "戳戳卷数量不能为空") private Integer coupons; @ApiModelProperty("游戏类别(1.戳戳币游戏 2.体验游戏)") @NotNull(groups = {AddGroup.class}, message = "游戏类别不能为空") private Integer type; @ApiModelProperty("奖励类型(1.免费产品 2.免费服务)") private Integer awardType; @ApiModelProperty("戳戳币分配方式(1.随机分配 2.平均分配)") private Integer allocation; @ApiModelProperty("戳戳币总额") private Integer coins; @ApiModelProperty("地址") @NotBlank(groups = {AddGroup.class}, message = "地址不能为空") private String address; @ApiModelProperty("纬度") @NotBlank(groups = {AddGroup.class}, message = "纬度不能为空") private String lat; @ApiModelProperty("经度") @NotBlank(groups = {AddGroup.class}, message = "经度不能为空") private String lon; @ApiModelProperty("失效时间") @NotNull(groups = {AddGroup.class}, message = "失效时间不能为空") private Date expireAt; @ApiModelProperty("封面") @NotBlank(groups = {AddGroup.class}, message = "封面不能为空") private String cover; @ApiModelProperty("其他图片(多张图片以逗号隔开)") private String otherImages; @ApiModelProperty("游戏介绍") @NotBlank(groups = {AddGroup.class}, message = "游戏介绍不能为空") private String introduction; @ApiModelProperty(value = "创建人", hidden = true) private Long createdBy; @ApiModelProperty(value = "更新人", hidden = true) private Long updatedBy; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/McsInfoDTO.java
New file @@ -0,0 +1,57 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import com.panzhihua.common.validated.AddGroup; import com.panzhihua.common.validated.PutGroup; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsInfoDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 新增/编辑戳戳资讯 * @author: hans * @date: 2022/01/05 10:06 */ @Data @ApiModel("新增/编辑戳戳资讯") public class McsInfoDTO { @ApiModelProperty("资讯ID") @NotNull(groups = {PutGroup.class}, message = "资讯ID不能为空") private Long id; @ApiModelProperty("资讯标题") @NotBlank(groups = {AddGroup.class}, message = "资讯标题不能为空") private String name; @ApiModelProperty("地址") @NotBlank(groups = {AddGroup.class}, message = "地址不能为空") private String address; @ApiModelProperty("纬度") @NotBlank(groups = {AddGroup.class}, message = "纬度不能为空") private String lat; @ApiModelProperty("经度") @NotBlank(groups = {AddGroup.class}, message = "经度不能为空") private String lon; @ApiModelProperty("封面") @NotBlank(groups = {AddGroup.class}, message = "封面不能为空") private String cover; @ApiModelProperty("资讯内容") @NotBlank(groups = {AddGroup.class}, message = "资讯内容不能为空") private String content; @ApiModelProperty(value = "创建人", hidden = true) private Long createdBy; @ApiModelProperty(value = "更新人", hidden = true) private Long updatedBy; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/McsProductDTO.java
New file @@ -0,0 +1,48 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import com.panzhihua.common.validated.AddGroup; import com.panzhihua.common.validated.PutGroup; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; /** * @title: McsProductDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 新增/编辑产品信息 * @author: hans * @date: 2022/01/05 11:25 */ @Data @ApiModel("新增/编辑产品信息") public class McsProductDTO { @ApiModelProperty("产品ID") @NotNull(groups = {PutGroup.class}, message = "产品ID不能为空") private Long id; @ApiModelProperty("产品名称") @NotBlank(groups = {AddGroup.class}, message = "产品名称不能为空") private String name; @ApiModelProperty("产品图片") private String image; @ApiModelProperty("产品介绍") private String introduction; @ApiModelProperty("产品标签id列表") private List<Long> labelIds; @ApiModelProperty(value = "创建人", hidden = true) private Long createdBy; @ApiModelProperty(value = "更新人", hidden = true) private Long updatedBy; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/PageMcsEvaluateDTO.java
New file @@ -0,0 +1,33 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: PageMcsEvaluateDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 分页查询戳戳评价记录请求参数 * @author: hans * @date: 2021/12/31 13:22 */ @Data @ApiModel("分页查询戳戳评价记录请求参数") public class PageMcsEvaluateDTO { @ApiModelProperty("关键词") private String keyword; @ApiModelProperty(value = "分页-当前页数", example = "1") @NotNull(message = "分页参数不能为空") @Min(value = 1) private Long pageNum; @ApiModelProperty(value = "分页-每页记录数", example = "10") @NotNull(message = "分页参数不能为空") @Min(value = 1) private Long pageSize; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/PageMcsProductDTO.java
New file @@ -0,0 +1,39 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: PageMcsProductDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 分页查询产品信息请求参数 * @author: hans * @date: 2022/01/05 11:30 */ @Data @ApiModel("分页查询产品信息请求参数") public class PageMcsProductDTO { @ApiModelProperty("关键词") private String keyword; @ApiModelProperty("状态(1.上架中 2.已下架)") private Integer status; @ApiModelProperty(value = "分页-当前页数", example = "1") @NotNull(message = "分页参数不能为空") @Min(value = 1) private Long pageNum; @ApiModelProperty(value = "分页-每页记录数", example = "10") @NotNull(message = "分页参数不能为空") @Min(value = 1) private Long pageSize; @ApiModelProperty(value = "用户id", hidden = true) private Long userId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/SetShelfForProductDTO.java
New file @@ -0,0 +1,33 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import java.util.List; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: SetShelfForProductDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 上架/下架产品信息请求参数 * @author: hans * @date: 2022/01/05 11:27 */ @Data @ApiModel("上架/下架产品信息请求参数") public class SetShelfForProductDTO { @ApiModelProperty(value = "处理类型(1.上架 2.下架)", required = true, allowableValues = "1,2") @NotNull(message = "处理类型不能为空") private Integer type; @ApiModelProperty(value = "产品id列表", required = true) @NotEmpty(message = "产品id列表不能为空") private List<Long> productIds; @ApiModelProperty(value = "处理人", hidden = true) private Long updatedBy; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsEvaluateVO.java
New file @@ -0,0 +1,45 @@ package com.panzhihua.common.model.vos.community.microCommercialStreet; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsEvaluateVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 戳戳评价记录信息 * @author: hans * @date: 2021/12/31 13:19 */ @Data @ApiModel("戳戳评价记录信息") public class McsEvaluateVO { @ApiModelProperty("评价记录id") private Long id; @ApiModelProperty("评分(1.差 2.一般 3.还不错 4.很满意 5.强烈推荐)") private Integer star; @ApiModelProperty("评价内容") private String content; @ApiModelProperty("评价图片(多张逗号隔开)") private String photos; @ApiModelProperty("评价时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createdAt; @ApiModelProperty("用户") private String nickName; @ApiModelProperty("手机号码") private String phone; @ApiModelProperty("评价游戏") private String gameName; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsGameVO.java
@@ -2,6 +2,7 @@ import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -51,6 +52,7 @@ private String lon; @ApiModelProperty("失效时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date expireAt; @ApiModelProperty("封面") @@ -69,6 +71,7 @@ private Boolean isPopular; @ApiModelProperty("发布时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date publishAt; @ApiModelProperty("所属商家") springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsInformationVO.java
@@ -2,6 +2,7 @@ import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -42,6 +43,7 @@ private Integer status; @ApiModelProperty("发布时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date publishAt; @ApiModelProperty("所属商家") springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsMerchantVO.java
@@ -2,6 +2,7 @@ import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -39,6 +40,7 @@ private Integer publishLimit; @ApiModelProperty("到期时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date expireAt; @ApiModelProperty("商家地址") @@ -54,8 +56,12 @@ private String introduction; @ApiModelProperty("首次点亮时间") private Date firstLit; @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date firstLitAt; @ApiModelProperty("账号状态(1.启用 2.禁用)") private Integer accountStatus; @ApiModelProperty("空闲戳戳点") private Integer idleTotal; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsProductVO.java
New file @@ -0,0 +1,48 @@ package com.panzhihua.common.model.vos.community.microCommercialStreet; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsProductVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: * @author: hans * @date: 2022/01/05 11:29 */ @Data @ApiModel("产品信息") public class McsProductVO { @ApiModelProperty("产品id") @JsonSerialize(using = ToStringSerializer.class) private Long id; @ApiModelProperty("产品名称") private String name; @ApiModelProperty("产品图片") private String image; @ApiModelProperty("产品介绍") private String introduction; @ApiModelProperty("浏览量") private Integer viewNum; @ApiModelProperty("状态(1.上架中 2.已下架)") private Integer status; @ApiModelProperty("产品标签") private String productLabel; @ApiModelProperty("所属商家") private Long merchantId; @ApiModelProperty("所属商家名称") private Long merchantName; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/TopStatisticsVO.java
New file @@ -0,0 +1,34 @@ package com.panzhihua.common.model.vos.community.microCommercialStreet; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: TopStatisticsVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 统计信息 * @author: hans * @date: 2022/01/04 17:58 */ @Data @ApiModel("统计信息") public class TopStatisticsVO { @ApiModelProperty("到期时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date expireAt; @ApiModelProperty("领取人数") private Integer appliedTotal; @ApiModelProperty("核销人数") private Integer verifiedTotal; @ApiModelProperty("空闲戳戳点") private Integer idleTotal; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -4,13 +4,19 @@ import com.panzhihua.common.model.dtos.PageBaseDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsEvaluateDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsInformationDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetPopularForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForProductDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.scheduling.annotation.Async; @@ -7843,4 +7849,137 @@ */ @DeleteMapping("/microcommercialstreet/information/delete") R deleteMcsInfo(@RequestParam("infoId") Long infoId, @RequestParam("userId") Long userId); /** * 分页查询评价记录 * @param pageMcsEvaluateDTO * @return */ @PostMapping("/microcommercialstreet/evaluate/page") R pageMcsEvaluate(@RequestBody PageMcsEvaluateDTO pageMcsEvaluateDTO); /** * 查询评价记录详情 * @param evaluateId * @return */ @GetMapping("/microcommercialstreet/evaluate/get") R getMcsEvaluate(@RequestParam("evaluateId") Long evaluateId); /** * 删除评价记录 * @param evaluateId * @return */ @DeleteMapping("/microcommercialstreet/evaluate/delete") R deleteMcsEvaluate(@RequestParam("evaluateId") Long evaluateId); /** * 新增戳戳游戏 * @param mcsGameDTO * @return */ @PostMapping("/microcommercialstreet/game/add") R addMcsGame(@RequestBody McsGameDTO mcsGameDTO); /** * 编辑戳戳游戏 * @param mcsGameDTO * @return */ @PutMapping("/microcommercialstreet/game/put") R putMcsGame(@RequestBody McsGameDTO mcsGameDTO); /** * 发布戳戳游戏 * @param gameId * @param userId * @return */ @GetMapping("/microcommercialstreet/game/publish") R publishMcsGame(@RequestParam("gameId") Long gameId, @RequestParam("userId") Long userId); /** * 结束戳戳游戏 * @param gameId * @param userId * @return */ @GetMapping("/microcommercialstreet/game/finish") R finishMcsGame(@RequestParam("gameId") Long gameId, @RequestParam("userId") Long userId); /** * 戳戳游戏/资讯顶部统计数据 * @param type * @param userId * @return */ @GetMapping("/microcommercialstreet/statistics/top") R getTopStatistics(@RequestParam("type") Integer type, @RequestParam("userId") Long userId); /** * 新增戳戳资讯 * @param mcsInfoDTO * @return */ @PostMapping("/microcommercialstreet/information/add") R addMcsInfo(@RequestBody McsInfoDTO mcsInfoDTO); /** * 编辑戳戳资讯 * @param mcsInfoDTO * @return */ @PutMapping("/microcommercialstreet/information/put") R putMcsInfo(@RequestBody McsInfoDTO mcsInfoDTO); /** * 发布戳戳资讯 * @param infoId * @param userId * @return */ @GetMapping("/microcommercialstreet/information/publish") R publishMcsInfo(@RequestParam("infoId") Long infoId, @RequestParam("userId") Long userId); /** * 新增产品信息 * @param mcsProductDTO * @return */ @PostMapping("/microcommercialstreet/product/add") R addMcsProduct(@RequestBody McsProductDTO mcsProductDTO); /** * 编辑产品信息 * @param mcsProductDTO * @return */ @PutMapping("/microcommercialstreet/product/put") R putMcsProduct(@RequestBody McsProductDTO mcsProductDTO); /** * 删除产品信息 * @param productId * @param userId * @return */ @DeleteMapping("/microcommercialstreet/product/delete") R deleteMcsProduct(@RequestParam("productId") Long productId, @RequestParam("userId") Long userId); /** * 上架/下架产品信息 * @param setShelfForProductDTO * @return */ @PutMapping("/microcommercialstreet/product/setShelf") R setShelfForMcsProduct(@RequestBody SetShelfForProductDTO setShelfForProductDTO); /** * 分页查询产品信息 * @param pageMcsProductDTO * @return */ @PostMapping("/microcommercialstreet/product/page") R pageMcsProduct(@RequestBody PageMcsProductDTO pageMcsProductDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/MicroCommercialStreetApi.java
@@ -3,17 +3,25 @@ import javax.annotation.Resource; import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsEvaluateDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsInformationDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetPopularForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForProductDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import com.panzhihua.service_community.service.McsConfigService; import com.panzhihua.service_community.service.McsEvaluateService; import com.panzhihua.service_community.service.McsGameService; import com.panzhihua.service_community.service.McsInformationService; import com.panzhihua.service_community.service.McsMerchantService; import com.panzhihua.service_community.service.McsProductService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -54,6 +62,10 @@ private McsGameService mcsGameService; @Resource private McsInformationService mcsInformationService; @Resource private McsEvaluateService mcsEvaluateService; @Resource private McsProductService mcsProductService; /** * 新增数字商业街商家 @@ -206,4 +218,177 @@ public R deleteMcsInfo(@RequestParam("infoId") Long infoId, @RequestParam("userId") Long userId) { return mcsInformationService.deleteMcsInfo(infoId, userId); } /** * 分页查询评价记录 * @param pageMcsEvaluateDTO * @return */ @PostMapping("/evaluate/page") public R pageMcsEvaluate(@RequestBody PageMcsEvaluateDTO pageMcsEvaluateDTO) { return mcsEvaluateService.pageMcsEvaluate(pageMcsEvaluateDTO); } /** * 查询评价记录详情 * @param evaluateId * @return */ @GetMapping("/evaluate/get") public R getMcsEvaluate(@RequestParam("evaluateId") Long evaluateId) { return mcsEvaluateService.getMcsEvaluate(evaluateId); } /** * 删除评价记录 * @param evaluateId * @return */ @DeleteMapping("/evaluate/delete") public R deleteMcsEvaluate(@RequestParam("evaluateId") Long evaluateId) { return mcsEvaluateService.deleteMcsEvaluate(evaluateId); } /** * 新增戳戳游戏 * @param mcsGameDTO * @return */ @PostMapping("/game/add") public R addMcsGame(@RequestBody McsGameDTO mcsGameDTO) { return mcsGameService.addMcsGame(mcsGameDTO); } /** * 编辑戳戳游戏 * @param mcsGameDTO * @return */ @PutMapping("/game/put") public R putMcsGame(@RequestBody McsGameDTO mcsGameDTO) { return mcsGameService.putMcsGame(mcsGameDTO); } /** * 发布戳戳游戏 * @param gameId * @param userId * @return */ @GetMapping("/game/publish") public R publishMcsGame(@RequestParam("gameId") Long gameId, @RequestParam("userId") Long userId) { return mcsGameService.publishMcsGame(gameId, userId); } /** * 结束戳戳游戏 * @param gameId * @param userId * @return */ @GetMapping("/game/finish") public R finishMcsGame(@RequestParam("gameId") Long gameId, @RequestParam("userId") Long userId) { return mcsGameService.finishMcsGame(gameId, userId); } /** * 戳戳游戏/资讯顶部统计数据 * @param type * @param userId * @return */ @GetMapping("/statistics/top") public R getTopStatistics(@RequestParam("type") Integer type, @RequestParam("userId") Long userId) { if (type.equals(1)) { //戳戳游戏 return mcsGameService.getTopStatistics(userId); } else if (type.equals(2)) { //戳戳资讯 return mcsInformationService.getTopStatistics(userId); } else { return R.fail("未知错误"); } } /** * 新增戳戳资讯 * @param mcsInfoDTO * @return */ @PostMapping("/information/add") public R addMcsInfo(@RequestBody McsInfoDTO mcsInfoDTO) { return mcsInformationService.addMcsInfo(mcsInfoDTO); } /** * 编辑戳戳资讯 * @param mcsInfoDTO * @return */ @PutMapping("/information/put") public R putMcsInfo(@RequestBody McsInfoDTO mcsInfoDTO) { return mcsInformationService.putMcsInfo(mcsInfoDTO); } /** * 发布戳戳资讯 * @param infoId * @param userId * @return */ @GetMapping("/information/publish") public R publishMcsInfo(@RequestParam("infoId") Long infoId, @RequestParam("userId") Long userId) { return mcsInformationService.publishMcsInfo(infoId, userId); } /** * 新增产品信息 * @param mcsProductDTO * @return */ @PostMapping("/product/add") public R addMcsProduct(@RequestBody McsProductDTO mcsProductDTO) { return mcsProductService.addMcsProduct(mcsProductDTO); } /** * 编辑产品信息 * @param mcsProductDTO * @return */ @PutMapping("/product/put") public R putMcsProduct(@RequestBody McsProductDTO mcsProductDTO) { return mcsProductService.putMcsProduct(mcsProductDTO); } /** * 删除产品信息 * @param productId * @param userId * @return */ @DeleteMapping("/product/delete") public R deleteMcsProduct(@RequestParam("productId") Long productId, @RequestParam("userId") Long userId) { return mcsProductService.deleteMcsProduct(productId, userId); } /** * 上架/下架产品信息 * @param setShelfForProductDTO * @return */ @PutMapping("/product/setShelf") public R setShelfForMcsProduct(@RequestBody SetShelfForProductDTO setShelfForProductDTO) { return mcsProductService.setShelfForMcsProduct(setShelfForProductDTO); } /** * 分页查询产品信息 * @param pageMcsProductDTO * @return */ @PostMapping("/product/page") public R pageMcsProduct(@RequestBody PageMcsProductDTO pageMcsProductDTO) { return mcsProductService.pageMcsProduct(pageMcsProductDTO); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsEvaluateDAO.java
@@ -3,6 +3,10 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsEvaluateDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; import com.panzhihua.service_community.entity.McsEvaluate; @@ -36,4 +40,18 @@ */ int insertOrUpdateBatch(@Param("entities") List<McsEvaluate> entities); /** * 分页查询戳戳游戏评价记录 * @param page * @param pageMcsEvaluateDTO * @return */ IPage<McsEvaluateVO> pageMcsEvaluate(@Param("page") Page page, @Param("pageMcsEvaluateDTO") PageMcsEvaluateDTO pageMcsEvaluateDTO); /** * 获取评价详情 * @param evaluateId * @return */ McsEvaluateVO getMcsEvaluate(@Param("evaluateId") Long evaluateId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsGameDAO.java
@@ -47,4 +47,25 @@ * @return */ IPage<McsGameVO> pageMcsGame(@Param("page") Page page, @Param("pageMcsGameDTO") PageMcsGameDTO pageMcsGameDTO); /** * 查询商家已发布数 * @param merchantId * @return */ Integer selectPublishCount(@Param("merchantId") Long merchantId); /** * 查询商家下已被领取的卷总数 * @param merchantId * @return */ Integer selectAppliedCount(@Param("merchantId") Long merchantId); /** * 查询商家下已被核销的卷总数 * @param merchantId * @return */ Integer selectVerifiedCount(@Param("merchantId") Long merchantId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsInformationDAO.java
@@ -3,6 +3,10 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsInformationDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsInformationVO; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; import com.panzhihua.service_community.entity.McsInformation; @@ -36,4 +40,11 @@ */ int insertOrUpdateBatch(@Param("entities") List<McsInformation> entities); /** * 分页查询资讯 * @param page * @param pageMcsInformationDTO * @return */ IPage<McsInformationVO> pageMcsInfo(@Param("page") Page page, @Param("pageMcsInformationDTO") PageMcsInformationDTO pageMcsInformationDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsProductDAO.java
@@ -3,6 +3,10 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsProductDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsProductVO; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; import com.panzhihua.service_community.entity.McsProduct; @@ -36,4 +40,11 @@ */ int insertOrUpdateBatch(@Param("entities") List<McsProduct> entities); /** * 分页查询商家产品信息 * @param page * @param pageMcsProductDTO * @return */ IPage<McsProductVO> pageMcsProduct(@Param("page") Page page, @Param("pageMcsProductDTO") PageMcsProductDTO pageMcsProductDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsGame.java
@@ -48,6 +48,10 @@ */ private Integer coins; /** * 剩余戳戳币 */ private Integer surplusCoins; /** * 地址 */ private String address; @@ -112,4 +116,15 @@ */ private Long updatedBy; /** * 状态(1.未发布 2.进行中 3.已下架 4.已结束) */ public interface Status { int wfb = 1; int jxz = 2; int yxj = 3; int yjs = 4; } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsInformation.java
@@ -76,4 +76,13 @@ */ private Long updatedBy; /** * 状态(1.未发布 2.已发布 3.已下架) */ public interface Status{ int wfb = 1; int yfb = 2; int yxj = 3; } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsMerchant.java
@@ -52,6 +52,10 @@ */ private Date expireAt; /** * 首次点亮时间 */ private Date firstLitAt; /** * 商家地址 */ private String address; springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsProduct.java
@@ -64,4 +64,11 @@ */ private Long updatedBy; /** * 状态(1.上架中 2.已下架) */ public interface Status { int sjz = 1; int yxj = 2; } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsEvaluateService.java
@@ -1,6 +1,8 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsEvaluateDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.entity.McsEvaluate; /** @@ -11,4 +13,24 @@ */ public interface McsEvaluateService extends IService<McsEvaluate> { /** * 分页查询评价记录 * @param pageMcsEvaluateDTO * @return */ R pageMcsEvaluate(PageMcsEvaluateDTO pageMcsEvaluateDTO); /** * 查询评价记录详情 * @param evaluateId * @return */ R getMcsEvaluate(Long evaluateId); /** * 删除评价记录 * @param evaluateId * @return */ R deleteMcsEvaluate(Long evaluateId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsGameService.java
@@ -1,6 +1,7 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetPopularForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; @@ -43,4 +44,41 @@ * @return */ R deleteMcsGame(Long gameId, Long userId); /** * 新增戳戳游戏 * @param mcsGameDTO * @return */ R addMcsGame(McsGameDTO mcsGameDTO); /** * 编辑戳戳游戏 * @param mcsGameDTO * @return */ R putMcsGame(McsGameDTO mcsGameDTO); /** * 发布戳戳游戏 * @param gameId * @param userId * @return */ R publishMcsGame(Long gameId, Long userId); /** * 结束戳戳游戏 * @param gameId * @param userId * @return */ R finishMcsGame(Long gameId, Long userId); /** * 戳戳游戏顶部统计数据 * @param userId * @return */ R getTopStatistics(Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsInformationService.java
@@ -1,6 +1,7 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsInformationDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.vos.R; @@ -35,4 +36,33 @@ * @return */ R deleteMcsInfo(Long infoId, Long userId); /** * 戳戳资讯顶部统计数据 * @param userId * @return */ R getTopStatistics(Long userId); /** * 新增戳戳资讯 * @param mcsInfoDTO * @return */ R addMcsInfo(McsInfoDTO mcsInfoDTO); /** * 编辑戳戳资讯 * @param mcsInfoDTO * @return */ R putMcsInfo(McsInfoDTO mcsInfoDTO); /** * 发布戳戳资讯 * @param infoId * @param userId * @return */ R publishMcsInfo(Long infoId, Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsProductService.java
@@ -1,6 +1,10 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForProductDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.entity.McsProduct; /** @@ -11,4 +15,39 @@ */ public interface McsProductService extends IService<McsProduct> { /** * 新增产品信息 * @param mcsProductDTO * @return */ R addMcsProduct(McsProductDTO mcsProductDTO); /** * 编辑产品信息 * @param mcsProductDTO * @return */ R putMcsProduct(McsProductDTO mcsProductDTO); /** * 删除产品信息 * @param productId * @param userId * @return */ R deleteMcsProduct(Long productId, Long userId); /** * 上架/下架产品信息 * @param setShelfForProductDTO * @return */ R setShelfForMcsProduct(SetShelfForProductDTO setShelfForProductDTO); /** * 分页查询产品信息 * @param pageMcsProductDTO * @return */ R pageMcsProduct(PageMcsProductDTO pageMcsProductDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsEvaluateServiceImpl.java
@@ -1,10 +1,16 @@ package com.panzhihua.service_community.service.impl; import org.springframework.stereotype.Service; 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.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsEvaluateDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO; import com.panzhihua.service_community.dao.McsEvaluateDAO; import com.panzhihua.service_community.entity.McsEvaluate; import com.panzhihua.service_community.service.McsEvaluateService; import org.springframework.stereotype.Service; /** * (McsEvaluate)表服务实现类 @@ -15,4 +21,38 @@ @Service("mcsEvaluateService") public class McsEvaluateServiceImpl extends ServiceImpl<McsEvaluateDAO, McsEvaluate> implements McsEvaluateService { /** * 分页查询评价记录 * @param pageMcsEvaluateDTO * @return */ @Override public R pageMcsEvaluate(PageMcsEvaluateDTO pageMcsEvaluateDTO) { Page page = new Page<>(); page.setSize(pageMcsEvaluateDTO.getPageSize()); page.setCurrent(pageMcsEvaluateDTO.getPageNum()); IPage<McsEvaluateVO> mcsEvaluates = this.baseMapper.pageMcsEvaluate(page, pageMcsEvaluateDTO); return R.ok(mcsEvaluates); } /** * 查询评价记录详情 * @param evaluateId * @return */ @Override public R getMcsEvaluate(Long evaluateId) { return R.ok(this.baseMapper.getMcsEvaluate(evaluateId)); } /** * 删除评价记录 * @param evaluateId * @return */ @Override public R deleteMcsEvaluate(Long evaluateId) { this.baseMapper.deleteById(evaluateId); return R.ok(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java
@@ -2,19 +2,29 @@ import static java.util.Objects.isNull; import javax.annotation.Resource; import com.panzhihua.common.model.vos.community.microCommercialStreet.TopStatisticsVO; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.panzhihua.common.model.dtos.community.microCommercialStreet.McsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetPopularForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO; import com.panzhihua.service_community.dao.McsGameDAO; import com.panzhihua.service_community.dao.McsMerchantDAO; import com.panzhihua.service_community.entity.McsGame; import com.panzhihua.service_community.entity.McsMerchant; import com.panzhihua.service_community.service.McsGameService; import java.util.Date; /** * (McsGame)表服务实现类 @@ -24,6 +34,9 @@ */ @Service("mcsGameService") public class McsGameServiceImpl extends ServiceImpl<McsGameDAO, McsGame> implements McsGameService { @Resource private McsMerchantDAO mcsMerchantDAO; /** * 分页查询戳戳游戏 @@ -81,6 +94,12 @@ Integer type = setShelfForGameDTO.getType(); if (type.equals(1)) { //上架 McsMerchant mcsMerchant = mcsMerchantDAO.selectById(mcsGame.getMerchantId()); Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = this.baseMapper.selectPublishCount(mcsGame.getMerchantId()); if (publishCount >= publishLimit) { return R.fail("空闲戳戳点不足"); } mcsGame.setStatus(2); } else if (type.equals(2)) { //下架 @@ -108,6 +127,7 @@ return R.fail("修改数据不存在"); } mcsGame.setIsDel(true); mcsGame.setStatus(McsGame.Status.yxj); mcsGame.setUpdatedBy(userId); int num = this.baseMapper.updateById(mcsGame); if (num > 0) { @@ -115,4 +135,179 @@ } return R.fail("删除失败,请重新尝试"); } /** * 新增戳戳游戏 * @param mcsGameDTO * @return */ @Override public R addMcsGame(McsGameDTO mcsGameDTO) { Long userId = mcsGameDTO.getCreatedBy(); McsMerchant mcsMerchant = mcsMerchantDAO.selectOne(new QueryWrapper<McsMerchant>().lambda().eq(McsMerchant::getUserId, userId)); if (isNull(mcsMerchant)) { return R.fail("未查询到商家信息"); } Integer type = mcsGameDTO.getType(); McsGame mcsGame = new McsGame(); if (type.equals(1)) { //1.戳戳币游戏 Integer allocation = mcsGameDTO.getAllocation(); Integer coins = mcsGameDTO.getCoins(); if (isNull(allocation)) { return R.fail("缺少分配方式"); } if (isNull(coins)) { return R.fail("未设置戳戳币总额"); } mcsGame.setSurplusCoins(mcsGameDTO.getCoins()); } else if (type.equals(2)) { //2.体验游戏 Integer awardType = mcsGameDTO.getAwardType(); if (isNull(awardType)) { return R.fail("缺少奖励类型"); } } else { return R.fail("未知错误"); } BeanUtils.copyProperties(mcsGameDTO, mcsGame); mcsGame.setSurplusCoupons(mcsGameDTO.getCoupons()); mcsGame.setStatus(McsGame.Status.wfb); mcsGame.setMerchantId(mcsMerchant.getId()); int num = this.baseMapper.insert(mcsGame); if (num > 0) { return R.ok(); } return R.fail("新增失败,请重新尝试"); } /** * 编辑戳戳游戏 * @param mcsGameDTO * @return */ @Override public R putMcsGame(McsGameDTO mcsGameDTO) { McsGame mcsGame = this.baseMapper.selectById(mcsGameDTO.getId()); if (isNull(mcsGame)) { return R.fail("资源不存在"); } Integer type = mcsGameDTO.getType(); if (type.equals(1)) { //1.戳戳币游戏 Integer allocation = mcsGameDTO.getAllocation(); Integer coins = mcsGameDTO.getCoins(); if (isNull(allocation)) { return R.fail("缺少分配方式"); } if (isNull(coins)) { return R.fail("未设置戳戳币总额"); } Integer beforeCoins = mcsGame.getCoins(); Integer beforeSurplusCoins = mcsGame.getSurplusCoins(); Integer beforeUsedCoins = beforeCoins - beforeSurplusCoins; Integer surplusCoins = coins - beforeUsedCoins; if (surplusCoins < 0) { return R.fail("戳戳币总额少于已发出的数量"); } mcsGame.setSurplusCoins(surplusCoins); } else if (type.equals(2)) { //2.体验游戏 Integer awardType = mcsGameDTO.getAwardType(); if (isNull(awardType)) { return R.fail("缺少奖励类型"); } } else { return R.fail("未知错误"); } Integer beforeCoupons = mcsGame.getCoupons(); Integer beforeSurplusCoupons = mcsGame.getSurplusCoupons(); Integer beforeUsedCoupons = beforeCoupons - beforeSurplusCoupons; BeanUtils.copyProperties(mcsGameDTO, mcsGame); Integer coupons = mcsGame.getCoupons(); Integer surplusCoupons = coupons - beforeUsedCoupons; if (surplusCoupons < 0) { return R.fail("卷总数少于已发出的数量"); } mcsGame.setSurplusCoupons(surplusCoupons); int num = this.baseMapper.updateById(mcsGame); if (num > 0) { return R.ok(); } return R.fail("编辑失败,请重新尝试"); } /** * 发布戳戳游戏 * @param gameId * @param userId * @return */ @Override public R publishMcsGame(Long gameId, Long userId) { McsGame mcsGame = this.baseMapper.selectById(gameId); if (isNull(mcsGame)) { return R.fail("资源不存在"); } McsMerchant mcsMerchant = mcsMerchantDAO.selectById(mcsGame.getMerchantId()); Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = this.baseMapper.selectPublishCount(mcsGame.getMerchantId()); if (publishCount >= publishLimit) { return R.fail("空闲戳戳点不足"); } mcsGame.setStatus(McsGame.Status.jxz); mcsGame.setPublishAt(new Date()); mcsGame.setUpdatedBy(userId); int num = this.baseMapper.updateById(mcsGame); if (num > 0) { return R.ok(); } return R.fail("发布失败,请重新尝试"); } /** * 结束戳戳游戏 * @param gameId * @param userId * @return */ @Override public R finishMcsGame(Long gameId, Long userId) { McsGame mcsGame = this.baseMapper.selectById(gameId); if (isNull(mcsGame)) { return R.fail("资源不存在"); } mcsGame.setStatus(McsGame.Status.yjs); mcsGame.setUpdatedBy(userId); int num = this.baseMapper.updateById(mcsGame); if (num > 0) { return R.ok(); } return R.fail("结束失败,请重新尝试"); } /** * 戳戳游戏顶部统计数据 * @param userId * @return */ @Override public R getTopStatistics(Long userId) { McsMerchant mcsMerchant = mcsMerchantDAO.selectOne(new QueryWrapper<McsMerchant>().lambda().eq(McsMerchant::getUserId, userId)); if (isNull(mcsMerchant)) { return R.fail("未查询到商家信息"); } TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt()); Integer appliedCount = this.baseMapper.selectAppliedCount(mcsMerchant.getId()); topStatisticsVO.setAppliedTotal(appliedCount); Integer verifiedCount = this.baseMapper.selectVerifiedCount(mcsMerchant.getId()); topStatisticsVO.setVerifiedTotal(verifiedCount); Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = this.baseMapper.selectPublishCount(mcsMerchant.getId()); Integer idleTotal = publishLimit - publishCount; topStatisticsVO.setIdleTotal(idleTotal > 0 ? idleTotal : 0); return R.ok(topStatisticsVO); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java
@@ -1,14 +1,30 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; import javax.annotation.Resource; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsInformationDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsInformationVO; import com.panzhihua.common.model.vos.community.microCommercialStreet.TopStatisticsVO; import com.panzhihua.service_community.dao.McsGameDAO; import com.panzhihua.service_community.dao.McsInformationDAO; import com.panzhihua.service_community.dao.McsMerchantDAO; import com.panzhihua.service_community.entity.McsInformation; import com.panzhihua.service_community.entity.McsMerchant; import com.panzhihua.service_community.service.McsInformationService; import java.util.Date; /** * (McsInformation)表服务实现类 @@ -20,6 +36,11 @@ public class McsInformationServiceImpl extends ServiceImpl<McsInformationDAO, McsInformation> implements McsInformationService { @Resource private McsGameDAO mcsGameDAO; @Resource private McsMerchantDAO mcsMerchantDAO; /** * 分页查询戳戳资讯 * @param pageMcsInformationDTO @@ -27,7 +48,11 @@ */ @Override public R pageMcsInfo(PageMcsInformationDTO pageMcsInformationDTO) { return null; Page page = new Page<>(); page.setSize(pageMcsInformationDTO.getPageSize()); page.setCurrent(pageMcsInformationDTO.getPageNum()); IPage<McsInformationVO> mcsInfos = this.baseMapper.pageMcsInfo(page, pageMcsInformationDTO); return R.ok(mcsInfos); } /** @@ -37,7 +62,31 @@ */ @Override public R setShelfForMcsInfo(SetShelfForInfoDTO setShelfForInfoDTO) { return null; McsInformation mcsInformation = this.baseMapper.selectById(setShelfForInfoDTO.getInfoId()); if (isNull(mcsInformation)) { return R.fail("修改数据不存在"); } Integer type = setShelfForInfoDTO.getType(); if (type.equals(1)) { //上架 McsMerchant mcsMerchant = mcsMerchantDAO.selectById(mcsInformation.getMerchantId()); Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = mcsGameDAO.selectPublishCount(mcsInformation.getMerchantId()); if (publishCount >= publishLimit) { return R.fail("空闲戳戳点不足"); } mcsInformation.setStatus(2); } else if (type.equals(2)) { //下架 mcsInformation.setStatus(3); } else { return R.fail("未知错误"); } int num = this.baseMapper.updateById(mcsInformation); if (num > 0) { return R.ok(); } return R.fail("修改失败,请重新尝试"); } /** @@ -48,6 +97,107 @@ */ @Override public R deleteMcsInfo(Long infoId, Long userId) { return null; McsInformation mcsInformation = this.baseMapper.selectById(infoId); if (isNull(mcsInformation)) { return R.fail("修改数据不存在"); } mcsInformation.setIsDel(true); mcsInformation.setStatus(McsInformation.Status.yxj); mcsInformation.setUpdatedBy(userId); int num = this.baseMapper.updateById(mcsInformation); if (num > 0) { return R.ok(); } return R.fail("删除失败,请重新尝试"); } /** * 戳戳资讯顶部统计数据 * @param userId * @return */ @Override public R getTopStatistics(Long userId) { McsMerchant mcsMerchant = mcsMerchantDAO.selectOne(new QueryWrapper<McsMerchant>().lambda().eq(McsMerchant::getUserId, userId)); if (isNull(mcsMerchant)) { return R.fail("未查询到商家信息"); } TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt()); Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = mcsGameDAO.selectPublishCount(mcsMerchant.getId()); Integer idleTotal = publishLimit - publishCount; topStatisticsVO.setIdleTotal(idleTotal > 0 ? idleTotal : 0); return R.ok(topStatisticsVO); } /** * 新增戳戳资讯 * @param mcsInfoDTO * @return */ @Override public R addMcsInfo(McsInfoDTO mcsInfoDTO) { Long userId = mcsInfoDTO.getCreatedBy(); McsMerchant mcsMerchant = mcsMerchantDAO.selectOne(new QueryWrapper<McsMerchant>().lambda().eq(McsMerchant::getUserId, userId)); if (isNull(mcsMerchant)) { return R.fail("未查询到商家信息"); } McsInformation mcsInformation = new McsInformation(); BeanUtils.copyProperties(mcsInfoDTO, mcsInformation); mcsInformation.setMerchantId(mcsMerchant.getId()); mcsInformation.setStatus(McsInformation.Status.wfb); int num = this.baseMapper.insert(mcsInformation); if (num > 0) { return R.ok(); } return R.fail("新增失败,请重新尝试"); } /** * 编辑戳戳资讯 * @param mcsInfoDTO * @return */ @Override public R putMcsInfo(McsInfoDTO mcsInfoDTO) { McsInformation mcsInformation = this.baseMapper.selectById(mcsInfoDTO.getId()); if (isNull(mcsInformation)) { return R.fail("资源不存在"); } BeanUtils.copyProperties(mcsInfoDTO, mcsInformation); int num = this.baseMapper.updateById(mcsInformation); if (num > 0) { return R.ok(); } return R.fail("编辑失败,请重新尝试"); } /** * 发布戳戳资讯 * @param infoId * @param userId * @return */ @Override public R publishMcsInfo(Long infoId, Long userId) { McsInformation mcsInformation = this.baseMapper.selectById(infoId); if (isNull(mcsInformation)) { return R.fail("资源不存在"); } McsMerchant mcsMerchant = mcsMerchantDAO.selectById(mcsInformation.getMerchantId()); Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = mcsGameDAO.selectPublishCount(mcsInformation.getMerchantId()); if (publishCount >= publishLimit) { return R.fail("空闲戳戳点不足"); } mcsInformation.setStatus(McsInformation.Status.yfb); mcsInformation.setPublishAt(new Date()); int num = this.baseMapper.updateById(mcsInformation); if (num > 0) { return R.ok(); } return R.fail("发布失败,请重新尝试"); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
@@ -1,12 +1,17 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import java.util.Arrays; import java.util.Date; import javax.annotation.Resource; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.panzhihua.service_community.dao.McsConfigDAO; import com.panzhihua.service_community.dao.McsGameDAO; import com.panzhihua.service_community.entity.McsConfig; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,8 +41,15 @@ @Service("mcsMerchantService") public class McsMerchantServiceImpl extends ServiceImpl<McsMerchantDAO, McsMerchant> implements McsMerchantService { private static final String MERCHANT_PUBLISH_LIMIT_KEY = "MERCHANT_PUBLISH_LIMIT"; private static final int DEFAULT_PUBLISH_LIMIT = 2; @Resource private UserService userService; @Resource private McsConfigDAO mcsConfigDAO; @Resource private McsGameDAO mcsGameDAO; /** * 新增数字商业街商家 @@ -56,6 +68,8 @@ } mcsMerchant.setExpireAt(DateUtils.addDay(new Date(), litDays)); } McsConfig publishLimitConfig = mcsConfigDAO.selectOne(new QueryWrapper<McsConfig>().lambda().eq(McsConfig::getKey, MERCHANT_PUBLISH_LIMIT_KEY)); mcsMerchant.setPublishLimit(nonNull(publishLimitConfig) ? Integer.parseInt(publishLimitConfig.getValue()) : DEFAULT_PUBLISH_LIMIT); mcsMerchant.setUserId(0L); int insertResult = this.baseMapper.insert(mcsMerchant); if (insertResult > 0) { @@ -87,10 +101,9 @@ } if (mcsMerchantDTO.getLevel().equals(1)) { Integer litDays = mcsMerchantDTO.getLitDays(); if (isNull(litDays)) { return R.fail("临时商家未设置点亮天数"); } if (nonNull(litDays)) { mcsMerchant.setExpireAt(DateUtils.addDay(new Date(), litDays)); } } BeanUtils.copyProperties(mcsMerchantDTO, mcsMerchant); int result = this.baseMapper.updateById(mcsMerchant); @@ -113,7 +126,14 @@ */ @Override public R getMcsMerchant(Long merchantId) { return R.ok(this.baseMapper.getMcsMerchantById(merchantId)); McsMerchantVO merchantVO = this.baseMapper.getMcsMerchantById(merchantId); if (nonNull(merchantVO)) { Integer publishLimit = merchantVO.getPublishLimit(); Integer publishCount = mcsGameDAO.selectPublishCount(merchantVO.getId()); Integer idleTotal = publishLimit - publishCount; merchantVO.setIdleTotal(idleTotal > 0 ? idleTotal : 0); } return R.ok(merchantVO); } /** springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsProductServiceImpl.java
@@ -1,10 +1,35 @@ package com.panzhihua.service_community.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.service_community.dao.McsProductDAO; import com.panzhihua.service_community.entity.McsProduct; import com.panzhihua.service_community.service.McsProductService; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.panzhihua.common.model.dtos.community.microCommercialStreet.McsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForProductDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsProductVO; import com.panzhihua.common.utlis.Snowflake; import com.panzhihua.service_community.dao.McsLabelDAO; import com.panzhihua.service_community.dao.McsMerchantDAO; import com.panzhihua.service_community.dao.McsProductDAO; import com.panzhihua.service_community.dao.McsProductLabelDAO; import com.panzhihua.service_community.entity.McsLabel; import com.panzhihua.service_community.entity.McsMerchant; import com.panzhihua.service_community.entity.McsProduct; import com.panzhihua.service_community.entity.McsProductLabel; import com.panzhihua.service_community.service.McsProductService; /** * (McsProduct)表服务实现类 @@ -15,4 +40,149 @@ @Service("mcsProductService") public class McsProductServiceImpl extends ServiceImpl<McsProductDAO, McsProduct> implements McsProductService { @Resource private McsMerchantDAO mcsMerchantDAO; @Resource private McsLabelDAO mcsLabelDAO; @Resource private McsProductLabelDAO mcsProductLabelDAO; /** * 新增产品信息 * @param mcsProductDTO * @return */ @Override public R addMcsProduct(McsProductDTO mcsProductDTO) { Long userId = mcsProductDTO.getCreatedBy(); McsMerchant mcsMerchant = mcsMerchantDAO.selectOne(new QueryWrapper<McsMerchant>().lambda().eq(McsMerchant::getUserId, userId)); if (isNull(mcsMerchant)) { return R.fail("商家信息不存在"); } McsProduct mcsProduct = new McsProduct(); BeanUtils.copyProperties(mcsProductDTO, mcsProduct); mcsProduct.setMerchantId(mcsMerchant.getId()); mcsProduct.setStatus(McsProduct.Status.yxj); mcsProduct.setId(Snowflake.getId()); int num = this.baseMapper.insert(mcsProduct); if (num > 0) { List<Long> labelIds = mcsProductDTO.getLabelIds(); if (nonNull(labelIds) && !labelIds.isEmpty()) { List<McsLabel> mcsLabels = mcsLabelDAO.selectBatchIds(labelIds); if (nonNull(mcsLabels) && !mcsLabels.isEmpty()) { List<McsProductLabel> mcsProductLabelList = new ArrayList<>(); mcsLabels.forEach(e -> { McsProductLabel productLabel = new McsProductLabel(); productLabel.setLabelId(e.getId()); productLabel.setProductId(mcsProduct.getId()); productLabel.setLabelName(e.getName()); mcsProductLabelList.add(productLabel); }); mcsProductLabelDAO.insertBatch(mcsProductLabelList); } } return R.ok(); } return R.fail("新增失败,请重新尝试"); } /** * 编辑产品信息 * @param mcsProductDTO * @return */ @Override public R putMcsProduct(McsProductDTO mcsProductDTO) { McsProduct mcsProduct = this.baseMapper.selectById(mcsProductDTO.getId()); if (isNull(mcsProduct)) { return R.fail("资源不存在"); } BeanUtils.copyProperties(mcsProductDTO, mcsProduct); int num = this.baseMapper.updateById(mcsProduct); if (num > 0) { List<Long> labelIds = mcsProductDTO.getLabelIds(); mcsProductLabelDAO.delete(new QueryWrapper<McsProductLabel>().lambda().eq(McsProductLabel::getProductId, mcsProduct.getId())); if (nonNull(labelIds) && !labelIds.isEmpty()) { List<McsLabel> mcsLabels = mcsLabelDAO.selectBatchIds(labelIds); if (nonNull(mcsLabels) && !mcsLabels.isEmpty()) { List<McsProductLabel> mcsProductLabelList = new ArrayList<>(); mcsLabels.forEach(e -> { McsProductLabel productLabel = new McsProductLabel(); productLabel.setLabelId(e.getId()); productLabel.setProductId(mcsProduct.getId()); productLabel.setLabelName(e.getName()); mcsProductLabelList.add(productLabel); }); mcsProductLabelDAO.insertBatch(mcsProductLabelList); } } return R.ok(); } return R.fail("编辑失败,请重新尝试"); } /** * 删除产品信息 * @param productId * @param userId * @return */ @Override public R deleteMcsProduct(Long productId, Long userId) { McsProduct mcsProduct = this.baseMapper.selectById(productId); if (isNull(mcsProduct)) { return R.fail("资源不存在"); } mcsProduct.setIsDel(true); mcsProduct.setUpdatedBy(userId); int num = this.baseMapper.updateById(mcsProduct); if (num > 0) { return R.ok(); } return R.fail("删除失败,请重新尝试"); } /** * 上架/下架产品信息 * @param setShelfForProductDTO * @return */ @Override public R setShelfForMcsProduct(SetShelfForProductDTO setShelfForProductDTO) { Integer type = setShelfForProductDTO.getType(); List<McsProduct> mcsProducts = this.baseMapper.selectBatchIds(setShelfForProductDTO.getProductIds()); if (nonNull(mcsProducts) && !mcsProducts.isEmpty()) { if (type.equals(1)) { //上架 mcsProducts.forEach(e -> { e.setStatus(McsProduct.Status.sjz); e.setUpdatedBy(setShelfForProductDTO.getUpdatedBy()); }); } else if (type.equals(2)) { //下架 mcsProducts.forEach(e -> { e.setStatus(McsProduct.Status.yxj); e.setUpdatedBy(setShelfForProductDTO.getUpdatedBy()); }); } else { return R.fail("未知错误"); } this.updateBatchById(mcsProducts); } return R.ok(); } /** * 分页查询产品信息 * @param pageMcsProductDTO * @return */ @Override public R pageMcsProduct(PageMcsProductDTO pageMcsProductDTO) { Page page = new Page<>(); page.setSize(pageMcsProductDTO.getPageSize()); page.setCurrent(pageMcsProductDTO.getPageNum()); IPage<McsProductVO> mcsProduct = this.baseMapper.pageMcsProduct(page, pageMcsProductDTO); return R.ok(mcsProduct); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsEvaluateMapper.xml
@@ -30,6 +30,28 @@ coupon_id = values(coupon_id) , star = values(star) , content = values(content) , photos = values(photos) , created_at = values(created_at) </insert> <select id="pageMcsEvaluate" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO"> SELECT t1.id, t1.star, t1.content, t1.photos, t1.created_at, t3.nick_name, t3.phone, t2.`name` AS gameName FROM mcs_evaluate t1 LEFT JOIN mcs_game t2 ON t1.game_id = t2.id LEFT JOIN sys_user t3 ON t1.user_id = t3.user_id WHERE 1=1 <if test="pageMcsEvaluateDTO.keyword != null and pageMcsEvaluateDTO.keyword != """> AND ( t3.nick_name LIKE CONCAT(#{pageMcsEvaluateDTO.keyword}, '%') OR t3.phone LIKE CONCAT(#{pageMcsEvaluateDTO.keyword}, '%') ) </if> </select> <select id="getMcsEvaluate" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO"> SELECT t1.id, t1.star, t1.content, t1.photos, t1.created_at, t3.nick_name, t3.phone, t2.`name` AS gameName FROM mcs_evaluate t1 LEFT JOIN mcs_game t2 ON t1.game_id = t2.id LEFT JOIN sys_user t3 ON t1.user_id = t3.user_id WHERE t1.id = #{evaluateId} </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsGameMapper.xml
@@ -11,6 +11,7 @@ <result property="awardType" column="award_type" jdbcType="INTEGER"/> <result property="allocation" column="allocation" jdbcType="INTEGER"/> <result property="coins" column="coins" jdbcType="INTEGER"/> <result property="surplusCoins" column="surplus_coins" jdbcType="INTEGER"/> <result property="address" column="address" jdbcType="VARCHAR"/> <result property="lat" column="lat" jdbcType="VARCHAR"/> <result property="lon" column="lon" jdbcType="VARCHAR"/> @@ -99,6 +100,26 @@ </if> ORDER BY t1.created_at DESC </select> <select id="selectPublishCount" resultType="java.lang.Integer"> SELECT SUM(publishCount) AS publishCount FROM ( SELECT COUNT(1) AS publishCount FROM mcs_game WHERE merchant_id = 2 AND `status` = 2 AND is_del = 0 UNION ALL SELECT COUNT(1) AS publishCount FROM mcs_information WHERE merchant_id = 2 AND `status` = 2 AND is_del = 0 ) temp </select> <select id="selectAppliedCount" resultType="java.lang.Integer"> SELECT COUNT(1) FROM mcs_coupon t1 LEFT JOIN mcs_game t2 ON t1.game_id = t2.id WHERE t2.merchant_id = #{merchantId} </select> <select id="selectVerifiedCount" resultType="java.lang.Integer"> SELECT COUNT(1) FROM mcs_coupon t1 LEFT JOIN mcs_game t2 ON t1.game_id = t2.id WHERE t1.is_verified = 1 AND t2.merchant_id = #{merchantId} </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsInformationMapper.xml
@@ -47,6 +47,20 @@ values(is_del) , merchant_id = values(merchant_id) , created_at = values(created_at) , created_by = values(created_by) , updated_at = values(updated_at) , updated_by = values(updated_by) </insert> <select id="pageMcsInfo" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsInformationVO"> SELECT t1.id, t1.`name`, t1.publish_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName FROM mcs_information t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.is_del = 0 <if test="pageMcsInformationDTO.status != null"> AND t1.`status` = #{pageMcsInformationDTO.status} </if> <if test="pageMcsInformationDTO.keyword != null and pageMcsInformationDTO.keyword != """> AND t1.`name` LIKE CONCAT(#{pageMcsInformationDTO.keyword}, '%') </if> ORDER BY t1.created_at DESC </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsMerchantMapper.xml
@@ -12,6 +12,7 @@ <result property="level" column="level" jdbcType="INTEGER"/> <result property="publishLimit" column="publish_limit" jdbcType="INTEGER"/> <result property="expireAt" column="expire_at" jdbcType="TIMESTAMP"/> <result property="firstLitAt" column="first_lit_at" jdbcType="TIMESTAMP"/> <result property="address" column="address" jdbcType="VARCHAR"/> <result property="lat" column="lat" jdbcType="VARCHAR"/> <result property="lon" column="lon" jdbcType="VARCHAR"/> @@ -55,7 +56,8 @@ </insert> <select id="getMcsMerchantById" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO"> SELECT t1.id, t1.`name`, t1.phone, t1.account, t1.`level`, t1.expire_at, t2.`status` AS accountStatus SELECT t1.id, t1.`name`, t1.phone, t1.account, t1.`level`, t1.expire_at, t1.first_lit_at, t1.publish_limit, t1.logo, t1.address, t1.lat, t1.lon, t1.introduction, t2.`status` AS accountStatus FROM mcs_merchant t1 LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id WHERE t1.id = #{merchantId} AND t1.is_del = 0 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsProductMapper.xml
@@ -44,6 +44,21 @@ values(created_at) , created_by = values(created_by) , updated_at = values(updated_at) , updated_by = values(updated_by) </insert> <select id="pageMcsProduct" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsProductVO"> SELECT t1.id, t1.`name`, t1.image, t1.view_num, t1.`status`, t3.productLabel FROM mcs_product t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id LEFT JOIN (SELECT product_id, GROUP_CONCAT(label_name) AS productLabel FROM mcs_product_label GROUP BY product_id) t3 ON t1.id = t3.product_id WHERE t1.is_del = 0 AND t2.user_id = #{pageMcsProductDTO.userId} AND t2.is_del = 0 <if test="pageMcsProductDTO.status != null"> AND t1.`status` = #{pageMcsProductDTO.status} </if> <if test="pageMcsProductDTO.keyword != null and pageMcsProductDTO.keyword != """> AND t1.`name` LIKE CONCAT(#{pageMcsProductDTO.keyword}, '%') </if> ORDER BY t1.created_at DESC </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/MicroCommercialStreetApi.java
New file @@ -0,0 +1,227 @@ package com.panzhihua.shop_backstage.api; import javax.annotation.Resource; import javax.validation.Valid; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsEvaluateDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsInformationDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForProductDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsInformationVO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsProductVO; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.validated.AddGroup; import com.panzhihua.common.validated.PutGroup; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; /** * @title: MicroCommercialStreetApi * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 微商业街相关接口 * @author: hans * @date: 2021/12/28 14:18 */ @Api(tags = {"微商业街"}) @RestController @RequestMapping("/microcommercialstreet") public class MicroCommercialStreetApi extends BaseController { @Resource private CommunityService communityService; @ApiOperation(value = "新增戳戳游戏") @PostMapping("/game/add") public R addMcsGame(@RequestBody @Validated(AddGroup.class) McsGameDTO mcsGameDTO) { Long userId = this.getUserId(); mcsGameDTO.setCreatedBy(userId); mcsGameDTO.setUpdatedBy(userId); return communityService.addMcsGame(mcsGameDTO); } @ApiOperation(value = "编辑戳戳游戏") @PutMapping("/game/put") public R putMcsGame(@RequestBody @Validated(PutGroup.class) McsGameDTO mcsGameDTO) { mcsGameDTO.setUpdatedBy(this.getUserId()); return communityService.putMcsGame(mcsGameDTO); } @ApiOperation(value = "发布戳戳游戏") @ApiImplicitParam(name = "gameId", value = "游戏id", required = true) @GetMapping("/game/publish") public R publishMcsGame(@RequestParam("gameId") Long gameId) { return communityService.publishMcsGame(gameId, this.getUserId()); } @ApiOperation(value = "结束戳戳游戏") @ApiImplicitParam(name = "gameId", value = "游戏id", required = true) @GetMapping("/game/finish") public R finishMcsGame(@RequestParam("gameId") Long gameId) { return communityService.finishMcsGame(gameId, this.getUserId()); } @ApiOperation(value = "分页查询戳戳游戏", response = McsGameVO.class) @PostMapping("/game/page") public R pageMcsGame(@RequestBody @Valid PageMcsGameDTO pageMcsGameDTO) { return communityService.pageMcsGame(pageMcsGameDTO); } @ApiOperation(value = "上架/下架戳戳游戏") @PutMapping("/game/setShelf") public R setShelfForGame(@RequestBody @Valid SetShelfForGameDTO setShelfForGameDTO) { setShelfForGameDTO.setUpdatedBy(this.getUserId()); return communityService.setShelfForGame(setShelfForGameDTO); } @ApiOperation(value = "删除戳戳游戏") @ApiImplicitParam(name = "gameId", value = "游戏id", required = true) @DeleteMapping("/game/delete") public R deleteMcsGame(@RequestParam("gameId") Long gameId) { return communityService.deleteMcsGame(gameId, this.getUserId()); } @ApiOperation(value = "戳戳游戏/资讯顶部统计数据") @ApiImplicitParam(name = "type", value = "类型(1.戳戳游戏 2.戳戳资讯)", required = true) @GetMapping("/statistics/top") public R getTopStatistics(@RequestParam("type") Integer type) { return communityService.getTopStatistics(type, this.getUserId()); } @ApiOperation(value = "新增戳戳资讯") @PostMapping("/information/add") public R addMcsInfo(@RequestBody @Validated(AddGroup.class) McsInfoDTO mcsInfoDTO) { Long userId = this.getUserId(); mcsInfoDTO.setCreatedBy(userId); mcsInfoDTO.setUpdatedBy(userId); return communityService.addMcsInfo(mcsInfoDTO); } @ApiOperation(value = "编辑戳戳资讯") @PutMapping("/information/put") public R putMcsInfo(@RequestBody @Validated(PutGroup.class) McsInfoDTO mcsInfoDTO) { mcsInfoDTO.setUpdatedBy(this.getUserId()); return communityService.putMcsInfo(mcsInfoDTO); } @ApiOperation(value = "发布戳戳资讯") @ApiImplicitParam(name = "infoId", value = "资讯id", required = true) @GetMapping("/information/publish") public R publishMcsInfo(@RequestParam("infoId") Long infoId) { return communityService.publishMcsInfo(infoId, this.getUserId()); } @ApiOperation(value = "分页查询戳戳资讯", response = McsInformationVO.class) @PostMapping("/information/page") public R pageMcsInfo(@RequestBody @Valid PageMcsInformationDTO pageMcsInformationDTO) { return communityService.pageMcsInfo(pageMcsInformationDTO); } @ApiOperation(value = "上架/下架戳戳资讯") @PutMapping("/information/setShelf") public R setShelfForMcsInfo(@RequestBody @Valid SetShelfForInfoDTO setShelfForInfoDTO) { setShelfForInfoDTO.setUpdatedBy(this.getUserId()); return communityService.setShelfForMcsInfo(setShelfForInfoDTO); } @ApiOperation(value = "删除戳戳资讯") @ApiImplicitParam(name = "infoId", value = "资讯id", required = true) @DeleteMapping("/information/delete") public R deleteMcsInfo(@RequestParam("infoId") Long infoId) { return communityService.deleteMcsInfo(infoId, this.getUserId()); } @ApiOperation(value = "编辑数字商业街商家") @PutMapping("/merchant/put") public R putMcsMerchant(@RequestBody @Validated(PutGroup.class) McsMerchantDTO mcsMerchantDTO) { mcsMerchantDTO.setUpdatedBy(this.getUserId()); return communityService.putMcsMerchant(mcsMerchantDTO); } @ApiOperation(value = "查询数字商业街商家详情", response = McsMerchantVO.class) @ApiImplicitParam(name = "merchantId", value = "商家id", required = true) @GetMapping("/merchant/get") public R getMcsMerchant(@RequestParam("merchantId") Long merchantId) { return communityService.getMcsMerchant(merchantId); } @ApiOperation(value = "新增产品信息") @PostMapping("/product/add") public R addMcsProduct(@RequestBody @Validated(AddGroup.class) McsProductDTO mcsProductDTO) { Long userId = this.getUserId(); mcsProductDTO.setCreatedBy(userId); mcsProductDTO.setUpdatedBy(userId); return communityService.addMcsProduct(mcsProductDTO); } @ApiOperation(value = "编辑产品信息") @PutMapping("/product/put") public R putMcsProduct(@RequestBody @Validated(PutGroup.class) McsProductDTO mcsProductDTO) { mcsProductDTO.setUpdatedBy(this.getUserId()); return communityService.putMcsProduct(mcsProductDTO); } @ApiOperation(value = "删除产品信息") @ApiImplicitParam(name = "productId", value = "产品id", required = true) @DeleteMapping("/product/delete") public R deleteMcsProduct(@RequestParam("productId") Long productId) { return communityService.deleteMcsProduct(productId, this.getUserId()); } @ApiOperation(value = "上架/下架产品信息") @PutMapping("/product/setShelf") public R setShelfForMcsProduct(@RequestBody @Valid SetShelfForProductDTO setShelfForProductDTO) { setShelfForProductDTO.setUpdatedBy(this.getUserId()); return communityService.setShelfForMcsProduct(setShelfForProductDTO); } @ApiOperation(value = "分页查询产品信息", response = McsProductVO.class) @PostMapping("/product/page") public R pageMcsProduct(@RequestBody @Valid PageMcsProductDTO pageMcsProductDTO) { pageMcsProductDTO.setUserId(this.getUserId()); return communityService.pageMcsProduct(pageMcsProductDTO); } @ApiOperation(value = "分页查询评价记录", response = McsEvaluateVO.class) @PostMapping("/evaluate/page") public R pageMcsEvaluate(@RequestBody @Valid PageMcsEvaluateDTO pageMcsEvaluateDTO) { return communityService.pageMcsEvaluate(pageMcsEvaluateDTO); } @ApiOperation(value = "查询评价记录详情", response = McsEvaluateVO.class) @ApiImplicitParam(name = "evaluateId", value = "评论id", required = true) @GetMapping("/evaluate/get") public R getMcsEvaluate(@RequestParam("evaluateId") Long evaluateId) { return communityService.getMcsEvaluate(evaluateId); } @ApiOperation(value = "删除评价记录") @ApiImplicitParam(name = "evaluateId", value = "评论id", required = true) @DeleteMapping("/evaluate/delete") public R deleteMcsEvaluate(@RequestParam("evaluateId") Long evaluateId) { return communityService.deleteMcsEvaluate(evaluateId); } }