|
@@ -3,7 +3,11 @@ package com.jeeplus.test.wdt.disposeRubbish.service;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.jeeplus.sys.domain.Office;
|
|
|
+import com.jeeplus.sys.service.OfficeService;
|
|
|
+import com.jeeplus.sys.service.dto.OfficeDTO;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
+import com.jeeplus.sys.utils.UserUtils;
|
|
|
import com.jeeplus.test.garbageClearance.domain.LookOver;
|
|
|
import com.jeeplus.test.garbageClearance.service.LookOverService;
|
|
|
import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
@@ -18,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.time.YearMonth;
|
|
@@ -35,6 +40,8 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
|
|
|
private OssService ossService;
|
|
|
@Autowired
|
|
|
private LookOverService lookOverService;
|
|
|
+ @Autowired
|
|
|
+ private OfficeService officeService;
|
|
|
|
|
|
public String getMaxNo() {
|
|
|
// 创建查询条件构造器
|
|
@@ -75,13 +82,40 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据id获取巡视工单信息
|
|
|
+ * 根据id获取巡查工单信息
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
public DisposeRubbish selectById(String id) {
|
|
|
DisposeRubbish disposeRubbish = baseMapper.selectById(id);
|
|
|
- if(StringUtils.isNotBlank(disposeRubbish.getProgramId())){
|
|
|
+ //通过createById获取发起人所属村落。根据所属村落的运输距离和计费方式计算出补贴金额
|
|
|
+ if(null != disposeRubbish && StringUtils.isNotBlank(disposeRubbish.getCreateById())){
|
|
|
+ UserDTO userDTO = UserUtils.get(disposeRubbish.getCreateById());
|
|
|
+ OfficeDTO officeDTO = userDTO.getOfficeDTO();
|
|
|
+ if(null != officeDTO && StringUtils.isNotBlank(officeDTO.getId())){
|
|
|
+ Office office = officeService.getById(officeDTO.getId());
|
|
|
+ if(StringUtils.isNotBlank(office.getHaulDistance())){
|
|
|
+ disposeRubbish.setTransportMileage(office.getHaulDistance());
|
|
|
+ //字符串转数字
|
|
|
+ int haulDistance = Integer.parseInt(office.getHaulDistance());
|
|
|
+ if(haulDistance<=5){
|
|
|
+ //5公里内每公里补贴20元
|
|
|
+ disposeRubbish.setSubsidyUnitPrice(20);
|
|
|
+ } else if (haulDistance<=10){
|
|
|
+ //5-10公里每公里补贴22元
|
|
|
+ disposeRubbish.setSubsidyUnitPrice(22);
|
|
|
+ } else if (haulDistance<=20){
|
|
|
+ //10-20公里每公里补贴25元
|
|
|
+ disposeRubbish.setSubsidyUnitPrice(25);
|
|
|
+ }else{
|
|
|
+ //20公里以上每公里补贴28元
|
|
|
+ disposeRubbish.setSubsidyUnitPrice(28);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("");
|
|
|
+ }
|
|
|
+ if(null != disposeRubbish && StringUtils.isNotBlank(disposeRubbish.getProgramId())){
|
|
|
// 使用 split() 方法将字符串分割为数组
|
|
|
String[] array = disposeRubbish.getProgramId().split(",");
|
|
|
// 将数组转换为 List
|
|
@@ -112,7 +146,7 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
|
|
|
return disposeRubbish;
|
|
|
}
|
|
|
/**
|
|
|
- * 根据id获取巡视工单信息
|
|
|
+ * 根据id获取巡查工单信息
|
|
|
* @param procInsIdList
|
|
|
* @return
|
|
|
*/
|
|
@@ -121,7 +155,7 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据id获取巡视工单信息
|
|
|
+ * 根据id获取巡查工单信息
|
|
|
* @param programIdList
|
|
|
* @return
|
|
|
*/
|
|
@@ -132,7 +166,7 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据id获取巡视工单信息
|
|
|
+ * 根据id获取巡查工单信息
|
|
|
* @param officeId
|
|
|
* @return
|
|
|
*/
|
|
@@ -229,7 +263,7 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 根据id和年月获取巡视工单信息
|
|
|
+ * 根据id和年月获取巡查工单信息
|
|
|
* @param officeId
|
|
|
* @param yearMonth
|
|
|
* @return
|
|
@@ -260,7 +294,7 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 根据id获取巡视工单信息
|
|
|
+ * 根据id获取巡查工单信息
|
|
|
* @param no
|
|
|
* @return
|
|
|
*/
|