提交 3c6e9593 authored 作者: liuhaiquan's avatar liuhaiquan

Merge remote-tracking branch 'origin/v5.5_settlement_20231011' into v5.5_settlement_20231011

......@@ -69,7 +69,7 @@ public enum PerformanceResultEnum implements ResultEnum {
SETTLEMENT_ORDER_STATUS_CHANGED(1401, "结算单状态已变更,请重新刷新页面"),
SETTLEMENT_NO_FOUND(1401, "结算单不存在"),
MONEY_NO_SAME(1501, "货主提现金额和平台支付金额不一致"),
;
private final int code;
......
......@@ -18,10 +18,10 @@ public enum SettlementLogEnum {
UPLOAD_SETTLEMENT (2, "上传结算凭证"),
OWNER_TO_BE_CONFIRMED(3, "货主确认结算单"),
SHIPPER_TO_PAYMENT(4, "货主付款"),
PLATFORM_CONFIRMED_OWNER_PAYMENT(5, "平台确认付款"),
PLATFORM_CONFIRMED_OWNER_PAYMENT(5, "平台确认付款"),
PLATFORM_TO_PAYMENT(6, "平台付款"),
OWNER_CONFIRMED_PLATFORM_PAYMENT(7, "货主确认付款"),
INVOICE_TO_BE_MAILED(8, "邮寄发票"),
OWNER_CONFIRMED_PLATFORM_PAYMENT(7, "货主确认付款"),
INVOICE_TO_BE_MAILED(8, "邮寄发票"),
COMPLETED(9, "已完结"),
;
......
package com.clx.performance.feign;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.vo.feign.OrderGoodsFeignVO;
import com.msl.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.constraints.NotBlank;
......@@ -27,4 +30,6 @@ public interface PerformanceFeign {
@GetMapping(value = {"clx-performance/feign/orderGoods/getOrderGoodsListByOrderNo"})
List<OrderGoodsFeignVO> getOrderGoodsListByOrderNo(@RequestParam String orderNo);
@PostMapping(value = {"clx-performance/feign/owner/ownerAccountFrozen"})
Result<Object> ownerAccountFrozen(@RequestBody FrozenAccountParam param);
}
package com.clx.performance.param.pc;
import com.msl.common.convertor.type.MoneyInConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
......@@ -29,6 +30,7 @@ public class OwnerCaseOutApproveParam {
private String paymentProof;
@ApiModelProperty(value = "平台付款金额", example = "11.21")
@MoneyInConvert
private BigDecimal platformPayBalance;
}
......@@ -17,7 +17,7 @@ public class PageOwnerAccountListParam extends PageParam {
private String ownerUserNo;
@ApiModelProperty(value = "联系电话")
private Integer mobile;
private String mobile;
@ApiModelProperty(value = "账户类型 1:保证金 2:预付运费")
private Integer accountType;
......
......@@ -29,4 +29,7 @@ public class PageOwnerAccountRunningWaterParam extends PageParam {
@ApiModelProperty(value = "操作结束时间",example = "2020-01-01 10:10:10")
private String endTime;
@ApiModelProperty(value="货主编码",example = "20145787812312312")
private Long ownerUserNo;
}
......@@ -16,9 +16,6 @@ import lombok.ToString;
@ToString
public class PlatformAccountTopUpParam{
@ApiModelProperty(value="货主编码",example = "20145787812312312")
private Long ownerUserNo;
@ApiModelProperty(value="id",example = "1")
private Integer id;
......
package com.clx.performance.param.pc.owner;
import com.msl.common.convertor.type.MoneyInConvert;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
......@@ -15,11 +14,10 @@ import java.math.BigDecimal;
public class FrozenAccountParam {
private Long userNo;
private String mobile;
private String ownerName;
@MoneyInConvert
//预付运费
private BigDecimal frozenBalance;
@MoneyInConvert
//保证金
private BigDecimal ensureBalance;
private Integer orderId;
private String orderNo;
......
......@@ -22,6 +22,6 @@ public class PageCarrierSettlementOwnerParam extends PageParam {
@ApiModelProperty(value="货主编码",example = "201457878")
private Long ownerUserNo;
@ApiModelProperty(value="状态 10:待锁定 20:待对账 30:待货主确认 40:待货主付款 50:平台确认货主付款 60:待平台付款 70:货主确认平台付款 80:待邮寄发票 90:已完结",example = "10")
@ApiModelProperty(value="状态 10:待锁定 20:待对账 30:待货主确认 40:待货主付款 50:待平台确认付款 60:待平台付款 70:待货主确认付款 80:待邮寄发票 90:已完结",example = "10")
private String status;
}
......@@ -22,17 +22,17 @@ public class OwnerAccountVO {
* 货主编码
*/
@ApiModelProperty(value = "货主编码")
private String ownerNo;
private String ownerUserNo;
/**
* 货主名称
*/
@ApiModelProperty(value = "货主名称")
private String ownerName;
private String ownerUserName;
/**
* 联系电话
*/
@ApiModelProperty(value = "联系电话")
private Integer mobile;
private String mobile;
/**
* 账户类型;1:保证金 2:预付运费
*/
......
......@@ -30,6 +30,14 @@ public class CarrierPageSettlementOwnerDetailVO {
private String childNo;
@ApiModelProperty(value = "结算单号")
private String settlementNo;
@ApiModelProperty(value = "发货地址id", example = "")
private Integer sendAddressId;
@ApiModelProperty(value = "发货地址", example = "")
private String sendAddress;
@ApiModelProperty(value = "收货地址id", example = "")
private Integer receiveAddressId;
@ApiModelProperty(value = "收货地址", example = "")
private String receiveAddress;
@ApiModelProperty(value = "货物id")
private Integer goodsId;
@ApiModelProperty(value = "货物名称")
......
......@@ -50,6 +50,6 @@ public class CarrierPageSettlementOwnerVO {
private BigDecimal invoiceFreight;
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "状态 10:待锁定 20:待对账 30:待货主确认 40:待货主付款 50:平台确认货主付款 60:待平台付款 70:货主确认平台付款 80:待邮寄发票 90:已完结")
@ApiModelProperty(value = "状态 10:待锁定 20:待对账 30:待货主确认 40:待货主付款 50:待平台确认付款 60:待平台付款 70:待货主确认付款 80:待邮寄发票 90:已完结")
private Integer status;
}
......@@ -132,10 +132,10 @@ public class CarrierSettlementOwnerDetailVO {
@ApiModelProperty(value = "开票状态Msg 1-已开票 2-部分开票 3-无需开票", example = "无需开票")
private String invoiceStatusMsg;
@ApiModelProperty(value = "状态code 1-待锁定,2-待对账,3-待货主确认,4-待货主付款,5-付款待确认,6-待邮寄发票,7-待平台付款,8-已完结", example = "1")
@ApiModelProperty(value = "状态code 10:待锁定 20:待对账 30:待货主确认 40:待货主付款 50:待平台确认付款 60:待平台付款 70:待货主确认付款 80:待邮寄发票 90:已完结", example = "10")
private Integer statusCode;
@ApiModelProperty(value = "状态Msg 1-待锁定,2-待对账,3-待货主确认,4-待货主付款,5-付款待确认,6-待邮寄发票,7-待平台付款,8-已完结", example = "待锁定")
@ApiModelProperty(value = "状态Msg", example = "待锁定")
private String statusMsg;
@ApiModelProperty(value = "驳回原因", example = "驳回原因")
......
......@@ -50,6 +50,6 @@ public class OwnerPageSettlementOwnerVO {
private BigDecimal invoiceFreight;
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "状态 10:待锁定 20:待对账 30:待货主确认 40:待货主付款 50:平台确认货主付款 60:待平台付款 70:货主确认平台付款 80:待邮寄发票 90:已完结")
@ApiModelProperty(value = "状态 10:待锁定 20:待对账 30:待货主确认 40:待货主付款 50:待平台确认付款 60:待平台付款 70:待货主确认付款 80:待邮寄发票 90:已完结")
private Integer status;
}
package com.clx.performance.controller.feign;
import cn.hutool.json.JSONUtil;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.service.OwnerAccountService;
import com.msl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/feign/owner")
@Validated
@AllArgsConstructor
public class OwnerAccountFeignController {
private final OwnerAccountService ownerAccountService;
@ApiOperation(value = "冻结保证金", notes = "<br>By:胡宇帆")
@PostMapping("/ownerAccountFrozen")
public Result<Object> ownerAccountFrozen(@RequestBody FrozenAccountParam param) {
log.info("进行冻结保证金账户,相关参数{}", JSONUtil.parse(param).toString());
ownerAccountService.ownerAccountFrozen(param);
return Result.ok();
}
}
......@@ -93,6 +93,7 @@ public class CarrierAccountController {
@ApiOperation(value = "提现审批", notes = "<br>By:胡宇帆")
@PostMapping("/accountCaseOutApprove")
@UnitCovert()
public Result<Object> accountCaseOutApprove(@RequestBody OwnerCaseOutApproveParam param) {
ownerAccountService.accountCaseOutApprove(param);
return Result.ok();
......
......@@ -87,8 +87,6 @@ public class OwnerAccountController {
@PostMapping("/accountTopUp")
@UnitCovert
public Result<Long> accountTopUp(@RequestBody OwnerTopUpParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setOwnerUserNo(loginUserInfo.getUserNo());
Long id = ownerAccountService.accountTopUp(param);
return Result.ok(id);
......@@ -162,14 +160,6 @@ public class OwnerAccountController {
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
@ApiOperation(value = "冻结保证金", notes = "<br>By:胡宇帆")
@PostMapping("/ownerAccountFrozen")
@UnitCovert()
public Result<Object> ownerAccountFrozen(FrozenAccountParam param) {
ownerAccountService.ownerAccountFrozen(param);
return Result.ok();
}
@ApiOperation(value = "创建账户", notes = "<br>By:胡宇帆")
@PostMapping("/createAccount")
public Result<Object> createAccount(CreteAccountParam param) {
......
......@@ -41,7 +41,9 @@ public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAc
@Override
public Integer updateOwnerAccountForConfirm(OwnerAccount account) {
return baseMapper.updateOwnerAccountForConfirm(account);
String nowStr = DateUtils.formatDateTime(LocalDateTime.now(),"yyyy-MM-dd HH:mm:ss").get();
return baseMapper.updateOwnerAccountForConfirm(account,nowStr);
}
@Override
......
......@@ -25,21 +25,24 @@ public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> {
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "pageList")
IPage<OwnerAccountVO> pageList(Page<OwnerAccountVO> page, PageOwnerAccountListParam param);
// @SelectProvider(type = OwnerAccountSqlProvider.class, method = "addAccount")
// @SelectProvider(type = OwnerAccountSqlProvider.class, method = "addAccount")
@Update("update owner_account set usable_balance = usable_balance + #{account.usableBalance}"
+",account_balance = account_balance + #{account.accountBalance}"
+",modified_time= #{now}"
+"where id = #{account.id} and modified_time = #{account.modifiedTime}"
+ ",account_balance = account_balance + #{account.accountBalance}"
+ ",modified_time= #{now}"
+ "where id = #{account.id} and modified_time = #{account.modifiedTime}"
)
Integer addAccount(@Param("account") OwnerAccount account, @Param("now")String now);
Integer addAccount(@Param("account") OwnerAccount account, @Param("now") String now);
@Update("update owner_account set usable_balance = usable_balance - #{account.usableBalance}," +
"frozen_balance = frozen_balance + #{account.frozenBalance},account_balance = account_balance - #{account.accountBalance}," +
"modified_time=#{now}"
+"where id = #{account.id} and modified_time = #{account.modifiedTime}"
)
Integer subAccount(@Param("account") OwnerAccount account, @Param("now")String now);
+ "where id = #{account.id} and modified_time = #{account.modifiedTime}"
)
Integer subAccount(@Param("account") OwnerAccount account, @Param("now") String now);
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "updateOwnerAccountForConfirm")
Integer updateOwnerAccountForConfirm(OwnerAccount account);
@Update("update owner_account set frozen_balance = frozen_balance - #{account.frozenBalance}," +
"modified_time=#{now}"
+ "where id = #{account.id} and modified_time = #{account.modifiedTime}"
)
Integer updateOwnerAccountForConfirm(@Param("account") OwnerAccount account, @Param("now") String now);
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ import java.time.LocalDateTime;
@Getter
@Setter
@Accessors(chain = true)
@TableName("Owner_running_water_record")
@TableName("owner_running_water_record")
public class OwnerRunningWaterRecord implements HasKey<Integer> {
/**
* id
......@@ -42,8 +42,8 @@ public class OwnerRunningWaterRecord implements HasKey<Integer> {
/**
* 货主名称
*/
@TableField("owner_name")
private String ownerName;
@TableField("owner_user_name")
private String ownerUserName;
/**
* 联系电话
*/
......
......@@ -74,11 +74,15 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
@Override
public IPage<OwnerAccountRunningWaterRecordVO> marginAccountPageList(PagePlatformMarginAccountParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setOwnerUserNo(loginUserInfo.getUserNo());
return ownerRunningWaterRecordDao.marginAccountPageList(param);
}
@Override
public IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(PagePlatformPrepaidFreightAccountParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setOwnerUserNo(loginUserInfo.getUserNo());
return ownerRunningWaterRecordDao.prepaidFreightAccountPageList(param);
}
......@@ -98,6 +102,9 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
@Override
public Long accountTopUp(OwnerTopUpParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setOwnerUserNo(loginUserInfo.getUserNo());
OwnerTopUp entity = new OwnerTopUp();
entity.setAccountType(param.getAccountType());
entity.setOwnerUserNo(param.getOwnerUserNo());
......@@ -106,6 +113,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
entity.setDrawingBank(param.getDrawingBank());
entity.setDrawingBankNumber(param.getDrawingBankNumber());
entity.setDrawingProof(param.getDrawingProof());
entity.setCreateBy(loginUserInfo.getUserName());
//充值编号
entity.setTopUpNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.TOP_UP.getCode()));
......@@ -169,7 +177,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerCaseOutDao.saveEntity(entity);
//插入冻结流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
runningWaterRecord.setOwnerName(loginUserInfo.getUserName());
runningWaterRecord.setOwnerUserName(loginUserInfo.getUserName());
runningWaterRecord.setMobile(loginUserInfo.getUserMobile());
runningWaterRecord.setCreateBy(loginUserInfo.getUserName());
runningWaterRecord.setRelationId(entity.getCaseOutNo());
......@@ -216,7 +224,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerCaseOutDao.saveEntity(entity);
//插入冻结流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
runningWaterRecord.setOwnerName(loginUserInfo.getUserName());
runningWaterRecord.setOwnerUserName(loginUserInfo.getUserName());
runningWaterRecord.setMobile(loginUserInfo.getUserMobile());
runningWaterRecord.setCreateBy(loginUserInfo.getUserName());
runningWaterRecord.setRelationId(entity.getCaseOutNo());
......@@ -243,6 +251,9 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
}
OwnerTopUp ownerTopUp = optional.get();
OwnerTopUp entity = new OwnerTopUp();
entity.setApprovalBy(loginUserInfo.getUserName());
entity.setApprovalTime(LocalDateTime.now());
String ownerName = "";
if (!param.getPassType()) {
entity.setId(param.getId());
......@@ -254,7 +265,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
BigDecimal topUpBalance = ownerTopUp.getTopUpBalance();
LocalDateTime now = LocalDateTime.now();
while (true) {
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(param.getOwnerUserNo(), param.getAccountType());
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(ownerTopUp.getOwnerUserNo(), param.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setAccountBalance(topUpBalance);
update.setUsableBalance(topUpBalance);
......@@ -272,13 +283,13 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerTopUpDao.updateEntityByKey(entity);
//需要插入充值流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
runningWaterRecord.setOwnerName(ownerName);
runningWaterRecord.setOwnerUserName(ownerName);
runningWaterRecord.setMobile(loginUserInfo.getUserMobile());
runningWaterRecord.setCreateBy(loginUserInfo.getUserName());
runningWaterRecord.setRelationId(ownerTopUp.getTopUpNo());
runningWaterRecord.setAccountBalance(topUpBalance);
runningWaterRecord.setOwnerUserNo(param.getOwnerUserNo());
runningWaterRecord.setOwnerUserNo(ownerTopUp.getOwnerUserNo());
runningWaterRecord.setAccountType(param.getAccountType());
runningWaterRecord.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.TOP_UP.getCode());
......@@ -317,7 +328,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
BigDecimal caseOutBalance = ownerCaseOut.getCaseOutBalance();
BigDecimal platformPayBalance = ownerCaseOut.getPlatformPayBalance();
if (platformPayBalance.compareTo(caseOutBalance) != 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "货主提现金额和平台支付金额不一致");
throw new ServiceSystemException(PerformanceResultEnum.MONEY_NO_SAME);
}
//给对应账户减少金额
......@@ -333,10 +344,15 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
}
}
//更新提现状态
OwnerCaseOut entity = new OwnerCaseOut();
entity.setId(ownerCaseOut.getId());
entity.setStatus(OwnerAccountEnum.CaseOutStatus.PAID.getCode());
ownerCaseOutDao.updateEntityByKey(entity);
//插入提现成功流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
runningWaterRecord.setOwnerName(loginUserInfo.getUserName());
runningWaterRecord.setOwnerUserName(loginUserInfo.getUserName());
runningWaterRecord.setMobile(loginUserInfo.getUserMobile());
runningWaterRecord.setCreateBy(loginUserInfo.getUserName());
......@@ -596,9 +612,9 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
@Override
@Transactional(rollbackFor = Exception.class)
public void ownerAccountFrozen(FrozenAccountParam param) {
String mobile = param.getMobile();
String mobile = "";
Long userNo = param.getUserNo();
String ownerName = param.getOwnerName();
String ownerName = "";
BigDecimal frozenBalance = param.getFrozenBalance();
BigDecimal ensureBalance = param.getEnsureBalance();
Integer orderId = param.getOrderId();
......@@ -610,42 +626,49 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
List<OwnerAccount> accountList = ownerAccountDao.accountInfo(userNo);
for (OwnerAccount ownerAccount : accountList) {
OwnerAccount entity = new OwnerAccount();
mobile = ownerAccount.getMobile();
ownerName = ownerAccount.getOwnerUserName();
entity.setAccountType(ownerAccount.getAccountType());
entity.setId(ownerAccount.getId());
entity.setModifiedTime(ownerAccount.getModifiedTime());
if (ownerAccount.getAccountType().equals(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode())) {
if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) {
if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主保证金账户可用余额不够冻结");
}
//冻结金额
entity.setFrozenBalance(frozenBalance);
entity.setFrozenBalance(ensureBalance);
//可用余额
entity.setUsableBalance(frozenBalance);
entity.setUsableBalance(ensureBalance);
//账户余额
entity.setAccountBalance(ensureBalance);
//updateList.add(entity);
flag += ownerAccountDao.updateAccountCAS(entity, now, false);
} else {
if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) {
if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主预付运费账户可用余额不够冻结");
}
//冻结金额
entity.setFrozenBalance(ensureBalance);
entity.setFrozenBalance(frozenBalance);
//可用余额
entity.setUsableBalance(ensureBalance);
entity.setUsableBalance(frozenBalance);
//账户余额
entity.setAccountBalance(frozenBalance);
//updateList.add(entity);
flag += ownerAccountDao.updateAccountCAS(entity, now, false);
}
}
if (flag == 2) {
log.info("冻结账户完毕");
break;
}
}
log.info("插入保证金冻结流水");
//插入保证金冻结流水
OwnerRunningWaterRecord marginAccount = new OwnerRunningWaterRecord();
marginAccount.setOwnerName(ownerName);
marginAccount.setOwnerUserName(ownerName);
marginAccount.setMobile(mobile);
marginAccount.setCreateBy("操作人");
marginAccount.setCreateBy("系统");
marginAccount.setOrderId(orderId);
marginAccount.setOrderNo(orderNo);
......@@ -657,12 +680,13 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
marginAccount.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
marginAccount.setRunningWaterNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.FROZEN.getCode()));
ownerRunningWaterRecordDao.saveEntity(marginAccount);
log.info("插入预付运费冻结流水");
//插入预付运费冻结流水
OwnerRunningWaterRecord prepaidFreight = new OwnerRunningWaterRecord();
prepaidFreight.setOwnerName(ownerName);
prepaidFreight.setOwnerUserName(ownerName);
prepaidFreight.setMobile(mobile);
prepaidFreight.setCreateBy("操作人");
prepaidFreight.setCreateBy("系统");
prepaidFreight.setOrderId(orderId);
prepaidFreight.setOrderNo(orderNo);
......@@ -690,6 +714,10 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerAccount.setOwnerUserName(param.getName());
ownerAccount.setOwnerUserNo(param.getUserNo());
ownerAccount.setMobile(param.getMobile());
ownerAccount.setAccountBalance(BigDecimal.ZERO);
ownerAccount.setUsableBalance(BigDecimal.ZERO);
ownerAccount.setFrozenBalance(BigDecimal.ZERO);
ownerAccountDao.saveEntity(ownerAccount);
ownerAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode());
ownerAccountDao.saveEntity(ownerAccount);
......
......@@ -83,7 +83,7 @@ public class SettlementDriverDetailServiceImpl implements SettlementDriverDetai
* 亏吨计算
*/
private BigDecimal lossWeightCalc(BigDecimal loadNet, BigDecimal unLoadNet){
return unLoadNet.compareTo(loadNet) < 0? unLoadNet.subtract(loadNet) : BigDecimal.ZERO;
return unLoadNet.compareTo(loadNet) < 0? loadNet.subtract(unLoadNet) : BigDecimal.ZERO;
}
/**
......
package com.clx.performance.service.impl.settle;
import com.clx.order.enums.ResultEnum;
import com.clx.performance.dao.settle.SettlementDriverDao;
import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.dao.settle.SettlementOwnerDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.enums.OrderChildLogEnum;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.clx.performance.enums.settle.SettlementLogEnum;
import com.clx.performance.enums.settle.SettlementOwnerEnum;
import com.clx.performance.enums.settle.SettlementPlatformEnum;
import com.clx.performance.extranal.user.OwnerInfoService;
import com.clx.performance.model.settle.SettlementDriver;
import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOwner;
import com.clx.performance.model.settle.SettlementOwnerDetail;
import com.clx.performance.service.impl.UniqueOrderNumService;
import com.clx.performance.service.settle.SettlementLogService;
import com.clx.performance.service.settle.SettlementMqHandlerService;
import com.clx.performance.service.settle.SettlementService;
import com.clx.performance.utils.LocalDateTimeUtils;
import com.clx.performance.vo.mq.SettlementDetailAddMqParam;
import com.clx.performance.vo.mq.SettlementDetailInvoiceTypeSyncMqParam;
import com.clx.user.vo.feign.OwnerInfoFeignVO;
import com.msl.common.exception.ServiceSystemException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
......@@ -55,6 +55,9 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
@Autowired
private SettlementService settlementService;
@Autowired
private SettlementLogService settlementLogService;
@Override
......@@ -63,6 +66,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
SettlementOwnerDetail settlementOwnerDetail = settlementOwnerDetailDao.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
String settlementNo = null ;
SettlementOwner settlementOwner = null;
OwnerInfoFeignVO ownerInfo = ownerInfoService.getOwnerInfo(settlementOwnerDetail.getOwnerUserNo());
......@@ -71,27 +75,29 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
LocalDateTime settlementPeriodTime = LocalDateTimeUtils.getBeginMonthDate();
settlementOwner = settlementOwnerDao.selectUnlockOfSettlementPeriodMonth(settlementOwnerDetail.getOrderNo(), settlementPeriodTime, settlementOwnerDetail.getInvoiceType()).orNull();
if (settlementOwner == null){ // 月结初始化
settlementPeriodMonthInit(settlementOwnerDetail, settlementPeriodTime);
settlementNo = settlementPeriodMonthInit(settlementOwnerDetail, settlementPeriodTime);
}
else { // 月结更新
settlementPeriodMonthUpdate(settlementOwner, settlementOwnerDetail);
settlementNo = settlementOwner.getSettlementNo();
}
}
else {
settlementOwner = settlementOwnerDao.selectUnlockOfSettlementPeriodImmediate(settlementOwnerDetail.getOrderNo(), settlementOwnerDetail.getInvoiceType()).orNull();
if (settlementOwner == null){ // 拉运完成初始化
settlementPeriodImmediateInit(settlementOwnerDetail);
settlementNo = settlementPeriodImmediateInit(settlementOwnerDetail);
}
else { // 拉运完成更新
settlementPeriodImmediateUpdate(settlementOwner, settlementOwnerDetail);
settlementNo = settlementOwner.getSettlementNo();
}
}
settlementDriverSave(settlementDriverDetail);
settlementDriverSave(settlementDriverDetail,settlementNo);
// 更新结算单
settlementOwnerDetail.setSettlementNo(settlementOwner.getSettlementNo());
settlementDriverDetail.setSettlementNo(settlementOwner.getSettlementNo());
settlementOwnerDetail.setSettlementNo(settlementNo);
settlementDriverDetail.setSettlementNo(settlementNo);
settlementOwnerDetailDao.updateSettlementNo(settlementOwnerDetail);
settlementDriverDetailDao.updateSettlementNo(settlementDriverDetail);
}
......@@ -108,8 +114,27 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
settlementService.updateSettlementDetailInvoiceType(settlementOwnerDetail.getChildNo(), SettlementOwnerEnum.InvoiceType.ORDINARY.getCode());
}
private void settlementDriverSave(SettlementDriverDetail settlementDriverDetail){
private void settlementDriverSave(SettlementDriverDetail detail,String settlementNo){
SettlementDriver settlementDriver = new SettlementDriver();
settlementDriver.setDriverUserNo(detail.getDriverUserNo());
settlementDriver.setDriverName(detail.getDriverName());
settlementDriver.setSettlementNo(settlementNo);
settlementDriver.setChildNo(detail.getChildNo());
settlementDriver.setOrderGoodsNo(detail.getOrderGoodsNo());
settlementDriver.setOrderNo(detail.getOrderNo());
settlementDriver.setGoodsId(detail.getGoodsId());
settlementDriver.setGoodsName(detail.getGoodsName());
settlementDriver.setTruckNo(detail.getTruckNo());
settlementDriver.setFreightPrice(detail.getFreightPrice());
settlementDriver.setWeight(detail.getWeight());
settlementDriver.setFreight(detail.getFreight());
settlementDriver.setLossPrice(detail.getLossPrice());
settlementDriver.setLossWeight(detail.getLossWeight());
settlementDriver.setLossFreight(detail.getLossFreight());
settlementDriver.setSettlementFreight(detail.getSettlementFreight());
settlementDriver.setInvoiceType(detail.getInvoiceType());
settlementDriver.setSettlementPlatform(String.valueOf(SettlementPlatformEnum.Platform.MSL.getCode()));
settlementDriver.setStatus(SettlementDriverEnum.Status.WAIT_SETTLEMENT.getCode());
settlementDriverDao.saveEntity(settlementDriver);
}
......@@ -117,7 +142,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
/**
* 月结初始化
*/
private void settlementPeriodMonthInit(SettlementOwnerDetail settlementOwnerDetail, LocalDateTime settlementPeriodTime){
private String settlementPeriodMonthInit(SettlementOwnerDetail settlementOwnerDetail, LocalDateTime settlementPeriodTime){
//获取所有detail
......@@ -136,6 +161,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
settlementOwner.setWeight(settlementOwnerDetail.getWeight());
settlementOwner.setFreight(settlementOwnerDetail.getFreight());
settlementOwner.setLossWeight(settlementOwnerDetail.getLossWeight());
settlementOwner.setLossFreight(settlementOwnerDetail.getLossFreight());
settlementOwner.setSettlementFreight(settlementOwnerDetail.getSettlementFreight());
......@@ -146,6 +172,13 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
settlementOwner.setStatus(SettlementOwnerEnum.Status.TO_BE_LOCKED.getCode());
settlementOwnerDao.saveEntity(settlementOwner);
//保存结算单日志----创建结算单
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.CREATE_SETTLEMENT.getCode(),SettlementLogEnum.Type.CREATE_SETTLEMENT.getMsg(),
OrderChildLogEnum.CreateType.PLATFORM.getCode(),0L,"系统");
return settlementNo;
}
/**
......@@ -187,7 +220,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
/**
* 拉运完成结 初始化
*/
private void settlementPeriodImmediateInit(SettlementOwnerDetail settlementOwnerDetail){
private String settlementPeriodImmediateInit(SettlementOwnerDetail settlementOwnerDetail){
SettlementOwner settlementOwner = new SettlementOwner();
String settlementNo = settlementNoGenerate();
......@@ -201,6 +234,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
settlementOwner.setWeight(settlementOwnerDetail.getWeight());
settlementOwner.setFreight(settlementOwnerDetail.getFreight());
settlementOwner.setLossWeight(settlementOwnerDetail.getLossWeight());
settlementOwner.setLossFreight(settlementOwnerDetail.getLossFreight());
settlementOwner.setSettlementFreight(settlementOwnerDetail.getSettlementFreight());
......@@ -211,6 +245,13 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
settlementOwner.setStatus(SettlementOwnerEnum.Status.TO_BE_ACCOUNT.getCode());
settlementOwnerDao.saveEntity(settlementOwner);
//保存结算单日志----创建结算单
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.CREATE_SETTLEMENT.getCode(),SettlementLogEnum.Type.CREATE_SETTLEMENT.getMsg(),
OrderChildLogEnum.CreateType.PLATFORM.getCode(),0L,"系统");
return settlementNo;
}
/**
......
......@@ -101,7 +101,7 @@ public class SettlementOwnerDetailServiceImpl implements SettlementOwnerDetailS
* 亏吨计算
*/
private BigDecimal lossWeightCalc(BigDecimal loadNet, BigDecimal unLoadNet){
return unLoadNet.compareTo(loadNet) < 0? unLoadNet.subtract(loadNet) : BigDecimal.ZERO;
return unLoadNet.compareTo(loadNet) < 0? loadNet.subtract(unLoadNet) : BigDecimal.ZERO;
}
/**
......
......@@ -35,6 +35,7 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
......@@ -95,15 +96,26 @@ public class SettlementOwnerServiceImpl implements SettlementOwnerService {
}
String settlementNo = settlementOwner.getSettlementNo();
//更新状态为待货主付款
settlementOwnerDao.updateStatusBySettlementNo(settlementNo,SettlementOwnerEnum.Status.SHIPPER_TO_PAYMENT.getCode());
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
//保存结算单日志
//保存结算单日志----货主确认结算单
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.OWNER_TO_BE_CONFIRMED.getCode(),SettlementLogEnum.Type.OWNER_TO_BE_CONFIRMED.getMsg(),
OrderChildLogEnum.CreateType.OWNER.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
int status;
if(settlementOwner.getSettlementFreight().compareTo(BigDecimal.ZERO) >0){
status = SettlementOwnerEnum.Status.SHIPPER_TO_PAYMENT.getCode();
}else if(settlementOwner.getSettlementFreight().compareTo(BigDecimal.ZERO) <0){
status = SettlementOwnerEnum.Status.PLATFORM_TO_PAYMENT.getCode();
}else{
status = SettlementOwnerEnum.Status.COMPLETED.getCode();
//保存结算单日志----已完结
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.COMPLETED.getCode(),SettlementLogEnum.Type.COMPLETED.getMsg(),
OrderChildLogEnum.CreateType.OWNER.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
}
//更新状态
settlementOwnerDao.updateStatusBySettlementNo(settlementNo,status);
}
@Override
......@@ -173,7 +185,7 @@ public class SettlementOwnerServiceImpl implements SettlementOwnerService {
SettlementLogEnum.Type.OWNER_CONFIRMED_PLATFORM_PAYMENT.getCode(),SettlementLogEnum.Type.OWNER_CONFIRMED_PLATFORM_PAYMENT.getMsg(),
OrderChildLogEnum.CreateType.OWNER.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
if(Objects.equals(settlementOwner.getStatus(),SettlementOwnerEnum.InvoiceType.ONLINE.getCode())){//网运单
if(Objects.equals(settlementOwner.getInvoiceStatus(),SettlementOwnerEnum.InvoiceType.ONLINE.getCode())){//网运单
status = SettlementOwnerEnum.Status.COMPLETED.getCode();
//保存结算单日志
settlementLogService.saveSettlementLog(settlementNo,
......@@ -294,23 +306,42 @@ public class SettlementOwnerServiceImpl implements SettlementOwnerService {
}
@Override
public void uploadInvoiceImg(UploadInvoiceImgParam param){
settlementOwnerDao.uploadInvoiceImg(param.getSettlementNo(),param.getInvoiceImg());
String settlementNo = param.getSettlementNo();
settlementOwnerDao.uploadInvoiceImg(settlementNo,param.getInvoiceImg());
settlementOwnerDao.updateStatusBySettlementNo(param.getSettlementNo()
settlementOwnerDao.updateStatusBySettlementNo(settlementNo
,SettlementOwnerEnum.Status.OWNER_TO_BE_CONFIRMED.getCode());
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
//保存结算单日志----上传结算凭证
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.UPLOAD_SETTLEMENT.getCode(),SettlementLogEnum.Type.UPLOAD_SETTLEMENT.getMsg(),
OrderChildLogEnum.CreateType.PLATFORM.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
}
@Override
public void saveExpress(SaveExpressParam param){
settlementOwnerDao.saveExpress(param.getSettlementNo(),param.getExpressCompany(),param.getExpressNo());
String settlementNo = param.getSettlementNo();
settlementOwnerDao.saveExpress(settlementNo,param.getExpressCompany(),param.getExpressNo());
settlementOwnerDao.updateStatusBySettlementNo(param.getSettlementNo()
settlementOwnerDao.updateStatusBySettlementNo(settlementNo
,SettlementOwnerEnum.Status.COMPLETED.getCode());
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
//保存结算单日志----邮寄发票
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.INVOICE_TO_BE_MAILED.getCode(),SettlementLogEnum.Type.INVOICE_TO_BE_MAILED.getMsg(),
OrderChildLogEnum.CreateType.PLATFORM.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
//保存结算单日志----已完结
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.COMPLETED.getCode(),SettlementLogEnum.Type.COMPLETED.getMsg(),
OrderChildLogEnum.CreateType.PLATFORM.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
}
@Override
public void savePayee(SavePayeeParam param){
settlementOwnerDao.savePayee(param.getSettlementNo(),
String settlementNo = param.getSettlementNo();
settlementOwnerDao.savePayee(settlementNo,
param.getPayee(),
param.getPayeeBankName(),
param.getPayeeBankCardNo(),
......@@ -319,8 +350,13 @@ public class SettlementOwnerServiceImpl implements SettlementOwnerService {
param.getPaymentBankName(),
param.getPaymentAmount());
settlementOwnerDao.updateStatusBySettlementNo(param.getSettlementNo()
settlementOwnerDao.updateStatusBySettlementNo(settlementNo
,SettlementOwnerEnum.Status.PLATFORM_CONFIRMED_OWNER_PAYMENT.getCode());
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
//保存结算单日志----平台付款
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.PLATFORM_TO_PAYMENT.getCode(),SettlementLogEnum.Type.PLATFORM_TO_PAYMENT.getMsg(),
OrderChildLogEnum.CreateType.PLATFORM.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
}
@Override
......@@ -331,6 +367,20 @@ public class SettlementOwnerServiceImpl implements SettlementOwnerService {
@Override
public void payeeConfirm(String settlementNo){
settlementOwnerDao.updateStatusBySettlementNo(settlementNo,SettlementOwnerEnum.Status.PLATFORM_TO_PAYMENT.getCode());
SettlementOwner settlementOwner = settlementOwnerDao.selectBySettlementNo(settlementNo).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
//保存结算单日志
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.PLATFORM_CONFIRMED_OWNER_PAYMENT.getCode(),SettlementLogEnum.Type.PLATFORM_CONFIRMED_OWNER_PAYMENT.getMsg(),
OrderChildLogEnum.CreateType.PLATFORM.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
if(Objects.equals(settlementOwner.getInvoiceStatus(),SettlementOwnerEnum.InvoiceType.ONLINE.getCode())){//网运单
//保存结算单日志
settlementLogService.saveSettlementLog(settlementNo,
SettlementLogEnum.Type.COMPLETED.getCode(),SettlementLogEnum.Type.COMPLETED.getMsg(),
OrderChildLogEnum.CreateType.PLATFORM.getCode(),loginUserInfo.getUserNo(),loginUserInfo.getUserName());
}
}
......
......@@ -27,7 +27,7 @@ public class OwnerAccountSqlProvider {
if (StringUtils.isNotBlank(param.getOwnerUserNo())) {
WHERE("a.owner_user_no = #{param.ownerUserNo}");
}
if (ObjectUtil.isNotNull(param.getMobile())) {
if (StringUtils.isNotBlank(param.getMobile())) {
WHERE("a.mobile = #{param.mobile}");
}
if (ObjectUtil.isNotNull(param.getAccountType())) {
......@@ -64,13 +64,4 @@ public class OwnerAccountSqlProvider {
return sqlList.toString();
}
public String updateOwnerAccountForConfirm(OwnerAccount account) {
StringBuffer sqlList = new StringBuffer();
sqlList.append("update owner_account set frozen_balance = frozen_balance -" +
account.getFrozenBalance()
+ "where id = " + account.getId() + "and modified_time = '" + DateUtils.formatDateTime(account.getModifiedTime(), "yyyy-MM-dd HH:mm:ss").get()+"'"
);
return sqlList.toString();
}
}
......@@ -9,7 +9,7 @@ public class OwnerBindCardRecordSqlProvider {
public String ownerBindCardPageList(@Param("param") PageOwnerBindCardRecordListParam param) {
String sql = new SQL() {{
SELECT("a.id, a.owner_user_no," +
" a.owner_user_name, a.owner_type, a.owner_bank, " +
" a.owner_user_name, a.owner_bank, " +
" a.bank_card_number,a.open_account_bank, a.account_bank_name,a.create_by,a.create_time,a.create_item");
FROM("owner_bind_card_record a");
......
......@@ -66,6 +66,7 @@ public class OwnerRunningWaterRecordSqlProvider {
" a.owner_user_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,date_format(a.create_time, '%Y-%m-%d %H:%i:%s') as create_time");
FROM("owner_running_water_record a");
WHERE("a.owner_user_no = #{param.ownerUserNo}");
if (ObjectUtil.isNotNull(param.getAccountType())) {
WHERE("a.account_type = #{param.accountType}");
......@@ -76,6 +77,7 @@ public class OwnerRunningWaterRecordSqlProvider {
if (ObjectUtil.isNotNull(param.getRunningWaterType())) {
WHERE("a.running_water_type = #{param.runningWaterType}");
}
ORDER_BY("a.create_time desc");
}}.toString();
return sql;
......
......@@ -24,8 +24,8 @@ public interface SettlementOwnerDetailStruct {
@Named("toBaseVo")
@Mapping(target = "invoiceTypeMsg", expression = "java(SettlementOwnerEnum.InvoiceType.getMsgByCode(settlementOwner.getInvoiceType()))")
@Mapping(target = "finalPaymentStatusMsg", expression = "java(SettlementOwnerDetailEnum.FinalPaymentStatus.getMsgByCode(settlementOwner.getInvoiceStatus()))")
@Mapping(target = "invoiceStatusMsg", expression = "java(SettlementOwnerDetailEnum.InvoiceStatus.getMsgByCode(settlementOwner.getStatus()))")
@Mapping(target = "finalPaymentStatusMsg", expression = "java(SettlementOwnerDetailEnum.FinalPaymentStatus.getMsgByCode(settlementOwner.getFinalPaymentStatus()))")
@Mapping(target = "invoiceStatusMsg", expression = "java(SettlementOwnerDetailEnum.InvoiceStatus.getMsgByCode(settlementOwner.getInvoiceStatus()))")
PageOwnerSettlementOwnerDetailVO convert(SettlementOwnerDetail settlementOwner);
@IterableMapping(qualifiedByName = "toBaseVo")
......
......@@ -11,14 +11,21 @@ import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.constant.RedisConstants;
import com.clx.performance.dao.OrderGoodsDao;
import com.clx.performance.dao.OwnerAccountDao;
import com.clx.performance.dao.OwnerCaseOutDao;
import com.clx.performance.enums.OrderGoodsStatusEnum;
import com.clx.performance.enums.OrderGoodsTruckBindEnum;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.feign.PerformanceFeign;
import com.clx.performance.mapper.OrderGoodsMapper;
import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.OwnerAccount;
import com.clx.performance.model.OwnerCaseOut;
import com.clx.performance.param.pc.OwnerCaseOutParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.service.OwnerAccountService;
import com.msl.common.base.Optional;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.core.Message;
......@@ -63,12 +70,20 @@ public class JobTest {
@Autowired
private OwnerAccountService ownerAccountService;
@Autowired
private PerformanceFeign performanceFeign;
@Autowired
private OwnerCaseOutDao ownerCaseOutDao;
@Test
public void test1() {
OwnerCaseOutParam param = new OwnerCaseOutParam();
param.setOwnerUserNo(1021181283626946629L);
param.setCaseOutBalance(new BigDecimal("1"));
param.setAccountType(1);
ownerAccountService.accountCaseOut(param);
Optional<OwnerCaseOut> optional = ownerCaseOutDao.getEntityByKey(19);
OwnerCaseOut ownerCaseOut = optional.get();
BigDecimal caseOutBalance = ownerCaseOut.getCaseOutBalance();
BigDecimal platformPayBalance = ownerCaseOut.getPlatformPayBalance();
if (platformPayBalance.compareTo(caseOutBalance) != 0) {
throw new ServiceSystemException(PerformanceResultEnum.MONEY_NO_SAME);
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论