|
|
@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
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.RenException; |
|
|
|
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.entity.ActSignInCodeEntity; |
|
|
|
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.service.ActSignInCodeService; |
|
|
|
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.constant.GroupActConstant; |
|
|
|
import com.epmet.modules.member.service.ResiGroupMemberService; |
|
|
@ -84,6 +87,8 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private OssFeignClient ossFeignClient; |
|
|
|
@Autowired |
|
|
|
private ActSummaryService actSummaryService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询当前用户是否签到 |
|
|
@ -154,10 +159,47 @@ public class ActSignInRecordServiceImpl extends BaseServiceImpl<ActSignInRecordD |
|
|
|
baseDao.updateById(updateEntity); |
|
|
|
return; |
|
|
|
} |
|
|
|
//查询活动信息
|
|
|
|
GroupActInfoDTO originalActInfo = groupActInfoService.getGroupActInfoDTO(formDTO.getGroupActId()); |
|
|
|
if(null==originalActInfo){ |
|
|
|
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())) { |
|
|
|
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()); |
|
|
|
} |
|
|
|
|
|
|
|
//未设置签到开始、截止时间
|
|
|
|
if (null == originalActInfo.getSignInStartTime() || null == originalActInfo.getSignInEndTime()) { |
|
|
|
log.warn("并未设置签到开始、截止时间"); |
|
|
|
throw new RenException(EpmetErrorCode.SIGN_IN_TIME_NOT_START.getCode(), EpmetErrorCode.SIGN_IN_TIME_NOT_START.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
//已经设置签到时间
|
|
|
|
if (null != originalActInfo.getSignInStartTime() && null != originalActInfo.getSignInEndTime()) { |
|
|
|
Date nowDate=new Date(); |
|
|
|
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()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//未签到、在签到时间范围内的,可以签到
|
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|