提交 5a7d282d authored 作者: huyufan's avatar huyufan

资金管理

上级 df3c4282
......@@ -17,6 +17,9 @@ import lombok.ToString;
@ToString
public class PagePlatformPrepaidFreightAccountParam extends PageParam {
@ApiModelProperty(value="货主编码",example = "20145787812312312")
private Long ownerUserNo;
@ApiModelProperty(value="订单编号",example = "201457878")
private String orderNo;
......
package com.clx.performance.param.pc;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* @Author huyufan
* @create 2023-09-19 13:33
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
public class PlatformAccountTopUpParam{
@ApiModelProperty(value="货主编码",example = "20145787812312312")
private Long ownerUserNo;
@ApiModelProperty(value="id",example = "1")
private Integer id;
@ApiModelProperty(value="账户类型",example = "1:保证金 2:预付运费")
private Integer accountType;
@ApiModelProperty(value="审批拒绝原因")
private String turnDownContent;
}
package com.clx.performance.vo.pc;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Getter
......@@ -14,96 +14,91 @@ import java.math.BigDecimal;
@NoArgsConstructor
public class OwnerAccountRunningWaterRecordVO {
/**
* id
*/
@ApiModelProperty("id")
private Integer id;
/**
* 货主编码
*/
@ApiModelProperty("货主编码")
private Long ownerUserNo;
/**
* 货主名称
*/
@ApiModelProperty("货主名称")
private String ownerName;
/**
* 联系电话
*/
@ApiModelProperty("联系电话")
private String mobile;
/**
* 账户类型
*/
@ApiModelProperty("账户类型")
private Integer accountType;
/**
* 关联数据主键ID
*/
@ApiModelProperty("关联数据主键ID")
private Integer relationId;
/**
* 流水类型
*/
@ApiModelProperty("流水类型")
private Integer runningWaterType;
/**
* 订单ID
*/
@ApiModelProperty("订单ID")
private Integer orderId;
/**
* 订单编号
*/
@ApiModelProperty("订单编号")
private String orderNo;
@ApiModelProperty("货单编号")
private String orderGoodsNo;
@ApiModelProperty("货单状态")
private Integer orderGoodsStatus;
@ApiModelProperty("提取吨数")
private BigDecimal extractWeight;
@ApiModelProperty("剩余拉运吨数")
private BigDecimal residueTransportWeight;
@ApiModelProperty("已拉运吨数")
private BigDecimal alreadyTransportWeight;
@ApiModelProperty("发货地址ID")
private Integer sendAddressId;
@ApiModelProperty(value = "发货地址全称")
private String sendAddressAll;
@ApiModelProperty("发货地址简称")
private String sendAddressShorter;
@ApiModelProperty("发货地址经度")
private BigDecimal sendLongitude;
@ApiModelProperty("发货地址纬度")
private BigDecimal sendLatitude;
@ApiModelProperty("收货地址ID")
private Integer receiveAddressId;
@ApiModelProperty(value = "收货地址全称")
private String reveiveAddressAll;
@ApiModelProperty("收货地址简称")
private String receiveAddressShorter;
@ApiModelProperty("收货地址经度")
private BigDecimal receiveLongitude;
@ApiModelProperty("收货地址纬度")
private BigDecimal receiveLatitude;
@ApiModelProperty("货物ID")
private Integer goodsId;
@ApiModelProperty("货物名称")
private String goodsName;
@ApiModelProperty("挂单方式 1公开派单 2定向派单")
private Integer pendingOrderWay;
@ApiModelProperty("定向运单失效时间")
private String directionalExpireTime;
@ApiModelProperty("最晚到达货源地时间/运单的最晚装货时间")
private String lastArriveSendTime;
@ApiModelProperty("挂单时间")
private String pendingOrderTime;
@ApiModelProperty("提取方式 1提取全部 2提取部分")
private Integer extractWay;
@ApiModelProperty("需要车辆/辆")
private Integer needTruckNum;
@ApiModelProperty("高级物流经理id")
private Integer seniorLogisticsManagerId;
@ApiModelProperty("高级物流经理姓名")
private String seniorLogisticsManagerName;
@ApiModelProperty("挂单运费")
@MoneyOutConvert
private BigDecimal pendingOrderFreight;
@ApiModelProperty("创建人用户编号")
private Long userNo;
@ApiModelProperty("创建人姓名")
private String userName;
@ApiModelProperty("创建时间")
private String createTime;
/**
* 运单ID
*/
@ApiModelProperty("运单ID")
private Integer orderChildId;
/**
* 运单编号
*/
@ApiModelProperty("运单编号")
private String orderChildNo;
/**
* 变动金额
*/
@ApiModelProperty("变动金额")
private BigDecimal alterationBalance;
/**
* 冻结金额
*/
@ApiModelProperty("冻结金额")
private BigDecimal frozenBalance;
/**
* 可用余额
*/
@ApiModelProperty("可用余额")
private BigDecimal usableBalance;
/**
* 账户余额
*/
@ApiModelProperty("账户余额")
private BigDecimal accountBalance;
/**
* 操作人
*/
@ApiModelProperty("操作人")
private String createBy;
/**
* 操作时间
*/
@ApiModelProperty("操作时间")
private LocalDateTime createTime;
}
\ No newline at end of file
......@@ -19,6 +19,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
@Slf4j
@RestController
......@@ -61,9 +63,9 @@ public class CarrierAccountController {
@ApiOperation(value = "充值审批", notes = "<br>By:胡宇帆")
@GetMapping("/accountTopUpApprove")
public void accountTopUpApprove(@RequestParam Integer id, @RequestParam String turnDownContent) {
ownerAccountService.accountTopUpApprove(id,turnDownContent);
@PostMapping("/accountTopUpApprove")
public void accountTopUpApprove(@RequestBody PlatformAccountTopUpParam param) {
ownerAccountService.accountTopUpApprove(param);
}
@ApiOperation(value = "提现审批", notes = "<br>By:胡宇帆")
......
......@@ -27,7 +27,7 @@ import java.util.List;
@RequestMapping("/pc/owner")
@Validated
@AllArgsConstructor
@Api(tags = "PC-资金管理")
@Api(tags = "PC-货主资金管理")
public class OwnerAccountController {
private final OwnerAccountService ownerAccountService;
......@@ -41,8 +41,8 @@ public class OwnerAccountController {
@ApiOperation(value = "账户信息", notes = "<br>By:胡宇帆")
@GetMapping("/accountInfo")
@UnitCovert(param = false)
public Result<List<OwnerAccountVO>> accountInfo(@RequestParam String ownerNo) {
List<OwnerAccountVO> accountVOList = ownerAccountService.accountInfo(ownerNo);
public Result<List<OwnerAccountVO>> accountInfo(@RequestParam Long ownerUserNo) {
List<OwnerAccountVO> accountVOList = ownerAccountService.accountInfo(ownerUserNo);
return Result.ok(accountVOList);
}
......
......@@ -12,5 +12,7 @@ import java.util.List;
public interface OwnerAccountDao extends BaseDao<OwnerAccountMapper, OwnerAccount, Integer> {
IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param);
List<OwnerAccountVO> accountInfo(String ownerNo);
List<OwnerAccountVO> accountInfo(Long ownerUserNo);
OwnerAccount getAccountByOwnerUserNoAndAccountType(Long ownerUserNo,Integer accountType);
}
......@@ -28,10 +28,15 @@ public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAc
}
@Override
public List<OwnerAccountVO> accountInfo(String ownerNo) {
List<OwnerAccount> list = baseMapper.selectList(lQrWrapper().eq(OwnerAccount::getOwnerUserNo, ownerNo));
public List<OwnerAccountVO> accountInfo(Long ownerUserNo) {
List<OwnerAccount> list = baseMapper.selectList(lQrWrapper().eq(OwnerAccount::getOwnerUserNo, ownerUserNo));
return ownerAccountStruct.convertList(list);
}
@Override
public OwnerAccount getAccountByOwnerUserNoAndAccountType(Long ownerUserNo, Integer accountType) {
return baseMapper.selectOne(lQrWrapper().eq(OwnerAccount::getAccountType, accountType).eq(OwnerAccount::getOwnerUserNo, ownerUserNo));
}
}
......@@ -7,11 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.msl.common.config.KeyColumn;
import com.msl.common.model.HasKey;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.poi.hpsf.Decimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
......@@ -34,7 +33,7 @@ public class OwnerAccount implements HasKey<Integer> {
* 货主编码
*/
@TableField("owner_user_no")
private String ownerUserNo;
private Long ownerUserNo;
/**
* 货主名称
*/
......@@ -54,17 +53,17 @@ public class OwnerAccount implements HasKey<Integer> {
* 账户余额
*/
@TableField("account_balance")
private Decimal accountBalance;
private BigDecimal accountBalance;
/**
* 可用余额
*/
@TableField("usable_balance")
private Decimal usableBalance;
private BigDecimal usableBalance;
/**
* 冻结金额
*/
@TableField("frozen_balance")
private Decimal frozenBalance;
private BigDecimal frozenBalance;
/**
* 创建人
*/
......
......@@ -12,6 +12,7 @@ import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.poi.hpsf.Decimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
......@@ -32,8 +33,8 @@ public class OwnerRunningWaterRecord implements HasKey<Integer> {
/**
* 货主编码
*/
@TableField("owner_no")
private String ownerNo;
@TableField("owner_user_no")
private Long ownerUserNo;
/**
* 货主名称
*/
......@@ -43,12 +44,18 @@ public class OwnerRunningWaterRecord implements HasKey<Integer> {
* 联系电话
*/
@TableField("mobile")
private Integer mobile;
private String mobile;
/**
* 账户类型
*/
@TableField("account_type")
private Integer accountType;
/**
* 关联数据主键ID
*/
@TableField("relation_id")
private Integer relationId;
/**
* 流水类型
*/
......@@ -78,22 +85,22 @@ public class OwnerRunningWaterRecord implements HasKey<Integer> {
* 变动金额
*/
@TableField("alteration_balance")
private Double alterationBalance;
private BigDecimal alterationBalance;
/**
* 冻结金额
*/
@TableField("frozen_balance")
private Decimal frozenBalance;
private BigDecimal frozenBalance;
/**
* 可用余额
*/
@TableField("usable_balance")
private Decimal usableBalance;
private BigDecimal usableBalance;
/**
* 账户余额
*/
@TableField("account_balance")
private Decimal accountBalance;
private BigDecimal accountBalance;
/**
* 操作人
*/
......
......@@ -14,7 +14,7 @@ public interface OwnerAccountService {
IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(PagePlatformPrepaidFreightAccountParam param);
List<OwnerAccountVO> accountInfo(String ownerNo);
List<OwnerAccountVO> accountInfo(Long ownerUserNo);
Long accountTopUp(OwnerTopUpParam param);
......@@ -22,10 +22,8 @@ public interface OwnerAccountService {
/**
* 充值审批
* @param id
* @param turnDownContent
*/
void accountTopUpApprove(Integer id, String turnDownContent);
void accountTopUpApprove(PlatformAccountTopUpParam param);
/**
* 提现审批
......
......@@ -8,6 +8,8 @@ import com.clx.performance.dao.OwnerRunningWaterRecordDao;
import com.clx.performance.dao.OwnerTopUpDao;
import com.clx.performance.enums.IdTypeEnum;
import com.clx.performance.enums.OwnerAccountEnum;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.model.OwnerAccount;
import com.clx.performance.model.OwnerCaseOut;
import com.clx.performance.model.OwnerRunningWaterRecord;
import com.clx.performance.model.OwnerTopUp;
......@@ -15,12 +17,15 @@ import com.clx.performance.param.pc.*;
import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.performance.vo.pc.OwnerAccountVO;
import com.msl.common.base.Optional;
import com.msl.common.exception.ServiceSystemException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
@Slf4j
......@@ -54,8 +59,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
}
@Override
public List<OwnerAccountVO> accountInfo(String ownerNo) {
return ownerAccountDao.accountInfo(ownerNo);
public List<OwnerAccountVO> accountInfo(Long ownerUserNo) {
return ownerAccountDao.accountInfo(ownerUserNo);
}
@Override
......@@ -93,27 +98,47 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
/**
* 充值审批
*
* @param id
* @param turnDownContent
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void accountTopUpApprove(Integer id, String turnDownContent) {
public void accountTopUpApprove(PlatformAccountTopUpParam param) {
Optional<OwnerTopUp> optional = ownerTopUpDao.getEntityByKey(param.getId());
if (!optional.isPresent()) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前ID未查询到有效记录");
}
OwnerTopUp ownerTopUp = optional.get();
OwnerTopUp entity = new OwnerTopUp();
if (StringUtils.isNotBlank(turnDownContent)) {
entity.setId(id);
entity.setApprovalTurnDown(turnDownContent);
if (StringUtils.isNotBlank(param.getTurnDownContent())) {
entity.setId(param.getId());
entity.setApprovalTurnDown(param.getTurnDownContent());
entity.setStatus(OwnerAccountEnum.TopUpStatus.APPROVAL_REJECTION.getCode());
ownerTopUpDao.updateEntityByKey(entity);
} else {
entity.setId(id);
entity.setId(param.getId());
entity.setStatus(OwnerAccountEnum.TopUpStatus.APPROVAL_APPROVE.getCode());
ownerTopUpDao.updateEntityByKey(entity);
//需要插入充值流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
BigDecimal topUpBalance = ownerTopUp.getTopUpBalance();
runningWaterRecord.setOwnerName("测试");
runningWaterRecord.setMobile("11111111111");
runningWaterRecord.setCreateBy("操作人测试");
runningWaterRecord.setRelationId(ownerTopUp.getId());
runningWaterRecord.setAccountBalance(topUpBalance);
runningWaterRecord.setOwnerUserNo(param.getOwnerUserNo());
runningWaterRecord.setAccountType(param.getAccountType());
runningWaterRecord.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.TOP_UP.getCode());
ownerRunningWaterRecordDao.saveEntity(runningWaterRecord);
//给对应账户增加金额
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(param.getOwnerUserNo(), param.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setAccountBalance(account.getAccountBalance().add(topUpBalance));
update.setUsableBalance(account.getUsableBalance().add(topUpBalance));
update.setId(account.getId());
ownerAccountDao.updateEntityByKey(update);
}
}
......
......@@ -13,11 +13,12 @@ public class OwnerRunningWaterRecordSqlProvider {
public String marginAccountPageList(@Param("param") PagePlatformMarginAccountParam param) {
String sql = new SQL() {{
SELECT("a.id, a.owner_code," +
SELECT("a.id, a.owner_user_no," +
" a.owner_name, a.mobile, a.account_type, a.running_water_type,a.order_id,a.order_no,a.order_child_id,a.order_child_no,a.alteration_balance," +
" a.account_balance,a.usable_balance, a.frozen_balance,a.create_by,a.create_time");
FROM("owner_running_water_record a");
WHERE("a.account_type =" + OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode());
WHERE("a.owner_user_no = #{param.ownerUserNo}");
if (StringUtils.isNotBlank(param.getBeginTime()) && StringUtils.isNotBlank(param.getEndTime())) {
WHERE("a.create_time >= #{param.beginTime} and a.create_time <= #{param.endTime}");
......@@ -40,6 +41,7 @@ public class OwnerRunningWaterRecordSqlProvider {
" a.account_balance,a.usable_balance, a.frozen_balance,a.create_by,a.create_time");
FROM("owner_running_water_record a");
WHERE("a.account_type =" + OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode());
WHERE("a.owner_user_no = #{param.ownerUserNo}");
if (StringUtils.isNotBlank(param.getBeginTime()) && StringUtils.isNotBlank(param.getEndTime())) {
WHERE("a.create_time >= #{param.beginTime} and a.create_time <= #{param.endTime}");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论