huanghongfa
2021-07-30 74c6540767e23913daaa69f0c6db6c454af33638
积分模块接口开发
7个文件已修改
38个文件已添加
3043 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/ComActIntegralUserApi.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/Constants.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/ComActIntegralCommunityRankDTO.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/ComActIntegralCountDTO.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/admin/AddComActIntegralUserDTO.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/admin/EditComActIntegralRuleDTO.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/admin/PageComActIntegralRuleDTO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/admin/PageComActIntegralTradeDTO.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralCommunityRankVO.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralCommunityTradeVO.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralUserListVO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralUserRuleVO.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralUserVO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/IntegralUserRankVO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/admin/ComActIntegralUserRuleAdminVO.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/admin/ComActIntegralUserTradeAdminVO.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/admin/IntegralUserVO.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActIntegralUserApi.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComActIntegralUserApi.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActIntegralRuleMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActIntegralUserChangeMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActIntegralUserMapper.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActIntegralUserTradeMapper.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActUserWalletMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActIntegralRuleDO.java 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActIntegralUserChangeDO.java 210 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActIntegralUserDO.java 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActIntegralUserTradeDO.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActIntegralRuleService.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActIntegralUserChangeService.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActIntegralUserService.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActIntegralUserTradeService.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralRuleServiceImpl.java 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserChangeServiceImpl.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserServiceImpl.java 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserTradeServiceImpl.java 342 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActUserWalletServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActIntegralRuleDOMapper.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActIntegralUserChangeDOMapper.xml 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActIntegralUserDOMapper.xml 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActIntegralUserTradeDOMapper.xml 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActUserWalletDOMapper.xml 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/ComActIntegralUserApi.java
New file
@@ -0,0 +1,81 @@
package com.panzhihua.applets.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.dtos.community.wallet.PageComActWalletTradeDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityRankVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityTradeVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserVO;
import com.panzhihua.common.model.vos.community.wallet.ComActWalletRankingVO;
import com.panzhihua.common.service.community.CommunityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@Slf4j
@RestController
@RequestMapping("/integral/")
@Api(tags = {"用户积分模块"})
public class ComActIntegralUserApi extends BaseController {
    @Resource
    private CommunityService communityService;
    @ApiOperation(value = "查询积分说明")
    @GetMapping("/explain")
    public R getIntegralExplain() {
        return communityService.getIntegralExplainApplets();
    }
    @ApiOperation(value = "查询社区领取积分列表",response = ComActIntegralUserRuleVO.class)
    @PostMapping("/receive")
    public R getIntegralReceive() {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if(userInfoVO == null){
            return R.fail("请先登录");
        }
        return communityService.getIntegralReceiveApplets(userInfoVO.getUserId(),userInfoVO.getCommunityId());
    }
    @ApiOperation(value = "查询我的积分列表",response = ComActIntegralUserVO.class)
    @PostMapping("/user/list")
    public R getIntegralUserList() {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if(userInfoVO == null){
            return R.fail("请先登录");
        }
        return communityService.getIntegralUserListApplets(userInfoVO.getUserId(),userInfoVO.getCommunityId());
    }
    @ApiOperation(value = "查询社区积分排行榜",response = ComActIntegralCommunityRankVO.class)
    @PostMapping("/community/rank")
    public R getIntegralCommunityRank(@RequestBody ComActIntegralCommunityRankDTO communityRankDTO) {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if(userInfoVO == null){
            return R.fail("请先登录");
        }
        if(communityRankDTO.getCommunityId() == null){
            communityRankDTO.setCommunityId(userInfoVO.getCommunityId());
        }
        return communityService.getIntegralCommunityRankApplets(communityRankDTO);
    }
    @ApiOperation(value = "查询用户积分明细",response = ComActIntegralCommunityTradeVO.class)
    @PostMapping("/community/trade")
    public R getIntegralCommunityTrade(@RequestBody ComActIntegralCommunityRankDTO communityTradeDTO) {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if(userInfoVO == null){
            return R.fail("请先登录");
        }
        communityTradeDTO.setCommunityId(userInfoVO.getCommunityId());
        communityTradeDTO.setUserId(userInfoVO.getUserId());
        return communityService.getIntegralCommunityTradeApplets(communityTradeDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/Constants.java
@@ -148,4 +148,6 @@
    public static final String ZZ_APP_TAG_LIST = "{\"list\":[\"流动人口\",\"户籍人口\",\"社区矫正\",\"吸毒人员\",\"重精患者\",\"刑满释放\"]}";
    public static final String PROFIT_EXPLAIN = "<p>一、简介</p><p>活动期间内,居民发布随手拍内容可获得一定现金奖励,具体奖励金额以社区设置为准,最终由对应社区统一结算。</p><p>二、如何使用</p><p>居民获得收益后由对应社区结算,具体结算方式由社区根据实际情况进行处理。</p><p>三、如何获得</p><p>1.参与活动</p><p>活动期间内,用户可以在西区社区通“随手拍”板块,用照片和视频记录展示社区生活;</p><p>活动由所在社区添加管理,社区发布活动后居民可进行参与。</p><p>2.&nbsp;社区审核</p><p>社区通过对用户发布内容的质量(优质、精良、普通内容)和价值进行审核,酌情对相关用户进行奖励;</p><p>3.&nbsp;获得奖励</p><p>审核完成后,根据社区设置的内容质量奖励金额下发奖励。</p><p>若内容被工作人员驳回将不可获得奖励。</p><p>&nbsp;</p><p><br></p>";
    public static final String INTEGRAL_EXPLAIN = "积分说明";
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/ComActIntegralCommunityRankDTO.java
New file
@@ -0,0 +1,48 @@
package com.panzhihua.common.model.dtos.community.integral;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("查询社区积分排行榜请求参数")
public class ComActIntegralCommunityRankDTO {
    @ApiModelProperty(value = "社区id")
    private Long communityId;
    @ApiModelProperty(value = "用户id",hidden = true)
    private Long userId;
    @ApiModelProperty(value = "交易身份类型(1.居民 2.党员 3.志愿者)",hidden = true)
    private Integer identityType;
    @ApiModelProperty("身份类型(1.全部 2.居民 3.志愿者 4.党员)")
    private Integer type = 1;
    @ApiModelProperty(value = "分页-当前页数",example = "1")
    private Long pageNum = 1L;
    @ApiModelProperty(value = "分页-每页记录数",example = "10")
    private Long pageSize = 10L;
    /**
     * 身份类型(1.全部 2.居民 3.志愿者 4.党员)
     */
    public interface type{
        int all = 1;
        int resident = 2;
        int party = 3;
        int volunteer = 4;
    }
    /**
     * 交易身份类型(1.居民 2.党员 3.志愿者)
     */
    public interface identityType{
        int resident = 1;
        int party = 2;
        int volunteer = 3;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/ComActIntegralCountDTO.java
New file
@@ -0,0 +1,25 @@
package com.panzhihua.common.model.dtos.community.integral;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("查询用户积分交易记录条数请求参数")
public class ComActIntegralCountDTO {
    @ApiModelProperty("社区id")
    private Long communityId;
    @ApiModelProperty("用户id")
    private Long userId;
    @ApiModelProperty("查询开始时间")
    private String startTime;
    @ApiModelProperty("查询结束时间")
    private String endTime;
    @ApiModelProperty("变动类型(1.增加  2.减少)")
    private Integer type;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/admin/AddComActIntegralUserDTO.java
New file
@@ -0,0 +1,46 @@
package com.panzhihua.common.model.dtos.community.integral.admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("计算用户积分请求参数")
public class AddComActIntegralUserDTO {
    @ApiModelProperty("业务id")
    private Long serviceId;
    @ApiModelProperty("积分任务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)")
    private Integer integralType;
    @ApiModelProperty(value = "社区id")
    private Long communityId;
    @ApiModelProperty(value = "用户id")
    private Long userId;
    /**
     * 积分任务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)
     */
    public interface integralType{
        int fbssp = 1;
        int fbwxy = 2;
        int cyystp = 3;
        int cyzyzhd = 4;
        int cysqhd = 5;
        int cydyhd = 6;
        int cydcwj = 7;
    }
    public AddComActIntegralUserDTO(Long serviceId, Integer integralType, Long communityId, Long userId) {
        this.serviceId = serviceId;
        this.integralType = integralType;
        this.communityId = communityId;
        this.userId = userId;
    }
    public AddComActIntegralUserDTO() {
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/admin/EditComActIntegralRuleDTO.java
New file
@@ -0,0 +1,28 @@
package com.panzhihua.common.model.dtos.community.integral.admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("编辑积分规则请求参数")
public class EditComActIntegralRuleDTO {
    @ApiModelProperty("社区积分规则id")
    private Long id;
    @ApiModelProperty("奖励积分金额")
    private Integer amount;
    @ApiModelProperty("是否限制(1.是 2.否)")
    private Integer isRestrict;
    @ApiModelProperty("限制类型(1.月 2.日)")
    private Integer type;
    @ApiModelProperty("限制次数")
    private Integer count;
    @ApiModelProperty("积分任务描述")
    private String integralDescribe;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/admin/PageComActIntegralRuleDTO.java
New file
@@ -0,0 +1,20 @@
package com.panzhihua.common.model.dtos.community.integral.admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("分页查询社区后台积分交易记录请求参数")
public class PageComActIntegralRuleDTO {
    @ApiModelProperty(value = "分页-当前页数",example = "1")
    private Long pageNum = 1L;
    @ApiModelProperty(value = "分页-每页记录数",example = "10")
    private Long pageSize = 10L;
    @ApiModelProperty(value = "社区id",hidden = true)
    private Long communityId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/integral/admin/PageComActIntegralTradeDTO.java
New file
@@ -0,0 +1,32 @@
package com.panzhihua.common.model.dtos.community.integral.admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("分页查询社区后台积分交易记录请求参数")
public class PageComActIntegralTradeDTO {
    @ApiModelProperty(value = "分页-当前页数",example = "1")
    private Long pageNum = 1L;
    @ApiModelProperty(value = "分页-每页记录数",example = "10")
    private Long pageSize = 10L;
    @ApiModelProperty(value = "社区id",hidden = true)
    private Long communityId;
    @ApiModelProperty("姓名")
    private String name;
    @ApiModelProperty("手机号")
    private String phone;
    @ApiModelProperty("用户身份(1.居民 2.党员 3.志愿者)")
    private Integer userIdentity;
    @ApiModelProperty("交易身份类型(1.居民 2.党员 3.志愿者)")
    private Integer identityType;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralCommunityRankVO.java
New file
@@ -0,0 +1,27 @@
package com.panzhihua.common.model.vos.community.integral;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("小程序-社区积分排行榜返回参数")
public class ComActIntegralCommunityRankVO {
    @ApiModelProperty("用户昵称")
    private String nickName;
    @ApiModelProperty("用户头像")
    private String imageUrl;
    @ApiModelProperty("积分账户金额")
    private Integer amount;
    @ApiModelProperty("是否党员(0.否  1.是)")
    private Integer isPartymember;
    @ApiModelProperty("是否志愿者(0.否  1.是)")
    private Integer isVolunteer;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralCommunityTradeVO.java
New file
@@ -0,0 +1,35 @@
package com.panzhihua.common.model.vos.community.integral;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel("小程序-用户社区积分明细返回参数")
public class ComActIntegralCommunityTradeVO {
    @ApiModelProperty("交易业务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)")
    private Integer serviceType;
    @ApiModelProperty("交易数量")
    private Integer amount;
    @ApiModelProperty("交易备注")
    private String remark;
    @ApiModelProperty("交易时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAt;
    @ApiModelProperty("变动类型(1.增加  2.减少)")
    private Integer changeType;
    @ApiModelProperty("交易身份类型(1.居民 2.党员 3.志愿者)")
    private Integer identityType;
    @ApiModelProperty("社区名称")
    private String communityName;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralUserListVO.java
New file
@@ -0,0 +1,20 @@
package com.panzhihua.common.model.vos.community.integral;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序-用户积分列表返回参数")
public class ComActIntegralUserListVO {
    @ApiModelProperty("社区名称")
    private String communityName;
    @ApiModelProperty(value = "社区id")
    private Long communityId;
    @ApiModelProperty("积分总额")
    private Integer amount;
    @ApiModelProperty("社区积分排名")
    private Integer rank;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralUserRuleVO.java
New file
@@ -0,0 +1,40 @@
package com.panzhihua.common.model.vos.community.integral;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel("小程序-社区领取积分列表")
public class ComActIntegralUserRuleVO {
    @ApiModelProperty("积分任务规则id")
    private Long id;
    @ApiModelProperty("积分任务规则名字")
    private String name;
    @ApiModelProperty("积分奖励金额")
    private Integer amount;
    @ApiModelProperty("积分任务描述")
    private String integralDescribe;
    @ApiModelProperty("是否限制(1.是 2.否)")
    private Integer isRestrict;
    @ApiModelProperty("限制类型(1.月 2.日)")
    private Integer type;
    @ApiModelProperty("限制次数")
    private Integer count;
    @ApiModelProperty("积分任务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)")
    private Integer integralType;
    @ApiModelProperty("积分任务备注")
    private String remark;
    @ApiModelProperty("是否已完成(1.是 2.否)")
    private Integer isComplete;
    /**
     * 是否已完成(1.是 2.否)
     */
    public interface isComplete{
        int yes = 1;
        int no = 2;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/ComActIntegralUserVO.java
New file
@@ -0,0 +1,21 @@
package com.panzhihua.common.model.vos.community.integral;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("小程序-用户积分页面返回参数")
public class ComActIntegralUserVO {
    @ApiModelProperty("用户积分总额")
    private Integer amount;
    @ApiModelProperty("用户绑定社区")
    private String communityName;
    @ApiModelProperty("用户积分列表")
    private List<ComActIntegralUserListVO> integralUserList;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/IntegralUserRankVO.java
New file
@@ -0,0 +1,16 @@
package com.panzhihua.common.model.vos.community.integral;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序-查询用户积分排名返回参数")
public class IntegralUserRankVO {
    @ApiModelProperty("用户id")
    private Long userId;
    @ApiModelProperty("排名")
    private Integer rank;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/admin/ComActIntegralUserRuleAdminVO.java
New file
@@ -0,0 +1,38 @@
package com.panzhihua.common.model.vos.community.integral.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel("管理后台-社区积分规则列表")
public class ComActIntegralUserRuleAdminVO {
    @ApiModelProperty("积分任务规则id")
    private Long id;
    @ApiModelProperty("积分任务规则名字")
    private String name;
    @ApiModelProperty("积分奖励金额")
    private Integer amount;
    @ApiModelProperty("积分任务描述")
    private String integralDescribe;
    @ApiModelProperty("是否限制(1.是 2.否)")
    private Integer isRestrict;
    @ApiModelProperty("限制类型(1.月 2.日)")
    private Integer type;
    @ApiModelProperty("限制次数")
    private Integer count;
    @ApiModelProperty("积分任务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)")
    private Integer integralType;
    @ApiModelProperty("积分任务备注")
    private String remark;
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAt;
    @ApiModelProperty("修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateAt;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/admin/ComActIntegralUserTradeAdminVO.java
New file
@@ -0,0 +1,54 @@
package com.panzhihua.common.model.vos.community.integral.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel("管理后台-社区积分明细列表")
public class ComActIntegralUserTradeAdminVO {
    @ApiModelProperty("积分交易记录id")
    private Long id;
    @ApiModelProperty("交易人昵称")
    private String nickName;
    @ApiModelProperty("交易人手机号")
    private String phone;
    @ApiModelProperty("交易人姓名")
    private String name;
    @ApiModelProperty("用户身份")
    private String identity;
    @ApiModelProperty("交易积分金额")
    private Integer amount;
    @ApiModelProperty("交易积分时身份(1.居民 2.党员 3.志愿者)")
    private Integer identityType;
    @ApiModelProperty("交易备注")
    private String remark;
    @ApiModelProperty("交易时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAt;
    @ApiModelProperty(value = "是否志愿者(0.否 1.是)",hidden = true)
    private Integer isVolunteer;
    @ApiModelProperty(value = "是否党员(0.否 1.是)",hidden = true)
    private Integer isPartymember;
    /**
     * 是否志愿者(0.否 1.是)
     */
    public interface isVolunteer{
        int no = 0;
        int yes = 1;
    }
    /**
     * 是否党员(0.否 1.是)
     */
    public interface isPartymember{
        int no = 0;
        int yes = 1;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/integral/admin/IntegralUserVO.java
New file
@@ -0,0 +1,56 @@
package com.panzhihua.common.model.vos.community.integral.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 小程序用户
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-12-30 11:22
 **/
@Data
@ApiModel("小程序用户")
public class IntegralUserVO {
    @ApiModelProperty("主键")
    private Long userId;
    @ApiModelProperty("手机号")
    private String phone;
    @ApiModelProperty("昵称")
    private String nickName;
    @ApiModelProperty("身份证号码")
    private String idCard;
    @ApiModelProperty("真实名字")
    private String name;
    @ApiModelProperty("社区名字")
    private String communityName;
    @ApiModelProperty("1 启用 2 禁用")
    private Integer status;
    @ApiModelProperty("是否志愿者 0 否 1 是")
    private Integer isVolunteer;
    @ApiModelProperty("是否党员 0 否 1 是")
    private Integer isPartymember;
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAt;
    @ApiModelProperty("最后登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastLoginTime;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -14,6 +14,11 @@
import com.panzhihua.common.model.dtos.community.easyPhoto.EditEasyPhotoActivityDTO;
import com.panzhihua.common.model.dtos.community.easyPhoto.PageEasyPhotoActivityDTO;
import com.panzhihua.common.model.dtos.community.easyPhoto.PageEasyPhotoActivityUserDTO;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.EditComActIntegralRuleDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralRuleDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralTradeDTO;
import com.panzhihua.common.model.dtos.community.wallet.*;
import com.panzhihua.common.model.dtos.elders.ComEldersAuthGetResultDTO;
import com.panzhihua.common.model.dtos.elders.ComEldersAuthPageDTO;
@@ -3744,4 +3749,76 @@
     */
    @PostMapping("/patrolRecord/addPatrolRecord")
    R addPatrolRecord(@RequestBody ComSwPatrolRecordAddDTO comSwPatrolRecordAddDTO);
    /**
     * 小程序-查询积分说明
     * @return  积分说明
     */
    @GetMapping("/integral/explain/applets")
    R getIntegralExplainApplets();
    /**
     * 小程序-用户查询当前社区可领取积分规则列表
     * @param userId    用户id
     * @param communityId   社区id
     * @return  可领取积分规则列表
     */
    @PostMapping("/integral/receive/applets")
    R getIntegralReceiveApplets(@RequestParam("userId") Long userId,@RequestParam("communityId") Long communityId);
    /**
     * 小程序-查询用户积分列表
     * @param userId    用户id
     * @return  用户积分列表
     */
    @PostMapping("/integral/user/list/applets")
    R getIntegralUserListApplets(@RequestParam("userId") Long userId, @RequestParam("communityId") Long communityId);
    /**
     * 小程序-查询社区积分账户排行榜
     * @param communityRankDTO  请求参数
     * @return  社区积分账户排行榜
     */
    @PostMapping("/integral/community/rank/applets")
    R getIntegralCommunityRankApplets(@RequestBody ComActIntegralCommunityRankDTO communityRankDTO);
    /**
     * 小程序-查询用户社区积分明细
     * @param communityTradeDTO 请求参数
     * @return  用户社区积分明细
     */
    @PostMapping("/integral/community/trade/applets")
    R getIntegralCommunityTradeApplets(@RequestBody ComActIntegralCommunityRankDTO communityTradeDTO);
    /**
     * 社区后台-根据社区id查询社区下积分规则列表
     * @param integralRuleDTO   请求参数
     * @return  社区下积分规则列表
     */
    @PostMapping("/integral/rule/list/admin")
    R getIntegralRuleAdminList(@RequestBody PageComActIntegralRuleDTO integralRuleDTO);
    /**
     * 社区后台-编辑社区积分规则
     * @param integralRuleDTO   请求参数
     * @return  编辑结果
     */
    @PostMapping("/integral/rule/edit/admin")
    R editIntegralRuleAdmin(@RequestBody EditComActIntegralRuleDTO integralRuleDTO);
    /**
     * 社区后台-分页查询社区下积分明细记录
     * @param integralRuleDTO   请求参数
     * @return  社区下积分明细记录
     */
    @PostMapping("/integral/user/trade/page/admin")
    R getIntegralTradeListAdmin(@RequestBody PageComActIntegralTradeDTO integralRuleDTO);
    /**
     * 给用户添加积分
     * @param integralUserDTO   请求参数
     * @return  添加积分结果
     */
    @PostMapping("/integral/user/add/admin")
    R addIntegralTradeAdmin(@RequestBody AddComActIntegralUserDTO integralUserDTO);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java
@@ -795,12 +795,58 @@
        }
    }
    /**
     * 获取当前月第一天
     * @return
     */
    public static String getFirstDayOfMonthString() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MONTH, 0);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        // 格式化日期
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(calendar.getTime())+" 00:00:00";
    }
    /**
     * 获取当前月最后一天
     * @return
     */
    public static String getLastDayOfMonthString() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MONTH, 1);
        calendar.set(Calendar.DAY_OF_MONTH, 0);
        // 格式化日期
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(calendar.getTime())+" 23:59:59";
    }
    /**
     * 获取当前时间(年月日)
     * @return
     */
    public static String getDayOfMonthString() {
        Calendar today = Calendar.getInstance();
        today.set(Calendar.HOUR, 0);
        today.set(Calendar.MINUTE, 0);
        today.set(Calendar.SECOND, 0);
        today.set(Calendar.MILLISECOND, 0);
        // 格式化日期
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(today.getTime());
    }
    public static void main(String[]args)throws Exception{
//        Date date= new Date();
//        Date after = new Date();
//        System.out.println(calTimeDifference(date,after));
//        System.out.println(getFirstDayOfMonthString());
//        System.out.println(getDayOfMonthString());
    }
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActIntegralUserApi.java
New file
@@ -0,0 +1,56 @@
package com.panzhihua.community_backstage.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.integral.admin.EditComActIntegralRuleDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralRuleDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralTradeDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.integral.admin.ComActIntegralUserRuleAdminVO;
import com.panzhihua.common.model.vos.community.integral.admin.ComActIntegralUserTradeAdminVO;
import com.panzhihua.common.service.community.CommunityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@Slf4j
@RestController
@RequestMapping("/integral/")
@Api(tags = {"积分模块"})
public class ComActIntegralUserApi extends BaseController {
    @Resource
    private CommunityService communityService;
    @ApiOperation(value = "查询社区积分规则列表",response = ComActIntegralUserRuleAdminVO.class)
    @PostMapping("/rule/list")
    public R getIntegralRuleAdminList(@RequestBody PageComActIntegralRuleDTO integralRuleDTO) {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if(userInfoVO == null){
            return R.fail("请先登录");
        }
        integralRuleDTO.setCommunityId(userInfoVO.getCommunityId());
        return communityService.getIntegralRuleAdminList(integralRuleDTO);
    }
    @ApiOperation(value = "编辑社区积分规则")
    @PostMapping("/rule/edit")
    public R editIntegralRuleAdmin(@RequestBody EditComActIntegralRuleDTO integralRuleDTO) {
        return communityService.editIntegralRuleAdmin(integralRuleDTO);
    }
    @ApiOperation(value = "分页查询社区积分明细",response = ComActIntegralUserTradeAdminVO.class)
    @PostMapping("/user/trade/page")
    public R getIntegralTradeListAdmin(@RequestBody PageComActIntegralTradeDTO integralRuleDTO) {
        LoginUserInfoVO userInfoVO = this.getLoginUserInfo();
        if(userInfoVO == null){
            return R.fail("请先登录");
        }
        integralRuleDTO.setCommunityId(userInfoVO.getCommunityId());
        return communityService.getIntegralTradeListAdmin(integralRuleDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.GrantRewardDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.*;
@@ -338,6 +339,11 @@
                            log.info("新增微心愿发起了活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                        }
                    }
                    if(type.equals(1)){//审核通过给用户增加积分
                        communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO(id,AddComActIntegralUserDTO.integralType.fbwxy
                                ,this.getCommunityId(),comActMicroWishVO1.getSponsorId()));
                    }
                }
            }
        }
@@ -399,6 +405,11 @@
                        log.info("新增随手拍有反馈通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                    }
                }
                if(type.equals(1)){//审核通过给用户增加积分
                    communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO(id,AddComActIntegralUserDTO.integralType.fbssp
                            ,this.getCommunityId(),comActEasyPhotoVO1.getSponsorId()));
                }
            }
        }
        return r;
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComActIntegralUserApi.java
New file
@@ -0,0 +1,122 @@
package com.panzhihua.service_community.api;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.EditComActIntegralRuleDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralRuleDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralTradeDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.service.ComActIntegralRuleService;
import com.panzhihua.service_community.service.ComActIntegralUserService;
import com.panzhihua.service_community.service.ComActIntegralUserTradeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * 用户积分模块
 */
@Slf4j
@RestController
@RequestMapping("/integral")
public class ComActIntegralUserApi {
    @Resource
    private ComActIntegralUserService comActIntegralUserService;
    @Resource
    private ComActIntegralRuleService comActIntegralRuleService;
    @Resource
    private ComActIntegralUserTradeService comActIntegralUserTradeService;
    /**
     * 小程序-查询积分说明
     * @return  积分说明
     */
    @GetMapping("/explain/applets")
    public R getIntegralExplainApplets(){
        return comActIntegralUserService.getIntegralExplainApplets();
    }
    /**
     * 用户查询当前社区可领取积分规则列表
     * @param userId    用户id
     * @param communityId   社区id
     * @return  可领取积分规则列表
     */
    @PostMapping("/receive/applets")
    public R getIntegralReceiveApplets(@RequestParam("userId") Long userId, @RequestParam("communityId") Long communityId){
        return comActIntegralUserService.getIntegralReceiveApplets(userId,communityId);
    }
    /**
     * 小程序-查询用户积分列表
     * @param userId    用户id
     * @return  用户积分列表
     */
    @PostMapping("/user/list/applets")
    public R getIntegralUserListApplets(@RequestParam("userId") Long userId, @RequestParam("communityId") Long communityId){
        return comActIntegralUserService.getIntegralUserListApplets(userId,communityId);
    }
    /**
     * 查询社区积分账户排行榜
     * @param communityRankDTO  请求参数
     * @return  社区积分账户排行榜
     */
    @PostMapping("/community/rank/applets")
    public R getIntegralCommunityRankApplets(@RequestBody ComActIntegralCommunityRankDTO communityRankDTO){
        return comActIntegralUserService.getIntegralCommunityRankApplets(communityRankDTO);
    }
    /**
     * 小程序-查询用户社区积分明细
     * @param communityTradeDTO 请求参数
     * @return  用户社区积分明细
     */
    @PostMapping("/community/trade/applets")
    public R getIntegralCommunityTradeApplets(@RequestBody ComActIntegralCommunityRankDTO communityTradeDTO){
        return comActIntegralUserTradeService.getIntegralCommunityTradeApplets(communityTradeDTO);
    }
    /**
     * 社区后台-根据社区id查询社区下积分规则列表
     * @param integralRuleDTO   请求参数
     * @return  社区下积分规则列表
     */
    @PostMapping("/rule/list/admin")
    public R getIntegralRuleAdminList(@RequestBody PageComActIntegralRuleDTO integralRuleDTO){
        return comActIntegralRuleService.getIntegralRuleAdminList(integralRuleDTO);
    }
    /**
     * 社区后台-编辑社区积分规则
     * @param integralRuleDTO   请求参数
     * @return  编辑结果
     */
    @PostMapping("/rule/edit/admin")
    public R editIntegralRuleAdmin(@RequestBody EditComActIntegralRuleDTO integralRuleDTO){
        return comActIntegralRuleService.editIntegralRuleAdmin(integralRuleDTO);
    }
    /**
     * 社区后台-分页查询社区下积分明细记录
     * @param integralRuleDTO   请求参数
     * @return  社区下积分明细记录
     */
    @PostMapping("/user/trade/page/admin")
    public R getIntegralTradeListAdmin(@RequestBody PageComActIntegralTradeDTO integralRuleDTO){
        return comActIntegralUserTradeService.getIntegralTradeListAdmin(integralRuleDTO);
    }
    /**
     * 给用户添加积分
     * @param integralUserDTO   请求参数
     * @return  添加积分结果
     */
    @PostMapping("/user/add/admin")
    public R addIntegralTradeAdmin(@RequestBody AddComActIntegralUserDTO integralUserDTO){
        return comActIntegralUserTradeService.addIntegralTradeAdmin(integralUserDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActIntegralRuleMapper.java
New file
@@ -0,0 +1,37 @@
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.integral.admin.PageComActIntegralRuleDTO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO;
import com.panzhihua.common.model.vos.community.integral.admin.ComActIntegralUserRuleAdminVO;
import com.panzhihua.service_community.model.dos.ComActIntegralRuleDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @auther lyq
 * @create 2021-07-28 16:02:46
 * @describe 积分规则表mapper类
 */
@Mapper
public interface ComActIntegralRuleMapper extends BaseMapper<ComActIntegralRuleDO> {
    /**
     * 查询社区下积分任务列表
     * @param communityId   社区id
     * @return  查询社区下积分任务列表
     */
    List<ComActIntegralUserRuleVO> getIntegralReceiveApplets(@Param("communityId") Long communityId);
    /**
     * 社区后台-根据社区id查询社区下积分规则列表
     * @param integralRuleDTO   请求参数
     * @return  社区下积分规则列表
     */
    IPage<ComActIntegralUserRuleAdminVO> getIntegralRuleAdminList(Page page, @Param("integralRuleDTO") PageComActIntegralRuleDTO integralRuleDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActIntegralUserChangeMapper.java
New file
@@ -0,0 +1,15 @@
package com.panzhihua.service_community.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.service_community.model.dos.ComActIntegralUserChangeDO;
import org.apache.ibatis.annotations.Mapper;
/**
 * @auther lyq
 * @create 2021-07-28 16:03:05
 * @describe 用户积分账户变动记录mapper类
 */
@Mapper
public interface ComActIntegralUserChangeMapper extends BaseMapper<ComActIntegralUserChangeDO> {
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActIntegralUserMapper.java
New file
@@ -0,0 +1,48 @@
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.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityRankVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserListVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO;
import com.panzhihua.common.model.vos.community.integral.IntegralUserRankVO;
import com.panzhihua.service_community.model.dos.ComActIntegralUserDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * @auther lyq
 * @create 2021-07-28 16:02:57
 * @describe 用户积分账户表mapper类
 */
@Mapper
public interface ComActIntegralUserMapper extends BaseMapper<ComActIntegralUserDO> {
    /**
     * 小程序-查询用户积分列表
     * @param userId    用户id
     * @return  用户积分列表
     */
    List<ComActIntegralUserListVO> getIntegralUserListApplets(@Param("userId") Long userId);
    /**
     * 小程序-查询用户在当前社区积分排名
     * @param userId    用户id
     * @param communityId    社区id
     * @return  用户在当前社区积分排名
     */
    IntegralUserRankVO getIntegralUserRank(@Param("communityId") Long communityId, @Param("userId") Long userId);
    /**
     * 查询社区积分账户排行榜
     * @param communityRankDTO  请求参数
     * @return  社区积分账户排行榜
     */
    IPage<ComActIntegralCommunityRankVO> getIntegralCommunityRankApplets(Page page,@Param("communityRankDTO") ComActIntegralCommunityRankDTO communityRankDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActIntegralUserTradeMapper.java
New file
@@ -0,0 +1,46 @@
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.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCountDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralTradeDTO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityTradeVO;
import com.panzhihua.common.model.vos.community.integral.admin.ComActIntegralUserTradeAdminVO;
import com.panzhihua.common.model.vos.community.integral.admin.IntegralUserVO;
import com.panzhihua.service_community.model.dos.ComActIntegralUserTradeDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * @auther lyq
 * @create 2021-07-28 16:03:18
 * @describe 用户积分账户交易记录mapper类
 */
@Mapper
public interface ComActIntegralUserTradeMapper extends BaseMapper<ComActIntegralUserTradeDO> {
    /**
     * 查询用户某个时间段交易数量
     * @param integralCountDTO  请求参数
     * @return  交易数量
     */
    Integer getIntegralCount(@Param("integralCountDTO") ComActIntegralCountDTO integralCountDTO);
    /**
     * 小程序-查询用户社区积分明细
     * @param communityTradeDTO 请求参数
     * @return  用户社区积分明细
     */
    IPage<ComActIntegralCommunityTradeVO> getIntegralCommunityTradeApplets(Page page,@Param("communityTradeDTO") ComActIntegralCommunityRankDTO communityTradeDTO);
    /**
     * 社区后台-分页查询社区下积分明细记录
     * @param integralRuleDTO   请求参数
     * @return  社区下积分明细记录
     */
    IPage<ComActIntegralUserTradeAdminVO> getIntegralTradeListAdmin(Page page,@Param("integralRuleDTO") PageComActIntegralTradeDTO integralRuleDTO);
    IntegralUserVO getUserInfo(@Param("userId") Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActUserWalletMapper.java
@@ -21,7 +21,9 @@
@Mapper
public interface ComActUserWalletMapper extends BaseMapper<ComActUserWalletDO> {
    Map<String,String> getCommunityName(@Param("communityId") Long communityId);
    Map<String,String> getCommunityName(@Param("communityId") Long communityId,@Param("type") Integer type);
    Map<String,String> getAgreementContent(@Param("communityId") Long communityId,@Param("type") Integer type);
    /**
     * 查询用户绑定的社区收益排行榜
@@ -37,6 +39,6 @@
     */
    IPage<ComActWalletAdminVO> getUserWalletList(Page page, @Param("pageWalletAdminDTO") PageComActWalletAdminDTO pageWalletAdminDTO);
    void insertSysAgreement(@Param("content") String content,@Param("communityId") Long communityId);
    void insertSysAgreement(@Param("content") String content,@Param("name") String name,@Param("communityId") Long communityId,@Param("type") Integer type);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActIntegralRuleDO.java
New file
@@ -0,0 +1,131 @@
package com.panzhihua.service_community.model.dos;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * @auther lyq
 * @create 2021-07-28 16:02:46
 * @describe 积分规则表实体类
 */
@Data
@TableName("com_act_integral_rule")
public class ComActIntegralRuleDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 积分规则名称
     */
    private String name;
    /**
     * 社区id
     */
    private Long communityId;
    /**
     * 积分奖励金额
     */
    private Integer amount;
    /**
     * 积分任务描述
     */
    private String integralDescribe;
    /**
     * 是否限制(1.是 2.否)
     */
    private Integer isRestrict;
    /**
     * 限制类型(1.月 2.日)
     */
    @TableField(value = "type", updateStrategy  = FieldStrategy.IGNORED)
    private Integer type;
    /**
     * 限制次数
     */
    @TableField(value = "count", updateStrategy  = FieldStrategy.IGNORED)
    private Integer count;
    /**
     * 创建时间
     */
    private Date createAt;
    /**
     * 修改时间
     */
    private Date updateAt;
    /**
     * 积分任务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)
     */
    private Integer integralType;
    /**
     * 积分任务备注
     */
    private String remark;
    /**
     * 积分任务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)
     */
    public interface integralType{
        int fbssp = 1;
        int fbwxy = 2;
        int cyystp = 3;
        int cyzyzhd = 4;
        int cysqhd = 5;
        int cydyhd = 6;
        int cydcwj = 7;
    }
    /**
     * 是否限制(1.是 2.否)
     */
    public interface isRestrict{
        int yes = 1;
        int no = 2;
    }
    /**
     * 限制类型(1.月 2.日)
     */
    public interface type{
        int month = 1;
        int day = 2;
    }
    @Override
    public String toString() {
        return "ComActIntegralRuleDO{" +
                "id=" + id +
                ", name=" + name +
                ", communityId=" + communityId +
                ", amount=" + amount +
                ", integralDescribe=" + integralDescribe +
                ", isRestrict=" + isRestrict +
                ", type=" + type +
                ", count=" + count +
                ", createAt=" + createAt +
                ", updateAt=" + updateAt +
                ", integralType=" + integralType +
                ", remark=" + remark +
                "}";
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActIntegralUserChangeDO.java
New file
@@ -0,0 +1,210 @@
package com.panzhihua.service_community.model.dos;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * @auther lyq
 * @create 2021-07-28 16:03:05
 * @describe 用户积分账户变动记录实体类
 */
@Data
@TableName("com_act_integral_user_change")
public class ComActIntegralUserChangeDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.INPUT)
    private Long id;
    /**
     * 用户id
     */
    private Long userId;
    /**
     * 积分账户id
     */
    private Long integralId;
    /**
     * 社区id
     */
    private Long communityId;
    /**
     * 总积分数量变动前
     */
    private Integer integralSumTop;
    /**
     * 总积分数量变动后
     */
    private Integer integralSumBack;
    /**
     * 可用总积分数量变动前
     */
    private Integer integralAvailableSumTop;
    /**
     * 可用总积分数量变动后
     */
    private Integer integralAvailableSumBack;
    /**
     * 冻结总积分数量变动前
     */
    private Integer integralFrozenSumTop;
    /**
     * 冻结总积分数量变动后
     */
    private Integer integralFrozenSumBack;
    /**
     * 党员积分数量变动前
     */
    private Integer integralPartyTop;
    /**
     * 党员积分数量变动后
     */
    private Integer integralPartyBack;
    /**
     * 可用党员积分数量变动前
     */
    private Integer integralAvailablePartyTop;
    /**
     * 可用党员积分数量变动后
     */
    private Integer integralAvailablePartyBack;
    /**
     * 冻结党员积分数量变动前
     */
    private Integer integralFrozenPartyTop;
    /**
     * 冻结党员积分数量变动后
     */
    private Integer integralFrozenPartyBack;
    /**
     * 志愿者积分数量变动前
     */
    private Integer integralVolunteerTop;
    /**
     * 志愿者积分数量变动后
     */
    private Integer integralVolunteerBack;
    /**
     * 可用志愿者积分数量变动前
     */
    private Integer integralAvailableVolunteerTop;
    /**
     * 可用志愿者积分数量变动后
     */
    private Integer integralAvailableVolunteerBack;
    /**
     * 冻结志愿者积分数量变动前
     */
    private Integer integralFrozenVolunteerTop;
    /**
     * 冻结志愿者积分数量变动后
     */
    private Integer integralFrozenVolunteerBack;
    /**
     * 居民积分数量变动前
     */
    private Integer integralResidentTop;
    /**
     * 居民积分数量变动后
     */
    private Integer integralResidentBack;
    /**
     * 可用居民积分数量变动前
     */
    private Integer integralAvailableResidentTop;
    /**
     * 可用居民积分数量变动后
     */
    private Integer integralAvailableResidentBack;
    /**
     * 冻结居民积分数量变动前
     */
    private Integer integralFrozenResidentTop;
    /**
     * 冻结居民积分数量变动后
     */
    private Integer integralFrozenResidentBack;
    /**
     * 交易记录id
     */
    private Long serviceId;
    /**
     * 变动时间
     */
    private Date createAt;
    @Override
    public String toString() {
        return "ComActIntegralUserChangeDO{" +
                "id=" + id +
                ", userId=" + userId +
                ", integralId=" + integralId +
                ", communityId=" + communityId +
                ", integralSumTop=" + integralSumTop +
                ", integralSumBack=" + integralSumBack +
                ", integralAvailableSumTop=" + integralAvailableSumTop +
                ", integralAvailableSumBack=" + integralAvailableSumBack +
                ", integralFrozenSumTop=" + integralFrozenSumTop +
                ", integralFrozenSumBack=" + integralFrozenSumBack +
                ", integralPartyTop=" + integralPartyTop +
                ", integralPartyBack=" + integralPartyBack +
                ", integralAvailablePartyTop=" + integralAvailablePartyTop +
                ", integralAvailablePartyBack=" + integralAvailablePartyBack +
                ", integralFrozenPartyTop=" + integralFrozenPartyTop +
                ", integralFrozenPartyBack=" + integralFrozenPartyBack +
                ", integralVolunteerTop=" + integralVolunteerTop +
                ", integralVolunteerBack=" + integralVolunteerBack +
                ", integralAvailableVolunteerTop=" + integralAvailableVolunteerTop +
                ", integralAvailableVolunteerBack=" + integralAvailableVolunteerBack +
                ", integralFrozenVolunteerTop=" + integralFrozenVolunteerTop +
                ", integralFrozenVolunteerBack=" + integralFrozenVolunteerBack +
                ", integralResidentTop=" + integralResidentTop +
                ", integralResidentBack=" + integralResidentBack +
                ", integralAvailableResidentTop=" + integralAvailableResidentTop +
                ", integralAvailableResidentBack=" + integralAvailableResidentBack +
                ", integralFrozenResidentTop=" + integralFrozenResidentTop +
                ", integralFrozenResidentBack=" + integralFrozenResidentBack +
                ", serviceId=" + serviceId +
                ", createAt=" + createAt +
                "}";
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActIntegralUserDO.java
New file
@@ -0,0 +1,145 @@
package com.panzhihua.service_community.model.dos;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * @auther lyq
 * @create 2021-07-28 16:02:57
 * @describe 用户积分账户表实体类
 */
@Data
@TableName("com_act_integral_user")
public class ComActIntegralUserDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 用户id
     */
    private Long userId;
    /**
     * 社区id
     */
    private Long communityId;
    /**
     * 总积分数量
     */
    private Integer integralSum;
    /**
     * 可用总积分数量
     */
    private Integer integralAvailableSum;
    /**
     * 冻结总积分数量
     */
    private Integer integralFrozenSum;
    /**
     * 党员积分数量
     */
    private Integer integralParty;
    /**
     * 可用党员积分数量
     */
    private Integer integralAvailableParty;
    /**
     * 冻结党员积分数量
     */
    private Integer integralFrozenParty;
    /**
     * 志愿者积分数量
     */
    private Integer integralVolunteer;
    /**
     * 可用志愿者积分数量
     */
    private Integer integralAvailableVolunteer;
    /**
     * 冻结志愿者积分数量
     */
    private Integer integralFrozenVolunteer;
    /**
     * 居民积分数量
     */
    private Integer integralResident;
    /**
     * 可用居民积分数量
     */
    private Integer integralAvailableResident;
    /**
     * 冻结居民积分数量
     */
    private Integer integralFrozenResident;
    /**
     * 创建时间
     */
    private Date createAt;
    /**
     * 上次积分变动时间
     */
    private Date updateAt;
    /**
     * 状态(1.启用 2.禁用)
     */
    private Integer status;
    /**
     * 状态(1.启用 2.禁用)
     */
    public interface status{
        int yes = 1;
        int no = 2;
    }
    @Override
    public String toString() {
        return "ComActIntegralUserDO{" +
                "id=" + id +
                ", userId=" + userId +
                ", communityId=" + communityId +
                ", integralSum=" + integralSum +
                ", integralAvailableSum=" + integralAvailableSum +
                ", integralFrozenSum=" + integralFrozenSum +
                ", integralParty=" + integralParty +
                ", integralAvailableParty=" + integralAvailableParty +
                ", integralFrozenParty=" + integralFrozenParty +
                ", integralVolunteer=" + integralVolunteer +
                ", integralAvailableVolunteer=" + integralAvailableVolunteer +
                ", integralFrozenVolunteer=" + integralFrozenVolunteer +
                ", integralResident=" + integralResident +
                ", integralAvailableResident=" + integralAvailableResident +
                ", integralFrozenResident=" + integralFrozenResident +
                ", createAt=" + createAt +
                ", updateAt=" + updateAt +
                "}";
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActIntegralUserTradeDO.java
New file
@@ -0,0 +1,119 @@
package com.panzhihua.service_community.model.dos;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * @auther lyq
 * @create 2021-07-28 16:03:18
 * @describe 用户积分账户交易记录实体类
 */
@Data
@TableName("com_act_integral_user_trade")
public class ComActIntegralUserTradeDO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(type = IdType.INPUT)
    private Long id;
    /**
     * 用户id
     */
    private Long userId;
    /**
     * 积分账户id
     */
    private Long integralId;
    /**
     * 社区id
     */
    private Long communityId;
    /**
     * 交易业务id
     */
    private Long serviceId;
    /**
     * 交易业务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)
     */
    private Integer serviceType;
    /**
     * 交易积分数量
     */
    private Integer amount;
    /**
     * 变动类型(1.增加  2.减少)
     */
    private Integer changeType;
    /**
     * 交易备注
     */
    private String remark;
    /**
     * 交易身份类型(1.居民 2.党员 3.志愿者)
     */
    private Integer identityType;
    /**
     * 交易时间
     */
    private Date createAt;
    /**
     * 操作人id
     */
    private Long createBy;
    /**
     * 变动类型(1.增加  2.减少)
     */
    public interface changeType{
        int add = 1;
        int reduce = 2;
    }
    /**
     * 交易身份类型(1.居民 2.党员 3.志愿者)
     */
    public interface identityType{
        int jm = 1;
        int dy = 2;
        int zyz = 3;
    }
    @Override
    public String toString() {
        return "ComActIntegralUserTradeDO{" +
                "id=" + id +
                ", userId=" + userId +
                ", integralId=" + integralId +
                ", communityId=" + communityId +
                ", serviceId=" + serviceId +
                ", serviceType=" + serviceType +
                ", amount=" + amount +
                ", changeType=" + changeType +
                ", remark=" + remark +
                ", identityType=" + identityType +
                ", createAt=" + createAt +
                ", createBy=" + createBy +
                "}";
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActIntegralRuleService.java
New file
@@ -0,0 +1,40 @@
package com.panzhihua.service_community.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.community.integral.admin.EditComActIntegralRuleDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralRuleDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO;
import com.panzhihua.service_community.model.dos.ComActIntegralRuleDO;
import java.util.List;
/**
 * @auther lyq
 * @create 2021-07-28 16:02:46
 * @describe 积分规则表服务类
 */
public interface ComActIntegralRuleService extends IService<ComActIntegralRuleDO> {
    /**
     * 查询社区下积分任务列表
     * @param communityId   社区id
     * @return  查询社区下积分任务列表
     */
    List<ComActIntegralUserRuleVO> getIntegralReceiveApplets(Long communityId);
    /**
     * 社区后台-根据社区id查询社区下积分规则列表
     * @param integralRuleDTO   请求参数
     * @return  社区下积分规则列表
     */
    R getIntegralRuleAdminList(PageComActIntegralRuleDTO integralRuleDTO);
    /**
     * 社区后台-编辑社区积分规则
     * @param integralRuleDTO   请求参数
     * @return  编辑结果
     */
    R editIntegralRuleAdmin(EditComActIntegralRuleDTO integralRuleDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActIntegralUserChangeService.java
New file
@@ -0,0 +1,52 @@
package com.panzhihua.service_community.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.service_community.model.dos.ComActIntegralUserChangeDO;
/**
 * @auther lyq
 * @create 2021-07-28 16:03:05
 * @describe 用户积分账户变动记录服务类
 */
public interface ComActIntegralUserChangeService extends IService<ComActIntegralUserChangeDO> {
    /**
     * 添加用户积分账户变动记录
     * @param userId    用户id
     * @param integralId    积分账户id
     * @param communityId   社区id
     * @param integralSumTop    总积分数量变动前
     * @param integralSumBack   总积分数量变动后
     * @param integralAvailableSumTop   可用总积分数量变动前
     * @param integralAvailableSumBack  可用总积分数量变动后
     * @param integralFrozenSumTop  冻结总积分数量变动前
     * @param integralFrozenSumBack 冻结总积分数量变动后
     * @param integralPartyTop  党员积分数量变动前
     * @param integralPartyBack 党员积分数量变动后
     * @param integralAvailablePartyTop 可用党员积分数量变动前
     * @param integralAvailablePartyBack    可用党员积分数量变动后
     * @param integralFrozenPartyTop    冻结党员积分数量变动前
     * @param integralFrozenPartyBack   冻结党员积分数量变动后
     * @param integralVolunteerTop  志愿者积分数量变动前
     * @param integralVolunteerBack 志愿者积分数量变动后
     * @param integralAvailableVolunteerTop 可用志愿者积分数量变动前
     * @param integralAvailableVolunteerBack    可用志愿者积分数量变动后
     * @param integralFrozenVolunteerTop    冻结志愿者积分数量变动前
     * @param integralFrozenVolunteerBack   冻结志愿者积分数量变动后
     * @param integralResidentTop   居民积分数量变动前
     * @param integralResidentBack  居民积分数量变动后
     * @param integralAvailableResidentTop  可用居民积分数量变动前
     * @param integralAvailableResidentBack 可用居民积分数量变动后
     * @param integralFrozenResidentTop 冻结居民积分数量变动前
     * @param integralFrozenResidentBack    冻结居民积分数量变动后
     * @param serviceId 交易记录id
     */
    void addIntegralUserChangeRecord(Long userId,Long integralId,Long communityId,Integer integralSumTop
            ,Integer integralSumBack,Integer integralAvailableSumTop,Integer integralAvailableSumBack,Integer integralFrozenSumTop
            ,Integer integralFrozenSumBack,Integer integralPartyTop,Integer integralPartyBack,Integer integralAvailablePartyTop
            ,Integer integralAvailablePartyBack,Integer integralFrozenPartyTop,Integer integralFrozenPartyBack,Integer integralVolunteerTop
            ,Integer integralVolunteerBack,Integer integralAvailableVolunteerTop,Integer integralAvailableVolunteerBack,Integer integralFrozenVolunteerTop
            ,Integer integralFrozenVolunteerBack,Integer integralResidentTop,Integer integralResidentBack,Integer integralAvailableResidentTop
            ,Integer integralAvailableResidentBack,Integer integralFrozenResidentTop,Integer integralFrozenResidentBack,Long serviceId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActIntegralUserService.java
New file
@@ -0,0 +1,43 @@
package com.panzhihua.service_community.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.model.dos.ComActIntegralUserDO;
/**
 * @auther lyq
 * @create 2021-07-28 16:02:57
 * @describe 用户积分账户表服务类
 */
public interface ComActIntegralUserService extends IService<ComActIntegralUserDO> {
    /**
     * 小程序-查询积分说明
     * @return  积分说明
     */
    R getIntegralExplainApplets();
    /**
     * 用户查询当前社区可领取积分规则列表
     * @param userId    用户id
     * @param communityId   社区id
     * @return  可领取积分规则列表
     */
    R getIntegralReceiveApplets(Long userId,Long communityId);
    /**
     * 小程序-查询用户积分列表
     * @param userId    用户id
     * @return  用户积分列表
     */
    R getIntegralUserListApplets(Long userId,Long communityId);
    /**
     * 查询社区积分账户排行榜
     * @param communityRankDTO  请求参数
     * @return  社区积分账户排行榜
     */
    R getIntegralCommunityRankApplets(ComActIntegralCommunityRankDTO communityRankDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActIntegralUserTradeService.java
New file
@@ -0,0 +1,62 @@
package com.panzhihua.service_community.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCountDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralTradeDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.model.dos.ComActIntegralUserTradeDO;
/**
 * @auther lyq
 * @create 2021-07-28 16:03:18
 * @describe 用户积分账户交易记录服务类
 */
public interface ComActIntegralUserTradeService extends IService<ComActIntegralUserTradeDO> {
    /**
     * 查询用户某个时间段交易数量
     * @param integralCountDTO  请求参数
     * @return  交易数量
     */
    Integer getIntegralCount(ComActIntegralCountDTO integralCountDTO);
    /**
     * 添加用户积分交易记录
     * @param userId    用户id
     * @param integralId    积分账户id
     * @param communityId   社区id
     * @param serviceId     交易业务id
     * @param serviceType   交易业务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)
     * @param amount    交易积分数量
     * @param changeType    变动类型(1.增加  2.减少)
     * @param remark    交易备注
     * @param identityType  交易身份类型(1.居民 2.党员 3.志愿者)
     * @param createBy  操作人id
     */
    Long addIntegralTradeRecord(Long userId,Long integralId,Long communityId,Long serviceId
            ,Integer serviceType,Integer amount,Integer changeType,String remark,Integer identityType,Long createBy);
    /**
     * 小程序-查询用户社区积分明细
     * @param communityTradeDTO 请求参数
     * @return  用户社区积分明细
     */
    R getIntegralCommunityTradeApplets(ComActIntegralCommunityRankDTO communityTradeDTO);
    /**
     * 社区后台-分页查询社区下积分明细记录
     * @param integralRuleDTO   请求参数
     * @return  社区下积分明细记录
     */
    R getIntegralTradeListAdmin(PageComActIntegralTradeDTO integralRuleDTO);
    /**
     * 给用户添加积分
     * @param integralUserDTO   请求参数
     * @return  添加积分结果
     */
    R addIntegralTradeAdmin(AddComActIntegralUserDTO integralUserDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralRuleServiceImpl.java
New file
@@ -0,0 +1,172 @@
package com.panzhihua.service_community.service.impl;
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.integral.admin.EditComActIntegralRuleDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralRuleDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO;
import com.panzhihua.service_community.dao.ComActIntegralRuleMapper;
import com.panzhihua.service_community.model.dos.ComActIntegralRuleDO;
import com.panzhihua.service_community.service.ComActIntegralRuleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * @auther lyq
 * @create 2021-07-28 16:02:46
 * @describe 积分规则表服务实现类
 */
@Slf4j
@Service
public class ComActIntegralRuleServiceImpl extends ServiceImpl<ComActIntegralRuleMapper, ComActIntegralRuleDO> implements ComActIntegralRuleService {
    /**
     * 查询社区下积分任务列表
     * @param communityId   社区id
     * @return  查询社区下积分任务列表
     */
    @Override
    public List<ComActIntegralUserRuleVO> getIntegralReceiveApplets(Long communityId){
        return this.baseMapper.getIntegralReceiveApplets(communityId);
    }
    /**
     * 社区后台-根据社区id查询社区下积分规则列表
     * @param integralRuleDTO   请求参数
     * @return  社区下积分规则列表
     */
    @Override
    public R getIntegralRuleAdminList(PageComActIntegralRuleDTO integralRuleDTO){
        Integer count = this.baseMapper.selectCount(new QueryWrapper<ComActIntegralRuleDO>().lambda().eq(ComActIntegralRuleDO::getCommunityId,integralRuleDTO.getCommunityId()));
        if(count.equals(0)){
            List<ComActIntegralRuleDO> integralRuleList = getIntegralRuleList(integralRuleDTO.getCommunityId());
            this.saveBatch(integralRuleList);
        }
        return R.ok(this.baseMapper.getIntegralRuleAdminList(new Page(integralRuleDTO.getPageNum(),integralRuleDTO.getPageSize()),integralRuleDTO));
    }
    /**
     * 加载默认社区积分规则列表
     * @param communityId   社区id
     * @return  默认积分规则列表
     */
    private List<ComActIntegralRuleDO> getIntegralRuleList(Long communityId){
        List<ComActIntegralRuleDO> integralRuleList = new ArrayList<>();
        //随手拍默认积分规则
        ComActIntegralRuleDO integralRuleSSPDO = new ComActIntegralRuleDO();
        integralRuleSSPDO.setCommunityId(communityId);
        integralRuleSSPDO.setName("发布随手拍");
        integralRuleSSPDO.setAmount(0);
        integralRuleSSPDO.setIntegralDescribe("发布随手拍并被公示后");
        integralRuleSSPDO.setIsRestrict(2);
        integralRuleSSPDO.setIntegralType(ComActIntegralRuleDO.integralType.fbssp);
        integralRuleList.add(integralRuleSSPDO);
        //微心愿默认积分规则
        ComActIntegralRuleDO integralRuleWXYDO = new ComActIntegralRuleDO();
        integralRuleWXYDO.setCommunityId(communityId);
        integralRuleWXYDO.setName("发布微心愿");
        integralRuleWXYDO.setAmount(0);
        integralRuleWXYDO.setIntegralDescribe("发布微心愿并完成后");
        integralRuleWXYDO.setIsRestrict(1);
        integralRuleWXYDO.setType(ComActIntegralRuleDO.type.month);
        integralRuleWXYDO.setCount(5);
        integralRuleWXYDO.setIntegralType(ComActIntegralRuleDO.integralType.fbssp);
        integralRuleList.add(integralRuleWXYDO);
        //议事投票默认积分规则
        ComActIntegralRuleDO integralRuleYSTPDO = new ComActIntegralRuleDO();
        integralRuleYSTPDO.setCommunityId(communityId);
        integralRuleYSTPDO.setName("参与议事投票");
        integralRuleYSTPDO.setAmount(0);
        integralRuleYSTPDO.setIntegralDescribe("参与议事投票");
        integralRuleYSTPDO.setIsRestrict(1);
        integralRuleYSTPDO.setType(ComActIntegralRuleDO.type.day);
        integralRuleYSTPDO.setCount(3);
        integralRuleYSTPDO.setIntegralType(ComActIntegralRuleDO.integralType.cyystp);
        integralRuleList.add(integralRuleYSTPDO);
        //志愿者活动默认积分规则
        ComActIntegralRuleDO integralRuleZYZDO = new ComActIntegralRuleDO();
        integralRuleZYZDO.setCommunityId(communityId);
        integralRuleZYZDO.setName("参与志愿者活动");
        integralRuleZYZDO.setAmount(0);
        integralRuleZYZDO.setIntegralDescribe("报名参加志愿者活动,仅限志愿者");
        integralRuleZYZDO.setIsRestrict(1);
        integralRuleZYZDO.setType(ComActIntegralRuleDO.type.month);
        integralRuleZYZDO.setCount(5);
        integralRuleZYZDO.setIntegralType(ComActIntegralRuleDO.integralType.cyzyzhd);
        integralRuleList.add(integralRuleZYZDO);
        //社区活动默认积分规则
        ComActIntegralRuleDO integralRuleSQHDDO = new ComActIntegralRuleDO();
        integralRuleSQHDDO.setCommunityId(communityId);
        integralRuleSQHDDO.setName("参与社区活动");
        integralRuleSQHDDO.setAmount(0);
        integralRuleSQHDDO.setIntegralDescribe("报名参加社区活动,所有人可参与");
        integralRuleSQHDDO.setIsRestrict(1);
        integralRuleSQHDDO.setType(ComActIntegralRuleDO.type.month);
        integralRuleSQHDDO.setCount(5);
        integralRuleSQHDDO.setIntegralType(ComActIntegralRuleDO.integralType.cysqhd);
        integralRuleList.add(integralRuleSQHDDO);
        //党员活动默认积分规则
        ComActIntegralRuleDO integralRuleDYHDDO = new ComActIntegralRuleDO();
        integralRuleDYHDDO.setCommunityId(communityId);
        integralRuleDYHDDO.setName("参与党员活动");
        integralRuleDYHDDO.setAmount(0);
        integralRuleDYHDDO.setIntegralDescribe("报名参加社区党员活动,党员可参与");
        integralRuleDYHDDO.setIsRestrict(1);
        integralRuleDYHDDO.setType(ComActIntegralRuleDO.type.day);
        integralRuleDYHDDO.setCount(3);
        integralRuleDYHDDO.setIntegralType(ComActIntegralRuleDO.integralType.cydyhd);
        integralRuleList.add(integralRuleDYHDDO);
        //党员活动默认积分规则
        ComActIntegralRuleDO integralRuleWJDCDO = new ComActIntegralRuleDO();
        integralRuleWJDCDO.setCommunityId(communityId);
        integralRuleWJDCDO.setName("参与问卷调查");
        integralRuleWJDCDO.setAmount(0);
        integralRuleWJDCDO.setIntegralDescribe("参与问卷调查");
        integralRuleWJDCDO.setIsRestrict(1);
        integralRuleWJDCDO.setType(ComActIntegralRuleDO.type.day);
        integralRuleWJDCDO.setCount(3);
        integralRuleWJDCDO.setIntegralType(ComActIntegralRuleDO.integralType.cydcwj);
        integralRuleList.add(integralRuleWJDCDO);
        return integralRuleList;
    }
    /**
     * 社区后台-编辑社区积分规则
     * @param integralRuleDTO   请求参数
     * @return  编辑结果
     */
    @Override
    public R editIntegralRuleAdmin(EditComActIntegralRuleDTO integralRuleDTO){
        //查询社区积分规则记录
        ComActIntegralRuleDO integralRuleDO = this.baseMapper.selectById(integralRuleDTO.getId());
        if(integralRuleDO == null){
            return R.fail("未找到积分规则记录");
        }
        BeanUtils.copyProperties(integralRuleDTO,integralRuleDO);
        if(integralRuleDTO.getIsRestrict().equals(ComActIntegralRuleDO.isRestrict.no)){
            integralRuleDO.setCount(null);
            integralRuleDO.setType(null);
        }
        integralRuleDO.setUpdateAt(new Date());
        if(this.baseMapper.updateById(integralRuleDO) > 0){
            return R.ok();
        }else {
            return R.fail("修改失败");
        }
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserChangeServiceImpl.java
New file
@@ -0,0 +1,95 @@
package com.panzhihua.service_community.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.service_community.dao.ComActIntegralUserChangeMapper;
import com.panzhihua.service_community.model.dos.ComActIntegralUserChangeDO;
import com.panzhihua.service_community.service.ComActIntegralUserChangeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
 * @auther lyq
 * @create 2021-07-28 16:03:05
 * @describe 用户积分账户变动记录服务实现类
 */
@Slf4j
@Service
public class ComActIntegralUserChangeServiceImpl extends ServiceImpl<ComActIntegralUserChangeMapper, ComActIntegralUserChangeDO> implements ComActIntegralUserChangeService {
    /**
     * 添加用户积分账户变动记录
     * @param userId    用户id
     * @param integralId    积分账户id
     * @param communityId   社区id
     * @param integralSumTop    总积分数量变动前
     * @param integralSumBack   总积分数量变动后
     * @param integralAvailableSumTop   可用总积分数量变动前
     * @param integralAvailableSumBack  可用总积分数量变动后
     * @param integralFrozenSumTop  冻结总积分数量变动前
     * @param integralFrozenSumBack 冻结总积分数量变动后
     * @param integralPartyTop  党员积分数量变动前
     * @param integralPartyBack 党员积分数量变动后
     * @param integralAvailablePartyTop 可用党员积分数量变动前
     * @param integralAvailablePartyBack    可用党员积分数量变动后
     * @param integralFrozenPartyTop    冻结党员积分数量变动前
     * @param integralFrozenPartyBack   冻结党员积分数量变动后
     * @param integralVolunteerTop  志愿者积分数量变动前
     * @param integralVolunteerBack 志愿者积分数量变动后
     * @param integralAvailableVolunteerTop 可用志愿者积分数量变动前
     * @param integralAvailableVolunteerBack    可用志愿者积分数量变动后
     * @param integralFrozenVolunteerTop    冻结志愿者积分数量变动前
     * @param integralFrozenVolunteerBack   冻结志愿者积分数量变动后
     * @param integralResidentTop   居民积分数量变动前
     * @param integralResidentBack  居民积分数量变动后
     * @param integralAvailableResidentTop  可用居民积分数量变动前
     * @param integralAvailableResidentBack 可用居民积分数量变动后
     * @param integralFrozenResidentTop 冻结居民积分数量变动前
     * @param integralFrozenResidentBack    冻结居民积分数量变动后
     * @param serviceId 交易记录id
     */
    @Override
    public void addIntegralUserChangeRecord(Long userId,Long integralId,Long communityId,Integer integralSumTop
            ,Integer integralSumBack,Integer integralAvailableSumTop,Integer integralAvailableSumBack,Integer integralFrozenSumTop
            ,Integer integralFrozenSumBack,Integer integralPartyTop,Integer integralPartyBack,Integer integralAvailablePartyTop
            ,Integer integralAvailablePartyBack,Integer integralFrozenPartyTop,Integer integralFrozenPartyBack,Integer integralVolunteerTop
            ,Integer integralVolunteerBack,Integer integralAvailableVolunteerTop,Integer integralAvailableVolunteerBack,Integer integralFrozenVolunteerTop
            ,Integer integralFrozenVolunteerBack,Integer integralResidentTop,Integer integralResidentBack,Integer integralAvailableResidentTop
            ,Integer integralAvailableResidentBack,Integer integralFrozenResidentTop,Integer integralFrozenResidentBack,Long serviceId){
        ComActIntegralUserChangeDO integralUserChangeDO = new ComActIntegralUserChangeDO();
        integralUserChangeDO.setId(Snowflake.getId());
        integralUserChangeDO.setUserId(userId);
        integralUserChangeDO.setIntegralId(integralId);
        integralUserChangeDO.setCommunityId(communityId);
        integralUserChangeDO.setIntegralSumTop(integralSumTop);
        integralUserChangeDO.setIntegralSumBack(integralSumBack);
        integralUserChangeDO.setIntegralAvailableSumTop(integralAvailableSumTop);
        integralUserChangeDO.setIntegralAvailableSumBack(integralAvailableSumBack);
        integralUserChangeDO.setIntegralFrozenSumTop(integralFrozenSumTop);
        integralUserChangeDO.setIntegralFrozenSumBack(integralFrozenSumBack);
        integralUserChangeDO.setIntegralPartyTop(integralPartyTop);
        integralUserChangeDO.setIntegralPartyBack(integralPartyBack);
        integralUserChangeDO.setIntegralAvailablePartyTop(integralAvailablePartyTop);
        integralUserChangeDO.setIntegralAvailablePartyBack(integralAvailablePartyBack);
        integralUserChangeDO.setIntegralFrozenPartyTop(integralFrozenPartyTop);
        integralUserChangeDO.setIntegralFrozenPartyBack(integralFrozenPartyBack);
        integralUserChangeDO.setIntegralVolunteerTop(integralVolunteerTop);
        integralUserChangeDO.setIntegralVolunteerBack(integralVolunteerBack);
        integralUserChangeDO.setIntegralAvailableVolunteerTop(integralAvailableVolunteerTop);
        integralUserChangeDO.setIntegralAvailableVolunteerBack(integralAvailableVolunteerBack);
        integralUserChangeDO.setIntegralFrozenVolunteerTop(integralFrozenVolunteerTop);
        integralUserChangeDO.setIntegralFrozenVolunteerBack(integralFrozenVolunteerBack);
        integralUserChangeDO.setIntegralResidentTop(integralResidentTop);
        integralUserChangeDO.setIntegralResidentBack(integralResidentBack);
        integralUserChangeDO.setIntegralAvailableResidentTop(integralAvailableResidentTop);
        integralUserChangeDO.setIntegralAvailableResidentBack(integralAvailableResidentBack);
        integralUserChangeDO.setIntegralFrozenResidentTop(integralFrozenResidentTop);
        integralUserChangeDO.setIntegralFrozenResidentBack(integralFrozenResidentBack);
        integralUserChangeDO.setServiceId(serviceId);
        integralUserChangeDO.setCreateAt(new Date());
        this.baseMapper.insert(integralUserChangeDO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserServiceImpl.java
New file
@@ -0,0 +1,265 @@
package com.panzhihua.service_community.service.impl;
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.constants.Constants;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCountDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserListVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserVO;
import com.panzhihua.common.model.vos.community.integral.IntegralUserRankVO;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.dao.ComActIntegralRuleMapper;
import com.panzhihua.service_community.dao.ComActIntegralUserMapper;
import com.panzhihua.service_community.dao.ComActUserWalletMapper;
import com.panzhihua.service_community.model.dos.ComActDO;
import com.panzhihua.service_community.model.dos.ComActIntegralRuleDO;
import com.panzhihua.service_community.model.dos.ComActIntegralUserDO;
import com.panzhihua.service_community.model.dos.ComActIntegralUserTradeDO;
import com.panzhihua.service_community.service.ComActIntegralRuleService;
import com.panzhihua.service_community.service.ComActIntegralUserService;
import com.panzhihua.service_community.service.ComActIntegralUserTradeService;
import com.panzhihua.service_community.service.ComActService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @auther lyq
 * @create 2021-07-28 16:02:57
 * @describe 用户积分账户表服务实现类
 */
@Slf4j
@Service
public class ComActIntegralUserServiceImpl extends ServiceImpl<ComActIntegralUserMapper, ComActIntegralUserDO> implements ComActIntegralUserService {
    @Resource
    private ComActUserWalletMapper comActUserWalletMapper;
    @Resource
    private ComActIntegralRuleService comActIntegralRuleService;
    @Resource
    private ComActIntegralUserTradeService comActIntegralUserTradeService;
    @Resource
    private ComActDAO comActDAO;
    /**
     * 小程序-查询积分说明
     * @return  积分说明
     */
    @Override
    public R getIntegralExplainApplets(){
        String result = "";
        Map<String,String> resultMap = comActUserWalletMapper.getAgreementContent(0L,6);
        if(resultMap != null){
            if(StringUtils.isEmpty(resultMap.get("content"))){
                comActUserWalletMapper.insertSysAgreement(Constants.INTEGRAL_EXPLAIN,"积分规则说明",0L,6);
                result = Constants.INTEGRAL_EXPLAIN;
            }else{
                result = resultMap.get("content");
            }
        }else{
            comActUserWalletMapper.insertSysAgreement(Constants.INTEGRAL_EXPLAIN,"积分规则说明",0L,6);
            result = Constants.INTEGRAL_EXPLAIN;
        }
        return R.ok(result);
    }
    /**
     * 用户查询当前社区可领取积分规则列表
     * @param userId    用户id
     * @param communityId   社区id
     * @return  可领取积分规则列表
     */
    @Override
    public R getIntegralReceiveApplets(Long userId,Long communityId){
        List<ComActIntegralUserRuleVO> integralUserRuleList = comActIntegralRuleService.getIntegralReceiveApplets(communityId);
        if(integralUserRuleList.isEmpty()){
            //如果没有查询到列表数据,增给社区增加默认规则列表再查询
            List<ComActIntegralRuleDO> integralRuleList = getIntegralRuleList(communityId);
            comActIntegralRuleService.saveBatch(integralRuleList);
            integralUserRuleList = comActIntegralRuleService.getIntegralReceiveApplets(communityId);
        }
        if(!integralUserRuleList.isEmpty()){
            integralUserRuleList.forEach(integralUserRule -> {
                if(integralUserRule.getIsRestrict().equals(ComActIntegralRuleDO.isRestrict.no)){
                    integralUserRule.setIsComplete(ComActIntegralUserRuleVO.isComplete.no);
                }else{
                    ComActIntegralCountDTO integralCountDTO = new ComActIntegralCountDTO();
                    integralCountDTO.setUserId(userId);
                    integralCountDTO.setCommunityId(communityId);
                    integralCountDTO.setType(ComActIntegralUserTradeDO.changeType.add);
                    if(integralUserRule.getType().equals(ComActIntegralRuleDO.type.month)){
                        integralCountDTO.setStartTime(DateUtils.getFirstDayOfMonthString());
                        integralCountDTO.setEndTime(DateUtils.getLastDayOfMonthString());
                    }else if(integralUserRule.getType().equals(ComActIntegralRuleDO.type.day)){
                        integralCountDTO.setStartTime(DateUtils.getDayOfMonthString() + " 00:00:00");
                        integralCountDTO.setEndTime(DateUtils.getDayOfMonthString() + " 23:59:59");
                    }
                    Integer count = comActIntegralUserTradeService.getIntegralCount(integralCountDTO);
                    if(count >= integralUserRule.getCount()){
                        integralUserRule.setIsComplete(ComActIntegralUserRuleVO.isComplete.yes);
                    }else{
                        integralUserRule.setIsComplete(ComActIntegralUserRuleVO.isComplete.no);
                    }
                }
            });
        }
        return R.ok(integralUserRuleList);
    }
    /**
     * 小程序-查询用户积分列表
     * @param userId    用户id
     * @return  用户积分列表
     */
    @Override
    public R getIntegralUserListApplets(Long userId,Long communityId){
        ComActIntegralUserVO integralUserVO = new ComActIntegralUserVO();
        Integer amount = 0;
        //查询该用户在本社区下的积分账户是否存在,不存在则需要给用户创建
        ComActIntegralUserDO integralUserDO = this.baseMapper.selectOne(new QueryWrapper<ComActIntegralUserDO>().lambda()
                .eq(ComActIntegralUserDO::getCommunityId,communityId).eq(ComActIntegralUserDO::getUserId,userId));
        if(integralUserDO == null){
            integralUserDO = new ComActIntegralUserDO();
            integralUserDO.setCommunityId(communityId);
            integralUserDO.setUserId(userId);
            integralUserDO.setCreateAt(new Date());
            this.baseMapper.insert(integralUserDO);
        }
        //查询用户积分账户列表
        List<ComActIntegralUserListVO> integralUserList = this.baseMapper.getIntegralUserListApplets(userId);
        if(!integralUserList.isEmpty()){
            for (ComActIntegralUserListVO integralUser:integralUserList) {
                //查询用户在本社区积分排行
                IntegralUserRankVO userRank = this.baseMapper.getIntegralUserRank(integralUser.getCommunityId(),userId);
                if(userRank != null){
                    integralUser.setRank(userRank.getRank());
                    amount += integralUser.getAmount();
                }
            }
        }
        //查询用户绑定社区名字
        ComActDO actDO = comActDAO.selectById(communityId);
        if(actDO != null){
            integralUserVO.setCommunityName(actDO.getName());
        }
        integralUserVO.setAmount(amount);
        integralUserVO.setIntegralUserList(integralUserList);
        return R.ok(integralUserVO);
    }
    /**
     * 加载默认社区积分规则列表
     * @param communityId   社区id
     * @return  默认积分规则列表
     */
    private List<ComActIntegralRuleDO> getIntegralRuleList(Long communityId){
        List<ComActIntegralRuleDO> integralRuleList = new ArrayList<>();
        //随手拍默认积分规则
        ComActIntegralRuleDO integralRuleSSPDO = new ComActIntegralRuleDO();
        integralRuleSSPDO.setCommunityId(communityId);
        integralRuleSSPDO.setName("发布随手拍");
        integralRuleSSPDO.setAmount(0);
        integralRuleSSPDO.setIntegralDescribe("发布随手拍并被公示后");
        integralRuleSSPDO.setIsRestrict(2);
        integralRuleSSPDO.setIntegralType(ComActIntegralRuleDO.integralType.fbssp);
        integralRuleList.add(integralRuleSSPDO);
        //微心愿默认积分规则
        ComActIntegralRuleDO integralRuleWXYDO = new ComActIntegralRuleDO();
        integralRuleWXYDO.setCommunityId(communityId);
        integralRuleWXYDO.setName("发布微心愿");
        integralRuleWXYDO.setAmount(0);
        integralRuleWXYDO.setIntegralDescribe("发布微心愿并完成后");
        integralRuleWXYDO.setIsRestrict(1);
        integralRuleWXYDO.setType(ComActIntegralRuleDO.type.month);
        integralRuleWXYDO.setCount(5);
        integralRuleWXYDO.setIntegralType(ComActIntegralRuleDO.integralType.fbssp);
        integralRuleList.add(integralRuleWXYDO);
        //议事投票默认积分规则
        ComActIntegralRuleDO integralRuleYSTPDO = new ComActIntegralRuleDO();
        integralRuleYSTPDO.setCommunityId(communityId);
        integralRuleYSTPDO.setName("参与议事投票");
        integralRuleYSTPDO.setAmount(0);
        integralRuleYSTPDO.setIntegralDescribe("参与议事投票");
        integralRuleYSTPDO.setIsRestrict(1);
        integralRuleYSTPDO.setType(ComActIntegralRuleDO.type.day);
        integralRuleYSTPDO.setCount(3);
        integralRuleYSTPDO.setIntegralType(ComActIntegralRuleDO.integralType.cyystp);
        integralRuleList.add(integralRuleYSTPDO);
        //志愿者活动默认积分规则
        ComActIntegralRuleDO integralRuleZYZDO = new ComActIntegralRuleDO();
        integralRuleZYZDO.setCommunityId(communityId);
        integralRuleZYZDO.setName("参与志愿者活动");
        integralRuleZYZDO.setAmount(0);
        integralRuleZYZDO.setIntegralDescribe("报名参加志愿者活动,仅限志愿者");
        integralRuleZYZDO.setIsRestrict(1);
        integralRuleZYZDO.setType(ComActIntegralRuleDO.type.month);
        integralRuleZYZDO.setCount(5);
        integralRuleZYZDO.setIntegralType(ComActIntegralRuleDO.integralType.cyzyzhd);
        integralRuleList.add(integralRuleZYZDO);
        //社区活动默认积分规则
        ComActIntegralRuleDO integralRuleSQHDDO = new ComActIntegralRuleDO();
        integralRuleSQHDDO.setCommunityId(communityId);
        integralRuleSQHDDO.setName("参与社区活动");
        integralRuleSQHDDO.setAmount(0);
        integralRuleSQHDDO.setIntegralDescribe("报名参加社区活动,所有人可参与");
        integralRuleSQHDDO.setIsRestrict(1);
        integralRuleSQHDDO.setType(ComActIntegralRuleDO.type.month);
        integralRuleSQHDDO.setCount(5);
        integralRuleSQHDDO.setIntegralType(ComActIntegralRuleDO.integralType.cysqhd);
        integralRuleList.add(integralRuleSQHDDO);
        //党员活动默认积分规则
        ComActIntegralRuleDO integralRuleDYHDDO = new ComActIntegralRuleDO();
        integralRuleDYHDDO.setCommunityId(communityId);
        integralRuleDYHDDO.setName("参与党员活动");
        integralRuleDYHDDO.setAmount(0);
        integralRuleDYHDDO.setIntegralDescribe("报名参加社区党员活动,党员可参与");
        integralRuleDYHDDO.setIsRestrict(1);
        integralRuleDYHDDO.setType(ComActIntegralRuleDO.type.day);
        integralRuleDYHDDO.setCount(3);
        integralRuleDYHDDO.setIntegralType(ComActIntegralRuleDO.integralType.cydyhd);
        integralRuleList.add(integralRuleDYHDDO);
        //党员活动默认积分规则
        ComActIntegralRuleDO integralRuleWJDCDO = new ComActIntegralRuleDO();
        integralRuleWJDCDO.setCommunityId(communityId);
        integralRuleWJDCDO.setName("参与问卷调查");
        integralRuleWJDCDO.setAmount(0);
        integralRuleWJDCDO.setIntegralDescribe("参与问卷调查");
        integralRuleWJDCDO.setIsRestrict(1);
        integralRuleWJDCDO.setType(ComActIntegralRuleDO.type.day);
        integralRuleWJDCDO.setCount(3);
        integralRuleWJDCDO.setIntegralType(ComActIntegralRuleDO.integralType.cydcwj);
        integralRuleList.add(integralRuleWJDCDO);
        return integralRuleList;
    }
    /**
     * 查询社区积分账户排行榜
     * @param communityRankDTO  请求参数
     * @return  社区积分账户排行榜
     */
    @Override
    public R getIntegralCommunityRankApplets(ComActIntegralCommunityRankDTO communityRankDTO){
        return R.ok(this.baseMapper.getIntegralCommunityRankApplets(new Page(communityRankDTO.getPageNum(),communityRankDTO.getPageSize()),communityRankDTO));
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserTradeServiceImpl.java
New file
@@ -0,0 +1,342 @@
package com.panzhihua.service_community.service.impl;
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.integral.ComActIntegralCommunityRankDTO;
import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCountDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO;
import com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralTradeDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO;
import com.panzhihua.common.model.vos.community.integral.admin.ComActIntegralUserTradeAdminVO;
import com.panzhihua.common.model.vos.community.integral.admin.IntegralUserVO;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.service_community.dao.ComActDiscussDAO;
import com.panzhihua.service_community.dao.ComActIntegralUserTradeMapper;
import com.panzhihua.service_community.dao.ComActQuestnaireDAO;
import com.panzhihua.service_community.model.dos.*;
import com.panzhihua.service_community.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
/**
 * @auther lyq
 * @create 2021-07-28 16:03:18
 * @describe 用户积分账户交易记录服务实现类
 */
@Slf4j
@Service
public class ComActIntegralUserTradeServiceImpl extends ServiceImpl<ComActIntegralUserTradeMapper, ComActIntegralUserTradeDO> implements ComActIntegralUserTradeService {
    @Resource
    private ComActIntegralRuleService comActIntegralRuleService;
    @Resource
    private ComActIntegralUserService comActIntegralUserService;
    @Resource
    private ComActQuestnaireDAO comActQuestnaireDAO;
    @Resource
    private ComActIntegralUserChangeService comActIntegralUserChangeService;
    @Resource
    private ComActEasyPhotoService comActEasyPhotoService;
    @Resource
    private ComActMicroWishService comActMicroWishService;
    @Resource
    private ComActDiscussDAO comActDiscussDAO;
    /**
     * 查询用户某个时间段交易数量
     * @param integralCountDTO  请求参数
     * @return  交易数量
     */
    @Override
    public Integer getIntegralCount(ComActIntegralCountDTO integralCountDTO){
        return this.baseMapper.getIntegralCount(integralCountDTO);
    }
    /**
     * 添加用户积分交易记录
     * @param userId    用户id
     * @param integralId    积分账户id
     * @param communityId   社区id
     * @param serviceId     交易业务id
     * @param serviceType   交易业务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)
     * @param amount    交易积分数量
     * @param changeType    变动类型(1.增加  2.减少)
     * @param remark    交易备注
     * @param identityType  交易身份类型(1.居民 2.党员 3.志愿者)
     * @param createBy  操作人id
     */
    @Override
    public Long addIntegralTradeRecord(Long userId,Long integralId,Long communityId,Long serviceId
            ,Integer serviceType,Integer amount,Integer changeType,String remark,Integer identityType,Long createBy){
        ComActIntegralUserTradeDO integralUserTradeDO = new ComActIntegralUserTradeDO();
        integralUserTradeDO.setId(Snowflake.getId());
        integralUserTradeDO.setUserId(userId);
        integralUserTradeDO.setIntegralId(integralId);
        integralUserTradeDO.setCommunityId(communityId);
        integralUserTradeDO.setServiceId(serviceId);
        integralUserTradeDO.setServiceType(serviceType);
        integralUserTradeDO.setAmount(amount);
        integralUserTradeDO.setChangeType(changeType);
        integralUserTradeDO.setRemark(remark);
        integralUserTradeDO.setIdentityType(identityType);
        integralUserTradeDO.setCreateBy(createBy);
        integralUserTradeDO.setCreateAt(new Date());
        this.baseMapper.insert(integralUserTradeDO);
        return integralUserTradeDO.getId();
    }
    /**
     * 小程序-查询用户社区积分明细
     * @param communityTradeDTO 请求参数
     * @return  用户社区积分明细
     */
    @Override
    public R getIntegralCommunityTradeApplets(ComActIntegralCommunityRankDTO communityTradeDTO){
        if(communityTradeDTO.getType().equals(ComActIntegralCommunityRankDTO.type.resident)){
            communityTradeDTO.setIdentityType(ComActIntegralCommunityRankDTO.type.resident);
        }else if(communityTradeDTO.getType().equals(ComActIntegralCommunityRankDTO.type.party)){
            communityTradeDTO.setIdentityType(ComActIntegralCommunityRankDTO.type.party);
        }else if(communityTradeDTO.getType().equals(ComActIntegralCommunityRankDTO.type.volunteer)){
            communityTradeDTO.setIdentityType(ComActIntegralCommunityRankDTO.type.volunteer);
        }
        return R.ok(this.baseMapper.getIntegralCommunityTradeApplets(new Page(communityTradeDTO.getPageNum(),communityTradeDTO.getPageSize()),communityTradeDTO));
    }
    /**
     * 社区后台-分页查询社区下积分明细记录
     * @param integralRuleDTO   请求参数
     * @return  社区下积分明细记录
     */
    @Override
    public R getIntegralTradeListAdmin(PageComActIntegralTradeDTO integralRuleDTO){
        IPage<ComActIntegralUserTradeAdminVO> userTradeAdminIPage = this.baseMapper.getIntegralTradeListAdmin(new Page(integralRuleDTO.getPageNum(),integralRuleDTO.getPageSize()),integralRuleDTO);
        if(!userTradeAdminIPage.getRecords().isEmpty()){
            userTradeAdminIPage.getRecords().forEach(userTrade -> {
                StringBuilder sb = new StringBuilder();
                sb.append("居民");
                if(userTrade.getIsVolunteer().equals(ComActIntegralUserTradeAdminVO.isVolunteer.yes)){
                    sb.append(",志愿者");
                }
                if(userTrade.getIsPartymember().equals(ComActIntegralUserTradeAdminVO.isPartymember.yes)){
                    sb.append(",党员");
                }
                userTrade.setIdentity(sb.toString());
            });
        }
        return R.ok(userTradeAdminIPage);
    }
    /**
     * 给用户添加积分
     * @param integralUserDTO   请求参数
     * @return  添加积分结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R addIntegralTradeAdmin(AddComActIntegralUserDTO integralUserDTO){
        //判断增加积分类型  积分任务类型(1.发布随手拍 2.发布微心愿 3.参与议事投票 4.参与志愿者活动 5.参与社区活动 6.参与党员活动 7.参与调查问卷)
        Integer type = integralUserDTO.getIntegralType();
        //业务id
        Long serviceId = integralUserDTO.getServiceId();
        //用户id
        Long userId = integralUserDTO.getUserId();
        //社区id
        Long communityId = integralUserDTO.getCommunityId();
        //需要给用户增加的积分数量
        Integer amount = 0;
        //用户增加积分的身份
        Integer identityType = 1;
        //用户交易备注
        StringBuilder remark = new StringBuilder();
        //当前时间
        Date nowDate = new Date();
        //查询随手拍增加积分数量
        ComActIntegralRuleDO integralRuleDO = comActIntegralRuleService.getOne(new QueryWrapper<ComActIntegralRuleDO>().lambda()
                .eq(ComActIntegralRuleDO::getIntegralType,type)
                .eq(ComActIntegralRuleDO::getCommunityId,communityId));
        if(integralRuleDO == null){
            log.error("未查询到该社区积分规则,社区id:" + communityId);
            return R.fail("未查询到该社区积分规则,社区id:" + communityId);
        }
        //判断规则是否有次数限制
        if(integralRuleDO.getIsRestrict().equals(ComActIntegralRuleDO.isRestrict.yes)){
            Integer count = this.baseMapper.getIntegralCount(getIntegralCountDTO(integralRuleDO.getType(),userId,communityId));
            if(count >= integralRuleDO.getCount()){
                log.error("该用户参加任务次数已达上限");
                return R.fail("该用户参加任务次数已达上限");
            }
        }
        amount = integralRuleDO.getAmount();
        switch (type){
            case 1:
                remark.append("发布随手拍奖励积分");
                ComActEasyPhotoDO easyPhotoDO = comActEasyPhotoService.getById(serviceId);
                if(easyPhotoDO != null){
                    remark.append("【");
                    remark.append(easyPhotoDO.getDetail());
                    remark.append("】");
                }
                break;
            case 2:
                remark.append("发布微心愿奖励积分");
                ComActMicroWishDO microWishDO = comActMicroWishService.getById(serviceId);
                if(microWishDO != null){
                    remark.append("【");
                    remark.append(microWishDO.getWishName());
                    remark.append("】");
                }
                break;
            case 3:
                remark.append("参与议事投票奖励积分");
                ComActDiscussDO discussDO = comActDiscussDAO.selectById(serviceId);
                if(discussDO != null){
                    remark.append("【");
                    remark.append(discussDO.getVoteTitle());
                    remark.append("】");
                }
                break;
            case 4:
                identityType = 3;
                remark.append("参与志愿者活动奖励积分");
                break;
            case 5:
                remark.append("参与社区活动奖励积分");
                break;
            case 6:
                identityType = 2;
                remark.append("参与党员活动奖励积分");
                break;
            case 7:
                //查询调查问卷
                ComActQuestnaireDO questnaireDO = comActQuestnaireDAO.selectById(serviceId);
                if(questnaireDO == null){
                    log.error("未查询到调查问卷记录,记录积分失败");
                    return R.fail("未查询到调查问卷记录,记录积分失败");
                }
                //查询当前用户信息
                IntegralUserVO integralUser = this.baseMapper.getUserInfo(userId);
                if(integralUser == null){
                    log.error("未查询到用户信息,记录积分失败");
                    return R.fail("未查询到用户信息,记录积分失败");
                }
                //判断调查问卷调查的对象是什么身份,如果是党员和志愿者两种身份,则记录志愿者积分
                if(questnaireDO.getForParty() && integralUser.getIsPartymember().equals(1)){
                    identityType = 2;
                    if(questnaireDO.getForVolunteer() && integralUser.getIsVolunteer().equals(1)){
                        identityType = 3;
                    }
                }
                if(questnaireDO.getForVolunteer() && integralUser.getIsVolunteer().equals(1)){
                    identityType = 3;
                }
                remark.append("参与调查问卷奖励积分");
                break;
            default:
                break;
        }
        //查询用户积分账户
        ComActIntegralUserDO integralUserDO = comActIntegralUserService.getOne(new QueryWrapper<ComActIntegralUserDO>().lambda()
                .eq(ComActIntegralUserDO::getUserId,userId).eq(ComActIntegralUserDO::getCommunityId,communityId));
        if(integralUserDO == null){
            integralUserDO = new ComActIntegralUserDO();
            integralUserDO.setCommunityId(communityId);
            integralUserDO.setUserId(userId);
            integralUserDO.setCreateAt(nowDate);
            integralUserDO.setStatus(ComActIntegralUserDO.status.yes);
            integralUserDO.setIntegralSum(0);
            integralUserDO.setIntegralAvailableSum(0);
            integralUserDO.setIntegralFrozenSum(0);
            integralUserDO.setIntegralParty(0);
            integralUserDO.setIntegralAvailableParty(0);
            integralUserDO.setIntegralFrozenParty(0);
            integralUserDO.setIntegralVolunteer(0);
            integralUserDO.setIntegralAvailableVolunteer(0);
            integralUserDO.setIntegralFrozenVolunteer(0);
            integralUserDO.setIntegralResident(0);
            integralUserDO.setIntegralAvailableResident(0);
            integralUserDO.setIntegralFrozenResident(0);
            comActIntegralUserService.save(integralUserDO);
        }
        if(integralUserDO.getStatus().equals(ComActIntegralUserDO.status.no)){
            log.error("用户钱包已被禁用,记录积分失败,用户id:" + userId);
            return R.fail("用户钱包已被禁用,记录积分失败,用户id:" + userId);
        }
        Long integralId = integralUserDO.getId();
        //记录变动前钱包金额
        Integer integralSum = integralUserDO.getIntegralSum();
        Integer integralAvailableSum = integralUserDO.getIntegralAvailableSum();
        Integer integralFrozenSum = integralUserDO.getIntegralFrozenSum();
        Integer integralParty = integralUserDO.getIntegralParty();
        Integer integralAvailableParty = integralUserDO.getIntegralAvailableParty();
        Integer integralFrozenParty = integralUserDO.getIntegralFrozenParty();
        Integer integralVolunteer = integralUserDO.getIntegralVolunteer();
        Integer integralAvailableVolunteer = integralUserDO.getIntegralAvailableVolunteer();
        Integer integralFrozenVolunteer = integralUserDO.getIntegralFrozenVolunteer();
        Integer integralResident = integralUserDO.getIntegralResident();
        Integer integralAvailableResident = integralUserDO.getIntegralAvailableResident();
        Integer integralFrozenResident = integralUserDO.getIntegralFrozenResident();
        integralUserDO.setIntegralSum(integralUserDO.getIntegralSum() + amount);
        integralUserDO.setIntegralAvailableSum(integralUserDO.getIntegralAvailableSum() + amount);
        integralUserDO.setUpdateAt(nowDate);
        //根据不同身份,计算钱包金额
        if(identityType.equals(ComActIntegralUserTradeDO.identityType.jm)){
            integralUserDO.setIntegralResident(integralUserDO.getIntegralResident() + amount);
            integralUserDO.setIntegralAvailableResident(integralUserDO.getIntegralAvailableResident() + amount);
        }else if(identityType.equals(ComActIntegralUserTradeDO.identityType.dy)){
            integralUserDO.setIntegralParty(integralUserDO.getIntegralParty() + amount);
            integralUserDO.setIntegralAvailableParty(integralUserDO.getIntegralAvailableParty() + amount);
        }else if(identityType.equals(ComActIntegralUserTradeDO.identityType.zyz)){
            integralUserDO.setIntegralVolunteer(integralUserDO.getIntegralVolunteer() + amount);
            integralUserDO.setIntegralAvailableVolunteer(integralUserDO.getIntegralAvailableVolunteer() + amount);
        }
        //更新钱包
        comActIntegralUserService.updateById(integralUserDO);
        //增加积分账户交易记录
        Long tradeId = this.addIntegralTradeRecord(userId,integralId,communityId,serviceId,type,amount
                ,ComActIntegralUserTradeDO.changeType.add,remark.toString(),identityType,2L);
        //增加积分账户变更记录
        comActIntegralUserChangeService.addIntegralUserChangeRecord(userId,integralId,communityId,integralSum,integralUserDO.getIntegralSum()
                ,integralAvailableSum,integralUserDO.getIntegralAvailableSum(),integralFrozenSum,integralUserDO.getIntegralFrozenSum()
                ,integralParty,integralUserDO.getIntegralParty(),integralAvailableParty,integralUserDO.getIntegralAvailableParty()
                ,integralFrozenParty,integralUserDO.getIntegralFrozenParty(),integralVolunteer,integralUserDO.getIntegralVolunteer()
                ,integralAvailableVolunteer,integralUserDO.getIntegralAvailableVolunteer(),integralFrozenVolunteer,integralUserDO.getIntegralFrozenVolunteer()
                ,integralResident,integralUserDO.getIntegralResident(),integralAvailableResident,integralUserDO.getIntegralAvailableResident()
                ,integralFrozenResident,integralUserDO.getIntegralFrozenResident(),tradeId);
        return R.ok();
    }
    /**
     * 根据类型、用户id、社区id构建查询请求参数
     * @param type  类型
     * @param userId    用户id
     * @param communityId   社区id
     * @return  查询请求参数
     */
    private ComActIntegralCountDTO getIntegralCountDTO(Integer type,Long userId,Long communityId){
        ComActIntegralCountDTO integralCountDTO = new ComActIntegralCountDTO();
        integralCountDTO.setUserId(userId);
        integralCountDTO.setCommunityId(communityId);
        integralCountDTO.setType(ComActIntegralUserTradeDO.changeType.add);
        if(type.equals(ComActIntegralRuleDO.type.month)){
            integralCountDTO.setStartTime(DateUtils.getFirstDayOfMonthString());
            integralCountDTO.setEndTime(DateUtils.getLastDayOfMonthString());
        }else if(type.equals(ComActIntegralRuleDO.type.day)){
            integralCountDTO.setStartTime(DateUtils.getDayOfMonthString() + " 00:00:00");
            integralCountDTO.setEndTime(DateUtils.getDayOfMonthString() + " 23:59:59");
        }
        return integralCountDTO;
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActUserWalletServiceImpl.java
@@ -76,11 +76,11 @@
            this.baseMapper.insert(userWalletDO);
        }
        BeanUtils.copyProperties(userWalletDO,comActWalletVO);
        Map<String,String> resultMap = this.baseMapper.getCommunityName(walletDetailDTO.getCommunityId());
        Map<String,String> resultMap = this.baseMapper.getCommunityName(walletDetailDTO.getCommunityId(),5);
        if(!resultMap.isEmpty()){
            comActWalletVO.setCommunityName(resultMap.get("name"));
            if(StringUtils.isEmpty(resultMap.get("content"))){
                this.baseMapper.insertSysAgreement(Constants.PROFIT_EXPLAIN,walletDetailDTO.getCommunityId());
                this.baseMapper.insertSysAgreement(Constants.PROFIT_EXPLAIN,"收益说明",walletDetailDTO.getCommunityId(),5);
                comActWalletVO.setAgreement(Constants.PROFIT_EXPLAIN);
            }else{
                comActWalletVO.setAgreement(resultMap.get("content"));
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActIntegralRuleDOMapper.xml
New file
@@ -0,0 +1,33 @@
<?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.ComActIntegralRuleMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActIntegralRuleDO">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="community_id" property="communityId" />
        <result column="amount" property="amount" />
        <result column="integral_describe" property="integralDescribe" />
        <result column="is_restrict" property="isRestrict" />
        <result column="type" property="type" />
        <result column="count" property="count" />
        <result column="create_at" property="createAt" />
        <result column="update_at" property="updateAt" />
        <result column="integral_type" property="integralType" />
        <result column="remark" property="remark" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, community_id, amount, integral_describe, is_restrict, type, count, create_at, update_at, integral_type, remark
    </sql>
    <select id="getIntegralReceiveApplets" resultType="com.panzhihua.common.model.vos.community.integral.ComActIntegralUserRuleVO">
        select id,`name`,amount,integral_describe,is_restrict,type,count,integral_type,remark from com_act_integral_rule where community_id = #{communityId}
    </select>
    <select id="getIntegralRuleAdminList" resultType="com.panzhihua.common.model.vos.community.integral.admin.ComActIntegralUserRuleAdminVO">
        select id,`name`,amount,integral_describe,is_restrict,type,count,integral_type,remark,create_at,update_at from com_act_integral_rule where community_id = #{integralRuleDTO.communityId}
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActIntegralUserChangeDOMapper.xml
New file
@@ -0,0 +1,44 @@
<?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.ComActIntegralUserChangeMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActIntegralUserChangeDO">
        <id column="id" property="id" />
        <result column="user_id" property="userId" />
        <result column="integral_id" property="integralId" />
        <result column="community_id" property="communityId" />
        <result column="integral_sum_top" property="integralSumTop" />
        <result column="integral_sum_back" property="integralSumBack" />
        <result column="integral_available_sum_top" property="integralAvailableSumTop" />
        <result column="integral_available_sum_back" property="integralAvailableSumBack" />
        <result column="integral_frozen_sum_top" property="integralFrozenSumTop" />
        <result column="integral_frozen_sum_back" property="integralFrozenSumBack" />
        <result column="integral_party_top" property="integralPartyTop" />
        <result column="integral_party_back" property="integralPartyBack" />
        <result column="integral_available_party_top" property="integralAvailablePartyTop" />
        <result column="integral_available_party_back" property="integralAvailablePartyBack" />
        <result column="integral_frozen_party_top" property="integralFrozenPartyTop" />
        <result column="integral_frozen_party_back" property="integralFrozenPartyBack" />
        <result column="integral_volunteer_top" property="integralVolunteerTop" />
        <result column="integral_volunteer_back" property="integralVolunteerBack" />
        <result column="integral_available_volunteer_top" property="integralAvailableVolunteerTop" />
        <result column="integral_available_volunteer_back" property="integralAvailableVolunteerBack" />
        <result column="integral_frozen_volunteer_top" property="integralFrozenVolunteerTop" />
        <result column="integral_frozen_volunteer_back" property="integralFrozenVolunteerBack" />
        <result column="integral_resident_top" property="integralResidentTop" />
        <result column="integral_resident_back" property="integralResidentBack" />
        <result column="integral_available_resident_top" property="integralAvailableResidentTop" />
        <result column="integral_available_resident_back" property="integralAvailableResidentBack" />
        <result column="integral_frozen_resident_top" property="integralFrozenResidentTop" />
        <result column="integral_frozen_resident_back" property="integralFrozenResidentBack" />
        <result column="service_id" property="serviceId" />
        <result column="create_at" property="createAt" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, user_id, integral_id, community_id, integral_sum_top, integral_sum_back, integral_available_sum_top, integral_available_sum_back, integral_frozen_sum_top, integral_frozen_sum_back, integral_party_top, integral_party_back, integral_available_party_top, integral_available_party_back, integral_frozen_party_top, integral_frozen_party_back, integral_volunteer_top, integral_volunteer_back, integral_available_volunteer_top, integral_available_volunteer_back, integral_frozen_volunteer_top, integral_frozen_volunteer_back, integral_resident_top, integral_resident_back, integral_available_resident_top, integral_available_resident_back, integral_frozen_resident_top, integral_frozen_resident_back, service_id, create_at
    </sql>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActIntegralUserDOMapper.xml
New file
@@ -0,0 +1,116 @@
<?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.ComActIntegralUserMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActIntegralUserDO">
        <id column="id" property="id" />
        <result column="user_id" property="userId" />
        <result column="community_id" property="communityId" />
        <result column="integral_sum" property="integralSum" />
        <result column="integral_available_sum" property="integralAvailableSum" />
        <result column="integral_frozen_sum" property="integralFrozenSum" />
        <result column="integral_party" property="integralParty" />
        <result column="integral_available_party" property="integralAvailableParty" />
        <result column="integral_frozen_party" property="integralFrozenParty" />
        <result column="integral_volunteer" property="integralVolunteer" />
        <result column="integral_available_volunteer" property="integralAvailableVolunteer" />
        <result column="integral_frozen_volunteer" property="integralFrozenVolunteer" />
        <result column="integral_resident" property="integralResident" />
        <result column="integral_available_resident" property="integralAvailableResident" />
        <result column="integral_frozen_resident" property="integralFrozenResident" />
        <result column="create_at" property="createAt" />
        <result column="update_at" property="updateAt" />
        <result column="status" property="status" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, user_id, community_id, integral_sum, integral_available_sum, integral_frozen_sum, integral_party, integral_available_party, integral_frozen_party, integral_volunteer, integral_available_volunteer, integral_frozen_volunteer, integral_resident, integral_available_resident, integral_frozen_resident, create_at, update_at
    </sql>
    <select id="getIntegralUserListApplets" resultType="com.panzhihua.common.model.vos.community.integral.ComActIntegralUserListVO">
        SELECT
            caiu.integral_sum as amount,
            caiu.community_id,
            ca.`name` AS communityName
        FROM
            com_act_integral_user AS caiu
            LEFT JOIN com_act AS ca ON ca.community_id = caiu.community_id
        WHERE
            caiu.user_id = #{userId}
    </select>
    <select id="getIntegralUserRank" resultType="com.panzhihua.common.model.vos.community.integral.IntegralUserRankVO">
        SELECT
            *
        FROM
            (
            SELECT
                t1.user_id,
                @rank := @rank + 1 AS rank
            FROM
                (
                SELECT
                    caiu.user_id,
                    caiu.integral_sum
                FROM
                    com_act_integral_user as caiu
                    left join sys_user as su on su.user_id = caiu.user_id
                WHERE
                    caiu.community_id = #{communityId}
                ORDER BY
                    caiu.integral_sum DESC,su.create_at asc
                 ) AS t1,
                ( SELECT @rank := 0 ) AS t2
            ) AS m
        WHERE
            user_id = #{userId}
    </select>
    <select id="getIntegralCommunityRankApplets" parameterType="com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO"
            resultType="com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityRankVO">
        SELECT
            su.nick_name,
            su.image_url,
            <if test="communityRankDTO.type == 1">
                caiu.integral_sum as amount,
            </if>
            <if test="communityRankDTO.type == 2">
                caiu.integral_resident as amount,
            </if>
            <if test="communityRankDTO.type == 3">
                caiu.integral_volunteer as amount,
            </if>
            <if test="communityRankDTO.type == 4">
                caiu.integral_party as amount,
            </if>
            su.is_partymember,
            su.is_volunteer
        FROM
            com_act_integral_user AS caiu
            LEFT JOIN sys_user AS su ON su.user_id = caiu.user_id
        WHERE
            caiu.community_id = #{communityRankDTO.communityId}
            <if test="communityRankDTO.type == 3">
                and su.is_volunteer = 1
            </if>
            <if test="communityRankDTO.type == 4">
                and su.is_partymember = 1
            </if>
            <if test="communityRankDTO.type == 1">
                order by caiu.integral_sum desc,su.create_at asc
            </if>
            <if test="communityRankDTO.type == 2">
                order by caiu.integral_resident desc,su.create_at asc
            </if>
            <if test="communityRankDTO.type == 3">
                order by caiu.integral_volunteer desc,su.create_at asc
            </if>
            <if test="communityRankDTO.type == 4">
                order by caiu.integral_party desc,su.create_at asc
            </if>
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActIntegralUserTradeDOMapper.xml
New file
@@ -0,0 +1,100 @@
<?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.ComActIntegralUserTradeMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActIntegralUserTradeDO">
        <id column="id" property="id" />
        <result column="user_id" property="userId" />
        <result column="integral_id" property="integralId" />
        <result column="community_id" property="communityId" />
        <result column="service_id" property="serviceId" />
        <result column="service_type" property="serviceType" />
        <result column="amount" property="amount" />
        <result column="change_type" property="changeType" />
        <result column="remark" property="remark" />
        <result column="identity_type" property="identityType" />
        <result column="create_at" property="createAt" />
        <result column="create_by" property="createBy" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, user_id, integral_id, community_id, service_id, service_type, amount, change_type, remark, identity_type, create_at, create_by
    </sql>
    <select id="getIntegralCount" resultType="Integer" parameterType="com.panzhihua.common.model.dtos.community.integral.ComActIntegralCountDTO">
        select count(id) from com_act_integral_user_trade where community_id = #{integralCountDTO.communityId} and user_id = #{integralCountDTO.userId} and change_type = #{integralCountDTO.type} and create_at between #{integralCountDTO.startTime} and #{integralCountDTO.endTime}
    </select>
    <select id="getIntegralCommunityTradeApplets" parameterType="com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO"
            resultType="com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityTradeVO">
        SELECT
            caiut.amount,
            caiut.service_type,
            caiut.remark,
            caiut.create_at,
            caiut.change_type,
            caiut.identity_type,
            ca.`name` AS communityName
        FROM
            com_act_integral_user_trade AS caiut
            LEFT JOIN com_act AS ca ON ca.community_id = caiut.community_id
            <where>
                <if test="communityTradeDTO.communityId != null">
                    and caiut.community_id = #{communityTradeDTO.communityId}
                </if>
                <if test="communityTradeDTO.userId != null">
                    and caiut.user_id = #{communityTradeDTO.userId}
                </if>
                <if test="communityTradeDTO.identityType != null">
                    and caiut.identity_type = #{communityTradeDTO.identityType}
                </if>
            </where>
            order by caiut.create_at desc
    </select>
    <select id="getIntegralTradeListAdmin" parameterType="com.panzhihua.common.model.dtos.community.integral.admin.PageComActIntegralTradeDTO"
            resultType="com.panzhihua.common.model.vos.community.integral.admin.ComActIntegralUserTradeAdminVO">
        SELECT
            caiut.id,
            su.nick_name,
            su.phone,
            su.`name`,
            su.is_volunteer,
            su.is_partymember,
            caiut.amount,
            caiut.identity_type,
            caiut.remark,
            caiut.create_at
        FROM
            com_act_integral_user_trade AS caiut
            LEFT JOIN sys_user AS su ON su.user_id = caiut.user_id
            <where>
                <if test="integralRuleDTO.communityId != null">
                    and caiut.community_id = #{integralRuleDTO.communityId}
                </if>
                <if test="integralRuleDTO.identityType != null">
                    and caiut.identity_type = #{integralRuleDTO.identityType}
                </if>
                <if test="integralRuleDTO.name != null and integralRuleDTO.name != &quot;&quot;">
                    and (su.nick_name like concat (#{integralRuleDTO.name},'%') or su.name like concat (#{integralRuleDTO.name},'%'))
                </if>
                <if test="integralRuleDTO.phone != null and integralRuleDTO.phone != &quot;&quot;">
                    and su.phone = #{integralRuleDTO.phone}
                </if>
                <if test="integralRuleDTO.userIdentity != null and integralRuleDTO.userIdentity == 2">
                    and su.is_partymember = 1
                </if>
                <if test="integralRuleDTO.userIdentity != null and integralRuleDTO.userIdentity == 3">
                    and su.is_volunteer = 1
                </if>
            </where>
    </select>
    <select id="getUserInfo" resultType="com.panzhihua.common.model.vos.community.integral.admin.IntegralUserVO">
        select user_id,phone,nick_name,id_card,`name`,`status`,is_volunteer,is_partymember,create_at,update_at from sys_user where user_id = #{userId}
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActUserWalletDOMapper.xml
@@ -28,7 +28,18 @@
            com_act AS ca
            LEFT JOIN sys_user_agreement AS sua ON sua.community_id = ca.community_id
        WHERE
            ca.community_id = #{communityId}
            ca.community_id = #{communityId} and sua.type = #{type}
    </select>
    <select id="getAgreementContent" resultType="Map">
        SELECT
            ca.`name`,
            sua.content
        FROM
            sys_user_agreement AS sua
            LEFT JOIN com_act AS ca ON sua.community_id = ca.community_id
        WHERE
            sua.community_id = #{communityId} and sua.type = #{type}
    </select>
    <select id="getWalletRanking" resultType="com.panzhihua.common.model.vos.community.wallet.ComActWalletRankingVO">
@@ -75,7 +86,7 @@
    </select>
    <insert id="insertSysAgreement">
        insert into sys_user_agreement(`type`,content,create_at,`name`,community_id) values (5,#{content},now(),'收益说明',#{communityId})
        insert into sys_user_agreement(`type`,content,create_at,`name`,community_id) values (#{type},#{content},now(),#{name},#{communityId})
    </insert>
</mapper>