|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.pj.api.wx.bo.PriceBO;
|
|
|
+import com.pj.current.config.PartConfig;
|
|
|
import com.pj.project.tb_business.TbBusiness;
|
|
|
import com.pj.project.tb_business.TbBusinessService;
|
|
|
import com.pj.project.tb_business_car.TbBusinessCar;
|
|
@@ -30,44 +31,59 @@ import javax.annotation.Resource;
|
|
|
|
|
|
/**
|
|
|
* Service: tb_fee_statistics -- 收费统计表
|
|
|
- * @author lzm
|
|
|
+ *
|
|
|
+ * @author lzm
|
|
|
*/
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, TbFeeStatistics> implements IService<TbFeeStatistics> {
|
|
|
|
|
|
- /** 底层 Mapper 对象 */
|
|
|
- @Autowired
|
|
|
- TbFeeStatisticsMapper tbFeeStatisticsMapper;
|
|
|
- @Resource
|
|
|
+ /**
|
|
|
+ * 底层 Mapper 对象
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ TbFeeStatisticsMapper tbFeeStatisticsMapper;
|
|
|
+ @Resource
|
|
|
TbBusinessCarService tbBusinessCarService;
|
|
|
- @Resource
|
|
|
+ @Resource
|
|
|
TbBusinessService tbBusinessService;
|
|
|
@Resource
|
|
|
TbFeeDetailsService tbFeeDetailsService;
|
|
|
+ @Resource
|
|
|
+ private PartConfig partConfig;
|
|
|
|
|
|
- /** 增 */
|
|
|
- int add(TbFeeStatistics t){
|
|
|
- return tbFeeStatisticsMapper.add(t);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 增
|
|
|
+ */
|
|
|
+ int add(TbFeeStatistics t) {
|
|
|
+ return tbFeeStatisticsMapper.add(t);
|
|
|
+ }
|
|
|
|
|
|
- /** 删 */
|
|
|
- int delete(Long id){
|
|
|
- return tbFeeStatisticsMapper.delete(id);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 删
|
|
|
+ */
|
|
|
+ int delete(Long id) {
|
|
|
+ return tbFeeStatisticsMapper.delete(id);
|
|
|
+ }
|
|
|
|
|
|
- /** 改 */
|
|
|
- int update(TbFeeStatistics t){
|
|
|
- return tbFeeStatisticsMapper.update(t);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 改
|
|
|
+ */
|
|
|
+ int update(TbFeeStatistics t) {
|
|
|
+ return tbFeeStatisticsMapper.update(t);
|
|
|
+ }
|
|
|
|
|
|
- /** 查 */
|
|
|
- TbFeeStatistics getById(Long id){
|
|
|
- return tbFeeStatisticsMapper.getById(id);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 查
|
|
|
+ */
|
|
|
+ TbFeeStatistics getById(Long id) {
|
|
|
+ return tbFeeStatisticsMapper.getById(id);
|
|
|
+ }
|
|
|
|
|
|
- /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
|
|
|
- List<TbFeeStatistics> getList(SoMap so) {
|
|
|
+ /**
|
|
|
+ * 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
|
+ */
|
|
|
+ List<TbFeeStatistics> getList(SoMap so) {
|
|
|
return tbFeeStatisticsMapper.getList(so);
|
|
|
}
|
|
|
|
|
@@ -79,7 +95,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
return tbFeeStatisticsMapper.getYear(so);
|
|
|
}
|
|
|
|
|
|
- public TbFeeStatistics getByDayAndFeeType(String day, Integer feeType){
|
|
|
+ public TbFeeStatistics getByDayAndFeeType(String day, Integer feeType) {
|
|
|
// TbFeeStatistics Fee = tbFeeStatisticsMapper.getByDayAndFeeType(Day, feeType);
|
|
|
QueryWrapper<TbFeeStatistics> qw = new QueryWrapper<>();
|
|
|
qw.eq("day", day);
|
|
@@ -88,20 +104,20 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
}
|
|
|
|
|
|
@Async
|
|
|
- public void countParkFee(List<PriceBO> cars){
|
|
|
+ public void countParkFee(List<PriceBO> cars) {
|
|
|
Date now = new Date();
|
|
|
String toDay = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
String thisYear = StrUtil.sub(toDay, 0, 4);
|
|
|
String thisMonth = StrUtil.sub(toDay, 0, 7);
|
|
|
TbFeeStatistics parkFee = this.getByDayAndFeeType(toDay, TbFeeStatistics.feeType.PARK_FEE.getCode());
|
|
|
- if(parkFee == null){
|
|
|
+ if (parkFee == null) {
|
|
|
parkFee = new TbFeeStatistics();
|
|
|
- parkFee.setTaxRate(new BigDecimal(0.09));
|
|
|
+ parkFee.setTaxRate(partConfig.getTaxRate());
|
|
|
}
|
|
|
for (PriceBO bo1 : cars) {
|
|
|
BigDecimal price = bo1.getP();
|
|
|
TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
|
|
|
- if(car.getMoney().compareTo(new BigDecimal(0)) == 0){
|
|
|
+ if (car.getMoney().compareTo(new BigDecimal(0)) == 0) {
|
|
|
parkFee.setNum(parkFee.getNum() + 1);
|
|
|
}
|
|
|
parkFee.setTaxMoney(parkFee.getTaxMoney().add(price));
|
|
@@ -115,7 +131,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
}
|
|
|
|
|
|
@Async
|
|
|
- public void countBusinessFee(List<TbBusinessItem> items){
|
|
|
+ public void countBusinessFee(List<TbBusinessItem> items) {
|
|
|
Date now = new Date();
|
|
|
String toDay = DateUtil.format(now, "yyyy-MM-dd");
|
|
|
String thisYear = StrUtil.sub(toDay, 0, 4);
|
|
@@ -123,19 +139,19 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
for (TbBusinessItem item : items) {
|
|
|
int feeType = -1;
|
|
|
String itemType = item.getItemTypeName();
|
|
|
- if(itemType.contains("核酸")){
|
|
|
+ if (itemType.contains("核酸")) {
|
|
|
feeType = TbFeeStatistics.feeType.NUCLEIC_FEE.getCode();
|
|
|
- } else if(itemType.contains("消毒")){
|
|
|
+ } else if (itemType.contains("消毒")) {
|
|
|
feeType = TbFeeStatistics.feeType.DISINFECT_FEE.getCode();
|
|
|
- } else if(itemType.contains("装卸")){
|
|
|
+ } else if (itemType.contains("装卸")) {
|
|
|
feeType = TbFeeStatistics.feeType.STEVEDORE_FEE.getCode();
|
|
|
- } else if(StrUtil.equals(itemType, "特殊车辆") || StrUtil.equals(itemType, "充电打冷") || StrUtil.equals(itemType, "汽车吊" )){
|
|
|
+ } else if (StrUtil.equals(itemType, "特殊车辆") || StrUtil.equals(itemType, "充电打冷") || StrUtil.equals(itemType, "汽车吊")) {
|
|
|
feeType = TbFeeStatistics.feeType.STEVEDORE_FEE.getCode();
|
|
|
- } else if(itemType.contains("入场管理")){
|
|
|
+ } else if (itemType.contains("入场管理")) {
|
|
|
feeType = TbFeeStatistics.feeType.MANAGE_FEE.getCode();
|
|
|
}
|
|
|
TbFeeStatistics businessFee = this.getByDayAndFeeType(toDay, feeType);
|
|
|
- if(businessFee == null){
|
|
|
+ if (businessFee == null) {
|
|
|
businessFee = new TbFeeStatistics();
|
|
|
businessFee.setTaxRate(new BigDecimal(0.06));
|
|
|
}
|
|
@@ -151,7 +167,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
//添加此item的收费明细
|
|
|
TbBusiness business = tbBusinessService.getById(item.getBusinessId());
|
|
|
TbFeeDetails businessFeeDetail = tbFeeDetailsService.getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
|
|
|
- if(businessFeeDetail == null){
|
|
|
+ if (businessFeeDetail == null) {
|
|
|
businessFeeDetail = new TbFeeDetails();
|
|
|
}
|
|
|
businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
|