bug修复

This commit is contained in:
yuezhihang
2022-03-11 11:29:59 +08:00
parent 334dfb40f4
commit 2d95a7c31f
16 changed files with 626 additions and 7 deletions
@@ -242,6 +242,9 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
sar.setProjectLevel(sarDto.getProjectLevel());
sar.setProjectManager(sarDto.getProjectManager());
sar.setProductLine(sarDto.getProductLine());
sar.setManagementHostName(sarDto.getManagementHostName());
sar.setCategoryName(sarDto.getCategoryName());
sar.setDevelopmentHostName(sarDto.getDevelopmentHostName());
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
try {
@@ -0,0 +1,141 @@
package com.adc.da.slrs.wgCommittee.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.wgCommittee.entity.WgCommitteeDTO;
import com.adc.da.slrs.wgCommittee.service.IWgCommitteeService;
import com.adc.da.slrs.wgCommitteeUser.service.IWgCommitteeUserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.adc.da.slrs.wgCommittee.entity.WgCommittee;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 标准委员会 前端控制器
* </p>
*
* @author yzh
* @since 2022-03-10
*/
@RestController
@Api(description = "|WgCommittee|")
@RequestMapping("/${restPath}/wgCommittee/wg-committee")
public class WgCommitteeController extends BaseController<WgCommittee> {
@Autowired
IWgCommitteeService iWgCommitteeService;
@Autowired
IWgCommitteeUserService iWgCommitteeUserService;
@ApiModelProperty("新增工作组")
@PostMapping("/insert")
public ResponseMessage addWorkCommitter(WgCommittee wgCommittee) {
if (isDistinct(wgCommittee.getCommitteeName(),null)){
if (iWgCommitteeService.add(wgCommittee)){
return Result.success("200","新增成功");
}else {
return Result.error("201","新增失败");
}
}else {
return Result.error("202","组名已存在");
}
}
@ApiModelProperty("批量删除工作组")
@DeleteMapping("/deleteBatch")
public ResponseMessage deleteWorkGroup(String id){
List<String> ids=new ArrayList<>();
if (id.contains(",")){
ids.addAll(new ArrayList<>(Arrays.asList(id.split(","))));
}else {
ids.add(id);
}
QueryWrapper<WgCommittee> wrapper=new QueryWrapper<>();
wrapper.select("committeer");
wrapper.in("id",ids);
wrapper.isNotNull("committeer");
List<WgCommittee> removes = iWgCommitteeService.list(wrapper);
if (!removes.isEmpty()) {
List<String> reids = removes.stream().distinct().map(WgCommittee::getCommitteer).collect(Collectors.toList());
iWgCommitteeUserService.removeByIds(reids);
}
if (iWgCommitteeService.removeByIds(ids)) {
return Result.success();
}else {
return Result.error("");
}
}
@ApiModelProperty("根据组长民或者组名查询工作组,参数为空时查询全部")
@GetMapping("/page")
public ResponseMessage<IPage<WgCommitteeDTO>> getWgCommitteeLists(WgCommittee wgCommittee){
IPage<WgCommitteeDTO> workGroup = iWgCommitteeService.getWgCommittee(wgCommittee);
return Result.success(workGroup);
}
@ApiModelProperty("根据组长民或者组名查询工作组,参数为空时查询全部")
@GetMapping("/pageWk")
public ResponseMessage<IPage<WgCommitteeDTO>> getWgCommitteeList(WgCommittee wgCommittee){
IPage<WgCommitteeDTO> workGroup = iWgCommitteeService.getWgCommittee(wgCommittee);
return Result.success(workGroup);
}
@ApiModelProperty("修改标准委员会")
@PutMapping("/update")
public ResponseMessage updateWgCommittee(WgCommittee wgCommittee){
ResponseMessage<Object> result = Result.success();
if (isDistinct(wgCommittee.getCommitteeName(),wgCommittee.getId())){
if (iWgCommitteeService.update(wgCommittee)){
result=Result.success("修改成功");
}else {
result=Result.error("201", "修改失败");
}
}else {
result=Result.error("202", "组名已存在");
}
return result;
}
/**
* 判断提交的工作组名称是否重复
* @param groupName 条件
* @param id 排除id
* @returntrue 没有重复 false 有重复
*/
private boolean isDistinct(String groupName,String id){
QueryWrapper<WgCommittee> ew = new QueryWrapper<>();
ew.eq("committee_name",groupName);
if (id!=null){
ew.ne("id",id);
}
List<WgCommittee> list = iWgCommitteeService.list(ew);
return list.isEmpty();
}
}
@@ -0,0 +1,26 @@
package com.adc.da.slrs.wgCommittee.dao;
import com.adc.da.slrs.wgCommittee.entity.WgCommittee;
import com.adc.da.slrs.wgCommittee.entity.WgCommitteeDTO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* 标准委员会 Mapper 接口
* </p>
*
* @author yzh
* @since 2022-03-10
*/
public interface WgCommitteeDao extends BaseMapper<WgCommittee> {
List<WgCommitteeDTO> getData(WgCommittee wgCommittee);
Integer getDataCount(WgCommittee wgCommittee);
List<WgCommitteeDTO> getDataWk(WgCommittee wgCommittee);
Integer getDataCountWk(WgCommittee wgCommittee);
}
@@ -0,0 +1,51 @@
package com.adc.da.slrs.wgCommittee.entity;
import com.adc.da.base.entity.BaseEntity;
import com.adc.da.base.page.BasePage;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* <p>
* 标准委员会
* </p>
*
* @author yzh
* @since 2022-03-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="WgCommittee对象", description="标准委员会")
public class WgCommittee extends BasePage {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "委员会名称")
private String committeeName;
@ApiModelProperty(value = "委员会主任")
private String committeeDirector;
@ApiModelProperty(value = "委员会秘书长")
private String committeeSecretary;
@ApiModelProperty(value = "委员关联表")
private String committeer;
@ApiModelProperty(value = "委员")
@TableField(exist = false)
private String committeeIds;
}
@@ -0,0 +1,49 @@
package com.adc.da.slrs.wgCommittee.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* <p>
* 标准委员会
* </p>
*
* @author yzh
* @since 2022-03-10
*/
@Data
public class WgCommitteeDTO {
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "委员会名称")
private String committeeName;
@ApiModelProperty(value = "委员会主任")
private String committeeDirector;
@ApiModelProperty(value = "委员会主任")
private String committeeDirectorName;
@ApiModelProperty(value = "委员会秘书长")
private String committeeSecretary;
@ApiModelProperty(value = "委员会秘书长")
private String committeeSecretaryName;
@ApiModelProperty(value = "委员关联表")
private String committeer;
@ApiModelProperty(value = "委员")
private String committor;
@ApiModelProperty(value = "委员")
private String committorId;
// @ApiModelProperty(value = "委员")
// private List<String> committeeIds;
}
@@ -0,0 +1,26 @@
package com.adc.da.slrs.wgCommittee.service;
import com.adc.da.slrs.wgCommittee.entity.WgCommittee;
import com.adc.da.slrs.wgCommittee.entity.WgCommitteeDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 标准委员会 服务类
* </p>
*
* @author yzh
* @since 2022-03-10
*/
public interface IWgCommitteeService extends IService<WgCommittee> {
boolean add (WgCommittee wgCommittee);
boolean update (WgCommittee wgCommittee);
IPage<WgCommitteeDTO> getWgCommittee(WgCommittee wgCommittee);
IPage<WgCommitteeDTO> getWgCommitteeWk(WgCommittee wgCommittee);
}
@@ -0,0 +1,93 @@
package com.adc.da.slrs.wgCommittee.service.impl;
import com.adc.da.slrs.wgCommittee.entity.WgCommittee;
import com.adc.da.slrs.wgCommittee.dao.WgCommitteeDao;
import com.adc.da.slrs.wgCommittee.entity.WgCommitteeDTO;
import com.adc.da.slrs.wgCommittee.service.IWgCommitteeService;
import com.adc.da.slrs.wgCommitteeUser.entity.WgCommitteeUser;
import com.adc.da.slrs.wgCommitteeUser.service.IWgCommitteeUserService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
* <p>
* 标准委员会 服务实现类
* </p>
*
* @author yzh
* @since 2022-03-10
*/
@Service
public class WgCommitteeServiceImpl extends ServiceImpl<WgCommitteeDao, WgCommittee> implements IWgCommitteeService {
@Autowired
IWgCommitteeUserService iWgCommitteeUserService;
@Autowired
IWgCommitteeService iWgCommitteeService;
@Autowired
WgCommitteeDao wgCommitteeDao;
@Transactional
@Override
public boolean add(WgCommittee wgCommittee) {
wgCommittee.setId(String.valueOf(UUID.randomUUID()));
String id=String.valueOf(UUID.randomUUID());
wgCommittee.setCommitteer(id);
List<WgCommitteeUser> list=new ArrayList<>();
if (null!=wgCommittee.getCommitteeIds() && !wgCommittee.getCommitteeIds().isEmpty()) {
List<String> res=new ArrayList<>(Arrays.asList(wgCommittee.getCommitteeIds().split(",")));
res.stream().forEach(s -> list.add(new WgCommitteeUser().setCommitterId(s).setId(wgCommittee.getCommitteer())));
iWgCommitteeUserService.saveOrUpdateBatch(list);
}
if (iWgCommitteeService.saveOrUpdate(wgCommittee)) {
return true;
}else {
return false;
}
}
@Transactional
@Override
public boolean update(WgCommittee wgCommittee) {
iWgCommitteeService.updateById(wgCommittee);
List<WgCommitteeUser> save=new ArrayList<>();
if (null!=wgCommittee.getCommitteeIds() && !wgCommittee.getCommitteeIds().isEmpty()){
List<String> res=new ArrayList<>(Arrays.asList(wgCommittee.getCommitteeIds().split(",")));
res.forEach(s -> save.add(new WgCommitteeUser().setId(wgCommittee.getCommitteer()).setCommitterId(s)));
}
if (iWgCommitteeUserService.updateBatchById(save)) {
return true;
}else {
return false;
}
}
@Override
public IPage<WgCommitteeDTO> getWgCommittee(WgCommittee wgCommittee) {
Page page=new Page();
page.setRecords(wgCommitteeDao.getData(wgCommittee));
page.setCurrent(wgCommittee.getPage());
page.setSize(wgCommittee.getPageSize());
page.setTotal(wgCommitteeDao.getDataCount(wgCommittee));
return page;
}
@Override
public IPage<WgCommitteeDTO> getWgCommitteeWk(WgCommittee wgCommittee) {
Page page=new Page();
page.setRecords(wgCommitteeDao.getDataWk(wgCommittee));
page.setCurrent(wgCommittee.getPage());
page.setSize(wgCommittee.getPageSize());
page.setTotal(wgCommitteeDao.getDataCountWk(wgCommittee));
return page;
}
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.wgCommitteeUser.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.wgCommitteeUser.entity.WgCommitteeUser;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 标准委员会委员 前端控制器
* </p>
*
* @author yzh
* @since 2022-03-10
*/
@RestController
@Api(description = "|WgCommitteeUser|")
@RequestMapping("/${restPath}/wgCommitteeUser/wg-committee-user")
public class WgCommitteeUserController extends BaseController<WgCommitteeUser> {
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.wgCommitteeUser.dao;
import com.adc.da.slrs.wgCommitteeUser.entity.WgCommitteeUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 标准委员会委员 Mapper 接口
* </p>
*
* @author yzh
* @since 2022-03-10
*/
public interface WgCommitteeUserDao extends BaseMapper<WgCommitteeUser> {
}
@@ -0,0 +1,33 @@
package com.adc.da.slrs.wgCommitteeUser.entity;
import com.adc.da.base.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 标准委员会委员
* </p>
*
* @author yzh
* @since 2022-03-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="WgCommitteeUser对象", description="标准委员会委员")
public class WgCommitteeUser extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "委员id")
private String committerId;
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.wgCommitteeUser.service;
import com.adc.da.slrs.wgCommitteeUser.entity.WgCommitteeUser;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 标准委员会委员 服务类
* </p>
*
* @author yzh
* @since 2022-03-10
*/
public interface IWgCommitteeUserService extends IService<WgCommitteeUser> {
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.wgCommitteeUser.service.impl;
import com.adc.da.slrs.wgCommitteeUser.entity.WgCommitteeUser;
import com.adc.da.slrs.wgCommitteeUser.dao.WgCommitteeUserDao;
import com.adc.da.slrs.wgCommitteeUser.service.IWgCommitteeUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 标准委员会委员 服务实现类
* </p>
*
* @author yzh
* @since 2022-03-10
*/
@Service
public class WgCommitteeUserServiceImpl extends ServiceImpl<WgCommitteeUserDao, WgCommitteeUser> implements IWgCommitteeUserService {
}