添加查询标签数据源value接口

This commit is contained in:
yangsb
2024-04-03 16:15:21 +08:00
parent e08dc9324c
commit b0dfc889ff
15 changed files with 123 additions and 9 deletions
@@ -4,6 +4,7 @@ import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService;
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -16,6 +17,7 @@ import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
* @author there
@@ -86,4 +88,12 @@ public class OptimizePlanController {
return CommonResult.success(optimizePlanParam);
}
@GetMapping("/getLabelDataSourceValue")
@Operation(summary = "获取标签数据源value")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<Map<String,Object>> getLabelDataSourceValue(@Valid GetSourceDataReq req ) {
return CommonResult.success( optimizePlanService.getLabelDataSourceValue(req));
}
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author Beal
*/
@Data
@Schema(description = "")
public class GetSourceDataReq {
@Schema(description = "生产单id")
@NotNull(message = "生产单id不能空")
private Long orderId;
@Schema(description = "排单id")
private Long planId;
@Schema(description = "数据源id")
@NotNull(message = "数据源id不能空")
private Long dataSourceId;
}
@@ -17,6 +17,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 生产单表 order_{N} Mapper
@@ -88,4 +89,5 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
return selectList(wrapper);
}
Map<String, Object> selectDynamicSqlString(String sql);
}
@@ -1,6 +1,7 @@
package com.cf.imes.module.executor.framework.rpc.config;
import com.cf.imes.module.infra.api.file.FileApi;
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
import com.cf.imes.module.system.api.machine.MachineApi;
import com.cf.imes.module.system.api.user.AdminUserApi;
import com.cf.imes.module.system.api.dict.DictDataApi;
@@ -11,6 +12,6 @@ import org.springframework.context.annotation.Configuration;
* @author there
*/
@Configuration(proxyBeanMethods = false)
@EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class, DictDataApi.class, FileApi.class})
@EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class, DictDataApi.class, FileApi.class, DataSourceApi.class})
public class RpcConfiguration {
}
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.service.optimizeplan;
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
import java.util.List;
import java.util.Map;
public interface OptimizePlanService {
List<PlateOptimize> getPlateListByPlanId(Long planId);
@@ -16,4 +17,6 @@ public interface OptimizePlanService {
OptimizeParamResVO getOptimizeParam(Long planId);
OptimizeParamRespVO getOptimizePlanParam(Long planId);
Map<String, Object> getLabelDataSourceValue(GetSourceDataReq req);
}
@@ -17,6 +17,7 @@ import com.cf.imes.module.executor.dal.dataobject.remainplaten.OutlineDTO;
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.mysql.goods.GoodsMapper;
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
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.remainplaten.RemainPlateMapper;
@@ -24,6 +25,7 @@ import com.cf.imes.module.executor.util.RandomUtils;
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.dto.FileCreateReqDTO;
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.stereotype.Service;
@@ -61,6 +63,12 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
@Resource
private GoodsMapper goodsMapper;
@Resource
private DataSourceApi dataSourceApi;
@Resource
private OrderMapper orderMapper;
@Override
public List<PlateOptimize> getPlateListByPlanId(Long planId) {
return planMapper.selectPlateListByPlanId(planId);
@@ -226,5 +234,11 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
return optimizePlanParam;
}
@Override
public Map<String, Object> getLabelDataSourceValue(GetSourceDataReq req) {
String sqlStr = dataSourceApi.getSqlById(req.getDataSourceId()).getCheckedData();
return orderMapper.selectDynamicSqlString(String.format(sqlStr, req.getOrderId()));
}
}
@@ -12,4 +12,8 @@
${ew.customSqlSegment}
group by orderId, p.id
</select>
<select id="selectDynamicSqlString" resultType="java.util.Map">
${sqlStr}
</select>
</mapper>