修改设备
This commit is contained in:
@@ -106,6 +106,6 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
* 设备当前流程(1:设备登记,2:功能调试,3:出厂调试),4:设备投运)
|
* 设备当前流程(1:设备登记,2:功能调试,3:出厂调试),4:设备投运)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "process")
|
@TableField(value = "process")
|
||||||
private String process;
|
private Integer process;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -221,4 +221,16 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
csEquipmentDeliveryService.importEquipment(file, response);
|
csEquipmentDeliveryService.importEquipment(file, response);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
@ResponseBody
|
||||||
|
@ApiOperation("联调完成")
|
||||||
|
@PostMapping(value = "testcompletion")
|
||||||
|
public HttpResult<String> testCompletion(@RequestParam("deviceId") String deviceId){
|
||||||
|
String methodDescribe = getMethodDescribe("testCompletion");
|
||||||
|
csEquipmentDeliveryService.testCompletion(deviceId);
|
||||||
|
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,4 +94,8 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
CsEquipmentDeliveryPO findDevByNDid(String nDid);
|
CsEquipmentDeliveryPO findDevByNDid(String nDid);
|
||||||
|
|
||||||
void importEquipment(MultipartFile file, HttpServletResponse response);
|
void importEquipment(MultipartFile file, HttpServletResponse response);
|
||||||
|
|
||||||
|
void delete(String devId);
|
||||||
|
|
||||||
|
void testCompletion(String deviceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,13 @@ import com.njcn.csdevice.utils.ExcelStyleUtil;
|
|||||||
import com.njcn.db.constant.DbConstant;
|
import com.njcn.db.constant.DbConstant;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
|
import com.njcn.poi.util.PoiUtil;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
@@ -88,6 +90,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
|
private final CsEquipmentProcessPOService csEquipmentProcessPOService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||||
@@ -99,7 +103,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
||||||
csEquipmentDeliveryPo.setStatus ("1");
|
csEquipmentDeliveryPo.setStatus ("1");
|
||||||
csEquipmentDeliveryPo.setRunStatus(1);
|
csEquipmentDeliveryPo.setRunStatus(1);
|
||||||
csEquipmentDeliveryPo.setProcess("1");
|
csEquipmentDeliveryPo.setProcess(1);
|
||||||
|
|
||||||
//生成二维码文件
|
//生成二维码文件
|
||||||
String qr = this.createQr(csEquipmentDeliveryAddParm.getNdid());
|
String qr = this.createQr(csEquipmentDeliveryAddParm.getNdid());
|
||||||
@@ -391,7 +395,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csEquipmentDeliveryPO.setMac(path);
|
csEquipmentDeliveryPO.setMac(path);
|
||||||
csEquipmentDeliveryPO.setRunStatus(1);
|
csEquipmentDeliveryPO.setRunStatus(1);
|
||||||
csEquipmentDeliveryPO.setStatus("1");
|
csEquipmentDeliveryPO.setStatus("1");
|
||||||
csEquipmentDeliveryPO.setProcess("1");
|
csEquipmentDeliveryPO.setProcess(1);
|
||||||
return csEquipmentDeliveryPO;
|
return csEquipmentDeliveryPO;
|
||||||
}).collect (Collectors.toList ( ));
|
}).collect (Collectors.toList ( ));
|
||||||
this.saveOrUpdateBatch (collect, 500);
|
this.saveOrUpdateBatch (collect, 500);
|
||||||
@@ -406,6 +410,68 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace ( );
|
e.printStackTrace ( );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 物理删除设备相关数据
|
||||||
|
*
|
||||||
|
* 2.删除cs_ledger
|
||||||
|
* 3.删除cs_dev_model_relation
|
||||||
|
* 4.删除cs_line
|
||||||
|
* 5.删除cs_line_topology_diagram
|
||||||
|
* 6.删除cs_device_user
|
||||||
|
* */
|
||||||
|
@Override
|
||||||
|
public void delete(String devId) {
|
||||||
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||||
|
/**
|
||||||
|
* 删除设备
|
||||||
|
*/
|
||||||
|
csLedgerQueryWrapper.clear();
|
||||||
|
csLedgerQueryWrapper.eq("id",devId);
|
||||||
|
csLedgerService.removeById(csLedgerQueryWrapper);
|
||||||
|
csLedgerQueryWrapper.clear();
|
||||||
|
csLedgerQueryWrapper.eq("pid",devId);
|
||||||
|
List<CsLedger> list = csLedgerService.list(csLedgerQueryWrapper);
|
||||||
|
List<String> collect = list.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||||
|
csLedgerService.removeById(csLedgerQueryWrapper);
|
||||||
|
QueryWrapper<CsDevModelRelationPO> csDevModelRelationPOQueryWrapper = new QueryWrapper<>();
|
||||||
|
csDevModelRelationPOQueryWrapper.clear();
|
||||||
|
csDevModelRelationPOQueryWrapper.eq("dev_id",devId);
|
||||||
|
csDevModelRelationService.remove(csDevModelRelationPOQueryWrapper);
|
||||||
|
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
|
||||||
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
|
csDeviceUserPOQueryWrapper.eq("device_id",devId);
|
||||||
|
csDeviceUserPOService.remove(csDeviceUserPOQueryWrapper);
|
||||||
|
|
||||||
|
if (!CollectionUtils.isEmpty(collect)) {
|
||||||
|
QueryWrapper<CsLinePO> csLinePOQueryWrapper = new QueryWrapper<>();
|
||||||
|
csLinePOQueryWrapper.clear();
|
||||||
|
csLinePOQueryWrapper.in("line_id",collect);
|
||||||
|
csLinePOService.remove(csLinePOQueryWrapper);
|
||||||
|
QueryWrapper<AppLineTopologyDiagramPO> appLineTopologyDiagramPOQueryWrapper = new QueryWrapper<>();
|
||||||
|
appLineTopologyDiagramPOQueryWrapper.clear();
|
||||||
|
csLinePOQueryWrapper.in("line_id",collect);
|
||||||
|
appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testCompletion(String deviceId) {
|
||||||
|
CsEquipmentDeliveryPO byId = this.getById(deviceId);
|
||||||
|
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
|
||||||
|
set(CsEquipmentDeliveryPO::getStatus,0).
|
||||||
|
set(CsEquipmentDeliveryPO::getRunStatus,1).
|
||||||
|
set(CsEquipmentDeliveryPO::getProcess,byId.getProcess()+1).update();
|
||||||
|
this.delete(deviceId);
|
||||||
|
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getDevId,deviceId).
|
||||||
|
eq(CsEquipmentProcessPO::getProcess,byId.getProcess()).
|
||||||
|
set(CsEquipmentProcessPO::getEndTime,new Date()).
|
||||||
|
update();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user