Commit c7944e30 by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents 107aaea0 9b3ae087
package com.gic.auth.dto;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 11:13
*/
public class AuditedGroupDTO implements Serializable{
private static final long serialVersionUID = -2850377191052218727L;
public interface SaveValid{}
/**
*
*/
private Integer auditedGroupId;
/**
*
*/
private Integer enterpriseId;
/**
* 受审组name
*/
@NotBlank(message = "受审组名称不能为空", groups = SaveValid.class)
private String auditedGroupName;
/**
*
*/
private Date createTime;
@NotEmpty(message = "请选择审核员", groups = SaveValid.class)
private List<Integer> userIdList;
private Integer allCheck;
private Integer userCount;
public void setUserCount(Integer userCount) {
this.userCount = userCount;
}
public Integer getUserCount() {
return userCount;
}
public void setAllCheck(Integer allCheck) {
this.allCheck = allCheck;
}
public Integer getAllCheck() {
return allCheck;
}
public Integer getAuditedGroupId() {
return auditedGroupId;
}
public void setAuditedGroupId(Integer auditedGroupId) {
this.auditedGroupId = auditedGroupId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getAuditedGroupName() {
return auditedGroupName;
}
public void setAuditedGroupName(String auditedGroupName) {
this.auditedGroupName = auditedGroupName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public List<Integer> getUserIdList() {
return userIdList;
}
public void setUserIdList(List<Integer> userIdList) {
this.userIdList = userIdList;
}
}
package com.gic.auth.qo;
import com.gic.enterprise.qo.PageQO;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 16:59
*/
public class AuditedGroupQO extends PageQO {
private static final long serialVersionUID = 4181799724240655836L;
public interface SaveValid{}
public interface DelValid { }
public interface GetValid{}
/**
*
*/
@NotNull(message = "受审组id不能为空", groups = {DelValid.class, GetValid.class})
private Integer auditedGroupId;
/**
*
*/
private Integer enterpriseId;
/**
* 受审组name
*/
@NotBlank(message = "受审组名称不能为空", groups = SaveValid.class)
private String auditedGroupName;
/**
*
*/
private Date createTime;
@NotBlank(message = "请选择审核员", groups = SaveValid.class)
private String userIds;
private Integer allCheck;
private Integer userCount;
public Integer getAuditedGroupId() {
return auditedGroupId;
}
public void setAuditedGroupId(Integer auditedGroupId) {
this.auditedGroupId = auditedGroupId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getAuditedGroupName() {
return auditedGroupName;
}
public void setAuditedGroupName(String auditedGroupName) {
this.auditedGroupName = auditedGroupName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUserIds() {
return userIds;
}
public void setUserIds(String userIds) {
this.userIds = userIds;
}
public Integer getAllCheck() {
return allCheck;
}
public void setAllCheck(Integer allCheck) {
this.allCheck = allCheck;
}
public Integer getUserCount() {
return userCount;
}
public void setUserCount(Integer userCount) {
this.userCount = userCount;
}
}
package com.gic.auth.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.qo.AuditedGroupQO;
/**
* 受审组
* @ClassName: AuditedGroupApiService
* @Description:
* @author zhiwj
* @date 2019-09-18 11:11
*/
public interface AuditedGroupApiService {
/**
* 新增或修改受审组
* @Title: saveOrUpdateAuditedGroup
* @Description:
* @author zhiwj
* @param auditedGroupDTO
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> saveOrUpdateAuditedGroup(AuditedGroupDTO auditedGroupDTO);
/**
* 删除
* @Title: delAuditedGroup
* @Description:
* @author zhiwj
* @param auditedGroupId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> delAuditedGroup(Integer auditedGroupId);
/**
* 受审组列表
* @Title: listAuditedGroup
* @Description:
* @author zhiwj
* @param auditedGroupQO
* @return com.gic.api.base.commons.ServiceResponse<com.gic.api.base.commons.Page<com.gic.auth.dto.AuditedGroupDTO>>
* @throws
*/
ServiceResponse<Page<AuditedGroupDTO>> listAuditedGroup(AuditedGroupQO auditedGroupQO);
/**
*
* @Title: getAuditedGroup
* @Description:
* @author zhiwj
* @param auditedGroupId
* @return com.gic.api.base.commons.ServiceResponse<com.gic.auth.dto.AuditedGroupDTO>
* @throws
*/
ServiceResponse<AuditedGroupDTO> getAuditedGroup(Integer auditedGroupId);
}
package com.gic.auth.dao.mapper;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.entity.TabAuditedGroup;
import com.gic.auth.qo.AuditedGroupQO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
public interface TabAuditedGroupMapper {
/**
......@@ -50,4 +54,10 @@ public interface TabAuditedGroupMapper {
* @return 更新条目数
*/
int updateByPrimaryKey(TabAuditedGroup record);
Integer getFirstAuditedGroup(AuditedGroupDTO auditedGroupDTO);
Integer delAuditedGroup(@Param("auditedGroupId") Integer auditedGroupId);
Page<TabAuditedGroup> listAuditedGroup(AuditedGroupQO auditedGroupQO);
}
\ No newline at end of file
package com.gic.auth.dao.mapper;
import com.gic.auth.entity.TabAuditedGroupUserRel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface TabAuditedGroupUserRelMapper {
/**
......@@ -50,4 +54,14 @@ public interface TabAuditedGroupUserRelMapper {
* @return 更新条目数
*/
int updateByPrimaryKey(TabAuditedGroupUserRel record);
int delByAuditedGroupId(@Param("auditedGroupId") Integer auditedGroupId);
void insertSelectiveByNotExist(TabAuditedGroupUserRel auditedGroupUserRel);
Integer updateStatusByUserIds(@Param("enterpriseId") Integer enterpriseId, @Param("auditedGroupId") Integer auditedGroupId, @Param("ids") List<Integer> userIdList);
List<Map<Integer,Object>> getUserCountByAuditedGroup(@Param("ids") List<Integer> auditedGroupIds);
List<TabAuditedGroupUserRel> listAuditedGroup(TabAuditedGroupUserRel groupUserRel);
}
\ No newline at end of file
package com.gic.auth.dao.mapper;
import com.gic.auth.entity.TabAuditorAuditedGroupRel;
import org.apache.ibatis.annotations.Param;
public interface TabAuditorAuditedGroupRelMapper {
/**
......@@ -50,4 +51,6 @@ public interface TabAuditorAuditedGroupRelMapper {
* @return 更新条目数
*/
int updateByPrimaryKey(TabAuditorAuditedGroupRel record);
int delRel(@Param("auditedGroupId") Integer auditedGroupId);
}
\ No newline at end of file
package com.gic.auth.dao.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.auth.dto.UserListDTO;
import com.gic.auth.entity.TabSysUser;
import com.gic.auth.qo.UserListQO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabSysUserMapper {
/**
......@@ -93,4 +92,6 @@ public interface TabSysUserMapper {
* @return int


 */
int deleteById(@Param("userId") Integer userId);
Integer getFirstNotInUserId(@Param("enterpriseId") Integer enterpriseId, @Param("ids") List<Integer> userIdList);
}
\ No newline at end of file
......@@ -12,11 +12,21 @@ public class TabAuditedGroup {
private Integer auditedGroupId;
/**
*
*/
private Integer enterpriseId;
/**
* 受审组name
*/
private String auditedGroupName;
/**
* 是否是全选的受审组 1:是 0:否
*/
private Integer allCheck;
/**
*
*/
private Integer status;
......@@ -39,6 +49,14 @@ public class TabAuditedGroup {
this.auditedGroupId = auditedGroupId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getAuditedGroupName() {
return auditedGroupName;
}
......@@ -47,6 +65,14 @@ public class TabAuditedGroup {
this.auditedGroupName = auditedGroupName;
}
public Integer getAllCheck() {
return allCheck;
}
public void setAllCheck(Integer allCheck) {
this.allCheck = allCheck;
}
public Integer getStatus() {
return status;
}
......
......@@ -12,6 +12,11 @@ public class TabAuditedGroupUserRel {
private Integer auditedGroupUserRelId;
/**
*
*/
private Integer enterpriseId;
/**
* 受审组id
*/
private Integer auditedGroupId;
......@@ -44,6 +49,14 @@ public class TabAuditedGroupUserRel {
this.auditedGroupUserRelId = auditedGroupUserRelId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getAuditedGroupId() {
return auditedGroupId;
}
......
......@@ -12,6 +12,11 @@ public class TabAuditorAuditedGroupRel {
private Integer auditorAuditedGroupRelId;
/**
*
*/
private Integer enterpriseId;
/**
* 审核员id
*/
private Integer auditorId;
......@@ -44,6 +49,14 @@ public class TabAuditorAuditedGroupRel {
this.auditorAuditedGroupRelId = auditorAuditedGroupRelId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getAuditorId() {
return auditorId;
}
......
......@@ -12,6 +12,11 @@ public class TabAuditorProjectRel {
private Integer auditorProjectRelId;
/**
*
*/
private Integer enterpriseId;
/**
* 审核员
*/
private Integer auditorId;
......@@ -44,6 +49,14 @@ public class TabAuditorProjectRel {
this.auditorProjectRelId = auditorProjectRelId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getAuditorId() {
return auditorId;
}
......
package com.gic.auth.service;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.entity.TabAuditedGroup;
import com.gic.auth.qo.AuditedGroupQO;
import com.github.pagehelper.Page;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 11:29
*/
public interface AuditedGroupService {
boolean validAuditedGroupIsRepeat(Integer enterpriseId, String auditedGroupName, Integer auditedGroupId);
Integer save(AuditedGroupDTO auditedGroupDTO);
Integer update(AuditedGroupDTO auditedGroupDTO);
Integer delAuditedGroup(Integer auditedGroupId);
Page<TabAuditedGroup> listAuditedGroup(AuditedGroupQO auditedGroupQO);
TabAuditedGroup getAuditedGroup(Integer auditedGroupId);
}
package com.gic.auth.service;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.entity.TabAuditedGroupUserRel;
import java.util.List;
import java.util.Map;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 11:31
*/
public interface AuditedGroupUserRelService {
Integer addOrUpdateRel(AuditedGroupDTO auditedGroupDTO);
int delRel(Integer auditedGroupId);
Map<Integer,Integer> getUserCountByAuditedGroup(List<Integer> auditedGroupIds);
List<TabAuditedGroupUserRel> listAuditedGroup(Integer auditedGroupId);
}
package com.gic.auth.service;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 16:30
*/
public interface AuditorAuditedGroupRelService {
int delRel(Integer auditedGroupId);
}
package com.gic.auth.service;
import java.util.List;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.dto.UserListDTO;
import com.gic.auth.entity.TabSysUser;
import com.gic.auth.qo.UserListQO;
import com.github.pagehelper.Page;
import java.util.List;
/**
* @author guojx
* @date 2019/7/16 6:50 PM
......@@ -64,4 +64,6 @@ public interface UserService {
* @return void


 */
void delete(Integer userId);
Integer getAllCheckValue(Integer enterpriseId, List<Integer> userIdList);
}
package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabAuditedGroupMapper;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.entity.TabAuditedGroup;
import com.gic.auth.qo.AuditedGroupQO;
import com.gic.auth.service.AuditedGroupService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 11:29
*/
@Service
public class AuditedGroupServiceImpl implements AuditedGroupService {
@Autowired
private TabAuditedGroupMapper tabAuditedGroupMapper;
@Override
public boolean validAuditedGroupIsRepeat(Integer enterpriseId, String auditedGroupName, Integer auditedGroupId) {
AuditedGroupDTO auditedGroupDTO = new AuditedGroupDTO();
auditedGroupDTO.setEnterpriseId(enterpriseId);
auditedGroupDTO.setAuditedGroupName(auditedGroupName);
auditedGroupDTO.setAuditedGroupId(auditedGroupId);
Integer line = tabAuditedGroupMapper.getFirstAuditedGroup(auditedGroupDTO);
return line != null;
}
@Override
public Integer save(AuditedGroupDTO auditedGroupDTO) {
TabAuditedGroup auditedGroup = EntityUtil.changeEntityByJSON(TabAuditedGroup.class, auditedGroupDTO);
auditedGroup.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
auditedGroup.setCreateTime(new Date());
tabAuditedGroupMapper.insertSelective(auditedGroup);
return auditedGroup.getAuditedGroupId();
}
@Override
public Integer update(AuditedGroupDTO auditedGroupDTO) {
TabAuditedGroup auditedGroup = new TabAuditedGroup();
auditedGroup.setAuditedGroupId(auditedGroupDTO.getAuditedGroupId());
auditedGroup.setAllCheck(auditedGroupDTO.getAllCheck());
auditedGroup.setAuditedGroupName(auditedGroupDTO.getAuditedGroupName());
return tabAuditedGroupMapper.updateByPrimaryKeySelective(auditedGroup);
}
@Override
public Integer delAuditedGroup(Integer auditedGroupId) {
return tabAuditedGroupMapper.delAuditedGroup(auditedGroupId);
}
@Override
public Page<TabAuditedGroup> listAuditedGroup(AuditedGroupQO auditedGroupQO) {
PageHelper.startPage(auditedGroupQO.getCurrentPage(), auditedGroupQO.getPageSize());
return tabAuditedGroupMapper.listAuditedGroup(auditedGroupQO);
}
@Override
public TabAuditedGroup getAuditedGroup(Integer auditedGroupId) {
TabAuditedGroup tabAuditedGroup = tabAuditedGroupMapper.selectByPrimaryKey(auditedGroupId);
return tabAuditedGroup != null && (GlobalInfo.DATA_STATUS_NORMAL == tabAuditedGroup.getStatus()) ? tabAuditedGroup : null;
}
}
package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabAuditedGroupUserRelMapper;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.entity.TabAuditedGroupUserRel;
import com.gic.auth.service.AuditedGroupUserRelService;
import com.gic.commons.util.GlobalInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 11:31
*/
@Service
public class AuditedGroupUserRelServiceImpl implements AuditedGroupUserRelService {
@Autowired
private TabAuditedGroupUserRelMapper tabAuditedGroupUserRelMapper;
@Override
public Integer addOrUpdateRel(AuditedGroupDTO auditedGroupDTO) {
// 把所有auditedGroup的关联status设置为0
tabAuditedGroupUserRelMapper.delByAuditedGroupId(auditedGroupDTO.getAuditedGroupId());
// 插入不存在的关联
for (Integer userId : auditedGroupDTO.getUserIdList()) {
TabAuditedGroupUserRel auditedGroupUserRel = new TabAuditedGroupUserRel();
auditedGroupUserRel.setEnterpriseId(auditedGroupDTO.getEnterpriseId());
auditedGroupUserRel.setAuditedGroupId(auditedGroupDTO.getAuditedGroupId());
auditedGroupUserRel.setUserId(userId);
auditedGroupUserRel.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
auditedGroupUserRel.setCreateTime(new Date());
tabAuditedGroupUserRelMapper.insertSelectiveByNotExist(auditedGroupUserRel);
}
// 把所有userId关联status都设置为1
return tabAuditedGroupUserRelMapper.updateStatusByUserIds(auditedGroupDTO.getEnterpriseId(), auditedGroupDTO.getAuditedGroupId(), auditedGroupDTO.getUserIdList());
}
@Override
public int delRel(Integer auditedGroupId) {
return tabAuditedGroupUserRelMapper.delByAuditedGroupId(auditedGroupId);
}
@Override
public Map<Integer, Integer> getUserCountByAuditedGroup(List<Integer> auditedGroupIds) {
List<Map<Integer, Object>> mapList = tabAuditedGroupUserRelMapper.getUserCountByAuditedGroup(auditedGroupIds);
Map<Integer, Integer> resultMap = new HashMap<>(auditedGroupIds.size());
for (Map<Integer, Object> map : mapList) {
resultMap.put(Integer.valueOf(map.get("auditedGroupId").toString()), Integer.valueOf(map.get("userCount").toString()));
}
return resultMap;
}
@Override
public List<TabAuditedGroupUserRel> listAuditedGroup(Integer auditedGroupId) {
TabAuditedGroupUserRel groupUserRel = new TabAuditedGroupUserRel();
groupUserRel.setAuditedGroupId(auditedGroupId);
return this.tabAuditedGroupUserRelMapper.listAuditedGroup(groupUserRel);
}
}
package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabAuditorAuditedGroupRelMapper;
import com.gic.auth.service.AuditorAuditedGroupRelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 16:30
*/
@Service
public class AuditorAuditedGroupRelServiceImpl implements AuditorAuditedGroupRelService {
@Autowired
private TabAuditorAuditedGroupRelMapper tabAuditorAuditedGroupRelMapper;
@Override
public int delRel(Integer auditedGroupId) {
return tabAuditorAuditedGroupRelMapper.delRel(auditedGroupId);
}
}
package com.gic.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.gic.auth.dao.mapper.TabSysUserMapper;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.dto.UserListDTO;
......@@ -13,8 +7,14 @@ import com.gic.auth.entity.TabSysUser;
import com.gic.auth.qo.UserListQO;
import com.gic.auth.service.UserService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author guojx
......@@ -80,4 +80,10 @@ public class UserServiceImpl implements UserService {
public void delete(Integer userId) {
tabSysUserMapper.deleteById(userId);
}
@Override
public Integer getAllCheckValue(Integer enterpriseId, List<Integer> userIdList) {
Integer line = tabSysUserMapper.getFirstNotInUserId(enterpriseId, userIdList);
return line == null ? GlobalInfo.DATA_STATUS_NORMAL : GlobalInfo.DATA_STATUS_DELETE;
}
}
package com.gic.auth.service.outer.impl;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.entity.TabAuditedGroup;
import com.gic.auth.entity.TabAuditedGroupUserRel;
import com.gic.auth.qo.AuditedGroupQO;
import com.gic.auth.service.*;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 11:26
*/
@Service("auditedGroupApiService")
public class AuditedGroupApiServiceImpl implements AuditedGroupApiService {
private Logger logger = LogManager.getLogger(AuditedGroupApiServiceImpl.class);
@Autowired
private AuditedGroupService auditedGroupService;
@Autowired
private AuditedGroupUserRelService auditedGroupUserRelService;
@Autowired
private UserService userService;
@Autowired
private AuditorAuditedGroupRelService auditorAuditedGroupRelService;
@Override
@Transactional(rollbackFor = Exception.class)
@SuppressWarnings("unchecked")
public ServiceResponse<Integer> saveOrUpdateAuditedGroup(AuditedGroupDTO auditedGroupDTO) {
// 判断名是否重复
boolean repeat = auditedGroupService.validAuditedGroupIsRepeat(auditedGroupDTO.getEnterpriseId(), auditedGroupDTO.getAuditedGroupName(), auditedGroupDTO.getAuditedGroupId());
if (repeat) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "受审组名称重复");
}
// 判断该受审组是否是全选的
Integer allCheck = userService.getAllCheckValue(auditedGroupDTO.getEnterpriseId(), auditedGroupDTO.getUserIdList());
auditedGroupDTO.setAllCheck(allCheck);
Integer id;
if (auditedGroupDTO.getAuditedGroupId() == null) {
// save
id = auditedGroupService.save(auditedGroupDTO);
auditedGroupDTO.setAuditedGroupId(id);
if (id == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return EnterpriseServiceResponse.failure(ErrorCode.OPERATION_FAILED);
}
} else {
// update
Integer line = auditedGroupService.update(auditedGroupDTO);
if (line == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
id = auditedGroupDTO.getAuditedGroupId();
}
this.auditedGroupUserRelService.addOrUpdateRel(auditedGroupDTO);
// if (line != auditedGroupDTO.getUserIdList().size()) {
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// return EnterpriseServiceResponse.failure(ErrorCode.OPERATION_FAILED);
// }
return ServiceResponse.success(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ServiceResponse<Integer> delAuditedGroup(Integer auditedGroupId) {
Integer line = auditedGroupService.delAuditedGroup(auditedGroupId);
if (line == 0) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
// 删除受审组和管理员的关联关系
auditedGroupUserRelService.delRel(auditedGroupId);
// 删除受审组和审核员的关联关系
auditorAuditedGroupRelService.delRel(auditedGroupId);
return ServiceResponse.success(line);
}
@Override
public ServiceResponse<Page<AuditedGroupDTO>> listAuditedGroup(AuditedGroupQO auditedGroupQO) {
com.github.pagehelper.Page<TabAuditedGroup> page = auditedGroupService.listAuditedGroup(auditedGroupQO);
Page<AuditedGroupDTO> resultPage = PageHelperUtils.changePageHelperToCurrentPage(page, AuditedGroupDTO.class);
if (CollectionUtils.isNotEmpty(resultPage.getResult())) {
List<Integer> auditedGroupIds = resultPage.getResult().stream().map(AuditedGroupDTO::getAuditedGroupId).collect(Collectors.toList());
Map<Integer, Integer> map = auditedGroupUserRelService.getUserCountByAuditedGroup(auditedGroupIds);
for (AuditedGroupDTO dto : resultPage.getResult()) {
dto.setUserCount(map.get(dto.getAuditedGroupId()));
}
}
return ServiceResponse.success(resultPage);
}
@Override
public ServiceResponse<AuditedGroupDTO> getAuditedGroup(Integer auditedGroupId) {
TabAuditedGroup auditedGroup = auditedGroupService.getAuditedGroup(auditedGroupId);
if (auditedGroup == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
AuditedGroupDTO auditedGroupDTO = EntityUtil.changeEntityByJSON(AuditedGroupDTO.class, auditedGroup);
List<TabAuditedGroupUserRel> rels = auditedGroupUserRelService.listAuditedGroup(auditedGroupId);
if (CollectionUtils.isNotEmpty(rels)) {
List<Integer> userIds = rels.stream().map(TabAuditedGroupUserRel::getUserId).collect(Collectors.toList());
auditedGroupDTO.setUserIdList(userIds);
}
return ServiceResponse.success(auditedGroupDTO);
}
}
......@@ -24,4 +24,6 @@
<dubbo:service interface="com.gic.auth.service.UnionEnterpriseApiService" ref="unionEnterpriseApiService" timeout="6000" />
<!--角色-->
<dubbo:service interface="com.gic.auth.service.RoleApiService" ref="roleApiService" timeout="6000" />
<!--受审组-->
<dubbo:service interface="com.gic.auth.service.AuditedGroupApiService" ref="auditedGroupApiService" timeout="6000" />
</beans>
......@@ -3,13 +3,16 @@
<mapper namespace="com.gic.auth.dao.mapper.TabAuditedGroupMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabAuditedGroup">
<id column="audited_group_id" jdbcType="INTEGER" property="auditedGroupId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="audited_group_name" jdbcType="VARCHAR" property="auditedGroupName" />
<result column="all_check" jdbcType="INTEGER" property="allCheck" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
audited_group_id, audited_group_name, status, create_time, update_time
audited_group_id, enterprise_id, audited_group_name, all_check, status, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -22,22 +25,31 @@
where audited_group_id = #{auditedGroupId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabAuditedGroup">
insert into tab_audited_group (audited_group_id, audited_group_name,
status, create_time, update_time
)
values (#{auditedGroupId,jdbcType=INTEGER}, #{auditedGroupName,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
insert into tab_audited_group (audited_group_id, enterprise_id, audited_group_name,
all_check, status, create_time,
update_time)
values (#{auditedGroupId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{auditedGroupName,jdbcType=VARCHAR},
#{allCheck,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabAuditedGroup">
<selectKey keyProperty="auditedGroupId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into tab_audited_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="auditedGroupId != null">
audited_group_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="auditedGroupName != null">
audited_group_name,
</if>
<if test="allCheck != null">
all_check,
</if>
<if test="status != null">
status,
</if>
......@@ -52,9 +64,15 @@
<if test="auditedGroupId != null">
#{auditedGroupId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="auditedGroupName != null">
#{auditedGroupName,jdbcType=VARCHAR},
</if>
<if test="allCheck != null">
#{allCheck,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
......@@ -69,9 +87,15 @@
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabAuditedGroup">
update tab_audited_group
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="auditedGroupName != null">
audited_group_name = #{auditedGroupName,jdbcType=VARCHAR},
</if>
<if test="allCheck != null">
all_check = #{allCheck,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
......@@ -86,10 +110,45 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabAuditedGroup">
update tab_audited_group
set audited_group_name = #{auditedGroupName,jdbcType=VARCHAR},
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
audited_group_name = #{auditedGroupName,jdbcType=VARCHAR},
all_check = #{allCheck,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where audited_group_id = #{auditedGroupId,jdbcType=INTEGER}
</update>
<select id="getFirstAuditedGroup" resultType="java.lang.Integer">
select
1
from tab_audited_group
where status = 1
<if test="enterpriseId != null ">
and enterprise_id = #{enterpriseId}
</if>
<if test="auditedGroupName != null and auditedGroupName != '' ">
and audited_group_name = #{auditedGroupName}
</if>
<if test="auditedGroupId != null ">
and audited_group_id &lt;&gt; #{auditedGroupId}
</if>
</select>
<update id="delAuditedGroup">
update tab_audited_group
set status = 0
where audited_group_id = #{auditedGroupId}
</update>
<select id="listAuditedGroup" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_audited_group
<where>
<if test="enterpriseId != null ">
and enterprise_id = #{enterpriseId}
</if>
<if test="auditedGroupName != null and auditedGroupName != '' ">
and audited_group_name like concat('%', #{auditedGroupName}, '%')
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -3,6 +3,7 @@
<mapper namespace="com.gic.auth.dao.mapper.TabAuditedGroupUserRelMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabAuditedGroupUserRel">
<id column="audited_group_user_rel_id" jdbcType="INTEGER" property="auditedGroupUserRelId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="audited_group_id" jdbcType="INTEGER" property="auditedGroupId" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="status" jdbcType="INTEGER" property="status" />
......@@ -10,7 +11,8 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
audited_group_user_rel_id, audited_group_id, user_id, status, create_time, update_time
audited_group_user_rel_id, enterprise_id, audited_group_id, user_id, status, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -23,12 +25,12 @@
where audited_group_user_rel_id = #{auditedGroupUserRelId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabAuditedGroupUserRel">
insert into tab_audited_group_user_rel (audited_group_user_rel_id, audited_group_id,
user_id, status, create_time,
update_time)
values (#{auditedGroupUserRelId,jdbcType=INTEGER}, #{auditedGroupId,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
insert into tab_audited_group_user_rel (audited_group_user_rel_id, enterprise_id,
audited_group_id, user_id, status,
create_time, update_time)
values (#{auditedGroupUserRelId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER},
#{auditedGroupId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabAuditedGroupUserRel">
insert into tab_audited_group_user_rel
......@@ -36,6 +38,9 @@
<if test="auditedGroupUserRelId != null">
audited_group_user_rel_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="auditedGroupId != null">
audited_group_id,
</if>
......@@ -56,6 +61,9 @@
<if test="auditedGroupUserRelId != null">
#{auditedGroupUserRelId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="auditedGroupId != null">
#{auditedGroupId,jdbcType=INTEGER},
</if>
......@@ -76,6 +84,9 @@
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabAuditedGroupUserRel">
update tab_audited_group_user_rel
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="auditedGroupId != null">
audited_group_id = #{auditedGroupId,jdbcType=INTEGER},
</if>
......@@ -96,11 +107,73 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabAuditedGroupUserRel">
update tab_audited_group_user_rel
set audited_group_id = #{auditedGroupId,jdbcType=INTEGER},
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
audited_group_id = #{auditedGroupId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where audited_group_user_rel_id = #{auditedGroupUserRelId,jdbcType=INTEGER}
</update>
<update id="delByAuditedGroupId">
update tab_audited_group_user_rel set status = 0
where audited_group_id = #{auditedGroupId}
</update>
<insert id="insertSelectiveByNotExist">
INSERT INTO tab_audited_group_user_rel (
audited_group_id,
user_id,
status,
create_time,
enterprise_id
) SELECT
#{auditedGroupId},
#{userId},
#{status},
#{createTime},
#{enterpriseId}
FROM
DUAL
WHERE
NOT EXISTS (
SELECT
1
FROM
tab_audited_group_user_rel tb
WHERE
tb.enterprise_id = #{enterpriseId}
AND tb.audited_group_id = #{auditedGroupId}
AND tb.user_id = #{userId}
)
</insert>
<update id="updateStatusByUserIds">
update tab_audited_group_user_rel set status = 1
where enterprise_id = #{enterpriseId}
and audited_group_id = #{auditedGroupId}
and user_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="getUserCountByAuditedGroup" resultType="java.util.HashMap">
select
audited_group_id auditedGroupId, count(1) userCount
from
tab_audited_group_user_rel
where status = 1
<if test="null != ids">
and audited_group_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by audited_group_id
</select>
<select id="listAuditedGroup" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_audited_group_user_rel
where status = 1
and audited_group_id = #{auditedGroupId}
</select>
</mapper>
\ No newline at end of file
......@@ -3,6 +3,7 @@
<mapper namespace="com.gic.auth.dao.mapper.TabAuditorAuditedGroupRelMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabAuditorAuditedGroupRel">
<id column="auditor_audited_group_rel_id" jdbcType="INTEGER" property="auditorAuditedGroupRelId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="auditor_id" jdbcType="INTEGER" property="auditorId" />
<result column="audited_group_id" jdbcType="INTEGER" property="auditedGroupId" />
<result column="status" jdbcType="INTEGER" property="status" />
......@@ -10,8 +11,8 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
auditor_audited_group_rel_id, auditor_id, audited_group_id, status, create_time,
update_time
auditor_audited_group_rel_id, enterprise_id, auditor_id, audited_group_id, status,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -24,12 +25,12 @@
where auditor_audited_group_rel_id = #{auditorAuditedGroupRelId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabAuditorAuditedGroupRel">
insert into tab_auditor_audited_group_rel (auditor_audited_group_rel_id, auditor_id,
audited_group_id, status, create_time,
update_time)
values (#{auditorAuditedGroupRelId,jdbcType=INTEGER}, #{auditorId,jdbcType=INTEGER},
#{auditedGroupId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
insert into tab_auditor_audited_group_rel (auditor_audited_group_rel_id, enterprise_id,
auditor_id, audited_group_id, status,
create_time, update_time)
values (#{auditorAuditedGroupRelId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER},
#{auditorId,jdbcType=INTEGER}, #{auditedGroupId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabAuditorAuditedGroupRel">
insert into tab_auditor_audited_group_rel
......@@ -37,6 +38,9 @@
<if test="auditorAuditedGroupRelId != null">
auditor_audited_group_rel_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="auditorId != null">
auditor_id,
</if>
......@@ -57,6 +61,9 @@
<if test="auditorAuditedGroupRelId != null">
#{auditorAuditedGroupRelId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="auditorId != null">
#{auditorId,jdbcType=INTEGER},
</if>
......@@ -77,6 +84,9 @@
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabAuditorAuditedGroupRel">
update tab_auditor_audited_group_rel
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="auditorId != null">
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
......@@ -97,11 +107,18 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabAuditorAuditedGroupRel">
update tab_auditor_audited_group_rel
set auditor_id = #{auditorId,jdbcType=INTEGER},
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
auditor_id = #{auditorId,jdbcType=INTEGER},
audited_group_id = #{auditedGroupId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where auditor_audited_group_rel_id = #{auditorAuditedGroupRelId,jdbcType=INTEGER}
</update>
<update id="delRel">
update tab_auditor_audited_group_rel
set status = 0
where audited_group_id = #{auditedGroupId}
and status = 1
</update>
</mapper>
\ No newline at end of file
......@@ -3,6 +3,7 @@
<mapper namespace="com.gic.auth.dao.mapper.TabAuditorProjectRelMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabAuditorProjectRel">
<id column="auditor_project_rel_id" jdbcType="INTEGER" property="auditorProjectRelId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="auditor_id" jdbcType="INTEGER" property="auditorId" />
<result column="project_id" jdbcType="INTEGER" property="projectId" />
<result column="status" jdbcType="INTEGER" property="status" />
......@@ -10,7 +11,8 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
auditor_project_rel_id, auditor_id, project_id, status, create_time, update_time
auditor_project_rel_id, enterprise_id, auditor_id, project_id, status, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -23,12 +25,12 @@
where auditor_project_rel_id = #{auditorProjectRelId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabAuditorProjectRel">
insert into tab_auditor_project_rel (auditor_project_rel_id, auditor_id, project_id,
status, create_time, update_time
)
values (#{auditorProjectRelId,jdbcType=INTEGER}, #{auditorId,jdbcType=INTEGER}, #{projectId,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
insert into tab_auditor_project_rel (auditor_project_rel_id, enterprise_id,
auditor_id, project_id, status,
create_time, update_time)
values (#{auditorProjectRelId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER},
#{auditorId,jdbcType=INTEGER}, #{projectId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabAuditorProjectRel">
insert into tab_auditor_project_rel
......@@ -36,6 +38,9 @@
<if test="auditorProjectRelId != null">
auditor_project_rel_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="auditorId != null">
auditor_id,
</if>
......@@ -56,6 +61,9 @@
<if test="auditorProjectRelId != null">
#{auditorProjectRelId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="auditorId != null">
#{auditorId,jdbcType=INTEGER},
</if>
......@@ -76,6 +84,9 @@
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabAuditorProjectRel">
update tab_auditor_project_rel
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="auditorId != null">
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
......@@ -96,7 +107,8 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabAuditorProjectRel">
update tab_auditor_project_rel
set auditor_id = #{auditorId,jdbcType=INTEGER},
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
auditor_id = #{auditorId,jdbcType=INTEGER},
project_id = #{projectId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
......
......@@ -263,4 +263,21 @@
where user_id = #{userId}
and status = 1
</update>
<select id="getFirstNotInUserId" resultType="java.lang.Integer">
select
1
from tab_sys_user
where status = 1
<if test="enterpriseId != null ">
and enterprise_id = #{enterpriseId}
</if>
<if test="null != ids">
and user_id not in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
package com.gic.auth.web.controller;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.qo.AuditedGroupQO;
import com.gic.auth.service.AuditedGroupApiService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-18 18:04
*/
@RestController
public class AuditedGroupController {
@Autowired
private AuditedGroupApiService auditedGroupApiService;
@RequestMapping("/save-audited-group")
public RestResponse saveOrUpdateAuditedGroup(@Validated(AuditedGroupQO.SaveValid.class) AuditedGroupQO auditedGroupQO) {
AuditedGroupDTO auditedGroupDTO = EntityUtil.changeEntityByJSON(AuditedGroupDTO.class, auditedGroupQO);
auditedGroupDTO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
List<String> list = Arrays.asList(auditedGroupQO.getUserIds().split(GlobalInfo.FLAG_COMMA));
List<Integer> ids = list.stream().map(Integer::valueOf).collect(Collectors.toList());
auditedGroupDTO.setUserIdList(ids);
ServiceResponse<Integer> response = auditedGroupApiService.saveOrUpdateAuditedGroup(auditedGroupDTO);
return ResultControllerUtils.commonResult(response);
}
@RequestMapping("/del-audited-group")
public RestResponse delAuditedGroup(@Validated(AuditedGroupQO.DelValid.class) AuditedGroupQO auditedGroupQO) {
ServiceResponse<Integer> response = auditedGroupApiService.delAuditedGroup(auditedGroupQO.getAuditedGroupId());
return ResultControllerUtils.commonResult(response);
}
@RequestMapping("/get-audited-group")
public RestResponse getAuditGroup(@Validated(AuditedGroupQO.DelValid.class) AuditedGroupQO auditedGroupQO) {
ServiceResponse<AuditedGroupDTO> response = auditedGroupApiService.getAuditedGroup(auditedGroupQO.getAuditedGroupId());
return ResultControllerUtils.commonResult(response);
}
@RequestMapping("/list-audited-group")
public RestResponse listAuditedGroup(AuditedGroupQO auditedGroupQO) {
auditedGroupQO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
ServiceResponse<Page<AuditedGroupDTO>> response = auditedGroupApiService.listAuditedGroup(auditedGroupQO);
return ResultControllerUtils.commonResult(response);
}
}
......@@ -46,4 +46,7 @@
<!--角色-->
<dubbo:reference interface="com.gic.auth.service.RoleApiService" id="roleApiService" timeout="6000" />
<!--受审组-->
<dubbo:reference interface="com.gic.auth.service.AuditedGroupApiService" id="auditedGroupApiService" timeout="6000" />
</beans>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment