0729接口逻辑修改

This commit is contained in:
2025-07-29 16:18:53 +08:00
parent 0696040874
commit 20f6be7790
17 changed files with 225 additions and 686 deletions

View File

@@ -8,16 +8,11 @@ import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.InputStream;
import java.util.Base64;
import java.util.UUID;
import java.util.Date;
/**
* MinIO 工具类(支持上传并设置 bucket 公共访问权限)
*/
@Component
public class MinioUtil {
@@ -44,29 +39,30 @@ public class MinioUtil {
}
/**
* 上传文件到指定 bucket 的指定目录(自动设置公共权限)
*
* @param file 上传的文件
* @param bucketName bucket 名称
* @param folder 目录前缀(如 "signature/"
* @return 返回公网可访问的 URL
* @throws Exception 异常
* 自动生成今日目录yyyy-MM-dd/
*/
private String getTodayFolder() {
return DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.getNowDate()) + "/";
}
/**
* 上传文件到指定 bucket 和目录
*/
public String upload(MultipartFile file, String bucketName, String folder) throws Exception {
String originalName = file.getOriginalFilename();
String ext = originalName != null && originalName.contains(".")
String ext = (originalName != null && originalName.contains("."))
? originalName.substring(originalName.lastIndexOf("."))
: "";
String objectName = folder + UUID.randomUUID().toString().replace("-", "") + ext;
try (InputStream in = file.getInputStream()) {
// 如果 bucket 不存在,则创建
// 检查或创建 bucket
boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
if (!exists) {
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
}
// 强制设置 bucket 策略为 public-read幂等
// 设置 bucket 公共策略
String policyJson = "{\n" +
" \"Version\":\"2012-10-17\",\n" +
" \"Statement\":[\n" +
@@ -79,14 +75,12 @@ public class MinioUtil {
" ]\n" +
"}";
minioClient.setBucketPolicy(
SetBucketPolicyArgs.builder()
.bucket(bucketName)
.config(policyJson)
.build()
);
minioClient.setBucketPolicy(SetBucketPolicyArgs.builder()
.bucket(bucketName)
.config(policyJson)
.build());
// 上传文件
// 上传
minioClient.putObject(PutObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
@@ -97,19 +91,21 @@ public class MinioUtil {
return endpoint + "/" + bucketName + "/" + objectName;
}
/**
* 上传 Base64 图片到指定 bucket 和目录
*/
public String uploadBase64(String imgStr, String bucketName, String folder) {
try {
String objectName = folder + UUID.randomUUID().toString().replace("-", "") + ".png";
imgStr = imgStr.replace("data:image/png;base64,", "").replace("data:image/jpeg;base64,", "");
byte[] imageBytes = Base64.getDecoder().decode(imgStr);
// 确保 bucket 存在
boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
if (!exists) {
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
}
// 设置公共访问策略(幂等)
String policyJson = "{\n" +
" \"Version\":\"2012-10-17\",\n" +
" \"Statement\":[\n" +
@@ -122,14 +118,11 @@ public class MinioUtil {
" ]\n" +
"}";
minioClient.setBucketPolicy(
SetBucketPolicyArgs.builder()
.bucket(bucketName)
.config(policyJson)
.build()
);
minioClient.setBucketPolicy(SetBucketPolicyArgs.builder()
.bucket(bucketName)
.config(policyJson)
.build());
// 构造 InputStream 上传
try (InputStream inputStream = new java.io.ByteArrayInputStream(imageBytes)) {
minioClient.putObject(PutObjectArgs.builder()
.bucket(bucketName)
@@ -147,17 +140,30 @@ public class MinioUtil {
}
/**
* 上传文件到默认 bucket 根目录
* 默认 bucket 上传
*/
public String upload(MultipartFile file) throws Exception {
return upload(file, defaultBucket, "");
}
/**
* 上传文件到默认 bucket 指定目录
* 默认 bucket 指定目录上传
*/
public String upload(MultipartFile file, String folder) throws Exception {
return upload(file, defaultBucket, folder);
}
/**
* 默认 bucket按日期目录上传MultipartFile
*/
public String uploadToDateFolder(MultipartFile file) throws Exception {
return upload(file, defaultBucket, getTodayFolder());
}
/**
* 默认 bucket按日期目录上传Base64
*/
public String uploadBase64ToDateFolder(String imgStr) {
return uploadBase64(imgStr, defaultBucket, getTodayFolder());
}
}

View File

@@ -37,7 +37,7 @@ public class DeviceInfoController extends BaseController
/**
* 查询设备信息列表
*/
// @PreAuthorize("@ss.hasPermi('information:device:list')")
@PreAuthorize("@ss.hasPermi('information:device:list')")
@GetMapping("/list")
public TableDataInfo list(DeviceInfo deviceInfo)
{

View File

@@ -28,7 +28,7 @@ public class GysJhController extends BaseController
@Autowired
private IGysJhService gysJhService;
/**
/**A
* 查询供应计划列表
*/
@PreAuthorize("@ss.hasPermi('plan:jh:list')")

View File

@@ -35,7 +35,7 @@ public class MoveRecordController extends BaseController
/**
* 新增移库记录
*/
@PreAuthorize("@ss.hasPermi('inventory:move:add')")
@PreAuthorize("@ss.hasPermi('wisdom:stock:move')")
@Log(title = "移库记录", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult processMove(@RequestBody MoveRequestDTO dto) {
@@ -47,7 +47,7 @@ public class MoveRecordController extends BaseController
/**
* 查询移库记录列表
*/
@PreAuthorize("@ss.hasPermi('inventory:move:list')")
@PreAuthorize("@ss.hasPermi('wisdom:move:list')")
@GetMapping("/list")
public TableDataInfo list(MoveRecord moveRecord)
{

View File

@@ -85,7 +85,7 @@ public class RkInfoController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('wisdom:stock:edit')")
@Log(title = "库存单据主", businessType = BusinessType.UPDATE)
@PutMapping
@PutMapping("/update")
public AjaxResult edit(@RequestBody RkInfo rkInfo)
{
return toAjax(rkInfoService.updateRkInfo(rkInfo));

View File

@@ -73,9 +73,10 @@ public interface GysJhMapper
/**
* 修改状态
* @param gysJhId
* @param gysJhId 主键ID
* @param status 状态值1=全部入库2=部分入库)
*/
void updateStatusById(Long gysJhId);
void updateStatusById(@Param("id") Long gysJhId, @Param("status") String status);
/**
* 重置状态

View File

@@ -175,7 +175,7 @@ public class AuditSignatureServiceImpl implements IAuditSignatureService
.collect(Collectors.toSet());
for (Long jhId : jhIdSet) {
gysJhMapper.updateStatusById(jhId);
gysJhMapper.updateStatusById(jhId,"1");
}
}

View File

@@ -10,11 +10,13 @@ import com.zg.common.utils.http.HttpUtils;
import com.zg.framework.web.domain.AjaxResult;
import com.zg.project.information.mapper.MtdMapper;
import com.zg.project.wisdom.domain.AgvTaskResult;
import com.zg.project.wisdom.domain.AgyWcs;
import com.zg.project.wisdom.domain.DdTask;
import com.zg.project.wisdom.domain.WcsTaskResult;
import com.zg.project.wisdom.domain.dto.TaskExecuteDTO;
import com.zg.project.wisdom.domain.vo.TaskExecuteResultVO;
import com.zg.project.wisdom.mapper.AgvTaskResultMapper;
import com.zg.project.wisdom.mapper.AgyWcsMapper;
import com.zg.project.wisdom.mapper.DdTaskMapper;
import com.zg.project.wisdom.mapper.WcsTaskResultMapper;
import com.zg.project.wisdom.service.IDdTaskService;
@@ -52,6 +54,9 @@ public class DdTaskServiceImpl implements IDdTaskService {
@Autowired
private MtdMapper mtdMapper;
@Autowired
private AgyWcsMapper agyWcsMapper;
//
// @Value("${agv.job.create-url}")
// private String agvJobCreateUrl;
@@ -126,17 +131,20 @@ public class DdTaskServiceImpl implements IDdTaskService {
return ddTaskMapper.deleteDdTaskById(id);
}
/**
* 执行任务
*/
@Override
@Transactional(rollbackFor = Exception.class)
public TaskExecuteResultVO executeTask(TaskExecuteDTO dto) {
Long id = dto.getId();
String targetName = dto.getTargetName();
Integer materialStatus = dto.getMaterialStatus(); // Materialstatus 前端传入
Integer materialStatus = dto.getMaterialStatus();
if (StringUtils.isBlank(targetName)) {
throw new ServiceException("targetName 不能为空");
}
// 1. 查询任务
DdTask task = ddTaskMapper.selectDdTaskById(id);
if (task == null) {
throw new ServiceException("任务不存在ID = " + id);
@@ -146,84 +154,144 @@ public class DdTaskServiceImpl implements IDdTaskService {
}
String taskNo = task.getTaskNo();
String taskType = task.getTaskType(); // 0入库1出库2移库
String requestId = null; // ✅ AGV 使用
String taskIdParam = null; // ✅ WCS 使用,提前声明防作用域错误
String taskType = task.getTaskType();
String requestId = null;
String taskIdParam = null;
String response;
int code;
String msg;
String userId = SecurityUtils.getUserId().toString();
Date now = DateUtils.getNowDate();
// 2. 构造参数
JSONObject param = new JSONObject();
param.put("owner", "wms");
param.put("type", taskType);
param.put("priority", 1);
param.put("sourceName", task.getSourceName());
param.put("targetName", targetName);
if ("0".equals(taskType) || "2".equals(taskType)) {
// ✅ 入库/移库 → AGV
requestId = taskNo + ("0".equals(taskType) ? "11" : "12"); // 拼接规则11 入库12 移库
param.put("taskNo", taskNo);
param.put("requestId", requestId);
log.info("[任务执行] 类型={}AGVrequestId={}, param={}", taskType, requestId, param);
response = HttpUtils.sendPost(agvJobCreateUrl, param.toJSONString());
} else if ("1".equals(taskType)) {
// ✅ 出库 → WCS下架不传 requestId只传 TaskID
if ("1".equals(taskType)) {
// 出库任务:先调 WCS
taskIdParam = taskNo + "22";
param.put("TaskID", taskIdParam);
param.put("Materialstatus", materialStatus);
param.put("outBack", 1);
param.put("TrayNo", "");
param.put("Mlocation", task.getSourceName());
JSONObject wcsParam = new JSONObject();
wcsParam.put("TaskID", taskIdParam);
wcsParam.put("TaskType", 2);
wcsParam.put("Mlocation", task.getSourceName());
wcsParam.put("TrayNo", "");
wcsParam.put("Materialstatus", materialStatus);
wcsParam.put("outBack", 1);
if (materialStatus == 0) {
param.put("MaterialCode", "");
param.put("Specification", "");
param.put("Quantity", "");
wcsParam.put("MaterialCode", "");
wcsParam.put("Specification", "");
wcsParam.put("Quantity", "");
} else {
String materialCode = task.getMid();
String quantity = task.getNum().toString();
String specification = mtdMapper.selectWlmsByWlbh(materialCode);
param.put("MaterialCode", materialCode);
param.put("Quantity", quantity);
param.put("Specification", specification == null ? "" : specification);
wcsParam.put("MaterialCode", materialCode);
wcsParam.put("Quantity", quantity);
wcsParam.put("Specification", specification == null ? "" : specification);
}
log.info("[任务执行] 类型=出库WCS下架TaskID={}, param={}", taskIdParam, param);
response = HttpUtils.sendPost(wcsJobCreateUrl, param.toJSONString());
log.info("[任务执行] 出库 → 调用WCStaskId={}, param={}", taskIdParam, wcsParam);
response = HttpUtils.sendPost(wcsJobCreateUrl, wcsParam.toJSONString());
} else {
throw new ServiceException("未知任务类型: " + taskType);
}
System.out.println("这是打印的出库时调用wcs的响应结果" + response);
// 3. 解析响应
JSONObject respJson;
try {
respJson = JSON.parseObject(response);
code = respJson.getInteger("code");
msg = respJson.getString("msg");
} catch (Exception e) {
throw new ServiceException("响应解析失败: " + response);
}
JSONObject respJson;
try {
respJson = JSON.parseObject(response);
code = respJson.getInteger("code");
msg = respJson.getString("msg");
} catch (Exception e) {
throw new ServiceException("WCS响应解析失败: " + response);
}
if (code != 200) {
throw new ServiceException("任务执行失败: " + msg);
}
if (code != 200) {
throw new ServiceException("WCS任务执行失败: " + msg);
}
// 4. 更新任务状态为已提交
task.setTaskStatus(1);
task.setDoCount(Optional.ofNullable(task.getDoCount()).orElse(0) + 1);
task.setUpdateBy(SecurityUtils.getUserId().toString());
task.setUpdateTime(DateUtils.getNowDate());
ddTaskMapper.updateDdTask(task);
// 写入 WCS 执行记录
WcsTaskResult wcs = new WcsTaskResult();
wcs.setTaskId(taskIdParam);
wcs.setTaskStatus("1");
wcs.setMsg(msg);
wcs.setOwner("wms");
wcs.setType(taskType);
wcs.setPriority("1");
wcs.setSourceName(task.getSourceName());
wcs.setTargetName(targetName);
wcs.setIsDelete("0");
wcs.setCreateBy(userId);
wcs.setCreateTime(now);
wcs.setUpdateTime(now);
wcsTaskResultMapper.insertWcsTaskResult(wcs);
// 5. 写入执行记录
String userId = SecurityUtils.getUserId().toString();
Date now = DateUtils.getNowDate();
// 调用 AGV立即
requestId = taskNo + "12";
JSONObject agvParam = new JSONObject();
agvParam.put("owner", "wms");
agvParam.put("type", "1");
agvParam.put("priority", 1);
agvParam.put("sourceName", task.getSourceName());
agvParam.put("targetName", targetName);
agvParam.put("taskNo", taskNo);
agvParam.put("requestId", requestId);
log.info("[任务执行] 出库 → 调用AGVrequestId={}, param={}", requestId, agvParam);
response = HttpUtils.sendPost(agvJobCreateUrl, agvParam.toJSONString());
try {
respJson = JSON.parseObject(response);
code = respJson.getInteger("code");
msg = respJson.getString("msg");
} catch (Exception e) {
throw new ServiceException("AGV响应解析失败: " + response);
}
if (code != 200) {
throw new ServiceException("AGV任务执行失败: " + msg);
}
AgvTaskResult agv = new AgvTaskResult();
agv.setRequestId(requestId);
agv.setTaskNo(taskNo);
agv.setStatus("CREATED");
agv.setMsg(msg);
agv.setOwner("wms");
agv.setType(taskType);
agv.setPriority("1");
agv.setSourceName(task.getSourceName());
agv.setTargetName(targetName);
agv.setIsDelete("0");
agv.setCreateBy(userId);
agv.setCreateTime(now);
agv.setUpdateTime(now);
agvTaskResultMapper.insertAgvTaskResult(agv);
// ✅ 保存 WCS 与 AGV 映射关系
AgyWcs mapping = new AgyWcs();
mapping.setRequestId(requestId);
mapping.setTaskId(taskIdParam);
agyWcsMapper.insertAgyWcs(mapping);
} else {
// 入库/移库任务 → 调用 AGV
requestId = taskNo + ("0".equals(taskType) ? "11" : "12");
JSONObject param = new JSONObject();
param.put("owner", "wms");
param.put("type", taskType);
param.put("priority", 1);
param.put("sourceName", task.getSourceName());
param.put("targetName", targetName);
param.put("taskNo", taskNo);
param.put("requestId", requestId);
log.info("[任务执行] 类型={}AGVrequestId={}, param={}", taskType, requestId, param);
response = HttpUtils.sendPost(agvJobCreateUrl, param.toJSONString());
JSONObject respJson = JSON.parseObject(response);
code = respJson.getInteger("code");
msg = respJson.getString("msg");
if (code != 200) {
throw new ServiceException("任务执行失败: " + msg);
}
if ("0".equals(taskType) || "2".equals(taskType)) {
AgvTaskResult agv = new AgvTaskResult();
agv.setRequestId(requestId);
agv.setTaskNo(taskNo);
@@ -239,27 +307,16 @@ public class DdTaskServiceImpl implements IDdTaskService {
agv.setCreateTime(now);
agv.setUpdateTime(now);
agvTaskResultMapper.insertAgvTaskResult(agv);
} else if ("1".equals(taskType)) {
WcsTaskResult wcs = new WcsTaskResult();
wcs.setTaskId(taskIdParam);
wcs.setTaskStatus("1");
wcs.setMsg(msg);
wcs.setJobId(null);
wcs.setOwner("wms");
wcs.setType(taskType);
wcs.setPriority("1");
wcs.setSourceName(task.getSourceName());
wcs.setTargetName(targetName);
wcs.setIsDelete("0");
wcs.setCreateBy(userId);
wcs.setCreateTime(now);
wcs.setUpdateTime(now);
wcsTaskResultMapper.insertWcsTaskResult(wcs);
}
// 6. 返回执行结果
task.setTaskStatus(1);
task.setDoCount(Optional.ofNullable(task.getDoCount()).orElse(0) + 1);
task.setUpdateBy(userId);
task.setUpdateTime(now);
ddTaskMapper.updateDdTask(task);
TaskExecuteResultVO vo = new TaskExecuteResultVO();
vo.setRequestId(("0".equals(taskType) || "2".equals(taskType)) ? requestId : null);
vo.setRequestId(requestId);
vo.setCode(code);
vo.setMsg(msg);
return vo;

View File

@@ -188,32 +188,39 @@ public class RkInfoServiceImpl implements IRkInfoService
(a, b) -> b
));
// ✅ 第2步:查询对应供应计划
List<GysJh> jhList = gysJhMapper.selectByIds(new ArrayList<>(realQtyMap.keySet()));
Set<Long> idsToUpdateStatus = new HashSet<>();
// ✅ 第2-4步若包含供应计划ID则处理计划扣减与状态更新
if (!realQtyMap.isEmpty()) {
// ✅ 查询对应供应计划
List<GysJh> jhList = gysJhMapper.selectByIds(new ArrayList<>(realQtyMap.keySet()));
Set<Long> idsToUpdateStatus = new HashSet<>();
// ✅ 第3步更新 jh_qty 和 status根据是否开启审核判断逻辑
for (GysJh jh : jhList) {
Long jhId = jh.getId();
BigDecimal planQty = BigDecimal.valueOf(jh.getJhQty());
BigDecimal realQty = realQtyMap.get(jhId);
if (realQty == null) continue;
// ✅ 更新 jh_qty 和 status根据是否开启审核判断逻辑
for (GysJh jh : jhList) {
Long jhId = jh.getId();
BigDecimal planQty = BigDecimal.valueOf(jh.getJhQty());
BigDecimal realQty = realQtyMap.get(jhId);
if (realQty == null) continue;
boolean isEqual = realQty.compareTo(planQty) == 0;
boolean isEqual = realQty.compareTo(planQty) == 0;
if (!isEqual) {
gysJhMapper.decreaseJhQtyById(jhId, realQty);
idsToUpdateStatus.add(jhId);
} else {
if (!needAudit) {
idsToUpdateStatus.add(jhId);
if (!isEqual) {
// 实到数量小于计划数量,执行扣减 + 设为部分入库2
gysJhMapper.decreaseJhQtyById(jhId, realQty);
if (!needAudit) {
gysJhMapper.updateStatusById(jhId, "2"); // 2 = 部分入库
}
} else {
// 实到数量等于计划数量状态设为全部入库1不做扣减
if (!needAudit) {
gysJhMapper.updateStatusById(jhId, "1"); // 1 = 全部入库
}
}
}
}
// ✅ 第4步批量更新 status = 2
if (!idsToUpdateStatus.isEmpty()) {
gysJhMapper.batchUpdateStatusByIds(idsToUpdateStatus);
// ✅ 批量更新 status = 2
if (!idsToUpdateStatus.isEmpty()) {
gysJhMapper.batchUpdateStatusByIds(idsToUpdateStatus);
}
}
// ✅ 第5步构建 RkInfo 入库记录
@@ -299,6 +306,7 @@ public class RkInfoServiceImpl implements IRkInfoService
}
}
/**
* 新增入库单据APP
* @param dto
@@ -346,13 +354,15 @@ public class RkInfoServiceImpl implements IRkInfoService
boolean isEqual = realQty.compareTo(planQty) == 0;
if (!isEqual) {
// 数量不相等,减数量 + 状态设为 2
// 实到数量小于计划数量,执行扣减 + 设为部分入库2
gysJhMapper.decreaseJhQtyById(jhId, realQty);
idsToUpdateStatus.add(jhId);
} else {
if (!needAudit) {
// 审核关闭且数量相等,仅更新状态
idsToUpdateStatus.add(jhId);
gysJhMapper.updateStatusById(jhId, "2"); // 2 = 部分入库
}
} else {
// 实到数量等于计划数量状态设为全部入库1不做扣减
if (!needAudit) {
gysJhMapper.updateStatusById(jhId, "1"); // 1 = 全部入库
}
}
}

View File

@@ -1,104 +0,0 @@
package com.zg.project.information.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zg.framework.aspectj.lang.annotation.Log;
import com.zg.framework.aspectj.lang.enums.BusinessType;
import com.zg.project.information.domain.MaterialType;
import com.zg.project.information.service.IMaterialTypeService;
import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult;
import com.zg.common.utils.poi.ExcelUtil;
import com.zg.framework.web.page.TableDataInfo;
/**
* 物资类型Controller
*
* @author zg
* @date 2025-05-27
*/
@RestController
@RequestMapping("/information/materialtype")
public class MaterialTypeController extends BaseController
{
@Autowired
private IMaterialTypeService materialTypeService;
/**
* 查询物资类型列表
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:list')")
@GetMapping("/list")
public TableDataInfo list(MaterialType materialType)
{
startPage();
List<MaterialType> list = materialTypeService.selectMaterialTypeList(materialType);
return getDataTable(list);
}
/**
* 导出物资类型列表
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:export')")
@Log(title = "物资类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MaterialType materialType)
{
List<MaterialType> list = materialTypeService.selectMaterialTypeList(materialType);
ExcelUtil<MaterialType> util = new ExcelUtil<MaterialType>(MaterialType.class);
util.exportExcel(response, list, "物资类型数据");
}
/**
* 获取物资类型详细信息
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(materialTypeService.selectMaterialTypeById(id));
}
/**
* 新增物资类型
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:add')")
@Log(title = "物资类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MaterialType materialType)
{
return toAjax(materialTypeService.insertMaterialType(materialType));
}
/**
* 修改物资类型
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:edit')")
@Log(title = "物资类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MaterialType materialType)
{
return toAjax(materialTypeService.updateMaterialType(materialType));
}
/**
* 删除物资类型
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:remove')")
@Log(title = "物资类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(materialTypeService.deleteMaterialTypeByIds(ids));
}
}

View File

@@ -1,132 +0,0 @@
package com.zg.project.information.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zg.framework.aspectj.lang.annotation.Excel;
import com.zg.framework.web.domain.BaseEntity;
/**
* 物资类型对象 material_type
*
* @author zg
* @date 2025-05-27
*/
public class MaterialType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 物资类型编码 */
@Excel(name = "物资类型编码")
private String typeCode;
/** 物资类型名称 */
@Excel(name = "物资类型名称")
private String typeName;
/** 状态1=启用0=禁用) */
@Excel(name = "状态", readConverterExp = "1==启用0=禁用")
private Long status;
/** 排序值 */
@Excel(name = "排序值")
private Long sort;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTypeCode(String typeCode)
{
this.typeCode = typeCode;
}
public String getTypeCode()
{
return typeCode;
}
public void setTypeName(String typeName)
{
this.typeName = typeName;
}
public String getTypeName()
{
return typeName;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public void setSort(Long sort)
{
this.sort = sort;
}
public Long getSort()
{
return sort;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("typeCode", getTypeCode())
.append("typeName", getTypeName())
.append("status", getStatus())
.append("sort", getSort())
.append("remark", getRemark())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
}
}

View File

@@ -1,61 +0,0 @@
package com.zg.project.information.mapper;
import java.util.List;
import com.zg.project.information.domain.MaterialType;
/**
* 物资类型Mapper接口
*
* @author zg
* @date 2025-05-27
*/
public interface MaterialTypeMapper
{
/**
* 查询物资类型
*
* @param id 物资类型主键
* @return 物资类型
*/
public MaterialType selectMaterialTypeById(Long id);
/**
* 查询物资类型列表
*
* @param materialType 物资类型
* @return 物资类型集合
*/
public List<MaterialType> selectMaterialTypeList(MaterialType materialType);
/**
* 新增物资类型
*
* @param materialType 物资类型
* @return 结果
*/
public int insertMaterialType(MaterialType materialType);
/**
* 修改物资类型
*
* @param materialType 物资类型
* @return 结果
*/
public int updateMaterialType(MaterialType materialType);
/**
* 删除物资类型
*
* @param id 物资类型主键
* @return 结果
*/
public int deleteMaterialTypeById(Long id);
/**
* 批量删除物资类型
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialTypeByIds(Long[] ids);
}

View File

@@ -1,61 +0,0 @@
package com.zg.project.information.service;
import java.util.List;
import com.zg.project.information.domain.MaterialType;
/**
* 物资类型Service接口
*
* @author zg
* @date 2025-05-27
*/
public interface IMaterialTypeService
{
/**
* 查询物资类型
*
* @param id 物资类型主键
* @return 物资类型
*/
public MaterialType selectMaterialTypeById(Long id);
/**
* 查询物资类型列表
*
* @param materialType 物资类型
* @return 物资类型集合
*/
public List<MaterialType> selectMaterialTypeList(MaterialType materialType);
/**
* 新增物资类型
*
* @param materialType 物资类型
* @return 结果
*/
public int insertMaterialType(MaterialType materialType);
/**
* 修改物资类型
*
* @param materialType 物资类型
* @return 结果
*/
public int updateMaterialType(MaterialType materialType);
/**
* 批量删除物资类型
*
* @param ids 需要删除的物资类型主键集合
* @return 结果
*/
public int deleteMaterialTypeByIds(Long[] ids);
/**
* 删除物资类型信息
*
* @param id 物资类型主键
* @return 结果
*/
public int deleteMaterialTypeById(Long id);
}

View File

@@ -1,93 +0,0 @@
package com.zg.project.information.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zg.project.information.mapper.MaterialTypeMapper;
import com.zg.project.information.domain.MaterialType;
import com.zg.project.information.service.IMaterialTypeService;
/**
* 物资类型Service业务层处理
*
* @author zg
* @date 2025-05-27
*/
@Service
public class MaterialTypeServiceImpl implements IMaterialTypeService
{
@Autowired
private MaterialTypeMapper materialTypeMapper;
/**
* 查询物资类型
*
* @param id 物资类型主键
* @return 物资类型
*/
@Override
public MaterialType selectMaterialTypeById(Long id)
{
return materialTypeMapper.selectMaterialTypeById(id);
}
/**
* 查询物资类型列表
*
* @param materialType 物资类型
* @return 物资类型
*/
@Override
public List<MaterialType> selectMaterialTypeList(MaterialType materialType)
{
return materialTypeMapper.selectMaterialTypeList(materialType);
}
/**
* 新增物资类型
*
* @param materialType 物资类型
* @return 结果
*/
@Override
public int insertMaterialType(MaterialType materialType)
{
return materialTypeMapper.insertMaterialType(materialType);
}
/**
* 修改物资类型
*
* @param materialType 物资类型
* @return 结果
*/
@Override
public int updateMaterialType(MaterialType materialType)
{
return materialTypeMapper.updateMaterialType(materialType);
}
/**
* 批量删除物资类型
*
* @param ids 需要删除的物资类型主键
* @return 结果
*/
@Override
public int deleteMaterialTypeByIds(Long[] ids)
{
return materialTypeMapper.deleteMaterialTypeByIds(ids);
}
/**
* 删除物资类型信息
*
* @param id 物资类型主键
* @return 结果
*/
@Override
public int deleteMaterialTypeById(Long id)
{
return materialTypeMapper.deleteMaterialTypeById(id);
}
}

View File

@@ -1,85 +0,0 @@
<?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.zg.project.information.mapper.MaterialTypeMapper">
<resultMap type="MaterialType" id="MaterialTypeResult">
<result property="id" column="id" />
<result property="typeCode" column="type_code" />
<result property="typeName" column="type_name" />
<result property="status" column="status" />
<result property="sort" column="sort" />
<result property="remark" column="remark" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectMaterialTypeVo">
select id, type_code, type_name, status, sort, remark, created_at, updated_at from material_type
</sql>
<select id="selectMaterialTypeList" parameterType="MaterialType" resultMap="MaterialTypeResult">
<include refid="selectMaterialTypeVo"/>
<where>
<if test="typeCode != null and typeCode != ''"> and type_code = #{typeCode}</if>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="status != null "> and status = #{status}</if>
<if test="sort != null "> and sort = #{sort}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where>
</select>
<select id="selectMaterialTypeById" parameterType="Long" resultMap="MaterialTypeResult">
<include refid="selectMaterialTypeVo"/>
where id = #{id}
</select>
<insert id="insertMaterialType" parameterType="MaterialType" useGeneratedKeys="true" keyProperty="id">
insert into material_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeCode != null and typeCode != ''">type_code,</if>
<if test="typeName != null and typeName != ''">type_name,</if>
<if test="status != null">status,</if>
<if test="sort != null">sort,</if>
<if test="remark != null">remark,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeCode != null and typeCode != ''">#{typeCode},</if>
<if test="typeName != null and typeName != ''">#{typeName},</if>
<if test="status != null">#{status},</if>
<if test="sort != null">#{sort},</if>
<if test="remark != null">#{remark},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
</trim>
</insert>
<update id="updateMaterialType" parameterType="MaterialType">
update material_type
<trim prefix="SET" suffixOverrides=",">
<if test="typeCode != null and typeCode != ''">type_code = #{typeCode},</if>
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
<if test="status != null">status = #{status},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMaterialTypeById" parameterType="Long">
delete from material_type where id = #{id}
</delete>
<delete id="deleteMaterialTypeByIds" parameterType="String">
delete from material_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -90,6 +90,7 @@ spring:
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# token配置
token:
# 令牌自定义标识

View File

@@ -159,10 +159,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateStatusById" parameterType="Long">
update gys_jh
set status = '1'
where id = #{id}
<update id="updateStatusById" parameterType="map">
UPDATE gys_jh
SET status = #{status}
WHERE id = #{id}
</update>
<update id="resetGysJhStatusBySapNos">