其他异常和设备异常接口,异常bug修改

赵嘉伟 4 years ago
parent 09fbc528b8
commit 661d1056fc

@ -8,6 +8,7 @@ import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService; import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
import com.foreverwin.mesnac.anomaly.service.FileUploadedService; import com.foreverwin.mesnac.anomaly.service.FileUploadedService;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto; import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.service.AnomalyService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R; import com.foreverwin.modular.core.util.R;
@ -36,6 +37,12 @@ public class AbnormalBillController {
@Autowired @Autowired
private FileUploadedService fileUploadedService; private FileUploadedService fileUploadedService;
@Autowired
public AnomalyService anomalyService;
/** /**
@ -317,4 +324,10 @@ public class AbnormalBillController {
public R clear(String type){ public R clear(String type){
return R.ok(abnormalBillService.getNextNumber(type)); return R.ok(abnormalBillService.getNextNumber(type));
} }
@GetMapping("/test")
public R test(String category, String resource, String shopOrder, String sfc, String ncCodes ){
anomalyService.createAnomalyTask(category,resource,shopOrder,sfc,ncCodes);
return R.ok();
}
} }

@ -12,16 +12,15 @@ import com.foreverwin.mesnac.anomaly.service.*;
import com.foreverwin.mesnac.common.constant.Constants; import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.helper.NextNumberHelper; import com.foreverwin.mesnac.common.helper.NextNumberHelper;
import com.foreverwin.mesnac.common.service.AnomalyService;
import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.mapper.NcGroupMapper; import com.foreverwin.mesnac.meapi.mapper.*;
import com.foreverwin.mesnac.meapi.mapper.NwaUserMapper;
import com.foreverwin.mesnac.meapi.mapper.ResrceMapper;
import com.foreverwin.mesnac.meapi.mapper.ShopOrderMapper;
import com.foreverwin.mesnac.meapi.model.*; import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.*; import com.foreverwin.mesnac.meapi.service.*;
import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
import com.visiprise.common.exception.BaseException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -40,7 +39,7 @@ import java.util.*;
*/ */
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, AbnormalBill> implements AbnormalBillService { public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, AbnormalBill> implements AbnormalBillService, AnomalyService {
@ -95,6 +94,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired @Autowired
private UploadPicturesService uploadPicturesService; private UploadPicturesService uploadPicturesService;
@Autowired
private SfcMapper sfcMapper;
@Override @Override
@ -501,9 +503,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
if(causeTypes.size() > 0){ if(causeTypes.size() > 0){
abnormalCauseService.saveOrUpdateBatch(causeTypes); abnormalCauseService.saveOrUpdateBatch(causeTypes);
} }
//放置图片 if(StringUtil.isBlank(abnormalBill.getFileName())){
this.fileUpload(abnormalBill); //放置图片
this.fileUpload(abnormalBill);
}
return message; return message;
} }
@ -587,6 +590,53 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
} }
return abnormalNo; return abnormalNo;
} }
@Override
public void createAnomalyTask(String category, String resource, String shopOrder, String sfc, String ncCodes) {
String site = CommonMethods.getSite();
LocalDateTime now = LocalDateTime.now();
String user = CommonMethods.getUser();
String abnormalNo = null;
AbnormalBill abnormalBill = new AbnormalBill();
if(Constants.ABNORMAL_SERVICE.equals(category)){
abnormalNo = this.getNextNumber(category);
abnormalBill.setNcCode(ncCodes);
abnormalBill.setRepairDateTime(now);
abnormalBill.setType(category);
}else if(Constants.ABNORMAL_OTHER.equals(category)){
abnormalNo = this.getNextNumber(category);
abnormalBill.setType(category);
}
abnormalBill.setSite(site);
abnormalBill.setAbnormalNo(abnormalNo);
abnormalBill.setHandle(HandleEnum.Z_ABNORMAL_BILL.getHandle(site,abnormalNo));
abnormalBill.setStatus(Constants.NEW);
abnormalBill.setSfc(sfc);
abnormalBill.setShopOrder(shopOrder);
abnormalBill.setResrce(resource);
abnormalBill.setDiscover(Constants.SELF_MADE);
abnormalBill.setReportFrom(Constants.REPORT);
AbnormalBillDispose abnormalBillDispose = new AbnormalBillDispose();
abnormalBillDispose.setSite(site);
abnormalBillDispose.setAbnormalBillBo(abnormalBill.getHandle());
this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null);
//判断工单sfc资源是否传递正确
Sfc sfc1 = sfcMapper.selectById(HandleEnum.SFC.getHandle(site, sfc));
if(sfc == null){
throw new BaseException("sfc传递有误");
}else {
Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, resource));
if(resrce == null){
throw new BaseException("资源传递有误");
}
}
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
}
} }

@ -102,4 +102,10 @@ public interface Constants {
String CALL_ITEM_STATUS_CALLED = "802"; String CALL_ITEM_STATUS_CALLED = "802";
String CALL_ITEM_STATUS_ISSUED = "803"; String CALL_ITEM_STATUS_ISSUED = "803";
String CALL_ITEM_STATUS_CANCELED = "804"; String CALL_ITEM_STATUS_CANCELED = "804";
//异常单的类型
String ABNORMAL_QUALITY = "Z";
String ABNORMAL_OTHER = "Q";
String ABNORMAL_SERVICE = "S";
} }

@ -39,6 +39,8 @@ public class NextNumberController {
public NextNumberCodeService nextNumberCodeService; public NextNumberCodeService nextNumberCodeService;
@ResponseBody @ResponseBody
@PostMapping("/save") @PostMapping("/save")
public R save(@RequestBody Map<String, Object> paramMap) { public R save(@RequestBody Map<String, Object> paramMap) {
@ -126,4 +128,6 @@ public class NextNumberController {
public R getNextNumber(String numberType, int qty){ public R getNextNumber(String numberType, int qty){
return R.ok(nextNumberHelper.getNextNumber(CommonMethods.getSite(), numberType, qty, null)); return R.ok(nextNumberHelper.getNextNumber(CommonMethods.getSite(), numberType, qty, null));
} }
} }

@ -0,0 +1,20 @@
package com.foreverwin.mesnac.common.service;
/**
* @Description TODO
* @Author zhaojiawei
* @Since 2021-07-12
*/
public interface AnomalyService {
/**
*
* @param category
* @param resource
* @param shopOrder
* @param sfc
* @param ncCodes
*/
void createAnomalyTask(String category, String resource, String shopOrder, String sfc, String ncCodes);
}
Loading…
Cancel
Save