parent
f945472793
commit
aac86fd8f5
8 changed files with 424 additions and 0 deletions
@ -0,0 +1,53 @@ |
||||
package org.springblade.desk.oem.pojo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* 外协标准工序代码 实体类 |
||||
* |
||||
* @author maxg |
||||
* @since 2026-04-29 |
||||
*/ |
||||
@Data |
||||
@TableName("MES_OEM_STANDARD_PROCESS") |
||||
@Schema(description = "OemStandardProcess对象") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class OemStandardProcessEntity extends BaseEntity { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 工序ID |
||||
*/ |
||||
@Schema(description = "工序ID") |
||||
private Long processId; |
||||
/** |
||||
* 镀种 |
||||
*/ |
||||
@Schema(description = "镀种") |
||||
private String plate; |
||||
/** |
||||
* 镀层厚度 |
||||
*/ |
||||
@Schema(description = "镀层厚度") |
||||
private String plateThickness; |
||||
/** |
||||
* 零件名称 |
||||
*/ |
||||
@Schema(description = "零件名称") |
||||
private String partName; |
||||
/** |
||||
* 标准工序代码 |
||||
*/ |
||||
@Schema(description = "标准工序代码") |
||||
private String standardProcessCode; |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,47 @@ |
||||
package org.springblade.desk.oem.pojo.excel; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serial; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 外协标准工序代码模板导入 |
||||
* |
||||
* @author maxg |
||||
* @since 2026-04-29 |
||||
*/ |
||||
@Data |
||||
@ColumnWidth(25) |
||||
@HeadRowHeight(20) |
||||
@ContentRowHeight(18) |
||||
public class OemStandardProcessExcel implements Serializable { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("工序") |
||||
private String processName; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("镀种") |
||||
private String plate; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("镀层厚度") |
||||
private String plateThickness; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("零件名称") |
||||
private String partName; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("标准工序代码") |
||||
private String standardProcessCode; |
||||
} |
||||
@ -0,0 +1,38 @@ |
||||
package org.springblade.desk.oem.pojo.vo; |
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.desk.oem.pojo.entity.OemStandardProcessEntity; |
||||
|
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* 外协标准工序代码 视图实体类 |
||||
* |
||||
* @author maxg |
||||
* @since 2026-04-29 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class OemStandardProcessVO extends OemStandardProcessEntity { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Schema(description = "工序名称") |
||||
private String processName; |
||||
|
||||
@Schema(description = "维护人") |
||||
private String updateUserName; |
||||
|
||||
/** |
||||
* 排序字段 |
||||
*/ |
||||
private String orderByField; |
||||
/** |
||||
* true: 升序,false: 降序 |
||||
*/ |
||||
private boolean isAsc; |
||||
|
||||
} |
||||
@ -0,0 +1,146 @@ |
||||
package org.springblade.desk.oem.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.Parameter; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import jakarta.validation.Valid; |
||||
import lombok.AllArgsConstructor; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springblade.core.excel.util.ExcelUtil; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.desk.basic.util.ExcelExtUtil; |
||||
import org.springblade.desk.dashboard.pojo.entity.BsProcessSetEntity; |
||||
import org.springblade.desk.dashboard.service.IBsProcessSetService; |
||||
import org.springblade.desk.oem.pojo.entity.OemStandardProcessEntity; |
||||
import org.springblade.desk.oem.pojo.excel.OemStandardProcessExcel; |
||||
import org.springblade.desk.oem.pojo.vo.OemStandardProcessVO; |
||||
import org.springblade.desk.oem.service.IOemStandardProcessService; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.core.io.Resource; |
||||
import org.springframework.http.ResponseEntity; |
||||
import org.springframework.util.CollectionUtils; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashSet; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* 外协标准工序代码 控制器 |
||||
* |
||||
* @author maxg |
||||
* @since 2026-04-29 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/mesOemStandardProcess") |
||||
@Tag(name = "外协标准工序代码", description = "外协标准工序代码接口") |
||||
public class OemStandardProcessController { |
||||
|
||||
private final IOemStandardProcessService oemStandardProcessService; |
||||
|
||||
private final IBsProcessSetService bsProcessSetService; |
||||
|
||||
/** |
||||
* 外协标准工序代码 自定义分页 |
||||
*/ |
||||
@GetMapping("/page") |
||||
@Operation(summary = "分页", description = "传入oemStandardProcess") |
||||
public R<IPage<OemStandardProcessVO>> page(OemStandardProcessVO oemStandardProcess, Query query) { |
||||
IPage<OemStandardProcessVO> pages = oemStandardProcessService.selectOemStandardProcessPage(Condition.getPage(query), oemStandardProcess); |
||||
return R.data(pages); |
||||
} |
||||
|
||||
/** |
||||
* 外协标准工序代码 新增或修改 |
||||
* |
||||
* @param oemStandardProcessList |
||||
* @return |
||||
*/ |
||||
@PostMapping("/submit") |
||||
@Operation(summary = "新增或修改", description = "传入bsEfficiencyTempList") |
||||
public R submit(@Valid @RequestBody List<OemStandardProcessEntity> oemStandardProcessList) { |
||||
for (OemStandardProcessEntity oemStandardProcessEntity : oemStandardProcessList) { |
||||
LambdaQueryWrapper<OemStandardProcessEntity> wrapper = new LambdaQueryWrapper<OemStandardProcessEntity>().eq(OemStandardProcessEntity::getProcessId, oemStandardProcessEntity.getProcessId()).eq(OemStandardProcessEntity::getPlate, oemStandardProcessEntity.getPlate()).eq(OemStandardProcessEntity::getPlateThickness, oemStandardProcessEntity.getPlateThickness()).eq(OemStandardProcessEntity::getPartName, oemStandardProcessEntity.getPartName()); |
||||
if (oemStandardProcessEntity.getId() != null) { |
||||
wrapper.ne(OemStandardProcessEntity::getId, oemStandardProcessEntity.getId()); |
||||
} |
||||
List<OemStandardProcessEntity> list = oemStandardProcessService.list(wrapper); |
||||
if (!CollectionUtils.isEmpty(list)) { |
||||
return R.fail("数据已存在"); |
||||
} |
||||
} |
||||
return R.status(oemStandardProcessService.saveOrUpdateBatch(oemStandardProcessList)); |
||||
} |
||||
|
||||
/** |
||||
* 外协标准工序代码 删除 |
||||
*/ |
||||
@PostMapping("/remove") |
||||
@Operation(summary = "逻辑删除", description = "传入ids") |
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
||||
return R.status(oemStandardProcessService.deleteLogic(Func.toLongList(ids))); |
||||
} |
||||
|
||||
/** |
||||
* 外协标准工序代码 下载模板 |
||||
* @return |
||||
*/ |
||||
@GetMapping("/download-excel-template") |
||||
@Operation(summary = "下载Excel模板", description = "") |
||||
public ResponseEntity<Resource> downloadExcelTemplate() { |
||||
return ExcelExtUtil.downloadXlsTemplate("Excel/oem/标准工序代码.xls", "导入模版-标准工序代码.xls"); |
||||
} |
||||
|
||||
/** |
||||
* 外协标准工序代码 导入Excel |
||||
* @param file |
||||
* @return |
||||
*/ |
||||
@PostMapping("/import-excel") |
||||
@Operation(summary = "导入Excel", description = "MultipartFile") |
||||
public R importExcel(@RequestParam("file") MultipartFile file) { |
||||
R checkR = ExcelExtUtil.importExcelCheck(file); |
||||
if (checkR != null) { |
||||
return checkR; |
||||
} |
||||
List<OemStandardProcessExcel> importList = ExcelUtil.read(file, 0, 1, OemStandardProcessExcel.class); |
||||
Set<String> uniqueSet = new HashSet<>(); |
||||
List<OemStandardProcessEntity> entityList = new ArrayList<>(); |
||||
for (int i = 0; i < importList.size(); i++) { |
||||
int rowNum = i + 2; |
||||
OemStandardProcessExcel row = importList.get(i); |
||||
if (StringUtils.isEmpty(row.getProcessName())) { |
||||
return R.fail(rowNum + "行工序未填写"); |
||||
} |
||||
if(StringUtils.isEmpty(row.getStandardProcessCode())){ |
||||
return R.fail(rowNum + "行标准工序代码未填写"); |
||||
} |
||||
String uniqueStr = StringUtils.joinWith("|", row.getProcessName(), row.getPlate(), row.getPlateThickness(), row.getPartName()); |
||||
if (!uniqueSet.add(uniqueStr)) { |
||||
return R.fail(rowNum + "行在Excel中重复"); |
||||
} |
||||
BsProcessSetEntity processSet = bsProcessSetService.getOne(new LambdaQueryWrapper<BsProcessSetEntity>().eq(BsProcessSetEntity::getName, row.getProcessName())); |
||||
if (processSet == null) { |
||||
return R.fail(rowNum + "行错误,系统无此工序"); |
||||
} |
||||
OemStandardProcessEntity exist = oemStandardProcessService.getOne(new LambdaQueryWrapper<OemStandardProcessEntity>().eq(OemStandardProcessEntity::getProcessId, processSet.getId()).eq(OemStandardProcessEntity::getPlate, row.getPlate()).eq(OemStandardProcessEntity::getPlateThickness, row.getPlateThickness()).eq(OemStandardProcessEntity::getPartName, row.getPartName())); |
||||
if (exist != null) { |
||||
return R.fail(rowNum + "行错误,数据已存在"); |
||||
} |
||||
OemStandardProcessEntity entity = new OemStandardProcessEntity(); |
||||
BeanUtils.copyProperties(row, entity); |
||||
entity.setProcessId(processSet.getId()); |
||||
entityList.add(entity); |
||||
} |
||||
return R.status(oemStandardProcessService.saveBatch(entityList)); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
package org.springblade.desk.oem.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.desk.efficiency.pojo.vo.BsEfficiencyTaskVO; |
||||
import org.springblade.desk.oem.pojo.entity.OemStandardProcessEntity; |
||||
import org.springblade.desk.oem.pojo.vo.OemStandardProcessVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 外协标准工序代码 Mapper接口 |
||||
* |
||||
* @author maxg |
||||
* @since 2026-04-29 |
||||
*/ |
||||
public interface OemStandardProcessMapper extends BaseMapper<OemStandardProcessEntity> { |
||||
|
||||
/** |
||||
* 自定义分页 |
||||
* |
||||
* @param page 分页参数 |
||||
* @param oemStandardProcess 查询参数 |
||||
* @return List<BsEfficiencyTaskVO> |
||||
*/ |
||||
List<OemStandardProcessVO> selectOemStandardProcessPage(IPage page, OemStandardProcessVO oemStandardProcess); |
||||
} |
||||
@ -0,0 +1,63 @@ |
||||
<?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="org.springblade.desk.oem.mapper.OemStandardProcessMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="mesOemStandardProcessVOResultMap" type="org.springblade.desk.oem.pojo.vo.OemStandardProcessVO"> |
||||
<result column="ID" property="id"/> |
||||
<result column="PROCESS_ID" property="processId"/> |
||||
<result column="PLATE" property="plate"/> |
||||
<result column="PLATE_THICKNESS" property="plateThickness"/> |
||||
<result column="PART_NAME" property="partName"/> |
||||
<result column="STANDARD_PROCESS_CODE" property="standardProcessCode"/> |
||||
<result column="CREATE_USER" property="createUser"/> |
||||
<result column="CREATE_TIME" property="createTime"/> |
||||
<result column="CREATE_DEPT" property="createDept"/> |
||||
<result column="UPDATE_USER" property="updateUser"/> |
||||
<result column="UPDATE_TIME" property="updateTime"/> |
||||
<result column="STATUS" property="status"/> |
||||
<result column="IS_DELETED" property="isDeleted"/> |
||||
<result column="PROCESS_NAME" property="processName"/> |
||||
<result column="UPDATE_USER_NAME" property="updateUserName"/> |
||||
</resultMap> |
||||
|
||||
<select id="selectOemStandardProcessPage" resultMap="mesOemStandardProcessVOResultMap"> |
||||
SELECT * FROM ( |
||||
SELECT t.*, |
||||
p.NAME as PROCESS_NAME, |
||||
bu.REAL_NAME as UPDATE_USER_NAME |
||||
FROM MES_OEM_STANDARD_PROCESS t |
||||
INNER JOIN BS_PROCESS_SET p ON t.PROCESS_ID = p.ID AND p.IS_DELETED = 0 |
||||
LEFT JOIN BLADE_USER bu ON t.update_user = bu.id |
||||
<where> |
||||
t.IS_DELETED = 0 |
||||
<if test="oemStandardProcess.processName != null"> |
||||
AND p.NAME like concat(concat('%', #{oemStandardProcess.processName}),'%') |
||||
</if> |
||||
<if test="oemStandardProcess.plate != null"> |
||||
AND t.PLATE like concat(concat('%', #{oemStandardProcess.plate}),'%') |
||||
</if> |
||||
<if test="oemStandardProcess.plateThickness != null"> |
||||
AND t.PLATE_THICKNESS like concat(concat('%', #{oemStandardProcess.plateThickness}),'%') |
||||
</if> |
||||
<if test="oemStandardProcess.partName != null"> |
||||
AND t.PART_NAME like concat(concat('%', #{oemStandardProcess.partName}),'%') |
||||
</if> |
||||
<if test="oemStandardProcess.standardProcessCode != null"> |
||||
AND t.STANDARD_PROCESS_CODE like concat(concat('%', #{oemStandardProcess.standardProcessCode}),'%') |
||||
</if> |
||||
</where> |
||||
) |
||||
<choose> |
||||
<when test="oemStandardProcess.orderByField != null and oemStandardProcess.orderByField != ''"> |
||||
ORDER BY ${oemStandardProcess.orderByField} |
||||
<if test="oemStandardProcess.isAsc">ASC</if> |
||||
<if test="!oemStandardProcess.isAsc">DESC</if> |
||||
</when> |
||||
<otherwise> |
||||
ORDER BY CREATE_TIME DESC |
||||
</otherwise> |
||||
</choose> |
||||
</select> |
||||
|
||||
</mapper> |
||||
@ -0,0 +1,25 @@ |
||||
package org.springblade.desk.oem.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.desk.efficiency.pojo.vo.BsEfficiencyTaskParamVO; |
||||
import org.springblade.desk.oem.pojo.entity.OemStandardProcessEntity; |
||||
import org.springblade.desk.oem.pojo.vo.OemStandardProcessVO; |
||||
|
||||
/** |
||||
* 外协标准工序代码 服务类 |
||||
* |
||||
* @author maxg |
||||
* @since 2026-04-29 |
||||
*/ |
||||
public interface IOemStandardProcessService extends BaseService<OemStandardProcessEntity> { |
||||
|
||||
/** |
||||
* 自定义分页 |
||||
* |
||||
* @param page 分页参数 |
||||
* @param oemStandardProcess 查询参数 |
||||
* @return IPage<OemStandardProcessVO> |
||||
*/ |
||||
IPage<OemStandardProcessVO> selectOemStandardProcessPage(IPage<OemStandardProcessVO> page, OemStandardProcessVO oemStandardProcess); |
||||
} |
||||
@ -0,0 +1,25 @@ |
||||
package org.springblade.desk.oem.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.desk.oem.mapper.OemStandardProcessMapper; |
||||
import org.springblade.desk.oem.pojo.entity.OemStandardProcessEntity; |
||||
import org.springblade.desk.oem.pojo.vo.OemStandardProcessVO; |
||||
import org.springblade.desk.oem.service.IOemStandardProcessService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* 外协标准工序代码 服务实现类 |
||||
* |
||||
* @author maxg |
||||
* @since 2026-04-29 |
||||
*/ |
||||
@Service |
||||
public class OemStandardProcessServiceImpl extends BaseServiceImpl<OemStandardProcessMapper, OemStandardProcessEntity> implements IOemStandardProcessService { |
||||
|
||||
@Override |
||||
public IPage<OemStandardProcessVO> selectOemStandardProcessPage(IPage<OemStandardProcessVO> page, OemStandardProcessVO oemStandardProcess) { |
||||
return page.setRecords(baseMapper.selectOemStandardProcessPage(page, oemStandardProcess)); |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue