Merge branch 'develop_1' into 'develop_master'

add:标准法规清单

See merge request !14
This commit is contained in:
王夏晖
2021-06-29 06:57:10 +00:00
28 changed files with 1207 additions and 10 deletions
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarDetailedIdAttFile;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 前端控制器
* </p>
*
* @author zzy
* @since 2021-06-24
*/
@RestController
@Api(description = "|SarDetailedIdAttFile|")
@RequestMapping("/api/sarLawsAttrDetailedList/sar-detailed-id-att-file")
public class SarDetailedIdAttFileController extends BaseController<SarDetailedIdAttFile> {
}
@@ -0,0 +1,145 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.controller;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.*;
import com.adc.da.slrs.sarLawsAttrDetailedList.service.ISarLawsAttrDetailedListService;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author zzy
* @since 2021-06-15
*/
@RestController
//@Api(description = "|SarLawsAttrDetailedList|")
@Api(tags = "标准法规清单详情")
@RequestMapping("/api/sarLawsAttrDetailedList/sar-laws-attr-detailed-list")
public class SarLawsAttrDetailedListController extends BaseController<SarLawsAttrDetailedList> {
@Autowired
private ISarLawsAttrDetailedListService iSarLawsAttrDetailedList;
@Autowired
private IAttFileEOService attFileEOService;
@Autowired
private SarLawsAttrDetailedListDao sarLawsAttrDetailedListDao;
/**
* @param Page 页数
* @param Size 大小
* @param id 清单id
* @return ResponseMessage
* @author zzy
* date 2021-06-17
**/
@ApiOperation(value = "查询标准信息")
@GetMapping("/selectLawsById")
public ResponseMessage selectLawsById(@RequestParam(defaultValue = "1")int Page, @RequestParam(defaultValue = "10") int Size, String id,String standName,String responseUnit){
List<LawsDto> laws = iSarLawsAttrDetailedList.selectLaws(id,Page-1,Size,standName);
return Result.success("200",laws);
}
@ApiOperation(value = "查询附件信息")
@GetMapping("/selectFile")
public ResponseMessage selectFile(String Id){
AttFileEO attFileEO = attFileEOService.getFileInfo(Id);
return Result.success("200",attFileEO);
}
/**
* @param Page 页数
* @param Size 大小
* @param id 清单id
* @return ResponseMessage
* @author zzy
* date 2021-06-17
* 标准主表中的数据不全,先预留接口
**/
@ApiOperation(value = "检索和高级检索")
@PostMapping("/selectByStandId")
public ResponseMessage selectByStandId(@RequestParam(defaultValue = "1")int Page, @RequestParam(defaultValue = "10") int Size, String id){
return null;
}
/**
*
* @param response 返回头
* @param standExcelVo standExcelVo类
* @return void
* @author 作者信息
* date 2021-06-24
**/
@ApiOperation(value = "导出标准信息")
@RequestMapping("/ExportLawsById")
public void ExportLawsById(HttpServletResponse response, StandExcelVo standExcelVo){
try {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
if(standExcelVo.getExportName()==null){
standExcelVo.setExportName("标准导出信息");
}
String fileName = URLEncoder.encode(standExcelVo.getExportName(), "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
List<LittleLawsDto> data = new ArrayList<>();
if (CollectionUtils.isEmpty(standExcelVo.getIds())){
List<String> list= sarLawsAttrDetailedListDao.selectLawsId2(standExcelVo.getId());
if (CollectionUtils.isEmpty(list)) return;
data=sarLawsAttrDetailedListDao.selectLawsById(list,null);
}else {
data=sarLawsAttrDetailedListDao.selectLawsById(standExcelVo.getIds(),null);
}
List<StandExcelDto> standExcel=new ArrayList<>();
for (LittleLawsDto littleLawsDto:data){
StandExcelDto standExcelDto=StandExcelDto.builder()
.standNumber(littleLawsDto.getStandNumber())
.standName(littleLawsDto.getStandName())
.standEnName(littleLawsDto.getStandEnName())
.responseUnit("责任部门")
.newCarTime("无字段")
.nowCarTime("无字段")
.typeApplicable("无字段")
.issueTime(littleLawsDto.getIssueTime())
.textStatus(littleLawsDto.getTextStatus())
.build();
standExcel.add(standExcelDto);
}
EasyExcel.write(response.getOutputStream(), StandExcelDto.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
.doWrite(standExcel);
} catch (Exception e) {
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().println(JSON.toJSONString(Result.error()));
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}
}
@@ -0,0 +1,18 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.dao;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarDetailedIdAttFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zzy
* @since 2021-06-24
*/
@Mapper
public interface SarDetailedIdAttFileDao extends BaseMapper<SarDetailedIdAttFile> {
}
@@ -0,0 +1,29 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.dao;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.LittleLawsDto;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandExcelDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zzy
* @since 2021-06-15
*/
@Mapper
public interface SarLawsAttrDetailedListDao extends BaseMapper<SarLawsAttrDetailedList> {
//根据清单id,查出标准的id并排序
List<String> selectLawsId(String standId,Integer page,Integer size);
//根据标准id查出数据
List<LittleLawsDto> selectLawsById(List<String> LawsIds,String standName);
List<String> selectLawsId2(String standId);
Boolean insertList(List<SarLawsAttrDetailedList> sarLawsAttrDetailedLists);
Boolean deleteByStandId(String standId);
}
@@ -0,0 +1,38 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* //Dto,用于从标准主表中查询和检索信息
* 主表还未完善需修改
*
* @author ZhangZhiYuan
* date 2021-06-16
*/
@Builder
@Data
public class LawsDto {
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "标准编号")
private String standNumber;
@ApiModelProperty(value = "中文名称")
private String standName;
@ApiModelProperty(value = "英文名称")
private String standEnName;
@ApiModelProperty(value = "责任部门")
private String responseUnit;
@ApiModelProperty(value = "新车型实施日期")
private String newCarTime;
@ApiModelProperty(value = "在产车实施日期")
private String nowCarTime;
@ApiModelProperty(value = "适用车辆类型")
private String typeApplicable;
@ApiModelProperty(value = "发布日期")
private String issueTime;
@ApiModelProperty(value = "文本状态")
private String textStatus;
}
@@ -0,0 +1,26 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* //TODO 添加类、接口描述
* 能从主表中查出的LawsDto所需要的数据
* @author ZhangZhiYuan
* date 2021-06-22
*/
@Data
public class LittleLawsDto {
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "标准编号")
private String standNumber;
@ApiModelProperty(value = "中文名称")
private String standName;
@ApiModelProperty(value = "英文名称")
private String standEnName;
@ApiModelProperty(value = "发布日期")
private String issueTime;
@ApiModelProperty(value = "文本状态")
private String textStatus;
}
@@ -0,0 +1,38 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
* 上传的附件和清单id的关联表
* @author zzy
* @since 2021-06-24
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarDetailedIdAttFile对象", description="")
public class SarDetailedIdAttFile extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId
private String id;
@ApiModelProperty(value = "清单id")
private String detailedId;
@ApiModelProperty(value = "文件id")
private String fileId;
}
@@ -0,0 +1,43 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author zzy
* @since 2021-06-15
*/
@Data
@Builder
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarLawsAttrDetailedList对象", description="")
public class SarLawsAttrDetailedList extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId
private String id;
@ApiModelProperty(value = "标准政策表的id")
private String standId;
@ApiModelProperty(value = "标准清单主键")
private String detailedListId;
@ApiModelProperty(value = "顺序")
private String number;
}
@@ -0,0 +1,45 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* //TODO 添加类、接口描述
*用于导出标准数据信息
* 需要后期修改
* @author ZhangZhiYuan
* @date 2021-06-24
*/
@Data
@Builder
public class StandExcelDto {
@ExcelProperty("标准编号")
@ApiModelProperty(value = "标准编号")
private String standNumber;
@ExcelProperty("中文名称")
@ApiModelProperty(value = "中文名称")
private String standName;
@ExcelProperty("英文名称")
@ApiModelProperty(value = "英文名称")
private String standEnName;
@ExcelProperty("责任部门")
@ApiModelProperty(value = "责任部门")
private String responseUnit;
@ExcelProperty("新车型实施日期")
@ApiModelProperty(value = "新车型实施日期")
private String newCarTime;
@ExcelProperty("在产车实施日期")
@ApiModelProperty(value = "在产车实施日期")
private String nowCarTime;
@ExcelProperty("适用车辆类型")
@ApiModelProperty(value = "适用车辆类型")
private String typeApplicable;
@ExcelProperty("发布日期")
@ApiModelProperty(value = "发布日期")
private String issueTime;
@ExcelProperty("文本状态")
@ApiModelProperty(value = "文本状态")
private String textStatus;
}
@@ -0,0 +1,25 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* //TODO 添加类、接口描述
*
* @author ZhangZhiYuan
* @date 2021-06-24
*/
@Data
@ApiModel(description = "标准导出类")
public class StandExcelVo {
@ApiModelProperty("文件名")
String exportName;
@ApiModelProperty("标准ID列表")
List<String> ids;
@ApiModelProperty("ID")
String id;
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.service;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarDetailedIdAttFile;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author zzy
* @since 2021-06-24
*/
public interface ISarDetailedIdAttFileService extends IService<SarDetailedIdAttFile> {
}
@@ -0,0 +1,25 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.service;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.LawsDto;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandExcelVo;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author zzy
* @since 2021-06-15
*/
public interface ISarLawsAttrDetailedListService extends IService<SarLawsAttrDetailedList> {
List<LawsDto> selectLaws(String standId, Integer Page, Integer Size,String standName);
Boolean insertDetailedList(String id,String[] lawsIds);
Boolean updateDetailedLaws(String id,String[] lawsIds);
void exportExcel(HttpServletResponse response, StandExcelVo standExcelVo);
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.service.impl;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarDetailedIdAttFile;
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarDetailedIdAttFileDao;
import com.adc.da.slrs.sarLawsAttrDetailedList.service.ISarDetailedIdAttFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author zzy
* @since 2021-06-24
*/
@Service
public class SarDetailedIdAttFileServiceImpl extends ServiceImpl<SarDetailedIdAttFileDao, SarDetailedIdAttFile> implements ISarDetailedIdAttFileService {
}
@@ -0,0 +1,104 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.service.impl;
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.LawsDto;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.LittleLawsDto;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandExcelVo;
import com.adc.da.slrs.sarLawsAttrDetailedList.service.ISarLawsAttrDetailedListService;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author zzy
* @since 2021-06-15
*/
@Service
public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrDetailedListDao, SarLawsAttrDetailedList> implements ISarLawsAttrDetailedListService {
@Autowired
SarLawsAttrDetailedListDao sarLawsAttrDetailedListDao;
//从主表中查询信息
@Override
public List<LawsDto> selectLaws(String standId, Integer Page, Integer Size,String standName) {
List<String> lawsIds = sarLawsAttrDetailedListDao.selectLawsId(standId,Page,Size);
if (CollectionUtils.isEmpty(lawsIds)){
return null;
}
List<LittleLawsDto> lawsDtoList = sarLawsAttrDetailedListDao.selectLawsById(lawsIds,standName);
List<LawsDto> list = new ArrayList<>();
for (LittleLawsDto laws:lawsDtoList){
LawsDto lawsDto = LawsDto.builder()
.id(laws.getId())
.standNumber(laws.getStandNumber())
.standName(laws.getStandName())
.standEnName(laws.getStandEnName())
.issueTime(laws.getIssueTime())
.textStatus(laws.getTextStatus())
.build();
list.add(lawsDto);
}
return list;
}
//向清单表和主表中的关联表插入信息
@Override
public Boolean insertDetailedList(String standId, String[] lawsIds) {
if (!StringUtils.isEmpty(lawsIds)){
try {
List<SarLawsAttrDetailedList> attrDetailedLists = new ArrayList<>();
int a=0;
for (String lawsId:lawsIds){
SarLawsAttrDetailedList sarLawsAttrDetailedList = SarLawsAttrDetailedList.builder()
.id(UUIDUtils.randomUUID20())
.standId(lawsId)
.detailedListId(standId)
.number(String.valueOf(a))
.build();
attrDetailedLists.add(sarLawsAttrDetailedList);
a++;
}
sarLawsAttrDetailedListDao.insertList(attrDetailedLists);
return true;
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
}
//修改关联表中的信息,先删除后修改
@Override
public Boolean updateDetailedLaws(String id, String[] lawsIds) {
try {
QueryWrapper<SarLawsAttrDetailedList> wrapper = new QueryWrapper<>();
wrapper.eq("detailed_list_id",id);
sarLawsAttrDetailedListDao.delete(wrapper);
insertDetailedList(id,lawsIds);
return true;
} catch (Exception e) {
return false;
}
}
@Override
public void exportExcel(HttpServletResponse response, StandExcelVo standExcelVo){
}
}
@@ -0,0 +1,119 @@
package com.adc.da.slrs.sarLawsDetailedList.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
import com.adc.da.slrs.sarLawsDetailedList.entity.DetailedUpDto;
import com.adc.da.slrs.sarLawsDetailedList.service.impl.SarLawsDetailedListServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author szc
* @since 2021-06-15
*/
@RestController
//@Api(description = "|SarLawsDetailedList|")
@Api(tags = "标准法规清单")
@RequestMapping("/api/sarLawsDetailedList/sar-laws-detailed-list")
public class SarLawsDetailedListController extends BaseController<SarLawsDetailedList> {
@Autowired
private SarLawsDetailedListServiceImpl sarLawsDetailedListService;
/**
* @param idList 要进行删除的清单id
* @return ResponseMessage
* @author zzy
* date 2021-06-22
**/
@ApiOperation(value = "批量删除清单")
@PostMapping("/deleteListAll")
public ResponseMessage deleteListAll(String[] idList) {
if (idList == null || idList.length == 0) {
return Result.success("200", "要删除的数据为空");
} else {
List<String> list = new ArrayList<>(Arrays.asList(idList));
String src = sarLawsDetailedListService.del(list);
return Result.success("200", src);
}
}
/**
* @param addDetailedDto AddDetailed类
* @return ResponseMessage
* @author zzy
* date 2021-06-22
**/
@ApiOperation(value = "增加清单")
@PostMapping("/insertList")
public ResponseMessage insertList(AddDetailedDto addDetailedDto) {
String src = sarLawsDetailedListService.add(addDetailedDto);
return Result.success(src);
}
/**
* 动态查询
* @param page 页数
* @param pageSize 大小
* @param sortKey 进行三个页面的分类1,2,3
* @param countryArea 动态查询输入 国家清单
* @param detailedList 列表
* @param projectName 其他
* @param detailedListName 动态查询输入
* @return ResponseMessage
*/
@ApiOperation(value = "动态查询")
@GetMapping("/getAllStand")
public ResponseMessage getAllStand(Integer page,Integer pageSize, String sortKey,
String countryArea, String projectName,
String detailedList,
String detailedListName) {
if ("null".equals(countryArea))countryArea=null;
if ("null".equals(projectName))projectName=null;
if ("null".equals(detailedList))detailedList=null;
if ("null".equals(detailedListName))detailedListName=null;
if (StringUtils.isNotEmpty(sortKey)) {
IPage<SarLawsDetailedList> publicList = sarLawsDetailedListService.AllSelectD(page, pageSize, sortKey,
countryArea, projectName, detailedList, detailedListName);
return Result.success("200", publicList);
} else {
return Result.success("200", null);
}
}
/**
* @param detailedUpDto 修改的信息,通过类进行接收
* @return ResponseMessage
* @author 张志远
* date 2021-06-22
**/
@ApiOperation(value = "修改清单")
@PutMapping("/updateList")
public ResponseMessage updateList(@RequestBody DetailedUpDto detailedUpDto) {
String src = sarLawsDetailedListService.updateList(detailedUpDto);
return Result.success("200",src,true);
}
}
@@ -0,0 +1,18 @@
package com.adc.da.slrs.sarLawsDetailedList.dao;
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author szc
* @since 2021-06-15
*/
@Mapper
public interface SarLawsDetailedListDao extends BaseMapper<SarLawsDetailedList> {
}
@@ -0,0 +1,48 @@
package com.adc.da.slrs.sarLawsDetailedList.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import java.util.Collection;
/**
* //TODO 添加类、接口描述
*
* @author ZhangZhiYuan
* @date 2021-06-24
*/
@Data
public class AddDetailedDto {
@ApiModelProperty(value = "国家或地区")
private String countryArea;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "清单类别")
private String detailedList;
@ApiModelProperty(value = "区分,国家地区为1,项目名称为2,清单类别为3")
private String sortKey;
@ApiModelProperty(value = "清单名称")
private String detailedListName;
@ApiModelProperty(value = "清单详情")
private String remark;
@ApiModelProperty(value = "清单状态,1为未发布,2为发布")
private String detailedListState;
@ApiModelProperty(value = "适用领域")
private String applicationScope;
@ApiModelProperty(value = "更新人")
private String updatePeople;
@ApiModelProperty(value = "上传的附件")
private MultipartFile[] files;
@ApiModelProperty(value = "要添加的清单id")
private String[] lawsIds;
public MultipartFile getFiles(int i) {
return files[i];
}
}
@@ -0,0 +1,62 @@
package com.adc.da.slrs.sarLawsDetailedList.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* //TODO 添加类、接口描述
*
* @author ZhangZhiYuan
* @date 2021-06-25
*/
@Data
public class DetailedUpDto {
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "国家或地区")
private String countryArea;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "清单类别")
private String detailedList;
@ApiModelProperty(value = "区分,国家地区为1,项目名称为2,清单类别为3")
private String sortKey;
@ApiModelProperty(value = "清单名称")
private String detailedListName;
@ApiModelProperty(value = "清单状态,1为未发布,2为发布")
private String detailedListState;
@ApiModelProperty(value = "清单版本,默认V0")
private String detailedListVision;
@ApiModelProperty(value = "适用领域")
private String applicationScope;
// @ApiModelProperty(value = "附件id")
// private String fileId;
@ApiModelProperty(value = "更新时间")
private Date reNewTime;
@ApiModelProperty(value = "更新人")
private String reNewPeople;
@ApiModelProperty(value = "要添加的清单id")
private String[] lawsIds;
@ApiModelProperty(value = "清单详情")
private String remark;
}
@@ -0,0 +1,18 @@
package com.adc.da.slrs.sarLawsDetailedList.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* //TODO 添加类、接口描述
*
* @author ZhangZhiYuan
* @date 2021-06-22
*/
@Data
public class IdListDto {
@ApiModelProperty("未符合项ID列表")
private List<String> Ids;
}
@@ -0,0 +1,81 @@
package com.adc.da.slrs.sarLawsDetailedList.entity;
import com.adc.da.base.entity.BaseEntity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author szc
* @since 2021-06-15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarLawsDetailedList对象", description="")
public class SarLawsDetailedList extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private String id;
@ApiModelProperty(value = "国家或地区")
@TableField("country_area")
private String countryArea;
@ApiModelProperty(value = "项目名称")
@TableField("project_name")
private String projectName;
@ApiModelProperty(value = "清单类别")
@TableField("detailed_list")
private String detailedList;
@ApiModelProperty(value = "区分,国家地区为1,项目名称为2,清单类别为3")
@TableField("sort_key")
private String sortKey;
@ApiModelProperty(value = "清单名称")
@TableField("detailed_list_name")
private String detailedListName;
@ApiModelProperty(value = "清单状态,1为未发布,2为发布")
@TableField("detailed_list_state")
private String detailedListState;
@ApiModelProperty(value = "清单版本,默认V0")
@TableField("detailed_list_vesion")
private String detailedListVision;
@ApiModelProperty(value = "适用领域")
@TableField("application_scope")
private String applicationScope;
@ApiModelProperty(value = "清单列表")
@TableField("remark")
private String remark;
@ApiModelProperty(value = "更新时间")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty(value = "更新人")
@TableField("update_people")
private String updatePeople;
}
@@ -0,0 +1,29 @@
package com.adc.da.slrs.sarLawsDetailedList.service;
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
import com.adc.da.slrs.sarLawsDetailedList.entity.DetailedUpDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author szc
* @since 2021-06-15
*/
public interface ISarLawsDetailedListService extends IService<SarLawsDetailedList> {
String del(List<String> idList);
String add(AddDetailedDto addDetailedDto);
IPage<SarLawsDetailedList> AllSelectD(Integer pages, Integer size, String sortKey,
String countryArea,String projectName,
String detailedList, String detailedListName);
// IPage<SarLawsDetailedList> selectAllP(Integer pages,Integer size,String sortKey);
String updateList(DetailedUpDto detailedUpDto);
}
@@ -0,0 +1,157 @@
package com.adc.da.slrs.sarLawsDetailedList.service.impl;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarDetailedIdAttFileDao;
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
import com.adc.da.slrs.sarLawsAttrDetailedList.service.impl.SarLawsAttrDetailedListServiceImpl;
import com.adc.da.slrs.sarLawsDetailedList.dao.SarLawsDetailedListDao;
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
import com.adc.da.slrs.sarLawsDetailedList.entity.DetailedUpDto;
import com.adc.da.slrs.sarLawsDetailedList.service.ISarLawsDetailedListService;
import com.adc.da.util.UUIDUtils;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author szc
* @since 2021-06-15
*/
@Service
public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedListDao, SarLawsDetailedList> implements ISarLawsDetailedListService {
@Autowired
public SarLawsDetailedListDao sarLawsDetailedListDao;
@Autowired
public IAttFileEOService iAttFileEOService;
@Autowired
private SarLawsAttrDetailedListDao sarLawsAttrDetailedListDao;
@Autowired
private SarLawsAttrDetailedListServiceImpl service;
@Override
public String del(List<String> idList) {
QueryWrapper<SarLawsAttrDetailedList> wrapper = new QueryWrapper<>();
for (String id:idList){
wrapper.eq("detailed_list_id",id);
sarLawsAttrDetailedListDao.delete(wrapper);
}
sarLawsDetailedListDao.deleteBatchIds(idList);
return "删除成功";
}
@Override
public String add(AddDetailedDto addDetailedDto) {
try {
SarLawsDetailedList sarLawsDetailedList = SarLawsDetailedList.builder()
.id(UUIDUtils.randomUUID20())
.sortKey(addDetailedDto.getSortKey())
.detailedListName(addDetailedDto.getDetailedListName())
.detailedListState("1")
.detailedListVision("v0")
.applicationScope(addDetailedDto.getApplicationScope())
.updateTime(new Date())
.updatePeople(addDetailedDto.getUpdatePeople())
.remark(addDetailedDto.getRemark())
.build();
switch (addDetailedDto.getSortKey()) {
case "1":
sarLawsDetailedList.setCountryArea(addDetailedDto.getCountryArea());
break;
case "2":
sarLawsDetailedList.setProjectName(addDetailedDto.getProjectName());
break;
case "3":
sarLawsDetailedList.setDetailedList(addDetailedDto.getDetailedList());
break;
default:
break;
}
sarLawsDetailedListDao.insert(sarLawsDetailedList);
service.insertDetailedList(sarLawsDetailedList.getId(),addDetailedDto.getLawsIds());
} catch (Exception e) {
e.printStackTrace();
}
return "添加成功";
}
@Override
public IPage<SarLawsDetailedList> AllSelectD(Integer pages, Integer size, String sortKey,
String countryArea,String projectName,
String detailedList,String detailedListName) {
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
if ("1".equals(sortKey) ) {
wrapper.like(StringUtils.isNotEmpty(countryArea),"country_area",countryArea).
like(StringUtils.isNotEmpty(detailedListName),"detailed_list_name",detailedListName);
}else if ("2".equals(sortKey)) {
wrapper.like(StringUtils.isNotEmpty(projectName),"project_name",projectName).
like(StringUtils.isNotEmpty(detailedListName),"detailed_list_name",detailedListName);
}else if ("3".equals(sortKey)){
wrapper.like(StringUtils.isNotEmpty(detailedList),"detailed_list_state",detailedList).
like(StringUtils.isNotEmpty(detailedListName),"detailed_list_name",detailedListName);
}
wrapper.eq("sort_key",sortKey);
Page<SarLawsDetailedList> page = new Page<>(pages, size);
IPage<SarLawsDetailedList> userIPage = sarLawsDetailedListDao.selectPage(page, wrapper);
System.out.println("总条数" + userIPage.getTotal());
System.out.println("总页数" + userIPage.getPages());
return userIPage;
}
@Override
public String updateList(DetailedUpDto detailedUpDto) {
SarLawsDetailedList list = sarLawsDetailedListDao.selectById(detailedUpDto.getId());
//国家或地区
if (StringUtils.isBlank(detailedUpDto.getCountryArea())) list.setCountryArea(null);
else if ("null".equals(detailedUpDto.getCountryArea()));
else list.setCountryArea(detailedUpDto.getCountryArea());
//项目名称
if (StringUtils.isBlank(detailedUpDto.getProjectName())) list.setProjectName(null);
else if ("null".equals(detailedUpDto.getProjectName()));
else list.setProjectName(detailedUpDto.getProjectName());
//清单类别
if (StringUtils.isBlank(detailedUpDto.getDetailedList())) list.setDetailedList(null);
else if ("null".equals(detailedUpDto.getDetailedList()));
else list.setDetailedList(detailedUpDto.getDetailedList());
//清单名称
if (StringUtils.isBlank(detailedUpDto.getDetailedListName())) list.setDetailedListName(null);
else if ("null".equals(detailedUpDto.getDetailedListName()));
else list.setDetailedListName(detailedUpDto.getDetailedListName());
//适用领域
if (StringUtils.isBlank(detailedUpDto.getApplicationScope())) list.setApplicationScope(null);
else if ("null".equals(detailedUpDto.getApplicationScope()));
else list.setApplicationScope(detailedUpDto.getApplicationScope());
//清单详情
if (StringUtils.isBlank(detailedUpDto.getRemark())) list.setRemark(null);
else if ("null".equals(detailedUpDto.getRemark()));
list.setRemark(detailedUpDto.getRemark());
//更新时间
list.setUpdateTime(new Date());
//更新人
if (StringUtils.isBlank(detailedUpDto.getReNewPeople())) list.setUpdatePeople(null);
else if ("null".equals(detailedUpDto.getReNewPeople()));
else list.setUpdatePeople(detailedUpDto.getReNewPeople());
sarLawsDetailedListDao.updateById(list);
service.updateDetailedLaws(detailedUpDto.getId(), detailedUpDto.getLawsIds());
return "修改成功";
}
}
@@ -22,7 +22,7 @@ public interface ISarPublicIdeaAllService extends IService<SarPublicIdeaAll> {
IPage<SarPublicIdeaAll> selectAll(DetAllStandDto detAllStandDto);
String add(SarPublicIdeaAll sarPublicIdeaAll);
String updateById(SarPublicIdeaAll sarPublicIdeaAll, String autUseerid);
String updateById(SarPublicIdeaAll sarPublicIdeaAll, String autUserid);
String delete(DelStandDto delStandDto);
String del(String id);
String stuListExcel(HttpServletResponse response,String cid);
@@ -63,8 +63,8 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
@Override
public String updateById(SarPublicIdeaAll sar, String autUseerid) {
if(sar.getUserId().equals(autUseerid)){
public String updateById(SarPublicIdeaAll sar, String autUserid) {
if(sar.getUserId().equals(autUserid)){
sarPublicIdeaAllDao.updateById(sar);
return "修改成功";
}else {
@@ -98,7 +98,7 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd hhmmss");
Workbook wb = new XSSFWorkbook();
//标题行抽出字段
String[] title = {"", "标准或政策编号","章节编号", "内容","提出人"};
String[] title = {"", "标准或政策编号","章节编号", "内容","提出人","所在部门"};
//设置sheet名称,并创建新的sheet对象
String sheetName = "意见信息";
Sheet stuSheet = wb.createSheet(sheetName);
@@ -124,9 +124,8 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
row.createCell(1).setCellValue(data.get(i).getCid());
row.createCell(2).setCellValue(data.get(i).getPartCode());
row.createCell(3).setCellValue(data.get(i).getContent());
row.createCell(4).setCellValue(data.get(i).getUserId());
row.createCell(4).setCellValue(data.get(i).getUserName());
row.createCell(5).setCellValue(data.get(i).getDeptName());
}
//设置单元格宽度自适应,在此基础上把宽度调至1.5倍
for (int i = 0; i < title.length; i++) {
@@ -45,11 +45,11 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
}
@Override
public IPage<SarPublicIdea> selectAllP(Integer p, Integer size, String categorg, String cname, Date start, Date end) {
public IPage<SarPublicIdea> selectAllP(Integer p, Integer size, String category, String cname, Date start, Date end) {
QueryWrapper<SarPublicIdea> list = new QueryWrapper<>();
list.eq(StringUtils.isNotEmpty(categorg),"category",categorg)
list.like(StringUtils.isNotEmpty(category),"category",category)
.like(StringUtils.isNotEmpty(cname),"cname",cname)
.gt(start!=null,"start_time",start).
.ge(start!=null,"start_time",start).
le(end!=null,"end_time",end);
Page<SarPublicIdea> page = new Page<>(p,size);
@@ -0,0 +1,5 @@
<?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.adc.da.slrs.sarLawsAttrDetailedList.dao.SarDetailedIdAttFileDao">
</mapper>
@@ -0,0 +1,61 @@
<?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.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao">
<select id="selectLawsById" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.LittleLawsDto">
SELECT ID,STAND_NUMBER,STAND_NAME,STAND_EN_NAME,ISSUE_TIME,TEXT_STATUS
FROM sar_standards_info
<where>
<if test="standName != null">
(STAND_NUMBER LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%')
or STAND_NAME LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%'))
and
</if>
ID IN
<foreach collection="param1" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
order by field(ID,
<foreach collection="param1" index="index" item="item" separator=",">
#{item}
</foreach>
)
</where>
</select>
<select id="selectLawsId" resultType="string">
select stand_id from sar_laws_attr_detailed_list
<where>
<if test="standId != null">
and detailed_list_id = #{standId,jdbcType=VARCHAR}
</if>
</where>
order by number
LIMIT #{param3} OFFSET #{param2};
</select>
<select id="selectLawsId2" resultType="string">
select stand_id from sar_laws_attr_detailed_list
<where>
<if test="standId != null">
and detailed_list_id = #{standId,jdbcType=VARCHAR}
</if>
</where>
order by number
</select>
<insert id="insertList">
INSERT INTO sar_laws_attr_detailed_list ( id, number, detailed_list_id, stand_id ) VALUES
<foreach collection ="list" item="list" separator =",">
(#{list.id,jdbcType=VARCHAR}, #{list.number}, #{list.detailedListId,jdbcType=VARCHAR}, #{list.standId,jdbcType=VARCHAR})
</foreach >
</insert>
<delete id="deleteByStandId">
delete from sar_laws_attr_detailed_list where detailed_list_id=#{standId,jdbcType=VARCHAR}
</delete>
</mapper>
@@ -0,0 +1,5 @@
<?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.adc.da.slrs.sarLawsDetailedList.dao.SarLawsDetailedListDao">
</mapper>