springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/MicroCommercialStreetApi.java
@@ -1,18 +1,37 @@ package com.panzhihua.applets_backstage.api; import java.util.List; 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.DisableOrEnableMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; 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.SetPopularForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; 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.service.community.CommunityService; import com.panzhihua.common.validated.AddGroup; import com.panzhihua.common.validated.PutGroup; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -40,4 +59,93 @@ mcsMerchantDTO.setUpdatedBy(userId); return communityService.addMcsMerchant(mcsMerchantDTO); } @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) @GetMapping("/merchant/get") public R getMcsMerchant(@RequestParam("merchantId") Long merchantId) { return communityService.getMcsMerchant(merchantId); } @ApiOperation(value = "删除数字商业街商家") @DeleteMapping("/merchant/delete") public R deleteMcsMerchant(@RequestParam("merchantId") Long merchantId) { return communityService.deleteMcsMerchant(merchantId, this.getUserId()); } @ApiOperation(value = "分页查询数字商业街商家", response = McsMerchantVO.class) @PostMapping("/merchant/page") public R pageMcsMerchant(@RequestBody @Valid PageMcsMerchantDTO pageMcsMerchantDTO) { return communityService.pageMcsMerchant(pageMcsMerchantDTO); } @ApiOperation(value = "禁用/启用数字商业街商家") @PutMapping("/merchant/disable-or-enable") public R disableOrEnableMcsMerchant(@RequestBody @Valid DisableOrEnableMcsMerchantDTO disableOrEnableMcsMerchantDTO) { disableOrEnableMcsMerchantDTO.setUpdatedBy(this.getUserId()); return communityService.disableOrEnableMcsMerchant(disableOrEnableMcsMerchantDTO); } @ApiOperation(value = "获取所有数字商业街配置", response = McsConfigVO.class) @GetMapping("/config/all") public R getAllMcsConfig() { return communityService.getAllMcsConfig(); } @ApiOperation(value = "修改数字商业街配置") @PutMapping("/config/put") public R putMcsConfig(@RequestBody List<McsConfigVO> configs) { return communityService.putMcsConfig(configs); } @ApiOperation(value = "分页查询戳戳游戏", response = McsGameVO.class) @PostMapping("/game/page") public R pageMcsGame(@RequestBody @Valid PageMcsGameDTO pageMcsGameDTO) { return communityService.pageMcsGame(pageMcsGameDTO); } @ApiOperation(value = "设为/取消游戏热门") @PutMapping("/game/setPopular") public R setPopularForGame(@RequestBody @Valid SetPopularForGameDTO setPopularForGameDTO) { setPopularForGameDTO.setUpdatedBy(this.getUserId()); return communityService.setPopularForGame(setPopularForGameDTO); } @ApiOperation(value = "上架/下架戳戳游戏") @PutMapping("/game/setShelf") public R setShelfForGame(@RequestBody @Valid SetShelfForGameDTO setShelfForGameDTO) { setShelfForGameDTO.setUpdatedBy(this.getUserId()); return communityService.setShelfForGame(setShelfForGameDTO); } @ApiOperation(value = "删除戳戳游戏") @DeleteMapping("/game/delete") public R deleteMcsGame(@RequestParam("gameId") Long gameId) { return communityService.deleteMcsGame(gameId, 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 = "删除戳戳资讯") @DeleteMapping("/information/delete") public R deleteMcsInfo(@RequestParam("infoId") Long infoId) { return communityService.deleteMcsInfo(infoId, this.getUserId()); } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/DisableOrEnableMcsMerchantDTO.java
New file @@ -0,0 +1,30 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: DisableOrEnableMcsMerchantDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 禁用/启用数字商业街商家请求参数 * @author: hans * @date: 2021/12/29 14:35 */ @Data @ApiModel("禁用/启用数字商业街商家请求参数") public class DisableOrEnableMcsMerchantDTO { @ApiModelProperty(value = "处理类型(1.启用 2.禁用)", required = true, allowableValues = "1,2") @NotNull(message = "处理类型不能为空") private Integer type; @ApiModelProperty(value = "商家id", required = true) @NotNull(message = "商家id不能为空") private Long merchantId; @ApiModelProperty(value = "处理人", hidden = true) private Long updatedBy; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/McsMerchantDTO.java
@@ -78,4 +78,7 @@ @ApiModelProperty(value = "更新人", hidden = true) private Long updatedBy; @ApiModelProperty(value = "所属商家", hidden = true) private Long userId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/PageMcsGameDTO.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: PageMcsGameDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 分页查询戳戳游戏请求参数 * @author: hans * @date: 2021/12/30 15:20 */ @Data @ApiModel("分页查询戳戳游戏请求参数") public class PageMcsGameDTO { @ApiModelProperty("关键词") private String keyword; @ApiModelProperty("游戏类别(1.戳戳币游戏 2.体验游戏)") private Integer type; @ApiModelProperty("状态(1.未发布 2.进行中 3.已下架 4.已结束)") 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; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/PageMcsInformationDTO.java
New file @@ -0,0 +1,36 @@ 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: PageMcsInformationDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 分页查询戳戳资讯请求参数 * @author: hans * @date: 2021/12/30 17:44 */ @Data @ApiModel("分页查询戳戳资讯请求参数") public class PageMcsInformationDTO { @ApiModelProperty("关键词") private String keyword; @ApiModelProperty("状态(1.未发布 2.已发布 3.已下架)") 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; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/PageMcsMerchantDTO.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: PageMcsMerchantDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 分页查询微商业街商家请求参数 * @author: hans * @date: 2021/12/29 14:31 */ @Data @ApiModel("分页查询微商业街商家请求参数") public class PageMcsMerchantDTO { @ApiModelProperty("关键词") private String keyword; @ApiModelProperty("账号状态(1.启用 2.禁用)") private Integer accountStatus; @ApiModelProperty("商家级别(1.临时商家 2.合作商家)") private Integer level; @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/SetPopularForGameDTO.java
New file @@ -0,0 +1,30 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: SetPopularForGameDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 设为/取消游戏热门请求参数 * @author: hans * @date: 2021/12/30 16:29 */ @Data @ApiModel("设为/取消游戏热门请求参数") public class SetPopularForGameDTO { @ApiModelProperty(value = "处理类型(1.设为热门 2.取消热门)", required = true, allowableValues = "1,2") @NotNull(message = "处理类型不能为空") private Integer type; @ApiModelProperty(value = "游戏id", required = true) @NotNull(message = "游戏id不能为空") private Long gameId; @ApiModelProperty(value = "处理人", hidden = true) private Long updatedBy; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/SetShelfForGameDTO.java
New file @@ -0,0 +1,30 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: SetPopularForGameDTO1 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 上架/下架戳戳游戏请求参数 * @author: hans * @date: 2021/12/30 16:43 */ @Data @ApiModel("上架/下架戳戳游戏请求参数") public class SetShelfForGameDTO { @ApiModelProperty(value = "处理类型(1.上架 2.下架)", required = true, allowableValues = "1,2") @NotNull(message = "处理类型不能为空") private Integer type; @ApiModelProperty(value = "游戏id", required = true) @NotNull(message = "游戏id不能为空") private Long gameId; @ApiModelProperty(value = "处理人", hidden = true) private Long updatedBy; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/SetShelfForInfoDTO.java
New file @@ -0,0 +1,30 @@ package com.panzhihua.common.model.dtos.community.microCommercialStreet; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: SetShelfForInfoDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 上架/下架戳戳资讯请求参数 * @author: hans * @date: 2021/12/30 17:45 */ @Data @ApiModel("上架/下架戳戳资讯请求参数") public class SetShelfForInfoDTO { @ApiModelProperty(value = "处理类型(1.上架 2.下架)", required = true, allowableValues = "1,2") @NotNull(message = "处理类型不能为空") private Integer type; @ApiModelProperty(value = "资讯id", required = true) @NotNull(message = "资讯id不能为空") private Long infoId; @ApiModelProperty(value = "处理人", hidden = true) private Long updatedBy; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsConfigVO.java
New file @@ -0,0 +1,29 @@ package com.panzhihua.common.model.vos.community.microCommercialStreet; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsConfigVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 数字商业街配置信息 * @author: hans * @date: 2021/12/30 11:15 */ @Data @ApiModel("数字商业街配置信息") public class McsConfigVO { @ApiModelProperty("配置id") private Long id; @ApiModelProperty("配置名称") private String name; @ApiModelProperty("key") private String key; @ApiModelProperty("配置内容") private String value; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsGameVO.java
New file @@ -0,0 +1,79 @@ package com.panzhihua.common.model.vos.community.microCommercialStreet; import java.util.Date; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsGameVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 戳戳游戏信息 * @author: hans * @date: 2021/12/30 13:50 */ @Data @ApiModel("戳戳游戏信息") public class McsGameVO { @ApiModelProperty("游戏id") private Long id; @ApiModelProperty("游戏名称") private String name; @ApiModelProperty("戳戳卷数量") private Integer coupons; @ApiModelProperty("剩余戳戳卷数量") private Integer surplusCoupons; @ApiModelProperty("游戏类别(1.戳戳币游戏 2.体验游戏)") private Integer type; @ApiModelProperty("奖励类型(1.免费产品 2.免费服务)") private Integer awardType; @ApiModelProperty("戳戳币分配方式(1.随机分配 2.平均分配)") private Integer allocation; @ApiModelProperty("戳戳币总额") private Integer coins; @ApiModelProperty("地址") private String address; @ApiModelProperty("纬度") private String lat; @ApiModelProperty("经度") private String lon; @ApiModelProperty("失效时间") private Date expireAt; @ApiModelProperty("封面") private String cover; @ApiModelProperty("其他图片(多张图片以逗号隔开)") private String otherImages; @ApiModelProperty("游戏介绍") private String introduction; @ApiModelProperty("状态(1.未发布 2.进行中 3.已下架 4.已结束)") private Integer status; @ApiModelProperty("是否热门") private Boolean isPopular; @ApiModelProperty("发布时间") private Date publishAt; @ApiModelProperty("所属商家") private Long merchantId; @ApiModelProperty("所属商家名称") private Long merchantName; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsInformationVO.java
New file @@ -0,0 +1,52 @@ package com.panzhihua.common.model.vos.community.microCommercialStreet; import java.util.Date; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsInformationVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 戳戳资讯信息 * @author: hans * @date: 2021/12/30 17:43 */ @Data @ApiModel("戳戳资讯信息") public class McsInformationVO { @ApiModelProperty("资讯id") private Long id; @ApiModelProperty("资讯标题") private String name; @ApiModelProperty("地址") private String address; @ApiModelProperty("纬度") private String lat; @ApiModelProperty("经度") private String lon; @ApiModelProperty("封面") private String cover; @ApiModelProperty("资讯内容") private String content; @ApiModelProperty("状态(1.未发布 2.已发布 3.已下架)") private Integer status; @ApiModelProperty("发布时间") private Date publishAt; @ApiModelProperty("所属商家") private Long merchantId; @ApiModelProperty("所属商家名称") private Long merchantName; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsMerchantVO.java
New file @@ -0,0 +1,61 @@ package com.panzhihua.common.model.vos.community.microCommercialStreet; import java.util.Date; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsMerchantVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 数字商业街商家信息 * @author: hans * @date: 2021/12/29 10:37 */ @Data @ApiModel("数字商业街商家信息") public class McsMerchantVO { @ApiModelProperty("商家id") private Long id; @ApiModelProperty("商家名称") private String name; @ApiModelProperty("手机号") private String phone; @ApiModelProperty("商家账号") private String account; @ApiModelProperty("商家logo") private String logo; @ApiModelProperty("商家级别(1.临时商家 2.合作商家)") private Integer level; @ApiModelProperty("戳戳点亮上限(发布次数上限)") private Integer publishLimit; @ApiModelProperty("到期时间") private Date expireAt; @ApiModelProperty("商家地址") private String address; @ApiModelProperty("纬度") private String lat; @ApiModelProperty("经度") private String lon; @ApiModelProperty("商家简介") private String introduction; @ApiModelProperty("首次点亮时间") private Date firstLit; @ApiModelProperty("账号状态(1.启用 2.禁用)") private Integer accountStatus; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -3,7 +3,15 @@ import java.util.List; import com.panzhihua.common.model.dtos.PageBaseDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; 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.SetPopularForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.scheduling.annotation.Async; import org.springframework.web.bind.annotation.DeleteMapping; @@ -7721,4 +7729,118 @@ */ @PostMapping("/microcommercialstreet/merchant/add") R addMcsMerchant(@RequestBody McsMerchantDTO mcsMerchantDTO); /** * 编辑数字商业街商家 * @param mcsMerchantDTO * @return */ @PutMapping("/microcommercialstreet/merchant/put") R putMcsMerchant(@RequestBody McsMerchantDTO mcsMerchantDTO); /** * 查询数字商业街商家详情 * @param merchantId * @return */ @GetMapping("/microcommercialstreet/merchant/get") R getMcsMerchant(@RequestParam("merchantId") Long merchantId); /** * 删除数字商业街商家 * @param merchantId * @param userId * @return */ @DeleteMapping("/microcommercialstreet/merchant/delete") R deleteMcsMerchant(@RequestParam("merchantId") Long merchantId, @RequestParam("userId") Long userId); /** * 分页查询数字商业街商家 * @param pageMcsMerchantDTO * @return */ @PostMapping("/microcommercialstreet/merchant/page") R pageMcsMerchant(@RequestBody PageMcsMerchantDTO pageMcsMerchantDTO); /** * 禁用/启用数字商业街商家 * @param disableOrEnableMcsMerchantDTO * @return */ @PutMapping("/microcommercialstreet/merchant/disable-or-enable") R disableOrEnableMcsMerchant(@RequestBody DisableOrEnableMcsMerchantDTO disableOrEnableMcsMerchantDTO); /** * 获取所有数字商业街配置 * @return */ @GetMapping("/microcommercialstreet/config/all") R getAllMcsConfig(); /** * 修改数字商业街配置 * @param configs * @return */ @PutMapping("/microcommercialstreet/config/put") R putMcsConfig(@RequestBody List<McsConfigVO> configs); /** * 分页查询戳戳游戏 * @param pageMcsGameDTO * @return */ @PostMapping("/microcommercialstreet/game/page") R pageMcsGame(@RequestBody PageMcsGameDTO pageMcsGameDTO); /** * 设为/取消游戏热门 * @param setPopularForGameDTO * @return */ @PutMapping("/microcommercialstreet/game/setPopular") R setPopularForGame(@RequestBody SetPopularForGameDTO setPopularForGameDTO); /** * 上架/下架戳戳游戏 * @param setShelfForGameDTO * @return */ @PutMapping("/microcommercialstreet/game/setShelf") R setShelfForGame(@RequestBody SetShelfForGameDTO setShelfForGameDTO); /** * 删除戳戳游戏 * @param gameId * @param userId * @return */ @DeleteMapping("/microcommercialstreet/game/delete") R deleteMcsGame(@RequestParam("gameId") Long gameId, @RequestParam("userId") Long userId); /** * 分页查询戳戳资讯 * @param pageMcsInformationDTO * @return */ @PostMapping("/microcommercialstreet/information/page") R pageMcsInfo(@RequestBody PageMcsInformationDTO pageMcsInformationDTO); /** * 上架/下架戳戳资讯 * @param setShelfForInfoDTO * @return */ @PutMapping("/microcommercialstreet/information/setShelf") R setShelfForMcsInfo(@RequestBody SetShelfForInfoDTO setShelfForInfoDTO); /** * 删除戳戳资讯 * @param infoId * @param userId * @return */ @DeleteMapping("/microcommercialstreet/information/delete") R deleteMcsInfo(@RequestParam("infoId") Long infoId, @RequestParam("userId") Long userId); } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/user/UserService.java
@@ -1101,4 +1101,12 @@ */ @PostMapping("insertMcsMerchantAccount") R addMcsMerchantUser(@RequestBody McsMerchantDTO mcsMerchantDTO); /** * 微商业街修改商家账号 * @param mcsMerchantDTO * @return */ @PutMapping("putMcsMerchantUser") R putMcsMerchantUser(@RequestBody McsMerchantDTO mcsMerchantDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/MicroCommercialStreetApi.java
@@ -2,11 +2,26 @@ import javax.annotation.Resource; import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO; 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.SetPopularForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import com.panzhihua.service_community.service.McsConfigService; import com.panzhihua.service_community.service.McsGameService; import com.panzhihua.service_community.service.McsInformationService; import com.panzhihua.service_community.service.McsMerchantService; 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; @@ -17,6 +32,8 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import java.util.List; /** * @title: MicroCommercialStreetApi @@ -31,6 +48,12 @@ @Resource private McsMerchantService mcsMerchantService; @Resource private McsConfigService mcsConfigService; @Resource private McsGameService mcsGameService; @Resource private McsInformationService mcsInformationService; /** * 新增数字商业街商家 @@ -41,4 +64,146 @@ public R addMcsMerchant(@RequestBody McsMerchantDTO mcsMerchantDTO) { return mcsMerchantService.addMcsMerchant(mcsMerchantDTO); } /** * 编辑数字商业街商家 * @param mcsMerchantDTO * @return */ @PutMapping("/merchant/put") public R putMcsMerchant(@RequestBody McsMerchantDTO mcsMerchantDTO) { return mcsMerchantService.putMcsMerchant(mcsMerchantDTO); } /** * 查询数字商业街商家详情 * @param merchantId * @return */ @GetMapping("/merchant/get") public R getMcsMerchant(@RequestParam("merchantId") Long merchantId) { return mcsMerchantService.getMcsMerchant(merchantId); } /** * 删除数字商业街商家 * @param merchantId * @param userId * @return */ @DeleteMapping("/merchant/delete") public R deleteMcsMerchant(@RequestParam("merchantId") Long merchantId, @RequestParam("userId") Long userId) { return mcsMerchantService.deleteMcsMerchant(merchantId, userId); } /** * 分页查询数字商业街商家 * @param pageMcsMerchantDTO * @return */ @PostMapping("/merchant/page") public R pageMcsMerchant(@RequestBody PageMcsMerchantDTO pageMcsMerchantDTO) { return mcsMerchantService.pageMcsMerchant(pageMcsMerchantDTO); } /** * 禁用/启用数字商业街商家 * @param disableOrEnableMcsMerchantDTO * @return */ @PutMapping("/merchant/disable-or-enable") public R disableOrEnableMcsMerchant(@RequestBody DisableOrEnableMcsMerchantDTO disableOrEnableMcsMerchantDTO) { return mcsMerchantService.disableOrEnableMcsMerchant(disableOrEnableMcsMerchantDTO); } /** * 获取所有数字商业街配置 * @return */ @GetMapping("/config/all") public R getAllMcsConfig() { return mcsConfigService.getAllMcsConfig(); } /** * 修改数字商业街配置 * @param configs * @return */ @PutMapping("/config/put") public R putMcsConfig(@RequestBody List<McsConfigVO> configs) { return mcsConfigService.putMcsConfig(configs); } /** * 分页查询戳戳游戏 * @param pageMcsGameDTO * @return */ @PostMapping("/game/page") public R pageMcsGame(@RequestBody PageMcsGameDTO pageMcsGameDTO) { return mcsGameService.pageMcsGame(pageMcsGameDTO); } /** * 设为/取消游戏热门 * @param setPopularForGameDTO * @return */ @PutMapping("/game/setPopular") public R setPopularForGame(@RequestBody SetPopularForGameDTO setPopularForGameDTO) { return mcsGameService.setPopularForGame(setPopularForGameDTO); } /** * 上架/下架戳戳游戏 * @param setShelfForGameDTO * @return */ @PutMapping("/game/setShelf") public R setShelfForGame(@RequestBody SetShelfForGameDTO setShelfForGameDTO) { return mcsGameService.setShelfForGame(setShelfForGameDTO); } /** * 删除戳戳游戏 * @param gameId * @param userId * @return */ @DeleteMapping("/game/delete") public R deleteMcsGame(@RequestParam("gameId") Long gameId, @RequestParam("userId") Long userId) { return mcsGameService.deleteMcsGame(gameId, userId); } /** * 分页查询戳戳资讯 * @param pageMcsInformationDTO * @return */ @PostMapping("/information/page") public R pageMcsInfo(@RequestBody PageMcsInformationDTO pageMcsInformationDTO) { return mcsInformationService.pageMcsInfo(pageMcsInformationDTO); } /** * 上架/下架戳戳资讯 * @param setShelfForInfoDTO * @return */ @PutMapping("/information/setShelf") public R setShelfForMcsInfo(@RequestBody SetShelfForInfoDTO setShelfForInfoDTO) { return mcsInformationService.setShelfForMcsInfo(setShelfForInfoDTO); } /** * 删除戳戳资讯 * @param infoId * @param userId * @return */ @DeleteMapping("/information/delete") public R deleteMcsInfo(@RequestParam("infoId") Long infoId, @RequestParam("userId") Long userId) { return mcsInformationService.deleteMcsInfo(infoId, userId); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsGameDAO.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.PageMcsGameDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; import com.panzhihua.service_community.entity.McsGame; @@ -36,4 +40,11 @@ */ int insertOrUpdateBatch(@Param("entities") List<McsGame> entities); /** * 分页查询戳戳游戏 * @param page * @param pageMcsGameDTO * @return */ IPage<McsGameVO> pageMcsGame(@Param("page") Page page, @Param("pageMcsGameDTO") PageMcsGameDTO pageMcsGameDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsMerchantDAO.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.PageMcsMerchantDTO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; import com.panzhihua.service_community.entity.McsMerchant; @@ -36,4 +40,18 @@ */ int insertOrUpdateBatch(@Param("entities") List<McsMerchant> entities); /** * 根据id查询商家信息 * @param merchantId * @return */ McsMerchantVO getMcsMerchantById(@Param("merchantId") Long merchantId); /** * 分页查询数字商业街商家 * @param page * @param pageMcsMerchantDTO * @return */ IPage<McsMerchantVO> pageMcsMerchant(@Param("page") Page page, @Param("pageMcsMerchantDTO") PageMcsMerchantDTO pageMcsMerchantDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsGame.java
@@ -80,6 +80,10 @@ */ private Integer status; /** * 是否设为热门 */ private Boolean isPopular; /** * 发布时间 */ private Date publishAt; springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsConfigService.java
@@ -1,7 +1,11 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import com.panzhihua.service_community.entity.McsConfig; import java.util.List; /** * (McsConfig)表服务接口 @@ -11,4 +15,16 @@ */ public interface McsConfigService extends IService<McsConfig> { /** * 获取所有数字商业街配置 * @return */ R getAllMcsConfig(); /** * 修改数字商业街配置 * @param configs * @return */ R putMcsConfig(List<McsConfigVO> configs); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsGameService.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.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.service_community.entity.McsGame; /** @@ -11,4 +15,32 @@ */ public interface McsGameService extends IService<McsGame> { /** * 分页查询戳戳游戏 * @param pageMcsGameDTO * @return */ R pageMcsGame(PageMcsGameDTO pageMcsGameDTO); /** * 设为/取消游戏热门 * @param setPopularForGameDTO * @return */ R setPopularForGame(SetPopularForGameDTO setPopularForGameDTO); /** * 上架/下架戳戳游戏 * @param setShelfForGameDTO * @return */ R setShelfForGame(SetShelfForGameDTO setShelfForGameDTO); /** * 删除戳戳游戏 * @param gameId * @param userId * @return */ R deleteMcsGame(Long gameId, Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsInformationService.java
@@ -1,6 +1,9 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; 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.service_community.entity.McsInformation; /** @@ -11,4 +14,25 @@ */ public interface McsInformationService extends IService<McsInformation> { /** * 分页查询戳戳资讯 * @param pageMcsInformationDTO * @return */ R pageMcsInfo(PageMcsInformationDTO pageMcsInformationDTO); /** * 上架/下架戳戳资讯 * @param setShelfForInfoDTO * @return */ R setShelfForMcsInfo(SetShelfForInfoDTO setShelfForInfoDTO); /** * 删除戳戳资讯 * @param infoId * @param userId * @return */ R deleteMcsInfo(Long infoId, Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsMerchantService.java
@@ -1,7 +1,9 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsMerchantDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.entity.McsMerchant; @@ -19,4 +21,40 @@ * @return */ R addMcsMerchant(McsMerchantDTO mcsMerchantDTO); /** * 编辑数字商业街商家 * @param mcsMerchantDTO * @return */ R putMcsMerchant(McsMerchantDTO mcsMerchantDTO); /** * 查询数字商业街商家详情 * @param merchantId * @return */ R getMcsMerchant(Long merchantId); /** * 删除数字商业街商家 * @param merchantId * @param userId * @return */ R deleteMcsMerchant(Long merchantId, Long userId); /** * 分页查询数字商业街商家 * @param pageMcsMerchantDTO * @return */ R pageMcsMerchant(PageMcsMerchantDTO pageMcsMerchantDTO); /** * 禁用/启用数字商业街商家 * @param disableOrEnableMcsMerchantDTO * @return */ R disableOrEnableMcsMerchant(DisableOrEnableMcsMerchantDTO disableOrEnableMcsMerchantDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsConfigServiceImpl.java
@@ -1,10 +1,20 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.nonNull; import java.util.ArrayList; import java.util.List; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import com.panzhihua.service_community.dao.McsConfigDAO; import com.panzhihua.service_community.entity.McsConfig; import com.panzhihua.service_community.service.McsConfigService; import org.springframework.stereotype.Service; /** * (McsConfig)表服务实现类 @@ -15,4 +25,44 @@ @Service("mcsConfigService") public class McsConfigServiceImpl extends ServiceImpl<McsConfigDAO, McsConfig> implements McsConfigService { /** * 获取所有数字商业街配置 * @return */ @Override public R getAllMcsConfig() { List<McsConfig> mcsConfigs = this.baseMapper.selectList(null); List<McsConfigVO> configList = new ArrayList<>(); if (!mcsConfigs.isEmpty()) { mcsConfigs.forEach(e -> { McsConfigVO configVO = new McsConfigVO(); BeanUtils.copyProperties(e, configVO); configList.add(configVO); }); } return R.ok(configList); } /** * 修改数字商业街配置 * @param configs * @return */ @Override public R putMcsConfig(List<McsConfigVO> configs) { if (nonNull(configs) && !configs.isEmpty()) { List<McsConfig> mcsConfigs = new ArrayList<>(); configs.forEach(e -> { McsConfig mcsConfig = this.baseMapper.selectOne(new QueryWrapper<McsConfig>().lambda().eq(McsConfig::getKey, e.getKey())); if (nonNull(mcsConfig)) { mcsConfig.setValue(e.getValue()); mcsConfigs.add(mcsConfig); } }); if (!mcsConfigs.isEmpty()) { this.updateBatchById(mcsConfigs); } } return R.ok(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java
@@ -1,10 +1,20 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; 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.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.entity.McsGame; import com.panzhihua.service_community.service.McsGameService; import org.springframework.stereotype.Service; /** * (McsGame)表服务实现类 @@ -15,4 +25,94 @@ @Service("mcsGameService") public class McsGameServiceImpl extends ServiceImpl<McsGameDAO, McsGame> implements McsGameService { /** * 分页查询戳戳游戏 * @param pageMcsGameDTO * @return */ @Override public R pageMcsGame(PageMcsGameDTO pageMcsGameDTO) { Page page = new Page<>(); page.setSize(pageMcsGameDTO.getPageSize()); page.setCurrent(pageMcsGameDTO.getPageNum()); IPage<McsGameVO> mcsGames = this.baseMapper.pageMcsGame(page, pageMcsGameDTO); return R.ok(mcsGames); } /** * 设为/取消游戏热门 * @param setPopularForGameDTO * @return */ @Override public R setPopularForGame(SetPopularForGameDTO setPopularForGameDTO) { McsGame mcsGame = this.baseMapper.selectById(setPopularForGameDTO.getGameId()); if (isNull(mcsGame)) { return R.fail("修改数据不存在"); } Integer type = setPopularForGameDTO.getType(); if (type.equals(1)) { //设为热门 mcsGame.setIsPopular(true); } else if (type.equals(2)) { //取消热门 mcsGame.setIsPopular(false); } else { return R.fail("未知错误"); } int num = this.baseMapper.updateById(mcsGame); if (num > 0) { return R.ok(); } return R.fail("修改失败,请重新尝试"); } /** * 上架/下架戳戳游戏 * @param setShelfForGameDTO * @return */ @Override public R setShelfForGame(SetShelfForGameDTO setShelfForGameDTO) { McsGame mcsGame = this.baseMapper.selectById(setShelfForGameDTO.getGameId()); if (isNull(mcsGame)) { return R.fail("修改数据不存在"); } Integer type = setShelfForGameDTO.getType(); if (type.equals(1)) { //上架 mcsGame.setStatus(2); } else if (type.equals(2)) { //下架 mcsGame.setStatus(3); } else { return R.fail("未知错误"); } int num = this.baseMapper.updateById(mcsGame); if (num > 0) { return R.ok(); } return R.fail("修改失败,请重新尝试"); } /** * 删除戳戳游戏 * @param gameId * @param userId * @return */ @Override public R deleteMcsGame(Long gameId, Long userId) { McsGame mcsGame = this.baseMapper.selectById(gameId); if (isNull(mcsGame)) { return R.fail("修改数据不存在"); } mcsGame.setIsDel(true); mcsGame.setUpdatedBy(userId); int num = this.baseMapper.updateById(mcsGame); if (num > 0) { return R.ok(); } return R.fail("删除失败,请重新尝试"); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java
@@ -1,10 +1,14 @@ package com.panzhihua.service_community.service.impl; import org.springframework.stereotype.Service; 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.service_community.dao.McsInformationDAO; import com.panzhihua.service_community.entity.McsInformation; import com.panzhihua.service_community.service.McsInformationService; import org.springframework.stereotype.Service; /** * (McsInformation)表服务实现类 @@ -16,4 +20,34 @@ public class McsInformationServiceImpl extends ServiceImpl<McsInformationDAO, McsInformation> implements McsInformationService { /** * 分页查询戳戳资讯 * @param pageMcsInformationDTO * @return */ @Override public R pageMcsInfo(PageMcsInformationDTO pageMcsInformationDTO) { return null; } /** * 上架/下架戳戳资讯 * @param setShelfForInfoDTO * @return */ @Override public R setShelfForMcsInfo(SetShelfForInfoDTO setShelfForInfoDTO) { return null; } /** * 删除戳戳资讯 * @param infoId * @param userId * @return */ @Override public R deleteMcsInfo(Long infoId, Long userId) { return null; } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
@@ -1,24 +1,31 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; import java.util.Arrays; import java.util.Date; import javax.annotation.Resource; import com.panzhihua.common.utlis.DateUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; 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.exceptions.ServiceException; import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsMerchantDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO; import com.panzhihua.common.service.user.UserService; import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.service_community.dao.McsMerchantDAO; import com.panzhihua.service_community.entity.McsMerchant; import com.panzhihua.service_community.service.McsMerchantService; import static java.util.Objects.isNull; /** * (McsMerchant)表服务实现类 @@ -65,4 +72,102 @@ } return R.fail("添加失败"); } /** * 编辑数字商业街商家 * @param mcsMerchantDTO * @return */ @Override @Transactional(rollbackFor = Exception.class) public R putMcsMerchant(McsMerchantDTO mcsMerchantDTO) { McsMerchant mcsMerchant = this.baseMapper.selectById(mcsMerchantDTO.getId()); if (isNull(mcsMerchant)) { return R.fail("商家不存在"); } if (mcsMerchantDTO.getLevel().equals(1)) { Integer litDays = mcsMerchantDTO.getLitDays(); if (isNull(litDays)) { return R.fail("临时商家未设置点亮天数"); } mcsMerchant.setExpireAt(DateUtils.addDay(new Date(), litDays)); } BeanUtils.copyProperties(mcsMerchantDTO, mcsMerchant); int result = this.baseMapper.updateById(mcsMerchant); if (result > 0) { //修改商家绑定账户号 mcsMerchantDTO.setUserId(mcsMerchant.getUserId()); R putResult = userService.putMcsMerchantUser(mcsMerchantDTO); if (!R.isOk(putResult)) { throw new ServiceException("406", putResult.getMsg()); } return R.ok(); } return R.fail("修改失败,请重新尝试"); } /** * 查询数字商业街商家详情 * @param merchantId * @return */ @Override public R getMcsMerchant(Long merchantId) { return R.ok(this.baseMapper.getMcsMerchantById(merchantId)); } /** * 删除数字商业街商家 * @param merchantId * @param userId * @return */ @Override public R deleteMcsMerchant(Long merchantId, Long userId) { McsMerchant mcsMerchant = this.baseMapper.selectById(merchantId); if (isNull(mcsMerchant)) { return R.fail("商家不存在"); } mcsMerchant.setIsDel(true); this.baseMapper.updateById(mcsMerchant); return R.ok(); } /** * 分页查询数字商业街商家 * @param pageMcsMerchantDTO * @return */ @Override public R pageMcsMerchant(PageMcsMerchantDTO pageMcsMerchantDTO) { Page page = new Page<>(); page.setSize(pageMcsMerchantDTO.getPageSize()); page.setCurrent(pageMcsMerchantDTO.getPageNum()); IPage<McsMerchantVO> mcsMerchants = this.baseMapper.pageMcsMerchant(page, pageMcsMerchantDTO); return R.ok(mcsMerchants); } /** * 禁用/启用数字商业街商家 * @param disableOrEnableMcsMerchantDTO * @return */ @Override public R disableOrEnableMcsMerchant(DisableOrEnableMcsMerchantDTO disableOrEnableMcsMerchantDTO) { McsMerchant mcsMerchant = this.baseMapper.selectById(disableOrEnableMcsMerchantDTO.getMerchantId()); if (isNull(mcsMerchant)) { return R.fail("商家不存在"); } Integer type = disableOrEnableMcsMerchantDTO.getType(); if (type.equals(1) || type.equals(2)) { //启用 or 禁用 DisableOrEnableConvenientMerchantDTO dto = new DisableOrEnableConvenientMerchantDTO(); dto.setType(type); dto.setUserIds(Arrays.asList(mcsMerchant.getUserId())); R r = userService.disableOrEnableMerchantUsers(dto); return r; } else { return R.fail("未知错误"); } } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsGameMapper.xml
@@ -19,6 +19,7 @@ <result property="otherImages" column="other_images" jdbcType="VARCHAR"/> <result property="introduction" column="introduction" jdbcType="VARCHAR"/> <result property="status" column="status" jdbcType="INTEGER"/> <result property="isPopular" column="is_popular" jdbcType="VARCHAR"/> <result property="publishAt" column="publish_at" jdbcType="TIMESTAMP"/> <result property="isDel" column="is_del" jdbcType="VARCHAR"/> <result property="merchantId" column="merchant_id" jdbcType="INTEGER"/> @@ -64,6 +65,40 @@ created_at = values(created_at) , created_by = values(created_by) , updated_at = values(updated_at) , updated_by = values(updated_by) </insert> <select id="pageMcsGame" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO"> SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons, t1.publish_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName FROM mcs_game t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.is_del = 0 AND t1.`status` = 2 <if test="pageMcsGameDTO.type != null"> AND t1.`type` = #{pageMcsGameDTO.type} </if> <if test="pageMcsGameDTO.status != null"> AND t1.`status` = #{pageMcsGameDTO.status} </if> <if test="pageMcsGameDTO.keyword != null and pageMcsGameDTO.keyword != """> AND t1.`name` LIKE CONCAT(#{pageMcsGameDTO.keyword}, '%') </if> ORDER BY t1.created_at DESC UNION ALL SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons, t1.publish_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName FROM mcs_game t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.is_del = 0 AND t1.`status` != 2 <if test="pageMcsGameDTO.type != null"> AND t1.`type` = #{pageMcsGameDTO.type} </if> <if test="pageMcsGameDTO.status != null"> AND t1.`status` = #{pageMcsGameDTO.status} </if> <if test="pageMcsGameDTO.keyword != null and pageMcsGameDTO.keyword != """> AND t1.`name` LIKE CONCAT(#{pageMcsGameDTO.keyword}, '%') </if> ORDER BY t1.created_at DESC </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsMerchantMapper.xml
@@ -53,6 +53,33 @@ is_del = values(is_del) , created_at = values(created_at) , created_by = values(created_by) , updated_at = values(updated_at) , updated_by = values(updated_by) </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 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 </select> <select id="pageMcsMerchant" 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 FROM mcs_merchant t1 LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id WHERE t1.is_del = 0 <if test="pageMcsMerchantDTO.accountStatus != null"> AND t2.`status` = #{pageMcsMerchantDTO.accountStatus} </if> <if test="pageMcsMerchantDTO.level != null"> AND t1.`level` = #{pageMcsMerchantDTO.level} </if> <if test="pageMcsMerchantDTO.keyword != null and pageMcsMerchantDTO.keyword != """> AND ( t1.`name` LIKE CONCAT(#{pageMcsMerchantDTO.keyword}, '%') OR t1.phone LIKE CONCAT(#{pageMcsMerchantDTO.keyword}, '%') ) </if> ORDER BY t1.created_at DESC </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
@@ -1247,4 +1247,14 @@ public R addMcsMerchantUser(@RequestBody McsMerchantDTO mcsMerchantDTO) { return userService.addMcsMerchantUser(mcsMerchantDTO); } /** * 微商业街修改商家账号 * @param mcsMerchantDTO * @return */ @PutMapping("putMcsMerchantUser") public R putMcsMerchantUser(@RequestBody McsMerchantDTO mcsMerchantDTO) { return userService.putMcsMerchantUser(mcsMerchantDTO); } } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/UserService.java
@@ -764,4 +764,11 @@ * @return 商家用户id */ R addMcsMerchantUser(McsMerchantDTO mcsMerchantDTO); /** * 微商业街修改商家账号 * @param mcsMerchantDTO * @return */ R putMcsMerchantUser(McsMerchantDTO mcsMerchantDTO); } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -2,6 +2,7 @@ import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.util.ArrayList; import java.util.Date; @@ -13,6 +14,7 @@ import java.util.stream.Collectors; import javax.annotation.Resource; import javax.validation.constraints.NotBlank; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; import org.apache.commons.lang.time.DateFormatUtils; @@ -2834,4 +2836,45 @@ } return R.fail("新增商户发生错误"); } /** * 微商业街修改商家账号 * @param mcsMerchantDTO * @return */ @Override public R putMcsMerchantUser(McsMerchantDTO mcsMerchantDTO) { SysUserDO sysUserDO = userDao.selectById(mcsMerchantDTO.getUserId()); if (isNull(sysUserDO)) { return R.fail("用户不存在"); } String account = mcsMerchantDTO.getAccount(); String phone = mcsMerchantDTO.getPhone(); Integer accountStatus = mcsMerchantDTO.getAccountStatus(); if (isNotBlank(account)) { sysUserDO.setAccount(account); } if (isNotBlank(phone)) { sysUserDO.setPhone(phone); } if (nonNull(accountStatus)) { sysUserDO.setStatus(accountStatus); } try { userDao.updateById(sysUserDO); } catch (Exception e) { e.printStackTrace(); log.error("修改数字商业街商家用户报错【{}】", e.getMessage()); if (e.getMessage().contains("union_phone_type")) { return R.fail("手机号已存在"); } else if (e.getMessage().contains("union_account_type")) { return R.fail("账户已经存在"); }else if(e.getMessage().contains("23000")){ return R.fail("手机号已存在"); } else { return R.fail("账户或手机号已存在,请重新填写尝试"); } } return R.ok(); } }