|
@@ -52,6 +52,7 @@ import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseService;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.redis.cache.BladeRedis;
|
|
|
+import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
@@ -252,10 +253,10 @@ public class TaskController extends BladeController {
|
|
|
throw new ServiceException("当前期数的数据中存在已上报的任务,操作失败");
|
|
|
}
|
|
|
/*校验计量单金额是否为0*/
|
|
|
- BigDecimal reduce = middleMeterApplies.stream().map(l -> l.getMeterMoney()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- if (reduce.compareTo(BigDecimal.ZERO) == 0){
|
|
|
- throw new ServiceException("上报金额不能为0");
|
|
|
- }
|
|
|
+// BigDecimal reduce = middleMeterApplies.stream().map(l -> l.getMeterMoney()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+// if (reduce.compareTo(BigDecimal.ZERO) == 0){
|
|
|
+// throw new ServiceException("上报金额不能为0");
|
|
|
+// }
|
|
|
|
|
|
/*获取所有中间计量申请下的清单信息*/
|
|
|
List<Long> middleMeterAppliesIds = middleMeterApplies.stream().map(MiddleMeterApply::getId).collect(Collectors.toList());
|
|
@@ -1393,8 +1394,8 @@ public class TaskController extends BladeController {
|
|
|
}else {
|
|
|
vo.setType(task.getMeterTaskType() == 2 ? 1 : 2);
|
|
|
}
|
|
|
- if (reportAllMoney == null || reportAllMoney.compareTo(BigDecimal.ZERO) == 0){
|
|
|
- throw new ServiceException("上报金额不能为0");
|
|
|
+ if (reportAllMoney == null){
|
|
|
+ throw new ServiceException("上报金额不能为空");
|
|
|
}
|
|
|
reportAllMoney =reportAllMoney.setScale(0,RoundingMode.HALF_UP);
|
|
|
vo.setReportAllMoney(reportAllMoney);
|
|
@@ -2542,20 +2543,7 @@ public class TaskController extends BladeController {
|
|
|
|
|
|
//单独保存意见单
|
|
|
if (task.getMeterTaskType() != null && Arrays.asList(1,2,3).contains(task.getMeterTaskType())) {
|
|
|
- MeterApproveOpinion opinion = dto.getMeterApproveOpinion();
|
|
|
- if (opinion != null) {
|
|
|
- if (StringUtils.isBlank(opinion.getChiefExecutive()))opinion.setChiefExecutive(null);
|
|
|
- if (StringUtils.isBlank(opinion.getContractDept()))opinion.setContractDept(null);
|
|
|
- if (StringUtils.isBlank(opinion.getProjectBuild()))opinion.setProjectBuild(null);
|
|
|
- if (StringUtils.isBlank(opinion.getGeneralManager()))opinion.setGeneralManager(null);
|
|
|
- if (StringUtils.isBlank(opinion.getChiefSupervisor()))opinion.setChiefSupervisor(null);
|
|
|
- if (StringUtils.isBlank(opinion.getSafetyManager()))opinion.setSafetyManager(null);
|
|
|
- if (StringUtils.isBlank(opinion.getContractDeptLeader()))opinion.setContractDeptLeader(null);
|
|
|
- if (StringUtils.isBlank(opinion.getProjectBuildLeader()))opinion.setProjectBuildLeader(null);
|
|
|
- if (StringUtils.isBlank(opinion.getSafetyManagerLeader()))opinion.setSafetyManagerLeader(null);
|
|
|
- if (StringUtils.isBlank(opinion.getSupervisorAudit()))opinion.setSupervisorAudit(null);
|
|
|
- opinionMapper.updateById(opinion);
|
|
|
- }
|
|
|
+ this.saveOpinion(dto);
|
|
|
}
|
|
|
|
|
|
//如果要生成审计意见单
|
|
@@ -2651,6 +2639,175 @@ public class TaskController extends BladeController {
|
|
|
return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
|
+ private void saveOpinion(TaskApproveDTO dto) {
|
|
|
+ MeterApproveOpinion opinion = dto.getMeterApproveOpinion();
|
|
|
+ //获取最新的意见单
|
|
|
+ MeterApproveOpinion oldOpinion = opinionMapper.selectById(opinion.getId());
|
|
|
+ if (opinion != null) {
|
|
|
+ if (StringUtils.isBlank(opinion.getChiefExecutive())) {
|
|
|
+ opinion.setChiefExecutive(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getChiefExecutive())){
|
|
|
+ opinion.setChiefExecutiveUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setChiefExecutiveTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setChiefExecutiveUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setChiefExecutiveTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getContractDept())) {
|
|
|
+ opinion.setContractDept(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getContractDept())){
|
|
|
+ opinion.setContractDeptUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setContractDeptTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setContractDeptUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setContractDeptTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getProjectBuild())) {
|
|
|
+ opinion.setProjectBuild(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getProjectBuild())){
|
|
|
+ opinion.setProjectBuildUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setProjectBuildTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setProjectBuildUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setProjectBuildTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getGeneralManager())) {
|
|
|
+ opinion.setGeneralManager(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getGeneralManager())){
|
|
|
+ opinion.setGeneralManagerUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setGeneralManagerTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setGeneralManagerUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setGeneralManagerTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getChiefSupervisor())) {
|
|
|
+ opinion.setChiefSupervisor(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getChiefSupervisor())){
|
|
|
+ opinion.setChiefSupervisorUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setChiefSupervisorTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setChiefSupervisorUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setChiefSupervisorTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getSafetyManager())) {
|
|
|
+ opinion.setSafetyManager(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getSafetyManager())){
|
|
|
+ opinion.setSafetyManagerUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setSafetyManagerTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setSafetyManagerUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setSafetyManagerTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getContractDeptLeader())) {
|
|
|
+ opinion.setContractDeptLeader(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getContractDeptLeader())){
|
|
|
+ opinion.setContractDeptLeaderUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setContractDeptLeaderTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setContractDeptLeaderUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setContractDeptLeaderTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getProjectBuildLeader())) {
|
|
|
+ opinion.setProjectBuildLeader(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getProjectBuildLeader())){
|
|
|
+ opinion.setProjectBuildLeaderUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setProjectBuildLeaderTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setProjectBuildLeaderUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setProjectBuildLeaderTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getSafetyManagerLeader())) {
|
|
|
+ opinion.setSafetyManagerLeader(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getSafetyManagerLeader())){
|
|
|
+ opinion.setSafetyManagerLeaderUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setSafetyManagerLeaderTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setSafetyManagerLeaderUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setSafetyManagerLeaderTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(opinion.getSupervisorAudit())) {
|
|
|
+ opinion.setSupervisorAudit(null);
|
|
|
+ }else {
|
|
|
+ //如果存在数据则判断之前是否填写总监理工程师,填写了则不管,没填写这次填写了,则设置用户id名称时间
|
|
|
+ if (oldOpinion != null){
|
|
|
+ if (StringUtils.isBlank(oldOpinion.getSupervisorAudit())){
|
|
|
+ opinion.setSupervisorAuditUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setSupervisorAuditTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果不存在数据,则判断当前是否填写了总监理工程师数据,填写了,则设置用户id名称时间
|
|
|
+ opinion.setSupervisorAuditUserName(AuthUtil.getNickName());
|
|
|
+ opinion.setSupervisorAuditTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ opinionMapper.updateById(opinion);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void checkMiddleApp(TaskApproveDTO dto, Task task, List<TaskParallel> taskParallels) {
|
|
|
String html = this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId()));
|
|
|
if (html != null) {
|