Commit 78094132 authored by licc's avatar licc

新增版本更新接口

parent 7b898ff7
...@@ -122,4 +122,6 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> { ...@@ -122,4 +122,6 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
*/ */
List<TradeRecord> getList(Map<String, Object> map); List<TradeRecord> getList(Map<String, Object> map);
TradeRecord getVersion();
} }
...@@ -100,10 +100,10 @@ ...@@ -100,10 +100,10 @@
user_id=#{userId} user_id=#{userId}
</if> </if>
<if test="yearMonth != null"> <if test="yearMonth != null">
AND( AND(
YEAR(create_time) = YEAR(#{yearMonth}) YEAR(create_time) = YEAR(#{yearMonth})
AND MONTH(create_time) = MONTH(#{yearMonth})) AND MONTH(create_time) = MONTH(#{yearMonth}))
</if> </if>
</where> </where>
</select> </select>
...@@ -226,4 +226,12 @@ ...@@ -226,4 +226,12 @@
limit #{startNum},#{endNum} limit #{startNum},#{endNum}
</select> </select>
<select id="getVersion" resultType="cn.wisenergy.model.app.TradeRecord">
select
<include refid="cols_all"/>
from
<include refid="table"/>
where trade_type=9
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -68,9 +68,9 @@ public class BankManger { ...@@ -68,9 +68,9 @@ public class BankManger {
} }
} }
//新增交易流水记录 //更改提现状态
if (null != record) { if (null != record) {
int count = recordMapper.add(record); int count = recordMapper.edit(record);
return count != 0; return count != 0;
} }
return true; return true;
......
...@@ -22,8 +22,17 @@ public interface AccountService { ...@@ -22,8 +22,17 @@ public interface AccountService {
/** /**
* 获取账户列表 * 获取账户列表
*
* @param query 查询条件 * @param query 查询条件
* @return 账户列表 * @return 账户列表
*/ */
R<PageInfo<AccountInfo>> getList(AccountInfoQuery query); R<PageInfo<AccountInfo>> getList(AccountInfoQuery query);
/**
* 版本更新
*
* @param version 版本号
* @return 安装包下载地址
*/
R<String> updateVersion(String version);
} }
...@@ -40,6 +40,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -40,6 +40,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
@Autowired @Autowired
private AccountMapper accountMapper; private AccountMapper accountMapper;
@Autowired
private TradeRecordMapper tradeRecordMapper;
/**
* 测试安卓包路径:https://www.xitiansen.com/upload/app-debug.apk
* 线上安卓包路径:http://app.xitiansen.com/upload/xitiansen.apk
*/
private static final String DOWNLOAD_URL = "https://www.xitiansen.com/upload/app-debug.apk";
@Override @Override
public R<AccountInfo> getByUserId(String userId) { public R<AccountInfo> getByUserId(String userId) {
AccountInfo accountInfo = accountMapper.getByUserId(userId); AccountInfo accountInfo = accountMapper.getByUserId(userId);
...@@ -55,7 +64,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -55,7 +64,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
pageHandle(query); pageHandle(query);
Map<String,Object> map=new HashMap<>(); Map<String, Object> map = new HashMap<>();
int total = accountMapper.count(); int total = accountMapper.count();
map.put("startNum", query.getStartNum()); map.put("startNum", query.getStartNum());
...@@ -69,6 +78,26 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -69,6 +78,26 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
return R.ok(info); return R.ok(info);
} }
@Override
public R<String> updateVersion(String version) {
log.info("shop-mall[]AccountServiceImpl[]updateVersion[]input.param.version:" + version);
if (StringUtils.isBlank(version)) {
return R.error("入参不能为空!");
}
//获取版本号信息
TradeRecord tradeRecord = tradeRecordMapper.getVersion();
if (null == tradeRecord) {
return R.error("版本号信息不存在,请联系管理员!");
}
//版本号不相等
if (!tradeRecord.getTradeNo().equals(version)) {
return R.ok(DOWNLOAD_URL);
}
return R.ok("当前已是最新版本!");
}
/** /**
* 分页处理方法 * 分页处理方法
* *
......
...@@ -204,6 +204,7 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple ...@@ -204,6 +204,7 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
BigDecimal earningsTotal = accountInfo.getEarningsTotal().subtract(money); BigDecimal earningsTotal = accountInfo.getEarningsTotal().subtract(money);
accountInfo.setEarningsTotal(earningsTotal); accountInfo.setEarningsTotal(earningsTotal);
//4、添加提现交易流水记录 //4、添加提现交易流水记录
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(accountInfo.getUserId()); tradeRecord.setUserId(accountInfo.getUserId());
...@@ -212,6 +213,13 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple ...@@ -212,6 +213,13 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
tradeRecord.setStatus(TradeStatusEnum.BANK_TRANSFER_ACCOUNTS.getCode()); tradeRecord.setStatus(TradeStatusEnum.BANK_TRANSFER_ACCOUNTS.getCode());
tradeRecord.setMoney(money); tradeRecord.setMoney(money);
//获取用户银行卡信息
BankInfo bankInfo = bankInfoMapper.getByUserId(dto.getUserId());
if (null != bankInfo && StringUtils.isNotEmpty(bankInfo.getCardNumber())) {
tradeRecord.setCardNumber(bankInfo.getCardNumber());
}
//更新提现状态,更新账户冻结金额
Boolean bool = bankManger.updateAccountAddRecord(accountInfo, tradeRecord); Boolean bool = bankManger.updateAccountAddRecord(accountInfo, tradeRecord);
if (!bool) { if (!bool) {
return R.ok(1, false); return R.ok(1, false);
...@@ -282,6 +290,10 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple ...@@ -282,6 +290,10 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
return R.error("提现账户信息不存在!"); return R.error("提现账户信息不存在!");
} }
tradeRecord.setStatus(TradeStatusEnum.WITHDRAWAL_SUCCESS.getCode());
BigDecimal frozenMoney = accountInfo.getFrozenMoney().subtract(tradeRecord.getMoney());
accountInfo.setFrozenMoney(frozenMoney);
//更新提现状态为 提现成功,更新账户冻结金额 //更新提现状态为 提现成功,更新账户冻结金额
boolean bool = bankManger.updateAccountAndRecord(accountInfo, tradeRecord); boolean bool = bankManger.updateAccountAndRecord(accountInfo, tradeRecord);
if (!bool) { if (!bool) {
......
...@@ -10,6 +10,7 @@ import io.swagger.annotations.Api; ...@@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -40,4 +41,16 @@ public class AccountController extends BaseController { ...@@ -40,4 +41,16 @@ public class AccountController extends BaseController {
public R<PageInfo<AccountInfo>> getList(AccountInfoQuery query) { public R<PageInfo<AccountInfo>> getList(AccountInfoQuery query) {
return accountService.getList(query); return accountService.getList(query);
} }
@ApiOperation(value = "设置页-版本更新", notes = "设置页-版本更新", httpMethod = "GET")
@ApiImplicitParam(name = "version", value = "版本号", dataType = "string")
@GetMapping("/version")
public R<String> version(String version) {
if(StringUtils.isBlank(version)){
return R.error("入参不能为空!");
}
return accountService.updateVersion(version);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment