|
|
@ -25,22 +25,23 @@ import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.ActConstant; |
|
|
|
import com.epmet.dao.ActSignInPicDao; |
|
|
|
import com.epmet.dao.ActSignInRecDao; |
|
|
|
import com.epmet.dao.ActUserLogDao; |
|
|
|
import com.epmet.dao.ActUserRelationDao; |
|
|
|
import com.epmet.dto.ActSignInRecDTO; |
|
|
|
import com.epmet.dto.ActUserRelationDTO; |
|
|
|
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; |
|
|
|
import com.epmet.dto.form.resi.ResiActSignInFormDTO; |
|
|
|
import com.epmet.entity.ActSignInPicEntity; |
|
|
|
import com.epmet.entity.ActSignInRecEntity; |
|
|
|
import com.epmet.entity.ActUserLogEntity; |
|
|
|
import com.epmet.redis.ActSignInRecRedis; |
|
|
|
import com.epmet.service.ActLiveRecService; |
|
|
|
import com.epmet.service.ActSignInRecService; |
|
|
|
import com.epmet.utils.ValidityVerification; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.UUID; |
|
|
|
|
|
|
|
/** |
|
|
|
* 活动签到记录 |
|
|
@ -57,9 +58,6 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac |
|
|
|
@Autowired |
|
|
|
private ActUserRelationDao actUserRelationDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ActUserLogDao actUserLogDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ActSignInPicDao actSignInPicDao; |
|
|
|
|
|
|
@ -70,6 +68,12 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO) { |
|
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
|
// 文本校验
|
|
|
|
ValidityVerification verification = new ValidityVerification(); |
|
|
|
verification.textScanVerification(formDTO.getDesc(),"添加签到-文本内容审核失败"); |
|
|
|
// 图片校验
|
|
|
|
verification.imgScanVerification(formDTO.getImages(),"添加签到-图片审核失败"); |
|
|
|
|
|
|
|
// 更新用户活动关系表 SIGN_IN_FLAG字段更新为已签到
|
|
|
|
ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO(); |
|
|
|
actUserRelationDTO.setActId(formDTO.getActId()); |
|
|
@ -77,43 +81,31 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac |
|
|
|
actUserRelationDTO.setSignInFlag(ActConstant.ACT_USER_STATUS_SIGNED_IN); |
|
|
|
actUserRelationDao.updateUserRelationByActIdAndUserId(actUserRelationDTO); |
|
|
|
|
|
|
|
// 存储用户活动关系日志表
|
|
|
|
ActUserLogEntity actUserLogEntity = new ActUserLogEntity(); |
|
|
|
actUserLogEntity.setActId(formDTO.getActId()); |
|
|
|
actUserLogEntity.setUserId(formDTO.getUserId()); |
|
|
|
actUserLogEntity.setOperationType(ActConstant.ACT_USER_STATUS_SIGNED_IN); |
|
|
|
actUserLogDao.insert(actUserLogEntity); |
|
|
|
ActSignInRecDTO dto = ConvertUtils.sourceToTarget(formDTO, ActSignInRecDTO.class); |
|
|
|
|
|
|
|
//" 实况id,当sync_live=1时此列有值"
|
|
|
|
String liveId = ""; |
|
|
|
if (formDTO.getSyncLive() == 1){ |
|
|
|
if (formDTO.getSyncLive() == NumConstant.ONE){ |
|
|
|
// 签到内容同步到实况
|
|
|
|
ResiActInsertLiveFormDTO liveFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiActInsertLiveFormDTO.class); |
|
|
|
Result<String> inSertlive = actLiveRecService.inSertlive(tokenDto, liveFormDTO); |
|
|
|
liveId = inSertlive.getData(); |
|
|
|
//实况id, 当sync_live=1时此列有值
|
|
|
|
dto.setLiveId(inSertlive.getData()); |
|
|
|
} |
|
|
|
|
|
|
|
// 存储活动签到记录表
|
|
|
|
ActSignInRecEntity actSignInRecEntity = new ActSignInRecEntity(); |
|
|
|
actSignInRecEntity.setActId(formDTO.getActId()); |
|
|
|
actSignInRecEntity.setUserId(formDTO.getUserId()); |
|
|
|
actSignInRecEntity.setLongitude(formDTO.getLongitude()); |
|
|
|
actSignInRecEntity.setLatitude(formDTO.getLatitude()); |
|
|
|
actSignInRecEntity.setAddress(formDTO.getAddress()); |
|
|
|
actSignInRecEntity.setDesc(formDTO.getDesc()); |
|
|
|
actSignInRecEntity.setSyncLive(formDTO.getSyncLive()); |
|
|
|
actSignInRecEntity.setLiveId(liveId); |
|
|
|
baseDao.insert(actSignInRecEntity); |
|
|
|
String uuid = UUID.randomUUID().toString().replaceAll("-",""); |
|
|
|
dto.setId(uuid); |
|
|
|
baseDao.insertActSignInRec(dto); |
|
|
|
|
|
|
|
//存储活动签到图片
|
|
|
|
List<String> imgList = formDTO.getImages(); |
|
|
|
for (int i = 0; i < imgList.size(); i++) { |
|
|
|
String imgUrl = imgList.get(i); |
|
|
|
ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity(); |
|
|
|
actLivePicEntity.setSignInId(actSignInRecEntity.getId()); |
|
|
|
actLivePicEntity.setPicUrl(imgUrl); |
|
|
|
actLivePicEntity.setSort(i + NumConstant.ONE); |
|
|
|
actSignInPicDao.insert(actLivePicEntity); |
|
|
|
if (null != imgList){ |
|
|
|
for (int i = 0; i < imgList.size(); i++) { |
|
|
|
String imgUrl = imgList.get(i); |
|
|
|
ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity(); |
|
|
|
actLivePicEntity.setSignInId(uuid); |
|
|
|
actLivePicEntity.setPicUrl(imgUrl); |
|
|
|
actLivePicEntity.setSort(i + NumConstant.ONE); |
|
|
|
actSignInPicDao.insert(actLivePicEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|