重庆测试问题修改
This commit is contained in:
parent
948b3a524c
commit
74869937fe
|
|
@ -52,29 +52,30 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult submitRepairApply( RepairApplyRecord bean) {
|
public AjaxResult submitRepairApply(RepairApplyRecord bean) {
|
||||||
RepairTaskDetails details = mapper.getById(bean.getId());
|
RepairTaskDetails details = mapper.getById(bean.getId());
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
bean.setCreateBy(loginUser.getUserid());
|
bean.setCreateBy(loginUser.getUserid());
|
||||||
List<RepairPartDetails> partList = bean.getPartList();
|
List<RepairPartDetails> partList = bean.getPartList();
|
||||||
BigDecimal sfCosts = new BigDecimal("0");
|
BigDecimal sfCosts = new BigDecimal("0");
|
||||||
BigDecimal bsfCosts = new BigDecimal("0");
|
BigDecimal bsfCosts = new BigDecimal("0");
|
||||||
|
Integer partNum = 0;
|
||||||
String nbType = "1";
|
String nbType = "1";
|
||||||
String fcType = "2";
|
String fcType = "2";
|
||||||
String sfPart = "1";
|
String sfPart = "1";
|
||||||
String bsfPart = "0";
|
String bsfPart = "0";
|
||||||
if (partList != null && partList.size()>0){
|
if (partList != null && partList.size() > 0) {
|
||||||
bean.setRepairNum(partList.get(0).getRepairNum());
|
bean.setRepairNum(partList.get(0).getRepairNum());
|
||||||
bean.setRepairer(partList.get(0).getRepairer());
|
bean.setRepairer(partList.get(0).getRepairer());
|
||||||
}
|
}
|
||||||
switch (bean.getRepairType()) {
|
switch (bean.getRepairType()) {
|
||||||
case "1":{
|
case "1": {
|
||||||
int repairNum = details.getRepairedNum() + bean.getRepairNum();
|
int repairNum = details.getRepairedNum() + bean.getRepairNum();
|
||||||
int num = repairNum + details.getScrapNum();
|
int num = repairNum + details.getScrapNum();
|
||||||
if (num > details.getRepairNum()) {
|
if (num > details.getRepairNum()) {
|
||||||
throw new ServiceException("维修数量大于维修总量");
|
throw new ServiceException("维修数量大于维修总量");
|
||||||
}
|
}
|
||||||
mapper.updateRepairedNum(bean.getId(), repairNum,bean.getRepairer(),loginUser.getUserid());
|
mapper.updateRepairedNum(bean.getId(), repairNum, bean.getRepairer(), loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "2": {
|
case "2": {
|
||||||
|
|
@ -83,7 +84,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
if (num > details.getRepairNum()) {
|
if (num > details.getRepairNum()) {
|
||||||
throw new ServiceException("维修数量大于维修总量");
|
throw new ServiceException("维修数量大于维修总量");
|
||||||
}
|
}
|
||||||
mapper.updateRepairedNumTwo(bean.getId(), repairNum,loginUser.getUserid());
|
mapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "3": {
|
case "3": {
|
||||||
|
|
@ -92,17 +93,17 @@ public class RepairServiceImpl implements RepairService {
|
||||||
if (num > details.getRepairNum()) {
|
if (num > details.getRepairNum()) {
|
||||||
throw new ServiceException("维修数量大于维修总量");
|
throw new ServiceException("维修数量大于维修总量");
|
||||||
}
|
}
|
||||||
mapper.updateScrapNum(bean.getId(), scrapNum,loginUser.getUserid());
|
mapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (partList != null && partList.size()>0){
|
if (partList != null && partList.size() > 0) {
|
||||||
if (nbType.equals(bean.getRepairType())){
|
if (nbType.equals(bean.getRepairType())) {
|
||||||
for (RepairPartDetails partDetails : partList){
|
for (RepairPartDetails partDetails : partList) {
|
||||||
if(partDetails.getPartId() != null){
|
if (partDetails.getPartId() != null) {
|
||||||
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()){
|
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()) {
|
||||||
partDetails.setPartCost("0");
|
partDetails.setPartCost("0");
|
||||||
}
|
}
|
||||||
partDetails.setTaskId(bean.getTaskId());
|
partDetails.setTaskId(bean.getTaskId());
|
||||||
|
|
@ -111,47 +112,50 @@ public class RepairServiceImpl implements RepairService {
|
||||||
partDetails.setCreateBy(loginUser.getUserid());
|
partDetails.setCreateBy(loginUser.getUserid());
|
||||||
partDetails.setCompanyId(bean.getCompanyId());
|
partDetails.setCompanyId(bean.getCompanyId());
|
||||||
mapper.addPart(partDetails);
|
mapper.addPart(partDetails);
|
||||||
|
partNum += partDetails.getPartNum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bean.setPartNum(partNum);
|
||||||
}
|
}
|
||||||
if (fcType.equals(bean.getRepairType())){
|
if (fcType.equals(bean.getRepairType())) {
|
||||||
bean.setPartName(partList.get(0).getPartName());
|
bean.setPartName(partList.get(0).getPartName());
|
||||||
bean.setPartType(partList.get(0).getPartType());
|
bean.setPartType(partList.get(0).getPartType());
|
||||||
bean.setRepairContent(partList.get(0).getRepairContent());
|
bean.setRepairContent(partList.get(0).getRepairContent());
|
||||||
if (partList.get(0).getSupplierId() == null){
|
if (partList.get(0).getSupplierId() == null) {
|
||||||
throw new ServiceException("请选择返厂厂家");
|
throw new ServiceException("请选择返厂厂家");
|
||||||
}else {
|
} else {
|
||||||
bean.setSupplierId(partList.get(0).getSupplierId());
|
bean.setSupplierId(partList.get(0).getSupplierId());
|
||||||
}
|
}
|
||||||
if (bean.getPartPrice() == null || bean.getPartPrice().isEmpty()){
|
if (bean.getPartPrice() == null || bean.getPartPrice().isEmpty()) {
|
||||||
bean.setPartPrice("0");
|
bean.setPartPrice("0");
|
||||||
}else {
|
} else {
|
||||||
bean.setPartPrice(partList.get(0).getPartPrice());
|
bean.setPartPrice(partList.get(0).getPartPrice());
|
||||||
}
|
}
|
||||||
bean.setPartNum(partList.get(0).getPartNum());
|
bean.setPartNum(partList.get(0).getPartNum());
|
||||||
}
|
}
|
||||||
for (RepairPartDetails partDetails : partList){
|
for (RepairPartDetails partDetails : partList) {
|
||||||
if (sfPart.equals(partDetails.getPartType())){
|
|
||||||
if (StringUtils.isEmpty(partDetails.getPartCost())){
|
if (sfPart.equals(partDetails.getPartType())) {
|
||||||
|
if (StringUtils.isEmpty(partDetails.getPartCost())) {
|
||||||
partDetails.setPartCost("0");
|
partDetails.setPartCost("0");
|
||||||
}
|
}
|
||||||
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
||||||
sfCosts = sfCosts.add(partCost);
|
sfCosts = sfCosts.add(partCost);
|
||||||
} else if (bsfPart.equals(partDetails.getPartType())) {
|
} else if (bsfPart.equals(partDetails.getPartType())) {
|
||||||
if (StringUtils.isEmpty(partDetails.getPartCost())){
|
if (StringUtils.isEmpty(partDetails.getPartCost())) {
|
||||||
partDetails.setPartCost("0");
|
partDetails.setPartCost("0");
|
||||||
}
|
}
|
||||||
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
||||||
bsfCosts = bsfCosts.add(partCost);
|
bsfCosts = bsfCosts.add(partCost);
|
||||||
} else{
|
} else {
|
||||||
throw new ServiceException("请选择配件收费类型");
|
throw new ServiceException("请选择配件收费类型");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!"0".equals(sfCosts.toString())){
|
if (!"0".equals(sfCosts.toString())) {
|
||||||
mapper.addRepairCost(bean,sfCosts,sfPart);
|
mapper.addRepairCost(bean, sfCosts, sfPart);
|
||||||
}
|
}
|
||||||
if (!"0".equals(bsfCosts.toString())){
|
if (!"0".equals(bsfCosts.toString())) {
|
||||||
mapper.addRepairCost(bean,bsfCosts,bsfPart);
|
mapper.addRepairCost(bean, bsfCosts, bsfPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mapper.addRecord(bean);
|
mapper.addRecord(bean);
|
||||||
|
|
@ -162,13 +166,13 @@ public class RepairServiceImpl implements RepairService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult fastRepairApply(List<RepairTaskDetails> list) {
|
public AjaxResult fastRepairApply(List<RepairTaskDetails> list) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
for (RepairTaskDetails bean : list){
|
for (RepairTaskDetails bean : list) {
|
||||||
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
|
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
|
||||||
if (repairedNum <= 0){
|
if (repairedNum <= 0) {
|
||||||
throw new ServiceException("选中的数据中包含待维修数量为0的机具,请重新选择");
|
throw new ServiceException("选中的数据中包含待维修数量为0的机具,请重新选择");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (RepairTaskDetails bean : list){
|
for (RepairTaskDetails bean : list) {
|
||||||
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
|
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
|
||||||
RepairApplyRecord partDetails = new RepairApplyRecord();
|
RepairApplyRecord partDetails = new RepairApplyRecord();
|
||||||
partDetails.setTaskId(bean.getTaskId());
|
partDetails.setTaskId(bean.getTaskId());
|
||||||
|
|
@ -180,7 +184,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
partDetails.setCompanyId(bean.getCompanyId());
|
partDetails.setCompanyId(bean.getCompanyId());
|
||||||
mapper.addRecord(partDetails);
|
mapper.addRecord(partDetails);
|
||||||
int i = repairedNum + bean.getRepairedNum();
|
int i = repairedNum + bean.getRepairedNum();
|
||||||
mapper.updateRepairedNumTwo(bean.getId(),i,loginUser.getUserid());
|
mapper.updateRepairedNumTwo(bean.getId(), i, loginUser.getUserid());
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
@ -189,19 +193,19 @@ public class RepairServiceImpl implements RepairService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult endRepairTask(List<RepairTask> taskList) {
|
public AjaxResult endRepairTask(List<RepairTask> taskList) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
for (RepairTask task : taskList){
|
for (RepairTask task : taskList) {
|
||||||
int i = mapper.getUnFinish(task);
|
int i = mapper.getUnFinish(task);
|
||||||
if (i > 0){
|
if (i > 0) {
|
||||||
throw new ServiceException("选中的数据中包含维修未完成的,请完成维修再进行提交审核");
|
throw new ServiceException("选中的数据中包含维修未完成的,请完成维修再进行提交审核");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int i = mapper.updateTaskStatus(taskList,loginUser.getUserid());
|
int i = mapper.updateTaskStatus(taskList, loginUser.getUserid());
|
||||||
for (RepairTask task : taskList){
|
for (RepairTask task : taskList) {
|
||||||
task.setCreateBy(loginUser.getUserid());
|
task.setCreateBy(loginUser.getUserid());
|
||||||
Long agreementId = mapper.getAgreementId(task);
|
Long agreementId = mapper.getAgreementId(task);
|
||||||
List<RepairTaskDetails> detailsList = mapper.getDetailsListByTaskId(task);
|
List<RepairTaskDetails> detailsList = mapper.getDetailsListByTaskId(task);
|
||||||
mapper.addTask(task);
|
mapper.addTask(task);
|
||||||
for (RepairTaskDetails details : detailsList){
|
for (RepairTaskDetails details : detailsList) {
|
||||||
details.setCreateBy(loginUser.getUserid());
|
details.setCreateBy(loginUser.getUserid());
|
||||||
details.setTaskId(task.getTaskId());
|
details.setTaskId(task.getTaskId());
|
||||||
mapper.addAuditDetails(details);
|
mapper.addAuditDetails(details);
|
||||||
|
|
@ -221,7 +225,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
@Override
|
@Override
|
||||||
public int completeRepair(ArrayList<Long> ids) {
|
public int completeRepair(ArrayList<Long> ids) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
return mapper.completeRepair(ids,loginUser.getUserid());
|
return mapper.completeRepair(ids, loginUser.getUserid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue