|
@@ -1,12 +1,22 @@
|
|
|
package com.pj.project.tb_fee_details;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.ExcelWriter;
|
|
|
+import com.alibaba.excel.util.ListUtils;
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
import com.alibaba.excel.write.metadata.fill.FillConfig;
|
|
|
+import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
|
|
+import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -39,6 +49,7 @@ import com.pj.project4sp.role.SpRoleMapper;
|
|
|
import com.pj.project4sp.uploadfile.UploadUtil;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.poi.ss.usermodel.BorderStyle;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
@@ -170,7 +181,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
return list(qw);
|
|
|
}
|
|
|
|
|
|
- public TbFeeDetails findBuCarIdAndCarNoAndFeeTypeAndItemTypeName(String businessCarId, String carNo, Integer feeType, String itemTypeName) {
|
|
|
+ public TbFeeDetails findBuCarIdAndCarNoAndFeeTypeAndItemTypeName(String businessCarId, String carNo, Integer feeType, String itemTypeName){
|
|
|
QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
|
|
|
qw.eq("business_car_id", businessCarId);
|
|
|
qw.eq("car_no", carNo);
|
|
@@ -201,12 +212,12 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
//不是当前日期,当前放行记录的车辆在之前的日期付的钱
|
|
|
BigDecimal notToDayMoney = new BigDecimal(0);
|
|
|
for (TbFeeDetails d : thisCarAllFeeList) {
|
|
|
- if (!StrUtil.equals(payDay, d.getPayDay())) {
|
|
|
+ if(!StrUtil.equals(payDay, d.getPayDay())){
|
|
|
notToDayMoney = notToDayMoney.add(d.getItemPrice());
|
|
|
}
|
|
|
}
|
|
|
//当前日期付的钱 = 改放行记录总的停车费-之前日前的钱
|
|
|
- BigDecimal thisDayMoney = car.getMoney().subtract(notToDayMoney);
|
|
|
+ BigDecimal thisDayMoney = car.getMoney().subtract(notToDayMoney);
|
|
|
|
|
|
//oldFeeList是当前日期的白天停车和夜间停车明细
|
|
|
List<TbFeeDetails> oldFeeList = getByBusinessCarIdAndCarNoAndFeeTypeAndPayDay(car.getId(), car.getCarNo(), TbFeeDetails.fee.PARK_FEE.getCode(), payDay);
|
|
@@ -215,14 +226,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
String transactionIdStr = "";
|
|
|
String outTradeNoStr = "";
|
|
|
for (TbFeeDetails oldFee : oldFeeList) {
|
|
|
- if (!StrUtil.isEmpty(oldFee.getTransactionId())) {
|
|
|
+ if(!StrUtil.isEmpty(oldFee.getTransactionId())){
|
|
|
transactionIdStr = oldFee.getTransactionId();
|
|
|
outTradeNoStr = oldFee.getOutTradeNo();
|
|
|
}
|
|
|
- if (StrUtil.equals(oldFee.getItemTypeName(), "白天停车")) {
|
|
|
+ if(StrUtil.equals(oldFee.getItemTypeName(), "白天停车")){
|
|
|
dayParkFee = oldFee;
|
|
|
}
|
|
|
- if (StrUtil.equals(oldFee.getItemTypeName(), "夜间停车")) {
|
|
|
+ if(StrUtil.equals(oldFee.getItemTypeName(), "夜间停车")){
|
|
|
nightParkFee = oldFee;
|
|
|
}
|
|
|
}
|
|
@@ -231,16 +242,16 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
BigDecimal baseNightPrice = partConfig.getBasePrice().add(partConfig.getExtraPrice());
|
|
|
BigDecimal[] qr = thisDayMoney.divideAndRemainder(baseNightPrice);//商和余数的数组,商为夜间停车次数,余数为白天停车费用。
|
|
|
BigDecimal nightFeeNum = qr[0];
|
|
|
- if (nightFeeNum.compareTo(BigDecimal.valueOf(0)) > 0) {
|
|
|
- nightParkFee.setNum(nightFeeNum.intValue()).setItemTypeName("夜间停车")
|
|
|
- .setUnitPrice(baseNightPrice).setItemPrice(baseNightPrice.multiply(nightFeeNum));
|
|
|
- setFee(nightParkFee, car, transactionIdStr, outTradeNoStr, now);
|
|
|
- saveOrUpdate(nightParkFee);
|
|
|
- if (qr[1].compareTo(BigDecimal.valueOf(0)) == 0 && dayParkFee.getId() != null) {
|
|
|
- delete(Long.valueOf(dayParkFee.getId()));
|
|
|
- }
|
|
|
+ if(nightFeeNum.compareTo(BigDecimal.valueOf(0)) > 0){
|
|
|
+ nightParkFee.setNum(nightFeeNum.intValue()).setItemTypeName("夜间停车")
|
|
|
+ .setUnitPrice(baseNightPrice).setItemPrice(baseNightPrice.multiply(nightFeeNum));
|
|
|
+ setFee(nightParkFee, car, transactionIdStr, outTradeNoStr, now);
|
|
|
+ saveOrUpdate(nightParkFee);
|
|
|
+ if(qr[1].compareTo(BigDecimal.valueOf(0)) == 0 && dayParkFee.getId() != null){
|
|
|
+ delete(Long.valueOf(dayParkFee.getId()));
|
|
|
+ }
|
|
|
}
|
|
|
- if (qr[1].compareTo(BigDecimal.valueOf(0)) > 0) {
|
|
|
+ if(qr[1].compareTo(BigDecimal.valueOf(0)) > 0){
|
|
|
dayParkFee.setNum(1).setItemTypeName("白天停车").setUnitPrice(qr[1]).setItemPrice(qr[1]);
|
|
|
setFee(dayParkFee, car, transactionIdStr, outTradeNoStr, now);
|
|
|
saveOrUpdate(dayParkFee);
|
|
@@ -249,11 +260,11 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void setFee(TbFeeDetails parkFee, TbBusinessCar car, String transactionId, String outTradeNo, Date now) {
|
|
|
+ private void setFee(TbFeeDetails parkFee, TbBusinessCar car, String transactionId, String outTradeNo, Date now){
|
|
|
String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
|
|
|
String toDay = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
parkFee.setTaxRate(partConfig.getTaxRate());
|
|
|
- BigDecimal taxPrice = parkFee.getItemPrice().divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP).multiply(parkFee.getTaxRate());
|
|
|
+ BigDecimal taxPrice = parkFee.getItemPrice().divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP).multiply(parkFee.getTaxRate());
|
|
|
taxPrice = taxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal noTaxPrice = parkFee.getItemPrice().subtract(taxPrice);
|
|
|
noTaxPrice = noTaxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
@@ -265,14 +276,13 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
.setIsSettle(1).setPayMode(1).setPayTime(nowStr)
|
|
|
.setTransactionId(transactionId).setOutTradeNo(outTradeNo)
|
|
|
.setBusinessCarNo(car.getNo());
|
|
|
- if (StrUtil.isNotEmpty(car.getCustomerId())) {
|
|
|
+ if(StrUtil.isNotEmpty(car.getCustomerId())){
|
|
|
TbCostomer costomer = tbCostomerService.getById(car.getCustomerId());
|
|
|
- if (costomer != null) {
|
|
|
+ if(costomer != null){
|
|
|
parkFee.setCustomerName(costomer.getName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
public void chargeBusinessFee(List<TbBusinessItem> items, String transactionId, String outTradeNo, Date now) {
|
|
|
|
|
|
String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
|
|
@@ -346,7 +356,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public String export(SoMap so) throws Exception {
|
|
|
+ /*public String export(SoMap so) throws Exception{
|
|
|
Date now = new Date();
|
|
|
String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm");
|
|
|
String beginTime = so.getString("beginTime");
|
|
@@ -359,7 +369,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
String outPayCarNum = "";
|
|
|
String notOutCarNum = "";
|
|
|
boolean isIn = checkTimeRange(beginTime, endTime, now);
|
|
|
- if (isIn) {
|
|
|
+ if(isIn){
|
|
|
inCarNum = getInCarNum(now) + "";
|
|
|
outPayCarNum = getOutAndPayCarNum(now) + "";
|
|
|
notOutCarNum = getNotOutCarNum(now) + "";
|
|
@@ -373,7 +383,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
BigDecimal allParkFee = new BigDecimal(0);
|
|
|
BigDecimal allDayTaxes = new BigDecimal(0);
|
|
|
BigDecimal allDayNoTaxFee = new BigDecimal(0);
|
|
|
- List<ExportFeeDetailDTO> exportList = new ArrayList<>();
|
|
|
+ List<ExportFeeDetailDTO> exportList = new ArrayList<>();
|
|
|
List<TbFeeDetails> list = this.getList(so);
|
|
|
Integer index = 1;
|
|
|
for (TbFeeDetails feeDetails : list) {
|
|
@@ -393,16 +403,16 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
.setKaiDanPerson(feeDetails.getKaiDanPerson())
|
|
|
.setJiChaPerson(feeDetails.getJiChaPerson())
|
|
|
.setDiaoDuPerson(feeDetails.getDiaoDuPerson());
|
|
|
- if (!StrUtil.isEmpty(feeDetails.getBusinessId())) {
|
|
|
+ if(!StrUtil.isEmpty(feeDetails.getBusinessId())){
|
|
|
detailDTO.setBusinessNo(feeDetails.getBusinessNo());
|
|
|
- } else {
|
|
|
+ }else {
|
|
|
detailDTO.setBusinessNo(feeDetails.getBusinessCarNo());
|
|
|
}
|
|
|
exportList.add(detailDTO);
|
|
|
- if (checkTimeRange(nowStr, nowStr, feeDetails.getCreateTime()) && feeDetails.getFeeType() == TbFeeDetails.fee.PARK_FEE.getCode()) {
|
|
|
+ if(checkTimeRange(nowStr, nowStr, feeDetails.getCreateTime()) && feeDetails.getFeeType()==TbFeeDetails.fee.PARK_FEE.getCode()){
|
|
|
toDayFee = toDayFee.add(feeDetails.getItemPrice());
|
|
|
}
|
|
|
- if (feeDetails.getFeeType() == TbFeeDetails.fee.PARK_FEE.getCode()) {
|
|
|
+ if(feeDetails.getFeeType()==TbFeeDetails.fee.PARK_FEE.getCode()){
|
|
|
allParkFee = allParkFee.add(feeDetails.getItemPrice());
|
|
|
}
|
|
|
allDayFee = allDayFee.add(feeDetails.getItemPrice());
|
|
@@ -429,7 +439,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
|
|
|
ClassPathResource classPathResource = new ClassPathResource("static/day-fee-new.xlsx");
|
|
|
- InputStream tempInputStream = classPathResource.getInputStream();
|
|
|
+ InputStream tempInputStream =classPathResource.getInputStream();
|
|
|
|
|
|
ExcelWriter excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
|
|
|
.withTemplate(tempInputStream).build();
|
|
@@ -439,6 +449,119 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
excelWriter.fill(exportList, fillConfig, writeSheet);
|
|
|
excelWriter.finish();
|
|
|
return prefix + "/feeDetails/" + today + "/收费明细表_" + time + ".xlsx";
|
|
|
+ }*/
|
|
|
+
|
|
|
+ public String export(SoMap so) {
|
|
|
+ Date now = new Date();
|
|
|
+ String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm");
|
|
|
+ String beginTime = so.getString("beginTime");
|
|
|
+ String endTime = so.getString("endTime");
|
|
|
+ String time = beginTime + "至" + endTime;
|
|
|
+ Map<String, String> head = new HashMap<>();
|
|
|
+ head.put("time", time);
|
|
|
+ head.put("exportTime", nowStr);
|
|
|
+
|
|
|
+ BigDecimal allDayFee = new BigDecimal(0);
|
|
|
+ BigDecimal allDayTaxes = new BigDecimal(0);
|
|
|
+ BigDecimal allDayNoTaxFee = new BigDecimal(0);
|
|
|
+ List<ExportFeeDetailDTO> exportList = new ArrayList<>();
|
|
|
+ List<TbFeeDetails> list = this.getList(so);
|
|
|
+ Integer index = 1;
|
|
|
+ for (TbFeeDetails feeDetails : list) {
|
|
|
+ String feeType = TbFeeDetails.fee.getDesc(feeDetails.getFeeType());
|
|
|
+ ExportFeeDetailDTO detailDTO = new ExportFeeDetailDTO();
|
|
|
+ detailDTO.setBusinessNo(feeDetails.getBusinessNo()).setCarNo(feeDetails.getCarNo())
|
|
|
+ .setFeeType(feeType).setItemTypeName(feeDetails.getItemTypeName())
|
|
|
+ .setItemName(feeDetails.getItemName()).setItemPrice(feeDetails.getItemPrice())
|
|
|
+ .setPayType("微信支付").setIndex(index++)
|
|
|
+ .setPayMode("直接收款")
|
|
|
+ .setWeight(feeDetails.getWeight()).setNum(feeDetails.getNum()).setUnitPrice(feeDetails.getUnitPrice())
|
|
|
+ .setSettle("已结算").setTaxRate(feeDetails.getTaxRate().multiply(new BigDecimal(100)))
|
|
|
+ .setTaxPrice(feeDetails.getTaxPrice()).setNoTaxPrice(feeDetails.getNoTaxPrice()).setPayTime(feeDetails.getPayTime())
|
|
|
+ .setPickCustomerName(feeDetails.getPickCustomerName())
|
|
|
+ .setTransactionId(feeDetails.getTransactionId())
|
|
|
+ .setKaiDanPerson(feeDetails.getKaiDanPerson())
|
|
|
+ .setJiChaPerson(feeDetails.getJiChaPerson())
|
|
|
+ .setDiaoDuPerson(feeDetails.getDiaoDuPerson());
|
|
|
+ if(!StrUtil.isEmpty(feeDetails.getBusinessId())){
|
|
|
+ detailDTO.setBusinessNo(feeDetails.getBusinessNo());
|
|
|
+ }else {
|
|
|
+ detailDTO.setBusinessNo(feeDetails.getBusinessCarNo());
|
|
|
+ }
|
|
|
+ exportList.add(detailDTO);
|
|
|
+ allDayFee = allDayFee.add(feeDetails.getItemPrice());
|
|
|
+ allDayTaxes = allDayTaxes.add(feeDetails.getTaxPrice());
|
|
|
+ allDayNoTaxFee = allDayNoTaxFee.add(feeDetails.getNoTaxPrice());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String separator = File.separator;
|
|
|
+ String today = DateUtil.today();
|
|
|
+ String rootPath = UploadUtil.uploadConfig.rootFolder + separator + UploadUtil.uploadConfig.httpPrefix;
|
|
|
+ String prefix = myConfig.getDomain() + UploadUtil.uploadConfig.httpPrefix;
|
|
|
+ String extPath = "feeDetails" + separator + today + separator;
|
|
|
+ String fileName = "收费明细表_" + time + ".xlsx";
|
|
|
+ String savePath = rootPath + separator + extPath;
|
|
|
+ File saveFIle = new File(savePath);
|
|
|
+ if (!saveFIle.exists()) {
|
|
|
+ saveFIle.mkdirs();
|
|
|
+ }
|
|
|
+
|
|
|
+ ClassPathResource classPathResource = new ClassPathResource("static/day-fee-new.xlsx");
|
|
|
+ //InputStream tempInputStream =classPathResource.getInputStream();
|
|
|
+ WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
|
|
+ contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+ contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(
|
|
|
+ contentWriteCellStyle,contentWriteCellStyle);
|
|
|
+ ExcelWriter excelWriter = null;
|
|
|
+ try {
|
|
|
+ excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
|
|
|
+ .registerWriteHandler(horizontalCellStyleStrategy)
|
|
|
+ .withTemplate(classPathResource.getInputStream()).build();
|
|
|
+ WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
|
+ // FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();//换行
|
|
|
+ excelWriter.fill(exportList, writeSheet);
|
|
|
+ excelWriter.fill(head, writeSheet);
|
|
|
+ List<List<String>> totalListList = ListUtils.newArrayList();//动态添加行集合
|
|
|
+ List<String> totalList2 = ListUtils.newArrayList();//倒数第2行
|
|
|
+ List<String> totalList1 = ListUtils.newArrayList();//倒数第1行
|
|
|
+ totalListList.add(totalList2);
|
|
|
+ totalListList.add(totalList1);
|
|
|
+ for (int i=0;i<22;i++){
|
|
|
+ if(i==0){
|
|
|
+ totalList2.add("合计");
|
|
|
+ }else if(i==8){
|
|
|
+ totalList2.add(allDayFee.toString());
|
|
|
+ }else if(i==11){
|
|
|
+ totalList2.add(allDayTaxes.toString());
|
|
|
+ }else if(i==12){
|
|
|
+ totalList2.add(allDayNoTaxFee.toString());
|
|
|
+ }else {
|
|
|
+ totalList2.add(null);
|
|
|
+ }
|
|
|
+ if(i==2){
|
|
|
+ totalList1.add("收费核对员:");
|
|
|
+ }else if(i==10){
|
|
|
+ totalList1.add("收费统计员:");
|
|
|
+ }else if(i==18){
|
|
|
+ totalList1.add("收费员:");
|
|
|
+ }else {
|
|
|
+ totalList1.add(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ excelWriter.write(totalListList, writeSheet);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ if(excelWriter!=null){
|
|
|
+ excelWriter.finish();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return prefix + "/feeDetails/" + today + "/收费明细表_" + time + ".xlsx";
|
|
|
}
|
|
|
|
|
|
private boolean checkTimeRange(String begin, String end, Date now) {
|
|
@@ -461,7 +584,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
return list != null ? list.size() : 0;
|
|
|
}
|
|
|
|
|
|
- private Integer getOutAndPayCarNum(Date now) {
|
|
|
+ private Integer getOutAndPayCarNum(Date now){
|
|
|
Date beginOfDay = DateUtil.beginOfDay(now);
|
|
|
Date endOfDay = DateUtil.endOfDay(now);
|
|
|
QueryWrapper<TbBusinessCar> qw = new QueryWrapper();
|
|
@@ -473,7 +596,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
return list != null ? list.size() : 0;
|
|
|
}
|
|
|
|
|
|
- private Integer getNotOutCarNum(Date now) {
|
|
|
+ private Integer getNotOutCarNum(Date now){
|
|
|
Date beginOfDay = DateUtil.beginOfDay(now);
|
|
|
Date endOfDay = DateUtil.endOfDay(now);
|
|
|
QueryWrapper<TbBusinessCar> qw = new QueryWrapper();
|
|
@@ -486,9 +609,9 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
|
|
|
public List<TbFeeDetails> findByBusinessCarId(String businessCarId, int feeType) {
|
|
|
- QueryWrapper<TbFeeDetails> ew = new QueryWrapper<>();
|
|
|
- ew.eq("business_car_id", businessCarId);
|
|
|
- ew.eq("fee_type", feeType);
|
|
|
+ QueryWrapper<TbFeeDetails>ew=new QueryWrapper<>();
|
|
|
+ ew.eq("business_car_id",businessCarId);
|
|
|
+ ew.eq("fee_type",feeType);
|
|
|
return list(ew);
|
|
|
}
|
|
|
|
|
@@ -522,12 +645,12 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
.setTaxPrice(feeDetails.getTaxPrice()).setNoTaxPrice(feeDetails.getNoTaxPrice()).setPayTime(feeDetails.getPayTime())
|
|
|
.setPickCustomerName(feeDetails.getPickCustomerName())
|
|
|
.setCustomerName(feeDetails.getCustomerName())
|
|
|
- .setKaiDanPerson(feeDetails.getKaiDanPerson() != null ? feeDetails.getKaiDanPerson() : "")
|
|
|
- .setJiChaPerson(feeDetails.getJiChaPerson() != null ? feeDetails.getJiChaPerson() : "")
|
|
|
- .setDiaoDuPerson(feeDetails.getDiaoDuPerson() != null ? feeDetails.getDiaoDuPerson() : "");
|
|
|
- if (!StrUtil.isEmpty(feeDetails.getBusinessId())) {
|
|
|
+ .setKaiDanPerson(feeDetails.getKaiDanPerson()!=null?feeDetails.getKaiDanPerson():"")
|
|
|
+ .setJiChaPerson(feeDetails.getJiChaPerson()!=null?feeDetails.getJiChaPerson():"")
|
|
|
+ .setDiaoDuPerson(feeDetails.getDiaoDuPerson()!=null?feeDetails.getDiaoDuPerson():"");
|
|
|
+ if(!StrUtil.isEmpty(feeDetails.getBusinessId())){
|
|
|
detailDTO.setBusinessNo(feeDetails.getBusinessNo());
|
|
|
- } else {
|
|
|
+ }else {
|
|
|
detailDTO.setBusinessNo(feeDetails.getBusinessCarNo());
|
|
|
}
|
|
|
printList.add(detailDTO);
|
|
@@ -543,20 +666,20 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
|
|
|
public List<FeeTypeStatics> getFeeTypeStatics(String startDay, String endDay) {
|
|
|
- List<FeeTypeStatics> list = tbFeeDetailsMapper.getFeeTypeStatics(startDay, endDay);
|
|
|
- Double totalPrice = list.stream().collect(Collectors.summarizingDouble(FeeTypeStatics::getPrice)).getSum();
|
|
|
- Long total = list.stream().collect(Collectors.summarizingLong(FeeTypeStatics::getTotal)).getSum();
|
|
|
- FeeTypeStatics feeTypeStatics = new FeeTypeStatics();
|
|
|
+ List<FeeTypeStatics> list=tbFeeDetailsMapper.getFeeTypeStatics(startDay,endDay);
|
|
|
+ Double totalPrice= list.stream().collect(Collectors.summarizingDouble(FeeTypeStatics::getPrice)).getSum();
|
|
|
+ Long total= list.stream().collect(Collectors.summarizingLong(FeeTypeStatics::getTotal)).getSum();
|
|
|
+ FeeTypeStatics feeTypeStatics=new FeeTypeStatics();
|
|
|
feeTypeStatics.setName("总计").setPrice(totalPrice).setTotal(total);
|
|
|
list.add(feeTypeStatics);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public List<FeeTypeStatics> itemTypeStatics(String startDay, String endDay) {
|
|
|
- List<FeeTypeStatics> list = tbFeeDetailsMapper.itemTypeStatics(startDay, endDay);
|
|
|
- Double totalPrice = list.stream().collect(Collectors.summarizingDouble(FeeTypeStatics::getPrice)).getSum();
|
|
|
- Long total = list.stream().collect(Collectors.summarizingLong(FeeTypeStatics::getTotal)).getSum();
|
|
|
- FeeTypeStatics feeTypeStatics = new FeeTypeStatics();
|
|
|
+ List<FeeTypeStatics> list=tbFeeDetailsMapper.itemTypeStatics(startDay,endDay);
|
|
|
+ Double totalPrice= list.stream().collect(Collectors.summarizingDouble(FeeTypeStatics::getPrice)).getSum();
|
|
|
+ Long total= list.stream().collect(Collectors.summarizingLong(FeeTypeStatics::getTotal)).getSum();
|
|
|
+ FeeTypeStatics feeTypeStatics=new FeeTypeStatics();
|
|
|
feeTypeStatics.setName("总计").setPrice(totalPrice).setTotal(total);
|
|
|
list.add(feeTypeStatics);
|
|
|
return list;
|
|
@@ -565,14 +688,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
public void jiChaConfirm(List<Long> ids) {
|
|
|
SpAdmin admin = StpUserUtil.getAdmin();
|
|
|
SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
|
|
|
- if (!StrUtil.equals(TbFeeDetails.personEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
|
|
|
+ if(!StrUtil.equals(TbFeeDetails.personEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())){
|
|
|
throw new BusinessException("无操作权限");
|
|
|
}
|
|
|
List<TbFeeDetails> detailsList = this.listByIds(ids);
|
|
|
Set<String> days = new HashSet<>();
|
|
|
for (TbFeeDetails detail : detailsList) {
|
|
|
String name = admin.getName();
|
|
|
- if (StrUtil.isNotEmpty(admin.getNickname())) {
|
|
|
+ if(StrUtil.isNotEmpty(admin.getNickname())){
|
|
|
name = admin.getNickname();
|
|
|
}
|
|
|
detail.setJiChaPerson(name).setUpdateTime(new Date());
|
|
@@ -586,14 +709,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
public void kaiDanConfirm(List<Long> ids) {
|
|
|
SpAdmin admin = StpUserUtil.getAdmin();
|
|
|
SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
|
|
|
- if (!StrUtil.equals(TbFeeDetails.personEnum.KAIDAN.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
|
|
|
+ if(!StrUtil.equals(TbFeeDetails.personEnum.KAIDAN.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())){
|
|
|
throw new BusinessException("无操作权限");
|
|
|
}
|
|
|
List<TbFeeDetails> detailsList = this.listByIds(ids);
|
|
|
Set<String> days = new HashSet<>();
|
|
|
for (TbFeeDetails detail : detailsList) {
|
|
|
String name = admin.getName();
|
|
|
- if (StrUtil.isNotEmpty(admin.getNickname())) {
|
|
|
+ if(StrUtil.isNotEmpty(admin.getNickname())){
|
|
|
name = admin.getNickname();
|
|
|
}
|
|
|
detail.setKaiDanPerson(name).setUpdateTime(new Date());
|
|
@@ -607,14 +730,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
public void diaoDuConfirm(List<Long> ids) {
|
|
|
SpAdmin admin = StpUserUtil.getAdmin();
|
|
|
SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
|
|
|
- if (!StrUtil.equals(TbFeeDetails.personEnum.FUHE.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
|
|
|
+ if(!StrUtil.equals(TbFeeDetails.personEnum.FUHE.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())){
|
|
|
throw new BusinessException("无操作权限");
|
|
|
}
|
|
|
List<TbFeeDetails> detailsList = this.listByIds(ids);
|
|
|
Set<String> days = new HashSet<>();
|
|
|
for (TbFeeDetails detail : detailsList) {
|
|
|
String name = admin.getName();
|
|
|
- if (StrUtil.isNotEmpty(admin.getNickname())) {
|
|
|
+ if(StrUtil.isNotEmpty(admin.getNickname())){
|
|
|
name = admin.getNickname();
|
|
|
}
|
|
|
detail.setDiaoDuPerson(name).setUpdateTime(new Date());
|
|
@@ -627,11 +750,11 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
|
|
|
private void changeStats(Set<String> days, String personType) {
|
|
|
String personColumn = "";
|
|
|
- if (StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())) {
|
|
|
+ if(StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())){
|
|
|
personColumn = "ji_cha_person";
|
|
|
- } else if (StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())) {
|
|
|
+ }else if(StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())){
|
|
|
personColumn = "kai_dan_person";
|
|
|
- } else {
|
|
|
+ }else{
|
|
|
personColumn = "diao_du_person";
|
|
|
}
|
|
|
for (String day : days) {
|
|
@@ -653,20 +776,20 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
}
|
|
|
String personName = StrUtil.join(",", names);
|
|
|
- QueryWrapper<TbFeeStatistics> ew3 = new QueryWrapper<>();
|
|
|
+ QueryWrapper<TbFeeStatistics> ew3= new QueryWrapper<>();
|
|
|
ew3.eq("day_time", day);
|
|
|
List<TbFeeStatistics> statsList = tbFeeStatisticsService.list(ew3);
|
|
|
for (TbFeeStatistics thisDayStats : statsList) {
|
|
|
- if (StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())) {
|
|
|
+ if(StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())){
|
|
|
thisDayStats.setJiChaPerson(personName);
|
|
|
- } else if (StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())) {
|
|
|
+ }else if(StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())){
|
|
|
thisDayStats.setKaiDanPerson(personName);
|
|
|
- } else {
|
|
|
+ }else{
|
|
|
thisDayStats.setDiaoDuPerson(personName);
|
|
|
}
|
|
|
}
|
|
|
tbFeeStatisticsService.updateBatchById(statsList);
|
|
|
- } else {
|
|
|
+ }else{
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
@@ -675,7 +798,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
public void jiChaCancel(List<Long> ids) {
|
|
|
SpAdmin admin = StpUserUtil.getAdmin();
|
|
|
SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
|
|
|
- if (!StrUtil.equals(TbFeeDetails.personEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
|
|
|
+ if(!StrUtil.equals(TbFeeDetails.personEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())){
|
|
|
throw new BusinessException("该操作需要统计稽查员的权限");
|
|
|
}
|
|
|
List<TbFeeDetails> detailsList = this.listByIds(ids);
|
|
@@ -688,10 +811,9 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
this.updateBatchById(detailsList);
|
|
|
changeStats(days);
|
|
|
}
|
|
|
-
|
|
|
private void changeStats(Set<String> days) {
|
|
|
for (String day : days) {
|
|
|
- QueryWrapper<TbFeeStatistics> ew3 = new QueryWrapper<>();
|
|
|
+ QueryWrapper<TbFeeStatistics> ew3= new QueryWrapper<>();
|
|
|
ew3.eq("day_time", day);
|
|
|
List<TbFeeStatistics> statsList = tbFeeStatisticsService.list(ew3);
|
|
|
for (TbFeeStatistics thisDayStats : statsList) {
|
|
@@ -707,9 +829,9 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
|
|
|
public List<TbFeeDetails> findByBusinessNo(String businessNo) {
|
|
|
- QueryWrapper<TbFeeDetails> ew = new QueryWrapper<>();
|
|
|
- ew.eq("business_no", businessNo);
|
|
|
- return list(ew);
|
|
|
+ QueryWrapper<TbFeeDetails>ew=new QueryWrapper<>();
|
|
|
+ ew.eq("business_no",businessNo);
|
|
|
+ return list(ew);
|
|
|
}
|
|
|
|
|
|
public List<TbFeeStatistics> getDayStatistics(String toDay) {
|