Commit 60222743 authored by tangfang's avatar tangfang

修改余额为0的处理,

添加银行卡空指针问题
parent 78819d8f
......@@ -8,6 +8,7 @@ import com.pangding.web.util.DateUtil;
import com.pangding.web.vo.order.req.CapitalFlowReqVo;
import com.pangding.web.vo.order.req.back.CashWithdrawalBackReqVo;
import com.pangding.web.vo.order.res.CapitalFlowListResVo;
import com.pangding.web.vo.order.res.CapitalFlowResVo;
import com.pangding.web.vo.system.pd.company.CompanyMoneyVo;
import com.pangding.web.vo.system.req.company.CompanyMoneyReqVo;
import com.pangding.web.vo.system.res.company.CompanyMoneyTotalResVo;
......@@ -23,6 +24,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import static com.yanzuoguang.util.helper.DateHelper.getCurDate;
......@@ -71,6 +73,30 @@ public class FinanceController {
return ResponseResult.result(capitalFlowListResVo);
}
@RequestMapping(value = "/findCapitalFlowListGroup")
public ResponseResult<List<CapitalFlowResVo>> findCapitalFlowListGroup(@RequestBody CapitalFlowReqVo req) {
// CheckerHelper.newInstance()
// .notBlankCheck("companyId", req.getCompanyId())
// .checkException();
if (!StringHelper.isEmpty(req.getDateType()) && 1 == req.getDateType()) {
req.setStartPlayDate(req.getStartDate().substring(0, 10) + " 00:00:00");
req.setEndPlayDate(req.getEndDate().substring(0, 10) + " 23:59:59");
req.setStartDate("");
req.setEndDate("");
}
if (!StringHelper.isEmpty(req.getDateType()) && 0 == req.getDateType()) {
/*入参添加年月日*/
req.setStartOrderTime(req.getStartDate().substring(0, 10) + " 00:00:00");
req.setEndOrderTime(req.getEndDate().substring(0, 10) + " 23:59:59");
req.setStartDate("");
req.setEndDate("");
}
List<CapitalFlowResVo> list = financeService.findCapitalFlowListGroup(req);
return ResponseResult.result(list);
}
@PostMapping(value = "/withdrawal")
@ApiOperation(value = "公司余额查询", notes = "返回公司余额信息")
public ResponseResult<WithdrawalResVo> withdrawal(@RequestBody WithdrawalReqVo reqVo) {
......
......@@ -5,10 +5,14 @@ import com.pangding.web.vo.order.res.CapitalFlowResVo;
import com.yanzuoguang.dao.BaseDao;
import com.yanzuoguang.util.vo.PageSizeData;
import java.util.List;
public interface CapitalFlowDao extends BaseDao {
PageSizeData<CapitalFlowResVo> findCapitalFlowList(CapitalFlowReqVo req);
CapitalFlowResVo findCapitalFlowTotal(CapitalFlowReqVo req);
List<CapitalFlowResVo> findCapitalFlowTotalList(CapitalFlowReqVo req);
}
......@@ -8,6 +8,8 @@ import com.yanzuoguang.dao.impl.BaseDaoImpl;
import com.yanzuoguang.util.vo.PageSizeData;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class CapitalFlowDaoImpl extends BaseDaoImpl implements CapitalFlowDao {
......@@ -41,7 +43,12 @@ public class CapitalFlowDaoImpl extends BaseDaoImpl implements CapitalFlowDao {
"SUM(CASE WHEN category = 1 THEN order_money ELSE 0 END) AS withdrawalAmount," +
"SUM(CASE WHEN category = 3 THEN actual_money ELSE 0 END) AS refundMoney," +
"SUM(CASE WHEN category <> 3 THEN actual_money ELSE 0 END) - SUM(CASE WHEN category = 1 THEN order_money ELSE 0 END) as actualMoney" +
" FROM pd_capital_flow where 1=1 {WHERE} order by time desc")
" FROM pd_capital_flow where 1=1 {WHERE} GROUP BY 1{GROUP} order by time desc")
.addPara("companyGroup", "{GROUP}", ",company_id")
.addPara("merchantGroup", "{GROUP}", ",merchant_name")
.addPara("productGroup", "{GROUP}", ",product_name")
.add("companyId"," AND company_id = ? ")
.add("companyName"," AND company_name LIKE concat(?,'%')")
.add("merchantName"," AND merchant_name LIKE concat(?,'%') ")
......@@ -68,4 +75,9 @@ public class CapitalFlowDaoImpl extends BaseDaoImpl implements CapitalFlowDao {
public CapitalFlowResVo findCapitalFlowTotal(CapitalFlowReqVo req){
return this.queryFirst(CapitalFlowResVo.class, QUERY_LIST_TOTAL, req);
}
@Override
public List<CapitalFlowResVo> findCapitalFlowTotalList(CapitalFlowReqVo req){
return this.query(CapitalFlowResVo.class, QUERY_LIST_TOTAL, req);
}
}
......@@ -8,6 +8,7 @@ import com.pangding.web.mq.CompanyProducer;
import com.pangding.web.mq.DistributionProducer;
import com.pangding.web.mq.OrderProducer;
import com.pangding.web.mq.PayProducer;
import com.pangding.web.system.service.SystemWarnService;
import com.pangding.web.vo.order.req.CapitalFlowReqVo;
import com.pangding.web.vo.order.req.OrderLogReqVo;
import com.pangding.web.vo.order.req.OrderMoneyDetailReqVo;
......@@ -15,6 +16,7 @@ import com.pangding.web.vo.order.req.back.CashWithdrawalBackReqVo;
import com.pangding.web.vo.order.tl.CashWithdrawalReqVo;
import com.pangding.web.vo.order.tl.SoundReqVo;
import com.pangding.web.vo.system.req.CompanyMsgReqVo;
import com.pangding.web.vo.system.req.SystemWarnReqVo;
import com.pangding.web.vo.system.req.company.UpdateCompanyMoneyReqVo;
import com.pangding.web.vo.system.res.company.CompanyResVo;
import com.rabbitmq.client.Channel;
......@@ -52,6 +54,8 @@ public class CompanyConsumer {
private FinanceService financeService;
@Autowired
private CompanyService companyService;
@Autowired
private SystemWarnService systemWarnService;
/**
* 初始化mq
......@@ -277,4 +281,12 @@ public class CompanyConsumer {
mqService.basicAck(message, channel);
}
}
@RabbitListener(queues = {MqConstant.SYSTEM_WARN_SAVE})
public void systemWarnSave(String content, Message message, Channel channel) {
mqService.basicHandle(message, channel, MqConstant.SYSTEM_WARN_SAVE, content, 300, (contentTemp) -> {
SystemWarnReqVo systemWarnReqVo = JsonHelper.deserialize(content, SystemWarnReqVo.class);
systemWarnService.save(systemWarnReqVo);
});
}
}
......@@ -5,10 +5,13 @@ import com.pangding.web.authority.vo.resvo.WithdrawalResVo;
import com.pangding.web.vo.order.req.CapitalFlowReqVo;
import com.pangding.web.vo.order.req.back.CashWithdrawalBackReqVo;
import com.pangding.web.vo.order.res.CapitalFlowListResVo;
import com.pangding.web.vo.order.res.CapitalFlowResVo;
import com.pangding.web.vo.system.req.company.UpdateCompanyMoneyReqVo;
import com.pangding.web.vo.system.res.company.CompanyResVo;
import com.yanzuoguang.util.vo.ResponseResult;
import java.util.List;
/**
* @Author zhangjinyao
* @create 2019/6/18 20:01
......@@ -19,6 +22,8 @@ public interface FinanceService {
CapitalFlowListResVo findCapitalFlowList(CapitalFlowReqVo req);
List<CapitalFlowResVo> findCapitalFlowListGroup(CapitalFlowReqVo req);
/**
* 申请提现
* @param req
......
......@@ -29,6 +29,7 @@ import com.yanzuoguang.mq.service.MqService;
import com.yanzuoguang.mq.vo.req.MessageLogReqVo;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.helper.CalcHelper;
import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.util.helper.StringHelper;
......@@ -121,6 +122,14 @@ public class FinanceServiceImpl implements FinanceService {
return capitalFlowListResVo;
}
@Override
public List<CapitalFlowResVo> findCapitalFlowListGroup(CapitalFlowReqVo req) {
List<CapitalFlowResVo> capitalFlowTotal = capitalFlowDao.findCapitalFlowTotalList(req);
return capitalFlowTotal;
}
/**
* 申请提现
*
......@@ -198,7 +207,7 @@ public class FinanceServiceImpl implements FinanceService {
// 先修改公司余额
UpdateCompanyMoneyReqVo updateCompanyMoneyReqVo = new UpdateCompanyMoneyReqVo();
updateCompanyMoneyReqVo.setCompanyId(req.getCompanyId());
updateCompanyMoneyReqVo.setNewWithdrawTotalCash(-req.getOrderMoney());
updateCompanyMoneyReqVo.setNewWithdrawTotalCash(0d);
updateCompanyMoneyReqVo.setFrozenMoney(req.getOrderMoney());
companyExtendDao.updateCompanyMoney(updateCompanyMoneyReqVo);
......@@ -211,7 +220,10 @@ public class FinanceServiceImpl implements FinanceService {
}
// 可提现余额
double withdrawTotalCash = companyResVo.getWithdrawTotalCash();
if (withdrawTotalCash < 0) {
double frozenMoney = companyResVo.getFrozenMoney();
double money = CalcHelper.sub(withdrawTotalCash, frozenMoney);
if (CalcHelper.sub(money, req.getOrderMoney()) < 0) {
throw new CodeException("提现金额不能大于可提现余额");
}
if (companyResVo.getMinWithdrawMoney() > req.getOrderMoney() || companyResVo.getMaxWithdrawMoney() < req.getOrderMoney()) {
......@@ -392,7 +404,7 @@ public class FinanceServiceImpl implements FinanceService {
UpdateCompanyMoneyReqVo updateCompanyMoneyReqVo = new UpdateCompanyMoneyReqVo();
updateCompanyMoneyReqVo.setCompanyId(req.getCompanyId());
updateCompanyMoneyReqVo.setFrozenMoney(-capitalFlowVo.getOrderMoney());
updateCompanyMoneyReqVo.setNewWithdrawTotalCash(0d);
updateCompanyMoneyReqVo.setNewWithdrawTotalCash(-capitalFlowVo.getOrderMoney());
// todo...2021.10.9被注释 updateCompanyMoneyReqVo.setLateFee(-capitalFlowVo.getServiceCharge());
companyExtendDao.updateCompanyMoney(updateCompanyMoneyReqVo);
......
......@@ -24,7 +24,8 @@ public class swagger {
//为当前包路径
.apis(SwaggerHelper.basePackage(
"com.pangding.web.authority.controller",
"com.pangding.web.V2.web"
"com.pangding.web.system.web",
"com.pangding.web.report.web"
))
.paths(PathSelectors.any())
.build();
......
......@@ -9,4 +9,6 @@ public interface SystemWarnDao extends BaseDao {
PageSizeData<SystemWarnResVo> findListPage(SystemWarnPageReqVo req);
SystemWarnResVo findListTotal(SystemWarnPageReqVo req);
}
......@@ -13,12 +13,32 @@ public class SystemWarnDaoImpl extends BaseDaoImpl implements SystemWarnDao {
private final String QUERY_LIST = "QUERY_LIST";
private final String QUERY_TOTAL = "QUERY_TOTAL";
@Override
protected void init() {
register(SystemWarnVo.class);
table.add(QUERY_LIST, " select * from pd_system_warning where 1=1 {WHERE}")
table.add(QUERY_LIST, " select a.*,b.enum_value as channelTypeName from pd_system_warning a " +
" LEFT JOIN pd_enum b on a.channel_type = b.enum_key and b.child_type = 'channel_type'" +
" where 1=1 {WHERE}")
.add("startDate"," and a.create_date >= ? ")
.add("endDate"," and a.create_date <= ? ")
.add("systemWarningId"," and system_warning_id = ? ")
.add("warnType"," and warn_type = ? ")
.add("warnName"," and warnName LIKE concat('%', ?,'%') ")
.add("companyName"," and companyName LIKE concat('%', ?,'%') ")
.add("merchantName"," and merchantName LIKE concat('%', ?,'%') ")
.add("productName"," and productName LIKE concat('%', ?,'%') ")
.add("channelTypeList"," and channelTypeList in ( ? ) ")
.add("warnStatusList"," and warnStatusList in ( ? ) ");
table.add(QUERY_TOTAL, " select COUNT(1) as warnTotalNum, " +
"SUM(case WHEN warn_status = 0 THEN 1 else 0 END) as unreadNum," +
"SUM(case WHEN warn_status = 1 THEN 1 else 0 END) as readNum " +
" from pd_system_warning a" +
" where 1=1 {WHERE}")
.add("startDate"," and create_date >= ? ")
.add("endDate"," and create_date <= ? ")
.add("systemWarningId"," and system_warning_id = ? ")
......@@ -36,4 +56,11 @@ public class SystemWarnDaoImpl extends BaseDaoImpl implements SystemWarnDao {
return this.queryPage(SystemWarnResVo.class, req, QUERY_LIST, req);
}
public SystemWarnResVo findListTotal(SystemWarnPageReqVo req){
return this.queryFirst(SystemWarnResVo.class, QUERY_TOTAL, req);
}
}
......@@ -2,13 +2,14 @@ package com.pangding.web.system.service;
import com.pangding.web.vo.system.req.SystemWarnPageReqVo;
import com.pangding.web.vo.system.req.SystemWarnReqVo;
import com.pangding.web.vo.system.res.SystemWarnListResVo;
import com.pangding.web.vo.system.res.SystemWarnResVo;
import com.yanzuoguang.util.vo.PageSizeData;
public interface SystemWarnService {
PageSizeData<SystemWarnResVo> findListPage(SystemWarnPageReqVo req);
SystemWarnListResVo findListPage(SystemWarnPageReqVo req);
SystemWarnResVo find(SystemWarnReqVo req);
......
......@@ -5,6 +5,7 @@ import com.pangding.web.system.service.SystemWarnService;
import com.pangding.web.vo.system.pd.SystemWarnVo;
import com.pangding.web.vo.system.req.SystemWarnPageReqVo;
import com.pangding.web.vo.system.req.SystemWarnReqVo;
import com.pangding.web.vo.system.res.SystemWarnListResVo;
import com.pangding.web.vo.system.res.SystemWarnResVo;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.helper.StringHelper;
......@@ -20,8 +21,13 @@ public class SystemWarnServiceImpl implements SystemWarnService {
this.systemWarnDao = systemWarnDao;
}
public PageSizeData<SystemWarnResVo> findListPage(SystemWarnPageReqVo req){
return systemWarnDao.findListPage(req);
public SystemWarnListResVo findListPage(SystemWarnPageReqVo req){
PageSizeData<SystemWarnResVo> systemWarnResVoPageSizeData = systemWarnDao.findListPage(req);
SystemWarnResVo systemWarnResVo = systemWarnDao.findListTotal(req);
SystemWarnListResVo systemWarnListResVo = new SystemWarnListResVo();
systemWarnListResVo.setSystemWarnResVoPageSizeData(systemWarnResVoPageSizeData);
systemWarnListResVo.setSystemWarnResVo(systemWarnResVo);
return systemWarnListResVo;
}
public SystemWarnResVo find(SystemWarnReqVo req){
......
......@@ -3,6 +3,7 @@ package com.pangding.web.system.web;
import com.pangding.web.system.service.SystemWarnService;
import com.pangding.web.vo.system.req.SystemWarnPageReqVo;
import com.pangding.web.vo.system.req.SystemWarnReqVo;
import com.pangding.web.vo.system.res.SystemWarnListResVo;
import com.pangding.web.vo.system.res.SystemWarnResVo;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
......@@ -27,7 +28,7 @@ public class SystemWarnController {
@RequestMapping(value = "/findSystemWarnList")
@ApiOperation(value = "查询预警信息", notes = "返回预警信息列表.")
public ResponseResult<PageSizeData<SystemWarnResVo>> findSystemWarnList(@RequestBody SystemWarnPageReqVo req) {
public ResponseResult<SystemWarnListResVo> findSystemWarnList(@RequestBody SystemWarnPageReqVo req) {
return ResponseResult.result(systemWarnService.findListPage(req));
}
......
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