From fd5db46751d153ab8e4d9b025680428917b15f76 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 02 Jul 2021 10:36:21 +0800
Subject: [PATCH] modify
---
gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java b/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
index 535a8a5..b803ccc 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
@@ -1,31 +1,41 @@
package com.xzx.gc.user.service;
import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xzx.gc.common.exception.RestException;
+import com.xzx.gc.entity.AccountInfo;
import com.xzx.gc.entity.JhyInfo;
-import com.xzx.gc.user.dto.ExamineJwyDto;
-import com.xzx.gc.user.dto.JhyApplyDto;
-import com.xzx.gc.user.dto.JhyInfoListDto;
+import com.xzx.gc.entity.ScoreDetails;
+import com.xzx.gc.user.dto.*;
+import com.xzx.gc.user.mapper.AccountMapper;
import com.xzx.gc.user.mapper.JhyInfoMapper;
+import com.xzx.gc.user.vo.GetScoreNumVo;
import com.xzx.gc.user.vo.JhyInfoListVo;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import tk.mybatis.mapper.entity.Example;
+import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+@Slf4j
@Service
@Transactional
public class JhyInfoService {
@Autowired
private JhyInfoMapper jhyInfoMapper;
+ @Autowired
+ private AccountMapper accountMapper;
public void applyJhy(JhyApplyDto applyDto) {
JhyInfo mobileIsExist = jhyInfoMapper.selectExistJhyByIndeityOrMobile(applyDto.getMobile(), applyDto.getIdentity());
@@ -39,9 +49,13 @@
jhyInfoMapper.deleteByUserId(applyDto.getUserId());
+ log.info("图片地址:{}", applyDto.getCardPos());
JhyInfo jhyInfo = new JhyInfo();
BeanUtil.copyProperties(applyDto, jhyInfo);
jhyInfo.setCreatedTime(new Date());
+ jhyInfo.setIsJhy(JhyInfo.IS_JHY_N);
+ jhyInfo.setCardPos(applyDto.getCardPos());
+ jhyInfo.setStatus(JhyInfo.CHECK_WAIT);
jhyInfoMapper.insert(jhyInfo);
}
@@ -97,4 +111,40 @@
}
jhyInfoMapper.updateByPrimaryKey(jhyInfo);
}
+
+ public void addScoreNum(AddScoreNumDto model) {
+ Example exampleAccount = new Example(AccountInfo.class);
+ Example.Criteria criteriaAccount = exampleAccount.createCriteria();
+ criteriaAccount.andEqualTo("userId",model.getUserId());
+ List<AccountInfo> accountInfos = accountMapper.selectByExample(exampleAccount);
+ if(CollUtil.isNotEmpty(accountInfos)){
+ AccountInfo accountInfo = accountInfos.get(0);
+ String collectScore = StrUtil.isEmpty(accountInfo.getCollectScore())?"0":accountInfo.getCollectScore();
+// collectScore = collectScore + model.getScore();
+ accountInfo.setCollectScore(model.getScore().toString());
+ accountMapper.updateByPrimaryKey(accountInfo);
+
+ ScoreDetails scoreDetailsRet = new ScoreDetails();
+ scoreDetailsRet.setUserId(model.getUserId());
+ scoreDetailsRet.setType(ScoreDetails.SCORE_TYPE_ADMIN_RECHARGE);
+ scoreDetailsRet.setOriginalScore(new BigDecimal(collectScore).setScale( 0, BigDecimal.ROUND_DOWN ));
+ scoreDetailsRet.setCurrentScore(new BigDecimal(model.getScore()).setScale( 0, BigDecimal.ROUND_DOWN ));
+ scoreDetailsRet.setChangeScore(new BigDecimal(model.getScore()).setScale( 0, BigDecimal.ROUND_DOWN ));
+ scoreDetailsRet.setCreatedTime(new Date());
+ accountMapper.insertScoreDetailsRet(scoreDetailsRet);
+ }
+ }
+
+ public GetScoreNumVo getScoreNum(GetScoreNumDto model) {
+ GetScoreNumVo getScoreNumVo = new GetScoreNumVo();
+ Example exampleAccount = new Example(AccountInfo.class);
+ Example.Criteria criteriaAccount = exampleAccount.createCriteria();
+ criteriaAccount.andEqualTo("userId",model.getUserId());
+ List<AccountInfo> accountInfos = accountMapper.selectByExample(exampleAccount);
+ if(CollUtil.isNotEmpty(accountInfos)){
+ AccountInfo accountInfo = accountInfos.get(0);
+ getScoreNumVo.setScore(new BigDecimal(StrUtil.isEmpty(accountInfo.getCollectScore())?"0":accountInfo.getCollectScore()).setScale( 0, BigDecimal.ROUND_DOWN ));
+ }
+ return getScoreNumVo;
+ }
}
--
Gitblit v1.9.1