提交 ba9e52ca authored 作者: 杨启发's avatar 杨启发

Merge branch 'refs/heads/v18.5_pound_list_ocr_20240701' into dev

# Conflicts: # performance-api/src/main/java/com/clx/performance/feign/PerformanceFeign.java # performance-api/src/main/java/com/clx/performance/vo/pc/OrderGoodsVO.java # performance-web/pom.xml # performance-web/src/main/java/com/clx/performance/service/OrderGoodsService.java
package com.clx.performance.param.app;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
/**
* @author yangqifa
*/
@Getter
@Setter
@NoArgsConstructor
public class OcrRecognitionParam {
@ApiModelProperty(value = "运单编号", example = "100000000")
@NotBlank(message = "运单编号不能为空")
private String childNo;
@ApiModelProperty(value = "磅单图片url")
@NotBlank(message = "磅单图片url不能为空")
private String imageUrl;
}
......@@ -49,7 +49,7 @@ public class WalletResidueDTO {
}
@JsonGetter(value="frozen")
public BigDecimal frozenFormat() {
return new BigDecimal(new Double(this.frozen)/100);
return BigDecimal.valueOf(new Double(this.frozen)/100);
}
@JsonGetter(value="residue")
public Double residueFormat() {
......@@ -57,7 +57,7 @@ public class WalletResidueDTO {
}
@JsonGetter(value="deposit")
public Double depositFormat() {
return new Double(this.deposit)/100;
return this.deposit/100;
}
public Double getDeposit() {
......
package com.clx.performance.vo.app;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* @author yangqifa
*/
@Getter
@Setter
@ToString
@NoArgsConstructor
public class OcrRecognitionResultVO {
@ApiModelProperty(value = "毛重", example = "48.36")
private Double grossWeight;
@ApiModelProperty(value = "皮重", example = "16.32")
private Double tareWeight;
}
......@@ -144,9 +144,6 @@ public class OrderGoodsVO {
@ApiModelProperty("可装车时间段结束")
private String loadEndTime;
@ApiModelProperty("已派单数")
private Integer dispatchedOrders;
@ApiModelProperty("平台运费报价税类型:0未税 1含税")
private Integer platformFreightQuotationTaxType;
......@@ -166,4 +163,7 @@ public class OrderGoodsVO {
@ApiModelProperty("接单保证金 平台服务费费率 弹窗和文案显示 0 不显示 1 显示")
private Integer goodsOrderDetailShow = 0;
@ApiModelProperty("已派单数")
private Integer dispatchedOrders;
}
\ No newline at end of file
......@@ -51,6 +51,9 @@ public class OwnerPageSettlementOwnerVO {
@MoneyOutConvert
@ApiModelProperty(value = "开票金额")
private BigDecimal invoiceFreight;
@MoneyOutConvert
@ApiModelProperty(value = "开票服务费")
private BigDecimal invoiceServiceFee;
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "状态 10:待锁定 20:待对账 30:待货主确认 40:待货主付款 50:待平台确认付款 60:待平台付款 70:待货主确认付款 80:待邮寄发票 90:已完结")
......
......@@ -318,8 +318,16 @@
<version>2.0.0-beta7</version>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java-common</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java-ocr</artifactId>
<version>LATEST</version>
</dependency>
</dependencies>
......
......@@ -249,12 +249,14 @@ public class OrderChildLoanComponent {
if (!Objects.equals(orderInfo.getSupportLoan(), StatusEnum.YES.getCode())){
log.info("3.2当前运单不支持货主借款");
return;
}
if (!Objects.equals(orderInfo.getPlatformFreightQuotationTaxType(),
if (Objects.equals(orderInfo.getPlatformFreightQuotationTaxType(),
QuotationEnum.PlatformFreightQuotationTaxType.NO.getCode())){
log.info("3.3当前运单未税不支持借款");
return;
}
......
......@@ -189,4 +189,10 @@ public class AppDriverOrderChildController {
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
@ApiOperation(value = "磅单OCR识别", notes = "<br>By:杨启发")
@PostMapping("/ocrRecognition")
public Result<OcrRecognitionResultVO> ocrRecognition(@RequestBody @Validated OcrRecognitionParam param) {
return Result.ok(orderChildService.ocrRecognition(param));
}
}
package com.clx.performance.dao;
import com.clx.performance.mapper.OcrRecognitionMapper;
import com.clx.performance.model.OcrRecognition;
import com.msl.common.dao.BaseDao;
/**
* @author yangqifa
*/
public interface OcrRecognitionDao extends BaseDao<OcrRecognitionMapper, OcrRecognition, Integer> {
}
package com.clx.performance.dao.impl;
import com.clx.performance.dao.OcrRecognitionDao;
import com.clx.performance.mapper.OcrRecognitionMapper;
import com.clx.performance.model.OcrRecognition;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* @author yangqifa
*/
@Repository
public class OcrRecognitionDaoImpl extends BaseDaoImpl<OcrRecognitionMapper, OcrRecognition, Integer> implements OcrRecognitionDao {
}
......@@ -174,7 +174,7 @@ public class SettlementOwnerDetailDaoImpl extends BaseDaoImpl<SettlementOwnerDet
@Override
public List<SettlementOwnerDetail> listInvoiceStatusSync() {
return list(lUdWrapper()
.gt(SettlementOwnerDetail::getCreateTime, LocalDateTime.now().minusMonths(3))
.gt(SettlementOwnerDetail::getCreateTime, LocalDateTime.now().minusMonths(1))
.eq(SettlementOwnerDetail::getInvoiceChannel, SettlementOwnerDetailEnum.InvoiceChannel.BROKER.getCode())
.eq(SettlementOwnerDetail::getInvoiceStatus, SettlementOwnerDetailEnum.InvoiceStatus.NO.getCode())
.eq(SettlementOwnerDetail::getPayStatus, SettlementOwnerDetailEnum.PayStatus.YES.getCode())
......@@ -184,11 +184,21 @@ public class SettlementOwnerDetailDaoImpl extends BaseDaoImpl<SettlementOwnerDet
@Override
public List<SettlementOwnerDetail> listPayStatusSync() {
return list(lUdWrapper()
.gt(SettlementOwnerDetail::getCreateTime, LocalDateTime.now().minusMonths(3))
.gt(SettlementOwnerDetail::getCreateTime, LocalDateTime.now().minusMonths(1))
.eq(SettlementOwnerDetail::getInvoiceChannel, SettlementOwnerDetailEnum.InvoiceChannel.BROKER.getCode())
.eq(SettlementOwnerDetail::getPayStatus, SettlementOwnerDetailEnum.PayStatus.NO.getCode())
.eq(SettlementOwnerDetail::getInvoiceType, SettlementOwnerEnum.InvoiceType.ONLINE.getCode())
);
}
@Override
public List<SettlementOwnerDetail> listInvoiceTypeSync() {
return list(lUdWrapper()
.gt(SettlementOwnerDetail::getCreateTime, LocalDateTime.now().minusMonths(1))
.le(SettlementOwnerDetail::getCreateTime, LocalDateTime.now().minusMinutes(3))
.eq(SettlementOwnerDetail::getInvoiceChannel, SettlementOwnerDetailEnum.InvoiceChannel.BROKER.getCode())
.isNull(SettlementOwnerDetail::getInvoiceType)
);
}
}
......@@ -52,4 +52,5 @@ public interface SettlementOwnerDetailDao extends BaseDao<SettlementOwnerDetailM
List<SettlementOwnerDetail>listInvoiceStatusSync();
List<SettlementOwnerDetail> listPayStatusSync();
List<SettlementOwnerDetail> listInvoiceTypeSync();
}
......@@ -8,4 +8,6 @@ public interface BrokerService {
void orderChildSync(TransportParam param);
TransportVO getOrderChildStatus(String childNo);
TransportVO getOrderChildStatus(String childNo, String settlementNo);
}
......@@ -35,7 +35,13 @@ public class BrokerServiceImpl implements BrokerService {
@Override
public TransportVO getOrderChildStatus(String childNo) {
Result<TransportVO> result = brokerFeign.getTransportByChildNo(childNo, settlementConfig.getBrokerUserCode());
return getOrderChildStatus(childNo, null);
}
@Override
public TransportVO getOrderChildStatus(String childNo, String settlementNo) {
Result<TransportVO> result = brokerFeign.getTransportByChildNo(childNo, settlementConfig.getBrokerUserCode(), settlementNo);
if (result.getCode() != 0) {
log.info("运单同步网络货运失败, msg:{}", result.getMsg());
}
......
......@@ -23,6 +23,7 @@ public interface BrokerFeign {
@RequestMapping(value = "/broker-service/open/transport/getTransportByChildNo", method = RequestMethod.GET)
Result<TransportVO> getTransportByChildNo(@RequestParam @NotBlank(message = "运单编号不能为空") String orderCode,
@RequestParam @NotNull(message = "userCode不能为空") String userCode);
@RequestParam @NotNull(message = "userCode不能为空") String userCode,
@RequestParam String settlementNo);
}
......@@ -34,23 +34,16 @@ public class SettlementJob {
@XxlJob("settlementInvoiceTypeSync")
public void settlementInvoiceTypeSync() {
// 首次
List<OrderChildSyncTransportInvoiceRecord> recordList = orderChildSyncTransportInvoiceRecordDao
.selectListForJobOfFirst();
// 异常
List<OrderChildSyncTransportInvoiceRecord> recordList1 = orderChildSyncTransportInvoiceRecordDao
.selectListForJob();
recordList.addAll(recordList1);
List<SettlementOwnerDetail> recordList = settlementOwnerDetailDao
.listInvoiceTypeSync();
log.info("待同步无车承运运单状态,size:{}", recordList.size());
if (recordList.isEmpty()) {return;}
for (OrderChildSyncTransportInvoiceRecord item : recordList) {
for (SettlementOwnerDetail item : recordList) {
settlementMqService.invoiceTypeSync(item.getChildNo());
}
orderChildSyncTransportInvoiceRecordDao.deleteByKeys(
recordList.stream().map(item->item.getId()).collect(Collectors.toList()));
}
/**
......
......@@ -125,12 +125,6 @@ public class OrderChildSyncTransportListener {
} catch (Exception e) {
log.info("当前OrderChildSyncTransportListener监听同步网络货运失败,运单号{}, 错误信息{}", orderChild.getChildNo(), ExceptionUtils.getStackTrace(e));
} finally {
OrderChildSyncTransportInvoiceRecord entity = new OrderChildSyncTransportInvoiceRecord();
entity.setChildNo(orderChild.getChildNo());
entity.setType(TransportSyncTypeEnum.Type.RESULT.getCode());
entity.setRemark("异步查询状态");
orderChildSyncTransportInvoiceRecordDao.saveEntity(entity);
}
}
......@@ -154,22 +148,16 @@ public class OrderChildSyncTransportListener {
OrderGoods orderGoods = orderGoodsDao.getByOrderGoodsNo(orderChild.getOrderGoodsNo()).get();
// // 开票服务费
// settlementOwnerDetail.setInvoiceServiceFee(settlementCommonService.invoiceServiceFeeCalc(orderChild.getSettlementWay(), settlementOwnerDetail));
// // 开票金额
// settlementOwnerDetail.setInvoiceFreight(settlementCommonService.invoiceFreightCalc(orderChild.getSettlementWay(),
// orderGoods.getInvoiceServiceFeeRate(), settlementOwnerDetail));
// 结算金额
settlementOwnerDetail.setSettlementFreight(settlementCommonService.settlementFreightCalc(orderChild.getSettlementWay(), settlementOwnerDetail));
// 未税 卸车减货损不用生成扣除相关流水逻辑
if (Objects.equals(invoiceType, SettlementOwnerEnum.InvoiceType.ONLINE.getCode())
&& Objects.equals(orderGoods.getPlatformFreightQuotationTaxType(),QuotationEnum.PlatformFreightQuotationTaxType.NO.getCode())
&& Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
settlementOwnerDetail.setPrepayFreight(BigDecimal.ZERO);
settlementDriverDetail.setPrepayFreightFlag(SettlementDriverEnum.PrepayFreightFlag.NO_PAY.getCode());
settlementOwnerDetail.setFinalPaymentStatus(SettlementOwnerDetailEnum.FinalPaymentStatus.NO_REQUIRE.getCode());
settlementOwnerDetail.setFinalPaymentStatus(SettlementOwnerDetailEnum.FinalPaymentStatus.NO.getCode());
//生成提现记录
networkDriverRunningWaterRecordService.generateNetworkCaseOutRecord(settlementDriverDetail);
}
else if (Objects.equals(invoiceType, SettlementOwnerEnum.InvoiceType.ONLINE.getCode())) {
......
package com.clx.performance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.clx.performance.model.OcrRecognition;
/**
* @author yangqifa
*/
public interface OcrRecognitionMapper extends BaseMapper<OcrRecognition> {
}
package com.clx.performance.model;
import com.msl.common.config.KeyColumn;
import com.msl.common.model.HasKey;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Data;
/**
* @author yangqifa
*/
@Data
public class OcrRecognition implements HasKey<Integer> {
/**
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
private Integer id;
/**
* 运单编号
*/
@ApiModelProperty(value = "运单编号")
private String childNo;
/**
* 磅单图片url
*/
@ApiModelProperty(value = "磅单图片url")
private String imageUrl;
/**
* 毛重
*/
@ApiModelProperty(value = "毛重")
private Double grossWeight;
/**
* 皮重
*/
@ApiModelProperty(value = "皮重")
private Double tareWeight;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createdTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date modifiedTime;
@KeyColumn("id")
@Override
public Integer gainKey() {
return id;
}
}
\ No newline at end of file
......@@ -99,4 +99,6 @@ public interface OrderChildService {
Integer getOrderChildCheck(OrderChildCheckParam param);
void cancelOrderChilds(CancelOrderGoodsParam param);
OcrRecognitionResultVO ocrRecognition(OcrRecognitionParam param);
}
......@@ -132,11 +132,19 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
//计算司机保证金
PaymentDTO paymentDTO = getPaymentDTO(orderChild);
if (Objects.nonNull(paymentDTO.getPlatformServiceFeeNew()) &&
paymentDTO.getPlatformServiceFeeNew().compareTo(BigDecimal.ZERO) != 0) {
orderChild.setPlatformServiceFee(paymentDTO.getPlatformServiceFeeNew());
if (Objects.nonNull(paymentDTO.getPlatformServiceFeeNew())) {
if(paymentDTO.getPlatformServiceFeeNew().compareTo(BigDecimal.ZERO) != 0){
orderChild.setPlatformServiceFee(paymentDTO.getPlatformServiceFeeNew());
}
//因为可能服务费为 0
if(orderChild.getFreight().compareTo(BigDecimal.ZERO)<=0){
orderChild.setPlatformServiceFee(paymentDTO.getPlatformServiceFeeNew());
}
}
// 更新装车净重
updateOrderGoodsAmountLoad(orderGoods,orderChild.getChildNo(), dif);
......
......@@ -72,15 +72,24 @@ import com.msl.common.utils.LocalDateTimeUtils;
import com.msl.common.utils.gps.GpsUtil;
import com.msl.user.data.UserSessionData;
import com.msl.user.utils.TokenUtil;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.ocr.v20181119.OcrClient;
import com.tencentcloudapi.ocr.v20181119.models.GroupInfo;
import com.tencentcloudapi.ocr.v20181119.models.ItemInfo;
import com.tencentcloudapi.ocr.v20181119.models.SmartStructuralOCRV2Request;
import com.tencentcloudapi.ocr.v20181119.models.SmartStructuralOCRV2Response;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -103,6 +112,12 @@ import java.util.stream.Collectors;
@Slf4j
@Service
public class OrderChildServiceImpl implements OrderChildService {
@Value("${tencentcloudapi.credential.secretId}")
private String secretId;
@Value("${tencentcloudapi.credential.secretKey}")
private String secretKey;
@Autowired
private AmqpTemplate rabbitTemplate;
@Autowired
......@@ -195,6 +210,10 @@ public class OrderChildServiceImpl implements OrderChildService {
@Autowired
private QuotationService quotationService;
@Autowired
private OcrRecognitionDao ocrRecognitionDao;
@Override
public SaveOrderChildVO saveOrderChild(OrderChildSaveParam param) {
......@@ -469,7 +488,7 @@ public class OrderChildServiceImpl implements OrderChildService {
// 新增运单
orderChildDao.saveEntity(orderChild);
// 冻结司机保证金
if(deposit.compareTo(BigDecimal.ZERO) ==1){
if(deposit.compareTo(BigDecimal.ZERO) > 0){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFrom(checkWalletCode);
......@@ -860,7 +879,7 @@ public class OrderChildServiceImpl implements OrderChildService {
{
platformServiceFeeNew = net.multiply(freightPrice).setScale(2, RoundingMode.HALF_UP)
//平台服务费率 * 100
.multiply(platformServiceFeeRate).movePointLeft(2).setScale(2, RoundingMode.HALF_UP);
.multiply(platformServiceFeeRate).movePointLeft(2).setScale(0, RoundingMode.HALF_UP);
changeDeposit = platformServiceFeeNew.subtract(platformServiceFee);
log.info("运单号 {} ,原始冻结金额 {} ,最新冻结金额 {},运费差 {} 吨数{} 运费价格{},费率 {}",orderChild.getChildNo(),
platformServiceFee,platformServiceFeeNew,changeDeposit,net,freightPrice,platformServiceFeeRate
......@@ -1363,7 +1382,7 @@ public class OrderChildServiceImpl implements OrderChildService {
// 日志
orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.SETTLEMENT.getCode(),
OrderChildLogEnum.Type.SETTLEMENT.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName());
}
@Override
......@@ -2704,4 +2723,41 @@ public class OrderChildServiceImpl implements OrderChildService {
}
}
}
@Override
public OcrRecognitionResultVO ocrRecognition(OcrRecognitionParam param) {
OcrRecognitionResultVO vo = new OcrRecognitionResultVO();
try{
Credential cred = new Credential(secretId, secretKey);
OcrClient client = new OcrClient(cred, "ap-beijing");
String[] itemNames = {"毛重", "皮重"};
SmartStructuralOCRV2Request req = new SmartStructuralOCRV2Request();
req.setImageUrl(param.getImageUrl());
req.setItemNames(itemNames);
SmartStructuralOCRV2Response resp = client.SmartStructuralOCRV2(req);
for (GroupInfo groupInfo : resp.getStructuralList()) {
ItemInfo itemInfo = groupInfo.getGroups()[0].getLines()[0];
String autoName = itemInfo.getKey().getAutoName();
String autoContent = itemInfo.getValue().getAutoContent();
if (NumberUtils.isCreatable(autoContent)) {
if ("毛重".equals(autoName)) {
vo.setGrossWeight(Double.valueOf(autoContent));
}else if ("皮重".equals(autoName)) {
vo.setTareWeight(Double.valueOf(autoContent));
}
}
}
//保存识别结果
OcrRecognition ocrRecognition = new OcrRecognition();
ocrRecognition.setChildNo(param.getChildNo());
ocrRecognition.setImageUrl(param.getImageUrl());
ocrRecognition.setGrossWeight(vo.getGrossWeight());
ocrRecognition.setTareWeight(vo.getTareWeight());
ocrRecognitionDao.saveEntity(ocrRecognition);
} catch (TencentCloudSDKException e) {
log.error(e.getMessage(),e);
}
return vo;
}
}
......@@ -254,10 +254,14 @@ public class PaymentServiceImpl implements PaymentService {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR);
}
if (notify.getCode() != 0) {
if(Objects.equals(notify.getCode(),"")){
if(Objects.equals(notify.getCode(),1005)){
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR,
"预估接单保证金"+new BigDecimal(param.getFigureNew()).movePointLeft(2)+"元,车主钱包余额不足,请先充值");
}else{
}else if(Objects.equals(notify.getCode(),6104)){
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR,
"预估接单保证金"+new BigDecimal(param.getFigureNew()).movePointLeft(2)+"元,车主钱包余额不足,请先充值");
}
else{
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg());
}
}
......@@ -379,6 +383,7 @@ public class PaymentServiceImpl implements PaymentService {
orderPaymentDao.selectByRelationNo(orderNo,operation,paymentItem).orNull();
if (null == orderPaymentOptional){
log.error("数据不存在 {}, {}" ,orderNo,msg);
return;
}
orderPaymentOptional.setStatus(PaymentStatusEnum.FAIL.getValue());
orderPaymentOptional.setReason(msg);
......@@ -392,6 +397,7 @@ public class PaymentServiceImpl implements PaymentService {
orderPaymentDao.selectByRelationNo(orderNo,operation,paymentItem).orNull();
if (null == orderPaymentOptional){
log.error("数据不存在 {}, {}" ,orderNo);
return;
}
orderPaymentOptional.setStatus(PaymentStatusEnum.SUCCESS.getValue());
orderPaymentDao.updateEntityByKey(orderPaymentOptional);
......@@ -404,6 +410,7 @@ public class PaymentServiceImpl implements PaymentService {
OrderPayment orderPaymentOptional = orderPaymentDao.getEntityByKey(Integer.valueOf(id)).orNull();
if (null == orderPaymentOptional){
log.error("数据不存在 {}, {}" ,id);
return;
}
orderPaymentOptional.setStatus(status);
orderPaymentDao.updateEntityByKey(orderPaymentOptional);
......@@ -416,6 +423,7 @@ public class PaymentServiceImpl implements PaymentService {
log.error("数据不存在 {}, {} ,{}" ,orderNo ,serialNo ,operation ,paymentItem );
if (null == orderPaymentOptional){
log.error("数据不存在 {}, {}" ,orderNo);
return;
}
orderPaymentOptional.setStatus(PaymentStatusEnum.SUCCESS.getValue());
orderPaymentOptional.setSerialNo(serialNo);
......
......@@ -73,8 +73,8 @@ public class NetworkDriverAccountServiceImpl implements NetworkDriverAccountServ
WalletResidueCardVO data = result.getData();
NetworkDriverAccount account = networkDriverAccountDao.getOneByField(NetworkDriverAccount::getDriverUserNo, loginUserInfo.getUserNo()).get();
data.setAssetSum(data.getAssetSum().add(account.getAccountBalance().movePointLeft(2)));
data.setFrozen(data.getFrozen().add(account.getFrozenBalance()).setScale(2, RoundingMode.UP));
data.setResidue(data.getResidue().add(account.getUsableBalance()).setScale(2, RoundingMode.UP));
data.setFrozen(data.getFrozen().add(account.getFrozenBalance()).setScale(2, RoundingMode.HALF_UP));
data.setResidue(data.getResidue().add(account.getUsableBalance()).setScale(2, RoundingMode.HALF_UP));
return data;
}
}
......@@ -19,8 +19,6 @@ import com.clx.performance.vo.app.APPNetworkDriverRunningWaterRecordVO;
import com.clx.performance.vo.pc.NetworkDriverRunningWaterRecordVO;
import com.clx.user.feign.DriverFeign;
import com.clx.user.vo.feign.BankCardVO;
import com.msl.common.base.Optional;
import com.msl.common.enums.ResultCodeEnum;
import com.msl.common.result.Result;
import com.msl.user.utils.TokenUtil;
import lombok.AllArgsConstructor;
......@@ -33,7 +31,6 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import static java.util.Locale.filter;
......@@ -200,6 +197,36 @@ public class NetworkDriverRunningWaterRecordServiceImpl implements NetworkDriver
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void generateCaseOutSuccessRunningWaterRecord1(SettlementDriverDetail settlementDriverDetail) {
log.info("运单同步网络货运生成司机运单提现成功流水");
NetworkDriverAccount account = networkDriverAccountDao.getOneByField(NetworkDriverAccount::getDriverUserNo, settlementDriverDetail.getDriverUserNo()).get();
networkDriverRunningWaterRecordDao.updateFrozenFlagByChildNo(settlementDriverDetail.getChildNo());
NetworkDriverRunningWaterRecord entity = NetworkDriverRunningWaterRecord.builder()
.usableBalance(account.getUsableBalance())
.mobile(account.getMobile())
.alterationBalance(settlementDriverDetail.getSettlementFreight())
.accountBalance(account.getAccountBalance())
.frozenBalance(account.getFrozenBalance()).createBy("系统")
.fundType(NetworkDriverAccountEnum.FundType.EXPENDITURE.getCode())
.fundTypeMsg(NetworkDriverAccountEnum.FundType.EXPENDITURE.getMsg())
.driverUserName(account.getDriverUserName())
.driverUserNo(account.getDriverUserNo())
.runningWaterNo(idGenerateSnowFlake.nextId(3L))
.runningWaterTypeMsg(NetworkDriverAccountEnum.RunningWaterStatus.CASE_OUT_SUCCESS.getMsg())
.runningWaterType(NetworkDriverAccountEnum.RunningWaterStatus.CASE_OUT_SUCCESS.getCode())
.childNo(settlementDriverDetail.getChildNo())
.orderNo(settlementDriverDetail.getOrderNo())
.orderGoodsNo(settlementDriverDetail.getOrderGoodsNo())
.build();
networkDriverRunningWaterRecordDao.saveEntity(entity);
}
@Override
public void generateNetworkDriverRunningWaterRecord(SettlementDriverDetail settlementDriverDetail, Integer runningWaterType) {
if (NetworkDriverAccountEnum.RunningWaterStatus.SETTLEMENT.getCode().equals(runningWaterType)) {
......
......@@ -9,6 +9,7 @@ import com.clx.performance.dao.settle.OrderChildSyncTransportRecordDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.dto.PayStatusNotifyDTO;
import com.clx.performance.enums.NetworkDriverAccountEnum;
import com.clx.performance.enums.OrderChildEnum;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.settle.SettlementOwnerDetailEnum;
import com.clx.performance.enums.settle.SettlementWayEnum;
......@@ -31,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.Objects;
/**
......@@ -64,6 +66,7 @@ public class OrderChildSyncTransportRecordServiceImpl implements OrderChildSyncT
@Override
public void addOrderChildSyncTransportRecord(SettlementDriverDetail detail) {
OrderChildSyncTransportRecord record = struct.convertRecord(detail);
record.setId(null);
//0:未同步
record.setStatus(0);
orderChildSyncTransportRecordDao.saveEntity(record);
......@@ -88,10 +91,16 @@ public class OrderChildSyncTransportRecordServiceImpl implements OrderChildSyncT
);
SettlementDriverDetail driverDetail = settlementDriverDetailService.selectOneByChildNo(childNo);
orderChild.setStatus(OrderChildEnum.Status.COMPLETE.getCode());
orderChild.setSettleTime(LocalDateTime.now());
orderChild.setFinishTime(orderChild.getSettleTime());
orderChildDao.updateSettlement(orderChild);
if (Objects.equals(orderGoods.getPlatformFreightQuotationTaxType(),
QuotationEnum.PlatformFreightQuotationTaxType.NO.getCode())
&& Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
// 未税,卸车减货损账户不变动
// 未税,卸车减货损
networkDriverRunningWaterRecordService.generateCaseOutSuccessRunningWaterRecord1(driverDetail);
}
else {
networkDriverRunningWaterRecordService.generateCaseOutSuccessRunningWaterRecord(driverDetail);
......
......@@ -71,10 +71,9 @@ public class SettlementDriverDetailServiceImpl implements SettlementDriverDetai
settlementDriverDetail.setPlatformServiceFeeRate(orderChild.getPlatformServiceFeeRate()==null
? BigDecimal.ZERO
: orderChild.getPlatformServiceFeeRate());
settlementDriverDetail.setPlatformServiceFee(
settlementDriverDetail.getSettlementFreight()
.multiply(settlementDriverDetail.getPlatformServiceFeeRate().movePointLeft(2))
.setScale(0, RoundingMode.HALF_UP));
settlementDriverDetail.setPlatformServiceFee(orderChild.getPlatformServiceFee()==null
? BigDecimal.ZERO
: orderChild.getPlatformServiceFee());
settlementDriverDetailDao.saveEntity(settlementDriverDetail);
......
......@@ -202,21 +202,20 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
if (!settlementDriverDetail.getInvoiceType().equals(SettlementOwnerEnum.InvoiceType.ONLINE.getCode())) {
paySettlementDriver(settlementDriverDetail);
} else {
if (settlementDriverDetail.getPrepayFreightFlag().equals(SettlementDriverEnum.PrepayFreightFlag.PAYED.getCode())
&& settlementDriverDetail.getPrepayFreight().compareTo(BigDecimal.ZERO) > 0) {
if (Objects.equals(orderGoods.getPlatformFreightQuotationTaxType(),
QuotationEnum.PlatformFreightQuotationTaxType.NO.getCode())
&& Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
settlementDriverDetail.setSettlementNo(settlementNo);
//插入同步网络货运待支付记录
childSyncTransportRecordService.addOrderChildSyncTransportRecord(settlementDriverDetail);
}
if (Objects.equals(orderGoods.getPlatformFreightQuotationTaxType(),
QuotationEnum.PlatformFreightQuotationTaxType.NO.getCode())
&& Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
else if (settlementDriverDetail.getPrepayFreightFlag().equals(SettlementDriverEnum.PrepayFreightFlag.PAYED.getCode())
&& settlementDriverDetail.getPrepayFreight().compareTo(BigDecimal.ZERO) > 0) {
settlementDriverDetail.setSettlementNo(settlementNo);
//插入同步网络货运待支付记录
childSyncTransportRecordService.addOrderChildSyncTransportRecord(settlementDriverDetail);
}
}
// 更新结算单
......@@ -269,22 +268,14 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
}
if (Objects.equals(result.getSyncStatus(), 0)) {
OrderChildSyncTransportInvoiceRecord entity = new OrderChildSyncTransportInvoiceRecord();
entity.setChildNo(orderChild.getChildNo());
entity.setType(TransportSyncTypeEnum.Type.EXCEPTION.getCode());
entity.setRemark("处理中");
orderChildSyncTransportInvoiceRecordDao.saveEntity(entity);
return;
}
// 发送mq (结算)
settlementMqService.settle(orderChild.getChildNo(), invoiceType, remark);
}catch (Exception e){
OrderChildSyncTransportInvoiceRecord entity = new OrderChildSyncTransportInvoiceRecord();
entity.setChildNo(orderChild.getChildNo());
entity.setType(TransportSyncTypeEnum.Type.EXCEPTION.getCode());
entity.setRemark("接口调用失败");
orderChildSyncTransportInvoiceRecordDao.saveEntity(entity);
log.info("结算获取状态失败, 运单号 {}",mq.getChildNo(),e);
}
}
......@@ -336,7 +327,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
}
// 获取状态
TransportVO result = brokerService.getOrderChildStatus(mq.getChildNo());
TransportVO result = brokerService.getOrderChildStatus(mq.getChildNo(), settlementOwnerDetail.getSettlementNo());
if (result == null){
log.info("运单号 {} 未找到运单信息",mq.getChildNo());
return;
......
......@@ -101,9 +101,9 @@ public class SettlementOwnerDetailServiceImpl implements SettlementOwnerDetailS
settlementCommonService.invoiceFreightCalc(orderChild.getSettlementWay(),
orderGoods.getInvoiceServiceFeeRate(), settlementOwnerDetail));
// // 结算金额
// settlementOwnerDetail.setSettlementFreight(
// settlementCommonService.settlementFreightCalc(orderGoods.getSettlementWay(),settlementOwnerDetail));
// 结算金额
settlementOwnerDetail.setSettlementFreight(
settlementCommonService.settlementFreightCalc(orderGoods.getSettlementWay(),settlementOwnerDetail));
settlementOwnerDetail.setFinalPaymentStatus(SettlementOwnerDetailEnum.FinalPaymentStatus.NO.getCode());
//设置开票公司信息
......
......@@ -41,8 +41,8 @@ public class SettlementPlatformServiceFeeExportServiceImpl implements Settlement
fieldList.add(new ExcelField(6, "车牌号", "truckNo", 10000));
fieldList.add(new ExcelField(7, "结算金额", "settlementFreight", 10000));
fieldList.add(new ExcelField(8, "平台服务费率", "invoiceServiceFeeRate", 10000));
fieldList.add(new ExcelField(9, "平台服务费", "invoiceServiceFee", 10000));
fieldList.add(new ExcelField(8, "毛利率", "invoiceServiceFeeRate", 10000));
fieldList.add(new ExcelField(9, "毛利润", "invoiceServiceFee", 10000));
fieldList.add(new ExcelField(10, "创建时间", "createTime", 5000));
......@@ -71,7 +71,7 @@ public class SettlementPlatformServiceFeeExportServiceImpl implements Settlement
}
// 导出
ExcelUtil.export(new ExcelSheet("平台服务费统计", fieldList, dataList));
ExcelUtil.export(new ExcelSheet("毛利统计", fieldList, dataList));
}
}
......@@ -7,6 +7,7 @@ import com.clx.performance.param.app.NetworkDriverPageParam;
import com.clx.performance.param.pc.PageNetworkAccountInfoListParam;
import com.clx.performance.vo.app.APPNetworkDriverRunningWaterRecordVO;
import com.clx.performance.vo.pc.NetworkDriverRunningWaterRecordVO;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
......@@ -25,6 +26,8 @@ public interface NetworkDriverRunningWaterRecordService {
void generateCaseOutSuccessRunningWaterRecord(SettlementDriverDetail settlementDriverDetail);
void generateCaseOutSuccessRunningWaterRecord1(SettlementDriverDetail settlementDriverDetail);
void generateNetworkDriverRunningWaterRecord(SettlementDriverDetail settlementDriverDetail, Integer runningWaterType);
IPage<APPNetworkDriverRunningWaterRecordVO> pageFrozenList(NetworkDriverPageParam param);
......
......@@ -243,7 +243,9 @@ public class OrderGoodsSqlProvider {
" date_format(a.create_time, '%Y-%m-%d %H:%i:%s') as create_time," +
" date_format(a.modified_time, '%Y-%m-%d %H:%i:%s') as modified_time," +
"a.extract_way,a.need_truck_num,a.senior_logistics_manager_id,a.senior_logistics_manager_name,a.pending_order_freight," +
"a.user_no,a.user_name,a.batch_number,a.last_arrive_receive_time,a.last_load_time,a.last_order_time,a.vehicle_usage");
"a.user_no,a.user_name,a.batch_number,a.last_arrive_receive_time,a.last_load_time,a.last_order_time,a.vehicle_usage," +
" a.platform_freight_quotation_tax_type, a.platform_service_fee_rate, " +
" a.deposit, a.invoice_service_fee_rate, a.settlement_way, a.support_loan ");
FROM("order_goods a");
if (Objects.nonNull(id)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论