Browse Source

王公峰:接口优化测试

feature/dangjian
wanggongfeng 6 years ago
parent
commit
05f2887009
  1. 9
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiActPhraseController.java
  2. 46
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiActUserRelationController.java
  3. 2
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java
  4. 11
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AppActUserRelationFeignClient.java
  5. 2
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AppVolunteerRankFeignClient.java
  6. 9
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AppActUserRelationFeignClientFallback.java
  7. 11
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ActUserRelationService.java
  8. 4
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/AppActUserClockLogController.java
  9. 3
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActUserRelationDao.java
  10. 21
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserClockLogServiceImpl.java
  11. 30
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java
  12. 2
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActUserRelationDao.xml

9
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiActPhraseController.java

@ -3,10 +3,7 @@ package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.service.ActPhraseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* APP常用语相关接口
@ -28,8 +25,8 @@ public class ApiActPhraseController {
* @author wanggongfeng
* @date 2019/12/13 14:41
*/
@GetMapping("sagenumAddOne/{id}")
public Result sagenumAddOneById( @PathVariable("id") String id) {
@PostMapping("sagenumAddOne")
public Result sagenumAddOneById(String id) {
return actPhraseService.sagenumAddOneById(id);
}

46
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiActUserRelationController.java

@ -43,8 +43,8 @@ public class ApiActUserRelationController {
* @author wanggongfeng
* @date 2019/12/13 14:41
*/
@GetMapping("signup")
public Result activitySignUp(@LoginUser TokenDto tokenDto, @PathVariable("actId") String actId) {
@PostMapping("signup")
public Result activitySignUp(@LoginUser TokenDto tokenDto,String actId) {
//验证是否为志愿者
Result isVolunteer = appUserService.getVolunteerCountById(tokenDto);
int code = isVolunteer.getCode();
@ -52,7 +52,6 @@ public class ApiActUserRelationController {
//不是志愿者
return isVolunteer;
}
Result<EpdcUserInfoResultDTO> userInfo = appUserService.getInfoById(tokenDto);
EpdcUserInfoResultDTO epdcUserInfoResultDTO = userInfo.getData();
String identityNo = epdcUserInfoResultDTO.getIdentityNo();
@ -70,16 +69,16 @@ public class ApiActUserRelationController {
actUserRelationDTO.setStatus("0");
actUserRelationDTO.setSignupTime(new Date());
/*ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO();
actUserRelationDTO.setActId("122");
actUserRelationDTO.setUserId("3f6448adbfbe736dde333f057a956012");
actUserRelationDTO.setNickname("南宁路-安女士");
actUserRelationDTO.setActId(actId);
actUserRelationDTO.setUserId("0598a2e20eb2466ef0ebb42e930f3801");
actUserRelationDTO.setNickname("茅台-看先生");
actUserRelationDTO.setFaceImg("https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJpzm5C5QcVeGoUJoy6ic5VTsJCsgPhdhibmicV3WrlCVXSOumKhWhdibymIA7tkdJzzbWB72CkWibic30w/132");
actUserRelationDTO.setPartyFlag("0");
actUserRelationDTO.setRealName("安然");
actUserRelationDTO.setSex("0");
actUserRelationDTO.setRealName("看先生");
actUserRelationDTO.setSex("1");
actUserRelationDTO.setAge(39);
actUserRelationDTO.setMobile("17554179541");
actUserRelationDTO.setIdentityNo("61050219890208382X");
actUserRelationDTO.setIdentityNo("61050219890208383X");
actUserRelationDTO.setStatus("0");
actUserRelationDTO.setSignupTime(new Date());*/
return actUserRelationService.activitySignUp(actUserRelationDTO);
@ -95,9 +94,10 @@ public class ApiActUserRelationController {
* @author wanggongfeng
* @date 2019/12/13 14:41
*/
@GetMapping("cancelsignup")
public Result activityCancelSignUp(@LoginUser TokenDto tokenDto,@PathVariable("actId") String actId) {
@PostMapping("cancelsignup")
public Result activityCancelSignUp(@LoginUser TokenDto tokenDto,String actId) {
return actUserRelationService.activityCancelSignUp(tokenDto.getUserId(),actId);
//return actUserRelationService.activityCancelSignUp("0598a2e20eb2466ef0ebb42e930f3801",actId);
}
@ -110,16 +110,31 @@ public class ApiActUserRelationController {
* @author wanggongfeng
* @date 2019/12/13 14:41
*/
@GetMapping("clock")
@PostMapping("clock")
public Result activityClock(@LoginUser TokenDto tokenDto, @RequestBody EpdcAppActUserClockLogDTO epdcAppActUserClockLogDTO) {
AppActUserClockLogDTO appActUserClockLogDTO = ConvertUtils.sourceToTarget(epdcAppActUserClockLogDTO, AppActUserClockLogDTO.class);
appActUserClockLogDTO.setUserId(tokenDto.getUserId());
return actUserRelationService.activityClock(appActUserClockLogDTO);
/* ArrayList<String> imgList = new ArrayList<String>();
imgList.add("http://123232323223");
imgList.add("http://12323232342423423");
EpdcAppActUserClockLogDTO epdcAppActUserClockLogDTO = new EpdcAppActUserClockLogDTO();
epdcAppActUserClockLogDTO.setActId("122");
epdcAppActUserClockLogDTO.setClockAddress("打卡描述");
epdcAppActUserClockLogDTO.setClockLatitude(new BigDecimal(123.122));
epdcAppActUserClockLogDTO.setClockLongitude(new BigDecimal(123.122));
epdcAppActUserClockLogDTO.setClockType("0");
epdcAppActUserClockLogDTO.setImages(imgList);
epdcAppActUserClockLogDTO.setClockAddress("山东省青岛市市北区台东路");
AppActUserClockLogDTO appActUserClockLogDTO = ConvertUtils.sourceToTarget(epdcAppActUserClockLogDTO, AppActUserClockLogDTO.class);
appActUserClockLogDTO.setUserId("3f6448adbfbe736dde333f057a956012");
return actUserRelationService.activityClock(appActUserClockLogDTO);*/
}
/**
* 打卡列表
* 获取打卡列表
*
* @param tokenDto
* @param actId
@ -127,7 +142,7 @@ public class ApiActUserRelationController {
* @author wanggongfeng
* @date 2019/12/13 14:41
*/
@GetMapping("clockList")
@GetMapping("clockList/{actId}")
public Result<EpdcAppClockListDTO> getClockList(@LoginUser TokenDto tokenDto, @PathVariable("actId") String actId) {
Result<AppClockListDTO> result = actUserRelationService.getClockList(actId);
EpdcAppClockListDTO epdcAppClockListDTO = ConvertUtils.sourceToTarget(result.getData(), EpdcAppClockListDTO.class);
@ -136,5 +151,4 @@ public class ApiActUserRelationController {
return result1;
}
}

2
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java

@ -274,7 +274,7 @@ public class ApiAppUserController {
* @author wanggongfeng
* @date 2019/12/13 14:41
*/
@GetMapping("volunteer/authenticate")
@PostMapping("volunteer/authenticate")
public Result volunteerAuthenticate(@LoginUser TokenDto tokenDto, @RequestBody EpdcCompleteVolunteerInfoFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return appUserService.volunteerAuthenticate(tokenDto, formDto);

11
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AppActUserRelationFeignClient.java

@ -6,14 +6,11 @@ import com.elink.esua.epdc.activity.AppClockListDTO;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.feign.fallback.AppActUserRelationFeignClientFallback;
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
/**
*
* 活动报名管理
@ -21,7 +18,7 @@ import java.util.List;
* @Authorwanggongfeng
* @Date2019/12/16 17:36
*/
@FeignClient(name = ServiceConstant.EPDC_HEART_SERVER, fallback = AppActUserRelationFeignClientFallback.class,url = "http://127.0.0.1:9060")
@FeignClient(name = ServiceConstant.EPDC_HEART_SERVER, fallback = AppActUserRelationFeignClientFallback.class)
public interface AppActUserRelationFeignClient {
/**
@ -56,10 +53,4 @@ public interface AppActUserRelationFeignClient {
@GetMapping(value = "heart/appactuserrelation/selectListActUserRelation/{actId}")
Result<AppClockListDTO> selectListActUserRelation(@PathVariable("actId") String actId);
/**
* 获取排行榜
* @return
*/
@GetMapping("heart/volunteer/leaderboard")
Result<List<EpdcVolunteerRankDTO>> leaderboard();
}

2
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AppVolunteerRankFeignClient.java

@ -16,7 +16,7 @@ import java.util.List;
* @Authorwanggongfeng
* @Date2019/12/16 17:36
*/
@FeignClient(name = ServiceConstant.EPDC_HEART_SERVER, fallback = AppVolunteerRankFeignClientFallback.class,url = "http://127.0.0.1:9060")
@FeignClient(name = ServiceConstant.EPDC_HEART_SERVER, fallback = AppVolunteerRankFeignClientFallback.class)
public interface AppVolunteerRankFeignClient {
/**

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

@ -6,11 +6,8 @@ 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.feign.AppActUserRelationFeignClient;
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Authorwanggongfeng
* @Date2019/12/16 15:11
@ -37,10 +34,4 @@ public class AppActUserRelationFeignClientFallback implements AppActUserRelation
return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "selectListActUserRelation", actId);
}
@Override
public Result<List<EpdcVolunteerRankDTO>> leaderboard() {
return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "leaderboard");
}
}

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

@ -4,9 +4,6 @@ import com.elink.esua.epdc.activity.ActUserRelationDTO;
import com.elink.esua.epdc.activity.AppActUserClockLogDTO;
import com.elink.esua.epdc.activity.AppClockListDTO;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO;
import java.util.List;
/**
* @author wanggongfeng
@ -47,12 +44,4 @@ public interface ActUserRelationService {
*/
Result<AppClockListDTO> getClockList(String actId);
/**
* 获取排行榜
* @Author wanggongfeng
* @return
*/
Result<List<EpdcVolunteerRankDTO>> leaderboard();
}

4
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/AppActUserClockLogController.java

@ -24,7 +24,7 @@ import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.modules.activity.service.ActUserClockLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
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;
@ -48,7 +48,7 @@ public class AppActUserClockLogController {
* @param appActUserClockLogDTO
* @return
*/
@PutMapping
@GetMapping("activityClock")
public Result activityClock(@RequestBody AppActUserClockLogDTO appActUserClockLogDTO){
//效验数据
ValidatorUtils.validateEntity(appActUserClockLogDTO, UpdateGroup.class, DefaultGroup.class);

3
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActUserRelationDao.java

@ -21,7 +21,6 @@ import com.elink.esua.epdc.activity.ActClockListDTO;
import com.elink.esua.epdc.activity.ActClockPicDTO;
import com.elink.esua.epdc.activity.ActUserRelationDTO;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.modules.activity.entity.ActUserRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -50,7 +49,7 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
* @param actId
* @return
*/
Result<ActUserRelationDTO> selectOneActUserRelationInfo(@Param("userId")String userId, @Param("actId")String actId);
List<ActUserRelationDTO> selectOneActUserRelationInfo(@Param("userId")String userId, @Param("actId")String actId);
/**
* 通过活动ID查询人员活动关系信息

21
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserClockLogServiceImpl.java

@ -19,10 +19,7 @@ package com.elink.esua.epdc.modules.activity.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.activity.ActClockPicDTO;
import com.elink.esua.epdc.activity.ActUserClockLogDTO;
import com.elink.esua.epdc.activity.ActUserRelationDTO;
import com.elink.esua.epdc.activity.AppActUserClockLogDTO;
import com.elink.esua.epdc.activity.*;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
@ -33,6 +30,7 @@ import com.elink.esua.epdc.modules.activity.entity.ActUserClockLogEntity;
import com.elink.esua.epdc.modules.activity.redis.ActUserClockLogRedis;
import com.elink.esua.epdc.modules.activity.service.ActClockPicService;
import com.elink.esua.epdc.modules.activity.service.ActUserClockLogService;
import com.elink.esua.epdc.modules.activity.service.ActUserLogService;
import com.elink.esua.epdc.modules.activity.service.ActUserRelationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -62,6 +60,9 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD
@Autowired
private ActClockPicService actClockPicService;
@Autowired
private ActUserLogService actUserLogService;
@Override
public PageData<ActUserClockLogDTO> page(Map<String, Object> params) {
IPage<ActUserClockLogEntity> page = baseDao.selectPage(
@ -114,6 +115,11 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 活动打卡
* @param appActUserClockLogDTO
* @return
*/
@Override
public Result activityClock(AppActUserClockLogDTO appActUserClockLogDTO) {
//查询人员活动关系Id
@ -125,6 +131,13 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD
ActUserClockLogEntity entity = ConvertUtils.sourceToTarget(actUserClockLogDTO, ActUserClockLogEntity.class);
insert(entity);
String clockId = entity.getId();
//存储活动日志表 epdc_act_user_log
ActUserLogDTO actUserLogDTO = new ActUserLogDTO();
actUserLogDTO.setUserId(actUserRelationDTO.getUserId());
actUserLogDTO.setActId(actUserRelationDTO.getActId());
actUserLogDTO.setOperationType("2");//打卡
actUserLogDTO.setOperationTime(new Date());
actUserLogService.save(actUserLogDTO);
//更新人员活动关系表当前状态
actUserRelationDTO.setStatus("2");
actUserRelationService.updateActivityStatus(actUserRelationDTO);

30
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java

@ -133,9 +133,9 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
public Result activityCancelSignUp(String userId,String actId) {
//查询是否已报名
Result<ActUserRelationDTO> data = baseDao.selectOneActUserRelationInfo(userId,actId);
if(data != null){
ActUserRelationDTO actUserRelationDTO = data.getData();
List<ActUserRelationDTO> data = baseDao.selectOneActUserRelationInfo(userId,actId);
if(data != null && data.size() > 0){
ActUserRelationDTO actUserRelationDTO = data.get(0);
actUserRelationDTO.setStatus("3");//取消报名
//已报名该活动,进行取消报名
//更新活动人员关系表
@ -158,10 +158,10 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
@Override
public ActUserRelationDTO getActUserRelationId(String userId,String actId) {
Result<ActUserRelationDTO> data = baseDao.selectOneActUserRelationInfo(userId,actId);
List<ActUserRelationDTO> data = baseDao.selectOneActUserRelationInfo(userId,actId);
ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO();
if(data != null){
actUserRelationDTO = data.getData();
if(data != null && data.size() > 0){
actUserRelationDTO = data.get(0);
}
return actUserRelationDTO;
@ -187,15 +187,23 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
map.put("partyFlag",list.get(k).getPartyFlag());
map.put("clockDesc",list.get(k).getClockDesc());
map.put("createdTime",list.get(k).getClockTime());
map.put("clockId",list.get(k).getId() == null ? "" : list.get(k).getId());
//查询打卡对应图片
idArr[k] = list.get(k).getId();
resultList.add(map);
}
List<ActClockPicDTO> listLogImg = baseDao.selectListClockImg(idArr);
for(Object objMap : resultList){
Map<String,Object> mm = (Map<String,Object>)objMap;
List<String> imgList = new ArrayList<String>();
List<ActClockPicDTO> listLog = baseDao.selectListClockImg(idArr);
for(int i = 0 ; i < listLog.size() ; i++){
imgList.add(listLog.get(i).getClockPic());
for(int i = listLogImg.size()-1 ; i >= 0 ; i--){
if(mm.get("clockId").equals(listLogImg.get(i).getClockId())){
imgList.add(listLogImg.get(i).getClockPic());
listLogImg.remove(i);
}
}
map.put("images",imgList);
resultList.add(map);
mm.put("images",imgList);
mm.remove("clockId");
}
AppClockListDTO appClockListDTO = new AppClockListDTO();
appClockListDTO.setClockNum(resultList.size());

2
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActUserRelationDao.xml

@ -52,7 +52,7 @@
left join epdc_act_user_clock_log auc on aur.ID = auc.ACT_USER_ID
where aur.DEL_FLAG = '0' and auc.DEL_FLAG = '0'
and aur.ACT_ID = #{actId}
and aur.status in ('2','0')
and aur.status in ('2')
</select>
<select id="selectListClockImg" resultType="com.elink.esua.epdc.activity.ActClockPicDTO">

Loading…
Cancel
Save