Commit ef02825d by HlQ

[chg] 合同金额计算也根据查询条件来更改

1 parent fd62bb0e
...@@ -97,7 +97,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -97,7 +97,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.in(CollUtil.isNotEmpty(relatedContractIdList), Contract::getId, relatedContractIdList) .in(CollUtil.isNotEmpty(relatedContractIdList), Contract::getId, relatedContractIdList)
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName) .eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName)
.or() .or()
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName) .eq(StrUtil.isNotBlank(saleName), RContractUser::getUsername, saleName)
.orderByDesc(Contract::getEntryTime); .orderByDesc(Contract::getEntryTime);
if (StrUtil.isNotBlank(dto.getOperator()) && ObjUtil.isNotNull(dto.getAmount())) { if (StrUtil.isNotBlank(dto.getOperator()) && ObjUtil.isNotNull(dto.getAmount())) {
String ope = dto.getOperator(); String ope = dto.getOperator();
...@@ -320,6 +320,11 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -320,6 +320,11 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
// 防止特殊情况出现 // 防止特殊情况出现
Assert.notEquals(saleName, "未知", "当前用户角色不详,请联系管理员"); Assert.notEquals(saleName, "未知", "当前用户角色不详,请联系管理员");
List<Long> relatedContractIdList = Opt.ofNullable(dto.getProductLine())
.map(pl -> Db.listObjs(Wrappers.lambdaQuery(Store.class).eq(Store::getProductLine, pl), Store::getId))
.map(storeIds -> contractStoreService.listObjs(Wrappers.<RContractStore>lambdaQuery().select(RContractStore::getContractId).in(RContractStore::getStoreId, storeIds), o -> Long.valueOf(o.toString())))
.orElse(ListUtil.empty());
JSONObject obj = JSONUtil.createObj() JSONObject obj = JSONUtil.createObj()
.set("totalAmount", 0) .set("totalAmount", 0)
.set("paidAmount", 0) .set("paidAmount", 0)
...@@ -331,10 +336,15 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -331,10 +336,15 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
return obj; return obj;
} }
List<Contract> contracts = this.list(Wrappers.lambdaQuery(converter.convert(dto, Contract.class)) MPJLambdaWrapper<Contract> wrapper = new MPJLambdaWrapper<>(converter.convert(dto, Contract.class))
.selectAll(Contract.class)
.leftJoin(RContractUser.class, RContractUser::getContractId, Contract::getId)
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName) .eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName)
.between(ArrayUtil.isAllNotNull(dto.getSignDateStart(), dto.getSignDateEnd()), Contract::getSignDate, dto.getSignDateStart(), dto.getSignDateEnd()) .or()
); .eq(StrUtil.isNotBlank(saleName), RContractUser::getUsername, saleName)
.in(CollUtil.isNotEmpty(relatedContractIdList), Contract::getId, relatedContractIdList)
.between(ArrayUtil.isAllNotNull(dto.getSignDateStart(), dto.getSignDateEnd()), Contract::getSignDate, dto.getSignDateStart(), dto.getSignDateEnd());
List<Contract> contracts = this.selectJoinList(Contract.class, wrapper);
Opt.ofEmptyAble(contracts) Opt.ofEmptyAble(contracts)
.ifPresent(list -> { .ifPresent(list -> {
...@@ -408,7 +418,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -408,7 +418,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
Opt.ofNullable(type2DateMap.get(type)).ifPresent( Opt.ofNullable(type2DateMap.get(type)).ifPresent(
date -> { date -> {
financialAgeVO.setPayableDate(date); financialAgeVO.setPayableDate(date);
long age = DateUtil.between(new Date(), date, DateUnit.DAY, false); long age = DateUtil.between(date, new Date(), DateUnit.DAY, true);
financialAgeVO.setAge(((int) age)); financialAgeVO.setAge(((int) age));
} }
); );
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!