|
@@ -46,18 +46,32 @@ public abstract class AbstractRepairBaseStrategy implements RepairBaseStrategy{
|
|
|
|
|
|
@Override
|
|
|
public RepairApplicationForm callRepair(RepairApplicationFormDTO model) {
|
|
|
- if(StringUtils.isBlank(model.getSbId())){
|
|
|
- throw new DeniedException("请填写报修设备");
|
|
|
- }
|
|
|
model.setType(model.getType() == null ? 1 : model.getType());
|
|
|
Weekend<RepairApplicationForm> weekend = new Weekend<>(RepairApplicationForm.class);
|
|
|
weekend.weekendCriteria().andIsNotNull(RepairApplicationForm::getId).andEqualTo(RepairApplicationForm::getType, model.getType());
|
|
|
int count = repairApplicationFormMapper.selectCountByExample(weekend);
|
|
|
// 设备是否存在
|
|
|
- String sbId = model.getSbId();
|
|
|
- SbInfo sb = sbInfoService.getModelById(sbId);
|
|
|
- if (sb == null) {
|
|
|
- throw new DeniedException("设备不存在,无法报修");
|
|
|
+ // 判断设备录入方式
|
|
|
+ if(model.getInputType() == null){
|
|
|
+ throw new DeniedException("设备录入方式不能为空");
|
|
|
+ }
|
|
|
+ SbInfo sb = null;
|
|
|
+ if(model.getInputType() == 1){
|
|
|
+ if(StringUtils.isBlank(model.getSbName()) && StringUtils.isBlank(model.getPositionNo())){
|
|
|
+ throw new DeniedException("请填写报修设备信息");
|
|
|
+ }
|
|
|
+ // 手动录入
|
|
|
+ sb = packageSb(model.getSbName(),model.getPositionNo(),model.getPositionId(),model.getSbCph());
|
|
|
+ model.setSbId(sb.getId());
|
|
|
+ }else{
|
|
|
+ if(StringUtils.isBlank(model.getSbId())){
|
|
|
+ throw new DeniedException("请填写报修设备");
|
|
|
+ }
|
|
|
+ String sbId = model.getSbId();
|
|
|
+ sb = sbInfoService.getModelById(sbId);
|
|
|
+ if (sb == null) {
|
|
|
+ throw new DeniedException("设备不存在,无法报修");
|
|
|
+ }
|
|
|
}
|
|
|
// 存储报修人
|
|
|
if(StringUtils.isBlank(model.getActualUser())){
|
|
@@ -121,6 +135,23 @@ public abstract class AbstractRepairBaseStrategy implements RepairBaseStrategy{
|
|
|
return form;
|
|
|
}
|
|
|
|
|
|
+ private SbInfo packageSb(String sbName,String positionNo,String positionId,String sbCph){
|
|
|
+ SbInfo sbInfo = new SbInfo();
|
|
|
+ sbInfo.setName(StringUtils.isBlank(sbName) ? "暂无" : sbName);
|
|
|
+ sbInfo.setPositionNo(StringUtils.isBlank(positionNo) ? "暂无" : positionNo);
|
|
|
+ sbInfo.setLevel(SbInfoLevelEnum.B.getValue());
|
|
|
+ sbInfo.setNo("暂无");
|
|
|
+ sbInfo.setModel("暂无");
|
|
|
+ sbInfo.setTypeId("63b63efb3abe142254568505");
|
|
|
+ sbInfo.setPositionId(positionId);
|
|
|
+ sbInfo.setUseType(SbUseType.OTHER.getValue());
|
|
|
+ sbInfo.setSaveUser(SecurityUtils.getUserInfo().getUserId());
|
|
|
+ sbInfo.setStatus(SbInfoStatusEnum.IN_USE.getValue());
|
|
|
+ sbInfo.setIsFinancing(YesNoEnum.NO.getValue());
|
|
|
+ sbInfo.setCph(sbCph);
|
|
|
+ return sbInfoService.saveModel(sbInfo);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RepairApplicationFormDTO sendRepair(RepairApplicationFormDTO model) {
|
|
|
String id = model.getId();
|