提交 9808f5bb authored 作者: huyufan's avatar huyufan

增加根据货主ID查询货主借款账户信息

上级 2f35ad6a
...@@ -11,6 +11,7 @@ import com.clx.performance.vo.app.collect.AppCollectTruckVO; ...@@ -11,6 +11,7 @@ import com.clx.performance.vo.app.collect.AppCollectTruckVO;
import com.clx.performance.vo.feign.FreightEstimateVO; import com.clx.performance.vo.feign.FreightEstimateVO;
import com.clx.performance.vo.feign.OrderGoodsFeignVO; import com.clx.performance.vo.feign.OrderGoodsFeignVO;
import com.clx.performance.vo.pc.OwnerAccountAllVO; import com.clx.performance.vo.pc.OwnerAccountAllVO;
import com.clx.performance.vo.pc.OwnerLoanAccountVO;
import com.clx.performance.vo.pc.breakcontract.carrier.BreakContractOwnerRuleVO; import com.clx.performance.vo.pc.breakcontract.carrier.BreakContractOwnerRuleVO;
import com.msl.common.result.Result; import com.msl.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -111,4 +112,7 @@ public interface PerformanceFeign { ...@@ -111,4 +112,7 @@ public interface PerformanceFeign {
@PostMapping(value = {"clx-performance/feign/orderGoods/listFreightEstimate"}) @PostMapping(value = {"clx-performance/feign/orderGoods/listFreightEstimate"})
Result<FreightEstimateVO> listFreightEstimate(@RequestBody OrderChildReportParam param); Result<FreightEstimateVO> listFreightEstimate(@RequestBody OrderChildReportParam param);
@GetMapping(value = {"clx-performance/feign/owner/loanAccount"})
Result<OwnerLoanAccountVO> loanAccount(@RequestParam Long userNo);
} }
package com.clx.performance.vo.pc;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class OwnerLoanAccountVO {
private Integer id;
@ApiModelProperty("货主编码")
private Long ownerUserNo;
@ApiModelProperty("货主名称")
private String ownerUserName;
@ApiModelProperty("联系电话")
private String mobile;
@ApiModelProperty("账户类型: 默认3 借款账户")
private Integer accountType;
@ApiModelProperty("资金金额")
private BigDecimal fundingAmount;
@ApiModelProperty("虚拟币金额")
private BigDecimal virtuallyAmount;
@ApiModelProperty("资金欠款")
private BigDecimal fundingArrears;
@ApiModelProperty("虚拟币欠款")
private BigDecimal virtuallyArrears;
@ApiModelProperty("创建人")
private String createBy;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("修改时间")
private LocalDateTime modifiedTime;
}
...@@ -5,8 +5,8 @@ import com.clx.performance.param.pc.owner.FrozenAccountParam; ...@@ -5,8 +5,8 @@ import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.param.pc.owner.ThawAccountParam; import com.clx.performance.param.pc.owner.ThawAccountParam;
import com.clx.performance.service.OwnerAccountService; import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.vo.pc.OwnerAccountAllVO; import com.clx.performance.vo.pc.OwnerAccountAllVO;
import com.clx.performance.vo.pc.OwnerLoanAccountVO;
import com.msl.common.result.Result; import com.msl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -44,4 +44,10 @@ public class OwnerAccountFeignController { ...@@ -44,4 +44,10 @@ public class OwnerAccountFeignController {
public Result<OwnerAccountAllVO> accountInfo(@RequestParam Long userNo) { public Result<OwnerAccountAllVO> accountInfo(@RequestParam Long userNo) {
return Result.ok(ownerAccountService.accountInfo(userNo)); return Result.ok(ownerAccountService.accountInfo(userNo));
} }
@ApiOperation(value = "查询用户预付运费和保证金账户", notes = "<br>By:胡宇帆")
@GetMapping("/loanAccount")
public Result<OwnerLoanAccountVO> loanAccount(@RequestParam Long userNo) {
return Result.ok(ownerAccountService.loanAccount(userNo));
}
} }
...@@ -16,6 +16,7 @@ import com.clx.performance.param.pc.owner.ThawAccountParam; ...@@ -16,6 +16,7 @@ import com.clx.performance.param.pc.owner.ThawAccountParam;
import com.clx.performance.vo.pc.OwnerAccountAllVO; import com.clx.performance.vo.pc.OwnerAccountAllVO;
import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO; import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.performance.vo.pc.OwnerAccountVO; import com.clx.performance.vo.pc.OwnerAccountVO;
import com.clx.performance.vo.pc.OwnerLoanAccountVO;
import com.clx.user.param.pc.owner.UpdateOwnerBindCardFeignParam; import com.clx.user.param.pc.owner.UpdateOwnerBindCardFeignParam;
import com.clx.user.vo.pc.owner.OwnerBindCardVO; import com.clx.user.vo.pc.owner.OwnerBindCardVO;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
...@@ -101,4 +102,6 @@ public interface OwnerAccountService { ...@@ -101,4 +102,6 @@ public interface OwnerAccountService {
String checkBusinessLicenseNumber(InformationParam param); String checkBusinessLicenseNumber(InformationParam param);
void resetPassword(ResetPasswordParam param); void resetPassword(ResetPasswordParam param);
OwnerLoanAccountVO loanAccount(Long userNo);
} }
...@@ -15,11 +15,13 @@ import com.clx.performance.config.ClxMessageConfig; ...@@ -15,11 +15,13 @@ import com.clx.performance.config.ClxMessageConfig;
import com.clx.performance.constant.RabbitKeyConstants; import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.constant.RedisConstants; import com.clx.performance.constant.RedisConstants;
import com.clx.performance.dao.*; import com.clx.performance.dao.*;
import com.clx.performance.dao.loan.OwnerLoanAccountDao;
import com.clx.performance.enums.IdTypeEnum; import com.clx.performance.enums.IdTypeEnum;
import com.clx.performance.enums.OwnerAccountEnum; import com.clx.performance.enums.OwnerAccountEnum;
import com.clx.performance.enums.PerformanceResultEnum; import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.extranal.user.OwnerInfoService; import com.clx.performance.extranal.user.OwnerInfoService;
import com.clx.performance.model.*; import com.clx.performance.model.*;
import com.clx.performance.model.loan.OwnerLoanAccount;
import com.clx.performance.param.app.CheckMobileParam; import com.clx.performance.param.app.CheckMobileParam;
import com.clx.performance.param.app.InformationParam; import com.clx.performance.param.app.InformationParam;
import com.clx.performance.param.app.ResetPasswordParam; import com.clx.performance.param.app.ResetPasswordParam;
...@@ -33,6 +35,7 @@ import com.clx.performance.param.pc.owner.FrozenAccountParam; ...@@ -33,6 +35,7 @@ import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.param.pc.owner.ThawAccountParam; import com.clx.performance.param.pc.owner.ThawAccountParam;
import com.clx.performance.service.OwnerAccountService; import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.struct.OwnerAccountStruct; import com.clx.performance.struct.OwnerAccountStruct;
import com.clx.performance.struct.loan.OwnerLoanAccountStruct;
import com.clx.performance.utils.MyMD5Util; import com.clx.performance.utils.MyMD5Util;
import com.clx.performance.utils.excel.ExcelData; import com.clx.performance.utils.excel.ExcelData;
import com.clx.performance.utils.excel.ExcelField; import com.clx.performance.utils.excel.ExcelField;
...@@ -41,6 +44,7 @@ import com.clx.performance.utils.excel.ExcelUtil; ...@@ -41,6 +44,7 @@ import com.clx.performance.utils.excel.ExcelUtil;
import com.clx.performance.vo.pc.OwnerAccountAllVO; import com.clx.performance.vo.pc.OwnerAccountAllVO;
import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO; import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.performance.vo.pc.OwnerAccountVO; import com.clx.performance.vo.pc.OwnerAccountVO;
import com.clx.performance.vo.pc.OwnerLoanAccountVO;
import com.clx.user.enums.owner.FreezeSettingEnum; import com.clx.user.enums.owner.FreezeSettingEnum;
import com.clx.user.feign.OwnerFeign; import com.clx.user.feign.OwnerFeign;
import com.clx.user.feign.OwnerInfoFeign; import com.clx.user.feign.OwnerInfoFeign;
...@@ -111,6 +115,10 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -111,6 +115,10 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
private final OwnerInfoService ownerInfoService; private final OwnerInfoService ownerInfoService;
private final OwnerLoanAccountDao ownerLoanAccountDao;
private final OwnerLoanAccountStruct ownerLoanAccountStruct;
@Override @Override
public IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param) { public IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param) {
return ownerAccountDao.pageList(param); return ownerAccountDao.pageList(param);
...@@ -1213,4 +1221,13 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -1213,4 +1221,13 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
} }
} }
@Override
public OwnerLoanAccountVO loanAccount(Long userNo) {
OwnerLoanAccount ownerLoanAccount = ownerLoanAccountDao.getOneByField(OwnerLoanAccount::getOwnerUserNo, userNo).orNull();
if (ownerLoanAccount == null) {
return null;
}
return ownerLoanAccountStruct.convert(ownerLoanAccount);
}
} }
...@@ -3,19 +3,12 @@ package com.clx.performance.service.impl.settle; ...@@ -3,19 +3,12 @@ package com.clx.performance.service.impl.settle;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.component.IdGenerateSnowFlake;
import com.clx.performance.dao.OrderChildDao; import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.dao.OwnerAccountDao;
import com.clx.performance.dao.OwnerRunningWaterRecordDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao; import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.enums.IdTypeEnum;
import com.clx.performance.enums.OwnerAccountEnum;
import com.clx.performance.enums.settle.SettlementOwnerDetailEnum; import com.clx.performance.enums.settle.SettlementOwnerDetailEnum;
import com.clx.performance.enums.settle.SettlementWayEnum; import com.clx.performance.enums.settle.SettlementWayEnum;
import com.clx.performance.model.OrderChild; import com.clx.performance.model.OrderChild;
import com.clx.performance.model.OrderGoods; import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.OwnerAccount;
import com.clx.performance.model.OwnerRunningWaterRecord;
import com.clx.performance.model.settle.SettlementOwnerDetail; import com.clx.performance.model.settle.SettlementOwnerDetail;
import com.clx.performance.param.pc.owner.PageCarrierSettlementOwnerDetailParam; import com.clx.performance.param.pc.owner.PageCarrierSettlementOwnerDetailParam;
import com.clx.performance.param.pc.owner.PageOwnerSettlementOwnerDetailParam; import com.clx.performance.param.pc.owner.PageOwnerSettlementOwnerDetailParam;
...@@ -27,7 +20,6 @@ import com.clx.performance.utils.excel.ExcelSheet; ...@@ -27,7 +20,6 @@ import com.clx.performance.utils.excel.ExcelSheet;
import com.clx.performance.utils.excel.ExcelUtil; import com.clx.performance.utils.excel.ExcelUtil;
import com.clx.performance.vo.pc.carrier.settle.CarrierPageSettlementOwnerDetailVO; import com.clx.performance.vo.pc.carrier.settle.CarrierPageSettlementOwnerDetailVO;
import com.clx.performance.vo.pc.owner.settle.PageOwnerSettlementOwnerDetailVO; import com.clx.performance.vo.pc.owner.settle.PageOwnerSettlementOwnerDetailVO;
import com.msl.common.result.Result;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
...@@ -52,9 +44,6 @@ public class SettlementOwnerDetailServiceImpl implements SettlementOwnerDetailS ...@@ -52,9 +44,6 @@ public class SettlementOwnerDetailServiceImpl implements SettlementOwnerDetailS
private final SettlementOwnerDetailDao settlementOwnerDetailDao; private final SettlementOwnerDetailDao settlementOwnerDetailDao;
private final SettlementOwnerDetailStruct settlementOwnerDetailStruct; private final SettlementOwnerDetailStruct settlementOwnerDetailStruct;
private final IdGenerateSnowFlake idGenerateSnowFlake;
private final OwnerRunningWaterRecordDao ownerRunningWaterRecordDao;
private final OwnerAccountDao ownerAccountDao;
private final OrderChildDao orderChildDao; private final OrderChildDao orderChildDao;
...@@ -93,47 +82,6 @@ public class SettlementOwnerDetailServiceImpl implements SettlementOwnerDetailS ...@@ -93,47 +82,6 @@ public class SettlementOwnerDetailServiceImpl implements SettlementOwnerDetailS
BigDecimal ans = settlementOwnerDetail.getFreight().subtract(settlementOwnerDetail.getLossFreight()); BigDecimal ans = settlementOwnerDetail.getFreight().subtract(settlementOwnerDetail.getLossFreight());
if (ans.compareTo(BigDecimal.ZERO) <= 0) { if (ans.compareTo(BigDecimal.ZERO) <= 0) {
settlementOwnerDetail.setPrepayFreight(BigDecimal.ZERO); settlementOwnerDetail.setPrepayFreight(BigDecimal.ZERO);
} else {
/*List<OwnerRunningWaterRecord> runningWaterRecordList = ownerRunningWaterRecordDao.getOwnerRunningWaterRecord(orderChild.getOrderNo());
BigDecimal frozen = runningWaterRecordList.stream().filter(item -> {
return item.getRunningWaterType().equals(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
}).map(OwnerRunningWaterRecord::getAlterationBalance).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal takeOut = runningWaterRecordList.stream().filter(item -> {
return item.getRunningWaterType().equals(OwnerAccountEnum.RunningWaterStatus.TAKE_OUT.getCode());
}).map(OwnerRunningWaterRecord::getAlterationBalance).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal subtract = frozen.subtract(takeOut);
if (subtract.compareTo(BigDecimal.ZERO) <= 0) {
settlementOwnerDetail.setPrepayFreight(BigDecimal.ZERO);
}
if (subtract.subtract(ans).compareTo(BigDecimal.ZERO) >= 0) {
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(orderChild.getOwnerUserNo(),
OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode());
settlementOwnerDetail.setPrepayFreight(ans);
//生成扣除流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
runningWaterRecord.setOwnerUserName(orderChild.getOwnerName());
runningWaterRecord.setMobile(orderChild.getDriverMobile());
runningWaterRecord.setCreateBy("系统");
runningWaterRecord.setOrderId(orderChild.getId());
runningWaterRecord.setOrderNo(orderChild.getOrderNo());
runningWaterRecord.setRelationId(null);
runningWaterRecord.setAlterationBalance(ans);
runningWaterRecord.setFrozenBalance(ans);
runningWaterRecord.setUsableBalance(account.getUsableBalance());
runningWaterRecord.setTakeOutBalance(BigDecimal.ZERO);
runningWaterRecord.setAccountBalance(account.getAccountBalance());
runningWaterRecord.setOwnerUserNo(account.getOwnerUserNo());
runningWaterRecord.setAccountType(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode());
runningWaterRecord.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.TAKE_OUT.getCode());
runningWaterRecord.setRunningWaterNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.TAKE_OUT.getCode()));
ownerRunningWaterRecordDao.saveEntity(runningWaterRecord);
} else {
settlementOwnerDetail.setPrepayFreight(BigDecimal.ZERO);
}*/
} }
// // 开票金额 // // 开票金额
......
package com.clx.performance.sqlProvider.loan;
import cn.hutool.core.util.ObjectUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;
public class OwnerLoanAccountSqlProvider {
public String getOwnerLoanAccountByOwnerUserId(@Param("param") Long ownerUserNo) {
String sql = new SQL() {{
SELECT("a.id, a.owner_user_no," +
" a.owner_user_name, a.mobile, a.account_type, " +
" a.funding_amount,a.virtually_amount,a.funding_arrears,a.virtually_arrears,a.create_by,date_format(a.create_time, '%Y-%m-%d %H:%i:%s') as create_time");
FROM("owner_loan_account a");
if (ObjectUtil.isNotNull(ownerUserNo)) {
WHERE("a.owner_user_no = #{ownerUserNo}");
}
ORDER_BY("a.create_time desc");
}}.toString();
return sql;
}
}
package com.clx.performance.struct.loan;
import com.clx.performance.model.loan.OwnerLoanAccount;
import com.clx.performance.vo.pc.OwnerLoanAccountVO;
import com.msl.common.utils.DateStructUtil;
import org.mapstruct.Mapper;
import java.util.Objects;
@Mapper(componentModel = "spring", uses = DateStructUtil.class, imports = {Objects.class})
public interface OwnerLoanAccountStruct {
OwnerLoanAccountVO convert(OwnerLoanAccount account);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论