fix:生成applyId方法

dev
wangxy 12 months ago
parent fe82bfde7b
commit c54adee9b7

@ -1,7 +1,9 @@
package com.hyp.web.controller.manager; package com.hyp.web.controller.manager;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import com.hyp.common.core.domain.model.LoginUser; import com.hyp.common.core.domain.model.LoginUser;
import com.hyp.common.exception.ServiceException;
import com.hyp.common.utils.SecurityUtils; import com.hyp.common.utils.SecurityUtils;
import com.hyp.system.domain.RewApplyInfoList; import com.hyp.system.domain.RewApplyInfoList;
import com.hyp.system.domain.dto.ApplyInfoListDTO; import com.hyp.system.domain.dto.ApplyInfoListDTO;
@ -9,8 +11,10 @@ import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.system.service.RewApplyInfoListService; import com.hyp.system.service.RewApplyInfoListService;
import com.hyp.system.service.RewScoreInfoService; import com.hyp.system.service.RewScoreInfoService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -39,12 +43,29 @@ public class ApplyInfoListManager {
} }
/**
*
* applyId
* @param applyType
* @return com.hyp.system.domain.vo.ApplyInfoListVO
*/
@Transactional(rollbackFor = Exception.class)
public ApplyInfoListVO getApplyId(String applyType){ public ApplyInfoListVO getApplyId(String applyType){
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
List<RewApplyInfoList> list = applyInfoListService.lambdaQuery()
.eq(RewApplyInfoList::getApplyType, applyType)
.eq(RewApplyInfoList::getCreateId, loginUser.getUserId())
.list();
if(CollUtil.isNotEmpty(list)){
throw new ServiceException("该用户已申请,不能重复申请!");
}
RewApplyInfoList applyInfoList = new RewApplyInfoList(); RewApplyInfoList applyInfoList = new RewApplyInfoList();
applyInfoList.setApplyType(applyType); applyInfoList.setApplyType(applyType);
applyInfoList.setApplyStatus(0); applyInfoList.setApplyStatus(0);
applyInfoList.setCreateId(loginUser.getUserId()); applyInfoList.setCreateId(loginUser.getUserId());
applyInfoList.setCreateBy(loginUser.getUsername());
applyInfoList.setUpdateTime(new Date());
applyInfoList.setCreateTime(new Date());
applyInfoListService.save(applyInfoList); applyInfoListService.save(applyInfoList);
return Convert.convert(ApplyInfoListVO.class, applyInfoList); return Convert.convert(ApplyInfoListVO.class, applyInfoList);
} }

Loading…
Cancel
Save