mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1.新增用户模板授权分页列表接口,2.mock获取优化排单参数接口
This commit is contained in:
+7
-4
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.controller.admin.plan;
|
|||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
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.dto.Metrial;
|
||||||
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.executor.util.RandomUtils;
|
import com.cf.imes.module.executor.util.RandomUtils;
|
||||||
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,14 +79,15 @@ public class OptimizePlanController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getOptimizePlanParam")
|
@GetMapping("/getOptimizePlanParam")
|
||||||
@Operation(summary = "获取优化排单参数 (未完成)")
|
@Operation(summary = "获取优化排单参数 (mock)")
|
||||||
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
||||||
@Parameter(name = "planId", description = "排单id", required = false)
|
@Parameter(name = "planId", description = "排单id", required = false)
|
||||||
public CommonResult<OptimizeParamRespVO> getOptimizePlanParam (@RequestParam (required = false) Long planId) {
|
public CommonResult<OptimizeParamRespVO> getOptimizePlanParam (@RequestParam (required = false) Long planId) {
|
||||||
OptimizeParamRespVO data = RandomUtils.randomPojo(OptimizeParamRespVO.class);
|
/* OptimizeParamRespVO data = RandomUtils.randomPojo(OptimizeParamRespVO.class);
|
||||||
return CommonResult.success(data);
|
return CommonResult.success(data);*/
|
||||||
//todo
|
//todo
|
||||||
//return CommonResult.success(optimizePlanService.getOptimizePlanParam(planId));
|
OptimizeParamRespVO optimizePlanParam = optimizePlanService.getOptimizePlanParam(planId);
|
||||||
|
return CommonResult.success(optimizePlanParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -5,8 +5,10 @@ import com.cf.imes.module.executor.controller.admin.plan.dto.Metrial;
|
|||||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -20,6 +22,8 @@ import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class OptimizeParamRespVO {
|
public class OptimizeParamRespVO {
|
||||||
@Schema(description = "排单id")
|
@Schema(description = "排单id")
|
||||||
private Long planId;
|
private Long planId;
|
||||||
|
|||||||
+19
@@ -1,11 +1,14 @@
|
|||||||
package com.cf.imes.module.executor.service.optimizeplan;
|
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.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
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.module.executor.controller.admin.plan.dto.Metrial;
|
||||||
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.dal.dataobject.goods.GoodsDO;
|
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||||
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.plan.PlanDO;
|
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||||
@@ -18,6 +21,7 @@ import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
|||||||
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;
|
||||||
|
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;
|
||||||
@@ -205,6 +209,21 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
|
|
||||||
OptimizeParamRespVO optimizePlanParam = planMapper.getOptimizePlanParam(planId);
|
OptimizeParamRespVO optimizePlanParam = planMapper.getOptimizePlanParam(planId);
|
||||||
|
|
||||||
|
if(Objects.isNull(optimizePlanParam)) {
|
||||||
|
return RandomUtils.randomPojo(OptimizeParamRespVO.class);
|
||||||
|
}
|
||||||
|
//暂时先mock
|
||||||
|
ArrayList<Metrial> list = new ArrayList<>();
|
||||||
|
list.add(RandomUtils.randomPojo(Metrial.class));
|
||||||
|
list.add(RandomUtils.randomPojo(Metrial.class));
|
||||||
|
ArrayList<PlateDetailVO> plateDetailVOS = new ArrayList<>();
|
||||||
|
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
|
||||||
|
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
|
||||||
|
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
|
||||||
|
if( CollectionUtil.isNotEmpty(optimizePlanParam.getPlateList())) {
|
||||||
|
optimizePlanParam.getPlateList().get(0).setPlateDetailList(plateDetailVOS);
|
||||||
|
}
|
||||||
|
optimizePlanParam.setMetrialList(list);
|
||||||
return optimizePlanParam;
|
return optimizePlanParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+53
-25
@@ -20,25 +20,26 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="optimizeMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamRespVO">
|
<resultMap id="optimizeMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamRespVO">
|
||||||
<result column="planId" property="planId"/>
|
<result column="plan_id" property="planId"/>
|
||||||
<result column="plan_no" property="planNo"/>
|
<result column="plan_no" property="planNo"/>
|
||||||
<result column="sort" property="sort"/>
|
<result column="sort" property="sort"/>
|
||||||
<result column="type" property="type"/>
|
<result column="op_type" property="type"/>
|
||||||
<result column="status" property="status"/>
|
<result column="op_status" property="status"/>
|
||||||
<result column="is_pay" property="isPay"/>
|
|
||||||
<result column="machine_id" property="machineId"/>
|
<result column="machine_id" property="machineId"/>
|
||||||
<result column="plan_time" property="planTime"/>
|
<result column="plan_time" property="planTime"/>
|
||||||
<result column="remark" property="remark"/>
|
<result column="op_remark" property="remark"/>
|
||||||
<collection property="goodsList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.goods.vo.GoodsRespVO"/>
|
<result column="produce_time" property="produceTime" />
|
||||||
<collection property="orderList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderResp"/>
|
<result column="operator" property="operator"/>
|
||||||
<collection property="plateList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO" >
|
<collection property="plateList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO" >
|
||||||
<result column="plateId" property="id"/>
|
<result column="plateId" property="id"/>
|
||||||
<result column="plan_no" property="plateNo"/>
|
<result column="plan_no" property="plateNo"/>
|
||||||
<result column="type" property="type"/>
|
<result column="opl_order_id" property="orderId"/>
|
||||||
<result column="goods_id" property="goodsId"/>
|
<result column="opl_type" property="type"/>
|
||||||
<result column="width" property="width"/>
|
<result column="opl_name" property="name"/>
|
||||||
<result column="height" property="height"/>
|
<result column="opl_goods_id" property="goodsId"/>
|
||||||
<result column="thickness" property="thickness"/>
|
<result column="opl_width" property="width"/>
|
||||||
|
<result column="opl_height" property="height"/>
|
||||||
|
<result column="opl_thickness" property="thickness"/>
|
||||||
<result column="split_width" property="splitWidth"/>
|
<result column="split_width" property="splitWidth"/>
|
||||||
<result column="split_height" property="splitHeight"/>
|
<result column="split_height" property="splitHeight"/>
|
||||||
<result column="split_thickness" property="splitThickness"/>
|
<result column="split_thickness" property="splitThickness"/>
|
||||||
@@ -54,21 +55,58 @@
|
|||||||
<result property="frontHoleCount" column="front_hole_count"/>
|
<result property="frontHoleCount" column="front_hole_count"/>
|
||||||
<result property="backHoleCount" column="back_hole_count"/>
|
<result property="backHoleCount" column="back_hole_count"/>
|
||||||
<result property="sideHoleCount" column="side_hole_count"/>
|
<result property="sideHoleCount" column="side_hole_count"/>
|
||||||
|
<result property="frontModelCount" column="front_model_count"/>
|
||||||
<result property="backModelCount" column="back_model_count"/>
|
<result property="backModelCount" column="back_model_count"/>
|
||||||
<result property="isDoor" column="is_door"/>
|
<result property="isDoor" column="is_door"/>
|
||||||
<result property="openDoorType" column="open_door_type"/>
|
<result property="openDoorType" column="open_door_type"/>
|
||||||
<result property="offsetX" column="offset_x"/>
|
<result property="offsetX" column="offset_x"/>
|
||||||
<result property="offsetY" column="offset_y"/>
|
<result property="offsetY" column="offset_y"/>
|
||||||
<result property="isArcAcross" column="is_arc_across"/>
|
<result property="isArcAcross" column="is_arc_across"/>
|
||||||
<result property="moduleTypeId" column="module_typeId"/>
|
<result property="moduleTypeId" column="module_type_id"/>
|
||||||
<result property="filterType" column="filter_type"/>
|
|
||||||
<result property="filterType" column="filter_type"/>
|
<result property="filterType" column="filter_type"/>
|
||||||
<result property="isCancel" column="is_cancel"/>
|
<result property="isCancel" column="is_cancel"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="remark" column="opl_remark"/>
|
||||||
|
<result property="createTime" column="opl_create_time"/>
|
||||||
</collection>
|
</collection>
|
||||||
|
<collection property="orderList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderResp">
|
||||||
|
<result property="orderId" column="o_id"/>
|
||||||
|
<result property="type" column="o_type"/>
|
||||||
|
<result property="status" column="o_status"/>
|
||||||
|
<result property="dataType" column="data_type"/>
|
||||||
|
<result property="customOrderNo" column="custom_order_no"/>
|
||||||
|
<result column="customer" property="customer"/>
|
||||||
|
<result column="address" property="address"/>
|
||||||
|
<result column="phone_number" property="phoneNumber"/>
|
||||||
|
<result column="dealer" property="dealer"/>
|
||||||
|
<result column="dealer_phone_number" property="dealerPhoneNumber"/>
|
||||||
|
<result column="salesman" property="salesman"/>
|
||||||
|
<result column="splitter" property="splitter"/>
|
||||||
|
<result column="o_status" property="status"/>
|
||||||
|
<result column="delivery_date" property="deliveryDate"/>
|
||||||
|
<result column="o_remark" property="remark"/>
|
||||||
|
</collection>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getOptimizePlanParam" resultMap="optimizeMap">
|
||||||
|
select op.id as plan_id, op.plan_no, op.type as op_type, op.status as op_status, op.machine_id, op.plan_time, op.produce_time, op.remark as op_remark, op.operator,
|
||||||
|
oi.order_id, opl.id as plateId, opl.order_id opl_order_id, opl.name opl_name, opl.plate_no, opl.type as opl_type, opl.goods_id as opl_goods_id, opl.width opl_width,
|
||||||
|
opl.height opl_height, opl.thickness as opl_thickness, opl.split_width, opl.split_height, opl.split_thickness, opl.seal_left, opl.seal_right,
|
||||||
|
opl.seal_up, opl.seal_down, opl.area, opl.texture, opl.hole_face, opl.hole_arrange, opl.unregular_point_count, opl.front_hole_count,
|
||||||
|
opl.back_hole_count, opl.side_hole_count, opl.front_model_count, opl.back_model_count, opl.is_door, opl.open_door_type, opl.offset_x, opl.offset_y,
|
||||||
|
opl.is_arc_across, opl.module_type_id, opl.filter_type, opl.remark opl_remark, opl.is_cancel, opl.create_time as opl_create_time,
|
||||||
|
o.id as o_id, o.type as o_type, o.data_type, o.status o_status, o.custom_order_no, o.customer,
|
||||||
|
o.address, o.phone_number, o.dealer, o.dealer_phone_number, o.salesman, o.splitter, o.remark as o_remark, o.delivery_date
|
||||||
|
from order_plan op
|
||||||
|
left JOIN order_plan_item opi on op.id = opi.plan_id
|
||||||
|
left join order_item oi on opi.item_id = oi.id
|
||||||
|
left join order_plate opl on oi.plate_id = opl.id
|
||||||
|
left join `order` o on oi.order_id = o.id
|
||||||
|
where op.id = #{planId}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectPlateListByPlanId"
|
<select id="selectPlateListByPlanId"
|
||||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize">
|
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize">
|
||||||
select a.goods_id, a.goods_name, a.material, a.color, a.width, a.height, a.thickness, count(b.id) as plateNum, d.*
|
select a.goods_id, a.goods_name, a.material, a.color, a.width, a.height, a.thickness, count(b.id) as plateNum, d.*
|
||||||
@@ -81,14 +119,4 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getOptimizePlanParam" resultMap="optimizeMap">
|
|
||||||
select op.*, oi.order_id, opl.id as plateId, opl.*, og.*
|
|
||||||
from order_plan op
|
|
||||||
left JOIN order_plan_item opi on op.id = opi.plan_id
|
|
||||||
left join order_item oi on opi.item_id = oi.id
|
|
||||||
left join order_plate opl on oi.plate_id = opl.id
|
|
||||||
left join order_goods og on opl.goods_id = og.goods_id
|
|
||||||
where op.id = #{planId}
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
+8
@@ -125,4 +125,12 @@ public class MachineTemplateController {
|
|||||||
return success(machineTemplateService.auth(vo));
|
return success(machineTemplateService.auth(vo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("auth-template-page")
|
||||||
|
@Operation(summary = "用户模板授权分页列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
|
public CommonResult<PageResult<AuthTemplateResp>> authTemplatePage(AuthTemplatePage page) {
|
||||||
|
return success(machineTemplateService.authTemplatePage(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
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 AuthTemplatePage extends PageParam {
|
||||||
|
@Schema(description = "组织id")
|
||||||
|
private Long organId;
|
||||||
|
@Schema(description = "用户昵称")
|
||||||
|
private String nickname;
|
||||||
|
@Schema(description = "机台模板名称")
|
||||||
|
private String templateName;
|
||||||
|
}
|
||||||
+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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class AuthTemplateResp {
|
||||||
|
@Schema(description = "组织id")
|
||||||
|
private Long organId;
|
||||||
|
@Schema(description = "组织名称")
|
||||||
|
private String organName;
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
@Schema(description = "用户昵称")
|
||||||
|
private String nickname;
|
||||||
|
@Schema(description = "机台模板列表")
|
||||||
|
private List<AutoTemplateVO> authTemplateList;
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
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 AutoTemplateVO {
|
||||||
|
@Schema(description = "机台模板id")
|
||||||
|
private Long templateId;
|
||||||
|
@Schema(description = "机台模板名称")
|
||||||
|
private String templateName;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private Long userId;
|
||||||
|
}
|
||||||
-1
@@ -14,6 +14,5 @@ public class MachineAuthVO {
|
|||||||
@NotNull(message = "用户id不能空")
|
@NotNull(message = "用户id不能空")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@NotEmpty(message = "机台配置id不能空")
|
|
||||||
private List<Long> machinesIds;
|
private List<Long> machinesIds;
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -20,5 +20,4 @@ public class UserMachineDO {
|
|||||||
private Long id;
|
private Long id;
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private Long machineId;
|
private Long machineId;
|
||||||
private Long organId;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+11
@@ -1,14 +1,21 @@
|
|||||||
package com.cf.imes.module.system.dal.mysql.machinetemplate;
|
package com.cf.imes.module.system.dal.mysql.machinetemplate;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
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.mapper.BaseMapperX;
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.cf.imes.module.system.controller.admin.machine.vo.AuthTemplatePage;
|
||||||
|
import com.cf.imes.module.system.controller.admin.machine.vo.AuthTemplateResp;
|
||||||
|
import com.cf.imes.module.system.controller.admin.machine.vo.AutoTemplateVO;
|
||||||
import com.cf.imes.module.system.controller.admin.machine.vo.MachinePageReqVO;
|
import com.cf.imes.module.system.controller.admin.machine.vo.MachinePageReqVO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
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;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author there
|
* @author there
|
||||||
@@ -24,4 +31,8 @@ public interface MachineTemplateMapper extends BaseMapperX<MachineTemplateDO> {
|
|||||||
.betweenIfPresent(MachineTemplateDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(MachineTemplateDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.orderByDesc(MachineTemplateDO::getCreateTime));
|
.orderByDesc(MachineTemplateDO::getCreateTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Page<AuthTemplateResp> selectAuthTemplatePage(@Param("page") IPage<AuthTemplateResp> authTemplateRespPage, @Param("vo") AuthTemplatePage page);
|
||||||
|
|
||||||
|
List<AutoTemplateVO> selectAuthTemplateList(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -44,4 +44,6 @@ public interface MachineTemplateService {
|
|||||||
DrillTemplateRespVO getDefaultDrill();
|
DrillTemplateRespVO getDefaultDrill();
|
||||||
|
|
||||||
Map<Integer, List<MachineTemplateDO>> getMachineTemplateTree();
|
Map<Integer, List<MachineTemplateDO>> getMachineTemplateTree();
|
||||||
|
|
||||||
|
PageResult<AuthTemplateResp> authTemplatePage(AuthTemplatePage page);
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-7
@@ -10,6 +10,9 @@ 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.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.es.core.dal.ESDocument;
|
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||||
@@ -23,8 +26,10 @@ import com.cf.imes.module.system.dal.dataobject.machine.UserMachineDO;
|
|||||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO;
|
import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.DrillTemplateMachineDO;
|
import com.cf.imes.module.system.dal.dataobject.machinetemplate.DrillTemplateMachineDO;
|
||||||
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.dal.dataobject.user.AdminUserDO;
|
||||||
import com.cf.imes.module.system.dal.mysql.machine.UserMachineMapper;
|
import com.cf.imes.module.system.dal.mysql.machine.UserMachineMapper;
|
||||||
import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateMapper;
|
import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateMapper;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -257,6 +262,13 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<AuthTemplateResp> authTemplatePage(AuthTemplatePage page) {
|
||||||
|
Page<AuthTemplateResp> respPage = new Page<>(page.getPageNo(), page.getPageSize());
|
||||||
|
Page<AuthTemplateResp> pageRes = machineTemplateMapper.selectAuthTemplatePage(respPage, page);
|
||||||
|
return new PageResult<>(pageRes.getRecords(),pageRes.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteCuttingTemplate(Long id) {
|
public Boolean deleteCuttingTemplate(Long id) {
|
||||||
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
||||||
@@ -301,14 +313,16 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean auth(MachineAuthVO vo) {
|
public Boolean auth(MachineAuthVO vo) {
|
||||||
userMachineMapper.delete(new LambdaQueryWrapperX<UserMachineDO>().eq(UserMachineDO::getUserId, vo.getUserId()));
|
userMachineMapper.delete(new LambdaQueryWrapperX<UserMachineDO>().eq(UserMachineDO::getUserId, vo.getUserId()));
|
||||||
ArrayList<UserMachineDO> userMachineDOS = new ArrayList<>();
|
if(CollectionUtil.isNotEmpty(vo.getMachinesIds())) {
|
||||||
for (Long machinesId : vo.getMachinesIds()) {
|
ArrayList<UserMachineDO> userMachineDOS = new ArrayList<>();
|
||||||
userMachineDOS.add(UserMachineDO.builder()
|
for (Long machinesId : vo.getMachinesIds()) {
|
||||||
.userId(vo.getUserId())
|
userMachineDOS.add(UserMachineDO.builder()
|
||||||
.machineId(machinesId)
|
.userId(vo.getUserId())
|
||||||
.build());
|
.machineId(machinesId)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
userMachineMapper.insertBatch(userMachineDOS);
|
||||||
}
|
}
|
||||||
userMachineMapper.insertBatch(userMachineDOS);
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
<?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.machinetemplate.MachineTemplateMapper">
|
||||||
|
|
||||||
|
<resultMap id="map" type="com.cf.imes.module.system.controller.admin.machine.vo.AuthTemplateResp">
|
||||||
|
<result property="nickname" column="nickname"/>
|
||||||
|
<result property="organId" column="organ_id"/>
|
||||||
|
<result property="userId" column="userId"/>
|
||||||
|
<result property="organName" column="organName"/>
|
||||||
|
<collection property="authTemplateList" javaType="java.util.List" ofType="com.cf.imes.module.system.controller.admin.machine.vo.AutoTemplateVO"
|
||||||
|
select="selectAuthTemplateList" column="{userId=userId, templateName = templateName}" >
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectAuthTemplatePage" resultMap="map" parameterType="com.cf.imes.module.system.controller.admin.machine.vo.AuthTemplatePage">
|
||||||
|
select a.id AS userId, a.nickname, a.organ_id, f.name as organName,
|
||||||
|
case when ('${vo.templateName}' != '') then '${vo.templateName}' else '' end as templateName
|
||||||
|
from system_users a, user_machine b, system_organization f
|
||||||
|
<where>
|
||||||
|
a.id = b.user_id
|
||||||
|
and a.organ_id = f.id
|
||||||
|
and a.deleted = 0
|
||||||
|
<if test="vo.organId != null">
|
||||||
|
and a.organ_id = #{vo.organId}
|
||||||
|
</if>
|
||||||
|
<if test="vo.nickname != null and vo.nickname != '' ">
|
||||||
|
and a.nickname like concat('%',#{vo.nickname},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
group by a.id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAuthTemplateList"
|
||||||
|
resultType="com.cf.imes.module.system.controller.admin.machine.vo.AutoTemplateVO" parameterType="java.util.Map">
|
||||||
|
select b.user_id, c.name AS templateName, c.id AS templateId
|
||||||
|
from user_machine b
|
||||||
|
inner join system_machine_template c on b.machine_id = c.id
|
||||||
|
<where>
|
||||||
|
c.deleted = 0
|
||||||
|
<if test="templateName != null and templateName != ''">
|
||||||
|
and c.name like concat('%',#{templateName},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user