Browse Source

heart-work:测试bug修改

dev_shibei_match
yinzuomei 5 years ago
parent
commit
cfb5912191
  1. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java
  2. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java
  3. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java
  4. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java
  5. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java
  6. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java
  7. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActInfoServiceImpl.java
  8. 60
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  9. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
  10. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml
  11. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml
  12. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java

@ -112,7 +112,7 @@ public class ActInfoDTO implements Serializable {
/** /**
* 活动签到打卡位置经度 * 活动签到打卡位置经度
*/ */
private BigDecimal signinLongitude; private BigDecimal signInLongitude;
/** /**
* 活动签到打卡位置纬度 * 活动签到打卡位置纬度

1
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java

@ -100,4 +100,5 @@ public class AuditingUserDetailResultDTO implements Serializable {
* 审核历史待审核界面需要显示 * 审核历史待审核界面需要显示
*/ */
private HistoricalAuditResult historicalAuditResult; private HistoricalAuditResult historicalAuditResult;
private String actUserRelationId;
} }

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java

@ -107,7 +107,7 @@ public class ReEditActInfoResultDTO implements Serializable {
/** /**
* 活动签到打卡位置经度 * 活动签到打卡位置经度
*/ */
private BigDecimal signinLongitude; private BigDecimal signInLongitude;
/** /**
* 活动签到打卡位置纬度 * 活动签到打卡位置纬度

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java

@ -11,15 +11,15 @@ public interface ActMessageConstant {
/** /**
* 报名审核成功给居民端用户发送消息 * 报名审核成功给居民端用户发送消息
*/ */
String AUDIT_PASSED="您报名的活动%s,已审核通过"; String AUDIT_PASSED="您报名的%s活动,已审核通过";
/** /**
* 拒绝用户的报名给居民端用户发送消息 * 拒绝用户的报名给居民端用户发送消息
*/ */
String AUDIT_REFUSED="您报名的活动%s,审核未通过,原因:%s"; String AUDIT_REFUSED="您报名的%s活动,审核未通过,原因:%s";
/** /**
* 活动被取消给已经通过审核的居民端用户发送消息 * 活动被取消给已经通过审核的居民端用户发送消息
*/ */
String ACT_CANCELED="您报名的活动%s,已取消,原因:%s"; String ACT_CANCELED="您报名的%s活动,已取消,原因:%s";
/** /**
* 发放积分结束活动时调用消息的备注 * 发放积分结束活动时调用消息的备注

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java

@ -58,4 +58,13 @@ public interface LatestActInfoDao extends BaseDao<LatestActInfoEntity> {
* @Date 2020/7/21 17:56 * @Date 2020/7/21 17:56
**/ **/
ActPreviewResultDTO previewActInfo(String actDraftId); ActPreviewResultDTO previewActInfo(String actDraftId);
/**
* @return int
* @param id
* @author yinzuomei
* @description 逻辑删除表记录
* @Date 2020/7/27 17:10
**/
int updateToDelById(String id);
} }

1
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java

