Commit 622492d1 authored by zhangfeng's avatar zhangfeng

feat(wealth): 优化

parent 20a43543
......@@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.ecw.api.bank;
import cn.iocoder.yudao.module.ecw.api.bank.dto.BankAccountDTO;
import java.util.List;
public interface BankApi {
/**
* 根据银行账号获取账号信息
*/
BankAccountDTO getBankAccountByAccountNo(String baAccountNum);
List<BankAccountDTO> getBankAccountByAccountNo(String baAccountNum);
/**
* 根据银行账号id获取账号信息
*/
......
......@@ -34,4 +34,6 @@ public interface BankAccountConvert {
List<BankAccountExcelVO> convertList02(List<BankAccountDO> list);
BankAccountDTO convertDTO(BankAccountDO bankAccountDO);
List<BankAccountDTO> convertDTOList(List<BankAccountDO> bankAccountDOs);
}
......@@ -19,12 +19,9 @@ public class BankApiImpl implements BankApi {
private BankAccountMapper bankAccountMapper;
@Override
public BankAccountDTO getBankAccountByAccountNo(String baAccountNum) {
List<BankAccountDO> bankAccountDO = bankAccountMapper.selectList("ba_account_num", baAccountNum);
if (bankAccountDO != null && !bankAccountDO.isEmpty()) {
return BankAccountConvert.INSTANCE.convertDTO(bankAccountDO.get(0));
}
return null;
public List<BankAccountDTO> getBankAccountByAccountNo(String baAccountNum) {
List<BankAccountDO> bankAccountDOs = bankAccountMapper.selectList("ba_account_num", baAccountNum);
return BankAccountConvert.INSTANCE.convertDTOList(bankAccountDOs);
}
@Override
......
......@@ -231,4 +231,8 @@ public class ReceiptDO extends BaseDO {
* 生成路径
*/
private Integer generatePath;
/**
* 核销误差兑额外费用主币种金额
*/
private String writeOffDiffMainCurrency;
}
package cn.iocoder.yudao.module.wealth.dal.mysql.payment;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
......@@ -11,6 +12,7 @@ import cn.iocoder.yudao.module.wealth.vo.payment.*;
/**
* 付款单 Mapper
*
* @author 郑屹
*/
@Mapper
......@@ -18,14 +20,16 @@ public interface PaymentMapper extends AbstractMapper<PaymentDO> {
@Override
default PageResult<PaymentDO> selectPage(PageVO page, Object object) {
if (object instanceof PaymentQueryVO) {
PaymentQueryVO vo = (PaymentQueryVO)object;
PaymentQueryVO vo = (PaymentQueryVO) object;
return selectPage(page, new LambdaQuery<PaymentDO>()
.eqIfPresent(PaymentDO::getPaymentNo, vo.getPaymentNo())
.eqIfPresent(PaymentDO::getDepartmentId, vo.getDepartmentId())
.likeIfPresent(PaymentDO::getDepartmentName, vo.getDepartmentName())
.eqIfPresent(PaymentDO::getSalesmanId, vo.getSalesmanId())
.inIfPresent(PaymentDO::getSalesmanId, vo.getSalesmanIdList())
.likeIfPresent(PaymentDO::getSalesmanName, vo.getSalesmanName())
.eqIfPresent(PaymentDO::getSupplierId, vo.getSupplierId())
.inIfPresent(PaymentDO::getSupplierId, vo.getSupplierIdList())
.likeIfPresent(PaymentDO::getSupplierName, vo.getSupplierName())
.eqIfPresent(PaymentDO::getSupplierBank, vo.getSupplierBank())
.eqIfPresent(PaymentDO::getSupplierBankAccount, vo.getSupplierBankAccount())
......@@ -33,8 +37,10 @@ public interface PaymentMapper extends AbstractMapper<PaymentDO> {
.eqIfPresent(PaymentDO::getLatestPayAt, vo.getLatestPayAt())
.eqIfPresent(PaymentDO::getAccountNumber, vo.getAccountNumber())
.eqIfPresent(PaymentDO::getInvoiceStatus, vo.getInvoiceStatus())
.inIfPresent(PaymentDO::getInvoiceStatus, vo.getInvoiceStatusList())
.eqIfPresent(PaymentDO::getInvoiceNumber, vo.getInvoiceNumber())
.eqIfPresent(PaymentDO::getState, vo.getState())
.inIfPresent(PaymentDO::getState, vo.getStateList())
.eqIfPresent(PaymentDO::getPaymentAddId, vo.getPaymentAddId())
.eqIfPresent(PaymentDO::getPaymentAddBy, vo.getPaymentAddBy())
.eqIfPresent(PaymentDO::getReviewId, vo.getReviewId())
......@@ -55,7 +61,7 @@ public interface PaymentMapper extends AbstractMapper<PaymentDO> {
@Override
default List<PaymentDO> selectList(Object object) {
if (object instanceof PaymentQueryVO) {
PaymentQueryVO vo = (PaymentQueryVO)object;
PaymentQueryVO vo = (PaymentQueryVO) object;
return selectList(new LambdaQuery<PaymentDO>()
.eqIfPresent(PaymentDO::getPaymentNo, vo.getPaymentNo())
.eqIfPresent(PaymentDO::getDepartmentId, vo.getDepartmentId())
......
......@@ -87,91 +87,6 @@ public interface ReceivableMapper extends AbstractMapper<ReceivableDO> {
return null;
}
@ResultType(ReceivableBackVO.class)
@Select({
"<script>",
"select r.*, ",
"o.marks, ",
"o.`status`, ",
"o.abnormal_state, ",
"o.in_warehouse_state, ",
"o.shipment_state, ",
"o.pick_state, ",
"o.to_warehouse_state, ",
"o.tidan_no, ",
"o.container_number as container_number, ",
"nor.name as consignor_name, ",
"nor.phone as consignor_phone, ",
"nor.customer_id as consignor_id, ",
"nee.name as consignee_name, ",
"nee.customer_id as consignee_id, ",
"nee.phone as consignee_phone",
"from ecw_receivable r ",
"left join ecw_order o on o.order_id = r.order_id",
"left join ecw_warehouse_line de on o.line_id = de.id ",
"left join ecw_order_consignor nor on nor.order_id = o.order_id ",
"left join ecw_order_consignee nee on nee.order_id = o.order_id ",
"where r.deleted = 0 and r.receipt_id is null and o.order_id is not null",
"<when test = 'query.status != null'>",
"AND o.`status` = #{query.status}",
"</when>",
"<when test = 'query.isCargoControl != null'>",
"AND (o.`is_cargo_control` = #{query.isCargoControl} or o.`is_cargo_control` = #{query.isCargoControl})",
"</when>",
"<when test = 'query.customsType != null'>",
"AND o.`customs_type` = #{query.customsType}",
"</when>",
"<when test = 'query.transportId != null'>",
"AND o.`transport_id` = #{query.transportId}",
"</when>",
"<when test = 'query.isCargoControl != null '>",
"AND o.`is_cargo_control` = #{query.isCargoControl}",
"</when>",
"<when test = 'query.marks != null and query.marks != \"\" '>",
"AND o.`marks` like concat('%',concat(#{query.marks},'%'))",
"</when>",
"<when test = 'query.departureId != null '>",
"AND de.`start_warehouse_id` = #{query.departureId}",
"</when>",
"<when test = 'query.objectiveId != null '>",
"AND de.`dest_warehouse_id` = #{query.objectiveId}",
"</when>",
"<when test = 'query.title != null and query.title != \"\" '>",
"AND concat(r.`title_zh`, r.`title_en`) like concat('%',concat(#{query.title},'%'))",
"</when>",
"<when test = 'query.consignorNameOrPhone != null and query.consignorNameOrPhone != \"\" '>",
"AND concat(nor.`name`, nor.`phone`,nor.`company`) like concat('%',concat(#{query.consignorNameOrPhone},'%'))",
"</when>",
"<when test = 'query.consigneeNameOrPhone != null and query.consigneeNameOrPhone != \"\" '>",
"AND concat(nee.`name`, nee.`phone`,nee.`company`) like concat('%',concat(#{query.consigneeNameOrPhone},'%'))",
"</when>",
"<when test = 'query.orderNo != null and query.orderNo != \"\" '>",
"AND r.`order_no` like concat('%',concat(#{query.orderNo},'%'))",
"</when>",
"<when test = 'query.tidanNo != null and query.tidanNo != \"\" '>",
"AND o.`tidan_no` like concat('%',concat(#{query.tidanNo},'%'))",
"</when>",
"<when test = 'query.receiptNo != null and query.receiptNo != \"\" '>",
"AND r.`receipt_no` like concat('%',concat(#{query.receiptNo},'%'))",
"</when>",
"<when test = 'query.state != null '>",
"AND r.`state` #{query.state}",
"</when>",
"<when test = 'query.beginCreateTime != null and query.endCreateTime != null '>",
"AND r.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}",
"</when>",
"<when test = 'query.feeType != null'>",
"AND r.`fee_type` = #{query.feeType}",
"</when>",
"<when test = 'query.customerId != null'>",
"AND o.`customer_id` = #{query.customerId}",
"</when>",
"<when test = 'query.containerNumber != null'>",
"AND o.`container_number` = #{query.containerNumber}",
"</when>",
"group by r.id",
"</script>"
})
IPage<ReceivableBackVO> receivablePage(@Param("mpPage") IPage<ReceivableBackVO> mpPage, @Param("query") ReceivableQueryVO query);
......
......@@ -162,7 +162,6 @@ public class FinanceReceiptApproveService {
List orderIds = orderList.stream().map(ReceivableDO::getOrderId).distinct().collect(Collectors.toList());
receivableService.orderReceivableWriteOffLogAdd(orderIds, receiptDO.getReceiptNo());
// TODO 更新核销误差兑额外费用主币种金额
} else if (result == BpmProcessInstanceResultEnum.REJECT.getResult()) {
updateReceipt.setState(ReceiptStatusEnum.WRITE_OFF_PART_ING.getValue());
......@@ -270,7 +269,7 @@ public class FinanceReceiptApproveService {
.baAccountName(receiptItemDO.getAccountName())
.baAccountNum(receiptItemDO.getAccountNo())
.baBankName(receiptItemDO.getAccountBankName())
.baBalance(receiptItemDO.getAmount()).build(), true);
.baBalance(receiptItemDO.getAmount()).build(), false);
} else if (result == BpmProcessInstanceResultEnum.REJECT.getResult()) {
updateWrapper.set(ReceiptItemDO::getStatus, ReceiptItemStatusEnum.WRITE_OFF.getValue());
receiptItemMapper.update(null, updateWrapper);
......
......@@ -22,6 +22,8 @@ import cn.iocoder.yudao.module.ecw.api.bank.BankApi;
import cn.iocoder.yudao.module.ecw.api.bank.dto.BankAccountDTO;
import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi;
import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
import cn.iocoder.yudao.module.ecw.api.region.RegionApi;
import cn.iocoder.yudao.module.ecw.api.region.dto.RegionDTO;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
......@@ -120,6 +122,8 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
@Resource
@Lazy
private OrderApi orderApi;
@Resource
private RegionApi regionApi;
private static final String RECEIPT_NEW_NUMBER = "receipt:new:number";
......@@ -875,13 +879,15 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
if (null == currencyId) {
throw exception(RECEIPT_CURRENCY_NOT_EXISTS);
}
BigDecimal diff = null;
if (totalAmount.compareTo(receiptDO.getReceivableTotalAmount()) < 0) {
DictDataRespDTO dictDataRespDTO = dictDataApi.parseDictDataFromCache("write_off_diff", String.valueOf(currencyId));
if (null == dictDataRespDTO) {
throw exception(RECEIPT_CURRENCY_DIFF_NOT_EXISTS);
}
//核销差额大于配置提示
if (receiptDO.getReceivableTotalAmount().subtract(totalAmount).compareTo(new BigDecimal(dictDataRespDTO.getValue())) == 1) {
diff = receiptDO.getReceivableTotalAmount().subtract(totalAmount);
if (diff.compareTo(new BigDecimal(dictDataRespDTO.getValue())) > 0) {
throw exception(RECEIPT_CURRENCY_DIFF_BIG);
} else {
String message = "收款单已全部核销,总金额差值小于{}{},允许全部核销,核销比例应为100%";
......@@ -914,6 +920,17 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
update.setState(ReceiptStatusEnum.WRITE_OFF_ALL_ING.getValue());
update.setBmpId(bpmId);
update.setFinanceRemark(financeRemark);
// 更新核销误差兑额外费用主币种金额
List<ReceiptRelationOrderInfoVO> relationOrder = receiptMapper.getOrderInfoByReceiptId(receiptDO.getId());
OrderVO orderVO = receiptMapper.getContainerNumberByOrderId(relationOrder.get(0).getOrderId());
if (null != orderVO) {
RegionDTO region = regionApi.getRegionById(Long.parseLong(orderVO.getCountry()));
Long importCurrency3 = Long.parseLong(region.getImportCurrency3());
if (!currencyId.equals(importCurrency3)) {
diff = diff == null ? null : diff.multiply(currencyApi.getCurrencyRate(currencyId, importCurrency3).getCurrencyRate());
}
update.setWriteOffDiffMainCurrency(diff == null ? "0" : diff.setScale(2, RoundingMode.HALF_UP).toString());
}
receiptMapper.updateById(update);
}
......
......@@ -120,9 +120,6 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
*/
void cancelFinanceReceiptItemWriteOffNo(FinanceReceiptItemCancelVo financeReceiptItemVo);
BigDecimal getWriteOffAmountByReceiptId( Long receiptId);
List<ReceiptItemBatchRespVO> receiptItemImport(List<ReceiptItemBatchCreateReqVO> list, Boolean ignoreItem);
ReceiptItemBackVO getReceiptItemDetail(Long id);
......
......@@ -128,10 +128,6 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
for (ReceivableWriteOffReqVO receivableWriteOffReqVO : createReqVO.getReceivableWriteOffList()) {
receivableService.createWriteOffRecord(receivableWriteOffReqVO, receiptItem, incomeBelong);
}
// TODO 校验当前收款单汇率是否过期,过期则更新为导入的汇率 没过期不更新?更新汇率后有效期是啥?
//if (receiptDO.getRateValidateDate().before(new Date())) {
// 更新收款单汇率,且更新应收金额
//}
// 创建收款明细的时候要判断收款单状态进行更新
if (receiptDO.getState() == 1) {
ReceiptDO update = new ReceiptDO();
......@@ -142,7 +138,13 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
}
receiptService.updateReceiptItemStatus(receiptItem.getReceiptId());
if (isBatch) {
receiptItemAutoApprove(receiptItem, receiptDO.getReceiptNo());
createFinanceReceiptItemWriteOff(FinanceReceiptItemVo.builder()
.receiptId(receiptItem.getReceiptId())
.receiptNo(receiptDO.getReceiptNo())
.receiptItemId(receiptItem.getId())
.remark("批量创建收款明细自动提交审批")
.build());
// TODO 更新汇率
}
// 返回
return receiptItem.getId();
......@@ -495,30 +497,74 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
}
//校验收款单是否核销中
validateReceipt(receiptItemDO.getReceiptId());
receiptService.recordLog(receiptItemDO.getReceiptId(), ReceiptLinkEnum.SUBMIT_BANK_RECEIPT, financeReceiptItemVo.getRemark(), WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF.getValue());
// 判断是否符合自动审批规则
boolean autoApprove = judgmentAutoApprove(receiptItemDO);
//创建收款单明细核销流程
ReceiptApprovalDO approvalDO = new ReceiptApprovalDO();
approvalDO.setReceiptId(financeReceiptItemVo.getReceiptId());
approvalDO.setReceiptNo(financeReceiptItemVo.getReceiptNo());
approvalDO.setReceiptItemId(financeReceiptItemVo.getReceiptItemId());
approvalDO.setBmpKey(WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF.getKey());
approvalDO.setStatus(BpmProcessInstanceResultEnum.PROCESS.getResult());
approvalDO.setReason(financeReceiptItemVo.getRemark());
if (autoApprove) {
approvalDO.setStatus(BpmProcessInstanceResultEnum.APPROVE.getResult());
receiptApprovalService.save(approvalDO);
receiptItemDO.setBmpStatus(BpmProcessInstanceResultEnum.APPROVE.getResult());
receiptItemDO.setStatus(ReceiptItemStatusEnum.WRITE_OFF.getValue());
receiptItemDO.setApprovalTime(new Date());
this.updateById(receiptItemDO);
// 更新收款单
ReceiptDO receiptDO = receiptMapper.selectById(receiptItemDO.getReceiptId());
//判断收款单状态如果是待提交状态-变成部分核销状态,其它 状态不变
if (receiptDO.getState().equals(ReceiptStatusEnum.WRITE_OFF_WAITING.getValue())) {
receiptDO.setState(ReceiptStatusEnum.WRITE_OFF_PART_ING.getValue());
}
BigDecimal writeOffAmount = receiptItemMapper.getWriteOffAmountByReceiptId(receiptDO.getId());
if (null != receiptDO.getReceivableTotalAmount() && receiptDO.getReceivableTotalAmount().compareTo(BigDecimal.ZERO) > 0) {
receiptDO.setWriteOffProportion(writeOffAmount.divide(receiptDO.getReceivableTotalAmount(), 8, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(6, BigDecimal.ROUND_HALF_UP));
}
try {
receiptService.updateById(receiptDO);
} catch (Exception e) {
log.error("更新收款单失败", e);
}
//更新应收明细
List<ReceivableDO> receivableDOS = receivableService.selectList("receipt_id", receiptItemDO.getReceiptId());
for (ReceivableDO receivableDO : receivableDOS) {
receivableDO.setState(1);
ReceivableWriteOffRecordDO receivableWriteOffRecordDO = receivableService.getReceivableWriteOffRecord(receivableDO.getId(), receiptItemDO.getId());
if (null != receivableWriteOffRecordDO) {
BigDecimal writeOffCurrent = receivableWriteOffRecordDO.getWriteOffAmount().divide(receivableDO.getExchangeRate(), 4, RoundingMode.HALF_UP);
BigDecimal oldWriteOffAmount = receivableDO.getWriteOffAmount() == null ? BigDecimal.ZERO : receivableDO.getWriteOffAmount();
receivableDO.setWriteOffAmount(oldWriteOffAmount.add(writeOffCurrent));
}
}
receivableService.updateBatchById(receivableDOS);
// 更新银行账户余额
bankApi.updateBankAccountBalance(BankAccountDTO.builder()
.id(receiptItemDO.getAccountId())
.baAccountName(receiptItemDO.getAccountName())
.baAccountNum(receiptItemDO.getAccountNo())
.baBankName(receiptItemDO.getAccountBankName())
.baBalance(receiptItemDO.getAmount()).build(), true);
} else {
approvalDO.setStatus(BpmProcessInstanceResultEnum.PROCESS.getResult());
receiptApprovalService.save(approvalDO);
Long userId = SecurityFrameworkUtils.getLoginUserId();
String bpmId = bpmCreateServiceFactory.createBmp(userId, approvalDO.getId(), WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF.getKey(), financeReceiptItemVo.getReceiptNo(), financeReceiptItemVo.getCopyUserList());
approvalDO.setBmpId(bpmId);
receiptApprovalService.updateById(approvalDO);
ReceiptItemDO update = new ReceiptItemDO();
update.setId(financeReceiptItemVo.getReceiptItemId());
update.setBmpStatus(BpmProcessInstanceResultEnum.PROCESS.getResult());
update.setStatus(ReceiptItemStatusEnum.WRITE_OFF_APPROVE_ING.getValue());
update.setBmpId(bpmId);
this.updateById(update);
receiptService.recordLog(receiptItemDO.getReceiptId(), ReceiptLinkEnum.SUBMIT_BANK_RECEIPT, financeReceiptItemVo.getRemark(), WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF.getValue());
receiptService.updateReceiptItemStatus(receiptItemDO.getReceiptId());
receiptItemDO.setBmpStatus(BpmProcessInstanceResultEnum.PROCESS.getResult());
receiptItemDO.setStatus(ReceiptItemStatusEnum.WRITE_OFF_APPROVE_ING.getValue());
receiptItemDO.setBmpId(bpmId);
this.updateById(receiptItemDO);
return approvalDO;
}
receiptService.updateReceiptItemStatus(receiptItemDO.getReceiptId());
return null;
}
/**
* 判断是否符合自动审批条件
......@@ -526,18 +572,18 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
* 的核销比例范围内,银行收款明细自动审批通过,审批通过人为admin,日志备注核销比例为XX,
* 符合核销比例99.99%-100.99%
*/
private void receiptItemAutoApprove(ReceiptItemDO receiptItemDO, String receiptNo) {
private boolean judgmentAutoApprove(ReceiptItemDO receiptItemDO) {
List<ReceiptItemDO> receiptItemDOS = receiptItemMapper.selectList("receipt_id", receiptItemDO.getReceiptId());
if (receiptItemDOS.size() > 1 || !Objects.equals(receiptItemDOS.get(0).getId(), receiptItemDO.getId())) {
return;
return false;
}
List<ReceiptBankWriteoffRangeDO> receiptBankWriteoffRangeDOS = receiptBankWriteoffRangeMapper.selectList();
if (CollectionUtil.isEmpty(receiptBankWriteoffRangeDOS)) {
return;
return false;
}
List<ReceiptAccountDO> receiptAccounts = receiptAccountMapper.selectList("receipt_id", receiptItemDO.getReceiptId());
if (CollectionUtil.isEmpty(receiptAccounts)) {
return;
return false;
}
// 计算账单总金额
BigDecimal totalAmount = receiptAccounts.stream().map(ReceiptAccountDO::getWriteOffAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
......@@ -547,17 +593,11 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
BigDecimal writeOffUp = new BigDecimal(receiptBankWriteoffRangeDOS.get(0).getWriteOffUp());
BigDecimal writeOffRate = receiptItemDO.getWriteOffAmount().multiply(new BigDecimal(10000)).divide(totalAmount, 8, RoundingMode.HALF_UP).setScale(6, RoundingMode.HALF_UP);
if (writeOffRate.compareTo(writeOffDown) < 0 || writeOffRate.compareTo(writeOffUp) > 0) {
return;
return false;
}
String remark = "核销比例为: " + writeOffRate + "%, " + "符合核销比例" + writeOffDown + "%-" + writeOffUp + "%";
ReceiptApprovalDO approvalDO = createFinanceReceiptItemWriteOff(FinanceReceiptItemVo.builder()
.receiptId(receiptItemDO.getReceiptId())
.receiptNo(receiptNo)
.receiptItemId(receiptItemDO.getId())
.remark(remark)
.build());
bpmProcessInstanceApi.approveTask(approvalDO.getBmpId(), "自动审批");
receiptService.recordLog(receiptItemDO.getReceiptId(), ReceiptLinkEnum.APPROVE_BANK_RECEIPT, remark, WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF.getValue());
return true;
}
@Override
......@@ -640,7 +680,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
throw exception(BMP_NOT);
}
if (receiptItemDO.getBmpStatus() != BpmProcessInstanceResultEnum.PROCESS.getResult()) {
if (!receiptItemDO.getBmpStatus().equals(BpmProcessInstanceResultEnum.PROCESS.getResult())) {
throw exception(BMP_CANCEL);
}
......@@ -652,17 +692,12 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
if (null == receiptDO) {
throw exception(RECEIPT_NOT_EXISTS);
} else {
if (BpmProcessInstanceResultEnum.PROCESS.getResult() == receiptDO.getBmpStatus()) {
if (BpmProcessInstanceResultEnum.PROCESS.getResult().equals(receiptDO.getBmpStatus())) {
throw exception(RECEIPT_ALL_WRITE_OFF_ING);
}
}
}
public BigDecimal getWriteOffAmountByReceiptId(Long receiptId) {
return receiptItemMapper.getWriteOffAmountByReceiptId(receiptId);
}
@Override
public List<ReceiptItemBatchRespVO> receiptItemImport(List<ReceiptItemBatchCreateReqVO> createReqVOlist, Boolean ignoreItem) {
// 校验收款账户信息并生成创建明细
......@@ -691,16 +726,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
List<ReceivableWriteOffReqVO> receivableWriteOffList = getReceiptItemDetail(listForCreateReceiptItem, receiptItemCreateReqVO);
receiptItemCreateReqVO.setReceivableWriteOffList(receivableWriteOffList);
// 插入数据
Long receiptItemId = proxy.createReceiptItem(receiptItemCreateReqVO, true);
ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(receiptItemId);
if (receiptItemDO.getBmpId() == null) {
this.createFinanceReceiptItemWriteOff(FinanceReceiptItemVo.builder()
.receiptId(receiptItemDO.getReceiptId())
.receiptNo(receiptItemCreateReqVO.getOrderNo())
.receiptItemId(receiptItemDO.getId())
.remark("批量导入收款明细自动提交审批")
.build());
}
proxy.createReceiptItem(receiptItemCreateReqVO, true);
}
return respVOS;
}
......@@ -959,10 +985,14 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
createReqVO.setSettleCurrency(value.getId().toString());
}
}
BankAccountDTO account = bankApi.getBankAccountByAccountNo(createReqVO.getPayAccount());
if (null == account) {
List<BankAccountDTO> accounts = bankApi.getBankAccountByAccountNo(createReqVO.getPayAccount());
if (CollectionUtil.isEmpty(accounts)) {
return new ReceiptItemBatchRespVO(createReqVO.getOrderNo(), createReqVO.getPayer(), 0, "收款账号不存在");
}
if (accounts.size() > 1) {
return new ReceiptItemBatchRespVO(createReqVO.getOrderNo(), createReqVO.getPayer(), 0, "匹配到多个收款账号");
}
BankAccountDTO account = accounts.get(0);
createReqVO.setAccountId(account.getId());
createReqVO.setAccountName(account.getBaAccountName());
createReqVO.setAccountBankName(account.getBaBankName());
......
......@@ -39,6 +39,9 @@ public class CommissionPayableQueryVO {
@ApiModelProperty(value = "佣金费用类型(字典:commission_fee_type)")
private Integer feeType;
@ApiModelProperty(value = "佣金费用类型")
private List<Integer> feeTypeList;
@ApiModelProperty(value = "金额")
private java.math.BigDecimal totalAmount;
......@@ -60,6 +63,9 @@ public class CommissionPayableQueryVO {
@ApiModelProperty(value = "收款状态(0未付款,1付款中,2已付款)")
private Integer state;
@ApiModelProperty(value = "收款状态(0未付款,1付款中,2已付款)")
private List<Integer> stateList;
@ApiModelProperty(value = "数据来源(pc端,mobile端)")
private String source;
......@@ -82,12 +88,18 @@ public class CommissionPayableQueryVO {
@ApiModelProperty(value = "始发地仓库ID")
private Long startWarehouseId;
@ApiModelProperty(value = "始发地仓库ID")
private List<Long> startWarehouseIdList;
@ApiModelProperty(value = "目的地仓库ID")
private Long destWarehouseId;
@ApiModelProperty(value = "目的地仓库ID")
private List<Long> destWarehouseIdList;
@ApiModelProperty(value = "运输方式")
private Long transportId;
@ApiModelProperty(value = "运输方式")
private List<Long> transportIdList;
@ApiModelProperty(value = "搜索关键字(包括:客户名称、手机号、客户编号)")
private String searchKey;
......
......@@ -24,12 +24,18 @@ public class CommissionPaymentQueryVO {
@ApiModelProperty(value = "业务员")
private Long salesmanId;
@ApiModelProperty(value = "业务员id")
private List<Long> salesmanIdList;
@ApiModelProperty(value = "业务员名称")
private String salesmanName;
@ApiModelProperty(value = "客户id")
private Long customerId;
@ApiModelProperty(value = "客户id集合")
private List<Long> customerIdList;
@ApiModelProperty(value = "客户名称")
private String customerName;
......@@ -57,12 +63,16 @@ public class CommissionPaymentQueryVO {
@ApiModelProperty(value = "发票状态(0未开票,1已开票)")
private Integer invoiceStatus;
private List<Integer> invoiceStatusList;
@ApiModelProperty(value = "发票号")
private String invoiceNumber;
@ApiModelProperty(value = "付款单状态(1待审核,2已审核待核销,3已核销)")
private Integer state;
private List<Integer> stateList;
@ApiModelProperty(value = "付款单添加人id")
private Long paymentAddId;
......
......@@ -7,9 +7,9 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 应付款查询 VO")
......@@ -38,6 +38,9 @@ public class PayableQueryVO {
@ApiModelProperty(value = "费用类型(字典:payable_fee_type)")
private Long feeType;
@ApiModelProperty(value = "费用类型(字典:payable_fee_type)")
private List<Long> feeTypeList;
@ApiModelProperty(value = "金额")
private java.math.BigDecimal totalAmount;
......@@ -90,20 +93,30 @@ public class PayableQueryVO {
@ApiModelProperty(value = "运输方式id")
private String transportId;
@ApiModelProperty(value = "运输方式id")
private List<String> transportIdList;
@ExcelProperty("始发地ID")
@ApiModelProperty(value = "始发地ID")
private String departureId;
@ApiModelProperty(value = "始发地ID")
private List<String> departureIdList;
@ExcelProperty("目的地ID")
@ApiModelProperty(value = "目的地ID")
private String objectiveId;
@ApiModelProperty(value = "目的地ID")
private List<String> objectiveIdList;
@ApiModelProperty(value = "客户名称")
private String customerName;
/*
时间节点查询类型
*/
@ApiModelProperty(value = "时间节点查询类型")
private int dateType;
@ApiModelProperty(value = "时间节点查询类型")
private List<Integer> dateTypeList;
}
......@@ -24,12 +24,18 @@ public class PaymentQueryVO {
@ApiModelProperty(value = "业务员")
private Long salesmanId;
@ApiModelProperty(value = "业务员")
private List<Long> salesmanIdList;
@ApiModelProperty(value = "业务员名称")
private String salesmanName;
@ApiModelProperty(value = "供应商id")
private Long supplierId;
@ApiModelProperty(value = "供应商id")
private List<Long> supplierIdList;
@ApiModelProperty(value = "供应商名称")
private String supplierName;
......@@ -53,12 +59,18 @@ public class PaymentQueryVO {
@ApiModelProperty(value = "发票状态(0未开票,1已开票)")
private Integer invoiceStatus;
@ApiModelProperty(value = "发票状态(0未开票,1已开票)")
private List<Integer> invoiceStatusList;
@ApiModelProperty(value = "发票号")
private String invoiceNumber;
@ApiModelProperty(value = "付款单状态(1待审核,2已审核待核销,3已核销)")
private Integer state;
@ApiModelProperty(value = "付款单状态(1待审核,2已审核待核销,3已核销)")
private List<Integer> stateList;
@ApiModelProperty(value = "付款单添加人id")
private Long paymentAddId;
......
......@@ -180,4 +180,7 @@ public class ReceiptBackVO {
@ApiModelProperty(value = "实收日期")
private Date payedAt;
@ApiModelProperty(value = "核销误差兑额外费用主币种金额")
private String writeOffDiffMainCurrency;
}
......@@ -27,12 +27,18 @@ public class ReceiptQueryVO {
@ApiModelProperty(value = "业务员")
private Long salesmanId;
@ApiModelProperty(value = "业务员")
private List<Long> salesmanIdList;
@ApiModelProperty(value = "业务员名称")
private String salesmanName;
@ApiModelProperty(value = "客户id")
private Long customerId;
@ApiModelProperty(value = "客户id")
private List<Long> customerIdList;
@ApiModelProperty(value = "客户名称")
private String customerName;
......@@ -121,6 +127,9 @@ public class ReceiptQueryVO {
@ApiModelProperty(value = "状态: 1待核销,2 已核销,3已核销待开票,4已开票")
private Integer state;
@ApiModelProperty(value = "状态: 1待核销,2 已核销,3已核销待开票,4已开票")
private List<Integer> stateList;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "核销时间")
private Date writeOffAt;
......
......@@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
......@@ -51,6 +52,9 @@ public class ReceivableQueryVO {
@ApiModelProperty(value = "费用类型(字典 receivable_fee_type)")
private Integer feeType;
@ApiModelProperty(value = "费用类型(字典 receivable_fee_type)")
private List<Integer> feeTypeList;
@ApiModelProperty(value = "汇率")
private BigDecimal exchangeRate;
......@@ -95,24 +99,39 @@ public class ReceivableQueryVO {
@ApiModelProperty(value = "运输方式id")
private Integer transportId;
@ApiModelProperty(value = "运输方式id")
private List<Integer> transportIdList;
@ApiModelProperty(value = "是否控货")
private Boolean isCargoControl;
@ApiModelProperty(value = "报关类别:我司全代:1,自单代报:2,混合报关:3")
private Integer customsType;
@ApiModelProperty(value = "报关类别:我司全代:1,自单代报:2,混合报关:3")
private List<Integer> customsTypeList;
@ApiModelProperty(value = "始发地id")
private Long departureId;
@ApiModelProperty(value = "始发地id")
private List<Long> departureIdList;
@ApiModelProperty(value = "目的地id")
private Long objectiveId;
@ApiModelProperty(value = "目的地id")
private List<Long> objectiveIdList;
@ApiModelProperty(value = "唛头")
private String marks;
@ApiModelProperty(value = "订单状态详情见字典:order_status")
private Integer status;
@ApiModelProperty(value = "订单状态详情见字典:order_status")
private List<Integer> statusList;
@ApiModelProperty(value = "订单异常状态(字典 order_abnormal_state)")
private Integer abnormalState;
......
......@@ -72,10 +72,10 @@ public class CommissionPayableController {
return success(list);
}
@GetMapping("/page")
@PostMapping("/page")
@ApiOperation("获得订单佣金应付款分页")
// @PreAuthorize("@ss.hasPermission('ecw:commission-payable:query')")
public CommonResult<PageResult<CommissionPayableBackVO>> getCommissionPayablePage(@Valid CommissionPayableQueryVO query, PageVO page) {
public CommonResult<PageResult<CommissionPayableBackVO>> getCommissionPayablePage(@RequestBody @Valid CommissionPayableQueryVO query, PageVO page) {
PageResult<CommissionPayableBackVO> pageResult = commissionPayableService.getCommissionPayablePage(query, page);
return success(pageResult);
}
......
package cn.iocoder.yudao.module.wealth.controller.admin.commissionPayment;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.convert.paymentApproval.PaymentApprovalConvert;
import cn.iocoder.yudao.module.wealth.dal.dataobject.paymentApproval.PaymentApprovalDO;
import cn.iocoder.yudao.module.wealth.service.commissionPayment.CommissionPaymentService;
import cn.iocoder.yudao.module.wealth.service.paymentApproval.PaymentApprovalService;
import cn.iocoder.yudao.module.wealth.vo.commissionPayment.CommissionPaymentBackVO;
import cn.iocoder.yudao.module.wealth.vo.commissionPayment.CommissionPaymentCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.commissionPayment.CommissionPaymentQueryVO;
import cn.iocoder.yudao.module.wealth.vo.commissionPayment.CommissionPaymentUpdateReqVO;
import cn.iocoder.yudao.module.wealth.vo.payment.FinancePaymentCancelVo;
import cn.iocoder.yudao.module.wealth.vo.payment.FinancePaymentVo;
import cn.iocoder.yudao.module.wealth.vo.paymentApproval.PaymentApprovalBackVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.wealth.vo.commissionPayment.*;
import cn.iocoder.yudao.module.wealth.dal.dataobject.commissionPayment.CommissionPaymentDO;
import cn.iocoder.yudao.module.wealth.convert.commissionPayment.CommissionPaymentConvert;
import cn.iocoder.yudao.module.wealth.service.commissionPayment.CommissionPaymentService;
@Validated
@RestController
......@@ -82,10 +80,10 @@ public class CommissionPaymentController {
return success(list);
}
@GetMapping("/page")
@PostMapping("/page")
@ApiOperation("获得佣金付款单分页")
// @PreAuthorize("@ss.hasPermission('ecw:commission-payment:query')")
public CommonResult<PageResult<CommissionPaymentBackVO>> getCommissionPaymentPage(@Valid CommissionPaymentQueryVO query, PageVO page) {
public CommonResult<PageResult<CommissionPaymentBackVO>> getCommissionPaymentPage(@RequestBody @Valid CommissionPaymentQueryVO query, PageVO page) {
PageResult<CommissionPaymentBackVO> pageResult = commissionPaymentService.getCommissionPaymentPage(query, page);
return success(pageResult);
}
......
......@@ -75,10 +75,10 @@ public class PayableController {
return success(PayableConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@PostMapping("/page")
@ApiOperation("应付款分页列表,添加供应商未付款项列表 两个用这一个查询")
//@PreAuthorize("@ss.hasPermission('ecw:payable:query')")
public CommonResult<PageResult<PayableOrderBackVo>> getPayablePage(@Valid PayableQueryVO query, PageVO page) {
public CommonResult<PageResult<PayableOrderBackVo>> getPayablePage(@RequestBody @Valid PayableQueryVO query, PageVO page) {
PageResult<PayableOrderBackVo> result = payableService.getPayablePage(query, page);
return success(result);
}
......
......@@ -124,10 +124,10 @@ public class PaymentController {
}
@GetMapping("/page")
@PostMapping("/page")
@ApiOperation("获得付款单分页")
//@PreAuthorize("@ss.hasPermission('ecw:payment:query')")
public CommonResult<PageResult<PaymentBackVO>> getPaymentPage(@Valid PaymentQueryVO query, PageVO page) {
public CommonResult<PageResult<PaymentBackVO>> getPaymentPage(@RequestBody @Valid PaymentQueryVO query, PageVO page) {
PageResult<PaymentDO> pageResult = paymentService.getPaymentPage(query, page);
return success(PaymentConvert.INSTANCE.convertPage(pageResult));
}
......
......@@ -36,17 +36,17 @@ public class ReceivableController {
private ReceivableDiscountMapper receivableDiscountMapper;
@GetMapping("/page")
@PostMapping("/page")
@ApiOperation("应收款分页列表")
//@PreAuthorize("@ss.hasPermission('ecw:receivable:query')")
public CommonResult<PageResult<ReceivableBackVO>> getReceivablePage(@Valid ReceivableQueryVO query, PageVO page) {
public CommonResult<PageResult<ReceivableBackVO>> getReceivablePage(@RequestBody @Valid ReceivableQueryVO query, PageVO page) {
PageResult<ReceivableBackVO> pageResult = receivableService.receivablePage(query, page);
return success(pageResult);
}
@GetMapping("/page/amount")
@PostMapping("/page/amount")
@ApiOperation("应收款分页条件总金额合计")
public CommonResult<List<WealthMoneyAmountVO>> getReceivablePage(@Valid ReceivableQueryVO query) {
public CommonResult<List<WealthMoneyAmountVO>> getReceivablePage(@RequestBody @Valid ReceivableQueryVO query) {
List<WealthMoneyAmountVO> pageAmount = receivableService.receivablePageAmount(query);
return success(pageAmount);
}
......
......@@ -17,9 +17,21 @@
<if test="query.state != null">
AND cp.state = #{query.state}
</if>
<if test="query.stateList != null and query.stateList.size() > 1">
AND cp.`state` IN
<foreach collection="query.stateList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.invoiceStatus != null">
AND cp.invoice_status = #{query.invoiceStatus}
</if>
<if test="query.invoiceStatusList != null and query.invoiceStatusList.size() > 1">
AND cp.`invoice_status` IN
<foreach collection="query.invoiceStatusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.invoiceNumber != null and query.invoiceNumber != ''">
AND cp.invoice_number LIKE concat('%',#{query.invoiceNumber},'%')
</if>
......@@ -33,7 +45,14 @@
AND cp.customer_name LIKE concat('%',#{query.customerName},'%')
</if>
<if test="query.salesmanId != null">
AND (cp.`salesman_id` = #{query.salesmanId} or cp.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
AND (cp.`salesman_id` = #{query.salesmanId} or cp.`customer_id` in(select cus.id from ecw_customer cus where
cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
</if>
<if test="query.salesmanIdList != null and query.salesmanIdList.size() > 1">
AND cp.`salesman_id` IN
<foreach collection="query.salesmanIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.salesmanName != null and query.salesmanName != ''">
AND cp.salesman_name LIKE concat('%',#{query.salesmanName},'%')
......@@ -47,7 +66,7 @@
<if test="query.paymentNo != null and query.paymentNo !=''">
AND cp.payment_no LIKE concat('%',#{query.paymentNo},'%')
</if>
<if test = "query.beginCreateTime != null and query.endCreateTime != null ">
<if test="query.beginCreateTime != null and query.endCreateTime != null ">
AND cp.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<if test="query.ids != null ">
......
......@@ -116,16 +116,34 @@
<if test="query.customerId != null">
AND er.`customer_id` = #{query.customerId}
</if>
<if test="query.customerIdList != null and query.customerIdList.size() > 1">
AND er.`customer_id` IN
<foreach collection="query.customerIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.customerName != null">
AND er.`customer_name` = #{query.customerName}
</if>
<if test="query.state != null">
AND er.`state` = #{query.state}
</if>
<if test="query.stateList != null and query.stateList.size() > 1">
AND er.`state` IN
<foreach collection="query.stateList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.salesmanId != null">
AND (er.`salesman_id` = #{query.salesmanId} or er.`customer_id` in(select cus.id from ecw_customer cus where
cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
</if>
<if test="query.salesmanIdList != null and query.salesmanIdList.size() > 1">
AND er.`salesman_id` IN
<foreach collection="query.salesmanIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.salesmanName != null">
AND er.`salesman_name` = #{query.salesmanName}
</if>
......
......@@ -589,4 +589,121 @@
#{item}
</foreach>
</select>
<select id="receivablePage" resultType="cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO">
SELECT r.*,
o.marks,
o.`status`,
o.abnormal_state,
o.in_warehouse_state,
o.shipment_state,
o.pick_state,
o.to_warehouse_state,
o.tidan_no,
o.container_number AS container_number,
nor.name AS consignor_name,
nor.phone AS consignor_phone,
nor.customer_id AS consignor_id,
nee.name AS consignee_name,
nee.customer_id AS consignee_id,
nee.phone AS consignee_phone
FROM ecw_receivable r
LEFT JOIN ecw_order o ON o.order_id = r.order_id
LEFT JOIN ecw_warehouse_line de ON o.line_id = de.id
LEFT JOIN ecw_order_consignor nor ON nor.order_id = o.order_id
LEFT JOIN ecw_order_consignee nee ON nee.order_id = o.order_id
WHERE r.deleted = 0
AND r.receipt_id IS NULL
<if test="query.status != null">
AND o.`status` = #{query.status}
</if>
<if test="query.statusList != null and query.statusList.size() > 0">
AND o.`status` IN
<foreach collection="query.statusList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="query.isCargoControl != null">
AND (o.`is_cargo_control` = #{query.isCargoControl}
OR o.`is_cargo_control` = #{query.isCargoControl})
</if>
<if test="query.customsType != null">
AND o.`customs_type` = #{query.customsType}
</if>
<if test="query.customsTypeList != null and query.customsTypeList.size() > 0">
AND o.`customs_type` IN
<foreach collection="query.customsTypeList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="query.transportId != null">
AND o.`transport_id` = #{query.transportId}
</if>
<if test="query.transportIdList != null and query.transportIdList.size() > 0">
AND o.`transport_id` IN
<foreach collection="query.transportIdList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="query.marks != null and query.marks != ''">
AND o.`marks` LIKE CONCAT('%', #{query.marks}, '%')
</if>
<if test="query.departureId != null">
AND de.`start_warehouse_id` = #{query.departureId}
</if>
<if test="query.departureIdList != null and query.departureIdList.size() > 0">
AND de.`start_warehouse_id` IN
<foreach collection="query.departureIdList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="query.objectiveId != null">
AND de.`dest_warehouse_id` = #{query.objectiveId}
</if>
<if test="query.objectiveIdList != null and query.objectiveIdList.size() > 0">
AND de.`dest_warehouse_id` IN
<foreach collection="query.objectiveIdList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="query.title != null and query.title != ''">
AND CONCAT(r.`title_zh`, r.`title_en`) LIKE CONCAT('%', #{query.title}, '%')
</if>
<if test="query.consignorNameOrPhone != null and query.consignorNameOrPhone != ''">
AND CONCAT(nor.`name`, nor.`phone`, nor.`company`) LIKE CONCAT('%', #{query.consignorNameOrPhone}, '%')
</if>
<if test="query.consigneeNameOrPhone != null and query.consigneeNameOrPhone != ''">
AND CONCAT(nee.`name`, nee.`phone`, nee.`company`) LIKE CONCAT('%', #{query.consigneeNameOrPhone}, '%')
</if>
<if test="query.orderNo != null and query.orderNo != ''">
AND r.`order_no` LIKE CONCAT('%', #{query.orderNo}, '%')
</if>
<if test="query.tidanNo != null and query.tidanNo != ''">
AND o.`tidan_no` LIKE CONCAT('%', #{query.tidanNo}, '%')
</if>
<if test="query.receiptNo != null and query.receiptNo != ''">
AND r.`receipt_no` LIKE CONCAT('%', #{query.receiptNo}, '%')
</if>
<if test="query.state != null">
AND r.`state` = #{query.state}
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != null">
AND r.`create_time` BETWEEN #{query.beginCreateTime} AND #{query.endCreateTime}
</if>
<if test="query.feeType != null">
AND r.`fee_type` = #{query.feeType}
</if>
<if test="query.feeTypeList != null and query.feeTypeList.size() > 0">
AND r.`fee_type` IN
<foreach collection="query.feeTypeList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="query.customerId != null">
AND o.`customer_id` = #{query.customerId}
</if>
<if test="query.containerNumber != null">
AND o.`container_number` = #{query.containerNumber}
</if>
GROUP BY r.id
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment