commit
This commit is contained in:
parent
60727a158e
commit
b705316e08
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.web.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CustomerBigDecimalSerialize extends JsonSerializer<BigDecimal> {
|
||||
|
||||
|
||||
@Override
|
||||
public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException {
|
||||
if(Objects.nonNull(value)) {
|
||||
gen.writeNumber(value.stripTrailingZeros().doubleValue());
|
||||
//去除0后缀,如果想统一进行保留精度,也可以采用类似处理
|
||||
}else {//如果为null的话,就写null
|
||||
gen.writeNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
|
@ -89,7 +90,7 @@ public class ConBigScreenController extends BaseController {
|
|||
* 总支出=所有采购合同的合同总金额+他合同付款总金额
|
||||
*/
|
||||
@GetMapping("/expenditureSum")
|
||||
public R<Map<String,Double>> expenditureSum() {
|
||||
public R<Map<String, Double>> expenditureSum() {
|
||||
return R.ok(iConBigScreenService.expenditureSum()) ;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -159,5 +159,5 @@ public class ConSaleMedia extends BaseEntityAdd {
|
|||
* 其他返点金额2
|
||||
*/
|
||||
@FieldNameApi(name ="其他返点金额2")
|
||||
private Double otherReverMoney2;
|
||||
private BigDecimal otherReverMoney2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -202,5 +203,5 @@ public class ConSaleMediaBo extends BaseEntityAdd {
|
|||
*/
|
||||
@CustomBaenAnnotation(value = "其他返点金额2")
|
||||
@Digits(integer = 15,fraction = 4,message = "其他返点金额2最多允许15位整数,4位小数")
|
||||
private Double otherReverMoney2;
|
||||
private BigDecimal otherReverMoney2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,6 +202,11 @@ public class ConPurchaseBoCopy extends BaseEntity {
|
|||
@CustomBaenAnnotation(value = "媒体链条附件")
|
||||
private String mediaLink;
|
||||
|
||||
/**
|
||||
* 检测照片附件
|
||||
*/
|
||||
@CustomBaenAnnotation(value = "检测照片附件")
|
||||
private String detectPicAttr;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.contract.domain.bo.consale;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -47,4 +48,9 @@ public class ConSaleTotalVo {
|
|||
* 其他返点金额汇总
|
||||
*/
|
||||
private Double otherReverMoneySum;
|
||||
|
||||
/**
|
||||
* 其他返点金额汇总2
|
||||
*/
|
||||
private Double otherReverMoneySum2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.annotation.Alias;
|
|||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -88,7 +89,7 @@ public class ConSaleImportDto implements Serializable {
|
|||
private String otherReverPoit2 = "0";
|
||||
|
||||
@Alias("其他返点金额2")
|
||||
private Double otherReverMoney2 = 0.0;
|
||||
private BigDecimal otherReverMoney2 = BigDecimal.ZERO;
|
||||
|
||||
@Alias("开票时间")
|
||||
private String invoiceDate;
|
||||
|
|
|
|||
|
|
@ -229,6 +229,12 @@ public class ConPurchaseVo {
|
|||
@ExcelProperty(value = "检测照片附件")
|
||||
private String detectPicAttr;
|
||||
|
||||
/**
|
||||
* 媒体链条附件地址集合
|
||||
*/
|
||||
@ExcelProperty(value = "媒体链条附件地址集合")
|
||||
private List<LocalStorageVo> detectPicAttrList;
|
||||
|
||||
/**
|
||||
* 媒体链条附件地址集合
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.contract.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
|
|
@ -185,5 +186,5 @@ public class ConSaleMediaVo {
|
|||
* 其他返点金额2
|
||||
*/
|
||||
@ExcelProperty(value = "其他返点金额2")
|
||||
private Double otherReverMoney2;
|
||||
private BigDecimal otherReverMoney2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.ruoyi.contract.domain.bo.ConFirstBo;
|
|||
import com.ruoyi.contract.domain.vo.ConFirstVo;
|
||||
import com.ruoyi.contract.domain.vo.bigscreen.BigScreenTopLeftVo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -61,7 +62,7 @@ public interface IConBigScreenService {
|
|||
*
|
||||
* @return 总金额
|
||||
*/
|
||||
Map<String,Double> expenditureSum();
|
||||
Map<String, Double> expenditureSum();
|
||||
|
||||
/**
|
||||
* 毛利润=总收入-总支出
|
||||
|
|
|
|||
|
|
@ -391,12 +391,13 @@ public class ConBigScreenServiceImpl implements IConBigScreenService {
|
|||
//计算其他合同付款总金额
|
||||
List<ConOtherVo> conOtherVos = conOtherMapper.selectVoList(Wrappers.<ConOther>lambdaQuery().eq(ConOther::getState, 1).eq(ConOther::getMoneyType, 0).between(true, ConOther::getSignTime, beginOfYear, endOfYear));
|
||||
|
||||
double actualArrivalMoneySum = CollUtil.isNotEmpty(conOtherVos) ? conOtherVos.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney()))).mapToDouble(ConOtherVo::getContractMoney).sum() : 0d;
|
||||
|
||||
double v = CollUtil.isNotEmpty(purchaseVos) ? purchaseVos.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney()))).mapToDouble(ConPurchaseVo::getContractMoney).sum() : 0d;
|
||||
BigDecimal actualArrivalMoneySum = CollUtil.isNotEmpty(conOtherVos) ? conOtherVos.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney())))
|
||||
.map(item -> BigDecimal.valueOf(item.getContractMoney())).reduce(BigDecimal.ZERO,BigDecimal :: add) : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal v = CollUtil.isNotEmpty(purchaseVos) ? purchaseVos.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney())))
|
||||
.map(item -> BigDecimal.valueOf(item.getContractMoney())).reduce(BigDecimal.ZERO,BigDecimal :: add) : BigDecimal.ZERO;
|
||||
log.info("本年采购合同总额:{},本年其他合同付款总金额:{}", v, actualArrivalMoneySum);
|
||||
map.put("newExpenditureDate", v + actualArrivalMoneySum);
|
||||
map.put("newExpenditureDate", v.add(actualArrivalMoneySum).doubleValue() );
|
||||
//计算去年的数据
|
||||
Date begin = DateUtil.beginOfYear(DateUtil.offset(new Date(), DateField.YEAR, -1));
|
||||
Date end = DateUtil.endOfYear(DateUtil.offset(new Date(), DateField.YEAR, -1));
|
||||
|
|
@ -404,11 +405,13 @@ public class ConBigScreenServiceImpl implements IConBigScreenService {
|
|||
|
||||
//计算其他合同付款总金额
|
||||
List<ConOtherVo> lastConOtherVos = conOtherMapper.selectVoList(Wrappers.<ConOther>lambdaQuery().eq(ConOther::getState, 1).eq(ConOther::getMoneyType, 0).between(true, ConOther::getSignTime, begin, end));
|
||||
double LastActualArrivalMoneySum = CollUtil.isNotEmpty(lastConOtherVos) ? lastConOtherVos.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney()))).mapToDouble(ConOtherVo::getContractMoney).sum() : 0d;
|
||||
BigDecimal LastActualArrivalMoneySum = CollUtil.isNotEmpty(lastConOtherVos) ? lastConOtherVos.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney())))
|
||||
.map(item -> BigDecimal.valueOf(item.getContractMoney())).reduce(BigDecimal.ZERO,BigDecimal :: add) : BigDecimal.ZERO;
|
||||
|
||||
double lastExpenditureDate = CollUtil.isNotEmpty(voList) ? voList.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney()))).mapToDouble(ConPurchaseVo::getContractMoney).sum() : 0d;
|
||||
BigDecimal lastExpenditureDate = CollUtil.isNotEmpty(voList) ? voList.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney())))
|
||||
.map(item -> BigDecimal.valueOf(item.getContractMoney())).reduce(BigDecimal.ZERO,BigDecimal :: add) : BigDecimal.ZERO;
|
||||
log.info("去年采购合同总额:{},去年其他合同付款总金额:{}", lastExpenditureDate, LastActualArrivalMoneySum);
|
||||
map.put("lastExpenditureDate", lastExpenditureDate + LastActualArrivalMoneySum);
|
||||
map.put("lastExpenditureDate", lastExpenditureDate.add(LastActualArrivalMoneySum).doubleValue());
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -417,8 +420,8 @@ public class ConBigScreenServiceImpl implements IConBigScreenService {
|
|||
HashMap<String, Object> map = new HashMap<>();
|
||||
Map<String, Double> contractSum = contractSum();
|
||||
Map<String, Double> expenditureSum = expenditureSum();
|
||||
map.put("newGrossProfit", new BigDecimal(contractSum.get("contractSum")).subtract(new BigDecimal(expenditureSum.get("newExpenditureDate"))).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
map.put("LastGrossProfit", new BigDecimal(contractSum.get("LastContractSum")).subtract(new BigDecimal(expenditureSum.get("lastExpenditureDate"))).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
map.put("newGrossProfit", BigDecimal.valueOf(contractSum.get("contractSum")).subtract(BigDecimal.valueOf(expenditureSum.get("newExpenditureDate"))).setScale(2, RoundingMode.DOWN));
|
||||
map.put("LastGrossProfit", BigDecimal.valueOf(contractSum.get("LastContractSum")).subtract(BigDecimal.valueOf(expenditureSum.get("lastExpenditureDate"))).setScale(2, RoundingMode.DOWN));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -365,6 +365,9 @@ public class ConPurchaseServiceImpl implements IConPurchaseService {
|
|||
//查询mediaLink
|
||||
List<LocalStorageVo> mediaLinkList = getLocalStorageVoList(conPurchaseVo.getMediaLink());
|
||||
conPurchaseVo.setMediaLinkList(mediaLinkList);
|
||||
//查询检测照片
|
||||
List<LocalStorageVo> detectPicAttrList = getLocalStorageVoList(conPurchaseVo.getDetectPicAttr());
|
||||
conPurchaseVo.setDetectPicAttrList(detectPicAttrList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ import com.ruoyi.contract.domain.ConSaleMedia;
|
|||
import com.ruoyi.contract.mapper.ConSaleMediaMapper;
|
||||
import com.ruoyi.contract.service.IConSaleMediaService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
|
@ -361,7 +363,7 @@ public class ConSaleMediaServiceImpl implements IConSaleMediaService {
|
|||
} else {
|
||||
return new Double(0);
|
||||
}
|
||||
}).reduce(new Double(0), Double::sum);
|
||||
}).reduce((double) 0, Double::sum);
|
||||
//媒体费
|
||||
Double mediaFeeTotal = conSaleMediaList.stream().map(item -> {
|
||||
Double mediaFee = item.getMediaFee();
|
||||
|
|
@ -370,7 +372,7 @@ public class ConSaleMediaServiceImpl implements IConSaleMediaService {
|
|||
} else {
|
||||
return new Double(0);
|
||||
}
|
||||
}).reduce(new Double(0), Double::sum);
|
||||
}).reduce((double) 0, Double::sum);
|
||||
//制作费
|
||||
Double productFeeTotal = conSaleMediaList.stream().map(item -> {
|
||||
Double productFee = item.getProductFee();
|
||||
|
|
@ -379,7 +381,7 @@ public class ConSaleMediaServiceImpl implements IConSaleMediaService {
|
|||
} else {
|
||||
return new Double(0);
|
||||
}
|
||||
}).reduce(new Double(0), Double::sum);
|
||||
}).reduce((double) 0, Double::sum);
|
||||
//比稿返点金额
|
||||
Double competReverMoneySum = conSaleMediaList.stream().map(item -> {
|
||||
Double compeMoney = item.getCompetReverMoney();
|
||||
|
|
@ -388,7 +390,7 @@ public class ConSaleMediaServiceImpl implements IConSaleMediaService {
|
|||
} else {
|
||||
return new Double(0);
|
||||
}
|
||||
}).reduce(new Double(0), Double::sum);
|
||||
}).reduce((double) 0, Double::sum);
|
||||
//其他返点金额汇总
|
||||
Double otherReverMoneySum = conSaleMediaList.stream().map(item -> {
|
||||
Double otherRever= item.getOtherReverMoney();
|
||||
|
|
@ -397,12 +399,19 @@ public class ConSaleMediaServiceImpl implements IConSaleMediaService {
|
|||
} else {
|
||||
return new Double(0);
|
||||
}
|
||||
}).reduce(new Double(0), Double::sum);
|
||||
}).reduce((double) 0, Double::sum);
|
||||
|
||||
//其他返点金额汇总2
|
||||
BigDecimal otherReverMoneySum2 = conSaleMediaList.stream().filter(item -> item.getOtherReverMoney2() != null)
|
||||
.map(value -> new BigDecimal(value.getOtherReverMoney2().toString()).setScale(4, RoundingMode.HALF_UP))
|
||||
.reduce(BigDecimal.ZERO,BigDecimal :: add);
|
||||
|
||||
vo.setCompetReverMoneySum(competReverMoneySum);
|
||||
vo.setOtherReverMoneySum(otherReverMoneySum);
|
||||
vo.setAccountNumberTotal(accountNumberTotal);
|
||||
vo.setMediaFeeTotal(mediaFeeTotal);
|
||||
vo.setProductFeeTotal(productFeeTotal);
|
||||
vo.setOtherReverMoneySum2(otherReverMoneySum2.doubleValue());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -227,7 +228,7 @@ public class ConSaleServiceImpl implements IConSaleService {
|
|||
mediaBo.setOtherReverPoit(StrUtil.isNotBlank(row.getOtherReverPoit()) ? row.getOtherReverPoit() : "0");
|
||||
mediaBo.setOtherReverMoney(ObjectUtil.isNotNull(row.getOtherReverMoney()) ? row.getOtherReverMoney() : 0.0);
|
||||
mediaBo.setOtherReverPoit2(StrUtil.isNotBlank(row.getOtherReverPoit2()) ? row.getOtherReverPoit2() : "0");
|
||||
mediaBo.setOtherReverMoney2(ObjectUtil.isNotNull(row.getOtherReverMoney2()) ? row.getOtherReverMoney2() : 0.0);
|
||||
mediaBo.setOtherReverMoney2(ObjectUtil.isNotNull(row.getOtherReverMoney2()) ? row.getOtherReverMoney2() : BigDecimal.ZERO);
|
||||
|
||||
// 解析日期
|
||||
try {
|
||||
|
|
@ -1726,6 +1727,7 @@ public class ConSaleServiceImpl implements IConSaleService {
|
|||
vo.setMediaFeeTotal(conSaleTotalVo.getMediaFeeTotal());
|
||||
vo.setCompetReverMoneySum(conSaleTotalVo.getCompetReverMoneySum());
|
||||
vo.setOtherReverMoneySum(conSaleTotalVo.getOtherReverMoneySum());
|
||||
vo.setOtherReverMoneySum2(conSaleTotalVo.getOtherReverMoneySum2());
|
||||
vo.setTotal(conSales.size());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user