@ -124,6 +124,7 @@ public class LatestActContentServiceImpl extends BaseServiceImpl<LatestActConten
**/ **/
@Override @Override
public int deleteByActId(String actId) { public int deleteByActId(String actId) {
//逻辑删除
int updateNum=baseDao.updateToDelByActId(actId); int updateNum=baseDao.updateToDelByActId(actId);
//后面直接全部删除 //后面直接全部删除
return updateNum; return updateNum;

13
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActInfoServiceImpl.java

@ -21,7 +21,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.LatestActInfoDao; import com.epmet.dao.LatestActInfoDao;
@ -33,6 +32,8 @@ import com.epmet.redis.LatestActInfoRedis;
import com.epmet.service.LatestActContentService; import com.epmet.service.LatestActContentService;
import com.epmet.service.LatestActInfoService; import com.epmet.service.LatestActInfoService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -49,7 +50,7 @@ import java.util.Map;
*/ */
@Service @Service
public class LatestActInfoServiceImpl extends BaseServiceImpl<LatestActInfoDao, LatestActInfoEntity> implements LatestActInfoService { public class LatestActInfoServiceImpl extends BaseServiceImpl<LatestActInfoDao, LatestActInfoEntity> implements LatestActInfoService {
private Logger logger = LogManager.getLogger(LatestActInfoServiceImpl.class);
@Autowired @Autowired
private LatestActInfoRedis latestActInfoRedis; private LatestActInfoRedis latestActInfoRedis;
@Autowired @Autowired
@ -96,13 +97,16 @@ public class LatestActInfoServiceImpl extends BaseServiceImpl<LatestActInfoDao,
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String saveOrUpdateLatestActInfoDTO(LatestActInfoDTO dto) { public String saveOrUpdateLatestActInfoDTO(LatestActInfoDTO dto) {
if(StringUtils.isNotBlank(dto.getId())){ if(StringUtils.isNotBlank(dto.getId())&&null!=baseDao.selectById(dto.getId())){
logger.info("草稿id不为空,且根据id查询latest_act_info is not null 时更新记录");
LatestActInfoEntity entity = ConvertUtils.sourceToTarget(dto, LatestActInfoEntity.class); LatestActInfoEntity entity = ConvertUtils.sourceToTarget(dto, LatestActInfoEntity.class);
updateById(entity); updateById(entity);
return dto.getId(); return dto.getId();
} }
dto.setId(null);
LatestActInfoEntity entity = ConvertUtils.sourceToTarget(dto, LatestActInfoEntity.class); LatestActInfoEntity entity = ConvertUtils.sourceToTarget(dto, LatestActInfoEntity.class);
insert(entity); insert(entity);
logger.info("insert latest_act_info success");
return entity.getId(); return entity.getId();
} }
@ -148,8 +152,7 @@ public class LatestActInfoServiceImpl extends BaseServiceImpl<LatestActInfoDao,
//删除活动内容 //删除活动内容
int num=latestActContentService.deleteByActId(entity.getId()); int num=latestActContentService.deleteByActId(entity.getId());
//删除活动属性: del_flag="1" //删除活动属性: del_flag="1"
entity.setDelFlag(NumConstant.ONE_STR); baseDao.updateToDelById(entity.getId());
updateById(entity);
} }
} }

