完善关键零部件型号库功能
This commit is contained in:
@@ -2,20 +2,14 @@ package com.jero.modules.laws.part.constans;
|
||||
|
||||
public class PartConstants {
|
||||
private PartConstants(){}
|
||||
/**
|
||||
* 生效
|
||||
*/
|
||||
public static final String STATUS_1 = "1";
|
||||
|
||||
/**
|
||||
* 已发布
|
||||
* 作废
|
||||
*/
|
||||
public static final String MANIFEST_STATUS_PUBLISH = "1";
|
||||
|
||||
/**
|
||||
* 修改中
|
||||
*/
|
||||
public static final String MANIFEST_STATUS_EDIT = "2";
|
||||
|
||||
/**
|
||||
* 未发布
|
||||
*/
|
||||
public static final String MANIFEST_STATUS_NOT_PUBLISH = "3";
|
||||
public static final String STATUS_2 = "2";
|
||||
|
||||
}
|
||||
|
||||
+42
-8
@@ -6,6 +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.LawsPartType;
|
||||
import com.jero.modules.laws.part.service.ILawsPartTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -16,6 +17,7 @@ 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;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -35,7 +37,7 @@ public class LawsPartTypeController {
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param lawsPartRelevance
|
||||
* @param lawsPartType
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @return
|
||||
@@ -44,7 +46,7 @@ public class LawsPartTypeController {
|
||||
@ApiOperation(value = "业务支持-关键零部件型号库-分页列表查询", notes = "业务支持-关键零部件型号库-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@RequiresPermissions("keyPartBindingManage:search")
|
||||
// @RequiresPermissions("keyPartBindingManage:search")
|
||||
public Result<IPage<LawsPartType>> queryPageList(LawsPartType lawsPartType,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@@ -79,7 +81,7 @@ public class LawsPartTypeController {
|
||||
@ApiOperation(value = "业务支持-关键零部件型号库-删除", notes = "业务支持-关键零部件型号库-删除")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@PostMapping(value = "/delete")
|
||||
@RequiresPermissions("keyPartBindingManage:delete")
|
||||
// @RequiresPermissions("keyPartBindingManage:delete")
|
||||
public Result<?> delete(@RequestBody Map<String, String> map) {
|
||||
if (!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))) {
|
||||
return Result.error(ResultCommon.SELECT_DATA);
|
||||
@@ -98,7 +100,7 @@ public class LawsPartTypeController {
|
||||
@ApiOperation(value = "业务支持-关键零部件型号库-批量删除", notes = "业务支持-关键零部件型号库-批量删除")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
@RequiresPermissions("keyPartBindingManage:batchDel")
|
||||
// @RequiresPermissions("keyPartBindingManage:batchDel")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
if (!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))) {
|
||||
return Result.error(ResultCommon.SELECT_DATA);
|
||||
@@ -117,7 +119,7 @@ public class LawsPartTypeController {
|
||||
@ApiOperation(value = "业务支持-关键零部件型号库-新增", notes = "业务支持-关键零部件型号库-新增")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@PostMapping(value = "/add")
|
||||
@RequiresPermissions("keyPartBindingManage:add")
|
||||
// @RequiresPermissions("keyPartBindingManage:add")
|
||||
public Result<T> add(@Validated @RequestBody LawsPartType lawsPartType) {
|
||||
lawsPartTypeService.add(lawsPartType);
|
||||
return Result.OK(ResultCommon.OK);
|
||||
@@ -133,11 +135,28 @@ public class LawsPartTypeController {
|
||||
@ApiOperation(value = "业务支持-关键零部件型号库-编辑", notes = "业务支持-关键零部件型号库-编辑")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@PostMapping(value = "/edit")
|
||||
@RequiresPermissions("keyPartBindingManage:import")
|
||||
// @RequiresPermissions("keyPartBindingManage:import")
|
||||
public Result<T> edit(@Validated @RequestBody LawsPartType lawsPartType) {
|
||||
this.lawsPartTypeService.edit(lawsPartType);
|
||||
return Result.OK(ResultCommon.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 替换
|
||||
*
|
||||
* @param lawsPartType
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "业务支持-关键零部件型号库-编辑")
|
||||
@ApiOperation(value = "业务支持-关键零部件型号库-编辑", notes = "业务支持-关键零部件型号库-编辑")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@PostMapping(value = "/replace")
|
||||
// @RequiresPermissions("keyPartBindingManage:import")
|
||||
public Result<T> replace(@RequestBody LawsPartType lawsPartType) {
|
||||
this.lawsPartTypeService.replace(lawsPartType);
|
||||
return Result.OK(ResultCommon.OK);
|
||||
}
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
@@ -148,10 +167,25 @@ public class LawsPartTypeController {
|
||||
@ApiOperation(value = "业务支持-关键零部件型号库-作废", notes = "业务支持-关键零部件型号库-作废")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@PostMapping(value = "/cancellation")
|
||||
@RequiresPermissions("keyPartBindingManage:import")
|
||||
public Result<T> cancellation(@Validated @RequestBody LawsPartType lawsPartType) {
|
||||
// @RequiresPermissions("keyPartBindingManage:import")
|
||||
public Result<T> cancellation(@RequestBody LawsPartType lawsPartType) {
|
||||
this.lawsPartTypeService.cancellation(lawsPartType);
|
||||
return Result.OK(ResultCommon.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
* @param lawsPartType
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "外部标准库-市场法规清单-导出")
|
||||
@ApiOperation(value = "外部标准库-市场法规清单-导出", notes = "外部标准库-市场法规清单-导出")
|
||||
@GetMapping(value = "/export")
|
||||
@ApiOperationSupport(order = 2)
|
||||
// @RequiresPermissions("marketStandard:detail")
|
||||
public ModelAndView export(LawsPartType lawsPartType, HttpServletRequest request) {
|
||||
return lawsPartTypeService.export(lawsPartType,request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,6 @@ public class LawsPartType implements Serializable {
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private String id;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@@ -64,6 +59,13 @@ public class LawsPartType implements Serializable {
|
||||
@NotBlank(message = "零件号")
|
||||
private String partNum;
|
||||
|
||||
/**
|
||||
* 关键零部件id
|
||||
*/
|
||||
@ApiModelProperty(value = "关键零部件id")
|
||||
private String partRelevanceId;
|
||||
|
||||
|
||||
/**
|
||||
* 关键零部件名称
|
||||
*/
|
||||
@@ -106,6 +108,13 @@ public class LawsPartType implements Serializable {
|
||||
@Dict(dicCode = "applicable_vehicle_type")
|
||||
private String applicableVehicleType;
|
||||
|
||||
/**
|
||||
* 技术特性与已有零件全部相同
|
||||
*/
|
||||
@NotBlank(message = "技术特性与已有零件全部相同")
|
||||
@ApiModelProperty(value = "技术特性与已有零件全部相同")
|
||||
private String technicalFeature;
|
||||
|
||||
/**
|
||||
* 型号型式
|
||||
*/
|
||||
@@ -178,6 +187,43 @@ public class LawsPartType implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String responsibleModule;
|
||||
|
||||
/**
|
||||
* 申请人
|
||||
*/
|
||||
@ApiModelProperty(value = "申请人")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "username")
|
||||
@Excel(name = "申请人", width = 15, dictTable = "sys_user", dicCode = "id", dicText = "username")
|
||||
private String createBy;
|
||||
/**
|
||||
* 申请部门
|
||||
*/
|
||||
@ApiModelProperty(value = "申请部门")
|
||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@Excel(name = "申请部门", width = 15, dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||
@TableField(exist = false)
|
||||
private String depId;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@ApiModelProperty(value = "完成时间")
|
||||
@Excel(name = "完成时间",format = "yyyy-MM-dd")
|
||||
private String successTime;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty(value = "状态")
|
||||
@Excel(name = "状态", dicCode = "part_type_status")
|
||||
@Dict(dicCode = "part_type_status")
|
||||
private String status;
|
||||
|
||||
|
||||
/**
|
||||
* 替换前id
|
||||
*/
|
||||
@ApiModelProperty(value = "替换前id")
|
||||
private String lastId;
|
||||
|
||||
/**
|
||||
* FND+GPC关联
|
||||
*/
|
||||
|
||||
@@ -8,11 +8,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.modules.laws.part.entity.LawsPartType;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface LawsPartTypeMapper extends BaseMapper<LawsPartType> {
|
||||
|
||||
IPage<LawsPartType> pageList(Page<LawsPartType> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<LawsPartType> queryWrapper);
|
||||
List<LawsPartType> pageList(@Param(Constants.WRAPPER) QueryWrapper<LawsPartType> queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+33
-1
@@ -5,6 +5,38 @@
|
||||
<mapper namespace="com.jero.modules.laws.part.mapper.LawsPartTypeMapper">
|
||||
|
||||
<select id="pageList" resultType="com.jero.modules.laws.part.entity.LawsPartType">
|
||||
|
||||
select
|
||||
l2.reg_part_name_en,
|
||||
l2.reg_part_name_cn,
|
||||
l2.form_type,
|
||||
l2.system_code,
|
||||
l2.decision_requirement,
|
||||
l2.classification,
|
||||
l2.applicable_market,
|
||||
l2.parts_certified_deliverables,
|
||||
l2.responsible_department,
|
||||
l2.responsible_module,
|
||||
l2.remark,
|
||||
l2.fnd_gpc,
|
||||
l1.part_num,
|
||||
l1.part_relevance_id,
|
||||
l1.part_name,
|
||||
l1.production_factory,
|
||||
l1.applicable_vehicle_type,
|
||||
l1.technical_feature,
|
||||
l1.already_part_num_id,
|
||||
l1.already_part_num,
|
||||
l1.status,
|
||||
l1.success_time,
|
||||
l1.create_by,
|
||||
l1.last_id,
|
||||
s3.id as dep_id
|
||||
from laws_part_type l1
|
||||
left join laws_part_relevance l2 on l1.part_relevance_id = l2.id and l2.del_flag = 0
|
||||
left join sys_user s1 on s1.username = l1.create_by
|
||||
left join sys_user_depart s2 on s2.user_id = s1.id
|
||||
left join sys_depart s3 on s3.id = s2.dep_id
|
||||
${ew.customSqlSegment}
|
||||
group by l1.id,s3.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+5
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.laws.part.entity.LawsPartRelevance;
|
||||
import com.jero.modules.laws.part.entity.LawsPartType;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@@ -27,5 +28,9 @@ public interface ILawsPartTypeService extends IService<LawsPartType> {
|
||||
|
||||
void edit(LawsPartType lawsPartType);
|
||||
|
||||
void replace(LawsPartType lawsPartType);
|
||||
|
||||
void cancellation(LawsPartType lawsPartType);
|
||||
|
||||
ModelAndView export(LawsPartType lawsPartType, HttpServletRequest request);
|
||||
}
|
||||
|
||||
+69
-5
@@ -1,24 +1,35 @@
|
||||
package com.jero.modules.laws.part.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
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.LawsPartType;
|
||||
import com.jero.modules.laws.part.mapper.LawsPartTypeMapper;
|
||||
import com.jero.modules.laws.part.service.ILawsPartTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@@ -35,6 +46,7 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
|
||||
Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<LawsPartType> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(lawsPartType, req.getParameterMap());
|
||||
queryWrapper.eq("l1.del_flag","0");
|
||||
Page<LawsPartType> page = new Page<>(pageNo, pageSize);
|
||||
IPage<LawsPartType> re = lawsPartTypeMapper.pageList(page, queryWrapper);
|
||||
return re;
|
||||
@@ -57,10 +69,6 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
|
||||
if(Objects.isNull(lawsPartType)){
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if(!Objects.equals(lawsPartType.getCreateBy(),sysUser.getUsername())){
|
||||
throw new JeroBootException(ResultCommon.NO_PERMISSION);
|
||||
}
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
@@ -84,8 +92,64 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancellation(LawsPartType lawsPartType) {
|
||||
@Transactional(rollbackFor = JeroBootException.class)
|
||||
public void replace(LawsPartType lawsPartType) {
|
||||
LawsPartType lawsPartTypeOld = getById(lawsPartType.getId());
|
||||
if(Objects.isNull(lawsPartTypeOld)){
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
if(Objects.equals(lawsPartTypeOld.getStatus(),PartConstants.STATUS_2)){
|
||||
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(), Locale.ENGLISH) ?
|
||||
"Out of state" : "状态不正确"));
|
||||
}
|
||||
LawsPartType lawsPartTypeNew = JSON.parseObject(JSON.toJSONString(lawsPartTypeOld),LawsPartType.class);
|
||||
lawsPartTypeNew.setId(null);
|
||||
lawsPartTypeNew.setUpdateBy(null);
|
||||
lawsPartTypeNew.setCreateTime(null);
|
||||
lawsPartTypeNew.setLastId(lawsPartTypeOld.getId());
|
||||
save(lawsPartTypeNew);
|
||||
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaUpdateWrapper<LawsPartType> updateLawsPartType = new LambdaUpdateWrapper<>();
|
||||
updateLawsPartType.eq(LawsPartType::getId,lawsPartTypeOld.getId());
|
||||
updateLawsPartType.set(LawsPartType::getStatus, PartConstants.STATUS_2);
|
||||
updateLawsPartType.set(LawsPartType::getUpdateBy,sysUser.getUsername());
|
||||
updateLawsPartType.set(LawsPartType::getUpdateTime,new Date());
|
||||
update(updateLawsPartType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancellation(LawsPartType lawsPartType) {
|
||||
LawsPartType lawsPartTypeOld = getById(lawsPartType.getId());
|
||||
if(Objects.isNull(lawsPartTypeOld)){
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaUpdateWrapper<LawsPartType> updateLawsPartType = new LambdaUpdateWrapper<>();
|
||||
updateLawsPartType.eq(LawsPartType::getId,lawsPartTypeOld.getId());
|
||||
updateLawsPartType.set(LawsPartType::getStatus, PartConstants.STATUS_2);
|
||||
updateLawsPartType.set(LawsPartType::getUpdateBy,sysUser.getUsername());
|
||||
updateLawsPartType.set(LawsPartType::getUpdateTime,new Date());
|
||||
update(updateLawsPartType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAndView export(LawsPartType lawsPartType, HttpServletRequest request) {
|
||||
QueryWrapper<LawsPartType> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(lawsPartType, request.getParameterMap());
|
||||
queryWrapper.eq("l1.del_flag","0");
|
||||
List<LawsPartType> re = lawsPartTypeMapper.pageList( queryWrapper);
|
||||
|
||||
// Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
// 导出文件名称
|
||||
mv.addObject(JeroController.FILE_NAME, "关键零部件型号库");
|
||||
mv.addObject(JeroController.CLASS, LawsPartType.class);
|
||||
ExportParams exportParams = new ExportParams("密级:核心商密□普通商密□内部资料■外部公开□", "关键零部件型号库");
|
||||
// 导出xls
|
||||
mv.addObject(JeroController.PARAMS, exportParams);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, re);
|
||||
return mv;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user