完善关键零部件型号库申请流程

This commit is contained in:
梁琦涛
2024-09-30 16:15:59 +08:00
parent 89100425bb
commit 9388f41187
9 changed files with 272 additions and 3 deletions
@@ -0,0 +1,43 @@
package com.jero.modules.laws.part.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.modules.laws.part.entity.LawsPartInfo;
import com.jero.modules.laws.part.service.ILawsPartInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Api(tags = "业务支持-零件信息")
@RestController
@RequestMapping("/laws/lawsPartInfo")
@Slf4j
public class LawsPartInfoController {
@Resource
private ILawsPartInfoService lawsPartInfoService;
/**
* 分页列表查询
*
* @param lawsPartInfo
* @return
*/
@AutoLog(value = "业务支持-零件信息-列表查询")
@ApiOperation(value = "业务支持-零件信息-列表查询", notes = "业务支持-零件信息-列表查询")
@GetMapping(value = "/list")
@ApiOperationSupport(order = 1)
public Result<List<LawsPartInfo>> queryList(LawsPartInfo lawsPartInfo, HttpServletRequest req) {
List<LawsPartInfo> list = lawsPartInfoService.queryList(lawsPartInfo, req);
return Result.OK(list);
}
}
@@ -6,7 +6,7 @@ import com.jero.common.api.vo.Result;
import com.jero.common.api.vo.ResultCommon;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.aspect.annotation.Translation;
import com.jero.modules.laws.marketStandard.entity.LawsMarketStandardDetail;
import com.jero.modules.laws.part.entity.LawsPartRelevance;
import com.jero.modules.laws.part.entity.LawsPartType;
import com.jero.modules.laws.part.service.ILawsPartTypeService;
import io.swagger.annotations.Api;
@@ -14,7 +14,6 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -22,6 +21,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -188,4 +188,36 @@ public class LawsPartTypeController {
public ModelAndView export(LawsPartType lawsPartType, HttpServletRequest request) {
return lawsPartTypeService.export(lawsPartType,request);
}
/**
* 根据零件号获取关键零部件名称
*
* @param lawsPartType
* @return
*/
@AutoLog(value = "业务支持-市场法规清单-根据零件号获取关键零部件名称")
@ApiOperation(value = "业务支持-市场法规清单-根据零件号获取关键零部件名称", notes = "业务支持-市场法规清单-根据零件号获取关键零部件名称")
@GetMapping(value = "/queryByPartNum")
@ApiOperationSupport(order = 2)
@Translation
public Result<LawsPartRelevance> queryByPartNum(LawsPartType lawsPartType) {
LawsPartRelevance result = lawsPartTypeService.queryByPartNum(lawsPartType.getPartNum());
return Result.OK(result);
}
/**
* 获取已有零件对应零件号列表
*
* @param lawsPartType
* @return
*/
@AutoLog(value = "业务支持-市场法规清单-获取已有零件对应零件号列表")
@ApiOperation(value = "业务支持-市场法规清单-获取已有零件对应零件号列表", notes = "业务支持-市场法规清单-获取已有零件对应零件号列表")
@GetMapping(value = "/queryByPartNumList")
@ApiOperationSupport(order = 2)
@Translation
public Result<List<LawsPartType>> queryByPartNumList(LawsPartType lawsPartType) {
List<LawsPartType> result = lawsPartTypeService.queryByPartNumList(lawsPartType.getPartNum());
return Result.OK(result);
}
}
@@ -0,0 +1,82 @@
package com.jero.modules.laws.part.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* 零件信息
*
* @TableName laws_part_info
*/
@TableName(value ="laws_part_info")
@Data
public class LawsPartInfo implements Serializable {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键ID")
private String id;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 0表示未删除,1表示删除
*/
@TableLogic
@ApiModelProperty(value = "0表示未删除,1表示删除")
private Integer delFlag;
/**
* 零件号
*/
@ApiModelProperty(value = "零件号")
@Excel(name = "零件号", width = 15)
private String partNum;
/**
* 零件名称
*/
@NotBlank(message = "零件名称")
@ApiModelProperty(value = "零件名称")
@Excel(name = "零件名称", width = 15)
private String partName;
/**
* 零件英文名称
*/
@ApiModelProperty(value = "零件英文名称")
private String partNameEn;
/**
* FND+GPC关联
*/
@ApiModelProperty(value = "FND+GPC关联")
private String fndGpc;
}
@@ -0,0 +1,13 @@
package com.jero.modules.laws.part.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.laws.part.entity.LawsPartInfo;
public interface LawsPartInfoMapper extends BaseMapper<LawsPartInfo> {
}
@@ -0,0 +1,7 @@
<?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.jero.modules.laws.part.mapper.LawsPartInfoMapper">
</mapper>
@@ -0,0 +1,12 @@
package com.jero.modules.laws.part.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.laws.part.entity.LawsPartInfo;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
public interface ILawsPartInfoService extends IService<LawsPartInfo> {
List<LawsPartInfo> queryList(LawsPartInfo lawsPartInfo, HttpServletRequest req);
}
@@ -33,4 +33,8 @@ public interface ILawsPartTypeService extends IService<LawsPartType> {
void cancellation(LawsPartType lawsPartType);
ModelAndView export(LawsPartType lawsPartType, HttpServletRequest request);
LawsPartRelevance queryByPartNum(String partNum);
List<LawsPartType> queryByPartNumList(String partNum);
}
@@ -0,0 +1,32 @@
package com.jero.modules.laws.part.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.laws.part.entity.LawsPartInfo;
import com.jero.modules.laws.part.entity.LawsPartType;
import com.jero.modules.laws.part.mapper.LawsPartInfoMapper;
import com.jero.modules.laws.part.service.ILawsPartInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Service
@Slf4j
public class LawsPartInfoServiceImpl extends ServiceImpl<LawsPartInfoMapper, LawsPartInfo>
implements ILawsPartInfoService {
@Override
public List<LawsPartInfo> queryList(LawsPartInfo lawsPartInfo, HttpServletRequest req) {
QueryWrapper<LawsPartInfo> queryWrapper =
QueryGenerator.initQueryWrapper(lawsPartInfo, req.getParameterMap());
return list(queryWrapper);
}
}
@@ -1,6 +1,7 @@
package com.jero.modules.laws.part.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -12,8 +13,10 @@ import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.laws.part.constans.PartConstants;
import com.jero.modules.laws.part.entity.LawsPartRelevance;
import com.jero.modules.laws.part.entity.LawsPartType;
import com.jero.modules.laws.part.mapper.LawsPartTypeMapper;
import com.jero.modules.laws.part.service.ILawsPartRelevanceService;
import com.jero.modules.laws.part.service.ILawsPartTypeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
@@ -40,6 +43,8 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
@Resource
private LawsPartTypeMapper lawsPartTypeMapper;
@Resource
private ILawsPartRelevanceService lawsPartRelevanceService;
@Override
public IPage<LawsPartType> queryPage(LawsPartType lawsPartType, Integer pageNo,
@@ -61,7 +66,19 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
if(Objects.isNull(lawsPartType)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
lawsPartType.setRegPartNameCn(lawsPartType.getFndGpc());
LawsPartRelevance lawsPartRelevance = lawsPartRelevanceService.getById(lawsPartType.getPartRelevanceId());
if(Objects.isNull(lawsPartRelevance)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
lawsPartType.setRegPartNameCn(lawsPartRelevance.getRegPartNameCn());
lawsPartType.setRegPartNameEn(lawsPartRelevance.getRegPartNameEn());
lawsPartType.setFormType(lawsPartRelevance.getFormType());
lawsPartType.setDecisionRequirement(lawsPartRelevance.getDecisionRequirement());
lawsPartType.setClassification(lawsPartRelevance.getClassification());
lawsPartType.setApplicableMarket(lawsPartRelevance.getApplicableMarket());
lawsPartType.setPartsCertifiedDeliverables(lawsPartRelevance.getPartsCertifiedDeliverables());
lawsPartType.setResponsibleDepartment(lawsPartRelevance.getResponsibleDepartment());
lawsPartType.setResponsibleModule(lawsPartRelevance.getResponsibleModule());
return lawsPartType;
}
@@ -164,6 +181,33 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
mv.addObject(NormalExcelConstants.DATA_LIST, re);
return mv;
}
@Override
public LawsPartRelevance queryByPartNum(String partNum) {
LambdaQueryWrapper<LawsPartType> queryLawsPartType = new LambdaQueryWrapper<>();
queryLawsPartType.eq(LawsPartType::getPartNum,partNum);
LawsPartType lawsPartType = getOne(queryLawsPartType,false);
if(Objects.isNull(lawsPartType)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
QueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new QueryWrapper<>();
queryLawsPartRelevance.gt("FIND_IN_SET(fnd_gpc," + lawsPartType.getFndGpc() + ")", 0);
LawsPartRelevance lawsPartRelevance = lawsPartRelevanceService.getOne(queryLawsPartRelevance,false);
if(Objects.isNull(lawsPartRelevance)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
return lawsPartRelevance;
}
@Override
public List<LawsPartType> queryByPartNumList(String partNum) {
LambdaQueryWrapper<LawsPartType> queryLawsPartType = new LambdaQueryWrapper<>();
queryLawsPartType.select(LawsPartType::getPartRelevanceType);
queryLawsPartType.eq(LawsPartType::getPartNum,partNum);
queryLawsPartType.isNotNull(LawsPartType::getSuccessTime);
List<LawsPartType> list = list(queryLawsPartType);
return list;
}
}