60
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -137,15 +137,15 @@ public class WorkActServiceImpl implements WorkActService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO) { public PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO) {
//构造属性保存活动属性,活动内容
ActInfoEntity actInfoEntity=this.constructActInfo(formDTO);
//校验参数 //校验参数
this.checkPublishFormDTO(formDTO); this.checkPublishFormDTO(actInfoEntity);
PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); PublishActResultDTO publishActResultDTO=new PublishActResultDTO();
//内容审核(活动标题、招募要求、活动内容图文) //内容审核(活动标题、招募要求、活动内容图文)
this.auditAct(formDTO); this.auditAct(formDTO);
logger.info("发布活动,审核成功"); logger.info("发布活动,审核成功");
//构造属性保存活动属性,活动内容
ActInfoEntity actInfoEntity=this.constructActInfo(formDTO);
actInfoDao.insert(actInfoEntity); actInfoDao.insert(actInfoEntity);
List<ActContentEntity> actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); List<ActContentEntity> actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId());
@ -169,44 +169,23 @@ public class WorkActServiceImpl implements WorkActService {
/** /**
* @return void * @return void
* @param formDTO * @param actInfoEntity
* @author yinzuomei * @author yinzuomei
* @description 第一次发布 * @description 第一次发布
* @Date 2020/7/24 16:45 * @Date 2020/7/24 16:45
**/ **/
private void checkPublishFormDTO(PublishActInfoFormDTO formDTO) { private void checkPublishFormDTO(ActInfoEntity actInfoEntity) {
//1、活动预计开始时间、活动预计结束时间
if(formDTO.getActStartTime().compareTo(formDTO.getActEndTime())!=-1){
throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode());
}
//2、签到开始时间、签到结束时间
if(formDTO.getSignInStartTime().compareTo(formDTO.getSignInEndTime())!=-1){
throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode());
}
//3、报名截止时间(应该在活动预计开始时间之前)
if(formDTO.getSignUpEndTime().compareTo(formDTO.getActStartTime())!=-1){
throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode()));
}
}
/**
* @return void
* @param formDTO
* @author yinzuomei
* @description 重新发布
* @Date 2020/7/24 16:45
**/
private void checkRePublishFormDTO(RePublishFormDTO formDTO) {
//1、活动预计开始时间、活动预计结束时间 //1、活动预计开始时间、活动预计结束时间
if(formDTO.getActStartTime().compareTo(formDTO.getActEndTime())!=-1){ if(actInfoEntity.getActStartTime().compareTo(actInfoEntity.getActEndTime())!=-1){
throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode());
} }
//2、签到开始时间、签到结束时间 //2、签到开始时间、签到结束时间
if(formDTO.getSignInStartTime().compareTo(formDTO.getSignInEndTime())!=-1){ if(actInfoEntity.getSignInStartTime().compareTo(actInfoEntity.getSignInEndTime())!=-1){
throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode());
} }
int n=actInfoEntity.getSignUpEndTime().compareTo(actInfoEntity.getActStartTime());
//3、报名截止时间(应该在活动预计开始时间之前) //3、报名截止时间(应该在活动预计开始时间之前)
if(formDTO.getSignUpEndTime().compareTo(formDTO.getActStartTime())!=-1){ if(n!=-1){
throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode()));
} }
} }
@ -215,10 +194,10 @@ public class WorkActServiceImpl implements WorkActService {
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try { try {
Date yesterDate=format.parse("2020-07-25 13:00:00"); Date yesterDate=format.parse("2020-07-26 13:00:00");
Date today=format.parse("2020-07-26 13:00:00"); Date today=format.parse("2020-07-27 13:00:00");
Date tommorrow=format.parse("2020-07-27 13:00:00"); Date tommorrow=format.parse("2020-07-28 13:00:00");
Date today1=format.parse("2020-07-26 13:00:00"); Date today1=format.parse("2020-07-27 13:00:00");
System.out.println(yesterDate.compareTo(today)); System.out.println(yesterDate.compareTo(today));
System.out.println(tommorrow.compareTo(today)); System.out.println(tommorrow.compareTo(today));
System.out.println(today.compareTo(today1)); System.out.println(today.compareTo(today1));
@ -644,6 +623,7 @@ public class WorkActServiceImpl implements WorkActService {
List<UserMessageFormDTO> userMessageFormDTOS=new ArrayList<>(); List<UserMessageFormDTO> userMessageFormDTOS=new ArrayList<>();
for(String userId:userIdList){ for(String userId:userIdList){
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setCustomerId(actInfoDTO.getCustomerId());
userMessageFormDTO.setUserId(userId); userMessageFormDTO.setUserId(userId);
userMessageFormDTO.setGridId(StrConstant.STAR); userMessageFormDTO.setGridId(StrConstant.STAR);
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); userMessageFormDTO.setApp(AppClientConstant.APP_RESI);
@ -960,6 +940,9 @@ public class WorkActServiceImpl implements WorkActService {
if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode());
} }
if(!ActConstant.ACT_STATUS_PUBLISHED.equals(actInfoDTO.getActStatus())){
throw new RenException("只有进行中的活动才可以编辑");
}
ReEditActInfoResultDTO resultDTO= ConvertUtils.sourceToTarget(actInfoDTO, ReEditActInfoResultDTO.class); ReEditActInfoResultDTO resultDTO= ConvertUtils.sourceToTarget(actInfoDTO, ReEditActInfoResultDTO.class);
resultDTO.setActId(actId); resultDTO.setActId(actId);
List<ActPreviewContentResultDTO> actContent=actContentDao.selectByActId(actId); List<ActPreviewContentResultDTO> actContent=actContentDao.selectByActId(actId);
@ -984,15 +967,18 @@ public class WorkActServiceImpl implements WorkActService {
if(!originalActInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ if(!originalActInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode());
} }
if(!ActConstant.ACT_STATUS_PUBLISHED.equals(originalActInfo.getActStatus())){
throw new RenException("只有进行中的活动才可以编辑");
}
//构造属性保存活动属性,活动内容
ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO);
//校验参数 //校验参数
this.checkRePublishFormDTO(rePublishFormDTO); this.checkPublishFormDTO(newActInfoEntity);
PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); PublishActResultDTO publishActResultDTO=new PublishActResultDTO();
//内容审核(活动标题、招募要求、活动内容图文) //内容审核(活动标题、招募要求、活动内容图文)
this.auditRePublishAct(rePublishFormDTO); this.auditRePublishAct(rePublishFormDTO);
logger.info("重新发布活动,审核成功"); logger.info("重新发布活动,审核成功");
//构造属性保存活动属性,活动内容
ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO);
newActInfoEntity.setId(rePublishFormDTO.getActId()); newActInfoEntity.setId(rePublishFormDTO.getActId());
actInfoDao.updateById(newActInfoEntity); actInfoDao.updateById(newActInfoEntity);
//删除原来的 //删除原来的

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -278,6 +279,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
UserBaseInfoResultDTO userBaseInfo=queryUserBaseInfo(actUserRelationDTO.getUserId()); UserBaseInfoResultDTO userBaseInfo=queryUserBaseInfo(actUserRelationDTO.getUserId());
AuditingUserDetailResultDTO resultDTO=new AuditingUserDetailResultDTO(); AuditingUserDetailResultDTO resultDTO=new AuditingUserDetailResultDTO();
//基本信息赋值 //基本信息赋值
resultDTO.setActUserRelationId(actUserRelationDTO.getId());
resultDTO.setActId(actUserRelationDTO.getActId()); resultDTO.setActId(actUserRelationDTO.getActId());
resultDTO.setUserId(actUserRelationDTO.getUserId()); resultDTO.setUserId(actUserRelationDTO.getUserId());
resultDTO.setRealName(userBaseInfo.getRealName()); resultDTO.setRealName(userBaseInfo.getRealName());
@ -318,6 +320,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
cancelResult.setCancelTime(actUserRelationDTO.getCancelTime()); cancelResult.setCancelTime(actUserRelationDTO.getCancelTime());
resultDTO.setCancelResult(cancelResult); resultDTO.setCancelResult(cancelResult);
} }
resultDTO.setVolunteerFlag(getVolunteerFlag(actUserRelationDTO.getUserId()));
return resultDTO; return resultDTO;
} }
@ -522,6 +525,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
private void saveUserMessage(ActUserRelationEntity actUserRelationEntity, String type,ActInfoEntity actInfo) { private void saveUserMessage(ActUserRelationEntity actUserRelationEntity, String type,ActInfoEntity actInfo) {
try { try {
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setCustomerId(actInfo.getCustomerId());
userMessageFormDTO.setUserId(actUserRelationEntity.getUserId()); userMessageFormDTO.setUserId(actUserRelationEntity.getUserId());
userMessageFormDTO.setGridId(StrConstant.STAR); userMessageFormDTO.setGridId(StrConstant.STAR);
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); userMessageFormDTO.setApp(AppClientConstant.APP_RESI);
@ -535,6 +539,8 @@ public class WorkActUserServiceImpl implements WorkActUserService {
Result result = epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO); Result result = epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO);
if (result.success()) { if (result.success()) {
logger.info("审核成功,已成功发送站内信"); logger.info("审核成功,已成功发送站内信");
}else{
logger.error("审核成功,发送站内信失败"+ JSON.toJSONString(result));
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("审核结果,发送站内信异常", e.getMessage()); logger.error("审核结果,发送站内信异常", e.getMessage());

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml

@ -27,7 +27,7 @@
WHERE WHERE
ac.DEL_FLAG = '0' ac.DEL_FLAG = '0'
AND ac.ACT_ID = #{actId} AND ac.ACT_ID = #{actId}
order by orderNum asc order by ORDER_NUM asc
</select> </select>
<!-- 根据活动id,将原来的活动详情删除,del_flag=1--> <!-- 根据活动id,将原来的活动详情删除,del_flag=1-->

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml

@ -53,6 +53,6 @@
<!-- 根据活动id删除活动详情 物理删除 --> <!-- 根据活动id删除活动详情 物理删除 -->
<delete id="deleteByActId" parameterType="java.lang.String"> <delete id="deleteByActId" parameterType="java.lang.String">
delete from latest_act_content lac where lac.ACT_ID=#{actId} delete from latest_act_content where ACT_ID=#{actId}
</delete> </delete>
</mapper> </mapper>

5
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml

@ -118,4 +118,9 @@
lai.DEL_FLAG = '0' lai.DEL_FLAG = '0'
AND lai.ID = #{actDraftId} AND lai.ID = #{actDraftId}
</select> </select>
<!-- -->
<update id="updateToDelById" parameterType="java.lang.String">
update latest_act_info set DEL_FLAG='1' where id=#{id}
</update>
</mapper> </mapper>
Loading…
Cancel
Save