springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/ComPropertyPublicityApi.java
New file @@ -0,0 +1,77 @@ package com.panzhihua.applets.api; import javax.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.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.PageComPropertyPublicityDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngVillageVO; import com.panzhihua.common.model.vos.community.ComPropertyPublicityVO; import com.panzhihua.common.service.community.CommunityService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; /** * @title: ComPropertyPublicityApi * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 物业宣传相关接口 * @author: hans * @date: 2021/11/11 10:08 */ @Slf4j @Api(tags = {"物业宣传相关接口"}) @RestController @RequestMapping("/property/publicity") public class ComPropertyPublicityApi extends BaseController { @Resource private CommunityService communityService; @ApiOperation(value = "分页物业宣传信息", response = ComPropertyPublicityVO.class) @PostMapping("/page") public R pageComPropertyPublicity(@RequestBody PageComPropertyPublicityDTO pageComPropertyPublicityDTO) { if (isNull(pageComPropertyPublicityDTO.getCommunityId())) { return R.fail("社区id不能为空"); } LoginUserInfoVO loginUserInfoSureNoLogin = getLoginUserInfoSureNoLogin(); if (nonNull(loginUserInfoSureNoLogin)) { pageComPropertyPublicityDTO.setCommunityId(loginUserInfoSureNoLogin.getCommunityId()); } return communityService.pageComPropertyPublicityApplet(pageComPropertyPublicityDTO); } @ApiOperation(value = "查看物业宣传信息", response = ComPropertyPublicityVO.class) @GetMapping("/get") @ApiImplicitParam(name = "id", value = "物业宣传id", required = true) public R getComPropertyPublicity(@RequestParam("id") Long id) { return communityService.getComPropertyPublicity(id); } @ApiOperation(value = "小区列表", response = ComMngVillageVO.class) @GetMapping("/list/village") @ApiImplicitParam(name = "communityId", value = "社区id", required = true) public R listVillage(@RequestParam(value = "communityId") Long communityId) { return communityService.listVillage(null, communityId); } @ApiOperation(value = "增加物业宣传浏览量") @GetMapping("/incr-view") @ApiImplicitParam(name = "id", value = "物业宣传id", required = true) public R incrPropertyPublicityView(@RequestParam("id") Long id) { return communityService.incrPropertyPublicityView(id); } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/ComPropertyPublicityDTO.java
New file @@ -0,0 +1,61 @@ package com.panzhihua.common.model.dtos.community; 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: ComPropertyPublicityDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 新增/编辑物业宣传 * @author: hans * @date: 2021/11/11 10:55 */ @Data @ApiModel("新增/编辑物业宣传") public class ComPropertyPublicityDTO { @ApiModelProperty("物业宣传id") @NotNull(groups = PutGroup.class, message = "物业宣传id不能为空") private Long id; @ApiModelProperty("宣传标题") @NotBlank(groups = AddGroup.class, message = "宣传标题不能为空") private String title; @ApiModelProperty("宣传类型(0.其他 1.停水通知 2.停电通知 3.停气通知 4.物业公告 5.优秀业主)") @NotNull(groups = AddGroup.class, message = "宣传类型不能为空") private Integer publicityType; @ApiModelProperty("其他类型自定义名称") private String other; @ApiModelProperty("封面") @NotBlank(groups = AddGroup.class, message = "封面不能为空") private String cover; @ApiModelProperty("内容形式(1.文章链接 2.自定义内容)") @NotNull(groups = AddGroup.class, message = "内容形式不能为空") private Integer contentType; @ApiModelProperty("文章链接") private String articleUrl; @ApiModelProperty("自定义内容") private String diyContent; @ApiModelProperty(value = "物业公司id", hidden = true) private Long propertyId; @ApiModelProperty(value = "社区id", hidden = true) private Long communityId; @ApiModelProperty(value = "用户id", hidden = true) private Long userId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/PageComPropertyPublicityDTO.java
New file @@ -0,0 +1,48 @@ package com.panzhihua.common.model.dtos.community; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: PageComPropertyPublicityDTO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 分页查询物业宣传信息请求参数 * @author: hans * @date: 2021/11/11 10:32 */ @Data @ApiModel("分页查询物业宣传信息请求参数") public class PageComPropertyPublicityDTO { @ApiModelProperty("关键词") private String keyword; @ApiModelProperty("物业公司id") private Long propertyId; @ApiModelProperty("小区id") private Long villageId; @ApiModelProperty("宣传类型(0.其他 1.停水通知 2.停电通知 3.停气通知 4.物业公告 5.优秀业主)") private Integer publicityType; @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") private Long communityId; @ApiModelProperty(value = "用户id", hidden = true) private Long userId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComPropertyPublicityVO.java
New file @@ -0,0 +1,68 @@ package com.panzhihua.common.model.vos.community; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: ComPropertyPublicityVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 物业宣传信息 * @author: hans * @date: 2021/11/11 10:15 */ @Data @ApiModel("物业宣传信息") public class ComPropertyPublicityVO { @ApiModelProperty("物业宣传id") private Long id; @ApiModelProperty("宣传标题") private String title; @ApiModelProperty("宣传类型(0.其他 1.停水通知 2.停电通知 3.停气通知 4.物业公告 5.优秀业主)") private String publicityType; @ApiModelProperty("其他类型自定义名称") private String other; @ApiModelProperty("封面") private String cover; @ApiModelProperty("内容形式(1.文章链接 2.自定义内容)") private String contentType; @ApiModelProperty("文章链接") private String articleUrl; @ApiModelProperty("自定义内容") private String diyContent; @ApiModelProperty("物业公司id") private Long propertyId; @ApiModelProperty("物业公司名称") private String propertyName; @ApiModelProperty("所属小区") private String villageName; @ApiModelProperty("社区id") private Long communityId; @ApiModelProperty("浏览量") private Integer viewNum; @ApiModelProperty("发布时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createdAt; @ApiModelProperty("更新时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updatedAt; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -7200,4 +7200,79 @@ */ @PostMapping("/reserve/admin/register/homeQuarantine/page") R pageRegisterHomeQuarantine(PageReserveRegisterDetailedAdminDTO detailedAdminDTO); /** * 分页查询物业宣传 * @param pageComPropertyPublicityDTO * @return */ @PostMapping("/property/publicity/page") R pageComPropertyPublicity(@RequestBody PageComPropertyPublicityDTO pageComPropertyPublicityDTO); /** * 新增物业宣传 * @param comPropertyPublicityDTO * @return */ @PostMapping("/property/publicity/add") R addComPropertyPublicity(@RequestBody ComPropertyPublicityDTO comPropertyPublicityDTO); /** * 修改物业宣传 * @param comPropertyPublicityDTO * @return */ @PostMapping("/property/publicity/update") R updateComPropertyPublicity(@RequestBody ComPropertyPublicityDTO comPropertyPublicityDTO); /** * 查看物业宣传信息 * @param id * @return */ @GetMapping("/property/publicity/get") R getComPropertyPublicity(@RequestParam("id") Long id); /** * 删除物业宣传 * @param id * @return */ @DeleteMapping("/property/publicity/delete") R deleteComPropertyPublicity(@RequestParam("id") Long id); /** * 物业公司列表 * * @param villageId * @param communityId * @return */ @GetMapping("/property/publicity/list/property") R listProperty(@RequestParam(value = "villageId", required = false) Long villageId, @RequestParam("communityId") Long communityId); /** * 小区列表 * @param propertyId * @param communityId * @return */ @GetMapping("/property/publicity/list/village") R listVillage(@RequestParam(value = "propertyId",required = false) Long propertyId, @RequestParam("communityId") Long communityId); /** * 分页查询物业宣传-小程序 * @param pageComPropertyPublicityDTO * @return */ @PostMapping("/property/publicity/page/applet") R pageComPropertyPublicityApplet(@RequestBody PageComPropertyPublicityDTO pageComPropertyPublicityDTO); /** * 增加物业宣传浏览量 * @param id * @return */ @GetMapping("/property/publicity/incr-view") R incrPropertyPublicityView(@RequestParam("id") Long id); } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComPropertyPublicityApi.java
New file @@ -0,0 +1,101 @@ package com.panzhihua.community_backstage.api; import javax.annotation.Resource; 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.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.ComPropertyPublicityDTO; import com.panzhihua.common.model.dtos.community.PageComPropertyPublicityDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngVillageVO; import com.panzhihua.common.model.vos.community.ComPropertyPublicityVO; import com.panzhihua.common.model.vos.community.ComPropertyVO; 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; import lombok.extern.slf4j.Slf4j; /** * @title: ComPropertyPublicityApi * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 物业宣传相关接口 * @author: hans * @date: 2021/11/11 10:08 */ @Slf4j @Api(tags = {"物业宣传相关接口"}) @RestController @RequestMapping("/property/publicity") public class ComPropertyPublicityApi extends BaseController { @Resource private CommunityService communityService; @ApiOperation(value = "分页物业宣传信息", response = ComPropertyPublicityVO.class) @PostMapping("/page") public R pageComPropertyPublicity(@RequestBody PageComPropertyPublicityDTO pageComPropertyPublicityDTO) { LoginUserInfoVO loginUserInfo = getLoginUserInfo(); pageComPropertyPublicityDTO.setCommunityId(loginUserInfo.getCommunityId()); pageComPropertyPublicityDTO.setUserId(loginUserInfo.getUserId()); return communityService.pageComPropertyPublicity(pageComPropertyPublicityDTO); } @ApiOperation(value = "新增物业宣传") @PostMapping("/add") public R addComPropertyPublicity(@RequestBody @Validated(AddGroup.class) ComPropertyPublicityDTO comPropertyPublicityDTO) { LoginUserInfoVO loginUserInfo = getLoginUserInfo(); comPropertyPublicityDTO.setCommunityId(loginUserInfo.getCommunityId()); comPropertyPublicityDTO.setUserId(loginUserInfo.getUserId()); return communityService.addComPropertyPublicity(comPropertyPublicityDTO); } @ApiOperation(value = "修改物业宣传") @PostMapping("/update") public R updateComPropertyPublicity(@RequestBody @Validated(PutGroup.class) ComPropertyPublicityDTO comPropertyPublicityDTO) { LoginUserInfoVO loginUserInfo = getLoginUserInfo(); comPropertyPublicityDTO.setCommunityId(loginUserInfo.getCommunityId()); comPropertyPublicityDTO.setUserId(loginUserInfo.getUserId()); return communityService.updateComPropertyPublicity(comPropertyPublicityDTO); } @ApiOperation(value = "查看物业宣传信息", response = ComPropertyPublicityVO.class) @GetMapping("/get") @ApiImplicitParam(name = "id", value = "物业宣传id", required = true) public R getComPropertyPublicity(@RequestParam("id") Long id) { return communityService.getComPropertyPublicity(id); } @ApiOperation(value = "删除物业宣传") @DeleteMapping("/delete") @ApiImplicitParam(name = "id", value = "物业宣传id", required = true) public R deleteComPropertyPublicity(@RequestParam("id") Long id) { return communityService.deleteComPropertyPublicity(id); } @ApiOperation(value = "物业公司列表",response = ComPropertyVO.class) @GetMapping("/list/property") @ApiImplicitParam(name = "villageId", value = "小区id", required = false) public R listProperty(@RequestParam(value = "villageId", required = false) Long villageId) { return communityService.listProperty(villageId, getCommunityId()); } @ApiOperation(value = "小区列表", response = ComMngVillageVO.class) @GetMapping("/list/village") @ApiImplicitParam(name = "propertyId", value = "物业公司id", required = false) public R listVillage(@RequestParam(value = "propertyId",required = false) Long propertyId) { return communityService.listVillage(propertyId, getCommunityId()); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComPropertyPublicityApi.java
New file @@ -0,0 +1,125 @@ package com.panzhihua.service_community.api; import com.panzhihua.common.model.dtos.community.ComPropertyPublicityDTO; import com.panzhihua.common.model.dtos.community.PageComPropertyPublicityDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.service.ComPropertyPublicityService; 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.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import lombok.extern.slf4j.Slf4j; import javax.annotation.Resource; /** * @title: ComPropertyPublicityApi * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 物业宣传相关接口 * @author: hans * @date: 2021/11/11 10:08 */ @Slf4j @RestController @RequestMapping("/property/publicity") public class ComPropertyPublicityApi { @Resource private ComPropertyPublicityService comPropertyPublicityService; /** * 分页查询物业宣传 * @param pageComPropertyPublicityDTO * @return */ @PostMapping("/page") public R pageComPropertyPublicity(@RequestBody PageComPropertyPublicityDTO pageComPropertyPublicityDTO) { return comPropertyPublicityService.pageComPropertyPublicity(pageComPropertyPublicityDTO); } /** * 新增物业宣传 * @param comPropertyPublicityDTO * @return */ @PostMapping("/add") public R addComPropertyPublicity(@RequestBody ComPropertyPublicityDTO comPropertyPublicityDTO){ return comPropertyPublicityService.addComPropertyPublicity(comPropertyPublicityDTO); } /** * 修改物业宣传 * @param comPropertyPublicityDTO * @return */ @PostMapping("/update") public R updateComPropertyPublicity(@RequestBody ComPropertyPublicityDTO comPropertyPublicityDTO) { return comPropertyPublicityService.updateComPropertyPublicity(comPropertyPublicityDTO); } /** * 查看物业宣传信息 * @param id * @return */ @GetMapping("/get") public R getComPropertyPublicity(@RequestParam("id") Long id) { return comPropertyPublicityService.getComPropertyPublicity(id); } /** * 删除物业宣传 * @param id * @return */ @DeleteMapping("/delete") public R deleteComPropertyPublicity(@RequestParam("id") Long id) { return comPropertyPublicityService.deleteComPropertyPublicity(id); } /** * 物业公司列表 * @param communityId * @return */ @GetMapping("/list/property") public R listProperty(@RequestParam(value = "villageId", required = false) Long villageId, @RequestParam("communityId") Long communityId) { return comPropertyPublicityService.listProperty(villageId, communityId); } /** * 小区列表 * @param propertyId * @param communityId * @return */ @GetMapping("/list/village") public R listVillage(@RequestParam(value = "propertyId",required = false) Long propertyId, @RequestParam("communityId") Long communityId) { return comPropertyPublicityService.listVillage(propertyId, communityId); } /** * 分页查询物业宣传-小程序 * @param pageComPropertyPublicityDTO * @return */ @PostMapping("/page/applet") public R pageComPropertyPublicityApplet(@RequestBody PageComPropertyPublicityDTO pageComPropertyPublicityDTO) { return comPropertyPublicityService.pageComPropertyPublicityApplet(pageComPropertyPublicityDTO); } /** * 增加物业宣传浏览量 * @param id * @return */ @GetMapping("/incr-view") public R incrPropertyPublicityView(@RequestParam("id") Long id) { return comPropertyPublicityService.incrView(id); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComPropertyPublicityDAO.java
New file @@ -0,0 +1,58 @@ package com.panzhihua.service_community.dao; 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.PageComPropertyPublicityDTO; import com.panzhihua.common.model.vos.community.ComPropertyPublicityVO; import com.panzhihua.service_community.model.dos.ComPropertyPublicityDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @title: ComPropertyPublicityDAO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 物业宣传mapper * @author: hans * @date: 2021/11/11 13:58 */ @Mapper public interface ComPropertyPublicityDAO extends BaseMapper<ComPropertyPublicityDO> { /** * 获取用户菜单权限 * @param userId * @return */ List<String> retrieveUserMenuList(@Param("userId") Long userId); /** * 分页查询物业宣传 * @param pageComPropertyPublicityDTO * @return */ IPage<ComPropertyPublicityVO> pageComPropertyPublicity(@Param("page") Page page, @Param("pageComPropertyPublicityDTO") PageComPropertyPublicityDTO pageComPropertyPublicityDTO); /** * 获取物业宣传详情 * @param id * @return */ ComPropertyPublicityVO selectDetail(@Param("id") Long id); /** * 分页查询物业宣传-小程序 * @param pageComPropertyPublicityDTO * @return */ IPage<ComPropertyPublicityVO> pageComPropertyPublicityApplet(@Param("page") Page page, @Param("pageComPropertyPublicityDTO") PageComPropertyPublicityDTO pageComPropertyPublicityDTO); /** * 增加物业宣传浏览量 * @param id * @return */ int incrView(@Param("id") Long id); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComPropertyPublicityDO.java
New file @@ -0,0 +1,90 @@ package com.panzhihua.service_community.model.dos; import java.io.Serializable; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * @title: ComPropertyPublicityDO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 物业宣传实体类 * @author: hans * @date: 2021/11/11 13:55 */ @Data @TableName(value = "com_property_publicity") public class ComPropertyPublicityDO implements Serializable { private static final long serialVersionUID = 1L; /** * 主键id */ @TableId(type = IdType.AUTO) private Long id; /** * 宣传标题 */ private String title; /** * 宣传类型(0.其他 1.停水通知 2.停电通知 3.停气通知 4.物业公告 5.优秀业主 */ private String publicityType; /** * 其他类型自定义名称 */ private String other; /** * 封面 */ private String cover; /** * 内容形式(1.文章链接 2.自定义内容) */ private String contentType; /** * 文章链接 */ private String articleUrl; /** * 自定义内容 */ private String diyContent; /** * 物业公司id */ private Long propertyId; /** * 社区id */ private Long communityId; /** * 浏览量 */ private Integer viewNum; /** * 发布时间 */ private Date createdAt; /** * 更新时间 */ private Date updatedAt; } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComPropertyPublicityService.java
New file @@ -0,0 +1,83 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.dtos.community.ComPropertyPublicityDTO; import com.panzhihua.common.model.dtos.community.PageComPropertyPublicityDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.model.dos.ComPropertyPublicityDO; /** * @title: ComPropertyPublicityService * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 物业宣传服务类 * @author: hans * @date: 2021/11/11 13:56 */ public interface ComPropertyPublicityService extends IService<ComPropertyPublicityDO> { /** * 分页查询物业宣传 * @param pageComPropertyPublicityDTO * @return */ R pageComPropertyPublicity(PageComPropertyPublicityDTO pageComPropertyPublicityDTO); /** * 新增物业宣传 * @param comPropertyPublicityDTO * @return */ R addComPropertyPublicity(ComPropertyPublicityDTO comPropertyPublicityDTO); /** * 修改物业宣传 * @param comPropertyPublicityDTO * @return */ R updateComPropertyPublicity(ComPropertyPublicityDTO comPropertyPublicityDTO); /** * 查看物业宣传信息 * @param id * @return */ R getComPropertyPublicity(Long id); /** * 删除物业宣传 * @param id * @return */ R deleteComPropertyPublicity(Long id); /** * 物业公司列表 * * @param villageId * @param communityId * @return */ R listProperty(Long villageId, Long communityId); /** * 小区列表 * @param propertyId * @param communityId * @return */ R listVillage(Long propertyId, Long communityId); /** * 分页查询物业宣传-小程序 * @param pageComPropertyPublicityDTO * @return */ R pageComPropertyPublicityApplet(PageComPropertyPublicityDTO pageComPropertyPublicityDTO); /** * 增加物业宣传浏览量 * @param id * @return */ R incrView(Long id); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPropertyPublicityServiceImpl.java
New file @@ -0,0 +1,217 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.dtos.community.ComPropertyPublicityDTO; import com.panzhihua.common.model.dtos.community.PageComPropertyPublicityDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngStructAreaVO; import com.panzhihua.service_community.dao.ComMngStructAreaDAO; import com.panzhihua.service_community.dao.ComPropertyDao; import com.panzhihua.service_community.dao.ComPropertyPublicityDAO; import com.panzhihua.service_community.entity.ComProperty; import com.panzhihua.service_community.model.dos.ComMngStructAreaDO; import com.panzhihua.service_community.model.dos.ComPropertyPublicityDO; import com.panzhihua.service_community.service.ComPropertyPublicityService; import lombok.extern.slf4j.Slf4j; /** * @title: ComPropertyPublicityServiceImpl * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 物业宣传服务实现类 * @author: hans * @date: 2021/11/11 13:57 */ @Service @Slf4j public class ComPropertyPublicityServiceImpl extends ServiceImpl<ComPropertyPublicityDAO, ComPropertyPublicityDO> implements ComPropertyPublicityService { @Resource private ComPropertyDao comPropertyDao; @Resource private ComMngStructAreaDAO comMngStructAreaDAO; /** * 分页查询物业宣传 * @param pageComPropertyPublicityDTO * @return */ @Override public R pageComPropertyPublicity(PageComPropertyPublicityDTO pageComPropertyPublicityDTO) { Long userId = pageComPropertyPublicityDTO.getUserId(); ComProperty comProperty = comPropertyDao.selectOne(new QueryWrapper<ComProperty>().lambda().eq(ComProperty::getUserId, userId)); if (nonNull(comProperty)) { //用户为物业 pageComPropertyPublicityDTO.setPropertyId(comProperty.getId()); pageComPropertyPublicityDTO.setVillageId(comProperty.getAreaId()); } else { //非物业用户查看是否拥有菜单权限 List<String> menuList = this.baseMapper.retrieveUserMenuList(userId); if (menuList.isEmpty() || !menuList.contains("物业宣传")) { return R.fail("暂无权限"); } } Page page = new Page<>(); page.setSize(pageComPropertyPublicityDTO.getPageSize()); page.setCurrent(pageComPropertyPublicityDTO.getPageNum()); return R.ok(this.baseMapper.pageComPropertyPublicity(page, pageComPropertyPublicityDTO)); } /** * 新增物业宣传 * @param comPropertyPublicityDTO * @return */ @Override public R addComPropertyPublicity(ComPropertyPublicityDTO comPropertyPublicityDTO) { Long userId = comPropertyPublicityDTO.getUserId(); ComProperty comProperty = comPropertyDao.selectOne(new QueryWrapper<ComProperty>().lambda().eq(ComProperty::getUserId, userId)); if (isNull(comProperty)) { return R.fail("暂无权限"); } comPropertyPublicityDTO.setPropertyId(comProperty.getId()); ComPropertyPublicityDO publicityDO = new ComPropertyPublicityDO(); BeanUtils.copyProperties(comPropertyPublicityDTO, publicityDO); Date nowDate = new Date(); publicityDO.setCreatedAt(nowDate); publicityDO.setUpdatedAt(nowDate); int result = this.baseMapper.insert(publicityDO); if (result > 0) { return R.ok(); } return R.fail("添加失败"); } /** * 修改物业宣传 * @param comPropertyPublicityDTO * @return */ @Override public R updateComPropertyPublicity(ComPropertyPublicityDTO comPropertyPublicityDTO) { ComPropertyPublicityDO comPropertyPublicityDO = this.baseMapper.selectById(comPropertyPublicityDTO.getId()); if (isNull(comPropertyPublicityDO)) { return R.fail("信息不存在"); } Long userId = comPropertyPublicityDTO.getUserId(); ComProperty comProperty = comPropertyDao.selectOne(new QueryWrapper<ComProperty>().lambda().eq(ComProperty::getUserId, userId)); if (isNull(comProperty) || !comProperty.getId().equals(comPropertyPublicityDO.getPropertyId())) { return R.fail("暂无权限"); } BeanUtils.copyProperties(comPropertyPublicityDTO, comPropertyPublicityDO); comPropertyPublicityDO.setUpdatedAt(new Date()); int result = this.baseMapper.updateById(comPropertyPublicityDO); if (result > 0) { return R.ok(); } return R.fail("修改失败"); } /** * 查看物业宣传信息 * @param id * @return */ @Override public R getComPropertyPublicity(Long id) { return R.ok(this.baseMapper.selectDetail(id)); } /** * 删除物业宣传 * @param id * @return */ @Override public R deleteComPropertyPublicity(Long id) { this.baseMapper.deleteById(id); return R.ok(); } /** * 物业公司列表 * * @param villageId * @param communityId * @return */ @Override public R listProperty(Long villageId, Long communityId) { List<ComProperty> propertyList; if (nonNull(villageId)) { propertyList = comPropertyDao.selectList(new QueryWrapper<ComProperty>().lambda() .eq(ComProperty::getCommunityId, communityId).eq(ComProperty::getAreaId, villageId)); } else { propertyList = comPropertyDao.selectList(new QueryWrapper<ComProperty>().lambda().eq(ComProperty::getCommunityId, communityId)); } return R.ok(propertyList); } /** * 小区列表 * @param propertyId * @param communityId * @return */ @Override public R listVillage(Long propertyId, Long communityId) { List<ComMngStructAreaVO> comMngStructAreaVOS = new ArrayList<>(); List<ComMngStructAreaDO> comMngStructAreaDOS; if (nonNull(propertyId)) { ComProperty comProperty = comPropertyDao.selectById(propertyId); comMngStructAreaDOS = comMngStructAreaDAO.selectList( new QueryWrapper<ComMngStructAreaDO>().lambda().eq(ComMngStructAreaDO::getId, comProperty.getAreaId())); } else { comMngStructAreaDOS = comMngStructAreaDAO.selectList( new QueryWrapper<ComMngStructAreaDO>().lambda().eq(ComMngStructAreaDO::getCommunityId, communityId)); } if (!ObjectUtils.isEmpty(comMngStructAreaDOS)) { comMngStructAreaDOS.forEach(comMngStructAreaDO -> { ComMngStructAreaVO comMngStructAreaVO = new ComMngStructAreaVO(); BeanUtils.copyProperties(comMngStructAreaDO, comMngStructAreaVO); comMngStructAreaVOS.add(comMngStructAreaVO); }); } return R.ok(comMngStructAreaVOS); } /** * 分页查询物业宣传-小程序 * @param pageComPropertyPublicityDTO * @return */ @Override public R pageComPropertyPublicityApplet(PageComPropertyPublicityDTO pageComPropertyPublicityDTO) { Page page = new Page<>(); page.setSize(pageComPropertyPublicityDTO.getPageSize()); page.setCurrent(pageComPropertyPublicityDTO.getPageNum()); return R.ok(this.baseMapper.pageComPropertyPublicityApplet(page, pageComPropertyPublicityDTO)); } /** * 增加物业宣传浏览量 * @param id * @return */ @Override public R incrView(Long id) { this.baseMapper.incrView(id); return R.ok(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPropertyPublicityMapper.xml
New file @@ -0,0 +1,69 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.panzhihua.service_community.dao.ComPropertyPublicityDAO"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComPropertyPublicityDO"> <id column="id" property="id" /> <id column="title" property="title" /> <id column="publicity_type" property="publicityType" /> <id column="other" property="other" /> <id column="cover" property="cover" /> <id column="content_type" property="contentType" /> <id column="article_url" property="articleUrl" /> <id column="diy_content" property="diyContent" /> <id column="property_id" property="propertyId" /> <id column="community_id" property="communityId" /> <id column="view_num" property="viewNum" /> <id column="created_at" property="createdAt" /> <id column="updated_at" property="updatedAt" /> </resultMap> <update id="incrView"> UPDATE com_property_publicity SET view_num = view_num + 1 WHERE id = #{id} </update> <select id="retrieveUserMenuList" resultType="java.lang.String"> SELECT m.menu_name FROM sys_user u INNER JOIN sys_user_role ur ON u.user_id = ur.user_id LEFT JOIN sys_role r ON ur.role_id = r.role_id LEFT JOIN sys_role_menu rm ON r.role_id = rm.role_id LEFT JOIN sys_menu m ON rm.menu_id = m.menu_id WHERE u.user_id = #{userId} </select> <select id="pageComPropertyPublicity" resultType="com.panzhihua.common.model.vos.community.ComPropertyPublicityVO"> SELECT pp.*, p.`name` AS propertyName, v.`name` AS villageName FROM com_property_publicity pp INNER JOIN com_property p ON pp.property_id = p.id LEFT JOIN com_mng_village v ON p.area_id = v.village_id WHERE pp.community_id = #{pageComPropertyPublicityDTO.communityId} <if test="pageComPropertyPublicityDTO.propertyId != null"> AND pp.property_id = #{pageComPropertyPublicityDTO.propertyId} </if> <if test="pageComPropertyPublicityDTO.villageId != null"> AND p.area_id = #{pageComPropertyPublicityDTO.villageId} </if> <if test="pageComPropertyPublicityDTO.publicityType != null"> AND pp.publicity_type = #{pageComPropertyPublicityDTO.publicityType} </if> <if test="pageComPropertyPublicityDTO.keyword != null and pageComPropertyPublicityDTO.keyword != """> AND pp.title LIKE CONCAT(#{pageComPropertyPublicityDTO.keyword}, '%') </if> </select> <select id="selectDetail" resultType="com.panzhihua.common.model.vos.community.ComPropertyPublicityVO"> SELECT pp.*, p.`name` AS propertyName, v.`name` AS villageName FROM com_property_publicity pp INNER JOIN com_property p ON pp.property_id = p.id LEFT JOIN com_mng_village v ON p.area_id = v.village_id WHERE pp.id = #{id} </select> <select id="pageComPropertyPublicityApplet" resultType="com.panzhihua.common.model.vos.community.ComPropertyPublicityVO"> SELECT pp.*, p.`name` AS propertyName, v.`name` AS villageName FROM com_property_publicity pp INNER JOIN com_property p ON pp.property_id = p.id LEFT JOIN com_mng_village v ON p.area_id = v.village_id WHERE pp.community_id = #{pageComPropertyPublicityDTO.communityId} <if test="pageComPropertyPublicityDTO.villageId != null"> AND p.area_id = #{pageComPropertyPublicityDTO.villageId} </if> </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java
@@ -263,6 +263,10 @@ noLoginUrl.add("/api/shopbackstage/convenient/upload/file"); noLoginUrl.add("/api/applets/warehouse/donates/page"); noLoginUrl.add("/api/applets/warehouse/donates/get"); noLoginUrl.add("/api/applets/property/publicity/page"); noLoginUrl.add("/api/applets/property/publicity/get"); noLoginUrl.add("/api/applets/property/publicity/list/village"); noLoginUrl.add("/api/applets/property/publicity/incr-view"); if (noLoginUrl.contains(requestURI)) { List<SimpleGrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS));