Browse Source

签到接口修改

master
yinzuomei 5 years ago
parent
commit
bc21e0d08f
  1. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSummaryService.java
  2. 58
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java
  3. 3
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSummaryServiceImpl.java

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActSummaryService.java

@ -26,6 +26,8 @@ import com.epmet.resi.group.dto.act.form.InitTemplateFormDTO;
import com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO; import com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO;
import com.epmet.resi.group.dto.act.result.ActSummaryTemplateResultDTO; import com.epmet.resi.group.dto.act.result.ActSummaryTemplateResultDTO;
import java.util.List;
/** /**
* 活动总结 * 活动总结
* *
@ -61,4 +63,6 @@ public interface ActSummaryService extends BaseService<ActSummaryEntity> {
ActSummaryDetailResultDTO queryActSummaryDetail(ActSummaryDetailFormDTO formDTO); ActSummaryDetailResultDTO queryActSummaryDetail(ActSummaryDetailFormDTO formDTO);
ActSummaryEntity queryUserSummary(String groupActId, String userId); ActSummaryEntity queryUserSummary(String groupActId, String userId);
List<String> querySignedInUsers(List<String> signedInUserIds);
} }

58
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSignInRecordServiceImpl.java

@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
@ -35,9 +36,11 @@ import com.epmet.modules.act.dao.ActSignInRecordDao;
import com.epmet.modules.act.dao.GroupActInfoDao; import com.epmet.modules.act.dao.GroupActInfoDao;
import com.epmet.modules.act.entity.ActSignInCodeEntity; import com.epmet.modules.act.entity.ActSignInCodeEntity;
import com.epmet.modules.act.entity.ActSignInRecordEntity; import com.epmet.modules.act.entity.ActSignInRecordEntity;
import com.epmet.modules.act.entity.ActSummaryEntity;
import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.modules.act.entity.GroupActInfoEntity;
import com.epmet.modules.act.service.ActSignInCodeService; import com.epmet.modules.act.service.ActSignInCodeService;
import com.epmet.modules.act.service.ActSignInRecordService; import com.epmet.modules.act.service.ActSignInRecordService;
import com.epmet.modules.act.service.ActSummaryService;
import com.epmet.modules.act.service.GroupActInfoService; import com.epmet.modules.act.service.GroupActInfoService;
import com.epmet.modules.constant.GroupActConstant; import com.epmet.modules.constant.GroupActConstant;
import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.member.service.ResiGroupMemberService;
@ -84,6 +87,8 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired @Autowired
private OssFeignClient ossFeignClient; private OssFeignClient ossFeignClient;
@Autowired
private ActSummaryService actSummaryService;
/** /**
* 查询当前用户是否签到 * 查询当前用户是否签到
@ -154,10 +159,47 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD
baseDao.updateById(updateEntity); baseDao.updateById(updateEntity);
return; return;
} }
//查询活动信息
GroupActInfoDTO originalActInfo = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId()); GroupActInfoDTO originalActInfo = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId());
if(null==originalActInfo){ if(null==originalActInfo){
throw new RenException(String.format("根据groupActId:%s,查询活动信息为null",formDTO.getGroupActId())); throw new RenException(String.format("根据groupActId:%s,查询活动信息为null",formDTO.getGroupActId()));
} }
//校验当前活动是否可以签到
checkSignInActInfo(originalActInfo);
//未签到、在签到时间范围内的,可以签到
GroupActInfoEntity groupActInfoEntity = ConvertUtils.sourceToTarget(originalActInfo, GroupActInfoEntity.class);
groupActInfoEntity.setSignedInNum(originalActInfo.getSignedInNum() + NumConstant.ONE);
groupActInfoDao.updateById(groupActInfoEntity);
ActSignInRecordEntity insertEntity=new ActSignInRecordEntity();
insertEntity.setCustomerId(formDTO.getCustomerId());
insertEntity.setGroupActId(formDTO.getGroupActId());
insertEntity.setSignUserId(formDTO.getUserId());
insertEntity.setSignInAddress(formDTO.getSignInAddress());
insertEntity.setLatitude(formDTO.getLatitude());
insertEntity.setLongitude(formDTO.getLongitude());
baseDao.insert(insertEntity);
//如果活动已经填写过总结,需要更总结的已签到人数、签到人员名单
ActSummaryEntity actSummaryEntity=actSummaryService.queryUserSummary(groupActInfoEntity.getId(),groupActInfoEntity.getPublishUserId());
if(null!=actSummaryEntity){
actSummaryEntity.setSignedInNum(groupActInfoEntity.getSignedInNum());
//签到人员姓名集合
List<String> signedInUserIds = baseDao.selectUserIds(formDTO.getGroupActId());
List<String> signedInUsers = actSummaryService.querySignedInUsers(signedInUserIds);
actSummaryEntity.setSignedInUsers(StringUtils.strip(signedInUsers.toString(), "[]").replace(", ", StrConstant.COMMA_ZH));
actSummaryService.updateById(actSummaryEntity);
}
}
/**
* @return void
* @param originalActInfo
* @author yinzuomei
* @description 校验当前活动是否可以签到
* @Date 2021/4/25 16:45
**/
private void checkSignInActInfo(GroupActInfoDTO originalActInfo) {
//关闭、已取消不能签到 //关闭、已取消不能签到
if (GroupActConstant.CLOSED.equals(originalActInfo.getStatus())) { if (GroupActConstant.CLOSED.equals(originalActInfo.getStatus())) {
throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getCode(), EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getMsg()); throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getCode(), EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getMsg());
@ -165,11 +207,13 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD
throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getCode(), EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getMsg()); throw new RenException(EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getCode(), EpmetErrorCode.GROUP_ACT_CAN_NOT_CANCEL.getMsg());
} }
//未设置签到开始、截止时间
if (null == originalActInfo.getSignInStartTime() || null == originalActInfo.getSignInEndTime()) { if (null == originalActInfo.getSignInStartTime() || null == originalActInfo.getSignInEndTime()) {
log.warn("并未设置签到开始、截止时间"); log.warn("并未设置签到开始、截止时间");
throw new RenException(EpmetErrorCode.SIGN_IN_TIME_NOT_START.getCode(), EpmetErrorCode.SIGN_IN_TIME_NOT_START.getMsg()); throw new RenException(EpmetErrorCode.SIGN_IN_TIME_NOT_START.getCode(), EpmetErrorCode.SIGN_IN_TIME_NOT_START.getMsg());
} }
//已经设置签到时间
if (null != originalActInfo.getSignInStartTime() && null != originalActInfo.getSignInEndTime()) { if (null != originalActInfo.getSignInStartTime() && null != originalActInfo.getSignInEndTime()) {
Date nowDate=new Date(); Date nowDate=new Date();
long nowTime=nowDate.getTime(); long nowTime=nowDate.getTime();
@ -183,20 +227,6 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD
throw new RenException(EpmetErrorCode.SIGN_IN_TIME_PASSED.getCode(),EpmetErrorCode.SIGN_IN_TIME_PASSED.getMsg()); throw new RenException(EpmetErrorCode.SIGN_IN_TIME_PASSED.getCode(),EpmetErrorCode.SIGN_IN_TIME_PASSED.getMsg());
} }
} }
//未签到、在签到时间范围内的,可以签到
GroupActInfoEntity groupActInfoEntity = ConvertUtils.sourceToTarget(originalActInfo, GroupActInfoEntity.class);
groupActInfoEntity.setSignedInNum(originalActInfo.getSignedInNum() + NumConstant.ONE);
groupActInfoDao.updateById(groupActInfoEntity);
ActSignInRecordEntity insertEntity=new ActSignInRecordEntity();
insertEntity.setCustomerId(formDTO.getCustomerId());
insertEntity.setGroupActId(formDTO.getGroupActId());
insertEntity.setSignUserId(formDTO.getUserId());
insertEntity.setSignInAddress(formDTO.getSignInAddress());
insertEntity.setLatitude(formDTO.getLatitude());
insertEntity.setLongitude(formDTO.getLongitude());
baseDao.insert(insertEntity);
} }
/** /**

3
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActSummaryServiceImpl.java

@ -185,7 +185,8 @@ public class ActSummaryServiceImpl extends BaseServiceImpl<ActSummaryDao, ActSum
} }
private List<String> querySignedInUsers(List<String> signedInUserIds) { @Override
public List<String> querySignedInUsers(List<String> signedInUserIds) {
List<String> nameList = new ArrayList<>(); List<String> nameList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(signedInUserIds)) { if (CollectionUtils.isNotEmpty(signedInUserIds)) {
Result<List<UserBaseInfoResultDTO>> userResult = epmetUserOpenFeignClient.queryUserBaseInfo(signedInUserIds); Result<List<UserBaseInfoResultDTO>> userResult = epmetUserOpenFeignClient.queryUserBaseInfo(signedInUserIds);

Loading…
Cancel
Save