Browse Source

居民端-志愿者银行-用户公益积分记录接口 init

feature/screenDataPush
liuchuang 4 years ago
parent
commit
651af2be4d
  1. 34
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/form/VolunteerPointsRecordsFormDTO.java
  2. 5
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/result/VolunteerPointsRecordsResultDTO.java
  3. 23
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/VolunteerPointsAnalysisCotroller.java
  4. 11
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/VolunteerPointsAnalysisDao.java
  5. 12
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/VolunteerPointsAnalysisService.java
  6. 9
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/VolunteerPointsAnalysisServiceImpl.java
  7. 22
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/VolunteerPointsAnalysisDao.xml
  8. 34
      esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/form/ApiVolunteerPointsRecordsFormDTO.java
  9. 44
      esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/result/ApiVolunteerPointsRecordsResultDTO.java
  10. 17
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiPointsController.java
  11. 15
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AnalysisFeignClient.java
  12. 9
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AnalysisFeignClientFallback.java
  13. 13
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/PointsService.java
  14. 11
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/PointsServiceImpl.java

34
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/form/VolunteerPointsRecordsFormDTO.java

@ -0,0 +1,34 @@
package com.elink.esua.epdc.dto.user.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Authorliuchuang
* @Date2021/7/19 16:07
*/
@Data
public class VolunteerPointsRecordsFormDTO implements Serializable {
private static final long serialVersionUID = 1625467226873432125L;
/**
* 页码
*/
@Min(value = 1, message = "页码必须大于0")
private Integer pageIndex;
/**
* 页容量
*/
@Min(value = 1, message = "每页条数必须大于0")
private Integer pageSize;
/**
* 用户ID
*/
@NotBlank(message = "获取用户信息失败")
private String userId;
}

5
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/result/VolunteerPointsRecordsResultDTO.java

@ -36,4 +36,9 @@ public class VolunteerPointsRecordsResultDTO implements Serializable {
* 积分
*/
private Integer volunteerPoints;
/**
* 积分操作类型 0-减积分1-加积分
*/
private String operationType;
}

23
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/VolunteerPointsAnalysisCotroller.java

@ -2,16 +2,16 @@ package com.elink.esua.epdc.modules.user.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.dto.user.form.VolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO;
import com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO;
import com.elink.esua.epdc.modules.user.service.VolunteerPointsAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -68,4 +68,19 @@ public class VolunteerPointsAnalysisCotroller {
PageData<VolunteerPointsRecordsResultDTO> data = volunteerPointsAnalysisService.volunteerPointsRecords(params);
return new Result<PageData<VolunteerPointsRecordsResultDTO>>().ok(data);
}
/**
* 居民端-志愿者银行-用户公益积分记录
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO>>
* @author liuchuang
* @since 2021/7/19 16:13
*/
@GetMapping("charityPoints")
public Result<List<VolunteerPointsRecordsResultDTO>> charityPoints(@RequestBody VolunteerPointsRecordsFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
List<VolunteerPointsRecordsResultDTO> data = volunteerPointsAnalysisService.charityPoints(formDto);
return new Result<List<VolunteerPointsRecordsResultDTO>>().ok(data);
}
}

11
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/VolunteerPointsAnalysisDao.java

@ -1,6 +1,7 @@
package com.elink.esua.epdc.modules.user.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.elink.esua.epdc.dto.user.form.VolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO;
import com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO;
@ -44,4 +45,14 @@ public interface VolunteerPointsAnalysisDao extends BaseMapper<VolunteerPointsSt
* @since 2021/7/15 14:51
*/
List<VolunteerPointsRecordsResultDTO> volunteerPointsRecords(Map<String, Object> params);
/**
* 居民端-志愿者银行-用户公益积分记录
*
* @param formDto
* @return java.util.List<com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO>
* @author liuchuang
* @since 2021/7/19 16:14
*/
List<VolunteerPointsRecordsResultDTO> charityPoints(VolunteerPointsRecordsFormDTO formDto);
}

12
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/VolunteerPointsAnalysisService.java

@ -1,10 +1,12 @@
package com.elink.esua.epdc.modules.user.service;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.user.form.VolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO;
import com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO;
import java.util.List;
import java.util.Map;
/**
@ -42,4 +44,14 @@ public interface VolunteerPointsAnalysisService {
* @since 2021/7/15 14:48
*/
PageData<VolunteerPointsRecordsResultDTO> volunteerPointsRecords(Map<String, Object> params);
/**
* 居民端-志愿者银行-用户公益积分记录
*
* @param formDto
* @return java.util.List<com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO>
* @author liuchuang
* @since 2021/7/19 16:14
*/
List<VolunteerPointsRecordsResultDTO> charityPoints(VolunteerPointsRecordsFormDTO formDto);
}

