|
@@ -139,19 +139,19 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
|
|
|
for (PriceBO bo1 : cars) {
|
|
|
BigDecimal price = bo1.getP();
|
|
|
- if(price.compareTo(BigDecimal.valueOf(0)) != 0){
|
|
|
+ if (price.compareTo(BigDecimal.valueOf(0)) != 0) {
|
|
|
totalPrice = totalPrice.add(price);
|
|
|
TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
|
|
|
Integer addNum = calcuAddNum(car.getMoney(), price);
|
|
|
totalNum += addNum;
|
|
|
}
|
|
|
}
|
|
|
- if(totalPrice.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
+ if (totalPrice.compareTo(BigDecimal.valueOf(0)) == 0) {
|
|
|
return;
|
|
|
}
|
|
|
parkFee.setNum(totalNum).setTaxMoney(parkFee.getTaxMoney().add(totalPrice));
|
|
|
BigDecimal taxes = totalPrice
|
|
|
- .divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP)
|
|
|
.multiply(parkFee.getTaxRate());
|
|
|
taxes = taxes.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal noTaxMoney = totalPrice.subtract(taxes);
|
|
@@ -165,20 +165,20 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
this.saveOrUpdate(parkFee);
|
|
|
}
|
|
|
|
|
|
- public Integer calcuAddNum(BigDecimal money, BigDecimal p){
|
|
|
+ public Integer calcuAddNum(BigDecimal money, BigDecimal p) {
|
|
|
BigDecimal baseNightPrice = partConfig.getBasePrice().add(partConfig.getExtraPrice());
|
|
|
BigDecimal[] qrOld = money.divideAndRemainder(baseNightPrice);
|
|
|
Integer oldNightNum = qrOld[0].intValue();
|
|
|
- if(qrOld[1].compareTo(BigDecimal.valueOf(0)) > 0){
|
|
|
+ if (qrOld[1].compareTo(BigDecimal.valueOf(0)) > 0) {
|
|
|
oldNightNum++;
|
|
|
}
|
|
|
BigDecimal newMoney = money.add(p);
|
|
|
BigDecimal[] qrNew = newMoney.divideAndRemainder(baseNightPrice);
|
|
|
Integer newNightNum = qrNew[0].intValue();
|
|
|
- if(qrNew[1].compareTo(BigDecimal.valueOf(0)) > 0){
|
|
|
+ if (qrNew[1].compareTo(BigDecimal.valueOf(0)) > 0) {
|
|
|
newNightNum++;
|
|
|
}
|
|
|
- return newNightNum-oldNightNum;
|
|
|
+ return newNightNum - oldNightNum;
|
|
|
}
|
|
|
|
|
|
//@Async
|
|
@@ -191,7 +191,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
for (TbBusinessItem item : items) {
|
|
|
Integer feeType = item.getPayType();
|
|
|
String itemType = item.getItemTypeName();
|
|
|
- if(StrUtil.isNotEmpty(itemType)){
|
|
|
+ if (StrUtil.isNotEmpty(itemType)) {
|
|
|
if (itemType.contains("核酸")) {
|
|
|
feeType = TbFeeStatistics.FeeTypeEnum.NUCLEIC_FEE.getCode();
|
|
|
} else if (itemType.contains("消毒") || itemType.contains("消杀")) {
|
|
@@ -202,7 +202,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
feeType = TbFeeStatistics.FeeTypeEnum.STEVEDORE_FEE.getCode();
|
|
|
} else if (itemType.contains("入场管理")) {
|
|
|
feeType = TbFeeStatistics.FeeTypeEnum.MANAGE_FEE.getCode();
|
|
|
- } else if(StrUtil.equals(itemType, "充电打冷")) {
|
|
|
+ } else if (StrUtil.equals(itemType, "充电打冷")) {
|
|
|
feeType = TbFeeStatistics.FeeTypeEnum.CHARGE_FEE.getCode();
|
|
|
}
|
|
|
}
|
|
@@ -217,7 +217,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
businessFee.setTaxMoney(businessFee.getTaxMoney().add(item.getTotal()));//含税收入
|
|
|
businessFee.setNum(businessFee.getNum() + Integer.valueOf(item.getNum()));
|
|
|
BigDecimal taxes = item.getTotal()
|
|
|
- .divide(BigDecimal.valueOf(1).add(businessFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .divide(BigDecimal.valueOf(1).add(businessFee.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP)
|
|
|
.multiply(businessFee.getTaxRate());
|
|
|
taxes = taxes.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal noTaxMoney = item.getTotal().subtract(taxes);
|
|
@@ -233,28 +233,23 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
/*-----------------分割线------------------*/
|
|
|
//添加此item的收费明细
|
|
|
TbBusiness business = tbBusinessService.getById(item.getBusinessId());
|
|
|
-// TbFeeDetails businessFeeDetail = tbFeeDetailsService.getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
|
|
|
- TbFeeDetails businessFeeDetail = null;
|
|
|
- if (businessFeeDetail == null) {
|
|
|
- businessFeeDetail = new TbFeeDetails();
|
|
|
- businessFeeDetail.setTaxRate(BigDecimal.valueOf(taxRate));
|
|
|
- }
|
|
|
-
|
|
|
+ TbFeeDetails businessFeeDetail = new TbFeeDetails();
|
|
|
+ businessFeeDetail.setTaxRate(BigDecimal.valueOf(taxRate));
|
|
|
BigDecimal taxPrice = item.getTotal()
|
|
|
- .divide(BigDecimal.valueOf(1).add(businessFeeDetail.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .divide(BigDecimal.valueOf(1).add(businessFeeDetail.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP)
|
|
|
.multiply(businessFeeDetail.getTaxRate());
|
|
|
taxPrice = taxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal noTaxPrice = item.getTotal().subtract(taxPrice);
|
|
|
noTaxPrice = noTaxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
String carNo = business.getCardNo();
|
|
|
- if(StrUtil.isEmpty(business.getCardNo())){
|
|
|
+ if (StrUtil.isEmpty(business.getCardNo())) {
|
|
|
carNo = business.getChinaCarNo();
|
|
|
}
|
|
|
TbBusinessCar businessCar;
|
|
|
if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(business.getBusinessType())) {
|
|
|
- businessCar=tbBusinessCarService.getById(business.getBusinessCarId());
|
|
|
- }else {
|
|
|
- businessCar = tbBusinessCarService.findByBusinessIdAndCarNo(item.getBusinessId(), carNo);
|
|
|
+ businessCar = tbBusinessCarService.getById(business.getBusinessCarId());
|
|
|
+ } else {
|
|
|
+ businessCar = tbBusinessCarService.findByBusinessIdAndCarNo(item.getBusinessId(), carNo);
|
|
|
}
|
|
|
businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
|
|
|
.setBusinessItemNo(item.getNo()).setBusinessCarId(businessCar.getId()).setBusinessCarNo(businessCar.getNo())
|
|
@@ -273,13 +268,13 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public TbFeeStatistics updateParkNum(String day){
|
|
|
+ public TbFeeStatistics updateParkNum(String day) {
|
|
|
QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
|
|
|
qw.like("create_time", day);
|
|
|
List<TbFeeDetails> list = tbFeeDetailsService.list(qw);
|
|
|
Integer totalNum = 0;
|
|
|
for (TbFeeDetails feeDetail : list) {
|
|
|
- if(feeDetail.getFeeType() == TbFeeStatistics.FeeTypeEnum.PARK_FEE.getCode()){
|
|
|
+ if (feeDetail.getFeeType() == TbFeeStatistics.FeeTypeEnum.PARK_FEE.getCode()) {
|
|
|
totalNum = totalNum + feeDetail.getNum();
|
|
|
}
|
|
|
}
|
|
@@ -289,37 +284,37 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
return feeStatistics;
|
|
|
}
|
|
|
|
|
|
- public String exportMonthStatistics(SoMap so) throws Exception{
|
|
|
+ public String exportMonthStatistics(SoMap so) throws Exception {
|
|
|
String monthStr = so.getString("exportMonth");
|
|
|
- so.put("month",monthStr);
|
|
|
+ so.put("month", monthStr);
|
|
|
Date month = DateUtil.parse(monthStr, "yyyy-MM");
|
|
|
Month monthEnum = DateUtil.monthEnum(month);
|
|
|
boolean leap = DateUtil.isLeapYear(DateUtil.year(month));
|
|
|
Integer lastDay = monthEnum.getLastDay(leap);
|
|
|
Map<String, ExportMonthDataDTO> dataMap = new TreeMap<>();
|
|
|
- for(int i=1; i<=lastDay ; i++){
|
|
|
+ for (int i = 1; i <= lastDay; i++) {
|
|
|
ExportMonthDataDTO data = new ExportMonthDataDTO();
|
|
|
- String index = i<10 ? "0"+i : ""+i;
|
|
|
+ String index = i < 10 ? "0" + i : "" + i;
|
|
|
String day = monthStr + "-" + index;
|
|
|
data.setIndex(index).setDay(day);
|
|
|
dataMap.put(index, data);
|
|
|
}
|
|
|
List<TbFeeStatistics> list = this.getList(so);
|
|
|
Integer totalIn = 0;
|
|
|
- Integer totalOut= 0;
|
|
|
+ Integer totalOut = 0;
|
|
|
Integer totalAdd = 0;
|
|
|
BigDecimal totalMoney = BigDecimal.valueOf(0);
|
|
|
for (TbFeeStatistics statistics : list) {
|
|
|
String day = statistics.getDay();
|
|
|
String key = StrUtil.sub(day, 8, 10);
|
|
|
ExportMonthDataDTO data = dataMap.get(key);
|
|
|
- if(data.getDayMoney() == null){
|
|
|
+ if (data.getDayMoney() == null) {
|
|
|
data.setDayMoney(BigDecimal.valueOf(0));
|
|
|
}
|
|
|
data.setDayMoney(data.getDayMoney().add(statistics.getTaxMoney()));
|
|
|
totalMoney = totalMoney.add(statistics.getTaxMoney());
|
|
|
}
|
|
|
- List<ExportMonthDataDTO> exportList = new ArrayList<>(dataMap.values()) ;
|
|
|
+ List<ExportMonthDataDTO> exportList = new ArrayList<>(dataMap.values());
|
|
|
for (ExportMonthDataDTO dto : exportList) {
|
|
|
String day = dto.getDay();
|
|
|
List<TbBusinessCar> inCarList = tbBusinessCarService.findInCarByDay(day);
|
|
@@ -327,21 +322,21 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
Integer inNum = inCarList != null ? inCarList.size() : 0;
|
|
|
Integer outNum = outCarList != null ? outCarList.size() : 0;
|
|
|
Integer addNum = inNum - outNum;
|
|
|
- if(inNum != 0){
|
|
|
+ if (inNum != 0) {
|
|
|
dto.setInNum(inNum);
|
|
|
totalIn += inNum;
|
|
|
}
|
|
|
- if(outNum != 0){
|
|
|
+ if (outNum != 0) {
|
|
|
dto.setOutNum(outNum);
|
|
|
totalOut += outNum;
|
|
|
}
|
|
|
- if(addNum != 0){
|
|
|
+ if (addNum != 0) {
|
|
|
dto.setAddNum(addNum);
|
|
|
totalAdd += addNum;
|
|
|
}
|
|
|
}
|
|
|
Map<String, String> head = new HashMap<>();
|
|
|
- Integer exportMonth = Integer.valueOf(StrUtil.sub(monthStr, 5,7));
|
|
|
+ Integer exportMonth = Integer.valueOf(StrUtil.sub(monthStr, 5, 7));
|
|
|
String today = DateUtil.today();
|
|
|
head.put("exportMonth", exportMonth + "");
|
|
|
head.put("exportDay", today);
|
|
@@ -363,7 +358,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
}
|
|
|
|
|
|
ClassPathResource classPathResource = new ClassPathResource("static/month-fee.xlsx");
|
|
|
- InputStream tempInputStream =classPathResource.getInputStream();
|
|
|
+ InputStream tempInputStream = classPathResource.getInputStream();
|
|
|
ExcelWriter excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
|
|
|
.withTemplate(tempInputStream).build();
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|