diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java index aaf4f7d1..cd99c4d2 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java @@ -2,7 +2,6 @@ package com.bonus.sgzb.app.controller; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; -import cn.hutool.core.util.ObjectUtil; import com.bonus.sgzb.app.domain.LeaseApplyDetails; import com.bonus.sgzb.app.domain.LeaseApplyInfo; import com.bonus.sgzb.app.domain.TmTask; @@ -22,7 +21,6 @@ import com.bonus.sgzb.common.log.annotation.Log; import com.bonus.sgzb.common.log.enums.BusinessType; import com.bonus.sgzb.common.security.utils.SecurityUtils; import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -62,6 +60,8 @@ public class TmTaskController extends BaseController { @Autowired private LeaseUserBookService leaseUserBookService; + + private final static String STRING_ADMIN = "admin"; /** @@ -293,24 +293,22 @@ public class TmTaskController extends BaseController { return AjaxResult.error("参数错误"); } Set roles = SecurityUtils.getLoginUser().getRoles(); - List leaseAuditList = new ArrayList<>(); - if (souceBy == 1) { - if (roles.contains("admin")) { + List leaseAuditList; + if (souceBy != null && souceBy == 1) { + if (roles.contains(STRING_ADMIN)) { leaseAuditList = tmTaskService.getLeaseAuditList(task); - return AjaxResult.success(getDataTable(leaseAuditList)); } else { leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task); - return AjaxResult.success(getDataTable(leaseAuditList)); } + return AjaxResult.success(getDataTable(leaseAuditList)); } startPage(); - if (roles.contains("admin")) { + if (roles.contains(STRING_ADMIN)) { leaseAuditList = tmTaskService.getLeaseAuditList(task); - return AjaxResult.success(getDataTable(leaseAuditList)); } else { leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task); - return AjaxResult.success(getDataTable(leaseAuditList)); } + return AjaxResult.success(getDataTable(leaseAuditList)); } @@ -327,8 +325,8 @@ public class TmTaskController extends BaseController { if (StringUtils.isNull(task)) { return AjaxResult.error("参数错误"); } - List leaseAuditList = new ArrayList<>(); - if (souceBy == 1) { + List leaseAuditList; + if (souceBy != null && souceBy == 1) { leaseAuditList = tmTaskService.getLeaseAuditManageList(task); return AjaxResult.success(leaseAuditList); } @@ -351,7 +349,7 @@ public class TmTaskController extends BaseController { Set roles = SecurityUtils.getLoginUser().getRoles(); // 领料申请导出 if (task.getTypes() == 1) { - if (roles.contains("admin")) { + if (roles.contains(STRING_ADMIN)) { leaseAuditList = tmTaskService.getLeaseAuditList(task); } else { leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task); @@ -381,7 +379,7 @@ public class TmTaskController extends BaseController { return AjaxResult.error("参数错误"); } if (StringUtils.isNotBlank(role)) { - if (role.contains("admin")) { + if (role.contains(STRING_ADMIN)) { //如果是管理员可以看到所有的审核列表 List leaseAuditList = tmTaskService.getLeaseAuditListByAdmin(task); return AjaxResult.success(getDataTable(leaseAuditList)); diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java index 37a9ab1e..79b76a6c 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java @@ -2,7 +2,6 @@ package com.bonus.sgzb.app.service.impl; import cn.hutool.core.collection.CollUtil; import com.bonus.sgzb.app.domain.LeaseApplyDetails; -import com.bonus.sgzb.app.domain.LeaseApplyInfo; import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper; import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper; import com.bonus.sgzb.app.service.LeaseOutDetailsService; @@ -128,7 +127,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { if (StringUtils.isNull(record)) { return AjaxResult.error("领料出库失败,请检查参数是否填写完整!"); } - if (!(Objects.equals(Integer.valueOf(0), record.getMaId()) || record.getMaId() == null)) { + if (!(Objects.equals(0, record.getMaId()) || record.getMaId() == null)) { String status = leaseOutDetailsMapper.getMachineStatus(record); if (!maStatus.equals(status)) { return AjaxResult.error("领料出库失败,该设备不是在库状态!"); @@ -152,8 +151,6 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { if (updateLeaseApplyDetailsOutNum > 0) { if (insertSelectiveNum > 0) { if (updateMaTypeStockNum > 0) { - // if (updateMaMachineStatus > 0) { - // if (insertAgreementInfo > 0) { List leaseApplyDetailsList = leaseApplyDetailsMapper.getByParentId(record.getParentId()); int i = 0; for (LeaseApplyDetails bean : leaseApplyDetailsList) { @@ -168,16 +165,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { leaseOutDetailsMapper.updateTaskStatus(taskId, 34); } int j = insSltInfo(taskId, record); - if (j > 0) { - return AjaxResult.success("领料出库成功!"); - } else { - return AjaxResult.error("出库失败,更新设备规格库存数量时出错!"); - } - - // } - // return AjaxResult.error("领料出库失败,插入任务协议信息错误!"); - // } - // return AjaxResult.error("领料出库失败,最后更新设备状态错误!"); + return j > 0 ? AjaxResult.success("领料出库成功!") : AjaxResult.error("领料出库失败,更新设备规格库存数量时出错!"); } return AjaxResult.error("出库失败,更新设备规格库存数量时出错!"); } @@ -200,9 +188,9 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { if (StringUtils.isEmpty(protocol)) { ma.setFinalPrice(ma.getLeasePrice()); } else { - if (protocol.equals("1")) { + if ("1".equals(protocol)) { ma.setFinalPrice(ma.getLeasePrice()); - } else if (protocol.equals("2")) { + } else if ("2".equals(protocol)) { ma.setFinalPrice(ma.getRentPrice()); } else { ma.setFinalPrice(ma.getLeasePrice()); diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java index 3c138dd1..665212f0 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java @@ -1,12 +1,9 @@ package com.bonus.sgzb.app.service.impl; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.convert.Convert; -import cn.hutool.core.util.ObjectUtil; import com.bonus.sgzb.app.domain.LeaseApplyDetails; import com.bonus.sgzb.app.domain.LeaseApplyInfo; import com.bonus.sgzb.app.domain.TmTask; -import com.bonus.sgzb.app.domain.TmTaskDto; import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper; import com.bonus.sgzb.app.mapper.LeaseApplyInfoMapper; import com.bonus.sgzb.app.mapper.TmTaskMapper; @@ -15,7 +12,7 @@ import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.security.utils.SecurityUtils; -import net.sf.jsqlparser.expression.TryCastExpression; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -25,7 +22,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -37,6 +33,7 @@ import java.util.stream.Collectors; */ @Service +@Slf4j public class TmTaskServiceImpl implements TmTaskService { @Resource @@ -232,7 +229,7 @@ public class TmTaskServiceImpl implements TmTaskService { List leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo); if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) { for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null) { + if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { // 统计预领数量 count += leaseApplyDetail.getPreNum(); } @@ -358,7 +355,7 @@ public class TmTaskServiceImpl implements TmTaskService { List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) { for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null) { + if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { // 统计预领数量 count += leaseApplyDetail.getPreNum(); } @@ -382,7 +379,7 @@ public class TmTaskServiceImpl implements TmTaskService { List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) { for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null) { + if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { // 统计预领数量 count += leaseApplyDetail.getPreNum(); } @@ -731,6 +728,7 @@ public class TmTaskServiceImpl implements TmTaskService { throw new RuntimeException("insertNewDetailData异常"); } } catch (Exception e) { + log.error(e.getMessage(), e); e.printStackTrace(); } return res; @@ -775,11 +773,8 @@ public class TmTaskServiceImpl implements TmTaskService { res = leaseApplyInfoMapper.insert(leaseApplyInfo); } } - - return res; - } else { - return res; } + return res; } private int insertNewDetailData(TmTask task) { @@ -790,15 +785,13 @@ public class TmTaskServiceImpl implements TmTaskService { for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { LeaseApplyInfo leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), String.valueOf(leaseApplyDetail.getCompanyId())); Integer id = leaseApplyInfos.getId(); - if (leaseApplyDetail.getCompanyId() == leaseApplyInfos.getCompanyId()) { + if (leaseApplyDetail.getCompanyId().equals(leaseApplyInfos.getCompanyId())) { leaseApplyDetail.setParenntId(id); res = leaseApplyDetailsMapper.insert(leaseApplyDetail); } } - return res; - } else { - return res; } + return res; } private int deletePreData(TmTask task) { diff --git a/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SysOperLogMapper.xml index 149f4822..49cb8ddd 100644 --- a/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SysOperLogMapper.xml +++ b/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"