9
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/VolunteerPointsAnalysisServiceImpl.java

@ -2,7 +2,9 @@ package com.elink.esua.epdc.modules.user.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.user.form.VolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO;
import com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO;
@ -40,4 +42,11 @@ public class VolunteerPointsAnalysisServiceImpl extends BaseServiceImpl<Voluntee
List<VolunteerPointsRecordsResultDTO> list = baseDao.volunteerPointsRecords(params);
return new PageData<>(list, iPage.getTotal());
}
@Override
public List<VolunteerPointsRecordsResultDTO> charityPoints(VolunteerPointsRecordsFormDTO formDto) {
int pageIndex = (formDto.getPageIndex() - NumConstant.ONE) * formDto.getPageSize();
formDto.setPageIndex(pageIndex);
return baseDao.charityPoints(formDto);
}
}

22
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/VolunteerPointsAnalysisDao.xml

@ -121,4 +121,26 @@
ORDER BY l.`OPERATION_TIME` DESC
</select>
<select id="charityPoints" resultType="com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO">
SELECT l.`ID`,
l.`NICKNAME`,
l.`POINTS` AS volunteerPoints,
l.OPERATION_TYPE,
CASE
WHEN ai.`TITLE` IS NULL or ai.`TITLE` = ''
THEN '人工审核积分'
ELSE ai.`TITLE`
END AS actName,
l.`OPERATION_TIME`
FROM `esua_epdc_points`.`epdc_points_logs` l
LEFT JOIN `esua_epdc_mutuality`.`epdc_act_user_points_log` aup on aup.`ID`= l.`REFERENCE_ID`
LEFT JOIN `esua_epdc_mutuality`.`epdc_act_user_relation` aur on aur.`ID`= aup.`ACT_USER_ID`
LEFT JOIN `esua_epdc_mutuality`.`epdc_act_info` ai on ai.`ID`= aur.`ACT_ID`
WHERE l.`DEL_FLAG`= '0'
AND l.`BEHAVIOR_CODE`= 'join_act'
AND l.USER_ID = #{userId}
ORDER BY l.`OPERATION_TIME` DESC
LIMIT #{formDto.pageIndex},#{formDto.pageSize}
</select>
</mapper>

34
esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/form/ApiVolunteerPointsRecordsFormDTO.java

@ -0,0 +1,34 @@
package com.elink.esua.epdc.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Authorliuchuang
* @Date2021/7/19 16:07
*/
@Data
public class ApiVolunteerPointsRecordsFormDTO implements Serializable {
private static final long serialVersionUID = 1625467226873432125L;
/**
* 页码
*/
@Min(value = 1, message = "页码必须大于0")
private Integer pageIndex;
/**
* 页容量
*/
@Min(value = 1, message = "每页条数必须大于0")
private Integer pageSize;
/**
* 用户ID
*/
@NotBlank(message = "获取用户信息失败")
private String userId;
}

44
esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/result/ApiVolunteerPointsRecordsResultDTO.java

@ -0,0 +1,44 @@
package com.elink.esua.epdc.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Authorliuchuang
* @Date2021/7/15 14:45
*/
@Data
public class ApiVolunteerPointsRecordsResultDTO implements Serializable {
private static final long serialVersionUID = -286937478420813680L;
/**
* 积分记录ID
*/
private String id;
/**
* 昵称
*/
private String nickname;
/**
* 活动名称
*/
private String actName;
/**
* 积分记录时间
*/
private String operationTime;
/**
* 积分
*/
private Integer volunteerPoints;
/**
* 积分操作类型 0-减积分1-加积分
*/
private String operationType;
}

17
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiPointsController.java

@ -4,13 +4,16 @@ import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.annotation.LoginUser;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.dto.form.ApiVolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.form.EpdcAppPointsRankingFormDTO;
import com.elink.esua.epdc.dto.form.EpdcAppPointsRecordFormDTO;
import com.elink.esua.epdc.dto.result.ApiVolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.dto.result.EpdcAppPointsRankingResultDTO;
import com.elink.esua.epdc.dto.result.EpdcAppPointsRecordResultDTO;
import com.elink.esua.epdc.service.PointsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -55,4 +58,18 @@ public class ApiPointsController {
ValidatorUtils.validateEntity(formDto);
return pointsService.listPointsRanking(userDetail, formDto);
}
/**
* 居民端-志愿者银行-用户公益积分记录
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.ApiVolunteerPointsRecordsResultDTO>>
* @author liuchuang
* @since 2021/7/19 16:32
*/
@GetMapping("charityPoints")
public Result<List<ApiVolunteerPointsRecordsResultDTO>> charityPoints(@LoginUser TokenDto userDetail, ApiVolunteerPointsRecordsFormDTO formDto) {
return pointsService.charityPoints(userDetail, formDto);
}
}

