新火炬后端单体项目初始化代码
zhangherong
8 天以前 1eefb88049771407e0d0f9c8711bd473e44a1ba6
src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -13,10 +13,12 @@
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.base.model.FactoryIdModel;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.mdc.model.MdcEquipmentTree;
import org.jeecg.modules.mdc.model.ProductionIdModel;
import org.jeecg.modules.mdc.service.IFactoryEquipmentService;
import org.jeecg.modules.mdc.service.IMdcEquipmentDepartService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcProductionEquipmentService;
@@ -55,7 +57,10 @@
    private IMdcEquipmentDepartService mdcEquipmentDepartService;
    @Resource
    private IMdcProductionEquipmentService mdcProductionEquipmentService;
    private IFactoryEquipmentService factoryEquipmentService;
//    @Resource
//    private IMdcProductionEquipmentService mdcProductionEquipmentService;
    /**
     * 分页列表查询
@@ -203,34 +208,34 @@
        return Result.OK("批量移除成功!");
    }
    /**
     * 批量移除产线和设备关系
     */
    @AutoLog(value = "设备产线表-批量移除产线和设备关系")
    @ApiOperation(value = "设备产线表-批量移除产线和设备关系", notes = "设备产线表-批量移除产线和设备关系")
    @PostMapping(value = "/removeEquipmentsForProduction")
    public Result<?> removeEquipmentsForProduction(@RequestParam(name = "productionId", required = true) String productionId,
                                                   @RequestParam(name = "equipmentIds", required = true) String equipmentIds) {
        if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentIds)) {
            List<String> equipmentIdList = Arrays.asList(equipmentIds.split(","));
            mdcEquipmentService.removeEquipmentsForProduction(productionId, equipmentIdList);
        }
        return Result.OK("批量移除成功!");
    }
//    /**
//     * 批量移除产线和设备关系
//     */
//    @AutoLog(value = "设备产线表-批量移除产线和设备关系")
//    @ApiOperation(value = "设备产线表-批量移除产线和设备关系", notes = "设备产线表-批量移除产线和设备关系")
//    @PostMapping(value = "/removeEquipmentsForProduction")
//    public Result<?> removeEquipmentsForProduction(@RequestParam(name = "productionId", required = true) String productionId,
//                                                   @RequestParam(name = "equipmentIds", required = true) String equipmentIds) {
//        if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentIds)) {
//            List<String> equipmentIdList = Arrays.asList(equipmentIds.split(","));
//            mdcEquipmentService.removeEquipmentsForProduction(productionId, equipmentIdList);
//        }
//        return Result.OK("批量移除成功!");
//    }
    /**
     * 移除产线和设备关系
     */
    @AutoLog(value = "设备产线表-移除产线和设备关系")
    @ApiOperation(value = "设备产线表-移除产线和设备关系", notes = "设备产线表-移除产线和设备关系")
    @PostMapping(value = "/removeEquipmentForProduction")
    public Result<?> removeEquipmentForProduction(@RequestParam(name = "productionId", required = true) String productionId,
                                                  @RequestParam(name = "equipmentId", required = true) String equipmentId) {
        if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentId)) {
            mdcEquipmentService.removeEquipmentForProduction(productionId, equipmentId);
        }
        return Result.OK("移除成功!");
    }
