mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
添加查询标签数据源value接口
This commit is contained in:
+4
-2
@@ -4,6 +4,7 @@ import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
|||||||
import com.cf.imes.module.infra.service.logger.ApiAccessLogService;
|
import com.cf.imes.module.infra.service.logger.ApiAccessLogService;
|
||||||
/*import com.xxl.job.core.handler.annotation.XxlJob;*/
|
/*import com.xxl.job.core.handler.annotation.XxlJob;*/
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -30,11 +31,12 @@ public class AccessLogCleanJob {
|
|||||||
*/
|
*/
|
||||||
private static final Integer DELETE_LIMIT = 100;
|
private static final Integer DELETE_LIMIT = 100;
|
||||||
|
|
||||||
/* @XxlJob("accessLogCleanJob")
|
/* @XxlJob("accessLogCleanJob")*/
|
||||||
@OrganIgnore
|
@OrganIgnore
|
||||||
|
/* @Scheduled(cron = "0 0 * * * ?")*/
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Integer count = apiAccessLogService.cleanAccessLog(JOB_CLEAN_RETAIN_DAY, DELETE_LIMIT);
|
Integer count = apiAccessLogService.cleanAccessLog(JOB_CLEAN_RETAIN_DAY, DELETE_LIMIT);
|
||||||
log.info("[execute][定时执行清理访问日志数量 ({}) 个]", count);
|
log.info("[execute][定时执行清理访问日志数量 ({}) 个]", count);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -4,6 +4,7 @@ import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
|||||||
import com.cf.imes.module.infra.service.logger.ApiErrorLogService;
|
import com.cf.imes.module.infra.service.logger.ApiErrorLogService;
|
||||||
/*import com.xxl.job.core.handler.annotation.XxlJob;*/
|
/*import com.xxl.job.core.handler.annotation.XxlJob;*/
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -30,11 +31,12 @@ public class ErrorLogCleanJob {
|
|||||||
*/
|
*/
|
||||||
private static final Integer DELETE_LIMIT = 100;
|
private static final Integer DELETE_LIMIT = 100;
|
||||||
|
|
||||||
/* @XxlJob("errorLogCleanJob")
|
/*@XxlJob("errorLogCleanJob")*/
|
||||||
@OrganIgnore
|
@OrganIgnore
|
||||||
|
/*@Scheduled(cron = "0 0 2 * * ?")*/
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Integer count = apiErrorLogService.cleanErrorLog(JOB_CLEAN_RETAIN_DAY,DELETE_LIMIT);
|
Integer count = apiErrorLogService.cleanErrorLog(JOB_CLEAN_RETAIN_DAY,DELETE_LIMIT);
|
||||||
log.info("[execute][定时执行清理错误日志数量 ({}) 个]", count);
|
log.info("[execute][定时执行清理错误日志数量 ({}) 个]", count);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -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.framework.operatelog.core.annotations.OperateLog;
|
||||||
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.service.optimizeplan.OptimizePlanService;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -16,6 +17,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author there
|
* @author there
|
||||||
@@ -86,4 +88,12 @@ public class OptimizePlanController {
|
|||||||
return CommonResult.success(optimizePlanParam);
|
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));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+24
@@ -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;
|
||||||
|
}
|
||||||
+2
@@ -17,6 +17,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产单表 order_{N} Mapper
|
* 生产单表 order_{N} Mapper
|
||||||
@@ -88,4 +89,5 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
|||||||
return selectList(wrapper);
|
return selectList(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> selectDynamicSqlString(String sql);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.executor.framework.rpc.config;
|
package com.cf.imes.module.executor.framework.rpc.config;
|
||||||
|
|
||||||
import com.cf.imes.module.infra.api.file.FileApi;
|
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.machine.MachineApi;
|
||||||
import com.cf.imes.module.system.api.user.AdminUserApi;
|
import com.cf.imes.module.system.api.user.AdminUserApi;
|
||||||
import com.cf.imes.module.system.api.dict.DictDataApi;
|
import com.cf.imes.module.system.api.dict.DictDataApi;
|
||||||
@@ -11,6 +12,6 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
* @author there
|
* @author there
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@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 {
|
public class RpcConfiguration {
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.service.optimizeplan;
|
|||||||
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;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface OptimizePlanService {
|
public interface OptimizePlanService {
|
||||||
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
||||||
@@ -16,4 +17,6 @@ public interface OptimizePlanService {
|
|||||||
OptimizeParamResVO getOptimizeParam(Long planId);
|
OptimizeParamResVO getOptimizeParam(Long planId);
|
||||||
|
|
||||||
OptimizeParamRespVO getOptimizePlanParam(Long planId);
|
OptimizeParamRespVO getOptimizePlanParam(Long planId);
|
||||||
|
|
||||||
|
Map<String, Object> getLabelDataSourceValue(GetSourceDataReq req);
|
||||||
}
|
}
|
||||||
|
|||||||
+14
@@ -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.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.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;
|
||||||
@@ -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.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.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -61,6 +63,12 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
@Resource
|
@Resource
|
||||||
private GoodsMapper goodsMapper;
|
private GoodsMapper goodsMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataSourceApi dataSourceApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderMapper orderMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlateOptimize> getPlateListByPlanId(Long planId) {
|
public List<PlateOptimize> getPlateListByPlanId(Long planId) {
|
||||||
return planMapper.selectPlateListByPlanId(planId);
|
return planMapper.selectPlateListByPlanId(planId);
|
||||||
@@ -226,5 +234,11 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
return optimizePlanParam;
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -12,4 +12,8 @@
|
|||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
group by orderId, p.id
|
group by orderId, p.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDynamicSqlString" resultType="java.util.Map">
|
||||||
|
${sqlStr}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.cf.imes.module.system.api.dataSource;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.module.system.enums.ApiConstants;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
|
||||||
|
@Tag(name = "RPC 服务 - 数据源")
|
||||||
|
public interface DataSourceApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/dataSource";
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getSqlById")
|
||||||
|
@Operation(summary = "获得数据源sql")
|
||||||
|
CommonResult<String> getSqlById(@RequestParam(value = "id") Long id);
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package com.cf.imes.module.system.api.datasource;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||||
|
import com.cf.imes.module.system.dal.dataobject.datasource.DataSourceDO;
|
||||||
|
import com.cf.imes.module.system.dal.mysql.datasource.DataSourceMapper;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class DataSourceApiImpl implements DataSourceApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataSourceMapper dataSourceMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<String> getSqlById(Long id) {
|
||||||
|
DataSourceDO dataSourceDO = dataSourceMapper.selectById(id);
|
||||||
|
if(Objects.isNull(dataSourceDO)) {
|
||||||
|
throw exception(new ErrorCode(2133,"数据源不存在"));
|
||||||
|
}
|
||||||
|
return CommonResult.success(dataSourceDO.getSqlStr()) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -19,7 +19,7 @@ public class DataSourcePageReqVO extends PageParam {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "sql")
|
@Schema(description = "sql")
|
||||||
private String sql;
|
private String sqlStr;
|
||||||
|
|
||||||
@Schema(description = "数据源类型", example = "2")
|
@Schema(description = "数据源类型", example = "2")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ public class DataSourceRespVO {
|
|||||||
|
|
||||||
@Schema(description = "sql", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "sql", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("sql")
|
@ExcelProperty("sql")
|
||||||
private String sql;
|
private String sqlStr;
|
||||||
|
|
||||||
@Schema(description = "数据源类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
@Schema(description = "数据源类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
@ExcelProperty("数据源类型")
|
@ExcelProperty("数据源类型")
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ public class DataSourceDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* sql
|
* sql
|
||||||
*/
|
*/
|
||||||
private String sql;
|
private String sqlStr;
|
||||||
/**
|
/**
|
||||||
* 数据源类型
|
* 数据源类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ public interface DataSourceMapper extends BaseMapperX<DataSourceDO> {
|
|||||||
default PageResult<DataSourceDO> selectPage(DataSourcePageReqVO reqVO) {
|
default PageResult<DataSourceDO> selectPage(DataSourcePageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<DataSourceDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<DataSourceDO>()
|
||||||
.likeIfPresent(DataSourceDO::getName, reqVO.getName())
|
.likeIfPresent(DataSourceDO::getName, reqVO.getName())
|
||||||
.eqIfPresent(DataSourceDO::getSql, reqVO.getSql())
|
.eqIfPresent(DataSourceDO::getSqlStr, reqVO.getSqlStr())
|
||||||
.eqIfPresent(DataSourceDO::getType, reqVO.getType())
|
.eqIfPresent(DataSourceDO::getType, reqVO.getType())
|
||||||
.betweenIfPresent(DataSourceDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(DataSourceDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.orderByDesc(DataSourceDO::getId));
|
.orderByDesc(DataSourceDO::getId));
|
||||||
|
|||||||
Reference in New Issue
Block a user