15
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AnalysisFeignClient.java

@ -2,10 +2,15 @@ package com.elink.esua.epdc.feign;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.form.ApiVolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.result.ApiVolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.feign.fallback.AnalysisFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* 数据分析模块调用
@ -26,5 +31,15 @@ public interface AnalysisFeignClient {
@GetMapping(value = "analysis/workLog/getCustomId", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<String> getCustomId();
/**
* 居民端-志愿者银行-用户公益积分记录
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.ApiVolunteerPointsRecordsResultDTO>>
* @author liuchuang
* @since 2021/7/19 16:36
*/
@GetMapping(value = "analysis/volunteer/charityPoints", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<ApiVolunteerPointsRecordsResultDTO>> charityPoints(ApiVolunteerPointsRecordsFormDTO formDto);
}

9
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AnalysisFeignClientFallback.java

@ -3,9 +3,13 @@ package com.elink.esua.epdc.feign.fallback;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.form.ApiVolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.result.ApiVolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.feign.AnalysisFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Authorsongyunpeg
* @Date2020/9/9 15:42
@ -17,4 +21,9 @@ public class AnalysisFeignClientFallback implements AnalysisFeignClient {
public Result getCustomId() {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "getCustomId");
}
@Override
public Result<List<ApiVolunteerPointsRecordsResultDTO>> charityPoints(ApiVolunteerPointsRecordsFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "charityPoints", "formDto");
}
}

13
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/PointsService.java

@ -2,8 +2,10 @@ package com.elink.esua.epdc.service;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.form.ApiVolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.form.EpdcAppPointsRankingFormDTO;
import com.elink.esua.epdc.dto.form.EpdcAppPointsRecordFormDTO;
import com.elink.esua.epdc.dto.result.ApiVolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.dto.result.EpdcAppPointsRankingResultDTO;
import com.elink.esua.epdc.dto.result.EpdcAppPointsRecordResultDTO;
@ -42,4 +44,15 @@ public interface PointsService {
* @Date: 2020-04-30
*/
Result<EpdcAppPointsRankingResultDTO> listPointsRanking(TokenDto userDetail, EpdcAppPointsRankingFormDTO formDto);
/**
* 居民端-志愿者银行-用户公益积分记录
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.ApiVolunteerPointsRecordsResultDTO>>
* @author liuchuang
* @since 2021/7/19 16:34
*/
Result<List<ApiVolunteerPointsRecordsResultDTO>> charityPoints(TokenDto userDetail, ApiVolunteerPointsRecordsFormDTO formDto);
}

11
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/PointsServiceImpl.java

@ -2,10 +2,13 @@ package com.elink.esua.epdc.service.impl;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.form.ApiVolunteerPointsRecordsFormDTO;
import com.elink.esua.epdc.dto.form.EpdcAppPointsRankingFormDTO;
import com.elink.esua.epdc.dto.form.EpdcAppPointsRecordFormDTO;
import com.elink.esua.epdc.dto.result.ApiVolunteerPointsRecordsResultDTO;
import com.elink.esua.epdc.dto.result.EpdcAppPointsRankingResultDTO;
import com.elink.esua.epdc.dto.result.EpdcAppPointsRecordResultDTO;
import com.elink.esua.epdc.feign.AnalysisFeignClient;
import com.elink.esua.epdc.feign.PointsFeignClient;
import com.elink.esua.epdc.service.PointsService;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,6 +26,8 @@ public class PointsServiceImpl implements PointsService {
@Autowired
private PointsFeignClient pointsFeignClient;
@Autowired
private AnalysisFeignClient analysisFeignClient;
@Override
public Result<List<EpdcAppPointsRecordResultDTO>> listPointsRecord(TokenDto userDetail, EpdcAppPointsRecordFormDTO formDto) {
@ -36,4 +41,10 @@ public class PointsServiceImpl implements PointsService {
formDto.setNickName(userDetail.getNickname());
return pointsFeignClient.listPointsRankingFeignClient(formDto);
}
@Override
public Result<List<ApiVolunteerPointsRecordsResultDTO>> charityPoints(TokenDto userDetail, ApiVolunteerPointsRecordsFormDTO formDto) {
formDto.setUserId(userDetail.getUserId());
return analysisFeignClient.charityPoints(formDto);
}
}

Loading…
Cancel
Save