|
|
@@ -35,6 +35,7 @@ import com.cyksj.service.coin.UserGalaxyCoinService;
|
|
|
import com.cyksj.service.exchange.ExchangeCodeService;
|
|
|
import com.cyksj.service.mange.coupon.CouponCommonService;
|
|
|
import com.cyksj.service.market.MarketFrontService;
|
|
|
+import com.cyksj.service.market.ThirdPartyFileUploadService;
|
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
import com.cyksj.service.sys.SysConfigService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
@@ -46,6 +47,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -105,6 +107,8 @@ public class MarketFrontServiceImpl implements MarketFrontService {
|
|
|
|
|
|
private final UserGalaxyCoinService userGalaxyCoinService;
|
|
|
|
|
|
+ private final ThirdPartyFileUploadService thirdPartyFileUploadService;
|
|
|
+
|
|
|
@Override
|
|
|
public SignUser signByUserId(Long userId) {
|
|
|
//第一次签到
|
|
|
@@ -306,20 +310,29 @@ public class MarketFrontServiceImpl implements MarketFrontService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
- public void toCompleteFollowTask(TaskFollowReq taskFollowReq) {
|
|
|
+ public void toCompleteFollowTask(TaskFollowReq taskFollowReq, MultipartFile file) {
|
|
|
Long taskId = taskFollowReq.getTaskId();
|
|
|
Long userId = taskFollowReq.getUserId();
|
|
|
TaskFrontView data = beanSearcher.searchFirst(TaskFrontView.class, MapUtils.builder()
|
|
|
.field(TaskFrontView::getId, taskId).build());
|
|
|
+ if (data == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("该任务不存在");
|
|
|
+ }
|
|
|
//非审核
|
|
|
- if (!data.getIsVerify()) {
|
|
|
- throw BusinessRuntimeException.getInstance("");
|
|
|
+ if (!Boolean.TRUE.equals(data.getIsVerify())) {
|
|
|
+ throw BusinessRuntimeException.getInstance("该任务不需要提交审核");
|
|
|
+ }
|
|
|
+ if (taskFollowPlatVerifyMapper.selectCount(Wrappers.lambdaQuery(TaskFollowPlatVerify.class)
|
|
|
+ .eq(TaskFollowPlatVerify::getTaskId, taskId)
|
|
|
+ .eq(TaskFollowPlatVerify::getUserId, userId)) > 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("请勿重复提交关注任务");
|
|
|
}
|
|
|
+ String imgUrl = file == null || file.isEmpty() ? null : thirdPartyFileUploadService.uploadImage(file);
|
|
|
TaskFollowPlatVerify taskFollowPlatVerify = new TaskFollowPlatVerify();
|
|
|
taskFollowPlatVerify.setTaskId(taskId);
|
|
|
taskFollowPlatVerify.setUserId(userId);
|
|
|
taskFollowPlatVerify.setPlatNickname(taskFollowReq.getPlatNickname());
|
|
|
- taskFollowPlatVerify.setImg(taskFollowReq.getImg());
|
|
|
+ taskFollowPlatVerify.setImg(imgUrl);
|
|
|
taskFollowPlatVerify.setLink(taskFollowReq.getLink());
|
|
|
try {
|
|
|
taskFollowPlatVerifyMapper.insert(taskFollowPlatVerify);
|
|
|
@@ -330,12 +343,13 @@ public class MarketFrontServiceImpl implements MarketFrontService {
|
|
|
record.setStatus(TaskUserCompleteRecord.Status.verifying);
|
|
|
taskUserCompleteRecordMapper.insert(record);
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
-
|
|
|
+ throw BusinessRuntimeException.getInstance("请勿重复提交关注任务");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateFailFollowTask(TaskFollowReq taskFollowReq) {
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
+ public void updateFailFollowTask(TaskFollowReq taskFollowReq, MultipartFile file) {
|
|
|
if (taskFollowReq.getId() == null || taskFollowReq.getId() < 1) {
|
|
|
throw BusinessRuntimeException.getInstance("");
|
|
|
}
|
|
|
@@ -343,12 +357,20 @@ public class MarketFrontServiceImpl implements MarketFrontService {
|
|
|
if (dbTaskFollowPlatVerify == null) {
|
|
|
throw BusinessRuntimeException.getInstance("该提交记录不存在");
|
|
|
}
|
|
|
- if (dbTaskFollowPlatVerify.getStatus() == TaskFollowPlatVerify.Status.success) {
|
|
|
- throw BusinessRuntimeException.getInstance("您提交的记录已审核成功");
|
|
|
+ if (!taskFollowReq.getUserId().equals(dbTaskFollowPlatVerify.getUserId())) {
|
|
|
+ throw BusinessRuntimeException.getInstance("该提交记录不存在");
|
|
|
+ }
|
|
|
+ if (dbTaskFollowPlatVerify.getStatus() != TaskFollowPlatVerify.Status.fail) {
|
|
|
+ throw BusinessRuntimeException.getInstance("仅审核失败的记录可以重新提交");
|
|
|
+ }
|
|
|
+ if (!taskFollowReq.getTaskId().equals(dbTaskFollowPlatVerify.getTaskId())) {
|
|
|
+ throw BusinessRuntimeException.getInstance("任务与提交记录不匹配");
|
|
|
}
|
|
|
dbTaskFollowPlatVerify.setPlatNickname(taskFollowReq.getPlatNickname());
|
|
|
dbTaskFollowPlatVerify.setStatus(TaskFollowPlatVerify.Status.verifying);
|
|
|
- dbTaskFollowPlatVerify.setImg(taskFollowReq.getImg());
|
|
|
+ if (file != null && !file.isEmpty()) {
|
|
|
+ dbTaskFollowPlatVerify.setImg(thirdPartyFileUploadService.uploadImage(file));
|
|
|
+ }
|
|
|
taskFollowPlatVerifyMapper.updateById(dbTaskFollowPlatVerify);
|
|
|
|
|
|
TaskUserCompleteRecord record = taskUserCompleteRecordMapper.selectOne(Wrappers.lambdaQuery(TaskUserCompleteRecord.class)
|