修改车辆结算金额 计算
This commit is contained in:
parent
29652bcad6
commit
3fd01866be
|
|
@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
|
|
@ -14,6 +15,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|||
@MapperScan({"com.bonus.gzcar.**.dao", "com.bonus.gzcar.**.mapper"})
|
||||
@SpringBootApplication(exclude={MongoAutoConfiguration.class})
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
public class SpringBootSecurityApplication implements CommandLineRunner {
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -60,10 +60,12 @@ public class SupDispatchCarController {
|
|||
@DecryptAndVerify(decryptedClass = CarNeedPlanVo.class)
|
||||
public PageInfo<CarNeedPlanVo> getPlanListBySup(EncryptedReq<CarNeedPlanVo> dto) {
|
||||
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
|
||||
dto.getData().setCreator(userId);
|
||||
dto.getData().setUserId(userId);
|
||||
if(!"1".equals(userId)){
|
||||
dto.getData().setCreator(userId);
|
||||
dto.getData().setUserId(userId);
|
||||
}
|
||||
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
|
||||
List<CarNeedPlanVo> list = service.getPlanListBySup(dto.getData());;
|
||||
List<CarNeedPlanVo> list = service.getPlanListBySup(dto.getData());
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.bonus.gzcar.business.backstage.entity;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @className:HomeDataPreviewVo
|
||||
* @author:cwchen
|
||||
|
|
@ -33,12 +36,12 @@ public class HomeDataPreviewVo {
|
|||
private int noDispatchCraneNum;
|
||||
|
||||
/**已付款金额*/
|
||||
private double payMoney;
|
||||
private BigDecimal payMoney;
|
||||
/**已付款金额-需求计划*/
|
||||
private int payPlanNum;
|
||||
|
||||
/**预估金额*/
|
||||
private double estimateMoney;
|
||||
private BigDecimal estimateMoney;
|
||||
/**已付款金额-需求计划*/
|
||||
private int estimatePlanNum;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.gzcar.business.backstage.entity;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @className:HomeLeaseMoneyVo
|
||||
* @author:cwchen
|
||||
|
|
@ -13,9 +15,9 @@ import lombok.Data;
|
|||
public class HomeLeaseMoneyVo {
|
||||
|
||||
/**合同金额*/
|
||||
private double contractMoney;
|
||||
private BigDecimal contractMoney;
|
||||
/**付款金额*/
|
||||
private double payMoney;
|
||||
private BigDecimal payMoney;
|
||||
/**付款金额/合同金额 比率*/
|
||||
private double progress;
|
||||
private BigDecimal progress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.gzcar.business.backstage.entity;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @className:HomeProPlanDataViewVo
|
||||
* @author:cwchen
|
||||
|
|
@ -26,7 +28,7 @@ public class HomeProPlanDataViewVo {
|
|||
/**吊车数量*/
|
||||
private int craneNum;
|
||||
/**金额*/
|
||||
private double money;
|
||||
private BigDecimal money;
|
||||
/**进度*/
|
||||
private double progress;
|
||||
private String progress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.gzcar.business.backstage.entity;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @className:HomeSupStatisticsVo
|
||||
* @author:cwchen
|
||||
|
|
@ -23,13 +25,13 @@ public class HomeSupStatisticsVo {
|
|||
/**供应商合同占比*/
|
||||
private double contractRatio;
|
||||
/**供应商合同金额*/
|
||||
private double contractMoney;
|
||||
private BigDecimal contractMoney;
|
||||
/**已租赁数量*/
|
||||
private int leaseNum;
|
||||
/**已租赁金额*/
|
||||
private double leaseMoney;
|
||||
private BigDecimal leaseMoney;
|
||||
/**租赁进度*/
|
||||
private double leaseProgress;
|
||||
private BigDecimal leaseProgress;
|
||||
/**最新派车时间*/
|
||||
private String dispatchTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.gzcar.business.backstage.entity;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
|
|
@ -12,5 +14,5 @@ public class IndexVo {
|
|||
*/
|
||||
private String num;
|
||||
|
||||
private String money;
|
||||
private BigDecimal money;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createErroe(e.getMessage());
|
||||
|
||||
}
|
||||
return ServerResponse.createErroe("新增失败");
|
||||
|
|
@ -180,16 +181,17 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
@Override
|
||||
public ServerResponse<String> sltAudit(CarSltApplyVo data) {
|
||||
try{
|
||||
// 查询数据节点 ==>需要添加谁来审核数据
|
||||
CarSltApplyVo vo=mapper.getCarSltApplyVo(data);
|
||||
data.setAuditType(vo.getAuditType());
|
||||
String msg=getUserAudit(data);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
return ServerResponse.createErroe(msg);
|
||||
}
|
||||
// 查询数据节点 ==>需要添加谁来审核数据
|
||||
CarSltApplyVo vo=mapper.getCarSltApplyVo(data);
|
||||
String userId = Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
|
||||
String nextStatus=getNextStatus(vo.getAuditType(),data.getAuditStatus());
|
||||
String nextType=getNextType(vo.getAuditType(),data.getAuditStatus());
|
||||
CarSltAuditVo carSltAuditVo = new CarSltAuditVo(data.getId(),nextType, DateTimeHelper.getNowTime(),userId,nextStatus,data.getAuditReason(),"发起结算申请");
|
||||
CarSltAuditVo carSltAuditVo = new CarSltAuditVo(data.getId(),data.getAuditType(), DateTimeHelper.getNowTime(),userId,data.getAuditStatus(),data.getAuditReason(),"发起结算申请");
|
||||
mapper.insertCarSltAudit(carSltAuditVo);
|
||||
data.setAuditStatus(nextStatus);
|
||||
data.setAuditType(nextType);
|
||||
|
|
@ -229,7 +231,7 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
return msg;
|
||||
}
|
||||
}else{
|
||||
if("阮斌".equals(userName)){
|
||||
if("阮斌".equals(userName) || "娄强".equals(userName)){
|
||||
return null;
|
||||
}else{
|
||||
return msg;
|
||||
|
|
@ -379,6 +381,7 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
} catch (Exception e) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe(e.getMessage());
|
||||
}
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
}
|
||||
|
|
@ -438,7 +441,6 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
* 重新计算金额
|
||||
*/
|
||||
public void sltMoney(CarSltApplyVo data,boolean isUpdate){
|
||||
try{
|
||||
Map<String,Integer> planCarMap= Maps.newHashMap();
|
||||
List<CarSltPlanVo> planList=data.getPlanList();
|
||||
Map<String, List<CarSltApplyDetailsVo>> outList = new HashMap<>();
|
||||
|
|
@ -485,10 +487,7 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
}
|
||||
// 实际金额
|
||||
data.setExeMoney(allMoney.toString());
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(), e);
|
||||
throw new RuntimeException("金额计算失败", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -565,7 +564,6 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
if (planType == 1) {
|
||||
//实际公里数
|
||||
String gls = vo.getExeGls();
|
||||
try {
|
||||
String tonType;
|
||||
// 1. 先获取值并做 null 防护,避免 NPE
|
||||
BigDecimal tonValue = Optional.ofNullable(vo.getTon())
|
||||
|
|
@ -583,6 +581,9 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
gls, vo.getTon(), tonType, vo.getContractId(), vo.getSupId());
|
||||
//获取单公里价格
|
||||
PriceVo priceVo = getMoney(vo.getContractId(), null, vo.getSupId(), gls, tonType);
|
||||
if(priceVo==null){
|
||||
throw new RuntimeException("公里数不在范围内");
|
||||
}
|
||||
sb.append("依据:").append(priceVo.getGlsStart()).append("-").append(priceVo.getGlsEnd());
|
||||
sb.append("公里:").append(priceVo.getPrice()).append("元");
|
||||
vo.setRemark(sb.toString());
|
||||
|
|
@ -596,10 +597,7 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
allMoney = allMoney.add(glsMoney);
|
||||
vo.setCost(glsMoney.toString());
|
||||
vo.setGlsMoney(glsMoney);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
throw new RuntimeException("金额计算失败", e);
|
||||
}
|
||||
|
||||
} else {
|
||||
//实际天数
|
||||
int day = vo.getExeDay();
|
||||
|
|
@ -610,13 +608,16 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
}
|
||||
BigDecimal inMoney = new BigDecimal(inMoneyData);
|
||||
int isOutSet =1;
|
||||
try {
|
||||
|
||||
log.info("吊车派车计算 - 计划天数:{}, 是否收取进出场费:{}, 合同ID:{}, 车型ID:{}, 供应商ID:{}",
|
||||
day, isOutSet, vo.getContractId(), vo.getModelId(), vo.getSupId());
|
||||
BigDecimal days = new BigDecimal(day);
|
||||
BigDecimal dcMoney = new BigDecimal("0");
|
||||
BigDecimal month = new BigDecimal("30");
|
||||
PriceVo priceVo = getMoney(vo.getContractId(), vo.getModelId(), vo.getSupId(), null, null);
|
||||
if(priceVo==null){
|
||||
throw new RuntimeException("公里数不在范围内");
|
||||
}
|
||||
sb.append("依据:").append(priceVo.getName()).append("-").append(priceVo.getModel());
|
||||
vo.setPriceId(priceVo.getId());
|
||||
vo.setGlsPrice(toBigDecimal(priceVo.getPrice()));
|
||||
|
|
@ -681,26 +682,22 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
}
|
||||
vo.setDayPrice(priceVo.getDayPrice());
|
||||
vo.setMonthPrice(priceVo.getMonthPrice());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
throw new RuntimeException("金额计算失败", e);
|
||||
}
|
||||
vo.setRemark(sb.toString());
|
||||
}
|
||||
BigDecimal yuMoney = new BigDecimal(vo.getMoney());
|
||||
yuMoney = yuMoney.setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||
vo.setMoney(yuMoney.toString());
|
||||
if(isUpdate){
|
||||
vo.setMoney("");
|
||||
}
|
||||
// if(isUpdate){
|
||||
// vo.setMoney("");
|
||||
// }
|
||||
mapper.updatePlanOutDetails(vo);
|
||||
}
|
||||
allMoney = allMoney.setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||
outVo.setMoney(allMoney.toString());
|
||||
//修改的话就不去修改预估金额了
|
||||
if(isUpdate){
|
||||
outVo.setYgMoney("");
|
||||
}
|
||||
// if(isUpdate){
|
||||
// outVo.setYgMoney("");
|
||||
// }
|
||||
Integer carNum=planCarMap.get(outVo.getPlanId());
|
||||
if(carNum==null){
|
||||
carNum=list.size();
|
||||
|
|
@ -828,9 +825,8 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
* @param gls
|
||||
* @return
|
||||
*/
|
||||
private PriceVo getMoney(String contractId, String modelId, String supId, String gls, String ton) throws Exception {
|
||||
private PriceVo getMoney(String contractId, String modelId, String supId, String gls, String ton) {
|
||||
List<PriceVo> list = supDispatchCarMapper.getContractPriceList(contractId, modelId, supId, ton);
|
||||
|
||||
if(ListHelpUtil.isEmpty(list)){
|
||||
list = supDispatchCarMapper.getContractPriceList(contractId, modelId, supId, null);
|
||||
}
|
||||
|
|
@ -838,17 +834,29 @@ public class CarBalanceServiceImpl implements CarBalanceService {
|
|||
if (StringHelper.isEmpty(modelId)) {
|
||||
BigDecimal nowGls = new BigDecimal(gls);
|
||||
for (PriceVo priceVo : list) {
|
||||
BigDecimal glsEnd = new BigDecimal(priceVo.getGlsEnd());
|
||||
BigDecimal glsStart = new BigDecimal(priceVo.getGlsStart());
|
||||
if (nowGls.compareTo(glsEnd) <= 0 && nowGls.compareTo(glsStart) >= 0) {
|
||||
return priceVo;
|
||||
if(isNumberByRegex(priceVo.getGlsEnd()) && isNumberByRegex(priceVo.getGlsStart())){
|
||||
BigDecimal glsEnd = new BigDecimal(priceVo.getGlsEnd());
|
||||
BigDecimal glsStart = new BigDecimal(priceVo.getGlsStart());
|
||||
if (nowGls.compareTo(glsEnd) <= 0 && nowGls.compareTo(glsStart) >= 0) {
|
||||
return priceVo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
throw new Exception();
|
||||
return null;
|
||||
} else {
|
||||
return list.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNumberByRegex(String str) {
|
||||
// 先判空/空白串,避免正则匹配空值报错
|
||||
if (str == null || str.trim().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
// 正则表达式:匹配正负整数、合法小数(小数点后必须有数字)
|
||||
String regex = "^[-+]?[0-9]+(\\.[0-9]+)?$";
|
||||
return str.trim().matches(regex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.bonus.gzcar.manager.common.util.StringHelper;
|
|||
import com.bonus.gzcar.manager.common.util.UserUtil;
|
||||
import com.bonus.gzcar.manager.security.entity.SelfUserEntity;
|
||||
import com.bonus.gzcar.manager.webResult.ServerResponse;
|
||||
import com.bonus.gzcar.manager.webResult.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -181,12 +182,25 @@ public class CarNeedPlanServiceImpl implements CarNeedPlanService {
|
|||
vo.setFileList(fileList);
|
||||
}
|
||||
List<AuditRecordVo> recordList = recordService.getRecordList(data.getId());
|
||||
List<AuditRecordVo> record = recordService.getRecordList("out-" + vo.getOutId());
|
||||
if (record != null && !record.isEmpty()) {
|
||||
List<AuditRecordVo> supRecordList = recordService.getSupRecordList(data.getId());
|
||||
record.addAll(supRecordList);
|
||||
recordList.addAll(record);
|
||||
String outIds=vo.getOutId();
|
||||
List<AuditRecordVo> recordList2=new ArrayList<>();
|
||||
//获取派车审核记录
|
||||
if(StringUtils.isNotEmpty(outIds)){
|
||||
List<String> outIdList=Arrays.asList(outIds.split(","));
|
||||
for(String outId:outIdList){
|
||||
List<AuditRecordVo> record = recordService.getRecordList("out-" + outId);
|
||||
if (record != null && !record.isEmpty()) {
|
||||
recordList2.addAll(record);
|
||||
}
|
||||
}
|
||||
if(!recordList2.isEmpty()){
|
||||
List<AuditRecordVo> supRecordList = recordService.getSupRecordList(data.getId());
|
||||
recordList2.addAll(supRecordList);
|
||||
recordList.addAll(recordList2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vo.setRecordList(recordList);
|
||||
}
|
||||
return ServerResponse.createSuccess("查询成功", vo);
|
||||
|
|
|
|||
|
|
@ -146,11 +146,11 @@ public class DispatchCarServiceImpl implements DispatchCarService {
|
|||
public List<CarNeedPlanVo> getNeedPlanList(CarNeedPlanVo data) {
|
||||
try {
|
||||
List<CarNeedPlanVo> list= mapper.getNeedPlanList(data);
|
||||
//数据纠正
|
||||
for (CarNeedPlanVo listVo : list) {
|
||||
String outNum=mapper.getOutCarNum(listVo.getId());
|
||||
mapper.updateCarNum(outNum,listVo.getId());
|
||||
}
|
||||
// //数据纠正
|
||||
// for (CarNeedPlanVo listVo : list) {
|
||||
// String outNum=mapper.getOutCarNum(listVo.getId());
|
||||
// mapper.updateCarNum(outNum,listVo.getId());
|
||||
// }
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
|
|||
|
|
@ -102,23 +102,23 @@ public class HomeIndexServiceImpl implements HomeIndexService {
|
|||
log.info("数据概览-已付款金额{}", Thread.currentThread().getName());
|
||||
List<Object> dataList = new ArrayList<>(2);
|
||||
IndexVo indexVo = mapper.getPayMoney(dto);
|
||||
if(StringHelper.isEmpty(indexVo.getMoney())){
|
||||
indexVo.setMoney("0");
|
||||
if(StringHelper.isEmpty(indexVo.getMoney().toString())){
|
||||
indexVo.setMoney(new BigDecimal(0));
|
||||
indexVo.setNum("0");
|
||||
}
|
||||
dataList.add(0, Double.parseDouble(indexVo.getMoney()));
|
||||
dataList.add(0,indexVo.getMoney());
|
||||
dataList.add(1, Integer.parseInt(indexVo.getNum()));
|
||||
return dataList;
|
||||
});
|
||||
Future<List<Object>> future6 = testTaskExecutor.submit(() -> {
|
||||
log.info("数据概览-应付款金额{}", Thread.currentThread().getName());
|
||||
IndexVo indexVo = mapper.getNoPayMoney(dto);
|
||||
if(StringHelper.isEmpty(indexVo.getMoney())){
|
||||
indexVo.setMoney("0");
|
||||
if(StringHelper.isEmpty(indexVo.getMoney().toString())){
|
||||
indexVo.setMoney(new BigDecimal(0));
|
||||
indexVo.setNum("0");
|
||||
}
|
||||
List<Object> dataList = new ArrayList<>(2);
|
||||
dataList.add(0, Double.parseDouble(indexVo.getMoney()));
|
||||
dataList.add(0,indexVo.getMoney());
|
||||
dataList.add(1, Integer.parseInt(indexVo.getNum()));
|
||||
return dataList;
|
||||
});
|
||||
|
|
@ -132,9 +132,9 @@ public class HomeIndexServiceImpl implements HomeIndexService {
|
|||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
BigDecimal bd = new BigDecimal(vo.getEstimateMoney());
|
||||
BigDecimal bd =vo.getEstimateMoney();
|
||||
bd = bd.setScale(2, RoundingMode.HALF_UP); // 四舍五入
|
||||
vo.setEstimateMoney(bd.doubleValue());
|
||||
vo.setEstimateMoney(bd);
|
||||
return ServerResponse.createSuccess(vo);
|
||||
}
|
||||
|
||||
|
|
@ -163,9 +163,9 @@ public class HomeIndexServiceImpl implements HomeIndexService {
|
|||
vo.setNoDispatchCarNum(fList3.get(1));
|
||||
vo.setCraneNum(fList4.get(0));
|
||||
vo.setNoDispatchCraneNum(fList4.get(1));
|
||||
vo.setPayMoney((Double) fList5.get(0));
|
||||
vo.setPayMoney((BigDecimal) fList5.get(0));
|
||||
vo.setPayPlanNum((Integer) fList5.get(1));
|
||||
vo.setEstimateMoney((Double) fList6.get(0));
|
||||
vo.setEstimateMoney((BigDecimal) fList6.get(0));
|
||||
vo.setEstimatePlanNum((Integer) fList6.get(1));
|
||||
return vo;
|
||||
}
|
||||
|
|
@ -267,9 +267,9 @@ public class HomeIndexServiceImpl implements HomeIndexService {
|
|||
vo.setLeaseMoney(de.getLeaseMoney());
|
||||
vo.setDispatchTime(de.getDispatchTime());
|
||||
}else{
|
||||
vo.setLeaseProgress(0);
|
||||
vo.setLeaseProgress(new BigDecimal(0));
|
||||
vo.setLeaseNum(0);
|
||||
vo.setLeaseMoney(0);
|
||||
vo.setLeaseMoney(new BigDecimal(0));
|
||||
}
|
||||
vo.setDispatchTime(vo.getDispatchTime() == null ? "--" : vo.getDispatchTime());
|
||||
dataList.add(vo);
|
||||
|
|
@ -293,17 +293,17 @@ public class HomeIndexServiceImpl implements HomeIndexService {
|
|||
// 合同金额
|
||||
List<String> list = mapper.getLeaseMoney(dto, 1);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
double v = handleMoney(list);
|
||||
BigDecimal v = handleMoney(list);
|
||||
vo.setContractMoney(v);
|
||||
}
|
||||
dto.setType("1");
|
||||
IndexVo indexVo = mapper.getPayMoneyByCarType(dto);
|
||||
if(indexVo!=null) {
|
||||
vo.setPayMoney(Double.parseDouble(indexVo.getMoney()));
|
||||
vo.setPayMoney(indexVo.getMoney());
|
||||
}else {
|
||||
vo.setPayMoney(0.0);
|
||||
vo.setPayMoney(new BigDecimal(0));
|
||||
}
|
||||
double progress = handleProgress(vo.getContractMoney(), vo.getPayMoney());
|
||||
BigDecimal progress = handleProgress(vo.getContractMoney(), vo.getPayMoney());
|
||||
vo.setProgress(progress);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
@ -318,18 +318,18 @@ public class HomeIndexServiceImpl implements HomeIndexService {
|
|||
// 合同金额
|
||||
List<String> list = mapper.getLeaseMoney(dto, 2);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
double v = handleMoney(list);
|
||||
BigDecimal v = handleMoney(list);
|
||||
vo.setContractMoney(v);
|
||||
}
|
||||
dto.setType("2");
|
||||
IndexVo indexVo = mapper.getPayMoneyByCarType(dto);
|
||||
if(indexVo!=null) {
|
||||
vo.setPayMoney(Double.parseDouble(indexVo.getMoney()));
|
||||
vo.setPayMoney(indexVo.getMoney());
|
||||
}else {
|
||||
vo.setPayMoney(0.0);
|
||||
vo.setPayMoney(new BigDecimal(0));
|
||||
}
|
||||
|
||||
double progress = handleProgress(vo.getContractMoney(), vo.getPayMoney());
|
||||
BigDecimal progress = handleProgress(vo.getContractMoney(), vo.getPayMoney());
|
||||
vo.setProgress(progress);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
@ -337,27 +337,23 @@ public class HomeIndexServiceImpl implements HomeIndexService {
|
|||
return ServerResponse.createSuccess(vo);
|
||||
}
|
||||
|
||||
public double handleMoney(List<String> list) {
|
||||
public BigDecimal handleMoney(List<String> list) {
|
||||
BigDecimal initBd = new BigDecimal("0");
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (String money : list) {
|
||||
initBd = initBd.add(new BigDecimal(money));
|
||||
}
|
||||
}
|
||||
return initBd.doubleValue();
|
||||
return initBd;
|
||||
}
|
||||
|
||||
public double handleProgress(double value, double value2) {
|
||||
if (value > 0) {
|
||||
// value 合同金额 value2 付款金额
|
||||
BigDecimal a = BigDecimal.valueOf(value);
|
||||
BigDecimal b = BigDecimal.valueOf(value2);
|
||||
public BigDecimal handleProgress(BigDecimal a, BigDecimal b) {
|
||||
if (a == null || b == null) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
// 设置保留两位小数,并进行四舍五入
|
||||
BigDecimal result = b.divide(a, 4, RoundingMode.HALF_UP);
|
||||
return result.multiply(new BigDecimal("100")).doubleValue();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return result.multiply(new BigDecimal("100"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -422,8 +418,8 @@ public class HomeIndexServiceImpl implements HomeIndexService {
|
|||
vo.setPlanNum(list.size());
|
||||
vo.setCarNum(carNum);
|
||||
vo.setCraneNum(craneNum);
|
||||
double progress = handleProgress(dispatchNum, needNum);
|
||||
vo.setProgress(progress);
|
||||
BigDecimal progress = handleProgress(new BigDecimal(dispatchNum), new BigDecimal(needNum));
|
||||
vo.setProgress(progress.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.afterturn.easypoi.cache.manager.IFileLoader;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.gzcar.business.backstage.entity.*;
|
||||
import com.bonus.gzcar.business.backstage.mapper.DispatchCarMapper;
|
||||
import com.bonus.gzcar.business.backstage.mapper.SupDispatchCarMapper;
|
||||
import com.bonus.gzcar.business.system.entity.AuditRecordVo;
|
||||
import com.bonus.gzcar.business.system.entity.FileUploadVo;
|
||||
|
|
@ -47,11 +48,20 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService {
|
|||
@Autowired
|
||||
private FileUploadService uploadService;
|
||||
|
||||
@Autowired
|
||||
private DispatchCarMapper dispatchCarMapper;
|
||||
|
||||
@Override
|
||||
public List<CarNeedPlanVo> getPlanListBySup(CarNeedPlanVo data) {
|
||||
try {
|
||||
|
||||
return mapper.getPlanListBySup(data);
|
||||
//TODO
|
||||
List<CarNeedPlanVo> list= mapper.getPlanListBySup(data);
|
||||
//数据纠正
|
||||
// for (CarNeedPlanVo listVo : list) {
|
||||
// String outNum=dispatchCarMapper.getOutCarNum(listVo.getId());
|
||||
// dispatchCarMapper.updateCarNum(outNum,listVo.getId());
|
||||
// }
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.gzcar.business.config;
|
||||
|
||||
import com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo;
|
||||
import com.bonus.gzcar.business.backstage.mapper.DispatchCarMapper;
|
||||
import com.bonus.gzcar.business.backstage.mapper.SupDispatchCarMapper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据矫正
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DataConfigScheduleConfig {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SupDispatchCarMapper mapper;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private DispatchCarMapper dispatchCarMapper;
|
||||
|
||||
/**
|
||||
* 更新 派车数量
|
||||
*/
|
||||
@Scheduled(cron = "0 0 */2 * * ?")
|
||||
public void updateCarNum(){
|
||||
try{
|
||||
List<CarNeedPlanVo> list= mapper.getPlanListBySup(new CarNeedPlanVo());
|
||||
System.out.println(list.size());
|
||||
//数据纠正
|
||||
int num=0;
|
||||
for (CarNeedPlanVo listVo : list) {
|
||||
num++;
|
||||
System.out.println(num);
|
||||
String outNum=dispatchCarMapper.getOutCarNum(listVo.getId());
|
||||
dispatchCarMapper.updateCarNum(outNum,listVo.getId());
|
||||
}
|
||||
}catch(Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -92,10 +92,10 @@
|
|||
<select id="getSupPageList" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceVo">
|
||||
select
|
||||
cpo.id,cpo.apply_id applyId ,cpo.sup_id supId,count(1) num ,cs.name supName ,
|
||||
IFNULL(CAST(slt.money AS DECIMAL(18,2)), 0) payMoney,
|
||||
CAST(SUM(CAST(cpo.money AS DECIMAL(18,2))) AS DECIMAL(18,2)) - IFNULL(CAST(slt.money AS DECIMAL(18,2)), 0) noPayMoney,
|
||||
IFNULL(CAST(slt.money AS DECIMAL(18,3)), 0) payMoney,
|
||||
CAST(SUM(CAST(cpo.money AS DECIMAL(18,3))) AS DECIMAL(18,3)) - IFNULL(CAST(slt.money AS DECIMAL(18,3)), 0) noPayMoney,
|
||||
plan.planNum,pro.proNum,
|
||||
CAST(SUM(CAST(cpo.money AS DECIMAL(18,2))) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(CAST(cpo.money AS DECIMAL(18,3))) AS DECIMAL(18,3)) money,
|
||||
sum(cpo.dispatch_num) carNum,
|
||||
if(CURRENT_DATE() BETWEEN cc.start_time and cc.end_time,'已生效', if(CURRENT_DATE() < cc.start_time,'未生效','已失效')) status
|
||||
from
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
<select id="getPayCarPlanList" resultType="com.bonus.gzcar.business.backstage.entity.CarBalancePlanVo">
|
||||
select cpa.id,cpa.`code`,cpa.pro_id proId,pro.`name` proName ,cpa.dispatch_num dispatchNum,
|
||||
cpa.need_num needNum ,cpa.type ,cs.`name` supName ,
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) money,
|
||||
cpa.remark,
|
||||
cpa.dispatch_day lastDay,cpa.user_name userName
|
||||
FROM car_plan_apply cpa
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@
|
|||
<select id="getNeedPlanDetails" resultType="com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo">
|
||||
select cpa.id,
|
||||
cpa.code,
|
||||
cpo.id AS outId,
|
||||
GROUP_CONCAT(cpo.id ) outId,
|
||||
cpa.type,
|
||||
cpa.pro_id proId,
|
||||
cpa.project_part projectPart,
|
||||
|
|
@ -171,7 +171,7 @@
|
|||
<select id="getCarNeedPlanDetailsList"
|
||||
resultType="com.bonus.gzcar.business.backstage.entity.CarNeedPlanDetailVo">
|
||||
select cpd.id, cpd.apply_id planId ,cpd.model_id modelId,cpd.need_day needDay,
|
||||
remark,plan_type planType,cmti.type,cmti.name,cmti.model ,cmti.unit,
|
||||
remark,plan_type planType,cmti.type,cmti.name,cmti.model ,cmti.unit,cpd.need_num needNum,
|
||||
cpd.back_date as backDate
|
||||
from car_plan_details cpd
|
||||
LEFT JOIN car_ma_type_info cmti on cpd.model_id=cmti.id
|
||||
|
|
|
|||
|
|
@ -11,21 +11,21 @@
|
|||
cpo.apply_id planId,
|
||||
SUM(cpo.dispatch_num) carNum,
|
||||
-- 金额转DECIMAL保证精度,处理NULL值
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) payMoney,
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) money,
|
||||
CAST(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) payMoney,
|
||||
IF(csp.id IS NULL,'未付','已付') status,
|
||||
pro.name proName,
|
||||
IFNULL(cs.name, '-') supName,
|
||||
cpo.type,
|
||||
-- 基于DECIMAL做减法,避免精度丢失
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)) - SUM(IFNULL(CAST(csp.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) noPayMoney,
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)) - SUM(IFNULL(CAST(csp.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) noPayMoney,
|
||||
cpo.manager,
|
||||
cpo.create_time jbTime,
|
||||
csa.create_time fkTime
|
||||
FROM car_plan_out cpo
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,2))) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,3))) AS DECIMAL(18,3)) money,
|
||||
csd.out_id id,
|
||||
csd.slt_id
|
||||
FROM car_slt_details csd
|
||||
|
|
@ -93,9 +93,9 @@
|
|||
IFNULL(info.carnum, 0) carNum,
|
||||
IFNULL(info.needNum, 0) needNum,
|
||||
-- 金额字段转DECIMAL并处理NULL
|
||||
IFNULL(CAST(info.payMoney AS DECIMAL(18,2)), 0) payMoney,
|
||||
IFNULL(CAST(info.money AS DECIMAL(18,2)), 0) money,
|
||||
IFNULL(CAST(info.noPayMoney AS DECIMAL(18,2)), 0) noPayMoney,
|
||||
IFNULL(CAST(info.payMoney AS DECIMAL(18,3)), 0) payMoney,
|
||||
IFNULL(CAST(info.money AS DECIMAL(18,3)), 0) money,
|
||||
IFNULL(CAST(info.noPayMoney AS DECIMAL(18,3)), 0) noPayMoney,
|
||||
-- 数量差值保留原始类型,金额单独处理精度
|
||||
IFNULL(info.dpcNum,0) dpcNum
|
||||
FROM bm_project pro
|
||||
|
|
@ -108,16 +108,16 @@
|
|||
SUM(cpa.need_num) needNum,
|
||||
SUM(IF(cpa.need_num < cpa.dispatch_num,0,cpa.need_num-cpa.dispatch_num)) dpcNum,
|
||||
-- 子查询内先转DECIMAL再SUM,处理NULL为0
|
||||
CAST(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) payMoney,
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) payMoney,
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) money,
|
||||
-- 减法运算基于DECIMAL类型,避免精度丢失
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)) - SUM(IFNULL(CAST(csp.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) noPayMoney
|
||||
CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)) - SUM(IFNULL(CAST(csp.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) noPayMoney
|
||||
FROM car_plan_apply cpa
|
||||
LEFT JOIN car_plan_apply_sup cpas ON cpas.apply_id = cpa.id
|
||||
LEFT JOIN (
|
||||
-- 内层子查询同样处理金额精度
|
||||
SELECT
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,2))) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,3))) AS DECIMAL(18,3)) money,
|
||||
cpo.apply_id
|
||||
FROM car_plan_out cpo
|
||||
WHERE cpo.status = 2
|
||||
|
|
@ -152,13 +152,13 @@
|
|||
SUM(cpa.dispatch_num) carNum,
|
||||
cpa.pro_id proId,
|
||||
SUM(IF(cpa.need_num < cpa.dispatch_num,0,cpa.need_num-cpa.dispatch_num)) dpcNum,
|
||||
IFNULL(CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)), 0) money,
|
||||
IFNULL(CAST(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)), 0) payMoney,
|
||||
CAST(IFNULL(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)), 0) - IFNULL(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,2)), 0)), 0) AS DECIMAL(18,2)) noPayMoney
|
||||
IFNULL(CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)), 0) money,
|
||||
IFNULL(CAST(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)), 0) payMoney,
|
||||
CAST(IFNULL(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)), 0) - IFNULL(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,3)), 0)), 0) AS DECIMAL(18,3)) noPayMoney
|
||||
FROM car_plan_apply cpa
|
||||
LEFT JOIN(
|
||||
SELECT
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,2))) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,3))) AS DECIMAL(18,3)) money,
|
||||
apply_id
|
||||
FROM car_plan_out cpo
|
||||
WHERE cpo.status=2
|
||||
|
|
@ -166,7 +166,7 @@
|
|||
) cpo on cpo.apply_id=cpa.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,2))) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,3))) AS DECIMAL(18,3)) money,
|
||||
csd.plan_id id,
|
||||
csd.slt_id
|
||||
FROM car_slt_details csd
|
||||
|
|
@ -192,22 +192,22 @@
|
|||
cpa.id planId,
|
||||
IFNULL(SUM(cpo.dispatch_num), 0) carNum,
|
||||
-- 金额字段转DECIMAL并处理NULL,保证精度
|
||||
IFNULL(CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)), 0) money,
|
||||
CAST(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) payMoney,
|
||||
IFNULL(CAST(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)), 0) money,
|
||||
CAST(SUM(IFNULL(CAST(csp.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) payMoney,
|
||||
IF(cpa.apply_type=0,'需求计划审批','紧急及内部用车') typeName,
|
||||
IF(csp.id IS NULL,'未付','已付') status,
|
||||
pro.name proName,
|
||||
IFNULL(cs.name,'-') supName,
|
||||
cpa.type,
|
||||
-- 基于DECIMAL类型做减法,避免精度丢失
|
||||
CAST(IFNULL(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,2)), 0)), 0) - SUM(IFNULL(CAST(csp.money AS DECIMAL(18,2)), 0)) AS DECIMAL(18,2)) noPayMoney,
|
||||
CAST(IFNULL(SUM(IFNULL(CAST(cpo.money AS DECIMAL(18,3)), 0)), 0) - SUM(IFNULL(CAST(csp.money AS DECIMAL(18,3)), 0)) AS DECIMAL(18,3)) noPayMoney,
|
||||
cpa.need_num needNum,
|
||||
cpa.need_num - IFNULL(SUM(cpo.dispatch_num), 0) dpcNum
|
||||
FROM car_plan_apply cpa
|
||||
LEFT JOIN car_plan_out cpo ON cpo.apply_id = cpa.id AND cpo.status = 2
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,2))) AS DECIMAL(18,2)) money,
|
||||
CAST(SUM(CAST(money AS DECIMAL(18,3))) AS DECIMAL(18,3)) money,
|
||||
csd.out_id id,
|
||||
csd.slt_id
|
||||
FROM car_slt_details csd
|
||||
|
|
|
|||
|
|
@ -216,20 +216,22 @@
|
|||
cpa.type AS typeName,
|
||||
bp.bmname AS companyName,
|
||||
IFNULL( cpo.dispatch_num,0) AS dispatchNum,
|
||||
IFNULL(cpo.money,0) AS money,
|
||||
IFNULL(SUM(CAST(IF(cpo.money = '' OR cpo.money IS NULL, 0, cpo.money) AS DECIMAL(18,3))), 0.00) AS money,
|
||||
CASE WHEN IFNULL( cpo.dispatch_num,0) = 0 THEN '1'
|
||||
WHEN IFNULL( cpo.dispatch_num,0) > 0 THEN '2'
|
||||
END AS dispatchStatus,
|
||||
cs.name AS supName,
|
||||
cpa.code,
|
||||
if(csp.id is null,'待付款','已付款') payStatus
|
||||
if(csp.audit_status=0, '已付款','待付款') payStatus,
|
||||
FROM car_plan_apply cpa
|
||||
LEFT JOIN car_slt_plan csp on csp.plan_id=cpa.id
|
||||
LEFT JOIN bm_project bp ON cpa.pro_id = bp.id
|
||||
LEFT JOIN car_plan_apply_sup cpas ON cpa.id = cpas.apply_id
|
||||
LEFT JOIN car_supplier cs ON cpas.sup_id = cs.id
|
||||
left join(
|
||||
SELECT sum(dispatch_num) dispatch_num,sum(money) money,cpo.apply_id
|
||||
SELECT sum(dispatch_num) dispatch_num,
|
||||
IFNULL(SUM(CAST(IF(cpo.money = '' OR cpo.money IS NULL, 0, cpo.money) AS DECIMAL(18,3))), 0.00) AS money,
|
||||
cpo.apply_id
|
||||
FROM car_plan_out cpo
|
||||
where cpo.status = '1'
|
||||
GROUP BY cpo.apply_id
|
||||
|
|
@ -262,7 +264,7 @@
|
|||
END = #{dispatchStatus})
|
||||
</if>
|
||||
<if test="payStatus!='0' and payStatus!='' and payStatus!=null">
|
||||
AND (IF(csp.id is null,'2','1') = #{payStatus})
|
||||
AND (IF(csp.audit_status=0,'1','2') = #{payStatus})
|
||||
</if>
|
||||
AND cpa.`status` = '2' AND cpa.status_type = '1'
|
||||
</where>
|
||||
|
|
@ -304,7 +306,7 @@
|
|||
cpod.es_cost money, cpod.car_out_id carOutId,cmti.model,cmti.type,cmti.name,cpod.car_num carNum,csi.ton,
|
||||
day_or_m isDayOrMonth,cpod.remark,cpd.need_day needDay,
|
||||
cpa.code planCode,cpa.pro_id proId,
|
||||
if(csp.id is null,'待付款','已付款') payStatus,
|
||||
if(csp.audit_status=0, '已付款','待付款') payStatus,
|
||||
cpa.id AS planId,
|
||||
cpa.type AS typeName
|
||||
from car_plan_out_details cpod
|
||||
|
|
@ -317,7 +319,7 @@
|
|||
left join car_plan_apply_sup cpas on cpd.apply_id=cpas.apply_id
|
||||
LEFT JOIN car_supplier cs on cs.id=cpas.sup_id
|
||||
LEFT JOIN car_slt_plan csp on csp.plan_id=cpa.id
|
||||
where cpo.`status`=1
|
||||
where cpo.`status`=2
|
||||
<if test="yearMonth!=null and yearMonth!=''">
|
||||
AND DATE_FORMAT(cpo.out_time,'%Y-%m') = #{yearMonth}
|
||||
</if>
|
||||
|
|
@ -346,14 +348,16 @@
|
|||
and pro.`name` like concat('%',#{proName},'%')
|
||||
</if>
|
||||
<if test="payStatus!='0' and payStatus!='' and payStatus!=null">
|
||||
AND (IF(csp.id is null,'2','1') = #{payStatus})
|
||||
AND (IF(csp.audit_status=0,'1','2') = #{payStatus})
|
||||
</if>
|
||||
</select>
|
||||
<select id="getPayMoney" resultType="com.bonus.gzcar.business.backstage.entity.IndexVo">
|
||||
SELECT count(csp.plan_id) num,sum(csp.money) money
|
||||
SELECT count(csp.plan_id) num,
|
||||
IFNULL(SUM(CAST(IF(csp.money = '' OR csp.money IS NULL, 0, csp.money) AS DECIMAL(18,3))), 0) AS money
|
||||
from car_slt_plan csp
|
||||
left join car_slt_apply sla on csp.slt_id=sla.id
|
||||
<where>
|
||||
csp.audit_status=0
|
||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
|
||||
AND DATE_FORMAT(sla.create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
|
|
@ -362,10 +366,12 @@
|
|||
<select id="getNoPayMoney" resultType="com.bonus.gzcar.business.backstage.entity.IndexVo">
|
||||
SELECT sum(a.money) money ,sum(a.num) num
|
||||
from (
|
||||
SELECT sum(cpo.money) money ,0 num
|
||||
SELECT
|
||||
CAST(IF(cpo.money = '' OR cpo.money IS NULL, 0, cpo.money) AS DECIMAL(18,3)) AS money,
|
||||
0 num
|
||||
from car_plan_out cpo
|
||||
left join car_slt_details csd on csd.out_id=cpo.id
|
||||
where csd.id is null AND cpo.status=1
|
||||
where (csd.id is null or csd.audit_status!=0) AND cpo.status=1
|
||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
|
||||
AND DATE_FORMAT(cpo.create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
|
|
@ -373,7 +379,7 @@
|
|||
SELECT 0,count(DISTINCT cpo.apply_id) num
|
||||
from car_plan_out cpo
|
||||
left join car_slt_details csp on cpo.id=csp.out_id
|
||||
where csp.id is null AND cpo.status=1
|
||||
where (csp.id is null or csp.audit_status!=0) AND cpo.status=1
|
||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
|
||||
AND DATE_FORMAT(cpo.create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
|
|
@ -384,7 +390,7 @@
|
|||
from car_slt_plan csp
|
||||
left join car_slt_apply sla on csp.slt_id=sla.id
|
||||
<where>
|
||||
csp.type=#{type}
|
||||
csp.type=#{type} and csp.audit_status=0
|
||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
|
||||
AND DATE_FORMAT(sla.create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
|
|
@ -393,7 +399,8 @@
|
|||
</select>
|
||||
<select id="getMoneyBySupContract"
|
||||
resultType="com.bonus.gzcar.business.backstage.entity.HomeSupStatisticsVo">
|
||||
select DATE_FORMAT(max(cpo.create_time),'%Y-%m-%d') dispatchTime ,SUM(dispatch_num) leaseNum ,sum(money) leaseMoney
|
||||
select DATE_FORMAT(max(cpo.create_time),'%Y-%m-%d') dispatchTime ,SUM(dispatch_num) leaseNum ,
|
||||
IFNULL(SUM(CAST(IF(cpo.money = '' OR cpo.money IS NULL, 0, cpo.money) AS DECIMAL(18,3))), 0.00) AS leaseMoney
|
||||
from car_plan_apply_sup cpas
|
||||
left join car_plan_out cpo on cpas.apply_id=cpo.apply_id
|
||||
where cpo.`status`=1 and cpas.contract_id=#{id} and cpas.sup_id=#{supId}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<!--查询用户-->
|
||||
<select id="selectUserByName" resultType="com.bonus.gzcar.manager.core.entity.SysUserEntity">
|
||||
SELECT t.ID AS userId,
|
||||
t.NAME,
|
||||
t.NAME nickName,
|
||||
t.SALT salt,
|
||||
t.LOGIN_NAME username,
|
||||
t.ORG_ID orgId,
|
||||
|
|
@ -17,5 +17,6 @@
|
|||
LEFT JOIN pm_role pr on pr.ID = pur.ROLE_ID and pr.IS_ACTIVE = 1
|
||||
WHERE t.LOGIN_NAME = #{username}
|
||||
AND t.IS_ACTIVE = 1
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue