mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增组织机台授权相关接口
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode GOODS_NOT_EXISTS = new ErrorCode(1_001_108_000, "生产单商品不存在");
|
ErrorCode GOODS_NOT_EXISTS = new ErrorCode(1_001_108_000, "生产单商品不存在");
|
||||||
|
|
||||||
// ========== 生产单 TODO 补充编号 ==========
|
// ========== 生产单 TODO 补充编号 ==========
|
||||||
ErrorCode ORDER_NOT_EXISTS = new ErrorCode(1_001_109_000, "存在生产单不存在");
|
ErrorCode ORDER_NOT_EXISTS = new ErrorCode(1_001_109_000, "生产单不存在");
|
||||||
|
|
||||||
// ========== 生产单 TODO 补充编号 ==========
|
// ========== 生产单 TODO 补充编号 ==========
|
||||||
ErrorCode MODULE_NOT_EXISTS = new ErrorCode(1_001_110_000, "模块不存在");
|
ErrorCode MODULE_NOT_EXISTS = new ErrorCode(1_001_110_000, "模块不存在");
|
||||||
|
|||||||
+6
-2
@@ -93,8 +93,12 @@ public class OptimizePlanController {
|
|||||||
@GetMapping("/getOrderSource")
|
@GetMapping("/getOrderSource")
|
||||||
@Operation(summary = "获取生产单源数据 - mock")
|
@Operation(summary = "获取生产单源数据 - mock")
|
||||||
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
||||||
public CommonResult<OrderSource> getOrderSource(@RequestParam(required = false) Long orderId, @RequestParam(required = false) Long plateId) {
|
public CommonResult<OrderSource> getOrderSource(@Schema(description = "生产单id") @RequestParam(required = false) Long orderId,
|
||||||
return CommonResult.success(RandomUtils.randomPojo(OrderSource.class));
|
@Schema(description = "排单id") @RequestParam(required = false) Long planId,
|
||||||
|
@Schema(description = "机台Id") @RequestParam("machineId") Long machineId
|
||||||
|
) {
|
||||||
|
return CommonResult.success(optimizePlanService.getOrderSource(orderId, planId, machineId));
|
||||||
|
//return CommonResult.success(RandomUtils.randomPojo(OrderSource.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -4,6 +4,7 @@ import com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamRespVO;
|
|||||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailVO;
|
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailVO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||||
import com.cf.imes.module.system.api.machine.dto.MachineDTO;
|
import com.cf.imes.module.system.api.machine.dto.MachineDTO;
|
||||||
@@ -28,7 +29,7 @@ public class OrderSource {
|
|||||||
private MachineDTO machineDTO;
|
private MachineDTO machineDTO;
|
||||||
|
|
||||||
@Schema(description = "排单数据")
|
@Schema(description = "排单数据")
|
||||||
private OptimizeParamRespVO planDO;
|
private PlanDO planDO;
|
||||||
|
|
||||||
@Schema(description = "生产单列表")
|
@Schema(description = "生产单列表")
|
||||||
private List<OrderDO> orders;
|
private List<OrderDO> orders;
|
||||||
@@ -39,8 +40,8 @@ public class OrderSource {
|
|||||||
@Schema(description = "小板列表")
|
@Schema(description = "小板列表")
|
||||||
private List<PlateDO> plates;
|
private List<PlateDO> plates;
|
||||||
|
|
||||||
@Schema(description = "小板详情列表")
|
@Schema(description = "小板造型列表")
|
||||||
private List<PlateDetailVO> plateDetails;
|
private List<OrderModelDO> plateModels;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.executor.service.optimizeplan;
|
package com.cf.imes.module.executor.service.optimizeplan;
|
||||||
|
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -19,4 +20,10 @@ public interface OptimizePlanService {
|
|||||||
OptimizeParamRespVO getOptimizePlanParam(Long planId);
|
OptimizeParamRespVO getOptimizePlanParam(Long planId);
|
||||||
|
|
||||||
Map<String, Object> getLabelDataSourceValue(GetSourceDataReq req);
|
Map<String, Object> getLabelDataSourceValue(GetSourceDataReq req);
|
||||||
|
|
||||||
|
OrderSource getOrderSource(Long orderId, Long planId, Long machineId);
|
||||||
|
|
||||||
|
OrderSource getOrderSourceByOrderId(Long orderId);
|
||||||
|
|
||||||
|
OrderSource getOrderSourceByPlanId(Long planId);
|
||||||
}
|
}
|
||||||
|
|||||||
+133
-4
@@ -2,14 +2,28 @@ package com.cf.imes.module.executor.service.optimizeplan;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||||
|
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||||
|
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
|
||||||
|
import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery;
|
||||||
|
import co.elastic.clients.elasticsearch._types.query_dsl.TermsQuery;
|
||||||
|
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||||
|
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||||
|
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
|
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
|
import com.cf.imes.framework.organ.core.db.OrganBaseDO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.dto.Material;
|
import com.cf.imes.module.executor.controller.admin.plan.dto.Material;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailVO;
|
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailVO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.planitem.PlanItemDO;
|
import com.cf.imes.module.executor.dal.dataobject.planitem.PlanItemDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||||
@@ -18,6 +32,7 @@ import com.cf.imes.module.executor.dal.dataobject.remainplaten.PointDTO;
|
|||||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||||
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||||
|
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||||
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
||||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||||
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
||||||
@@ -26,26 +41,29 @@ import com.cf.imes.module.executor.util.RectangleChecker;
|
|||||||
import com.cf.imes.module.infra.api.file.FileApi;
|
import com.cf.imes.module.infra.api.file.FileApi;
|
||||||
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
|
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
|
||||||
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||||
|
import com.cf.imes.module.system.api.machine.MachineApi;
|
||||||
|
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.UNKNOWN;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.UNKNOWN;
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLAN_NOT_EXISTS;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLAN_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author there
|
* @author there
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class OptimizePlanServiceImpl implements OptimizePlanService {
|
public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -69,6 +87,14 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderMapper orderMapper;
|
private OrderMapper orderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ElasticsearchClient elasticsearchClient;
|
||||||
|
|
||||||
|
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MachineApi machineApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlateOptimize> getPlateListByPlanId(Long planId) {
|
public List<PlateOptimize> getPlateListByPlanId(Long planId) {
|
||||||
return planMapper.selectPlateListByPlanId(planId);
|
return planMapper.selectPlateListByPlanId(planId);
|
||||||
@@ -247,5 +273,108 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
return orderMapper.selectDynamicSqlString(sql);
|
return orderMapper.selectDynamicSqlString(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderSource getOrderSource(Long orderId, Long planId, Long machineId) {
|
||||||
|
OrderSource orderSource;
|
||||||
|
if(!Objects.isNull(orderId)) {
|
||||||
|
orderSource = getOrderSourceByOrderId(orderId);
|
||||||
|
orderSource.setMachineDTO(machineApi.getMachineDetail(machineId).getCheckedData());
|
||||||
|
return orderSource;
|
||||||
|
}
|
||||||
|
if(!Objects.isNull(planId)) {
|
||||||
|
orderSource = getOrderSourceByPlanId(planId);
|
||||||
|
orderSource.setMachineDTO(machineApi.getMachineDetail(machineId).getCheckedData());
|
||||||
|
return orderSource;
|
||||||
|
}
|
||||||
|
throw exception(154112,"生产单id或排单id不能空");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderSource getOrderSourceByOrderId(Long orderId) {
|
||||||
|
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||||
|
if(Objects.isNull(orderDO)) {
|
||||||
|
throw exception(ORDER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
OrderSource orderSource = new OrderSource();
|
||||||
|
|
||||||
|
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||||
|
.eq(GoodsDO::getOrderId, orderId)
|
||||||
|
);
|
||||||
|
List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||||
|
.eq(PlateDO::getOrderId, orderId)
|
||||||
|
);
|
||||||
|
List<OrderModelDO> orderModelDOS = buildRespByOrderId(orderId, ORDER_PLATE_MODEL);
|
||||||
|
orderSource.setOrders(Collections.singletonList(orderDO));
|
||||||
|
orderSource.setPlates(plateDOS);
|
||||||
|
orderSource.setGoods(goodsDOS);
|
||||||
|
orderSource.setPlateModels(orderModelDOS);
|
||||||
|
return orderSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderItemMapper orderItemMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderSource getOrderSourceByPlanId(Long planId) {
|
||||||
|
PlanDO planDO = planMapper.selectById(planId);
|
||||||
|
if(Objects.isNull(planDO)) {
|
||||||
|
throw exception(PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
MPJBaseJoin<OrderItemDO> wrapper = new MPJLambdaWrapperX<OrderItemDO>()
|
||||||
|
.select(OrderItemDO::getOrderId)
|
||||||
|
.rightJoin(PlanItemDO.class, PlanItemDO::getItemId, OrderItemDO::getId)
|
||||||
|
.isNotNull(OrderItemDO::getId);
|
||||||
|
Set<Long> orderIds = orderItemMapper.selectJoinList(OrderDO.class, wrapper).stream().map(OrganBaseDO::getOrganId).collect(Collectors.toSet());
|
||||||
|
List<OrderDO> orderDOS = orderMapper.selectBatchIds(orderIds);
|
||||||
|
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderId, orderIds));
|
||||||
|
List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>().in(PlateDO::getOrderId, orderIds));
|
||||||
|
List<OrderModelDO> orderModelDOS = buildRespByOrderIds(orderIds, ORDER_PLATE_MODEL);
|
||||||
|
return OrderSource.builder()
|
||||||
|
.orders(orderDOS)
|
||||||
|
.planDO(planDO)
|
||||||
|
.goods(goodsDOS)
|
||||||
|
.plates(plateDOS)
|
||||||
|
.plateModels(orderModelDOS)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OrderModelDO> buildRespByOrderIds(Collection<Long> orderIds, String index) {
|
||||||
|
List<FieldValue> fieldValues = orderIds.stream().map(FieldValue::of).toList();
|
||||||
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||||
|
builder.index(index);
|
||||||
|
builder.query(q -> q.terms(b -> b.field("orderId").terms(e->e.value(fieldValues))));
|
||||||
|
try {
|
||||||
|
SearchResponse<OrderModelDO> search = elasticsearchClient.search(builder.build(), OrderModelDO.class);
|
||||||
|
List<Hit<OrderModelDO>> hits = search.hits().hits();
|
||||||
|
if (CollectionUtil.isNotEmpty(hits)) {
|
||||||
|
return hits.stream().map(Hit::source).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OrderModelDO> buildRespByOrderId(Long orderId, String index) {
|
||||||
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||||
|
builder.index(index);
|
||||||
|
builder.query(q -> q.term(b -> b.field("orderId").value(orderId)));
|
||||||
|
try {
|
||||||
|
SearchResponse<OrderModelDO> search = elasticsearchClient.search(builder.build(), OrderModelDO.class);
|
||||||
|
List<Hit<OrderModelDO>> hits = search.hits().hits();
|
||||||
|
if (CollectionUtil.isNotEmpty(hits)) {
|
||||||
|
return hits.stream().map(Hit::source).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-25
@@ -2,10 +2,10 @@ package com.cf.imes.module.system.controller.admin.machine;
|
|||||||
|
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
|
||||||
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||||
|
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
||||||
import com.cf.imes.module.system.service.machine.MachineTemplateService;
|
import com.cf.imes.module.system.service.machine.MachineService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -22,48 +22,48 @@ import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
|||||||
* @author Beal
|
* @author Beal
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@Tag(name = "机台模板授权")
|
@Tag(name = "机台授权")
|
||||||
@RequestMapping("/system/machine-template-auth")
|
@RequestMapping("/system/machine-auth")
|
||||||
public class MachineAuthController {
|
public class MachineAuthController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MachineTemplateService machineTemplateService;
|
private MachineService machineService;
|
||||||
|
|
||||||
@PostMapping("organ-auth-template")
|
@PostMapping("organ-auth")
|
||||||
@Operation(summary = "组织模板授权")
|
@Operation(summary = "组织机台授权")
|
||||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
public CommonResult<Boolean> auth(@RequestBody MachineOrgAuthReq vo) {
|
public CommonResult<Boolean> auth(@RequestBody MachineOrgAuthReq vo) {
|
||||||
return success(machineTemplateService.auth(vo));
|
return success(machineService.auth(vo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("organ-template-page")
|
@GetMapping("organ-page")
|
||||||
@Operation(summary = "组织模板授权分页列表")
|
@Operation(summary = "组织机台授权分页列表")
|
||||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
public CommonResult<PageResult<OrganTemplateResp>> organTemplatePage(OrganTemplatePage page) {
|
public CommonResult<PageResult<OrganMachineResp>> organTemplatePage(OrganMachinePage page) {
|
||||||
return success(machineTemplateService.organTemplatePage(page));
|
return success(machineService.organMachinePage(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("organ-template-by-organId")
|
@GetMapping("organ-by-organId")
|
||||||
@Operation(summary = "根据组织id查询组织模板授权")
|
@Operation(summary = "根据组织id查询组织机台授权")
|
||||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
@Parameter(name = "organId", description = "组织id", required = true, example = "1")
|
@Parameter(name = "organId", description = "组织id", required = true, example = "1")
|
||||||
public CommonResult<OrganTemplateResp> organTemplateByOrganId(@RequestParam Long organId ) {
|
public CommonResult<OrganMachineResp> organTemplateByOrganId(@RequestParam Long organId ) {
|
||||||
return success(machineTemplateService.organTemplateByOrganId(organId));
|
return success(machineService.organMachineByOrganId(organId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("page-template-machine-auth")
|
@GetMapping("page-machine-auth")
|
||||||
@Operation(summary = "授权机台模板分页")
|
@Operation(summary = "授权机台分页")
|
||||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
public CommonResult<PageResult<TemplateAutoResp>> pageTemplateAuth(MachinePageReqVO pageParam) {
|
public CommonResult<PageResult<MachineAuthResp>> pageTemplateAuth(MachinePageReqVO pageParam) {
|
||||||
PageResult<MachineTemplateDO> page = machineTemplateService.page(pageParam);
|
PageResult<MachineDO> page = machineService.page(pageParam);
|
||||||
List<TemplateAutoResp> list = page.getList().stream().map(e->TemplateAutoResp.builder()
|
List<MachineAuthResp> list = page.getList().stream().map(e->MachineAuthResp.builder()
|
||||||
.id(e.getId())
|
.id(e.getId())
|
||||||
.machineType(e.getMachineType())
|
.machineType(e.getMachineType())
|
||||||
.templateName(e.getName())
|
.machineName(e.getName())
|
||||||
.isDefault(e.getIsDefault())
|
|
||||||
.build()
|
.build()
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
|
|
||||||
return success(new PageResult<TemplateAutoResp>(list, page.getTotal()));
|
return success(new PageResult<MachineAuthResp>(list, page.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
package com.cf.imes.module.system.controller.admin.machine;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
|
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||||
|
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
||||||
|
import com.cf.imes.module.system.service.machine.MachineTemplateService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "机台模板授权")
|
||||||
|
@RequestMapping("/system/machine-template-auth")
|
||||||
|
public class MachineTemplateAuthController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MachineTemplateService machineTemplateService;
|
||||||
|
|
||||||
|
@PostMapping("organ-auth-template")
|
||||||
|
@Operation(summary = "组织模板授权")
|
||||||
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
|
public CommonResult<Boolean> auth(@RequestBody MachineOrgAuthReq vo) {
|
||||||
|
return success(machineTemplateService.auth(vo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("organ-template-page")
|
||||||
|
@Operation(summary = "组织模板授权分页列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
|
public CommonResult<PageResult<OrganTemplateResp>> organTemplatePage(OrganTemplatePage page) {
|
||||||
|
return success(machineTemplateService.organTemplatePage(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("organ-template-by-organId")
|
||||||
|
@Operation(summary = "根据组织id查询组织模板授权")
|
||||||
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
|
@Parameter(name = "organId", description = "组织id", required = true, example = "1")
|
||||||
|
public CommonResult<OrganTemplateResp> organTemplateByOrganId(@RequestParam Long organId ) {
|
||||||
|
return success(machineTemplateService.organTemplateByOrganId(organId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("page-template-machine-auth")
|
||||||
|
@Operation(summary = "授权机台模板分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
|
public CommonResult<PageResult<TemplateAutoResp>> pageTemplateAuth(MachinePageReqVO pageParam) {
|
||||||
|
PageResult<MachineTemplateDO> page = machineTemplateService.page(pageParam);
|
||||||
|
List<TemplateAutoResp> list = page.getList().stream().map(e->TemplateAutoResp.builder()
|
||||||
|
.id(e.getId())
|
||||||
|
.machineType(e.getMachineType())
|
||||||
|
.templateName(e.getName())
|
||||||
|
.isDefault(e.getIsDefault())
|
||||||
|
.build()
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
|
||||||
|
return success(new PageResult<TemplateAutoResp>(list, page.getTotal()));
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MachineAuthResp {
|
||||||
|
@Schema(description = "机台id")
|
||||||
|
private Long id;
|
||||||
|
@Schema(description = "机台名称")
|
||||||
|
private String machineName;
|
||||||
|
@Schema(description = "机台类别")
|
||||||
|
private Integer machineType;
|
||||||
|
@Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置")
|
||||||
|
private Boolean showPriorFacing = false;
|
||||||
|
@Schema(description = "双工位")
|
||||||
|
private Boolean showDualWorkstation = false;
|
||||||
|
@Schema(description = "自动贴标")
|
||||||
|
private Boolean showAutoNotePrinter = false;
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrganMachinePage extends PageParam {
|
||||||
|
@Schema(description = "组织id")
|
||||||
|
private Long organId;
|
||||||
|
@Schema(description = "机台名称")
|
||||||
|
private String machineName;
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OrganMachineResp {
|
||||||
|
@Schema(description = "组织id")
|
||||||
|
private Long organId;
|
||||||
|
@Schema(description = "组织名称")
|
||||||
|
private String organName;
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||||
|
private Date updateTime;
|
||||||
|
@Schema(description = "机台模板列表")
|
||||||
|
private List<OrganMachineVO> authMachineList;
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrganMachineVO {
|
||||||
|
@Schema(description = "机台id")
|
||||||
|
private Long machineId;
|
||||||
|
@Schema(description = "机台名称")
|
||||||
|
private String machineName;
|
||||||
|
@Schema(description = "机台类型")
|
||||||
|
private Integer machineType;
|
||||||
|
@Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置")
|
||||||
|
private Boolean showPriorFacing;
|
||||||
|
@Schema(description = "双工位")
|
||||||
|
private Boolean showDualWorkstation;
|
||||||
|
@Schema(description = "自动贴标")
|
||||||
|
private Boolean showAutoNotePrinter;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private Long organId;
|
||||||
|
}
|
||||||
+1
-1
@@ -12,7 +12,7 @@ import javax.validation.constraints.Size;
|
|||||||
public class NoticeSaveReqVO {
|
public class NoticeSaveReqVO {
|
||||||
|
|
||||||
@Schema(description = "岗位公告编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
@Schema(description = "岗位公告编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
@NotNull(message = "岗位公告编号不能为空")
|
//@NotNull(message = "岗位公告编号不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "公告标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "小博主")
|
@Schema(description = "公告标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "小博主")
|
||||||
|
|||||||
+18
-1
@@ -1,12 +1,16 @@
|
|||||||
package com.cf.imes.module.system.dal.mysql.machine;
|
package com.cf.imes.module.system.dal.mysql.machine;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.cf.imes.module.system.controller.admin.machine.vo.MachinePageReqVO;
|
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||||
|
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机台 Mapper
|
* 机台 Mapper
|
||||||
@@ -24,4 +28,17 @@ public interface MachineMapper extends BaseMapperX<MachineDO> {
|
|||||||
.orderByDesc(MachineDO::getCreateTime));
|
.orderByDesc(MachineDO::getCreateTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Page<OrganMachineResp> selectOrganMachinePage(@Param("page") Page<OrganMachineResp> respPage, @Param("vo") OrganMachinePage page);
|
||||||
|
|
||||||
|
List<OrganMachineVO> selectOrganMachineList(Map<String, Object> map);
|
||||||
|
|
||||||
|
OrganMachineResp selectOrganMachine(Long organId);
|
||||||
|
|
||||||
|
default PageResult<MachineDO> selectPage(MachinePageReqVO pageParam, Collection<Long> ids) {
|
||||||
|
return selectPage(pageParam, new LambdaQueryWrapperX<MachineDO>()
|
||||||
|
.eqIfPresent(MachineDO::getMachineType, pageParam.getMachineType())
|
||||||
|
.likeIfPresent(MachineDO::getName, pageParam.getName())
|
||||||
|
.betweenIfPresent(MachineDO::getCreateTime, pageParam.getCreateTime())
|
||||||
|
.orderByDesc(MachineDO::getCreateTime));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
+8
@@ -72,4 +72,12 @@ public interface MachineService {
|
|||||||
List<MachineDO> list(Collection<Long> ids);
|
List<MachineDO> list(Collection<Long> ids);
|
||||||
|
|
||||||
Map<Integer, List<MachineVO>> getMachineTree(Long organId);
|
Map<Integer, List<MachineVO>> getMachineTree(Long organId);
|
||||||
|
|
||||||
|
Boolean auth(MachineOrgAuthReq vo);
|
||||||
|
|
||||||
|
PageResult<OrganMachineResp> organMachinePage(OrganMachinePage page);
|
||||||
|
|
||||||
|
OrganMachineResp organMachineByOrganId(Long organId);
|
||||||
|
|
||||||
|
PageResult<MachineDO> page(MachinePageReqVO pageParam);
|
||||||
}
|
}
|
||||||
+47
-1
@@ -10,6 +10,7 @@ import co.elastic.clients.elasticsearch.core.DeleteByQueryRequest;
|
|||||||
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.cf.imes.framework.es.core.dal.ESDocument;
|
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@@ -25,13 +26,13 @@ import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateL
|
|||||||
import com.cf.imes.module.system.dal.mysql.machine.MachineMapper;
|
import com.cf.imes.module.system.dal.mysql.machine.MachineMapper;
|
||||||
import com.cf.imes.module.system.dal.mysql.machine.MachineLimitMapper;
|
import com.cf.imes.module.system.dal.mysql.machine.MachineLimitMapper;
|
||||||
import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateLimitMapper;
|
import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateLimitMapper;
|
||||||
import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateMapper;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -251,6 +252,51 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean auth(MachineOrgAuthReq vo) {
|
||||||
|
machineLimitMapper.delete(new LambdaQueryWrapperX<MachineLimitDO>().eq(MachineLimitDO::getOrganId, vo.getOrganId()));
|
||||||
|
|
||||||
|
List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||||
|
|
||||||
|
if(CollectionUtil.isNotEmpty(machineAuthList)) {
|
||||||
|
List<MachineLimitDO> organMachineDOS = new ArrayList<>();
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
for (MachineAuth machineAuth : machineAuthList) {
|
||||||
|
organMachineDOS.add(
|
||||||
|
MachineLimitDO.builder()
|
||||||
|
.createTime(now)
|
||||||
|
.organId(vo.getOrganId())
|
||||||
|
.machineId(machineAuth.getMachineId())
|
||||||
|
.showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||||
|
.showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||||
|
.showPriorFacing(machineAuth.getShowPriorFacing())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
machineLimitMapper.insertBatch(organMachineDOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<OrganMachineResp> organMachinePage(OrganMachinePage page) {
|
||||||
|
Page<OrganMachineResp> respPage = new Page<>(page.getPageNo(), page.getPageSize());
|
||||||
|
Page<OrganMachineResp> pageRes = machineMapper.selectOrganMachinePage(respPage, page);
|
||||||
|
return new PageResult<>(pageRes.getRecords(), pageRes.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrganMachineResp organMachineByOrganId(Long organId) {
|
||||||
|
return machineMapper.selectOrganMachine(organId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MachineDO> page(MachinePageReqVO pageParam) {
|
||||||
|
return machineMapper.selectPage(pageParam, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
private void validateExists(Long id) {
|
private void validateExists(Long id) {
|
||||||
if (machineMapper.selectById(id) == null) {
|
if (machineMapper.selectById(id) == null) {
|
||||||
throw exception(MACHINE_NOT_EXISTS);
|
throw exception(MACHINE_NOT_EXISTS);
|
||||||
|
|||||||
+3
-3
@@ -65,7 +65,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
private MachineTemplateMapper machineTemplateMapper;
|
private MachineTemplateMapper machineTemplateMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MachineTemplateLimitMapper organMachineMapper;
|
private MachineTemplateLimitMapper machineTemplateLimitMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -323,7 +323,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean auth(MachineOrgAuthReq vo) {
|
public Boolean auth(MachineOrgAuthReq vo) {
|
||||||
organMachineMapper.delete(new LambdaQueryWrapperX<MachineTemplateLimitDO>().eq(MachineTemplateLimitDO::getOrganId, vo.getOrganId()));
|
machineTemplateLimitMapper.delete(new LambdaQueryWrapperX<MachineTemplateLimitDO>().eq(MachineTemplateLimitDO::getOrganId, vo.getOrganId()));
|
||||||
|
|
||||||
List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
organMachineMapper.insertBatch(organMachineDOS);
|
machineTemplateLimitMapper.insertBatch(organMachineDOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
|
|||||||
+77
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.cf.imes.module.system.dal.mysql.machine.MachineMapper">
|
||||||
|
|
||||||
|
<resultMap id="xxMap" type="com.cf.imes.module.system.controller.admin.machine.vo.OrganMachineResp">
|
||||||
|
<result property="organId" column="organId"/>
|
||||||
|
<result property="organName" column="organName"/>
|
||||||
|
<result property="updateTime" column="updateTime"/>
|
||||||
|
<collection property="authMachineList" javaType="java.util.List" ofType="com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateVO"
|
||||||
|
select="selectOrganMachineList" column="{organId=organId, machineName = machineName}" notNullColumn="machineName" >
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="orgMap" type="com.cf.imes.module.system.controller.admin.machine.vo.OrganMachineResp">
|
||||||
|
<result property="organId" column="organId"/>
|
||||||
|
<result property="organName" column="organName"/>
|
||||||
|
<result property="updateTime" column="updateTime"/>
|
||||||
|
<collection property="authMachineList" javaType="java.util.List" ofType="com.cf.imes.module.system.controller.admin.machine.vo.OrganMachineVO"
|
||||||
|
select="selectOrganMachineList" column="{organId=organId}" >
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectOrganMachinePage" resultMap="xxMap">
|
||||||
|
select * from (
|
||||||
|
select a.id as organId, a.name as organName, max(b.create_time) as updateTime,
|
||||||
|
case when ('${vo.machineName}' != '') then '${vo.machineName}' else '' end as machineName
|
||||||
|
from system_organization a, system_machine_limit b
|
||||||
|
<where>
|
||||||
|
a.id = b.organ_id
|
||||||
|
<if test="vo.organId !=null">
|
||||||
|
and a.id = #{vo.organId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY organId
|
||||||
|
) t1
|
||||||
|
LEFT JOIN (
|
||||||
|
select b.organ_id t2_organId
|
||||||
|
from system_machine_limit b inner join system_machine c on b.machine_id = c.id and c.deleted = 0
|
||||||
|
<where>
|
||||||
|
<if test="vo.machineName !=null and vo.machineName !='' " >
|
||||||
|
c.name like concat('%',#{vo.machineName},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
) t2 on t1.organId = t2.t2_organId
|
||||||
|
where t2.t2_organId is not null
|
||||||
|
GROUP BY organId
|
||||||
|
order by updateTime desc
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectOrganMachineList"
|
||||||
|
resultType="com.cf.imes.module.system.controller.admin.machine.vo.OrganMachineVO">
|
||||||
|
select b.organ_id organId, b.show_prior_facing, b.show_dual_workstation, b.show_auto_note_printer,
|
||||||
|
c.name AS machineName, c.id AS machineId, c.machine_type
|
||||||
|
from system_machine_limit b
|
||||||
|
inner join system_machine c on b.machine_id = c.id and c.deleted = 0
|
||||||
|
<where>
|
||||||
|
b.organ_id = #{organId}
|
||||||
|
<if test="machineName != null and machineName != ''">
|
||||||
|
and c.name like concat('%',#{machineName},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectOrganMachine" resultMap="orgMap">
|
||||||
|
select a.id as organId, a.name as organName, max(b.create_time) as updateTime
|
||||||
|
from system_organization a, system_machine_limit b
|
||||||
|
<where>
|
||||||
|
a.id = b.organ_id
|
||||||
|
and a.id = #{vo.organId}
|
||||||
|
</where>
|
||||||
|
GROUP BY organId
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user