|
|
@@ -8,6 +8,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
@@ -19,10 +20,12 @@ 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;
|
|
|
+import com.pj.api.pushfee.task.FeeDetailSyncTask;
|
|
|
import com.pj.api.wx.bo.PriceBO;
|
|
|
import com.pj.current.config.MyConfig;
|
|
|
import com.pj.current.config.PartConfig;
|
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
|
+import com.pj.current.task.TaskService;
|
|
|
import com.pj.project.relation_business_car.RelationBusinessCar;
|
|
|
import com.pj.project.relation_business_car.RelationBusinessCarService;
|
|
|
import com.pj.project.tb_business.TbBusiness;
|
|
|
@@ -93,6 +96,8 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
TbCostomerService tbCostomerService;
|
|
|
@Resource
|
|
|
TbDeductionBindService tbDeductionBindService;
|
|
|
+ @Resource
|
|
|
+ TaskService taskService;
|
|
|
|
|
|
/**
|
|
|
* 增
|
|
|
@@ -131,7 +136,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
|
|
|
public List<TbFeeDetails> getByBusinessItemId(String businessItemId) {
|
|
|
QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(TbFeeDetails::getBusinessItemId,businessItemId);
|
|
|
+ qw.lambda().eq(TbFeeDetails::getBusinessItemId, businessItemId);
|
|
|
return list(qw);
|
|
|
}
|
|
|
|
|
|
@@ -160,6 +165,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
|
|
|
/**
|
|
|
* 查找放行记录所有的收费明细
|
|
|
+ *
|
|
|
* @param businessCarId
|
|
|
* @param carNo
|
|
|
* @param feeType
|
|
|
@@ -182,7 +188,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);
|
|
|
@@ -199,14 +205,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
|
|
|
/**
|
|
|
* 处理停车费收费明细
|
|
|
+ *
|
|
|
* @param cars
|
|
|
* @param transactionId
|
|
|
* @param outTradeNo
|
|
|
* @param now
|
|
|
*/
|
|
|
- public void chargeParkFee(List<PriceBO> cars, String transactionId, String outTradeNo, Date now) {
|
|
|
+ public void chargeParkFee(List<PriceBO> cars, String transactionId, String outTradeNo, Date now,String module) {
|
|
|
log.info("进入计算停车费:{}", JSONUtil.toJsonStr(cars));
|
|
|
-
|
|
|
String payDay = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
for (PriceBO bo1 : cars) {
|
|
|
if (bo1.getP().compareTo(BigDecimal.valueOf(0)) == 0) {
|
|
|
@@ -219,28 +225,30 @@ 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);
|
|
|
TbFeeDetails nightParkFee = new TbFeeDetails();
|
|
|
TbFeeDetails dayParkFee = new TbFeeDetails();
|
|
|
+ dayParkFee.setModule(module);
|
|
|
+ nightParkFee.setModule(module);
|
|
|
String transactionIdStr = "";
|
|
|
String outTradeNoStr = "";
|
|
|
for (TbFeeDetails oldFee : oldFeeList) {
|
|
|
- if(StrUtil.isNotEmpty(oldFee.getTransactionId())){
|
|
|
+ if (StrUtil.isNotEmpty(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;
|
|
|
}
|
|
|
}
|
|
|
@@ -249,29 +257,36 @@ 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);
|
|
|
+ String type = StrUtil.isEmpty(nightParkFee.getId()) ? TbFeeDetails.SyncTypeEnum.INSERT.getCode() : TbFeeDetails.SyncTypeEnum.UPDATE.getCode();
|
|
|
+ saveOrUpdate(nightParkFee);
|
|
|
+ taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, nightParkFee.getId(), type));
|
|
|
+ if (qr[1].compareTo(BigDecimal.valueOf(0)) == 0 && dayParkFee.getId() != null) {
|
|
|
+ delete(Long.valueOf(dayParkFee.getId()));
|
|
|
+ type = TbFeeDetails.SyncTypeEnum.DELETE.getCode();
|
|
|
+ taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, dayParkFee.getId(), type));
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
- 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);
|
|
|
+ String type = StrUtil.isEmpty(dayParkFee.getId()) ? TbFeeDetails.SyncTypeEnum.INSERT.getCode() : TbFeeDetails.SyncTypeEnum.UPDATE.getCode();
|
|
|
saveOrUpdate(dayParkFee);
|
|
|
+ taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, dayParkFee.getId(), type));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
@@ -283,15 +298,24 @@ 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) {
|
|
|
|
|
|
+ /**
|
|
|
+ * 生成明细
|
|
|
+ *
|
|
|
+ * @param items
|
|
|
+ * @param transactionId
|
|
|
+ * @param outTradeNo
|
|
|
+ * @param now
|
|
|
+ * @param module 线上缴费/线下缴费
|
|
|
+ */
|
|
|
+ public void chargeBusinessFee(List<TbBusinessItem> items, String transactionId, String outTradeNo, Date now, String module) {
|
|
|
String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
|
|
|
String toDay = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
for (TbBusinessItem item : items) {
|
|
|
@@ -329,8 +353,8 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
carNo = business.getChinaCarNo();
|
|
|
}
|
|
|
TbGoods businessCfg = tbGoodsService.getById(business.getGoodsId());
|
|
|
- if((TbGoods.LeaveEnum.BUSINESS_MONEY.getCode()==businessCfg.getChinaCarLeave() || TbGoods.LeaveEnum.APART_BUSINESS.getCode()==businessCfg.getChinaCarLeave())
|
|
|
- && TbGoods.LeaveEnum.BUSINESS_MONEY.getCode()!=businessCfg.getVietnamCarLeave() && TbGoods.LeaveEnum.APART_BUSINESS.getCode()!=businessCfg.getVietnamCarLeave()){
|
|
|
+ if ((TbGoods.LeaveEnum.BUSINESS_MONEY.getCode() == businessCfg.getChinaCarLeave() || TbGoods.LeaveEnum.APART_BUSINESS.getCode() == businessCfg.getChinaCarLeave())
|
|
|
+ && TbGoods.LeaveEnum.BUSINESS_MONEY.getCode() != businessCfg.getVietnamCarLeave() && TbGoods.LeaveEnum.APART_BUSINESS.getCode() != businessCfg.getVietnamCarLeave()) {
|
|
|
carNo = business.getChinaCarNo();
|
|
|
}
|
|
|
String businessCarIds = "";
|
|
|
@@ -338,13 +362,13 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
List<RelationBusinessCar> relation = relationBusinessCarService.findByBusinessId(item.getBusinessId());
|
|
|
for (RelationBusinessCar rela : relation) {
|
|
|
TbBusinessCar bt = tbBusinessCarService.getById(rela.getBusinessCarId());
|
|
|
- if(StrUtil.contains(carNo, bt.getCarNo())){
|
|
|
+ if (StrUtil.contains(carNo, bt.getCarNo())) {
|
|
|
businessCarIds += bt.getId() + ",";
|
|
|
businessCarNos += bt.getNo() + ",";
|
|
|
}
|
|
|
}
|
|
|
- businessCarIds = StrUtil.sub(businessCarIds, 0, businessCarIds.length()-1);
|
|
|
- businessCarNos = StrUtil.sub(businessCarNos, 0, businessCarNos.length()-1);
|
|
|
+ businessCarIds = StrUtil.sub(businessCarIds, 0, businessCarIds.length() - 1);
|
|
|
+ businessCarNos = StrUtil.sub(businessCarNos, 0, businessCarNos.length() - 1);
|
|
|
businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
|
|
|
.setBusinessItemNo(item.getNo()).setBusinessCarId(businessCarIds).setBusinessCarNo(businessCarNos)
|
|
|
.setCarNo(carNo)
|
|
|
@@ -358,8 +382,11 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
.setCustomerName(business.getCustomerName())
|
|
|
.setIsSettle(1).setPayMode(1).setPayTime(nowStr).setWeight(business.getNetWeight())
|
|
|
.setTransactionId(transactionId).setOutTradeNo(outTradeNo)
|
|
|
- .setNum(Integer.valueOf(item.getNum()));
|
|
|
- this.saveOrUpdate(businessFeeDetail);
|
|
|
+ .setNum(Integer.valueOf(item.getNum()))
|
|
|
+ .setModule(module);
|
|
|
+ String type = StrUtil.isEmpty(businessFeeDetail.getId()) ? TbFeeDetails.SyncTypeEnum.INSERT.getCode() : TbFeeDetails.SyncTypeEnum.UPDATE.getCode();
|
|
|
+ saveOrUpdate(businessFeeDetail);
|
|
|
+ taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, businessFeeDetail.getId(), type));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -491,9 +518,9 @@ 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);
|
|
|
@@ -523,7 +550,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
|
|
|
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(
|
|
|
- contentWriteCellStyle,contentWriteCellStyle);
|
|
|
+ contentWriteCellStyle, contentWriteCellStyle);
|
|
|
ExcelWriter excelWriter = null;
|
|
|
try {
|
|
|
excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
|
|
|
@@ -538,33 +565,33 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
List<String> totalList1 = ListUtils.newArrayList();//倒数第1行
|
|
|
totalListList.add(totalList2);
|
|
|
totalListList.add(totalList1);
|
|
|
- for (int i=0;i<22;i++){
|
|
|
- if(i==0){
|
|
|
+ for (int i = 0; i < 22; i++) {
|
|
|
+ if (i == 0) {
|
|
|
totalList2.add("合计");
|
|
|
- }else if(i==8){
|
|
|
+ } else if (i == 8) {
|
|
|
totalList2.add(allDayFee.toString());
|
|
|
- }else if(i==11){
|
|
|
+ } else if (i == 11) {
|
|
|
totalList2.add(allDayTaxes.toString());
|
|
|
- }else if(i==12){
|
|
|
+ } else if (i == 12) {
|
|
|
totalList2.add(allDayNoTaxFee.toString());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
totalList2.add(null);
|
|
|
}
|
|
|
- if(i==2){
|
|
|
+ if (i == 2) {
|
|
|
totalList1.add("收费核对员:");
|
|
|
- }else if(i==10){
|
|
|
+ } else if (i == 10) {
|
|
|
totalList1.add("收费统计员:");
|
|
|
- }else if(i==18){
|
|
|
+ } else if (i == 18) {
|
|
|
totalList1.add("收费员:");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
totalList1.add(null);
|
|
|
}
|
|
|
}
|
|
|
excelWriter.write(totalListList, writeSheet);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
- }finally {
|
|
|
- if(excelWriter!=null){
|
|
|
+ } finally {
|
|
|
+ if (excelWriter != null) {
|
|
|
excelWriter.finish();
|
|
|
}
|
|
|
}
|
|
|
@@ -592,7 +619,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();
|
|
|
@@ -604,7 +631,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();
|
|
|
@@ -617,9 +644,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);
|
|
|
}
|
|
|
|
|
|
@@ -653,12 +680,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);
|
|
|
@@ -674,20 +701,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;
|
|
|
@@ -696,14 +723,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());
|
|
|
@@ -717,14 +744,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());
|
|
|
@@ -737,21 +764,21 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
|
|
|
public void diaoDuConfirm(List<Long> ids) {
|
|
|
SpAdmin admin = StpUserUtil.getAdmin();
|
|
|
- AtomicBoolean hasPermission= new AtomicBoolean(false);
|
|
|
- StrUtil.splitTrim(admin.getRoleId(),",").forEach(roleId->{
|
|
|
+ AtomicBoolean hasPermission = new AtomicBoolean(false);
|
|
|
+ StrUtil.splitTrim(admin.getRoleId(), ",").forEach(roleId -> {
|
|
|
SpRole role = spRoleMapper.getById(Long.valueOf(roleId));
|
|
|
- if(StrUtil.equals(TbFeeDetails.personEnum.FUHE.getDesc(), role.getName()) ||StrUtil.equals("admin", role.getType())){
|
|
|
- hasPermission.set(true);
|
|
|
+ if (StrUtil.equals(TbFeeDetails.personEnum.FUHE.getDesc(), role.getName()) || StrUtil.equals("admin", role.getType())) {
|
|
|
+ hasPermission.set(true);
|
|
|
}
|
|
|
});
|
|
|
- if (!hasPermission.get()){
|
|
|
+ if (!hasPermission.get()) {
|
|
|
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());
|
|
|
@@ -764,11 +791,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) {
|
|
|
@@ -778,32 +805,32 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
QueryWrapper<TbFeeDetails> ew2 = new QueryWrapper<>();
|
|
|
ew2.like("create_time", day);
|
|
|
Integer thisDayTotal = tbFeeDetailsMapper.selectCount(ew2);
|
|
|
- if(confirmList.size() == thisDayTotal){
|
|
|
+ if (confirmList.size() == thisDayTotal) {
|
|
|
Set<String> names = new TreeSet<>();
|
|
|
for (TbFeeDetails detail : confirmList) {
|
|
|
- if(StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())){
|
|
|
+ if (StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())) {
|
|
|
names.add(detail.getJiChaPerson());
|
|
|
- }else if(StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())){
|
|
|
+ } else if (StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())) {
|
|
|
names.add(detail.getKaiDanPerson());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
names.add(detail.getDiaoDuPerson());
|
|
|
}
|
|
|
}
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
@@ -812,7 +839,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);
|
|
|
@@ -825,9 +852,10 @@ 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) {
|
|
|
@@ -843,9 +871,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) {
|
|
|
@@ -855,6 +883,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
|
|
|
/**
|
|
|
* 预充值自动缴费-收费明细生成
|
|
|
+ *
|
|
|
* @param items
|
|
|
* @param transactionId
|
|
|
* @param outTradeNo
|
|
|
@@ -938,6 +967,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
|
|
|
/**
|
|
|
* 预充值自动缴费-停车费明细生成
|
|
|
+ *
|
|
|
* @param cars
|
|
|
* @param transactionId
|
|
|
* @param outTradeNo
|
|
|
@@ -1007,6 +1037,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
}
|
|
|
return feeDetails;
|
|
|
}
|
|
|
+
|
|
|
private void setFeeAuto(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");
|