Merge branch 'master' into 'fix_20230830'
保存 See merge request laws-nio/laws-weilai!361
This commit is contained in:
+1
-1
@@ -5890,7 +5890,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
if (sheet != null) {
|
||||
StringBuilder headerSb = new StringBuilder();
|
||||
int rowNos = sheet.getLastRowNum();// 得到excel的总记录条数
|
||||
for (int i = 0; i <= rowNos; i++) {// 遍历行
|
||||
for (int i = 0; i <= rowNos; i++) {
|
||||
if (i == 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+281
@@ -0,0 +1,281 @@
|
||||
package com.jero.modules.project.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.PageUtil;
|
||||
import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
import com.jero.modules.project.entity.ProjectRxswinEO;
|
||||
import com.jero.modules.project.service.IProjectRxswinEOService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: rxswin表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-08-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="rxswin表")
|
||||
@RestController
|
||||
@RequestMapping("/project/projectRxswinEO")
|
||||
@Slf4j
|
||||
public class ProjectRxswinEOController extends JeroController<ProjectRxswinEO, IProjectRxswinEOService> {
|
||||
@Autowired
|
||||
private IProjectRxswinEOService projectRxswinEOService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "rxswin表-分页列表查询")
|
||||
@ApiOperation(value="rxswin表-分页列表查询", notes="rxswin表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(ProjectRxswinEO projectRxswinEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<ProjectRxswinEO> queryWrapper = QueryGenerator.initQueryWrapper(projectRxswinEO, req.getParameterMap());
|
||||
List<ProjectRxswinEO> projectRxswinEOList = projectRxswinEOService.getPageInfo(projectRxswinEO);
|
||||
Page pages = PageUtil.getPages(pageNo, pageSize, projectRxswinEOList);
|
||||
return Result.OK(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "rxswin表-列表查询")
|
||||
@ApiOperation(value="rxswin表-列表查询", notes="rxswin表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<ProjectRxswinEO>> queryList() {
|
||||
List<ProjectRxswinEO> list = projectRxswinEOService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "rxswin表-添加")
|
||||
@ApiOperation(value="rxswin表-添加", notes="rxswin表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ProjectRxswinEO projectRxswinEO) {
|
||||
projectRxswinEOService.add(projectRxswinEO);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "rxswin表-编辑")
|
||||
@ApiOperation(value="rxswin表-编辑", notes="rxswin表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ProjectRxswinEO projectRxswinEO) {
|
||||
projectRxswinEOService.editById(projectRxswinEO);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "rxswin表-通过id删除")
|
||||
@ApiOperation(value="rxswin表-通过id删除", notes="rxswin表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
projectRxswinEOService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "rxswin表-批量删除")
|
||||
@ApiOperation(value="rxswin表-批量删除", notes="rxswin表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.projectRxswinEOService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "rxswin表-通过id查询")
|
||||
@ApiOperation(value="rxswin表-通过id查询", notes="rxswin表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
ProjectRxswinEO projectRxswinEO = projectRxswinEOService.queryById(id);
|
||||
if(projectRxswinEO==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(projectRxswinEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param projectRxswinEO
|
||||
*/
|
||||
@ApiOperation(value="导出", notes="导出")
|
||||
@RequestMapping(value = "/exportXls",method = RequestMethod.GET)
|
||||
public ModelAndView exportXls(HttpServletRequest request, ProjectRxswinEO projectRxswinEO) {
|
||||
return projectRxswinEOService.exportXls(request,projectRxswinEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
* @param file
|
||||
* @param cut
|
||||
* @param version
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="导入", notes="导入")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(MultipartFile file,String cut,String version,String projectId) {
|
||||
projectRxswinEOService.importExcel(file,cut,version,projectId);
|
||||
return Result.OK("");
|
||||
}
|
||||
|
||||
/**
|
||||
* 调取--第一层
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "调取--第一层")
|
||||
@ApiOperation(value="调取--第一层", notes="调取--第一层")
|
||||
@GetMapping(value = "/getOnePage")
|
||||
public Result<?> getOnePage(ProjectRxswinEO projectRxswinEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
IPage<ProjectLibraryBase> pageList = projectRxswinEOService.getOnePage(pageNo,pageSize,projectRxswinEO);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
/**
|
||||
* 调取--第二层
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "调取--第二层")
|
||||
@ApiOperation(value="调取--第二层", notes="调取--第二层")
|
||||
@GetMapping(value = "/getTwoPage")
|
||||
public Result<?> getTwoPage(ProjectRxswinEO projectRxswinEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
IPage<ProjectRxswinEO> pageList = projectRxswinEOService.getTwoPage(pageNo,pageSize,projectRxswinEO);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "提交")
|
||||
@ApiOperation(value="提交", notes="提交")
|
||||
@GetMapping(value = "/submitInfo")
|
||||
public Result<?> submitInfo(@RequestParam(name="projectId",required=true) String projectId,
|
||||
@RequestParam(name="ids",required=true) String ids) {
|
||||
projectRxswinEOService.submitInfo(projectId,ids);
|
||||
return Result.OK("提交成功");
|
||||
}
|
||||
|
||||
@AutoLog(value = "覆盖验证")
|
||||
@ApiOperation(value="覆盖验证", notes="覆盖验证")
|
||||
@GetMapping(value = "/iSExist")
|
||||
public Result<?> iSExist(@RequestParam(name="projectId",required=true) String projectId,
|
||||
@RequestParam(name="ids",required=true) String ids) {
|
||||
String iSExist = projectRxswinEOService.iSExist(projectId, ids);
|
||||
return Result.OK(iSExist);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param projectId
|
||||
* @param ids
|
||||
* @param flag flag-->YES覆盖, flag-->NO不覆盖
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "调取后保存数据")
|
||||
@ApiOperation(value="调取后保存数据", notes="调取后保存数据")
|
||||
@GetMapping(value = "/addBatch")
|
||||
public Result<?> addBatch(@RequestParam(name="projectId",required=true) String projectId,
|
||||
@RequestParam(name="ids",required=true) String ids,
|
||||
@RequestParam(name="flag",required=true) String flag) {
|
||||
projectRxswinEOService.addBatch(projectId, ids,flag);
|
||||
return Result.OK("");
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应版本下拉
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对应版本下拉")
|
||||
@ApiOperation(value="对应版本下拉", notes="对应版本下拉")
|
||||
@GetMapping(value = "/getVersionList")
|
||||
public Result<List<String>> getVersionList(String projectId) {
|
||||
List<String> list = projectRxswinEOService.getVersionList(projectId);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "模板下载")
|
||||
@GetMapping(value = "/exportTemplate")
|
||||
public void exportTemplate(@RequestParam Map<String,Object> map, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
projectRxswinEOService.exportTemplate(map, response, request);
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -112,6 +112,13 @@ public class ProjectLibraryBase implements Comparable<ProjectLibraryBase> {
|
||||
@TableField(exist = false)
|
||||
private java.lang.String targetMarketName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private java.lang.String targetMarketNameCn;
|
||||
|
||||
@TableField(exist = false)
|
||||
private java.lang.String targetMarketNameEn;
|
||||
|
||||
|
||||
//主项目id parent_id
|
||||
private String parentId;
|
||||
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package com.jero.modules.project.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: rxswin表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-08-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("project_rxswin")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="project_rxswin对象", description="rxswin表")
|
||||
public class ProjectRxswinEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
|
||||
/**项目id*/
|
||||
@ApiModelProperty(value = "项目id")
|
||||
private java.lang.String projectId;
|
||||
|
||||
/**文档库id(编号)*/
|
||||
@ApiModelProperty(value = "文档库id(编号)")
|
||||
private java.lang.String documentId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "编号")
|
||||
@Excel(name = "编号", width = 15)
|
||||
private String serialNumber;
|
||||
|
||||
/**主题*/
|
||||
@Excel(name = "主题", width = 15)
|
||||
@ApiModelProperty(value = "主题")
|
||||
private java.lang.String theme;
|
||||
|
||||
/**RXSWIN*/
|
||||
@Excel(name = "RXSWIN", width = 15)
|
||||
@ApiModelProperty(value = "RXSWIN")
|
||||
private java.lang.String rxswin;
|
||||
|
||||
/**版本*/
|
||||
@Excel(name = "版本", width = 15)
|
||||
@ApiModelProperty(value = "对应版本")
|
||||
private java.lang.String version;
|
||||
|
||||
/**状态(0->保存,1->提交)*/
|
||||
@ApiModelProperty(value = "状态(0->保存,1->提交)")
|
||||
private java.lang.String state;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "中英文切换")
|
||||
private String cut;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "表头排序字段")
|
||||
private java.lang.String orderByField;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.String orderBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "行号")
|
||||
private java.lang.Integer number;
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.jero.modules.project.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: rxswin表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-08-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("project_rxswin")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="project_rxswin对象", description="rxswin表")
|
||||
public class ProjectRxswinEOEn implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.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 java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**项目id*/
|
||||
@ApiModelProperty(value = "项目id")
|
||||
private String projectId;
|
||||
|
||||
/**文档库id(编号)*/
|
||||
@ApiModelProperty(value = "文档库id(编号)")
|
||||
private String documentId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "编号")
|
||||
@Excel(name = "No.", width = 15)
|
||||
private String serialNumber;
|
||||
|
||||
/**主题*/
|
||||
@Excel(name = "Theme", width = 15)
|
||||
@ApiModelProperty(value = "主题")
|
||||
private String theme;
|
||||
|
||||
/**RXSWIN*/
|
||||
@Excel(name = "RXSWIN", width = 15)
|
||||
@ApiModelProperty(value = "RXSWIN")
|
||||
private String rxswin;
|
||||
|
||||
/**版本*/
|
||||
@Excel(name = "Corresponding version", width = 30)
|
||||
@ApiModelProperty(value = "版本")
|
||||
private String version;
|
||||
|
||||
/**状态(0->保存,1->提交)*/
|
||||
@ApiModelProperty(value = "状态(0->保存,1->提交)")
|
||||
private String state;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "中英文切换")
|
||||
private String cut;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "表头排序字段")
|
||||
private String orderByField;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private String orderBy;
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.jero.modules.project.enums;
|
||||
|
||||
/**
|
||||
* 当前状态枚举类
|
||||
*/
|
||||
public enum RxswinEnum {
|
||||
|
||||
ONE("编号","No."),
|
||||
TWO("主题","Theme"),
|
||||
THREE("RXSWIN","RXSWIN"),
|
||||
FOUR("对应版本","Corresponding version")
|
||||
;
|
||||
|
||||
|
||||
String nameCn;
|
||||
String nameEn;
|
||||
|
||||
private RxswinEnum(String nameCn,String nameEn) {
|
||||
this.nameCn = nameCn;
|
||||
this.nameEn = nameEn;
|
||||
}
|
||||
|
||||
public String getNameCn() {
|
||||
return nameCn;
|
||||
}
|
||||
|
||||
public void setNameCn(String nameCn) {
|
||||
this.nameCn = nameCn;
|
||||
}
|
||||
|
||||
public String getNameEn() {
|
||||
return nameEn;
|
||||
}
|
||||
|
||||
public void setNameEn(String nameEn) {
|
||||
this.nameEn = nameEn;
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.jero.modules.project.enums;
|
||||
|
||||
/**
|
||||
* 任务状态枚举类
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
SAVE("保存","0"),
|
||||
SUBMIT("提交","1"),
|
||||
COVER_YES("覆盖","YES"),
|
||||
COVER_NO("不覆盖","NO"),
|
||||
;
|
||||
|
||||
|
||||
String name;
|
||||
String value;
|
||||
|
||||
private StatusEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getTextByValue(String value) {
|
||||
StatusEnum[] values = values();
|
||||
for (StatusEnum taskStatusEnum : values) {
|
||||
if (taskStatusEnum.value.equals(value)) {
|
||||
return taskStatusEnum.name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.project.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.project.entity.ProjectRxswinEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: rxswin表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-08-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ProjectRxswinEOMapper extends BaseMapper<ProjectRxswinEO> {
|
||||
|
||||
List<ProjectLibraryBase> queryProjectLibraryBaseList(@Param("id") String id,
|
||||
@Param("parentId") String parentId);
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?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.project.mapper.ProjectRxswinEOMapper">
|
||||
<resultMap id="ProjectRxswinEOResultMap" type="com.jero.modules.project.entity.ProjectRxswinEO">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="project_id" property="projectId" />
|
||||
<result column="document_id" property="documentId" />
|
||||
<result column="theme" property="theme" />
|
||||
<result column="rxswin" property="rxswin" />
|
||||
<result column="version" property="version" />
|
||||
<result column="state" property="state" />
|
||||
</resultMap>
|
||||
<select id="queryProjectLibraryBaseList" resultType="com.jero.modules.project.entity.ProjectLibraryBase">
|
||||
SELECT
|
||||
plb.id,
|
||||
plb.project_name_id,
|
||||
pni.project_name AS project_name,
|
||||
pyni.id AS year_name_id,
|
||||
pyni.year_name,
|
||||
plb.target_market,
|
||||
plb.parent_id,
|
||||
plb.project_version,
|
||||
plb.software_version,
|
||||
sdi.item_text targetMarketNameCn,
|
||||
sdi.en_name targetMarketNameEN,
|
||||
plb.create_time
|
||||
FROM
|
||||
project_library_base AS plb
|
||||
LEFT JOIN project_name_info AS pni ON plb.project_name_id = pni.id
|
||||
LEFT JOIN project_year_name_info AS pyni ON plb.year_name_id = pyni.id
|
||||
LEFT JOIN sys_dict_item AS sdi ON sdi.item_value = plb.target_market
|
||||
where plb.parent_id = #{parentId}
|
||||
or plb.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package com.jero.modules.project.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
import com.jero.modules.project.entity.ProjectRxswinEO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: rxswin表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-08-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IProjectRxswinEOService extends IService<ProjectRxswinEO> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
void add(ProjectRxswinEO projectRxswinEO);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
void editById(ProjectRxswinEO projectRxswinEO);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ProjectRxswinEO queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ProjectRxswinEO> queryList();
|
||||
|
||||
List<ProjectRxswinEO> getPageInfo(ProjectRxswinEO projectRxswinEO);
|
||||
|
||||
/**
|
||||
* 调取--第一层
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
Page<ProjectLibraryBase> getOnePage(Integer pageNo,Integer pageSize, ProjectRxswinEO projectRxswinEO);
|
||||
|
||||
/**
|
||||
* 调取--第二层
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
Page<ProjectRxswinEO> getTwoPage(Integer pageNo,Integer pageSize,ProjectRxswinEO projectRxswinEO);
|
||||
|
||||
/**
|
||||
* 提交
|
||||
* @param projectId
|
||||
* @param ids
|
||||
*/
|
||||
void submitInfo(String projectId,String ids);
|
||||
|
||||
/**
|
||||
* 覆盖验证
|
||||
* @param projectId
|
||||
* @param ids
|
||||
*/
|
||||
String iSExist(String projectId,String ids);
|
||||
|
||||
|
||||
void addBatch(String projectId,String ids,String flag);
|
||||
|
||||
List<String> getVersionList(String projectId);
|
||||
|
||||
ModelAndView exportXls(HttpServletRequest request, ProjectRxswinEO projectRxswinEO);
|
||||
|
||||
void exportTemplate(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
void importExcel(MultipartFile file, String cut, String version, String projectId);
|
||||
}
|
||||
+838
@@ -0,0 +1,838 @@
|
||||
package com.jero.modules.project.service.impl;
|
||||
|
||||
import com.aliyuncs.utils.IOUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.PageUtil;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
|
||||
import com.jero.modules.dummy.enums.OrderEnum;
|
||||
import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
import com.jero.modules.project.entity.ProjectRxswinEO;
|
||||
import com.jero.modules.project.entity.ProjectRxswinEOEn;
|
||||
import com.jero.modules.project.enums.RxswinEnum;
|
||||
import com.jero.modules.project.enums.StatusEnum;
|
||||
import com.jero.modules.project.mapper.ProjectRxswinEOMapper;
|
||||
import com.jero.modules.project.service.IProjectRxswinEOService;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
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.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.OutputStream;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: rxswin表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-08-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ProjectRxswinEOServiceImpl extends ServiceImpl<ProjectRxswinEOMapper, ProjectRxswinEO> implements IProjectRxswinEOService {
|
||||
|
||||
@Autowired
|
||||
private ProjectRxswinEOMapper projectRxswinEOMapper;
|
||||
@Autowired
|
||||
private BussDocumentLibraryEOServiceImpl bussDocumentLibraryEOService;
|
||||
@Autowired
|
||||
private ProjectLibraryBaseServiceImpl projectLibraryBaseService;
|
||||
@Value(value = "${jero.path.upload}")
|
||||
private String uploadpath;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(ProjectRxswinEO projectRxswinEO) {
|
||||
//判断主题是否已存在
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProjectRxswinEO::getProjectId, projectRxswinEO.getProjectId());
|
||||
wrapper.eq(ProjectRxswinEO::getTheme, projectRxswinEO.getTheme());
|
||||
List<ProjectRxswinEO> rxswinEOList = this.list(wrapper);
|
||||
if (!rxswinEOList.isEmpty()) {
|
||||
throw new JeroBootException("主题:" + projectRxswinEO.getTheme() + "已存在,请重新添加");
|
||||
}
|
||||
Date now = new Date();
|
||||
projectRxswinEO.setCreateTime(now);
|
||||
projectRxswinEO.setUpdateTime(now);
|
||||
projectRxswinEO.setState(StatusEnum.SAVE.getValue());
|
||||
save(projectRxswinEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(ProjectRxswinEO projectRxswinEO) {
|
||||
//判断主题是否存在
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProjectRxswinEO::getProjectId, projectRxswinEO.getProjectId());
|
||||
wrapper.eq(ProjectRxswinEO::getTheme, projectRxswinEO.getTheme());
|
||||
wrapper.ne(ProjectRxswinEO::getId, projectRxswinEO.getId());
|
||||
List<ProjectRxswinEO> rxswinEOList = this.list(wrapper);
|
||||
if (!rxswinEOList.isEmpty()) {
|
||||
throw new JeroBootException("主题:" + projectRxswinEO.getTheme() + "已存在,请重新添加");
|
||||
}
|
||||
Date now = new Date();
|
||||
projectRxswinEO.setUpdateTime(now);
|
||||
projectRxswinEO.setState(StatusEnum.SAVE.getValue());
|
||||
saveOrUpdate(projectRxswinEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ProjectRxswinEO queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectRxswinEO> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectRxswinEO> getPageInfo(ProjectRxswinEO projectRxswinEO) {
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isBlank(projectRxswinEO.getProjectId())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
wrapper.eq(ProjectRxswinEO::getProjectId, projectRxswinEO.getProjectId());
|
||||
|
||||
if (StringUtils.isNotBlank(projectRxswinEO.getTheme())) {
|
||||
wrapper.like(ProjectRxswinEO::getTheme, projectRxswinEO.getTheme());
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectRxswinEO.getVersion())) {
|
||||
wrapper.eq(ProjectRxswinEO::getVersion, projectRxswinEO.getVersion());
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectRxswinEO.getRxswin())) {
|
||||
wrapper.like(ProjectRxswinEO::getRxswin, projectRxswinEO.getRxswin());
|
||||
}
|
||||
if (StringUtils.isBlank(projectRxswinEO.getOrderByField())) {
|
||||
wrapper.orderByDesc(ProjectRxswinEO::getCreateTime);
|
||||
}
|
||||
List<ProjectRxswinEO> projectRxswinEOList = this.list(wrapper);
|
||||
|
||||
if (!projectRxswinEOList.isEmpty()) {
|
||||
List<String> documentIdList = projectRxswinEOList.stream().map(ProjectRxswinEO::getDocumentId).distinct().collect(Collectors.toList());
|
||||
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = getBussDocumentLibraryEOList(documentIdList);
|
||||
for (ProjectRxswinEO projectRxswinEOTemp : projectRxswinEOList) {
|
||||
List<BussDocumentLibraryEO> collect = bussDocumentLibraryEOList.stream()
|
||||
.filter(e -> e.getId().equals(projectRxswinEOTemp.getDocumentId())).collect(Collectors.toList());
|
||||
if (!collect.isEmpty()) {
|
||||
projectRxswinEOTemp.setSerialNumber(collect.get(0).getSerialNumber());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectRxswinEO.getSerialNumber())) {
|
||||
projectRxswinEOList = projectRxswinEOList.stream()
|
||||
.filter(e -> e.getSerialNumber().contains(projectRxswinEO.getSerialNumber())).collect(Collectors.toList());
|
||||
}
|
||||
heartSort(projectRxswinEO, projectRxswinEOList);
|
||||
}
|
||||
return projectRxswinEOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调取--第一层
|
||||
*
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<ProjectLibraryBase> getOnePage(Integer pageNo, Integer pageSize, ProjectRxswinEO projectRxswinEO) {
|
||||
ProjectLibraryBase libraryBase = projectLibraryBaseService.getById(projectRxswinEO.getProjectId());
|
||||
String id = "";
|
||||
String parentId = "";
|
||||
if (StringUtils.isBlank(libraryBase.getParentId())) {
|
||||
id = libraryBase.getId();
|
||||
parentId = libraryBase.getId();
|
||||
} else {
|
||||
id = libraryBase.getParentId();
|
||||
parentId = libraryBase.getParentId();
|
||||
}
|
||||
List<ProjectLibraryBase> libraryBaseList = projectRxswinEOMapper.queryProjectLibraryBaseList(id, parentId);
|
||||
for (ProjectLibraryBase projectLibraryBase : libraryBaseList) {
|
||||
//项目名称
|
||||
String projectName = "";
|
||||
if (CutEnum.CN.getValue().equals(projectRxswinEO.getCut())) {
|
||||
projectName = projectLibraryBase.getProjectName() + " " + projectLibraryBase.getYearName()
|
||||
+ "-" + projectLibraryBase.getTargetMarketNameCn() + "-" + projectLibraryBase.getProjectVersion();
|
||||
} else {
|
||||
projectName = projectLibraryBase.getProjectName() + " " + projectLibraryBase.getYearName()
|
||||
+ "-" + projectLibraryBase.getTargetMarketNameEn() + "-" + projectLibraryBase.getProjectVersion();
|
||||
}
|
||||
projectLibraryBase.setProjectName(projectName);
|
||||
}
|
||||
Collections.sort(libraryBaseList);
|
||||
return PageUtil.getPages(pageNo, pageSize, libraryBaseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调取--第二层
|
||||
*
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param projectRxswinEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<ProjectRxswinEO> getTwoPage(Integer pageNo, Integer pageSize, ProjectRxswinEO projectRxswinEO) {
|
||||
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProjectRxswinEO::getProjectId, projectRxswinEO.getProjectId());
|
||||
wrapper.eq(ProjectRxswinEO::getState, StatusEnum.SUBMIT.getValue());//提交的
|
||||
|
||||
if (StringUtils.isNotBlank(projectRxswinEO.getTheme())) {
|
||||
wrapper.like(ProjectRxswinEO::getTheme, projectRxswinEO.getTheme());
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectRxswinEO.getVersion())) {
|
||||
wrapper.eq(ProjectRxswinEO::getVersion, projectRxswinEO.getVersion());
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectRxswinEO.getRxswin())) {
|
||||
wrapper.like(ProjectRxswinEO::getRxswin, projectRxswinEO.getRxswin());
|
||||
}
|
||||
if (StringUtils.isBlank(projectRxswinEO.getOrderByField())) {
|
||||
wrapper.orderByDesc(ProjectRxswinEO::getCreateTime);
|
||||
}
|
||||
|
||||
List<ProjectRxswinEO> projectRxswinEOList = this.list(wrapper);
|
||||
|
||||
if (!projectRxswinEOList.isEmpty()) {
|
||||
List<String> documentIdList = projectRxswinEOList.stream().map(ProjectRxswinEO::getDocumentId).distinct().collect(Collectors.toList());
|
||||
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = getBussDocumentLibraryEOList(documentIdList);
|
||||
for (ProjectRxswinEO projectRxswinEOTemp : projectRxswinEOList) {
|
||||
List<BussDocumentLibraryEO> collect = bussDocumentLibraryEOList.stream()
|
||||
.filter(e -> e.getId().equals(projectRxswinEOTemp.getDocumentId())).collect(Collectors.toList());
|
||||
if (!collect.isEmpty()) {
|
||||
projectRxswinEOTemp.setSerialNumber(collect.get(0).getSerialNumber());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectRxswinEO.getSerialNumber())) {
|
||||
projectRxswinEOList = projectRxswinEOList.stream()
|
||||
.filter(e -> e.getSerialNumber().contains(projectRxswinEO.getSerialNumber())).collect(Collectors.toList());
|
||||
}
|
||||
heartSort(projectRxswinEO, projectRxswinEOList);
|
||||
}
|
||||
return PageUtil.getPages(pageNo, pageSize, projectRxswinEOList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交
|
||||
*
|
||||
* @param projectId
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
public void submitInfo(String projectId, String ids) {
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(ProjectRxswinEO::getId, Arrays.asList(ids.split(",")));
|
||||
List<ProjectRxswinEO> rxswinEOList = this.list(wrapper);
|
||||
for (ProjectRxswinEO projectRxswinEO : rxswinEOList) {
|
||||
projectRxswinEO.setUpdateBy(user.getUsername());
|
||||
projectRxswinEO.setState(StatusEnum.SUBMIT.getValue());
|
||||
}
|
||||
this.updateBatchById(rxswinEOList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 覆盖验证
|
||||
*
|
||||
* @param projectId
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
public String iSExist(String projectId, String ids) {
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//新增的
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
// wrapper.eq(ProjectRxswinEO::getProjectId, projectId);
|
||||
wrapper.in(ProjectRxswinEO::getId, Arrays.asList(ids.split(",")));
|
||||
List<ProjectRxswinEO> rxswinEOList = this.list(wrapper);
|
||||
|
||||
//已存在的
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapperTemp = new LambdaQueryWrapper<>();
|
||||
wrapperTemp.eq(ProjectRxswinEO::getProjectId, projectId);
|
||||
List<ProjectRxswinEO> rxswinEOS = this.list(wrapperTemp);
|
||||
|
||||
if (!rxswinEOS.isEmpty()) {
|
||||
List<String> themeList = rxswinEOS.stream().map(ProjectRxswinEO::getTheme).collect(Collectors.toList());
|
||||
List<ProjectRxswinEO> projectRxswinEOS = rxswinEOList.stream().filter(e -> themeList.contains(e.getTheme())).collect(Collectors.toList());
|
||||
if (projectRxswinEOS.isEmpty()) {
|
||||
//直接新增
|
||||
saveBatchInfo(projectId, user, rxswinEOList);
|
||||
} else {
|
||||
return "YES";
|
||||
}
|
||||
} else {
|
||||
//直接新增
|
||||
saveBatchInfo(projectId, user, rxswinEOList);
|
||||
}
|
||||
return "NO";
|
||||
}
|
||||
|
||||
private void saveBatchInfo(String projectId, LoginUser user, List<ProjectRxswinEO> rxswinEOList) {
|
||||
for (ProjectRxswinEO projectRxswinEO : rxswinEOList) {
|
||||
projectRxswinEO.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
projectRxswinEO.setProjectId(projectId);
|
||||
projectRxswinEO.setCreateTime(new Date());
|
||||
projectRxswinEO.setCreateBy(user.getUsername());
|
||||
projectRxswinEO.setState(StatusEnum.SAVE.getValue());
|
||||
}
|
||||
this.saveBatch(rxswinEOList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调取后保存数据
|
||||
*
|
||||
* @param projectId
|
||||
* @param ids
|
||||
* @param flag
|
||||
*/
|
||||
@Override
|
||||
public void addBatch(String projectId, String ids, String flag) {
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//新增的
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(ProjectRxswinEO::getId, Arrays.asList(ids.split(",")));
|
||||
List<ProjectRxswinEO> rxswinEOList = this.list(wrapper);
|
||||
|
||||
//已存在的
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapperTemp = new LambdaQueryWrapper<>();
|
||||
wrapperTemp.eq(ProjectRxswinEO::getProjectId, projectId);
|
||||
List<ProjectRxswinEO> rxswinEOS = this.list(wrapperTemp);
|
||||
|
||||
List<String> themeList = rxswinEOS.stream().map(ProjectRxswinEO::getTheme).collect(Collectors.toList());
|
||||
List<ProjectRxswinEO> yesList = rxswinEOList.stream().filter(e -> themeList.contains(e.getTheme())).collect(Collectors.toList());
|
||||
List<ProjectRxswinEO> noList = rxswinEOList.stream().filter(e -> !themeList.contains(e.getTheme())).collect(Collectors.toList());
|
||||
|
||||
|
||||
if (StatusEnum.COVER_YES.getValue().equals(flag)) {
|
||||
//未存在的进行新增
|
||||
saveBatchInfo(projectId, user, noList);
|
||||
|
||||
for (ProjectRxswinEO projectRxswinEO : yesList) {
|
||||
List<ProjectRxswinEO> collect = rxswinEOS.stream()
|
||||
.filter(e -> projectRxswinEO.getTheme().equals(e.getTheme())).collect(Collectors.toList());
|
||||
if (!collect.isEmpty()) {
|
||||
projectRxswinEO.setId(collect.get(0).getId());
|
||||
projectRxswinEO.setCreateTime(collect.get(0).getCreateTime());
|
||||
}
|
||||
projectRxswinEO.setUpdateTime(new Date());
|
||||
projectRxswinEO.setCreateBy(user.getUsername());
|
||||
projectRxswinEO.setState(StatusEnum.SAVE.getValue());
|
||||
projectRxswinEO.setProjectId(projectId);
|
||||
}
|
||||
//已存在的进行覆盖
|
||||
this.updateBatchById(yesList);
|
||||
|
||||
|
||||
} else if (StatusEnum.COVER_NO.getValue().equals(flag)) {
|
||||
saveBatchInfo(projectId, user, noList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getVersionList(String projectId) {
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProjectRxswinEO::getProjectId, projectId);
|
||||
List<ProjectRxswinEO> rxswinEOList = this.list(wrapper);
|
||||
List<String> versionList = rxswinEOList.stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getVersion()))
|
||||
.map(ProjectRxswinEO::getVersion).distinct().collect(Collectors.toList());
|
||||
Collections.sort(versionList, (a, b) -> {
|
||||
return Integer.parseInt(a) - Integer.parseInt(b);
|
||||
});
|
||||
return versionList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAndView exportXls(HttpServletRequest request, ProjectRxswinEO projectRxswinEO) {
|
||||
// Step.2 获取导出数据
|
||||
List<ProjectRxswinEO> pageList = getPageInfo(projectRxswinEO);
|
||||
List<ProjectRxswinEO> exportList = null;
|
||||
|
||||
// 过滤选中数据
|
||||
String selections = request.getParameter("selections");
|
||||
if (oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
exportList = pageList.stream().filter(e -> selectionList.contains(e.getId())).collect(Collectors.toList());
|
||||
} else {
|
||||
exportList = pageList;
|
||||
}
|
||||
|
||||
// Step.3 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
if (CutEnum.CN.getValue().equals(projectRxswinEO.getCut())) {
|
||||
mv.addObject(NormalExcelConstants.CLASS, ProjectRxswinEO.class);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
||||
ExportParams exportParams = new ExportParams(null, null, "RXSWIN");
|
||||
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
|
||||
} else {
|
||||
List<ProjectRxswinEOEn> dataList = new ArrayList<>();
|
||||
for (ProjectRxswinEO projectRxswinEOTemp : exportList) {
|
||||
ProjectRxswinEOEn projectRxswinEOEn = new ProjectRxswinEOEn();
|
||||
BeanUtils.copyProperties(projectRxswinEOTemp, projectRxswinEOEn);
|
||||
dataList.add(projectRxswinEOEn);
|
||||
}
|
||||
mv.addObject(NormalExcelConstants.CLASS, ProjectRxswinEOEn.class);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, dataList);
|
||||
ExportParams exportParams = new ExportParams(null, null, "RXSWIN");
|
||||
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
|
||||
}
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
||||
public List<BussDocumentLibraryEO> getBussDocumentLibraryEOList(List<String> documentIdList) {
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(BussDocumentLibraryEO::getId, documentIdList);
|
||||
return bussDocumentLibraryEOService.list(wrapper);
|
||||
}
|
||||
|
||||
private void heartSort(ProjectRxswinEO projectRxswinEO, List<ProjectRxswinEO> projectRxswinEOList) {
|
||||
Collator comparator = Collator.getInstance(Locale.CHINESE);
|
||||
// 编号
|
||||
if ("serialNumber".equals(projectRxswinEO.getOrderByField())) {
|
||||
if (OrderEnum.POSITIVE.getValue().equals(projectRxswinEO.getOrderBy())) {
|
||||
Collections.sort(projectRxswinEOList, (e1, e2) -> {
|
||||
String e1PlannedBpLaunchBatch = com.jero.modules.system.util.StringUtils.isNotBlank(e1.getSerialNumber()) ? e1.getSerialNumber() : "";
|
||||
String e2PlannedBpLaunchBatch = com.jero.modules.system.util.StringUtils.isNotBlank(e2.getSerialNumber()) ? e2.getSerialNumber() : "";
|
||||
return comparator.compare(e1PlannedBpLaunchBatch, e2PlannedBpLaunchBatch);
|
||||
});
|
||||
} else if (OrderEnum.REVERSE.getValue().equals(projectRxswinEO.getOrderBy())) {
|
||||
Collections.sort(projectRxswinEOList, (e1, e2) -> {
|
||||
String e1PlannedBpLaunchBatch = com.jero.modules.system.util.StringUtils.isNotBlank(e1.getSerialNumber()) ? e1.getSerialNumber() : "";
|
||||
String e2PlannedBpLaunchBatch = com.jero.modules.system.util.StringUtils.isNotBlank(e2.getSerialNumber()) ? e2.getSerialNumber() : "";
|
||||
return comparator.compare(e2PlannedBpLaunchBatch, e1PlannedBpLaunchBatch);
|
||||
});
|
||||
}
|
||||
}
|
||||
// 主题
|
||||
if ("theme".equals(projectRxswinEO.getOrderByField())) {
|
||||
if (OrderEnum.POSITIVE.getValue().equals(projectRxswinEO.getOrderBy())) {
|
||||
Collections.sort(projectRxswinEOList, (e1, e2) -> {
|
||||
String e1Market = com.jero.modules.system.util.StringUtils.isNotBlank(e1.getTheme()) ? e1.getTheme() : "";
|
||||
String e2Market = com.jero.modules.system.util.StringUtils.isNotBlank(e2.getTheme()) ? e2.getTheme() : "";
|
||||
return comparator.compare(e1Market, e2Market);
|
||||
});
|
||||
} else if (OrderEnum.REVERSE.getValue().equals(projectRxswinEO.getOrderBy())) {
|
||||
Collections.sort(projectRxswinEOList, (e1, e2) -> {
|
||||
String e1Market = com.jero.modules.system.util.StringUtils.isNotBlank(e1.getTheme()) ? e1.getTheme() : "";
|
||||
String e2Market = com.jero.modules.system.util.StringUtils.isNotBlank(e2.getTheme()) ? e2.getTheme() : "";
|
||||
return comparator.compare(e2Market, e1Market);
|
||||
});
|
||||
}
|
||||
}
|
||||
//RXSWIN
|
||||
if ("rxswin".equals(projectRxswinEO.getOrderByField())) {
|
||||
if (OrderEnum.POSITIVE.getValue().equals(projectRxswinEO.getOrderBy())) {
|
||||
Collections.sort(projectRxswinEOList, (e1, e2) -> {
|
||||
String e1Market = com.jero.modules.system.util.StringUtils.isNotBlank(e1.getRxswin()) ? e1.getRxswin() : "";
|
||||
String e2Market = com.jero.modules.system.util.StringUtils.isNotBlank(e2.getRxswin()) ? e2.getRxswin() : "";
|
||||
return comparator.compare(e1Market, e2Market);
|
||||
});
|
||||
} else if (OrderEnum.REVERSE.getValue().equals(projectRxswinEO.getOrderBy())) {
|
||||
Collections.sort(projectRxswinEOList, (e1, e2) -> {
|
||||
String e1Market = com.jero.modules.system.util.StringUtils.isNotBlank(e1.getRxswin()) ? e1.getRxswin() : "";
|
||||
String e2Market = com.jero.modules.system.util.StringUtils.isNotBlank(e2.getRxswin()) ? e2.getRxswin() : "";
|
||||
return comparator.compare(e2Market, e1Market);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//对应版本
|
||||
if ("version".equals(projectRxswinEO.getOrderByField())) {
|
||||
if (OrderEnum.POSITIVE.getValue().equals(projectRxswinEO.getOrderBy())) {
|
||||
Collections.sort(projectRxswinEOList, (e1, e2) -> {
|
||||
String e1Market = com.jero.modules.system.util.StringUtils.isNotBlank(e1.getVersion()) ? e1.getVersion() : "";
|
||||
String e2Market = com.jero.modules.system.util.StringUtils.isNotBlank(e2.getVersion()) ? e2.getVersion() : "";
|
||||
return comparator.compare(e1Market, e2Market);
|
||||
});
|
||||
} else if (OrderEnum.REVERSE.getValue().equals(projectRxswinEO.getOrderBy())) {
|
||||
Collections.sort(projectRxswinEOList, (e1, e2) -> {
|
||||
String e1Market = com.jero.modules.system.util.StringUtils.isNotBlank(e1.getVersion()) ? e1.getVersion() : "";
|
||||
String e2Market = com.jero.modules.system.util.StringUtils.isNotBlank(e2.getVersion()) ? e2.getVersion() : "";
|
||||
return comparator.compare(e2Market, e1Market);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportTemplate(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request) {
|
||||
OutputStream os = null;
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
String cut = (String) map.get("cut");
|
||||
String sheetName = "";
|
||||
if (com.jero.modules.system.util.StringUtils.equals(cut, CutEnum.CN.getValue())) {
|
||||
sheetName = "RXSWIN";
|
||||
} else {
|
||||
sheetName = "RXSWIN";
|
||||
}
|
||||
String fileOriName = "文档库导入模板.xls";
|
||||
String filePath = uploadpath + File.separator + fileOriName;
|
||||
try {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (CutEnum.CN.getValue().equals((String) map.get("cut"))) {
|
||||
list.add("编号,主题,RXSWIN,对应版本");
|
||||
} else {
|
||||
list.add("No.,Theme,RXSWIN,Corresponding version");
|
||||
}
|
||||
//创建临时文件夹
|
||||
File nowFile = new File(filePath);
|
||||
if (nowFile.exists()) {
|
||||
nowFile.delete();
|
||||
}
|
||||
nowFile.mkdirs();
|
||||
HSSFSheet sheet = workbook.createSheet(sheetName);
|
||||
sheet.setDefaultColumnWidth(16);//列宽
|
||||
HSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setWrapText(true);//自动换行
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
//表头
|
||||
Row row = sheet.createRow(i);//开始创建标题行
|
||||
String exportFieldName = list.get(i);
|
||||
if (i == 0) {
|
||||
if (com.jero.modules.system.util.StringUtils.isNotBlank(exportFieldName)) {
|
||||
String[] headerArr = exportFieldName.split(",");
|
||||
for (int j = 0; j < headerArr.length; j++) {
|
||||
row.createCell(j).setCellValue(headerArr[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\"" + fileOriName + ".xls");
|
||||
response.setContentType("application/force-download");
|
||||
response.flushBuffer();
|
||||
os = response.getOutputStream();
|
||||
workbook.write(os);
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException("下载文件失败,请重试");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void importExcel(MultipartFile file, String cut, String version, String projectId) {
|
||||
String title = "";
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
title = "编号,主题,RXSWIN,对应版本";
|
||||
} else {
|
||||
title = "No.,Theme,RXSWIN,Corresponding version";
|
||||
}
|
||||
// 获取文件名
|
||||
String fileName = file.getOriginalFilename();
|
||||
// 获取文件后缀
|
||||
String prefix = fileName.substring(fileName.lastIndexOf("."));
|
||||
if (!(prefix.equals(".xls") || prefix.equals(".xlsx"))) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("文件格式错误,请导入.xls或.xlsx格式");
|
||||
} else {
|
||||
throw new JeroBootException("The file format is wrong, please import. xls or. xlsx format.");
|
||||
}
|
||||
}
|
||||
Workbook workbook = null;
|
||||
try {
|
||||
File excelFile = File.createTempFile(fileName, prefix);
|
||||
file.transferTo(excelFile);
|
||||
workbook = WorkbookFactory.create(excelFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List<ProjectRxswinEO> projectRxswinEOList = new ArrayList<>();
|
||||
if (workbook != null) {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
if (sheet != null) {
|
||||
StringBuilder headerSb = new StringBuilder();
|
||||
int rowNos = sheet.getLastRowNum();// 得到excel的总记录条数
|
||||
for (int i = 0; i <= rowNos; i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
Row headerRow = sheet.getRow(0);
|
||||
boolean isBlank = bussDocumentLibraryEOService.isRowEmpty(row);
|
||||
ProjectRxswinEO projectRxswinEO = new ProjectRxswinEO();
|
||||
if (row != null && !isBlank) {
|
||||
int columNos = headerRow.getLastCellNum();// 表头总共的列数
|
||||
for (int j = 0; j < columNos; j++) {
|
||||
Cell cell = row.getCell(j);
|
||||
Cell headerCell = headerRow.getCell(j);
|
||||
if (cell != null) {
|
||||
if (i == 0) {
|
||||
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
||||
headerSb.append(cell.getStringCellValue() + ",");
|
||||
} else {
|
||||
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
||||
String stringCellValue = cell.getStringCellValue();
|
||||
if (StringUtils.isNotBlank(stringCellValue)) {
|
||||
String replace = stringCellValue.replace(",", ",");
|
||||
rxswinEOSet(projectRxswinEO, headerCell, replace);
|
||||
} else {
|
||||
rxswinEOSet(projectRxswinEO, headerCell, "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i != 0) {
|
||||
rxswinEOSet(projectRxswinEO, headerCell, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i != 0) {
|
||||
projectRxswinEOList.add(projectRxswinEO);
|
||||
// dataList.add(rowList);
|
||||
}
|
||||
}
|
||||
}
|
||||
String substring = headerSb.toString();
|
||||
if (substring.endsWith(",") || substring.endsWith(",")) {
|
||||
substring = headerSb.substring(0, headerSb.length() - 1);
|
||||
}
|
||||
String excelHeader = substring.toString();
|
||||
if (!title.equals(excelHeader)) {
|
||||
workbook.close();
|
||||
//删除原上传文件
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
|
||||
} else {
|
||||
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<BussDocumentLibraryEO> libraryEOList = bussDocumentLibraryEOService.list();
|
||||
List<String> serialNumberList = libraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList());
|
||||
|
||||
List<String> msgList = new ArrayList<>();
|
||||
//数据验证
|
||||
dataVerify(cut, projectId, projectRxswinEOList, serialNumberList, msgList);
|
||||
|
||||
if (msgList.size() > 0) {
|
||||
//返回报错信息
|
||||
String html = "";
|
||||
for (String s : msgList) {
|
||||
html += s + "</br>";
|
||||
}
|
||||
throw new JeroBootException(html);
|
||||
} else {
|
||||
for (ProjectRxswinEO projectRxswinEO : projectRxswinEOList) {
|
||||
projectRxswinEO.setProjectId(projectId);
|
||||
projectRxswinEO.setState(StatusEnum.SAVE.getValue());
|
||||
List<BussDocumentLibraryEO> collect = libraryEOList.stream()
|
||||
.filter(e -> e.getSerialNumber().equals(projectRxswinEO.getSerialNumber()))
|
||||
.collect(Collectors.toList());
|
||||
if (!collect.isEmpty()) {
|
||||
projectRxswinEO.setDocumentId(collect.get(0).getId());
|
||||
}
|
||||
}
|
||||
this.saveBatch(projectRxswinEOList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void dataVerify(String cut, String projectId, List<ProjectRxswinEO> projectRxswinEOList, List<String> serialNumberList, List<String> msgList) {
|
||||
List<ProjectRxswinEO> projectRxswinEOListTemp = projectRxswinEOList;
|
||||
int number = 2;
|
||||
int numberTemp = 2;
|
||||
for (ProjectRxswinEO rxswinEO : projectRxswinEOListTemp) {
|
||||
rxswinEO.setNumber(number);
|
||||
number++;
|
||||
}
|
||||
for (ProjectRxswinEO projectRxswinEO : projectRxswinEOList) {
|
||||
projectRxswinEO.setNumber(numberTemp);
|
||||
numberTemp++;
|
||||
}
|
||||
int count = 2;
|
||||
for (ProjectRxswinEO projectRxswinEO : projectRxswinEOList) {
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
errorMsg.append("第" + count + "行:");
|
||||
} else {
|
||||
errorMsg.append(count + " line:");
|
||||
}
|
||||
int countError = 0;
|
||||
List<ProjectRxswinEO> rxswinEOS = projectRxswinEOListTemp.stream()
|
||||
.filter(e -> !e.getNumber().equals(projectRxswinEO.getNumber()) && e.getTheme().equals(projectRxswinEO.getTheme()))
|
||||
.collect(Collectors.toList());
|
||||
if(!rxswinEOS.isEmpty()){
|
||||
List<Integer> numberList = rxswinEOS.stream().map(ProjectRxswinEO::getNumber).collect(Collectors.toList());
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
errorMsg.append(RxswinEnum.TWO.getNameCn()+"与"+StringUtils.join(numberList,",")+"行主题重复,");
|
||||
}else{
|
||||
errorMsg.append(RxswinEnum.TWO.getNameEn()+" and "+StringUtils.join(numberList,",")+" are duplicated,");
|
||||
}
|
||||
|
||||
countError ++;
|
||||
}
|
||||
projectRxswinEOListTemp = projectRxswinEOListTemp.stream().filter(e->!e.getTheme().equals(projectRxswinEO.getTheme())).collect(Collectors.toList());
|
||||
|
||||
String serialNumber = projectRxswinEO.getSerialNumber();
|
||||
String theme = projectRxswinEO.getTheme();
|
||||
String rxswin = projectRxswinEO.getRxswin();
|
||||
String versionTemp = projectRxswinEO.getVersion();
|
||||
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProjectRxswinEO::getProjectId, projectId);
|
||||
wrapper.eq(ProjectRxswinEO::getTheme, theme);
|
||||
List<ProjectRxswinEO> rxswinEOList = this.list(wrapper);
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
countError = isMust(errorMsg, RxswinEnum.ONE.getNameCn(), serialNumber, "不能为空,", countError);
|
||||
//验证编号是否存在
|
||||
if (StringUtils.isNotBlank(serialNumber) && !serialNumberList.contains(serialNumber)) {
|
||||
errorMsg.append(RxswinEnum.ONE.getNameCn() + "不存在,");
|
||||
// errorMsg += RxswinEnum.ONE.getNameCn()+"不存在,";
|
||||
countError++;
|
||||
}
|
||||
|
||||
countError = isMust(errorMsg, RxswinEnum.TWO.getNameCn(), theme, "不能为空,", countError);
|
||||
//验证主题是否存在
|
||||
if (!rxswinEOList.isEmpty()) {
|
||||
errorMsg.append(RxswinEnum.TWO.getNameCn() + "已存在,");
|
||||
// errorMsg += RxswinEnum.TWO.getNameCn()+"已存在,";
|
||||
countError++;
|
||||
}
|
||||
|
||||
countError = isMust(errorMsg, RxswinEnum.THREE.getNameCn(), rxswin, "不能为空,", countError);
|
||||
countError = isMust(errorMsg, RxswinEnum.FOUR.getNameCn(), versionTemp, "不能为空,", countError);
|
||||
} else {
|
||||
countError = isMust(errorMsg, RxswinEnum.ONE.getNameEn(), serialNumber, " cannot be empty,", countError);
|
||||
//验证编号是否存在
|
||||
if (StringUtils.isNotBlank(serialNumber) && !serialNumberList.contains(serialNumber)) {
|
||||
errorMsg.append(RxswinEnum.ONE.getNameEn() + " absent,");
|
||||
// errorMsg += RxswinEnum.ONE.getNameEn()+" absent,";
|
||||
countError++;
|
||||
}
|
||||
|
||||
countError = isMust(errorMsg, RxswinEnum.TWO.getNameEn(), theme, " cannot be empty,", countError);
|
||||
//验证主题是否存在
|
||||
if (!rxswinEOList.isEmpty()) {
|
||||
errorMsg.append(RxswinEnum.TWO.getNameEn() + " already exists,");
|
||||
// errorMsg += RxswinEnum.TWO.getNameCn()+" already exists,";
|
||||
countError++;
|
||||
}
|
||||
|
||||
countError = isMust(errorMsg, RxswinEnum.THREE.getNameEn(), rxswin, " cannot be empty,", countError);
|
||||
countError = isMust(errorMsg, RxswinEnum.FOUR.getNameEn(), versionTemp, " cannot be empty,", countError);
|
||||
}
|
||||
if (countError > 0) {
|
||||
if (errorMsg.toString().endsWith(",")) {
|
||||
String substring = errorMsg.substring(0, errorMsg.length() - 1);
|
||||
msgList.add(substring);
|
||||
} else {
|
||||
msgList.add(errorMsg.toString());
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
private int isMust(StringBuilder errorMsg, String field, String value, String reminder, int countError) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
errorMsg.append(field + reminder);
|
||||
// errorMsg += field + reminder;
|
||||
countError++;
|
||||
}
|
||||
return countError;
|
||||
}
|
||||
|
||||
|
||||
private void rxswinEOSet(ProjectRxswinEO projectRxswinEO, Cell headerCell, String replace) {
|
||||
if (RxswinEnum.ONE.getNameCn().equals(headerCell.getStringCellValue())
|
||||
|| RxswinEnum.ONE.getNameEn().equals(headerCell.getStringCellValue())) {
|
||||
projectRxswinEO.setSerialNumber(replace);
|
||||
|
||||
} else if (RxswinEnum.TWO.getNameCn().equals(headerCell.getStringCellValue())
|
||||
|| RxswinEnum.TWO.getNameEn().equals(headerCell.getStringCellValue())) {
|
||||
projectRxswinEO.setTheme(replace);
|
||||
|
||||
} else if (RxswinEnum.THREE.getNameCn().equals(headerCell.getStringCellValue())
|
||||
|| RxswinEnum.THREE.getNameEn().equals(headerCell.getStringCellValue())) {
|
||||
projectRxswinEO.setRxswin(replace);
|
||||
|
||||
} else if (RxswinEnum.FOUR.getNameCn().equals(headerCell.getStringCellValue())
|
||||
|| RxswinEnum.FOUR.getNameEn().equals(headerCell.getStringCellValue())) {
|
||||
projectRxswinEO.setVersion(replace);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user