|
@@ -11,24 +11,40 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.pj.api.wx.bo.PriceBO;
|
|
import com.pj.api.wx.bo.PriceBO;
|
|
|
|
+import com.pj.project.tb_business.TbBusiness;
|
|
|
|
+import com.pj.project.tb_business.TbBusinessService;
|
|
|
|
+import com.pj.project.tb_business_car.TbBusinessCar;
|
|
|
|
+import com.pj.project.tb_business_car.TbBusinessCarService;
|
|
import com.pj.project.tb_business_item.TbBusinessItem;
|
|
import com.pj.project.tb_business_item.TbBusinessItem;
|
|
|
|
+import com.pj.project.tb_fee_details.TbFeeDetails;
|
|
|
|
+import com.pj.project.tb_fee_details.TbFeeDetailsService;
|
|
import com.pj.utils.so.SoMap;
|
|
import com.pj.utils.so.SoMap;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.pj.utils.sg.*;
|
|
import com.pj.utils.sg.*;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Service: tb_fee_statistics -- 收费统计表
|
|
* Service: tb_fee_statistics -- 收费统计表
|
|
* @author lzm
|
|
* @author lzm
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
|
|
+@Transactional
|
|
public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, TbFeeStatistics> implements IService<TbFeeStatistics> {
|
|
public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, TbFeeStatistics> implements IService<TbFeeStatistics> {
|
|
|
|
|
|
/** 底层 Mapper 对象 */
|
|
/** 底层 Mapper 对象 */
|
|
@Autowired
|
|
@Autowired
|
|
TbFeeStatisticsMapper tbFeeStatisticsMapper;
|
|
TbFeeStatisticsMapper tbFeeStatisticsMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ TbBusinessCarService tbBusinessCarService;
|
|
|
|
+ @Resource
|
|
|
|
+ TbBusinessService tbBusinessService;
|
|
|
|
+ @Resource
|
|
|
|
+ TbFeeDetailsService tbFeeDetailsService;
|
|
|
|
|
|
/** 增 */
|
|
/** 增 */
|
|
int add(TbFeeStatistics t){
|
|
int add(TbFeeStatistics t){
|
|
@@ -84,7 +100,8 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
}
|
|
}
|
|
for (PriceBO bo1 : cars) {
|
|
for (PriceBO bo1 : cars) {
|
|
BigDecimal price = bo1.getP();
|
|
BigDecimal price = bo1.getP();
|
|
- if(price.compareTo(new BigDecimal(30)) == 0){
|
|
|
|
|
|
+ TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
|
|
|
|
+ if(car.getMoney().compareTo(new BigDecimal(0)) == 0){
|
|
parkFee.setNum(parkFee.getNum() + 1);
|
|
parkFee.setNum(parkFee.getNum() + 1);
|
|
}
|
|
}
|
|
parkFee.setTaxMoney(parkFee.getTaxMoney().add(price));
|
|
parkFee.setTaxMoney(parkFee.getTaxMoney().add(price));
|
|
@@ -103,8 +120,8 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
String toDay = DateUtil.format(now, "yyyy-MM-dd");
|
|
String toDay = DateUtil.format(now, "yyyy-MM-dd");
|
|
String thisYear = StrUtil.sub(toDay, 0, 4);
|
|
String thisYear = StrUtil.sub(toDay, 0, 4);
|
|
String thisMonth = StrUtil.sub(toDay, 0, 7);
|
|
String thisMonth = StrUtil.sub(toDay, 0, 7);
|
|
- int feeType = -1;
|
|
|
|
for (TbBusinessItem item : items) {
|
|
for (TbBusinessItem item : items) {
|
|
|
|
+ int feeType = -1;
|
|
String itemType = item.getItemTypeName();
|
|
String itemType = item.getItemTypeName();
|
|
if(itemType.contains("核酸")){
|
|
if(itemType.contains("核酸")){
|
|
feeType = TbFeeStatistics.feeType.NUCLEIC_FEE.getCode();
|
|
feeType = TbFeeStatistics.feeType.NUCLEIC_FEE.getCode();
|
|
@@ -130,7 +147,23 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
.setFeeType(feeType).setItemTypeName(itemType)
|
|
.setFeeType(feeType).setItemTypeName(itemType)
|
|
.setPayType(3);
|
|
.setPayType(3);
|
|
this.saveOrUpdate(businessFee);
|
|
this.saveOrUpdate(businessFee);
|
|
|
|
+ /*-----------------分割线------------------*/
|
|
|
|
+ //添加此item的收费明细
|
|
|
|
+ TbBusiness business = tbBusinessService.getById(item.getBusinessId());
|
|
|
|
+ TbFeeDetails businessFeeDetail = tbFeeDetailsService.getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
|
|
|
|
+ if(businessFeeDetail == null){
|
|
|
|
+ businessFeeDetail = new TbFeeDetails();
|
|
|
|
+ }
|
|
|
|
+ businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
|
|
|
|
+ .setCarNo(business.getCardNo())
|
|
|
|
+ .setItemPrice(item.getItemPrice())
|
|
|
|
+ .setFeeType(feeType)
|
|
|
|
+ .setItemTypeId(item.getItemTypeId()).setItemTypeName(item.getItemTypeName())
|
|
|
|
+ .setItemId(item.getItemId()).setItemName(item.getItemName())
|
|
|
|
+ .setPayDay(toDay).setPayType(3).setCreateTime(now);
|
|
|
|
+ tbFeeDetailsService.saveOrUpdate(businessFeeDetail);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|