Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | <div >
|
| | | <el-button type="success" size="mini" @click="handleInbound()">入库</el-button>
|
| | | <el-button type="success" size="mini" @click="handleInbound()">吊装位入库</el-button>
|
| | | <el-button type="success" size="mini" @click="addglass()">添加原片</el-button>
|
| | | |
| | | </div>
|
| | |
|
| | | <!-- 右侧选择框 -->
|
| | |
| | | </el-table-column>
|
| | |
|
| | | <!-- 操作列 -->
|
| | | <el-table-column label="操作" width="300">
|
| | | <el-table-column label="操作" width="350">
|
| | | <template #default="{ row }">
|
| | | <el-button type="primary" size="mini" @click="handleEdit(row)">修改</el-button>
|
| | | <el-button type="primary" size="mini" @click="edithandleRowClick(row)">修改</el-button>
|
| | | <el-button type="danger" size="mini" @click="handleDelete(row)">删除</el-button>
|
| | | <el-button type="warning" size="mini" @click="handleCheckout(row)">出库</el-button>
|
| | | |
| | | <el-button type="success" size="mini" @click="addglass()">添加原片</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | |
| | | </span>
|
| | | </el-dialog>
|
| | |
|
| | | <el-dialog title="编辑" v-model="editdialogVisible" width="30%" @close="edithandleDialogClose">
|
| | | <el-form :model="editForm" ref="editForm" label-width="80px">
|
| | | <el-form-item label="数量">
|
| | | <el-input v-model="editForm.quantity"></el-input>
|
| | | </el-form-item>
|
| | | <el-form-item label="批次号">
|
| | | <el-input v-model="editForm.batchnumber"></el-input>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | |
|
| | | <div slot="footer" class="dialog-footer">
|
| | | <el-button @click="editdialogVisible = false">取消</el-button>
|
| | | <el-button type="primary" @click="editsaveEdit">保存</el-button>
|
| | | </div>
|
| | | </el-dialog>
|
| | |
|
| | |
|
| | | <!-- <div ref="chart" id="chart" style="width: 100%; height: 400px;"></div> -->
|
| | |
| | |
|
| | | });
|
| | |
|
| | | const handleEdit = (row) => {
|
| | | // 处理修改数量逻辑
|
| | | console.log('Edit Quantity:', row);
|
| | | };
|
| | | |
| | |
|
| | | const handleDelete = (row) => {
|
| | | // 处理删除逻辑
|
| | | console.log('Delete:', row);
|
| | | };
|
| | |
|
| | | |
| | | const handleCheckout = (row) => {
|
| | | // 处理出库逻辑
|
| | | console.log('Checkout:', row);
|
| | |
| | |
|
| | |
|
| | |
|
| | |
|
| | | const editdialogVisible = ref(false);
|
| | | const editForm = ref({
|
| | | quantity: '',
|
| | | batchnumber: ''
|
| | | });
|
| | | let currentRow = ref(null);
|
| | |
|
| | | // 处理行点击事件
|
| | | const edithandleRowClick = (row) => {
|
| | | currentRow.value = row;
|
| | | editForm.value.quantity = row.quantity;
|
| | | editForm.value.batchnumber = row.batchnumber;
|
| | | editdialogVisible.value = true;
|
| | | console.log(editForm.value)
|
| | | };
|
| | |
|
| | | // 添加保存编辑内容
|
| | | const editsaveEdit = () => {
|
| | | if (!currentRow.value) return;
|
| | |
|
| | | // 更新当前行数据
|
| | | currentRow.value.quantity = parseInt(editForm.value.quantity);
|
| | | currentRow.value.batchnumber = editForm.value.batchnumber;
|
| | |
|
| | | // 关闭对话框
|
| | | editdialogVisible.value = false;
|
| | | };
|
| | |
|
| | | // 对话框关闭时重置编辑表单和当前行数据
|
| | | const edithandleDialogClose = () => {
|
| | | editForm.value.quantity = '';
|
| | | editForm.value.batchnumber = '';
|
| | | currentRow.value = null;
|
| | | };
|
| | |
|
| | |
|
| | | let chartInstance = null;
|
| | |
|
| | | onMounted(() => {
|
New file |
| | |
| | | package com.mes.order.controller; |
| | | import com.mes.order.entity.Orderdetail; |
| | | import com.mes.order.entity.Orders; |
| | | import com.mes.order.service.OrdersService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/order/order") |
| | | @Slf4j |
| | | public class OrderController { |
| | | @Autowired |
| | | //获取待选择的工程号 |
| | | private OrdersService ordersService; |
| | | |
| | | @ApiOperation("显示订单详细") |
| | | @PostMapping("/selectOrderdetail") //显示工程选择信息 |
| | | @ResponseBody |
| | | public Result<List<Orderdetail>> listByState(@RequestBody Orders orders) { |
| | | log.info("将请求参数封装在请求类里面"); |
| | | List<Orderdetail> glass = ordersService.selectOrderdetail(orders); |
| | | log.info("显示订单详情信息:{}", glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.order.entity; |
| | | |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class Order implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * <订单表> |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 订单Id |
| | | */ |
| | | private String orderId; |
| | | |
| | | /** |
| | | * 项目名称 |
| | | */ |
| | | private String project; |
| | | |
| | | /** |
| | | * 客户Id |
| | | */ |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * 客户名称 |
| | | */ |
| | | private String customerName; |
| | | |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | private String orderType; |
| | | |
| | | /** |
| | | * 订单分类 |
| | | */ |
| | | private String orderClassify; |
| | | |
| | | /** |
| | | * 商标选项 |
| | | */ |
| | | private String icon; |
| | | |
| | | /** |
| | | * 包装方式 |
| | | */ |
| | | private String packType; |
| | | |
| | | /** |
| | | * 送货时间 |
| | | */ |
| | | private LocalDateTime deliveryDate; |
| | | |
| | | /** |
| | | * 批次 |
| | | */ |
| | | private String batch; |
| | | |
| | | /** |
| | | * 计算方式 |
| | | */ |
| | | private Integer calculateType; |
| | | |
| | | /** |
| | | * 销售人员Id |
| | | */ |
| | | private String salesmanId; |
| | | |
| | | /** |
| | | * 销售人 |
| | | */ |
| | | private String salesman; |
| | | |
| | | /** |
| | | * 铝条方式 |
| | | */ |
| | | private String alType; |
| | | |
| | | /** |
| | | * 金额 |
| | | */ |
| | | private BigDecimal money; |
| | | |
| | | /** |
| | | * 合同编号 |
| | | */ |
| | | private String contractId; |
| | | |
| | | /** |
| | | * 客户批次 |
| | | */ |
| | | private String customerBatch; |
| | | |
| | | /** |
| | | * 联系人 |
| | | */ |
| | | private String contacts; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String contactNumber; |
| | | |
| | | /** |
| | | * 送货地址 |
| | | */ |
| | | private String deliveryAddress; |
| | | |
| | | /** |
| | | * 其他金额 |
| | | */ |
| | | private BigDecimal otherMoney; |
| | | |
| | | /** |
| | | * 其他金额备注 |
| | | */ |
| | | private String otherMoneyRemarks; |
| | | |
| | | /** |
| | | * 订单加工备注 |
| | | */ |
| | | private String processingNote; |
| | | |
| | | /** |
| | | * 其他备注 |
| | | */ |
| | | private String otherRemarks; |
| | | |
| | | /** |
| | | * 面积 |
| | | */ |
| | | private BigDecimal area; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Long quantity; |
| | | |
| | | /** |
| | | * 周长 |
| | | */ |
| | | private String perimeter; |
| | | |
| | | /** |
| | | * 审核人id |
| | | */ |
| | | private String verifierId; |
| | | |
| | | /** |
| | | * 审核人 |
| | | */ |
| | | private String verifier; |
| | | |
| | | /** |
| | | * 创建人id |
| | | */ |
| | | private String creatorId; |
| | | |
| | | /** |
| | | * 创建人 |
| | | */ |
| | | private String creator; |
| | | |
| | | /** |
| | | * 下单 |
| | | */ |
| | | private Integer createOrder; |
| | | |
| | | /** |
| | | * 工艺审核 |
| | | */ |
| | | private Integer processReview; |
| | | |
| | | /** |
| | | * 订单审核 |
| | | */ |
| | | private Integer orderReview; |
| | | |
| | | /** |
| | | * 生产订单 |
| | | */ |
| | | private Integer productionOrder; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private Integer processingCard; |
| | | |
| | | /** |
| | | * 入库 未入库状态0,未完全入库状态1,完全入库状态2 |
| | | */ |
| | | private Integer warehousing; |
| | | |
| | | /** |
| | | * 发货 |
| | | */ |
| | | private Integer delivery; |
| | | |
| | | /** |
| | | * 创建日期 |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private LocalDateTime updateTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.order.entity; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class Orderdetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * 订单Id |
| | | */ |
| | | private String orderId; |
| | | /** |
| | | * 项目名称 |
| | | */ |
| | | private String project; |
| | | |
| | | /** |
| | | * 产品名称 |
| | | */ |
| | | private String productName; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private String width; |
| | | /** |
| | | * 高 |
| | | */ |
| | | private String height; |
| | | |
| | | /** |
| | | * 面积 |
| | | */ |
| | | private Double area; |
| | | |
| | | |
| | | /** |
| | | * 包装方式 |
| | | */ |
| | | private Integer quantity; |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private String processingNote; |
| | | /** |
| | | * 送货时间 |
| | | */ |
| | | private String deliveryDate; |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.order.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class Orders implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * <订单表> |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 订单Id |
| | | */ |
| | | private String orderId; |
| | | /** |
| | | * 客户名称 |
| | | */ |
| | | private String customerName; |
| | | |
| | | /** |
| | | * 项目名称 |
| | | */ |
| | | private String project; |
| | | |
| | | /** |
| | | * 面积 |
| | | */ |
| | | private Double area; |
| | | |
| | | |
| | | /** |
| | | * 包装方式 |
| | | */ |
| | | private Integer quantity; |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer warehousing; |
| | | /** |
| | | * 送货时间 |
| | | */ |
| | | private String deliveryDate; |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.order.mapper; |
| | | |
| | | import com.mes.order.entity.Order; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | public interface OrderMapper extends BaseMapper<Order> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.order.mapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.order.entity.Orderdetail; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | public interface OrderdetailMapper extends BaseMapper<Orderdetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.order.mapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.order.entity.Orders; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | public interface OrdersMapper extends BaseMapper<Orders> { |
| | | |
| | | } |
New file |
| | |
| | | <?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.mes.order.mapper.OrderMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.mes.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.order.entity.Order; |
| | | import com.mes.order.entity.Orderdetail; |
| | | import com.mes.order.entity.Orders; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | public interface OrdersService extends IService<Orders> { |
| | | |
| | | List<Orders> selectOrders(); |
| | | |
| | | List<Orderdetail> selectOrderdetail(Orders orders); |
| | | } |
New file |
| | |
| | | package com.mes.order.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.order.entity.Orderdetail; |
| | | import com.mes.order.entity.Orders; |
| | | import com.mes.order.mapper.OrderdetailMapper; |
| | | import com.mes.order.mapper.OrdersMapper; |
| | | import com.mes.order.service.OrdersService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-17 |
| | | */ |
| | | @Service |
| | | @DS("sd") |
| | | public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService { |
| | | @Autowired |
| | | private OrderdetailMapper orderdetailMapper; |
| | | @Override |
| | | public List<Orders> selectOrders() { |
| | | //获取所有未完成的订单 |
| | | QueryWrapper<Orders> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.ne("warehousing", "2"); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Orderdetail> selectOrderdetail(Orders orders) { |
| | | QueryWrapper<Orderdetail> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("order_id", orders.getOrderId()); |
| | | return orderdetailMapper.selectList(queryWrapper); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.pp.controller; |
| | | |
| | | |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.pp.entity.request.Reportingdamage; |
| | | import com.mes.pp.service.ReportingWorkService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-26 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/reporting_work/reporting-work") |
| | | @Slf4j |
| | | public class ReportingWorkController { |
| | | @Autowired |
| | | private ReportingWorkService reportingWorkService; |
| | | |
| | | @ApiOperation("显示工程选择信息") |
| | | @PostMapping("/selectDamage") //显示工程选择信息 |
| | | @ResponseBody |
| | | public Result<List<Reportingdamage>> selectDamage(@RequestBody Reportingdamage reportingdamage) { |
| | | log.info("将请求参数封装在请求类里面"); |
| | | List<Reportingdamage> glass = reportingWorkService.selectDamage(reportingdamage); |
| | | log.info("显示工程选择信息:{}", glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.pp.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-26 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class ReportingWork implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * <报工主表> |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 报工编号 |
| | | */ |
| | | private String reportingWorkId; |
| | | |
| | | /** |
| | | * 销售单号 |
| | | */ |
| | | private String orderId; |
| | | |
| | | /** |
| | | * 生产订单号 |
| | | */ |
| | | private String productionId; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String processId; |
| | | |
| | | /** |
| | | * 本工序 |
| | | */ |
| | | private String thisProcess; |
| | | |
| | | /** |
| | | * 设备编号 |
| | | */ |
| | | private byte[] deviceId; |
| | | |
| | | /** |
| | | * 设备名称 |
| | | */ |
| | | private String deviceName; |
| | | |
| | | /** |
| | | * 上工序 |
| | | */ |
| | | private String previousProcess; |
| | | |
| | | /** |
| | | * 上工序数量 |
| | | */ |
| | | private Integer previousProcessQuantity; |
| | | |
| | | /** |
| | | * 本工序数量 |
| | | */ |
| | | private Integer thisProcessQuantity; |
| | | |
| | | /** |
| | | * 本工序完工数 |
| | | */ |
| | | private Integer thisCompletedQuantity; |
| | | |
| | | /** |
| | | * 本工序次破数 |
| | | */ |
| | | private Integer thisWornQuantity; |
| | | |
| | | /** |
| | | * 下工序 |
| | | */ |
| | | private String nextProcess; |
| | | |
| | | /** |
| | | * 班次 |
| | | */ |
| | | private String classes; |
| | | |
| | | /** |
| | | * 班组编号 |
| | | */ |
| | | private String teamsGroupsId; |
| | | |
| | | /** |
| | | * 班组名称 |
| | | */ |
| | | private String teamsGroupsName; |
| | | |
| | | /** |
| | | * 报工状态 |
| | | */ |
| | | private Integer reportingWorkState; |
| | | |
| | | /** |
| | | * 审核人 |
| | | */ |
| | | private String reviewed; |
| | | |
| | | /** |
| | | * 审核状态(默认0,审核通过1,不通过2,小于0删除) |
| | | */ |
| | | private Integer reviewedState; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String notes; |
| | | |
| | | /** |
| | | * 质检员 |
| | | */ |
| | | private String qualityInspector; |
| | | |
| | | /** |
| | | * 包装方式 |
| | | */ |
| | | private String packagingMethod; |
| | | |
| | | /** |
| | | * 报工时间 |
| | | */ |
| | | private LocalDateTime reportingWorkTime; |
| | | |
| | | /** |
| | | * 审核时间 |
| | | */ |
| | | private LocalDateTime examineTime; |
| | | |
| | | /** |
| | | * 质检时间 |
| | | */ |
| | | private LocalDateTime qualityInsTime; |
| | | |
| | | /** |
| | | * 创建者id |
| | | */ |
| | | private String creatorId; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | private String creator; |
| | | |
| | | /** |
| | | * 建立时间 |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private LocalDateTime updateTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.entity.request; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-26 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class AwaitingRepair implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | /** |
| | | * 次破时间 |
| | | */ |
| | | private String reportingWorkTime; |
| | | |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | private String orderId; |
| | | /** |
| | | * 报工编号 |
| | | */ |
| | | private String reportingWorkId; |
| | | /** |
| | | * 生产订单号 |
| | | */ |
| | | private String productionId; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String processId; |
| | | |
| | | /** |
| | | * 项目名称 |
| | | */ |
| | | private String project; |
| | | |
| | | /** |
| | | * 批次 |
| | | */ |
| | | private String batch; |
| | | |
| | | /** |
| | | * 明细id |
| | | */ |
| | | private String reviewer; |
| | | |
| | | /** |
| | | * 楼号 |
| | | */ |
| | | private String buildingNumber; |
| | | |
| | | /** |
| | | * 订单序号 |
| | | */ |
| | | private Integer orderSort; |
| | | /** |
| | | * 产品名称 |
| | | */ |
| | | private String productName; |
| | | |
| | | /** |
| | | * 工艺确认序号 |
| | | */ |
| | | private Integer technologyNumber; |
| | | /** |
| | | * 片标记(位置) |
| | | */ |
| | | private Integer glassAddress; |
| | | |
| | | /** |
| | | * 补片数量 |
| | | */ |
| | | private Integer patchNum; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 形状 |
| | | */ |
| | | private String shape; |
| | | |
| | | /** |
| | | * 责任工序 |
| | | */ |
| | | private String responsibleProcess; |
| | | |
| | | /** |
| | | * 本工序 |
| | | */ |
| | | private String patchProcesses; |
| | | |
| | | /** |
| | | * 次破未补数量 |
| | | */ |
| | | private Integer breakageQuantity; |
| | | |
| | | /** |
| | | * 退回工序 |
| | | */ |
| | | private String returnProcesses; |
| | | |
| | | /** |
| | | * 次破原因 |
| | | */ |
| | | private String patchReason; |
| | | |
| | | /** |
| | | * 次破类型 |
| | | */ |
| | | private String patchType; |
| | | |
| | | /** |
| | | * 责任人员 |
| | | */ |
| | | private String responsiblePersonnel; |
| | | |
| | | /** |
| | | * 责任设备 |
| | | */ |
| | | private String responsibleEquipment; |
| | | |
| | | /** |
| | | * 责任班组 |
| | | */ |
| | | private String responsibleTeam; |
| | | |
| | | /** |
| | | * 次破面积 |
| | | */ |
| | | private LocalDateTime patchArea; |
| | | |
| | | /** |
| | | * 质检员 |
| | | */ |
| | | private LocalDateTime qualityInspector; |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.entity.request; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author wu |
| | | */ |
| | | @Data |
| | | public class Reportingdamage { |
| | | /** |
| | | * 工序 |
| | | */ |
| | | private String thisProcess; |
| | | |
| | | /** |
| | | * 设备 |
| | | */ |
| | | private String deviceName; |
| | | /** |
| | | * 加工数量 |
| | | */ |
| | | private Integer completedQuantity; |
| | | /** |
| | | * 次破数量 |
| | | */ |
| | | private Integer breakageQuantity; |
| | | /** |
| | | * 次破时间 |
| | | */ |
| | | private String reportingWorkTime; |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.mes.pp.mapper; |
| | | |
| | | import com.mes.pp.entity.ReportingWork; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-26 |
| | | */ |
| | | public interface ReportingWorkMapper extends BaseMapper<ReportingWork> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.mapper.request; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.pp.entity.request.AwaitingRepair; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-26 |
| | | */ |
| | | public interface AwaitingRepairMapper extends BaseMapper<AwaitingRepair> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.mapper.request; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.pp.entity.request.Reportingdamage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-26 |
| | | */ |
| | | public interface ReportingDamageMapper extends BaseMapper<Reportingdamage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.service; |
| | | |
| | | import com.mes.pp.entity.ReportingWork; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.pp.entity.request.Reportingdamage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-26 |
| | | */ |
| | | public interface ReportingWorkService extends IService<ReportingWork> { |
| | | |
| | | //获取顶部扇形图破损加工数量 |
| | | List<Reportingdamage> selectDamage(Reportingdamage reportingdamage); |
| | | } |
New file |
| | |
| | | package com.mes.pp.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.pp.entity.ReportingWork; |
| | | import com.mes.pp.entity.request.Reportingdamage; |
| | | import com.mes.pp.mapper.ReportingWorkMapper; |
| | | import com.mes.pp.mapper.request.AwaitingRepairMapper; |
| | | import com.mes.pp.mapper.request.ReportingDamageMapper; |
| | | import com.mes.pp.service.ReportingWorkService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-06-26 |
| | | */ |
| | | @Service |
| | | @DS("pp") |
| | | @Slf4j |
| | | public class ReportingWorkServiceImpl extends ServiceImpl<ReportingWorkMapper, ReportingWork> implements ReportingWorkService { |
| | | @Autowired |
| | | private ReportingDamageMapper reportingDamageMapper; |
| | | @Autowired |
| | | private AwaitingRepairMapper awaitingRepairMapper; |
| | | @Override |
| | | public List<Reportingdamage> selectDamage(Reportingdamage reportingdamage) { |
| | | QueryWrapper<Reportingdamage>queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.eq("this_process",reportingdamage.getThisProcess()) |
| | | .eq("device_name",reportingdamage.getDeviceName()) |
| | | .le("reporting_work_time", LocalDateTime.now()); |
| | | return reportingDamageMapper.selectList(queryWrapper); |
| | | // rw.reporting_work_time BETWEEN '2024/05/12'and'2024/06/20' and rw.this_process = '磨边' and rw.device_name = '快速磨' |
| | | |
| | | } |
| | | } |
| | |
| | | // 2、全局配置 |
| | | // 全局配置 |
| | | GlobalConfig gc = new GlobalConfig(); |
| | | gc.setOutputDir("D:\\Documents\\hangzhoumesParent6\\"); |
| | | gc.setOutputDir("D:\\Documents\\hangzhoumesParent5\\"); |
| | | |
| | | gc.setServiceName("%sService"); //去掉Service接口的首字母I |
| | | gc.setAuthor("wu"); |
| | |
| | | |
| | | // 3、数据源配置 |
| | | DataSourceConfig dsc = new DataSourceConfig(); |
| | | dsc.setUrl("jdbc:mysql://10.153.19.150:3306/sd?serverTimezone=GMT%2b8"); |
| | | dsc.setUrl("jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8"); |
| | | dsc.setDriverName("com.mysql.cj.jdbc.Driver"); |
| | | dsc.setUsername("root"); |
| | | dsc.setPassword("beibo.123/"); |
| | |
| | | // 4、包配置 |
| | | PackageConfig pc = new PackageConfig(); |
| | | pc.setParent("com.mes"); |
| | | pc.setModuleName("orderdetail"); //模块名 |
| | | pc.setModuleName("reporting_work"); //模块名 |
| | | pc.setController("controller"); |
| | | pc.setService("service"); |
| | | pc.setMapper("mapper"); |
| | |
| | | // 5、策略配置 |
| | | StrategyConfig strategy = new StrategyConfig(); |
| | | |
| | | strategy.setInclude("order_detail"); |
| | | strategy.setInclude("reporting_work"); |
| | | |
| | | strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 |
| | | |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import com.mes.common.utils.FastJsonRedisSerializer; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 19:13 |
| | | * @Description: |
| | | */ |
| | | @Configuration |
| | | public class RedisConfig { |
| | | |
| | | @Bean |
| | | @SuppressWarnings(value = {"unchecked", "rawtypes"}) |
| | | public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) { |
| | | RedisTemplate<Object, Object> template = new RedisTemplate<>(); |
| | | template.setConnectionFactory(connectionFactory); |
| | | |
| | | FastJsonRedisSerializer serializer = new FastJsonRedisSerializer(Object.class); |
| | | |
| | | // 使用StringRedisSerializer来序列化和反序列化redis的key值 |
| | | template.setKeySerializer(new StringRedisSerializer()); |
| | | template.setValueSerializer(serializer); |
| | | |
| | | // Hash的key也采用StringRedisSerializer的序列化方式 |
| | | template.setHashKeySerializer(new StringRedisSerializer()); |
| | | template.setHashValueSerializer(serializer); |
| | | |
| | | template.afterPropertiesSet(); |
| | | return template; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | |
| | | import com.mes.common.filter.JwtAuthenticationTokenFilter; |
| | | import com.mes.common.handler.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
| | | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| | | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
| | | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | import org.springframework.security.config.http.SessionCreationPolicy; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| | | |
| | | @Configuration |
| | | @EnableWebSecurity |
| | | @EnableGlobalMethodSecurity(prePostEnabled = true) |
| | | public class TokenWebSecurityConfig extends WebSecurityConfigurerAdapter { |
| | | @Autowired |
| | | private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter; |
| | | @Autowired |
| | | LoginFailureHandler loginFailureHandler; |
| | | |
| | | @Autowired |
| | | LoginSuccessHandler loginSuccessHandler; |
| | | |
| | | @Autowired |
| | | JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint; |
| | | |
| | | @Autowired |
| | | JwtAccessDeniedHandler jwtAccessDeniedHandler; |
| | | |
| | | @Autowired |
| | | JwtLogoutSuccessHandler jwtLogoutSuccessHandler; |
| | | |
| | | @Bean |
| | | public PasswordEncoder passwordEncoder() { |
| | | return new BCryptPasswordEncoder(); |
| | | } |
| | | |
| | | /** |
| | | * 配置过滤规则 |
| | | */ |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | | |
| | | http.cors().and().csrf().disable() |
| | | |
| | | // 登录配置 |
| | | .formLogin() |
| | | .successHandler(loginSuccessHandler) |
| | | .failureHandler(loginFailureHandler) |
| | | |
| | | .and() |
| | | .logout() |
| | | .logoutSuccessHandler(jwtLogoutSuccessHandler) |
| | | |
| | | // 禁用session |
| | | .and() |
| | | .sessionManagement() |
| | | .sessionCreationPolicy(SessionCreationPolicy.STATELESS) |
| | | |
| | | // 配置拦截规则 |
| | | .and() |
| | | .authorizeRequests() |
| | | .antMatchers("/sys/user/login").anonymous() |
| | | .antMatchers("/swagger-ui.html").permitAll() |
| | | .antMatchers("/webjars/**").permitAll() |
| | | .antMatchers("/v2/**").permitAll() |
| | | .antMatchers("/swagger-resources/**").permitAll() |
| | | .antMatchers("/**").permitAll() |
| | | .anyRequest().authenticated() |
| | | |
| | | // 异常处理器 |
| | | .and() |
| | | .exceptionHandling() |
| | | .authenticationEntryPoint(jwtAuthenticationEntryPoint) |
| | | .accessDeniedHandler(jwtAccessDeniedHandler) |
| | | |
| | | // 配置自定义的过滤器 |
| | | .and() |
| | | .addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); |
| | | } |
| | | |
| | | @Bean |
| | | @Override |
| | | public AuthenticationManager authenticationManagerBean() throws Exception { |
| | | return super.authenticationManagerBean(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.filter; |
| | | |
| | | import com.mes.common.utils.JwtUtil; |
| | | import com.mes.common.utils.RedisUtil; |
| | | import com.mes.common.utils.UserInfoUtils; |
| | | import com.mes.userinfo.entity.LoginUser; |
| | | import com.mes.userinfo.service.SysUserService; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.filter.OncePerRequestFilter; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/10 9:42 |
| | | * @Description: |
| | | */ |
| | | @Component |
| | | public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { |
| | | // 此处解释为什么不去实现Filter接口,因为在某些情况下会过滤两次,执行两次Filter里面的方法,所以我们选择继承SpringSecurity中的OncePerRequestFilter |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private SysUserService sysUserService; |
| | | |
| | | @Override |
| | | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { |
| | | //获取token |
| | | String token = request.getHeader("token"); |
| | | if (!StringUtils.hasText(token)) { |
| | | //放行 |
| | | filterChain.doFilter(request, response); |
| | | return; // 此处加上return好处是后面结果返回的时候就不会再走一遍此过滤器的方法了 |
| | | } |
| | | //解析token |
| | | String userid; |
| | | try { |
| | | Claims claims = JwtUtil.getClaimByToken(token); |
| | | userid = claims.getSubject(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("token非法"); |
| | | } |
| | | //从redis中获取用户信息 |
| | | String redisKey = "login:" + userid; |
| | | LoginUser loginUser = redisUtil.getCacheObject(redisKey); |
| | | if (Objects.isNull(loginUser)) { |
| | | response.setHeader("token", ""); |
| | | throw new RuntimeException("用户未登录"); |
| | | } |
| | | //将用户信息放入当前线程 |
| | | UserInfoUtils.set(loginUser.getUser()); |
| | | //存入SecurityContextHolder,以供后面的过滤器使用 |
| | | List<String> permissionKeyList = sysUserService.getUserAuthorityInfo(Long.parseLong(userid)); |
| | | List<GrantedAuthority> authorities = permissionKeyList.stream(). |
| | | map(SimpleGrantedAuthority::new) |
| | | .collect(Collectors.toList()); |
| | | UsernamePasswordAuthenticationToken authenticationToken = |
| | | new UsernamePasswordAuthenticationToken(loginUser, null, authorities); |
| | | SecurityContextHolder.getContext().setAuthentication(authenticationToken); |
| | | //放行 |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.security.access.AccessDeniedException; |
| | | import org.springframework.security.web.access.AccessDeniedHandler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | @Component |
| | | public class JwtAccessDeniedHandler implements AccessDeniedHandler { |
| | | |
| | | @Override |
| | | public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { |
| | | |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | response.setStatus(HttpServletResponse.SC_FORBIDDEN); |
| | | |
| | | ServletOutputStream outputStream = response.getOutputStream(); |
| | | |
| | | Result result = Result.error(HttpStatus.FORBIDDEN.value(), "权限不足"); |
| | | |
| | | outputStream.write(JSONUtil.toJsonStr(result).getBytes("UTF-8")); |
| | | |
| | | outputStream.flush(); |
| | | outputStream.close(); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.web.AuthenticationEntryPoint; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | @Component |
| | | public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { |
| | | |
| | | @Override |
| | | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { |
| | | |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); |
| | | ServletOutputStream outputStream = response.getOutputStream(); |
| | | |
| | | Result result = Result.error(HttpStatus.UNAUTHORIZED.value(), "认证失败请重新登录"); |
| | | |
| | | outputStream.write(JSONUtil.toJsonStr(result).getBytes("UTF-8")); |
| | | |
| | | outputStream.flush(); |
| | | outputStream.close(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; |
| | | import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | @Component |
| | | public class JwtLogoutSuccessHandler implements LogoutSuccessHandler { |
| | | |
| | | private static final String header = "Authorization"; |
| | | |
| | | @Override |
| | | public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { |
| | | |
| | | if (authentication != null) { |
| | | new SecurityContextLogoutHandler().logout(request, response, authentication); |
| | | } |
| | | |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | ServletOutputStream outputStream = response.getOutputStream(); |
| | | |
| | | response.setHeader(header, ""); |
| | | |
| | | Result result = Result.success(""); |
| | | |
| | | outputStream.write(JSONUtil.toJsonStr(result).getBytes("UTF-8")); |
| | | |
| | | outputStream.flush(); |
| | | outputStream.close(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.web.authentication.AuthenticationFailureHandler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | @Component |
| | | public class LoginFailureHandler implements AuthenticationFailureHandler { |
| | | |
| | | @Override |
| | | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { |
| | | |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | ServletOutputStream outputStream = response.getOutputStream(); |
| | | |
| | | Result result = Result.error("用户名或密码错误"); |
| | | |
| | | outputStream.write(JSONUtil.toJsonStr(result).getBytes("UTF-8")); |
| | | |
| | | outputStream.flush(); |
| | | outputStream.close(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.mes.common.utils.JwtUtil; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | @Component |
| | | public class LoginSuccessHandler implements AuthenticationSuccessHandler { |
| | | |
| | | private static final String header = "Authorization"; |
| | | |
| | | @Override |
| | | public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | ServletOutputStream outputStream = response.getOutputStream(); |
| | | |
| | | // 生成jwt,并放置到请求头中 |
| | | String jwt = JwtUtil.generateToken(authentication.getName()); |
| | | response.setHeader(header, jwt); |
| | | |
| | | Result result = Result.success(""); |
| | | |
| | | outputStream.write(JSONUtil.toJsonStr(result).getBytes("UTF-8")); |
| | | |
| | | outputStream.flush(); |
| | | outputStream.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.parser.ParserConfig; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.fasterxml.jackson.databind.JavaType; |
| | | import com.fasterxml.jackson.databind.type.TypeFactory; |
| | | import org.springframework.data.redis.serializer.RedisSerializer; |
| | | import org.springframework.data.redis.serializer.SerializationException; |
| | | |
| | | import java.nio.charset.Charset; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/11 15:28 |
| | | * @Description: |
| | | */ |
| | | public class FastJsonRedisSerializer<T> implements RedisSerializer<T> { |
| | | |
| | | public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); |
| | | |
| | | private Class<T> clazz; |
| | | |
| | | static { |
| | | ParserConfig.getGlobalInstance().setAutoTypeSupport(true); |
| | | } |
| | | |
| | | public FastJsonRedisSerializer(Class<T> clazz) { |
| | | super(); |
| | | this.clazz = clazz; |
| | | } |
| | | |
| | | @Override |
| | | public byte[] serialize(T t) throws SerializationException { |
| | | if (t == null) { |
| | | return new byte[0]; |
| | | } |
| | | return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); |
| | | } |
| | | |
| | | @Override |
| | | public T deserialize(byte[] bytes) throws SerializationException { |
| | | if (bytes == null || bytes.length <= 0) { |
| | | return null; |
| | | } |
| | | String str = new String(bytes, DEFAULT_CHARSET); |
| | | |
| | | return JSON.parseObject(str, clazz); |
| | | } |
| | | |
| | | |
| | | protected JavaType getJavaType(Class<?> clazz) { |
| | | return TypeFactory.defaultInstance().constructType(clazz); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | |
| | | import io.jsonwebtoken.Claims; |
| | | import io.jsonwebtoken.Jwts; |
| | | import io.jsonwebtoken.SignatureAlgorithm; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 19:15 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class JwtUtil { |
| | | |
| | | private static final long expire = 60 * 60 * 1000L; |
| | | private static final String secret = "beibo"; |
| | | private static final String header = "Authorization"; |
| | | |
| | | // 生成jwt |
| | | public static String generateToken(String username) { |
| | | |
| | | Date nowDate = new Date(); |
| | | Date expireDate = new Date(nowDate.getTime() + 1000 * expire); |
| | | |
| | | return Jwts.builder() |
| | | .setHeaderParam("typ", "JWT") |
| | | .setSubject(username) |
| | | .setIssuedAt(nowDate) |
| | | .setExpiration(expireDate)// 7天過期 |
| | | .signWith(SignatureAlgorithm.HS512, secret) |
| | | .compact(); |
| | | } |
| | | |
| | | // 解析jwt |
| | | public static Claims getClaimByToken(String jwt) { |
| | | try { |
| | | return Jwts.parser() |
| | | .setSigningKey(secret) |
| | | .parseClaimsJws(jwt) |
| | | .getBody(); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | // jwt是否过期 |
| | | public boolean isTokenExpired(Claims claims) { |
| | | return claims.getExpiration().before(new Date()); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.BoundSetOperations; |
| | | import org.springframework.data.redis.core.HashOperations; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * spring redis 工具类 |
| | | **/ |
| | | @Component |
| | | public class RedisUtil { |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 缓存基本的对象,Integer、String、实体类等 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param value 缓存的值 |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value) { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | } |
| | | |
| | | /** |
| | | * 缓存基本的对象,Integer、String、实体类等 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param value 缓存的值 |
| | | * @param timeout 时间 |
| | | * @param timeUnit 时间颗粒度 |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) { |
| | | redisTemplate.opsForValue().set(key, value, timeout, timeUnit); |
| | | } |
| | | |
| | | /** |
| | | * 设置有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @param timeout 超时时间 |
| | | * @return true=设置成功;false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout) { |
| | | return expire(key, timeout, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | /** |
| | | * 设置有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @param timeout 超时时间 |
| | | * @param unit 时间单位 |
| | | * @return true=设置成功;false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout, final TimeUnit unit) { |
| | | return redisTemplate.expire(key, timeout, unit); |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的基本对象。 |
| | | * |
| | | * @param key 缓存键值 |
| | | * @return 缓存键值对应的数据 |
| | | */ |
| | | public <T> T getCacheObject(final String key) { |
| | | ValueOperations<String, T> operation = redisTemplate.opsForValue(); |
| | | return operation.get(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除单个对象 |
| | | * |
| | | * @param key |
| | | */ |
| | | public boolean deleteObject(final String key) { |
| | | return redisTemplate.delete(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除集合对象 |
| | | * |
| | | * @param collection 多个对象 |
| | | * @return |
| | | */ |
| | | public long deleteObject(final Collection collection) { |
| | | return redisTemplate.delete(collection); |
| | | } |
| | | |
| | | /** |
| | | * 缓存List数据 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param dataList 待缓存的List数据 |
| | | * @return 缓存的对象 |
| | | */ |
| | | public <T> long setCacheList(final String key, final List<T> dataList) { |
| | | Long count = redisTemplate.opsForList().rightPushAll(key, dataList); |
| | | return count == null ? 0 : count; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的list对象 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @return 缓存键值对应的数据 |
| | | */ |
| | | public <T> List<T> getCacheList(final String key) { |
| | | return redisTemplate.opsForList().range(key, 0, -1); |
| | | } |
| | | |
| | | /** |
| | | * 缓存Set |
| | | * |
| | | * @param key 缓存键值 |
| | | * @param dataSet 缓存的数据 |
| | | * @return 缓存数据的对象 |
| | | */ |
| | | public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) { |
| | | BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key); |
| | | Iterator<T> it = dataSet.iterator(); |
| | | while (it.hasNext()) { |
| | | setOperation.add(it.next()); |
| | | } |
| | | return setOperation; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的set |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Set<T> getCacheSet(final String key) { |
| | | return redisTemplate.opsForSet().members(key); |
| | | } |
| | | |
| | | /** |
| | | * 缓存Map |
| | | * |
| | | * @param key |
| | | * @param dataMap |
| | | */ |
| | | public <T> void setCacheMap(final String key, final Map<String, T> dataMap) { |
| | | if (dataMap != null) { |
| | | redisTemplate.opsForHash().putAll(key, dataMap); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的Map |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Map<String, T> getCacheMap(final String key) { |
| | | return redisTemplate.opsForHash().entries(key); |
| | | } |
| | | |
| | | /** |
| | | * 往Hash中存入数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @param value 值 |
| | | */ |
| | | public <T> void setCacheMapValue(final String key, final String hKey, final T value) { |
| | | redisTemplate.opsForHash().put(key, hKey, value); |
| | | } |
| | | |
| | | /** |
| | | * 获取Hash中的数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @return Hash中的对象 |
| | | */ |
| | | public <T> T getCacheMapValue(final String key, final String hKey) { |
| | | HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); |
| | | return opsForHash.get(key, hKey); |
| | | } |
| | | |
| | | /** |
| | | * 删除Hash中的数据 |
| | | * |
| | | * @param key |
| | | * @param hkey |
| | | */ |
| | | public void delCacheMapValue(final String key, final String hkey) { |
| | | HashOperations hashOperations = redisTemplate.opsForHash(); |
| | | hashOperations.delete(key, hkey); |
| | | } |
| | | |
| | | /** |
| | | * 获取多个Hash中的数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKeys Hash键集合 |
| | | * @return Hash对象集合 |
| | | */ |
| | | public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) { |
| | | return redisTemplate.opsForHash().multiGet(key, hKeys); |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的基本对象列表 |
| | | * |
| | | * @param pattern 字符串前缀 |
| | | * @return 对象列表 |
| | | */ |
| | | public Collection<String> keys(final String pattern) { |
| | | return redisTemplate.keys(pattern); |
| | | } |
| | | |
| | | /** |
| | | * 判断key是否存在 |
| | | * |
| | | * @param key 键 |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean hasKey(String key) { |
| | | try { |
| | | return redisTemplate.hasKey(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | import com.mes.userinfo.entity.SysUser; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/25 15:41 |
| | | * @Description: |
| | | */ |
| | | public class UserInfoUtils { |
| | | private static InheritableThreadLocal<SysUser> tokenPool = new InheritableThreadLocal<SysUser>(); |
| | | |
| | | public static SysUser get() { |
| | | return tokenPool.get(); |
| | | } |
| | | |
| | | public static void set(SysUser user) { |
| | | tokenPool.set(user); |
| | | } |
| | | |
| | | public static void remove() { |
| | | if (get() != null) { |
| | | tokenPool.remove(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 19:16 |
| | | * @Description: |
| | | */ |
| | | public class WebUtils { |
| | | /** |
| | | * 将字符串渲染到客户端 |
| | | * |
| | | * @param response 渲染对象 |
| | | * @param string 待渲染的字符串 |
| | | * @return null |
| | | */ |
| | | public static String renderString(HttpServletResponse response, String string) { |
| | | try { |
| | | response.setStatus(200); |
| | | response.setContentType("application/json"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.getWriter().print(string); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.menu.controller; |
| | | |
| | | import com.mes.entity.request.GeneralRequest; |
| | | import com.mes.menu.entity.SysMenu; |
| | | import com.mes.menu.service.SysMenuService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Api(description = "菜单管理") |
| | | @RestController |
| | | @RequestMapping("/sys/menu") |
| | | public class SysMenuController { |
| | | |
| | | @Autowired |
| | | private SysMenuService sysMenuService; |
| | | |
| | | @ApiOperation("新增菜单") |
| | | @PostMapping("/save") |
| | | // @PreAuthorize("hasAuthority('sys:menu:save')") |
| | | public Result save(@Validated @RequestBody SysMenu sysMenu) { |
| | | return Result.success(sysMenuService.save(sysMenu)); |
| | | } |
| | | |
| | | @ApiOperation("修改菜单信息") |
| | | @PostMapping("/updateMenu") |
| | | // @PreAuthorize("hasAuthority('sys:menu:update')") |
| | | public Result updateMenu(@Validated @RequestBody SysMenu sysMenu) { |
| | | sysMenuService.updateMenu(sysMenu); |
| | | return Result.success(sysMenu); |
| | | } |
| | | |
| | | @ApiOperation("获取用户有权限的所有菜单") |
| | | @GetMapping("/getMenuTree") |
| | | public Result<List<SysMenu>> getMenuTree(GeneralRequest request) { |
| | | return Result.success(sysMenuService.getMenuTree(request)); |
| | | } |
| | | |
| | | @ApiOperation("获取用户的权限") |
| | | @GetMapping("/getAuthorityInfo") |
| | | public Result<List<String>> getAuthorityInfo() { |
| | | return Result.success(sysMenuService.getAuthorityInfo()); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("用户当前用户的菜单和权限信息") |
| | | @GetMapping("/nav") |
| | | public Result<Map<Object, Object>> nav() { |
| | | return Result.success(sysMenuService.nav()); |
| | | } |
| | | |
| | | @ApiOperation("删除菜单") |
| | | @PostMapping("/deleteMenu") |
| | | // @PreAuthorize("hasAuthority('sys:menu:delete')") |
| | | public Result<String> deleteMenu(Long menuId) { |
| | | return Result.success(sysMenuService.deleteMenu(menuId)); |
| | | } |
| | | |
| | | @ApiOperation("批量删除菜单") |
| | | @PostMapping("/batchDeleteMenu") |
| | | // @PreAuthorize("hasAuthority('sys:menu:delete')") |
| | | public Result<String> batchDeleteMenu(@RequestBody List<Long> menuIds) { |
| | | return Result.success(sysMenuService.batchDeleteMenu(menuIds)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.menu.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-13 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class SysMenu implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 父id |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * 模块名称 |
| | | */ |
| | | private String menuName; |
| | | |
| | | /** |
| | | * 图标 |
| | | */ |
| | | private String icon; |
| | | |
| | | /** |
| | | * 地址 |
| | | */ |
| | | private String url; |
| | | |
| | | /** |
| | | * 语言类型 |
| | | */ |
| | | private String languageType; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private String listSort; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 权限 |
| | | */ |
| | | private String perms; |
| | | |
| | | /** |
| | | * 子菜单 |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<SysMenu> children; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.menu.mapper; |
| | | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.menu.entity.SysMenu; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Mapper |
| | | public interface SysMenuMapper extends MPJBaseMapper<SysMenu> { |
| | | |
| | | List<String> selectPermsByUserId(long parseLong); |
| | | } |
New file |
| | |
| | | package com.mes.menu.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.entity.request.GeneralRequest; |
| | | import com.mes.menu.entity.SysMenu; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | public interface SysMenuService extends IService<SysMenu> { |
| | | |
| | | /** |
| | | * 更新菜单信息 |
| | | * |
| | | * @param menu |
| | | * @return |
| | | */ |
| | | SysMenu updateMenu(SysMenu menu); |
| | | |
| | | /** |
| | | * 获取用户有权限的菜单树 |
| | | * |
| | | * @return |
| | | */ |
| | | List<SysMenu> getMenuTree(GeneralRequest request); |
| | | |
| | | /** |
| | | * 获取用户的权限 |
| | | * |
| | | * @return |
| | | */ |
| | | List<String> getAuthorityInfo(); |
| | | |
| | | |
| | | /** |
| | | * 获取用户菜单及权限信息 |
| | | * |
| | | * @return |
| | | */ |
| | | Map<Object, Object> nav(); |
| | | |
| | | /** |
| | | * 删除菜单信息 |
| | | * |
| | | * @param menuId |
| | | * @return |
| | | */ |
| | | String deleteMenu(Long menuId); |
| | | |
| | | /** |
| | | * 批量删除菜单信息 |
| | | * |
| | | * @param menuIds |
| | | * @return |
| | | */ |
| | | String batchDeleteMenu(List<Long> menuIds); |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.menu.service.impl; |
| | | |
| | | import cn.hutool.core.map.MapUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.utils.UserInfoUtils; |
| | | import com.mes.entity.request.GeneralRequest; |
| | | import com.mes.menu.entity.SysMenu; |
| | | import com.mes.menu.mapper.SysMenuMapper; |
| | | import com.mes.menu.service.SysMenuService; |
| | | import com.mes.role.entity.SysRoleMenu; |
| | | import com.mes.role.service.SysRoleMenuService; |
| | | import com.mes.userinfo.entity.SysUser; |
| | | import com.mes.userinfo.entity.SysUserRole; |
| | | import com.mes.userinfo.mapper.SysUserRoleMapper; |
| | | import com.mes.userinfo.service.SysUserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService { |
| | | |
| | | @Autowired |
| | | SysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | SysUserRoleMapper sysUserRoleMapper; |
| | | |
| | | @Autowired |
| | | SysRoleMenuService sysRoleMenuService; |
| | | |
| | | @Override |
| | | public SysMenu updateMenu(SysMenu menu) { |
| | | baseMapper.updateById(menu); |
| | | // 清除所有与该菜单相关的权限缓存 |
| | | sysUserService.clearUserAuthorityInfoByMenuId(menu.getId()); |
| | | return menu; |
| | | } |
| | | |
| | | @Override |
| | | public List<SysMenu> getMenuTree(GeneralRequest request) { |
| | | //todo:需要先获取用户的角色,角色下的菜单权限,拿到菜单id获取所有菜单 |
| | | SysUser user = UserInfoUtils.get(); |
| | | MPJLambdaWrapper<SysUserRole> wrapper = new MPJLambdaWrapper<>(); |
| | | |
| | | wrapper.selectAll(SysMenu.class).distinct() |
| | | .innerJoin(SysUser.class, SysUser::getId, SysUserRole::getUserId) |
| | | .innerJoin(SysRoleMenu.class, SysRoleMenu::getRoleId, SysUserRole::getRoleId) |
| | | .innerJoin(SysMenu.class, SysMenu::getId, SysRoleMenu::getMenuId) |
| | | .eq(SysUser::getId, user.getId()) |
| | | .like(StringUtils.isNotBlank(request.getKey()), SysMenu::getMenuName, request.getKey()); |
| | | |
| | | // |
| | | List<SysMenu> menuList = sysUserRoleMapper.selectJoinList(SysMenu.class, wrapper); |
| | | log.info("userinfos:{}",menuList); |
| | | return create(menuList); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getAuthorityInfo() { |
| | | SysUser user = UserInfoUtils.get(); |
| | | log.info("获取用户信息,用户名为{}", user); |
| | | // 获取权限信息 |
| | | // ROLE_admin,ROLE_normal,sys:user:list,.... |
| | | return sysUserService.getUserAuthorityInfo(user.getId()); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Object, Object> nav() { |
| | | List<SysMenu> menuTree = getMenuTree(new GeneralRequest()); |
| | | List<String> authorityInfo = getAuthorityInfo(); |
| | | return MapUtil.builder().put("authoritys", authorityInfo) |
| | | .put("tree", menuTree).map(); |
| | | } |
| | | |
| | | @Override |
| | | public String deleteMenu(Long menuId) { |
| | | int count = this.count(new LambdaQueryWrapper<SysMenu>().eq(SysMenu::getParentId, menuId)); |
| | | if (count > 0) { |
| | | return "无法删除,请先删除子菜单"; |
| | | } |
| | | |
| | | // 清除所有与该菜单相关的权限缓存 |
| | | sysUserService.clearUserAuthorityInfoByMenuId(menuId); |
| | | |
| | | this.removeById(menuId); |
| | | |
| | | // 同步删除中间关联表 |
| | | sysRoleMenuService.remove(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getMenuId, menuId)); |
| | | return "删除成功"; |
| | | } |
| | | |
| | | @Override |
| | | public String batchDeleteMenu(List<Long> menuIds) { |
| | | menuIds.stream().forEach(e -> deleteMenu(e)); |
| | | return "批量删除成功"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将数据库中查询出来的list集合传入此方法即可获得排成树形结构的list集合 |
| | | * |
| | | * @param lists |
| | | * @return |
| | | */ |
| | | public List<SysMenu> create(List<SysMenu> lists) { |
| | | List<SysMenu> deptTreeList = lists.stream() |
| | | .filter(item -> item.getParentId() == 0) |
| | | .map(item -> { |
| | | item.setChildren(getChildren(item, lists)); |
| | | return item; |
| | | }).collect(Collectors.toList()); |
| | | return deptTreeList; |
| | | } |
| | | |
| | | /** |
| | | * 此方法将被递归调用 |
| | | * |
| | | * @param menu |
| | | * @param menus |
| | | * @return |
| | | */ |
| | | private List<SysMenu> getChildren(SysMenu menu, List<SysMenu> menus) { |
| | | List<SysMenu> res = menus.stream() |
| | | .filter(item -> item.getParentId().equals(menu.getId())) |
| | | .collect(Collectors.toList()); |
| | | log.info("菜单树:{}", JSONUtil.toJsonStr(res)); |
| | | return res; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.controller; |
| | | |
| | | |
| | | import com.mes.entity.request.GeneralRequest; |
| | | import com.mes.role.entity.SysRole; |
| | | import com.mes.role.entity.vo.SysRoleVO; |
| | | import com.mes.role.service.SysRoleService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Api(description = "角色管理") |
| | | @RestController |
| | | @RequestMapping("/sys/role") |
| | | public class SysRoleController { |
| | | |
| | | @Autowired |
| | | private SysRoleService sysRoleService; |
| | | |
| | | @ApiOperation("新增角色及角色下的权限信息") |
| | | @PostMapping("/saveRole") |
| | | // @PreAuthorize("hasAuthority('sys:role:save')") |
| | | public Result<SysRole> saveRole(@Validated @RequestBody SysRoleVO sysRoleVO) { |
| | | return Result.success(sysRoleService.saveRole(sysRoleVO)); |
| | | } |
| | | |
| | | @ApiOperation("编辑角色及角色下的权限信息") |
| | | @PostMapping("/updateRole") |
| | | // @PreAuthorize("hasAuthority('sys:role:save')") |
| | | public Result<String> updateRole(@Validated @RequestBody SysRoleVO sysRoleVO) { |
| | | return Result.success(sysRoleService.updateRole(sysRoleVO)); |
| | | } |
| | | |
| | | @ApiOperation("查询角色及角色下的权限信息") |
| | | @PostMapping("/queryRole") |
| | | // @PreAuthorize("hasAuthority('sys:role:save')") |
| | | public Result<List<SysRoleVO>> queryRole(@Validated @RequestBody GeneralRequest request) { |
| | | return Result.success(sysRoleService.queryRole(request)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("删除角色及角色下的权限信息") |
| | | @PostMapping("/delete") |
| | | // @PreAuthorize("hasAuthority('sys:role:delete')") |
| | | @Transactional |
| | | public Result<String> deleteRole(@RequestBody List<Long> ids) { |
| | | return Result.success(sysRoleService.deleteRole(ids)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class SysRole implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | private String name; |
| | | |
| | | /** |
| | | * 角色权限字符串 |
| | | */ |
| | | private String roleKey; |
| | | |
| | | /** |
| | | * 角色状态(0正常 1停用) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 删除标志 |
| | | */ |
| | | private Integer delFlag; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class SysRoleMenu implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @TableId(type = IdType.NONE) |
| | | private Long roleId; |
| | | |
| | | /** |
| | | * 菜单id |
| | | */ |
| | | private Long menuId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.entity.vo; |
| | | |
| | | import com.mes.menu.entity.SysMenu; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/26 13:57 |
| | | * @Description: |
| | | */ |
| | | @Api(description = "角色信息") |
| | | @Data |
| | | public class SysRoleVO implements Serializable { |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "角色ID", position = 2) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "角色名称", position = 3) |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "角色权限字符串", position = 4) |
| | | private String roleKey; |
| | | |
| | | @ApiModelProperty(value = "角色状态(0正常 1停用)", position = 5) |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "删除标志", position = 6) |
| | | private Integer delFlag; |
| | | |
| | | @ApiModelProperty(value = "备注", position = 7) |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "角色菜单信息", position = 8) |
| | | private List<SysMenu> menuList; |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.mapper; |
| | | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.role.entity.SysRole; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Mapper |
| | | public interface SysRoleMapper extends MPJBaseMapper<SysRole> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.role.entity.SysRoleMenu; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Mapper |
| | | public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> { |
| | | |
| | | } |
New file |
| | |
| | | <?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.mes.role.mapper.SysRoleMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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.mes.role.mapper.SysRoleMenuMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.mes.role.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.role.entity.SysRoleMenu; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | public interface SysRoleMenuService extends IService<SysRoleMenu> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.entity.request.GeneralRequest; |
| | | import com.mes.role.entity.SysRole; |
| | | import com.mes.role.entity.vo.SysRoleVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | public interface SysRoleService extends IService<SysRole> { |
| | | |
| | | /** |
| | | * 创建角色信息 |
| | | * |
| | | * @param sysRoleVO |
| | | * @return |
| | | */ |
| | | SysRole saveRole(SysRoleVO sysRoleVO); |
| | | |
| | | /** |
| | | * 修改角色信息及权限 |
| | | * |
| | | * @param sysRoleVO |
| | | * @return |
| | | */ |
| | | String updateRole(SysRoleVO sysRoleVO); |
| | | |
| | | /** |
| | | * 按照角色名查询角色信息 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | List<SysRoleVO> queryRole(GeneralRequest request); |
| | | |
| | | /** |
| | | * 查询角色及角色下的权限信息 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | String deleteRole(List<Long> ids); |
| | | } |
New file |
| | |
| | | package com.mes.role.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.role.entity.SysRoleMenu; |
| | | import com.mes.role.mapper.SysRoleMenuMapper; |
| | | import com.mes.role.service.SysRoleMenuService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Service |
| | | public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements SysRoleMenuService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.entity.request.GeneralRequest; |
| | | import com.mes.menu.entity.SysMenu; |
| | | import com.mes.role.entity.SysRole; |
| | | import com.mes.role.entity.SysRoleMenu; |
| | | import com.mes.role.entity.vo.SysRoleVO; |
| | | import com.mes.role.mapper.SysRoleMapper; |
| | | import com.mes.role.service.SysRoleMenuService; |
| | | import com.mes.role.service.SysRoleService; |
| | | import com.mes.userinfo.entity.SysUserRole; |
| | | import com.mes.userinfo.service.SysUserRoleService; |
| | | import com.mes.userinfo.service.SysUserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService { |
| | | |
| | | @Autowired |
| | | SysRoleMenuService sysRoleMenuService; |
| | | |
| | | @Autowired |
| | | SysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | SysUserRoleService sysUserRoleService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysRole saveRole(SysRoleVO sysRoleVO) { |
| | | log.info("保存角色信息,生成对应的角色id"); |
| | | SysRole sysRole = new SysRole(); |
| | | BeanUtils.copyProperties(sysRoleVO, sysRole); |
| | | this.save(sysRole); |
| | | //保存角色权限信息 |
| | | saveRoleMenu(sysRole.getId(), sysRoleVO.getMenuList()); |
| | | return sysRole; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String updateRole(SysRoleVO sysRoleVO) { |
| | | log.info("保存角色信息,生成对应的角色id"); |
| | | SysRole sysRole = new SysRole(); |
| | | BeanUtils.copyProperties(sysRoleVO, sysRole); |
| | | this.updateById(sysRole); |
| | | //保存角色权限信息 |
| | | return saveRoleMenu(sysRole.getId(), sysRoleVO.getMenuList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysRoleVO> queryRole(GeneralRequest request) { |
| | | MPJLambdaWrapper<SysRole> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.selectAll(SysRole.class) |
| | | .selectCollection(SysMenu.class, SysRoleVO::getMenuList) |
| | | .leftJoin(SysRoleMenu.class, SysRoleMenu::getRoleId, SysRole::getId) |
| | | .leftJoin(SysMenu.class, SysMenu::getId, SysRoleMenu::getMenuId) |
| | | .like(StringUtils.hasText(request.getKey()), SysRole::getName, request.getKey()); |
| | | return baseMapper.selectJoinList(SysRoleVO.class, wrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String deleteRole(List<Long> ids) { |
| | | log.info("删除角色信息"); |
| | | this.removeByIds(ids); |
| | | |
| | | log.info("删除中间表信息"); |
| | | sysUserRoleService.remove(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, ids)); |
| | | sysRoleMenuService.remove(new LambdaQueryWrapper<SysRoleMenu>().in(SysRoleMenu::getRoleId, ids)); |
| | | |
| | | log.info("清空缓存中的权限信息"); |
| | | ids.stream().forEach(id -> sysUserService.clearUserAuthorityInfoByRoleId(id)); |
| | | return "success"; |
| | | } |
| | | |
| | | /** |
| | | * 保存角色权限信息 |
| | | * |
| | | * @param roleId |
| | | * @param menuList |
| | | * @return |
| | | */ |
| | | private String saveRoleMenu(Long roleId, List<SysMenu> menuList) { |
| | | log.info("配置角色菜单关心"); |
| | | List<SysRoleMenu> roleMenuList = menuList.stream().map(menu -> { |
| | | SysRoleMenu roleMenu = new SysRoleMenu(); |
| | | roleMenu.setRoleId(roleId); |
| | | roleMenu.setMenuId(menu.getId()); |
| | | return roleMenu; |
| | | }).collect(Collectors.toList()); |
| | | log.info("清空角色权限表中该角色信息"); |
| | | |
| | | |
| | | // 先删除原来的记录,再保存新的 |
| | | sysRoleMenuService.remove(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId)); |
| | | sysRoleMenuService.saveBatch(roleMenuList); |
| | | |
| | | // 删除缓存 |
| | | sysUserService.clearUserAuthorityInfoByRoleId(roleId); |
| | | return "success"; |
| | | } |
| | | } |
| | |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | sd: |
| | | url: jdbc:mysql://192.168.1.199:3306/sd?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://127.0.0.1:3306/sd?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | sd: |
| | | url: jdbc:mysql://192.168.1.199:3306/sd?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://10.153.19.150:3306/sd?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | |
| | | List<OptimizeDetail> list = optimizationDetailService.list(); |
| | | System.out.println("获取记录数:" + list.size()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.order.entity.Orderdetail; |
| | | import com.mes.order.entity.Orders; |
| | | import com.mes.order.service.OrdersService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.pp.entity.request.Reportingdamage; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.pp.service.ReportingWorkService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.impl.UpPattenUsageServiceImpl; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | |
| | | private UpWorkstationService workstationService; |
| | | @Autowired |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @Autowired |
| | | private OrdersService ordersService; |
| | | @Autowired |
| | | private ReportingWorkService reportingWorkService; |
| | | @Test |
| | | public void test() { |
| | | // List<OptimizeProject> list = optimizeProjectMapper.saveProject("P24032204"); |
| | |
| | | boolean isOver= upPattenUsageService.updateGlassState(upPattenUsage); |
| | | log.info("更改是否成功{}",isOver); |
| | | } |
| | | @Test |
| | | public void test2() { |
| | | List<Orders> list = ordersService.selectOrders(); |
| | | System.out.println("获取记录数:" + list); |
| | | } |
| | | @Test |
| | | public void test3() { |
| | | Orders orders = new Orders(); |
| | | orders.setOrderId("P24051103"); |
| | | List<Orderdetail> list = ordersService.selectOrderdetail(orders); |
| | | System.out.println("订单详细数据:" + list); |
| | | } |
| | | @Test |
| | | public void test4() { |
| | | Reportingdamage orders = new Reportingdamage(); |
| | | orders.setThisProcess("磨边"); |
| | | orders.setDeviceName("快速磨"); |
| | | List<Reportingdamage> list = reportingWorkService.selectDamage(orders); |
| | | System.out.println("订单详细数据:" + list); |
| | | } |
| | | |
| | | |
| | | } |