|
@@ -19,12 +19,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
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.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_fee_statistics.TbFeeStatistics;
|
|
|
+import com.pj.project.tb_fee_statistics.TbFeeStatisticsService;
|
|
|
+import com.pj.project4sp.admin.SpAdmin;
|
|
|
+import com.pj.project4sp.global.BusinessException;
|
|
|
+import com.pj.project4sp.role.SpRole;
|
|
|
+import com.pj.project4sp.role.SpRoleMapper;
|
|
|
import com.pj.project4sp.uploadfile.UploadUtil;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -63,6 +69,10 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
private MyConfig myConfig;
|
|
|
@Resource
|
|
|
private PartConfig partConfig;
|
|
|
+ @Resource
|
|
|
+ SpRoleMapper spRoleMapper;
|
|
|
+ @Resource
|
|
|
+ TbFeeStatisticsService tbFeeStatisticsService;
|
|
|
|
|
|
/**
|
|
|
* 增
|
|
@@ -399,4 +409,102 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
|
|
|
.setAllDayTaxes(allDayTaxes).setAllDayNoTaxFee(allDayNoTaxFee);
|
|
|
return printData;
|
|
|
}
|
|
|
+
|
|
|
+ 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())){
|
|
|
+ throw new BusinessException("无操作权限");
|
|
|
+ }
|
|
|
+ List<TbFeeDetails> detailsList = this.listByIds(ids);
|
|
|
+ Set<String> days = new HashSet<>();
|
|
|
+ for (TbFeeDetails detail : detailsList) {
|
|
|
+ detail.setJiChaPerson(admin.getName());
|
|
|
+ String dayStr = DateUtil.format(detail.getCreateTime(), "yyyy-MM-dd");
|
|
|
+ days.add(dayStr);
|
|
|
+ }
|
|
|
+ this.updateBatchById(detailsList);
|
|
|
+ changeStats(days, TbFeeDetails.personEnum.JICHA.getDesc());
|
|
|
+ }
|
|
|
+
|
|
|
+ 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())){
|
|
|
+ throw new BusinessException("无操作权限");
|
|
|
+ }
|
|
|
+ List<TbFeeDetails> detailsList = this.listByIds(ids);
|
|
|
+ Set<String> days = new HashSet<>();
|
|
|
+ for (TbFeeDetails detail : detailsList) {
|
|
|
+ detail.setKaiDanPerson(admin.getName());
|
|
|
+ String dayStr = DateUtil.format(detail.getCreateTime(), "yyyy-MM-dd");
|
|
|
+ days.add(dayStr);
|
|
|
+ }
|
|
|
+ this.updateBatchById(detailsList);
|
|
|
+ changeStats(days, TbFeeDetails.personEnum.KAIDAN.getDesc());
|
|
|
+ }
|
|
|
+
|
|
|
+ public void diaoDuConfirm(List<Long> ids) {
|
|
|
+ SpAdmin admin = StpUserUtil.getAdmin();
|
|
|
+ SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
|
|
|
+ if(!StrUtil.equals(TbFeeDetails.personEnum.DIAODU.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) {
|
|
|
+ detail.setDiaoDuPerson(admin.getName());
|
|
|
+ String dayStr = DateUtil.format(detail.getCreateTime(), "yyyy-MM-dd");
|
|
|
+ days.add(dayStr);
|
|
|
+ }
|
|
|
+ this.updateBatchById(detailsList);
|
|
|
+ changeStats(days, TbFeeDetails.personEnum.DIAODU.getDesc());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void changeStats(Set<String> days, String personType) {
|
|
|
+ String personColumn = "";
|
|
|
+ if(StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())){
|
|
|
+ personColumn = "ji_cha_person";
|
|
|
+ }else if(StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())){
|
|
|
+ personColumn = "kai_dan_person";
|
|
|
+ }else{
|
|
|
+ personColumn = "diao_du_person";
|
|
|
+ }
|
|
|
+ for (String day : days) {
|
|
|
+ QueryWrapper<TbFeeDetails> ew1 = new QueryWrapper<>();
|
|
|
+ ew1.like("create_time", day).isNotNull(personColumn);
|
|
|
+ List<TbFeeDetails> confirmList = this.list(ew1);
|
|
|
+ QueryWrapper<TbFeeDetails> ew2 = new QueryWrapper<>();
|
|
|
+ ew2.like("create_time", day);
|
|
|
+ Integer thisDayTotal = tbFeeDetailsMapper.selectCount(ew2);
|
|
|
+ if(confirmList.size() == thisDayTotal){
|
|
|
+ Set<String> names = new TreeSet<>();
|
|
|
+ for (TbFeeDetails detail : confirmList) {
|
|
|
+ if(StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())){
|
|
|
+ names.add(detail.getJiChaPerson());
|
|
|
+ }else if(StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())){
|
|
|
+ names.add(detail.getKaiDanPerson());
|
|
|
+ }else{
|
|
|
+ names.add(detail.getDiaoDuPerson());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String personName = StrUtil.join(",", names);
|
|
|
+ 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())){
|
|
|
+ thisDayStats.setJiChaPerson(personName);
|
|
|
+ }else if(StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())){
|
|
|
+ thisDayStats.setKaiDanPerson(personName);
|
|
|
+ }else{
|
|
|
+ thisDayStats.setDiaoDuPerson(personName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tbFeeStatisticsService.updateBatchById(statsList);
|
|
|
+ }else{
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|