Browse Source

更新用户积分

feature/user_house_import
Jackwang 4 years ago
parent
commit
1683875a2d
  1. 37
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ApiUserPointsController.java
  2. 11
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java
  3. 6
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java
  4. 11
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/AppUserService.java
  5. 64
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java

37
epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ApiUserPointsController.java

@ -0,0 +1,37 @@
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.PointsUpdateFormDTO;
import com.elink.esua.epdc.service.AppUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* APP爱心排名
*
* @author wanggongfeng
* @date 2019/12/17 10:30
*/
@RestController
@RequestMapping("points/behavior")
public class ApiUserPointsController {
@Autowired
private AppUserService appUserService;
/**
* @describe: 更新用户积分(双实信息更新 网格巡查)
* @author wangtong
* @date 2022/2/13 14:47
* @params [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
@PostMapping("updateUserPoints")
public Result updateUserPoints(@RequestBody PointsUpdateFormDTO formDto) {
return appUserService.updateUserPoints( formDto);
}
}

11
epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java

@ -1,6 +1,5 @@
package com.elink.esua.epdc.feign;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.*;
@ -492,5 +491,15 @@ public interface UserFeignClient {
**/
@GetMapping(value = "app-user/usersign/addConsequentSignPoints", consumes = MediaType.APPLICATION_JSON_VALUE)
Result addConsequentSignPoints(UserSignDTO userSignDTO);
/**
* @describe: 通过手机号查询人员信息
* @author wangtong
* @date 2022/2/13 14:52
* @params [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
@GetMapping(value = "app-user/user/getUserInfoByMobile", consumes = MediaType.APPLICATION_JSON_VALUE)
Result getUserInfoByMobile(PointsUpdateFormDTO formDto);
}

6
epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java

@ -1,6 +1,5 @@
package com.elink.esua.epdc.feign.fallback;
import com.elink.esua.epdc.common.token.dto.TokenDto;
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;
@ -239,4 +238,9 @@ public class UserFeignClientFallback implements UserFeignClient {
public Result addConsequentSignPoints(UserSignDTO userSignDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "addConsequentSignPoints", userSignDTO);
}
@Override
public Result getUserInfoByMobile(PointsUpdateFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "getUserInfoByMobile", formDto);
}
}

11
epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/AppUserService.java

@ -1,8 +1,8 @@
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.security.user.UserDetail;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.PointsUpdateFormDTO;
import com.elink.esua.epdc.dto.epdc.form.*;
import com.elink.esua.epdc.dto.epdc.result.*;
import com.elink.esua.epdc.dto.form.*;
@ -331,4 +331,13 @@ public interface AppUserService {
* @Date 10:27 2022-01-25
**/
Result userSign(TokenDto userDetail);
/**
* @describe: 更新用户积分(双实信息更新 网格巡查)
* @author wangtong
* @date 2022/2/13 14:47
* @params [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
Result updateUserPoints(PointsUpdateFormDTO formDto);
}

64
epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java

@ -37,6 +37,7 @@ import com.elink.esua.epdc.feign.*;
import com.elink.esua.epdc.jwt.JwtTokenProperties;
import com.elink.esua.epdc.jwt.JwtTokenUtils;
import com.elink.esua.epdc.modules.points.feign.PointsFeignClient;
import com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior;
import com.elink.esua.epdc.pointcommons.tools.dto.PointsRuleResultDTO;
import com.elink.esua.epdc.redis.AppUserRedis;
import com.elink.esua.epdc.service.AppUserService;
@ -1480,4 +1481,67 @@ public class AppUserServiceImpl implements AppUserService {
}
return new Result().ok("您已连续签到"+userSignDTO.getConsequentSignDays()+"天,继续努力吧");
}
@Override
public Result updateUserPoints(PointsUpdateFormDTO formDto) {
Result userResult = userFeignClient.getUserInfoByMobile(formDto);
if(!userResult.success() || userResult.getData()==null){
return new Result().error("未获取到用户信息!");
}
UserDTO user = (UserDTO) userResult.getData();
if("double_info_update".equals(formDto.getBehaviorType())){
updateBehavior1Points(user);
}else if("grid_patrol".equals(formDto.getBehaviorType())){
updateBehavior2Points(user);
}else if("grid_report_event".equals(formDto.getBehaviorType())){
updateBehavior3Points(user);
}else if("grid_work_upload".equals(formDto.getBehaviorType())){
updateBehavior4Points(user);
}
return new Result().ok("操作成功");
}
/**
* @describe: 双实信息更新及上报
* @author wangtong
* @date 2022/2/13 15:20
* @params [user]
* @return void
*/
@RecordUserBehavior(behavior = BehaviorEnum.DOUBLE_INFO_UPDATE, referenceId = "#{user.getId}", userId = "#{user.getId}")
private void updateBehavior1Points(UserDTO user){
}
/**
* @describe: 网格巡查
* @author wangtong
* @date 2022/2/13 15:20
* @params [user]
* @return void
*/
@RecordUserBehavior(behavior = BehaviorEnum.GRID_PATROL, referenceId = "#{user.getId}", userId = "#{user.getId}")
private void updateBehavior2Points(UserDTO user){
}
/**
* @describe: 网格上报事件
* @author wangtong
* @date 2022/2/13 15:20
* @params [user]
* @return void
*/
@RecordUserBehavior(behavior = BehaviorEnum.GRID_REPORT_EVENT, referenceId = "#{user.getId}", userId = "#{user.getId}")
private void updateBehavior3Points(UserDTO user){
}
/**
* @describe: 网格工作上传
* @author wangtong
* @date 2022/2/13 15:20
* @params [user]
* @return void
*/
@RecordUserBehavior(behavior = BehaviorEnum.GRID_WORK_UPLOAD, referenceId = "#{user.getId}", userId = "#{user.getId}")
private void updateBehavior4Points(UserDTO user){
}
}

Loading…
Cancel
Save