//    /**
//     * 移除产线和设备关系
//     */
//    @AutoLog(value = "设备产线表-移除产线和设备关系")
//    @ApiOperation(value = "设备产线表-移除产线和设备关系", notes = "设备产线表-移除产线和设备关系")
//    @PostMapping(value = "/removeEquipmentForProduction")
//    public Result<?> removeEquipmentForProduction(@RequestParam(name = "productionId", required = true) String productionId,
//                                                  @RequestParam(name = "equipmentId", required = true) String equipmentId) {
//        if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentId)) {
//            mdcEquipmentService.removeEquipmentForProduction(productionId, equipmentId);
//        }
//        return Result.OK("移除成功!");
//    }
    /**
     * 添加
@@ -244,7 +249,7 @@
    public Result<MdcEquipment> add(@RequestBody MdcEquipment mdcEquipment) {
        Result<MdcEquipment> result = new Result<>();
        String selectedDeparts = mdcEquipment.getSelectedDeparts();
        String selectedProduction = mdcEquipment.getSelectedProduction();
        String selectedProduction = mdcEquipment.getSelectedFactory();
        mdcEquipment.setEquipmentStatus(CommonConstant.STATUS_NORMAL);
        try {
            mdcEquipmentService.saveMdcEquipment(mdcEquipment, selectedDeparts, selectedProduction);
@@ -367,11 +372,11 @@
     */
    @AutoLog(value = "设备表-查询指定设备和产线关联的数据")
    @ApiOperation(value = "设备表-查询指定设备和产线关联的数据", notes = "设备表-查询指定设备和产线关联的数据")
    @GetMapping(value = "/equipmentProductionList")
    public Result<List<ProductionIdModel>> getEquipmentProductionList(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
        Result<List<ProductionIdModel>> result = new Result<>();
    @GetMapping(value = "/equipmentFactoryList")
    public Result<List<FactoryIdModel>> equipmentFactoryList(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
        Result<List<FactoryIdModel>> result = new Result<>();
        try {
            List<ProductionIdModel> proIdModelList = this.mdcProductionEquipmentService.queryProductionIdsOfEquipment(equipmentId);
            List<FactoryIdModel> proIdModelList = this.factoryEquipmentService.queryFactoryIdsOfEquipment(equipmentId);
            if (proIdModelList != null && !proIdModelList.isEmpty()) {
                result.setSuccess(true);
                result.setMessage("查找成功");
@@ -388,6 +393,33 @@
            return result;
        }
    }
//    /**
//     * 查询指定设备和产线关联的数据
//     */
//    @AutoLog(value = "设备表-查询指定设备和产线关联的数据")
//    @ApiOperation(value = "设备表-查询指定设备和产线关联的数据", notes = "设备表-查询指定设备和产线关联的数据")
//    @GetMapping(value = "/equipmentProductionList")
//    public Result<List<ProductionIdModel>> getEquipmentProductionList(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
//        Result<List<ProductionIdModel>> result = new Result<>();
//        try {
//            List<ProductionIdModel> proIdModelList = this.mdcProductionEquipmentService.queryProductionIdsOfEquipment(equipmentId);
//            if (proIdModelList != null && !proIdModelList.isEmpty()) {
//                result.setSuccess(true);
//                result.setMessage("查找成功");
//                result.setResult(proIdModelList);
//            } else {
//                result.setSuccess(false);
//                result.setMessage("查找失败");
//            }
//            return result;
//        } catch (Exception e) {
//            log.error(e.getMessage(), e);
//            result.setSuccess(false);
//            result.setMessage("查找过程中出现了异常: " + e.getMessage());
//            return result;
//        }
//    }
    /**
     * 加载部门设备树
@@ -416,6 +448,26 @@
    @ApiOperation(value = "设备表-加载产线设备树", notes = "设备表-加载产线设备树")
    @GetMapping(value = "/queryTreeListByProduction")
    public Result<List<MdcEquipmentTree>> queryTreeListByProduction() {
        Result<List<MdcEquipmentTree>> result = new Result<>();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        try {
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId);
            result.setSuccess(true);
            result.setResult(mdcEquipmentTreeList);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return result;
    }
    /**
     * 加载产线设备树
     */
    @AutoLog(value = "设备表-加载产线设备树")
    @ApiOperation(value = "设备表-加载产线设备树", notes = "设备表-加载产线设备树")
    @GetMapping(value = "/queryTreeListByFactory")
    public Result<List<MdcEquipmentTree>> queryTreeListByFactory() {
        Result<List<MdcEquipmentTree>> result = new Result<>();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
@@ -537,18 +589,18 @@
    }
    @AutoLog(value = "设备表-通过车间ids获取设备树")
    @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树")
    @GetMapping(value = "/loadTreeListByProductionIds")
    public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) {
        Result<List<MdcEquipmentTree>> result = new Result<>();
        try {
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids);
            result.setSuccess(true);
            result.setResult(mdcEquipmentTreeList);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return result;
    }
//    @AutoLog(value = "设备表-通过车间ids获取设备树")
//    @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树")
//    @GetMapping(value = "/loadTreeListByProductionIds")
//    public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) {
//        Result<List<MdcEquipmentTree>> result = new Result<>();
//        try {
//            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids);
//            result.setSuccess(true);
//            result.setResult(mdcEquipmentTreeList);
//        } catch (Exception e) {
//            log.error(e.getMessage(), e);
//        }
//        return result;
//    }
}