Commit 55226ead by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-auth into developer

# Conflicts:
#	gic-platform-auth-web/src/main/resources/dubbo-gic-platform-auth-web.xml
parents 2750e957 308f5731
package com.gic.auth.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-20 16:07
*/
public class AuditedGroupUserRelDTO implements Serializable {
/**
*
*/
private Integer auditedGroupUserRelId;
/**
*
*/
private Integer enterpriseId;
/**
* 受审组id
*/
private Integer auditedGroupId;
/**
* 管理员id
*/
private Integer userId;
/**
*
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
private List<Integer> auditedGroupIdList;
public Integer getAuditedGroupUserRelId() {
return auditedGroupUserRelId;
}
public void setAuditedGroupUserRelId(Integer auditedGroupUserRelId) {
this.auditedGroupUserRelId = auditedGroupUserRelId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getAuditedGroupId() {
return auditedGroupId;
}
public void setAuditedGroupId(Integer auditedGroupId) {
this.auditedGroupId = auditedGroupId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setAuditedGroupIdList(List<Integer> auditedGroupIdList) {
this.auditedGroupIdList = auditedGroupIdList;
}
public List<Integer> getAuditedGroupIdList() {
return auditedGroupIdList;
}
}
package com.gic.auth.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-20 11:00
*/
public class AuditorAuditedGroupRelDTO implements Serializable {
private static final long serialVersionUID = -3336969578120506485L;
/**
*
*/
private Integer auditorAuditedGroupRelId;
/**
*
*/
private Integer enterpriseId;
/**
* 审核员id
*/
private Integer auditorId;
/**
* 受审组id
*/
private Integer auditedGroupId;
/**
*
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
private List<Integer> auditorIdList;
public Integer getAuditorAuditedGroupRelId() {
return auditorAuditedGroupRelId;
}
public void setAuditorAuditedGroupRelId(Integer auditorAuditedGroupRelId) {
this.auditorAuditedGroupRelId = auditorAuditedGroupRelId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getAuditorId() {
return auditorId;
}
public void setAuditorId(Integer auditorId) {
this.auditorId = auditorId;
}
public Integer getAuditedGroupId() {
return auditedGroupId;
}
public void setAuditedGroupId(Integer auditedGroupId) {
this.auditedGroupId = auditedGroupId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setAuditorIdList(List<Integer> auditorIdList) {
this.auditorIdList = auditorIdList;
}
public List<Integer> getAuditorIdList() {
return auditorIdList;
}
}
package com.gic.auth.dto;
import java.io.Serializable;
import java.util.List;
/**
*
......@@ -32,6 +33,11 @@ public class AuditorDTO implements Serializable {
private String phone;
/**
* 关联管理员id
*/
private Integer userId;
/**
* 微信openid
*/
private String openid;
......@@ -41,6 +47,20 @@ public class AuditorDTO implements Serializable {
*/
private Integer isUse;
/**
* 受审项目审批项id
*/
private List<Integer> projectItemList;
/**
* 受审组id
*/
private List<Integer> auditedGroupIdList;
private Integer projectItemCount;
private Integer auditedGroupCount;
public Integer getAuditorId() {
return auditorId;
}
......@@ -73,6 +93,14 @@ public class AuditorDTO implements Serializable {
this.phone = phone;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getOpenid() {
return openid;
}
......@@ -88,4 +116,36 @@ public class AuditorDTO implements Serializable {
public void setIsUse(Integer isUse) {
this.isUse = isUse;
}
public List<Integer> getProjectItemList() {
return projectItemList;
}
public void setProjectItemList(List<Integer> projectItemList) {
this.projectItemList = projectItemList;
}
public List<Integer> getAuditedGroupIdList() {
return auditedGroupIdList;
}
public void setAuditedGroupIdList(List<Integer> auditedGroupIdList) {
this.auditedGroupIdList = auditedGroupIdList;
}
public Integer getProjectItemCount() {
return projectItemCount;
}
public void setProjectItemCount(Integer projectItemCount) {
this.projectItemCount = projectItemCount;
}
public Integer getAuditedGroupCount() {
return auditedGroupCount;
}
public void setAuditedGroupCount(Integer auditedGroupCount) {
this.auditedGroupCount = auditedGroupCount;
}
}
package com.gic.auth.qo;
import com.gic.enterprise.qo.PageQO;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-19 14:18
*/
public class AuditorListQO extends PageQO {
private Integer enterpriseId;
private String auditorName;
private Integer auditedGroupId;
private Integer isUse;
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getAuditorName() {
return auditorName;
}
public void setAuditorName(String auditorName) {
this.auditorName = auditorName;
}
public Integer getAuditedGroupId() {
return auditedGroupId;
}
public void setAuditedGroupId(Integer auditedGroupId) {
this.auditedGroupId = auditedGroupId;
}
public Integer getIsUse() {
return isUse;
}
public void setIsUse(Integer isUse) {
this.isUse = isUse;
}
}
package com.gic.auth.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.AuditorDTO;
import com.gic.auth.qo.AuditorListQO;
import java.util.List;
/**
* 审核员
......@@ -23,5 +27,59 @@ public interface AuditorApiService {
*/
ServiceResponse<String> saveOrUpdateAuditor(AuditorDTO auditorDTO);
/**
* 删除审核员
* @Title: delAuditor
* @Description:
* @author zhiwj
* @param auditorId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Void> delAuditor(Integer auditorId);
/**
*
* @Title: getAuditor
* @Description:
* @author zhiwj
* @param auditorId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<AuditorDTO> getAuditor(Integer auditorId);
/**
*
* @Title: pageAuditor
* @Description:
* @author zhiwj
* @param auditorListQO
* @return com.gic.api.base.commons.ServiceResponse<com.gic.api.base.commons.Page<com.gic.auth.dto.AuditorDTO>>
* @throws
*/
ServiceResponse<Page<AuditorDTO>> pageAuditor(AuditorListQO auditorListQO);
/**
* 接收扫描二维码之后的回调
* @Title: receiveOpenid
* @Description:
* @author zhiwj
* @param qrCodeParam
* @param openid
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> receiveOpenid(String qrCodeParam, String openid);
/**
* 不分頁列表
* @Title: listAuditor
* @Description:
* @author zhiwj
* @param auditorListQO
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.AuditorDTO>>
* @throws
*/
ServiceResponse<List<AuditorDTO>> listAuditor(AuditorListQO auditorListQO);
}
......@@ -6,6 +6,8 @@ import com.gic.auth.qo.AuditedGroupQO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabAuditedGroupMapper {
/**
* 根据主键删除
......@@ -60,4 +62,6 @@ public interface TabAuditedGroupMapper {
Integer delAuditedGroup(@Param("auditedGroupId") Integer auditedGroupId);
Page<TabAuditedGroup> listAuditedGroup(AuditedGroupQO auditedGroupQO);
int countByAuditedGroupIds(@Param("ids") List<Integer> auditedGroupIdList);
}
\ No newline at end of file
package com.gic.auth.dao.mapper;
import com.gic.auth.dto.AuditedGroupUserRelDTO;
import com.gic.auth.entity.TabAuditedGroupUserRel;
import org.apache.ibatis.annotations.Param;
......@@ -63,5 +64,5 @@ public interface TabAuditedGroupUserRelMapper {
List<Map<Integer,Object>> getUserCountByAuditedGroup(@Param("ids") List<Integer> auditedGroupIds);
List<TabAuditedGroupUserRel> listAuditedGroup(TabAuditedGroupUserRel groupUserRel);
List<TabAuditedGroupUserRel> listAuditedGroup(AuditedGroupUserRelDTO groupUserRel);
}
\ No newline at end of file
package com.gic.auth.dao.mapper;
import com.gic.auth.dto.AuditorAuditedGroupRelDTO;
import com.gic.auth.entity.TabAuditorAuditedGroupRel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface TabAuditorAuditedGroupRelMapper {
/**
* 根据主键删除
......@@ -53,4 +57,14 @@ public interface TabAuditorAuditedGroupRelMapper {
int updateByPrimaryKey(TabAuditorAuditedGroupRel record);
int delRel(@Param("auditedGroupId") Integer auditedGroupId);
void delByAuditorId(@Param("auditorId") Integer auditorId);
void insertSelectiveByNotExist(TabAuditorAuditedGroupRel itemRel);
void updateStatusByAuditedGroupIds(@Param("enterpriseId") Integer enterpriseId, @Param("auditorId") Integer auditorId, @Param("ids") List<Integer> auditedGroupIdList);
List<TabAuditorAuditedGroupRel> listRel(AuditorAuditedGroupRelDTO auditorAuditedGroupRel);
List<Map<String,Object>> getCountByAuditorIds(@Param("ids") List<Integer> auditorIdList);
}
\ No newline at end of file
package com.gic.auth.dao.mapper;
import com.gic.auth.dto.AuditorDTO;
import com.gic.auth.entity.TabAuditor;
import com.gic.auth.qo.AuditorListQO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
public interface TabAuditorMapper {
/**
......@@ -50,4 +54,10 @@ public interface TabAuditorMapper {
* @return 更新条目数
*/
int updateByPrimaryKey(TabAuditor record);
TabAuditor getFirstAuditor(AuditorDTO auditorDTO);
Integer delAuditor(@Param("auditorId") Integer auditorId);
Page<TabAuditor> listAuditor(AuditorListQO auditorListQO);
}
\ No newline at end of file
package com.gic.auth.dao.mapper;
import com.gic.auth.entity.TabAuditorProjectRel;
import com.gic.auth.entity.TabAuditorProjectItemRel;
import org.apache.ibatis.annotations.Param;
public interface TabAuditorProjectRelMapper {
import java.util.List;
import java.util.Map;
public interface TabAuditorProjectItemRelMapper {
/**
* 根据主键删除
*
* @param auditorProjectRelId 主键
* @param auditorProjectItemRelId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer auditorProjectRelId);
int deleteByPrimaryKey(Integer auditorProjectItemRelId);
/**
* 插入一条记录
......@@ -17,7 +21,7 @@ public interface TabAuditorProjectRelMapper {
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabAuditorProjectRel record);
int insert(TabAuditorProjectItemRel record);
/**
* 动态插入一条记录
......@@ -25,15 +29,15 @@ public interface TabAuditorProjectRelMapper {
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabAuditorProjectRel record);
int insertSelective(TabAuditorProjectItemRel record);
/**
* 根据主键查询
*
* @param auditorProjectRelId 主键
* @param auditorProjectItemRelId 主键
* @return 实体对象
*/
TabAuditorProjectRel selectByPrimaryKey(Integer auditorProjectRelId);
TabAuditorProjectItemRel selectByPrimaryKey(Integer auditorProjectItemRelId);
/**
* 根据主键动态更新记录
......@@ -41,7 +45,7 @@ public interface TabAuditorProjectRelMapper {
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabAuditorProjectRel record);
int updateByPrimaryKeySelective(TabAuditorProjectItemRel record);
/**
* 根据主键更新记录
......@@ -49,5 +53,15 @@ public interface TabAuditorProjectRelMapper {
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabAuditorProjectRel record);
int updateByPrimaryKey(TabAuditorProjectItemRel record);
int delByAuditorId(@Param("auditorId") Integer auditorId);
int insertSelectiveByNotExist(TabAuditorProjectItemRel itemRel);
int updateStatusByProjectItemIds(@Param("enterpriseId") Integer enterpriseId, @Param("auditorId") Integer auditorId, @Param("ids") List<Integer> projectItemList);
List<TabAuditorProjectItemRel> listRelByAuditorId(TabAuditorProjectItemRel auditorProjectItemRel);
List<Map<String,Object>> getCountByAuditorIds(@Param("ids") List<Integer> auditorIdList);
}
\ No newline at end of file
......@@ -94,4 +94,6 @@ public interface TabSysUserMapper {
int deleteById(@Param("userId") Integer userId);
Integer getFirstNotInUserId(@Param("enterpriseId") Integer enterpriseId, @Param("ids") List<Integer> userIdList);
Integer countUserByUserIds(@Param("ids") List<Integer> userIdList);
}
\ No newline at end of file
......@@ -27,6 +27,11 @@ public class TabAuditor {
private String phone;
/**
* 关联管理员id
*/
private Integer userId;
/**
* 微信openid
*/
private String openid;
......@@ -83,6 +88,14 @@ public class TabAuditor {
this.phone = phone;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getOpenid() {
return openid;
}
......
......@@ -3,13 +3,13 @@ package com.gic.auth.entity;
import java.util.Date;
/**
* tab_auditor_project_rel
* tab_auditor_project_item_rel
*/
public class TabAuditorProjectRel {
public class TabAuditorProjectItemRel {
/**
*
*/
private Integer auditorProjectRelId;
private Integer auditorProjectItemRelId;
/**
*
......@@ -22,9 +22,9 @@ public class TabAuditorProjectRel {
private Integer auditorId;
/**
* 项目
* 审批项
*/
private Integer projectId;
private Integer projectItemId;
/**
*
......@@ -41,12 +41,12 @@ public class TabAuditorProjectRel {
*/
private Date updateTime;
public Integer getAuditorProjectRelId() {
return auditorProjectRelId;
public Integer getAuditorProjectItemRelId() {
return auditorProjectItemRelId;
}
public void setAuditorProjectRelId(Integer auditorProjectRelId) {
this.auditorProjectRelId = auditorProjectRelId;
public void setAuditorProjectItemRelId(Integer auditorProjectItemRelId) {
this.auditorProjectItemRelId = auditorProjectItemRelId;
}
public Integer getEnterpriseId() {
......@@ -65,12 +65,12 @@ public class TabAuditorProjectRel {
this.auditorId = auditorId;
}
public Integer getProjectId() {
return projectId;
public Integer getProjectItemId() {
return projectItemId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
public void setProjectItemId(Integer projectItemId) {
this.projectItemId = projectItemId;
}
public Integer getStatus() {
......
......@@ -5,6 +5,8 @@ import com.gic.auth.entity.TabAuditedGroup;
import com.gic.auth.qo.AuditedGroupQO;
import com.github.pagehelper.Page;
import java.util.List;
/**
*
* @Description:
......@@ -24,4 +26,6 @@ public interface AuditedGroupService {
Page<TabAuditedGroup> listAuditedGroup(AuditedGroupQO auditedGroupQO);
TabAuditedGroup getAuditedGroup(Integer auditedGroupId);
boolean validAuditedGroupIsNotExist(List<Integer> auditedGroupIdList);
}
......@@ -20,4 +20,6 @@ public interface AuditedGroupUserRelService {
Map<Integer,Integer> getUserCountByAuditedGroup(List<Integer> auditedGroupIds);
List<TabAuditedGroupUserRel> listAuditedGroup(Integer auditedGroupId);
List<TabAuditedGroupUserRel> getUserIdListByAuditedGroup(List<Integer> auditedGroupIds);
}
package com.gic.auth.service;
import com.gic.auth.entity.TabAuditorAuditedGroupRel;
import java.util.List;
import java.util.Map;
/**
*
* @Description:
......@@ -9,4 +14,12 @@ package com.gic.auth.service;
public interface AuditorAuditedGroupRelService {
int delRel(Integer auditedGroupId);
void addOrUpdateRel(Integer enterpriseId, Integer auditorId, List<Integer> auditedGroupIdList);
void delRelByAuditorId(Integer auditorId);
List<TabAuditorAuditedGroupRel> listRelByAuditorId(Integer auditorId);
Map<Integer,Integer> getUserCountByAuditorIds(List<Integer> auditorIdList);
}
package com.gic.auth.service;
import com.gic.auth.entity.TabAuditorProjectItemRel;
import java.util.List;
import java.util.Map;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-19 16:56
*/
public interface AuditorProjectItemRelService {
void addOrUpdateRel(Integer enterpriseId, Integer auditorId, List<Integer> projectItemList);
void delRelByAuditorId(Integer auditorId);
List<TabAuditorProjectItemRel> listRelByAuditorId(Integer auditorId);
Map<Integer,Integer> getCountByAuditorIds(List<Integer> auditorIdList);
}
package com.gic.auth.service;
import com.gic.auth.dto.AuditorDTO;
import com.gic.auth.entity.TabAuditor;
import com.gic.auth.qo.AuditorListQO;
import com.github.pagehelper.Page;
import java.util.List;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-19 16:40
*/
public interface AuditorService {
boolean validAuditorNameIsRepeat(Integer enterpriseId, String auditorName, Integer auditorId);
boolean validPhoneIsRepeat(Integer enterpriseId, String phone, Integer auditorId);
boolean validOpenidIsRepeat(Integer enterpriseId, String openid, Integer auditorId);
Integer save(AuditorDTO auditorDTO);
Integer update(AuditorDTO auditorDTO);
TabAuditor getAuditor(Integer auditorId);
Integer delAuditor(Integer auditorId);
Page<TabAuditor> pageAuditor(AuditorListQO auditorListQO);
List<TabAuditor> listAuditor(AuditorListQO auditorListQO);
}
......@@ -77,4 +77,6 @@ public interface UserService {
void delete(Integer userId);
Integer getAllCheckValue(Integer enterpriseId, List<Integer> userIdList);
boolean validUserIsNotExist(List<Integer> userIdList);
}
......@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
*
......@@ -70,4 +71,10 @@ public class AuditedGroupServiceImpl implements AuditedGroupService {
TabAuditedGroup tabAuditedGroup = tabAuditedGroupMapper.selectByPrimaryKey(auditedGroupId);
return tabAuditedGroup != null && (GlobalInfo.DATA_STATUS_NORMAL == tabAuditedGroup.getStatus()) ? tabAuditedGroup : null;
}
@Override
public boolean validAuditedGroupIsNotExist(List<Integer> auditedGroupIdList) {
int count = tabAuditedGroupMapper.countByAuditedGroupIds(auditedGroupIdList);
return count != auditedGroupIdList.size();
}
}
......@@ -2,6 +2,7 @@ package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabAuditedGroupUserRelMapper;
import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.dto.AuditedGroupUserRelDTO;
import com.gic.auth.entity.TabAuditedGroupUserRel;
import com.gic.auth.service.AuditedGroupUserRelService;
import com.gic.commons.util.GlobalInfo;
......@@ -60,8 +61,15 @@ public class AuditedGroupUserRelServiceImpl implements AuditedGroupUserRelServic
@Override
public List<TabAuditedGroupUserRel> listAuditedGroup(Integer auditedGroupId) {
TabAuditedGroupUserRel groupUserRel = new TabAuditedGroupUserRel();
AuditedGroupUserRelDTO groupUserRel = new AuditedGroupUserRelDTO();
groupUserRel.setAuditedGroupId(auditedGroupId);
return this.tabAuditedGroupUserRelMapper.listAuditedGroup(groupUserRel);
}
@Override
public List<TabAuditedGroupUserRel> getUserIdListByAuditedGroup(List<Integer> auditedGroupIds) {
AuditedGroupUserRelDTO groupUserRel = new AuditedGroupUserRelDTO();
groupUserRel.setAuditedGroupIdList(auditedGroupIds);
return this.tabAuditedGroupUserRelMapper.listAuditedGroup(groupUserRel);
}
}
package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabAuditorAuditedGroupRelMapper;
import com.gic.auth.dto.AuditorAuditedGroupRelDTO;
import com.gic.auth.entity.TabAuditedGroupUserRel;
import com.gic.auth.entity.TabAuditorAuditedGroupRel;
import com.gic.auth.service.AuditedGroupUserRelService;
import com.gic.auth.service.AuditorAuditedGroupRelService;
import com.gic.commons.util.GlobalInfo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
*
* @Description:
......@@ -16,9 +25,82 @@ public class AuditorAuditedGroupRelServiceImpl implements AuditorAuditedGroupRel
@Autowired
private TabAuditorAuditedGroupRelMapper tabAuditorAuditedGroupRelMapper;
@Autowired
private AuditedGroupUserRelService auditedGroupUserRelService;
@Override
public int delRel(Integer auditedGroupId) {
return tabAuditorAuditedGroupRelMapper.delRel(auditedGroupId);
}
@Override
public void addOrUpdateRel(Integer enterpriseId, Integer auditorId, List<Integer> auditedGroupIdList) {
// 把所有auditorId的关联status设置为0
tabAuditorAuditedGroupRelMapper.delByAuditorId(auditorId);
// 插入不存在的关联
for (Integer auditedGroupId : auditedGroupIdList) {
TabAuditorAuditedGroupRel itemRel = new TabAuditorAuditedGroupRel();
itemRel.setEnterpriseId(enterpriseId);
itemRel.setAuditorId(auditorId);
itemRel.setAuditedGroupId(auditedGroupId);
itemRel.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
itemRel.setCreateTime(new Date());
tabAuditorAuditedGroupRelMapper.insertSelectiveByNotExist(itemRel);
}
// 把所有auditedGroup关联status都设置为1
tabAuditorAuditedGroupRelMapper.updateStatusByAuditedGroupIds(enterpriseId, auditorId, auditedGroupIdList);
}
@Override
public void delRelByAuditorId(Integer auditorId) {
tabAuditorAuditedGroupRelMapper.delByAuditorId(auditorId);
}
@Override
public List<TabAuditorAuditedGroupRel> listRelByAuditorId(Integer auditorId) {
AuditorAuditedGroupRelDTO auditorAuditedGroupRel = new AuditorAuditedGroupRelDTO();
auditorAuditedGroupRel.setAuditorId(auditorId);
return tabAuditorAuditedGroupRelMapper.listRel(auditorAuditedGroupRel);
}
@Override
public Map<Integer, Integer> getUserCountByAuditorIds(List<Integer> auditorIdList) {
// getAuditedGroupBelongAuditor
AuditorAuditedGroupRelDTO auditorAuditedGroupRelDTO = new AuditorAuditedGroupRelDTO();
auditorAuditedGroupRelDTO.setAuditorIdList(auditorIdList);
List<TabAuditorAuditedGroupRel> relList = tabAuditorAuditedGroupRelMapper.listRel(auditorAuditedGroupRelDTO);
if (CollectionUtils.isEmpty(relList)) {
return Collections.emptyMap();
}
// 根据受审组查询受审组对应的用户
List<Integer> auditedGroupIds = relList.stream().map(TabAuditorAuditedGroupRel::getAuditedGroupId).collect(Collectors.toList());
List<TabAuditedGroupUserRel> userList = auditedGroupUserRelService.getUserIdListByAuditedGroup(auditedGroupIds);
if (CollectionUtils.isEmpty(userList)) {
return Collections.emptyMap();
}
// 获取 受审组 -> 审核员 的map
Map<Integer, Integer> groupAuditorMap = getAuditedGroupBelongAuditor(relList);
Map<Integer, Set<Integer>> tmpMap = new HashMap<>();
for (TabAuditedGroupUserRel userRel : userList) {
Integer auditedGroupId = userRel.getAuditedGroupId();
Integer auditorId = groupAuditorMap.get(auditedGroupId);
Set<Integer> set = tmpMap.computeIfAbsent(auditorId, k -> new HashSet<>());
set.add(userRel.getUserId());
}
Map<Integer, Integer> resultMap = new HashMap<>();
for (Map.Entry<Integer, Set<Integer>> entry : tmpMap.entrySet()) {
Set<Integer> set = entry.getValue();
resultMap.put(entry.getKey(), set == null ? 0 : set.size());
}
return resultMap;
}
private Map<Integer, Integer> getAuditedGroupBelongAuditor(List<TabAuditorAuditedGroupRel> relList) {
Map<Integer, Integer> groupAuditorMap = new HashMap<>();
for (TabAuditorAuditedGroupRel tabAuditorAuditedGroupRel : relList) {
groupAuditorMap.put(tabAuditorAuditedGroupRel.getAuditedGroupId(), tabAuditorAuditedGroupRel.getAuditorId());
}
return groupAuditorMap;
}
}
package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabAuditorProjectItemRelMapper;
import com.gic.auth.entity.TabAuditorProjectItemRel;
import com.gic.auth.service.AuditorProjectItemRelService;
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-19 16:56
*/
@Service
public class AuditorProjectItemRelServiceImpl implements AuditorProjectItemRelService {
@Autowired
private TabAuditorProjectItemRelMapper tabAuditorProjectItemRelMapper;
@Override
public void addOrUpdateRel(Integer enterpriseId, Integer auditorId, List<Integer> projectItemList) {
// 把所有auditorId的关联status设置为0
tabAuditorProjectItemRelMapper.delByAuditorId(auditorId);
// 插入不存在的关联
for (Integer projectItemId : projectItemList) {
TabAuditorProjectItemRel itemRel = new TabAuditorProjectItemRel();
itemRel.setEnterpriseId(enterpriseId);
itemRel.setAuditorId(auditorId);
itemRel.setProjectItemId(projectItemId);
itemRel.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
itemRel.setCreateTime(new Date());
tabAuditorProjectItemRelMapper.insertSelectiveByNotExist(itemRel);
}
// 把所有projectItemId关联status都设置为1
tabAuditorProjectItemRelMapper.updateStatusByProjectItemIds(enterpriseId, auditorId, projectItemList);
}
@Override
public void delRelByAuditorId(Integer auditorId) {
tabAuditorProjectItemRelMapper.delByAuditorId(auditorId);
}
@Override
public List<TabAuditorProjectItemRel> listRelByAuditorId(Integer auditorId) {
TabAuditorProjectItemRel auditorProjectItemRel = new TabAuditorProjectItemRel();
auditorProjectItemRel.setAuditorId(auditorId);
return tabAuditorProjectItemRelMapper.listRelByAuditorId(auditorProjectItemRel);
}
@Override
public Map<Integer, Integer> getCountByAuditorIds(List<Integer> auditorIdList) {
List<Map<String, Object>> mapList = tabAuditorProjectItemRelMapper.getCountByAuditorIds(auditorIdList);
HashMap<Integer, Integer> resultMap = new HashMap<>();
for (Map<String, Object> map : mapList) {
resultMap.put(Integer.valueOf(map.get("auditorId").toString()), Integer.valueOf(map.get("projectItemCount").toString()));
}
return resultMap;
}
}
package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabAuditorMapper;
import com.gic.auth.dto.AuditorDTO;
import com.gic.auth.entity.TabAuditor;
import com.gic.auth.qo.AuditorListQO;
import com.gic.auth.service.AuditorService;
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;
import java.util.List;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-19 16:40
*/
@Service
public class AuditorServiceImpl implements AuditorService {
@Autowired
private TabAuditorMapper tabAuditorMapper;
@Override
public boolean validAuditorNameIsRepeat(Integer enterpriseId, String auditorName, Integer auditorId) {
AuditorDTO auditorDTO = new AuditorDTO();
auditorDTO.setAuditorId(auditorId);
auditorDTO.setEnterpriseId(enterpriseId);
auditorDTO.setAuditorName(auditorName);
TabAuditor auditor = tabAuditorMapper.getFirstAuditor(auditorDTO);
return auditor != null;
}
@Override
public boolean validPhoneIsRepeat(Integer enterpriseId, String phone, Integer auditorId) {
AuditorDTO auditorDTO = new AuditorDTO();
auditorDTO.setAuditorId(auditorId);
auditorDTO.setEnterpriseId(enterpriseId);
auditorDTO.setPhone(phone);
TabAuditor auditor = tabAuditorMapper.getFirstAuditor(auditorDTO);
return auditor != null;
}
@Override
public boolean validOpenidIsRepeat(Integer enterpriseId, String openid, Integer auditorId) {
AuditorDTO auditorDTO = new AuditorDTO();
auditorDTO.setAuditorId(auditorId);
auditorDTO.setEnterpriseId(enterpriseId);
auditorDTO.setOpenid(openid);
TabAuditor auditor = tabAuditorMapper.getFirstAuditor(auditorDTO);
return auditor != null;
}
@Override
public Integer save(AuditorDTO copy) {
TabAuditor auditor = new TabAuditor();
auditor.setEnterpriseId(copy.getEnterpriseId());
auditor.setAuditorName(copy.getAuditorName());
auditor.setPhone(copy.getPhone());
auditor.setUserId(copy.getUserId());
auditor.setIsUse(copy.getIsUse());
auditor.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
auditor.setCreateTime(new Date());
tabAuditorMapper.insertSelective(auditor);
return auditor.getAuditorId();
}
@Override
public Integer update(AuditorDTO copy) {
TabAuditor auditor = new TabAuditor();
auditor.setAuditorId(copy.getAuditorId());
auditor.setEnterpriseId(copy.getEnterpriseId());
auditor.setAuditorName(copy.getAuditorName());
auditor.setOpenid(copy.getOpenid());
auditor.setPhone(copy.getPhone());
auditor.setUserId(copy.getUserId());
auditor.setIsUse(copy.getIsUse());
return tabAuditorMapper.updateByPrimaryKeySelective(auditor);
}
@Override
public TabAuditor getAuditor(Integer auditorId) {
TabAuditor auditor = tabAuditorMapper.selectByPrimaryKey(auditorId);
if (auditor != null && auditor.getStatus() == GlobalInfo.DATA_STATUS_NORMAL) {
return auditor;
}
return null;
}
@Override
public Integer delAuditor(Integer auditorId) {
return tabAuditorMapper.delAuditor(auditorId);
}
@Override
public Page<TabAuditor> pageAuditor(AuditorListQO auditorListQO) {
PageHelper.startPage(auditorListQO.getCurrentPage(), auditorListQO.getPageSize());
return tabAuditorMapper.listAuditor(auditorListQO);
}
@Override
public List<TabAuditor> listAuditor(AuditorListQO auditorListQO) {
return tabAuditorMapper.listAuditor(auditorListQO);
}
}
......@@ -91,4 +91,10 @@ public class UserServiceImpl implements UserService {
Integer line = tabSysUserMapper.getFirstNotInUserId(enterpriseId, userIdList);
return line == null ? GlobalInfo.DATA_STATUS_NORMAL : GlobalInfo.DATA_STATUS_DELETE;
}
@Override
public boolean validUserIsNotExist(List<Integer> userIdList) {
Integer count = tabSysUserMapper.countUserByUserIds(userIdList);
return count != userIdList.size();
}
}
......@@ -17,7 +17,6 @@ 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;
......@@ -52,6 +51,11 @@ public class AuditedGroupApiServiceImpl implements AuditedGroupApiService {
if (repeat) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "受审组名称重复");
}
// 验证suerId是否合法
boolean notExist = userService.validUserIsNotExist(auditedGroupDTO.getUserIdList());
if (notExist) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR);
}
// 判断该受审组是否是全选的
Integer allCheck = userService.getAllCheckValue(auditedGroupDTO.getEnterpriseId(), auditedGroupDTO.getUserIdList());
auditedGroupDTO.setAllCheck(allCheck);
......@@ -61,23 +65,17 @@ public class AuditedGroupApiServiceImpl implements AuditedGroupApiService {
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);
}
......
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.AuditorDTO;
import com.gic.auth.entity.TabAuditor;
import com.gic.auth.entity.TabAuditorAuditedGroupRel;
import com.gic.auth.entity.TabAuditorProjectItemRel;
import com.gic.auth.qo.AuditorListQO;
import com.gic.auth.service.*;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.dto.ProjectItemDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.qo.ProjectItemQO;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.enterprise.service.ProjectItemApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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 java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-19 14:26
*/
@Service("auditorApiService")
public class AuditorApiServiceImpl implements AuditorApiService {
private Logger logger = LogManager.getLogger(AuditorApiServiceImpl.class);
@Autowired
private AuditorService auditorService;
@Autowired
private AuditorProjectItemRelService auditorProjectItemRelService;
@Autowired
private AuditorAuditedGroupRelService auditorAuditedGroupRelService;
@Autowired
private ProjectItemApiService projectItemApiService;
@Autowired
private AuditedGroupService auditedGroupService;
@Override
@Transactional(rollbackFor = Exception.class)
public ServiceResponse<String> saveOrUpdateAuditor(AuditorDTO auditorDTO) {
boolean nameIsRepeat = auditorService.validAuditorNameIsRepeat(auditorDTO.getEnterpriseId(), auditorDTO.getAuditorName(), auditorDTO.getAuditorId());
if (nameIsRepeat) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "审核员姓名重复");
}
boolean phoneIsRepeat = auditorService.validPhoneIsRepeat(auditorDTO.getEnterpriseId(), auditorDTO.getPhone(), auditorDTO.getAuditorId());
if (phoneIsRepeat) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "审核员手机号重复");
}
boolean projectItemIsNotExist = validProjectItemIsNotExist(auditorDTO.getProjectItemList());
if (projectItemIsNotExist) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR);
}
boolean auditedGroupIsNotExist = auditedGroupService.validAuditedGroupIsNotExist(auditorDTO.getAuditedGroupIdList());
if (auditedGroupIsNotExist) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR);
}
auditorDTO.setIsUse(auditorDTO.getUserId() == null? 0 : 1);
// 这里进来的 不会去修改openid,所以把openid设为null
auditorDTO.setOpenid(null);
// 保存审核员信息
if (auditorDTO.getAuditorId() == null) {
// save
Integer auditorId = auditorService.save(auditorDTO);
auditorDTO.setAuditorId(auditorId);
} else {
// update
Integer line = auditorService.update(auditorDTO);
if (line == 0) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
}
// 受审项目
auditorProjectItemRelService.addOrUpdateRel(auditorDTO.getEnterpriseId(), auditorDTO.getAuditorId(), auditorDTO.getProjectItemList());
// 受审组
auditorAuditedGroupRelService.addOrUpdateRel(auditorDTO.getEnterpriseId(), auditorDTO.getAuditorId(), auditorDTO.getAuditedGroupIdList());
// 查询二维码
TabAuditor auditor = auditorService.getAuditor(auditorDTO.getAuditorId());
String tempQrCodeUrl = null;
if (StringUtils.isNotBlank(auditor.getOpenid())) {
tempQrCodeUrl = this.getTempQrCodeUrl(auditorDTO.getAuditorId());
}
return ServiceResponse.success(tempQrCodeUrl);
}
private boolean validProjectItemIsNotExist(List<Integer> projectItemList) {
ProjectItemQO qo = new ProjectItemQO();
qo.setProjectItemList(projectItemList);
ServiceResponse<Page<ProjectItemDTO>> serviceResponse = projectItemApiService.listProjectItem(qo);
return !serviceResponse.isSuccess() || serviceResponse.getResult().getTotalCount() != projectItemList.size();
}
@Override
@Transactional(rollbackFor = Exception.class)
public ServiceResponse<Void> delAuditor(Integer auditorId) {
// 删除审核员
Integer line = auditorService.delAuditor(auditorId);
if (line == 0) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
// 删除受审项目关联
auditorProjectItemRelService.delRelByAuditorId(auditorId);
// 删除受审组关联
auditorAuditedGroupRelService.delRelByAuditorId(auditorId);
return ServiceResponse.success();
}
@Override
public ServiceResponse<AuditorDTO> getAuditor(Integer auditorId) {
TabAuditor auditor = this.auditorService.getAuditor(auditorId);
if (auditor == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
AuditorDTO auditorDTO = EntityUtil.changeEntityByJSON(AuditorDTO.class, auditor);
List<TabAuditorProjectItemRel> projectList = auditorProjectItemRelService.listRelByAuditorId(auditorId);
if (CollectionUtils.isNotEmpty(projectList)) {
List<Integer> projectIds = projectList.stream().map(TabAuditorProjectItemRel::getProjectItemId).collect(Collectors.toList());
auditorDTO.setProjectItemList(projectIds);
}
List<TabAuditorAuditedGroupRel> groupList = auditorAuditedGroupRelService.listRelByAuditorId(auditorId);
if (CollectionUtils.isNotEmpty(groupList)) {
List<Integer> groupIds = groupList.stream().map(TabAuditorAuditedGroupRel::getAuditedGroupId).collect(Collectors.toList());
auditorDTO.setAuditedGroupIdList(groupIds);
}
return ServiceResponse.success(auditorDTO);
}
@Override
public ServiceResponse<Page<AuditorDTO>> pageAuditor(AuditorListQO auditorListQO) {
com.github.pagehelper.Page<TabAuditor> page = this.auditorService.pageAuditor(auditorListQO);
Page<AuditorDTO> resultPage = PageHelperUtils.changePageHelperToCurrentPage(page, AuditorDTO.class);
if (CollectionUtils.isNotEmpty(resultPage.getResult())) {
List<Integer> auditorIdList = resultPage.getResult().stream().map(AuditorDTO::getAuditorId).collect(Collectors.toList());
Map<Integer, Integer> projectItemMap = auditorProjectItemRelService.getCountByAuditorIds(auditorIdList);
Map<Integer, Integer> userCountMap = auditorAuditedGroupRelService.getUserCountByAuditorIds(auditorIdList);
for (AuditorDTO auditorDTO: resultPage.getResult()) {
auditorDTO.setProjectItemCount(projectItemMap.get(auditorDTO.getAuditorId()));
auditorDTO.setAuditedGroupCount(userCountMap.get(auditorDTO.getAuditorId()));
}
}
return ServiceResponse.success(resultPage);
}
@Override
public ServiceResponse<Void> receiveOpenid(String qrCodeParam, String openid) {
logger.info("二维码参数:{},openid:{}", qrCodeParam, openid);
if(StringUtils.isNotBlank(qrCodeParam) && StringUtils.isNotBlank(openid)){
if(qrCodeParam.startsWith("auditor_")){
String auditorIdStr = qrCodeParam.substring(qrCodeParam.indexOf("auditor_") + 8);
Integer auditorId = Integer.valueOf(auditorIdStr);
TabAuditor auditor = this.auditorService.getAuditor(auditorId);
if (auditor != null) {
boolean repeat = this.auditorService.validOpenidIsRepeat(auditor.getEnterpriseId(), openid, null);
if (repeat) {
logger.info("receiveOpenid失败,商户:{}下,存在重复的openid:{}", auditor.getEnterpriseId(), openid);
} else {
AuditorDTO auditorDTO = new AuditorDTO();
auditorDTO.setAuditorId(auditorId);
auditorDTO.setOpenid(openid);
this.auditorService.update(auditorDTO);
}
}
}
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<List<AuditorDTO>> listAuditor(AuditorListQO auditorListQO) {
List<TabAuditor> list = this.auditorService.listAuditor(auditorListQO);
return ServiceResponse.success(EntityUtil.changeEntityListByJSON(AuditorDTO.class, list));
}
private String getTempQrCodeUrl(Integer auditorId){
// String enterpriseId = GlobalVar.ctxPropertiesMap.get("data_security_enterpriseId");
// EnterpriseDTO enterpriseDTO = this.enterpriseService.getEnterpriseById(enterpriseId);
// String qrCodeUrl = this.weixinBaseFunService.getTemporaryQRcodeURL(enterpriseDTO.getAppkey(), "auditor_"+auditorId, 300);
// return qrCodeUrl;
return "qrCodeUrl";
}
}
......@@ -30,4 +30,7 @@
<!--应用市场应用列表-->
<dubbo:reference interface="com.gic.open.api.service.ApplicationApiService" id="applicationApiService" timeout="6000" />
<!--审核员-->
<dubbo:service interface="com.gic.auth.service.AuditorApiService" ref="auditorApiService" timeout="6000" />
<dubbo:reference interface="com.gic.enterprise.service.ProjectItemApiService" id="projectItemApiService" timeout="6000" />
</beans>
......@@ -151,4 +151,14 @@
</if>
</where>
</select>
<select id="countByAuditedGroupIds" resultType="java.lang.Integer">
select count(1)
from tab_audited_group 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>
</select>
</mapper>
\ No newline at end of file
......@@ -174,6 +174,15 @@
<include refid="Base_Column_List" />
from tab_audited_group_user_rel
where status = 1
and audited_group_id = #{auditedGroupId}
<if test="auditedGroupId != null ">
and audited_group_id = #{auditedGroupId}
</if>
<if test="null != auditedGroupIdList">
and audited_group_id in
<foreach collection="auditedGroupIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -121,4 +121,78 @@
where audited_group_id = #{auditedGroupId}
and status = 1
</update>
<update id="delByAuditorId">
update tab_auditor_audited_group_rel
set status = 0
where auditor_id = #{auditorId}
and status = 1
</update>
<insert id="insertSelectiveByNotExist">
INSERT INTO tab_auditor_audited_group_rel (
enterprise_id,
auditor_id,
audited_group_id,
status,
create_time
) SELECT
#{enterpriseId},
#{auditorId},
#{auditedGroupId},
#{status},
#{createTime}
FROM
DUAL
WHERE
NOT EXISTS (
SELECT
1
FROM
tab_auditor_audited_group_rel tb
WHERE
tb.enterprise_id = #{enterpriseId}
AND tb.auditor_id = #{auditorId}
AND tb.audited_group_id = #{auditedGroupId}
)
</insert>
<update id="updateStatusByAuditedGroupIds">
update tab_auditor_audited_group_rel
set status = 1
where auditor_id = #{auditorId}
and enterprise_id = #{enterpriseId}
<if test="null != ids">
and audited_group_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
<select id="listRel" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_auditor_audited_group_rel
where status = 1
<if test="auditorId != null ">
and auditor_id = #{auditorId}
</if>
<if test="null != auditorIdList">
and auditor_id in
<foreach collection="auditorIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getCountByAuditorIds" resultType="java.util.HashMap">
select
auditor_id auditorId, count(1) auditedGroupCount
from
tab_auditor_audited_group_rel
where status = 1
<if test="null != ids">
and auditor_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by auditor_id
</select>
</mapper>
\ No newline at end of file
......@@ -6,6 +6,7 @@
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="auditor_name" jdbcType="VARCHAR" property="auditorName" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="openid" jdbcType="VARCHAR" property="openid" />
<result column="is_use" jdbcType="INTEGER" property="isUse" />
<result column="status" jdbcType="INTEGER" property="status" />
......@@ -13,8 +14,8 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
auditor_id, enterprise_id, auditor_name, phone, openid, is_use, status, create_time,
update_time
auditor_id, enterprise_id, auditor_name, phone, user_id, openid, is_use, status,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -28,15 +29,18 @@
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabAuditor">
insert into tab_auditor (auditor_id, enterprise_id, auditor_name,
phone, openid, is_use,
status, create_time, update_time
)
phone, user_id, openid,
is_use, status, create_time,
update_time)
values (#{auditorId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{auditorName,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{openid,jdbcType=VARCHAR}, #{isUse,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
#{phone,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR},
#{isUse,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabAuditor">
<selectKey keyProperty="auditorId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into tab_auditor
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="auditorId != null">
......@@ -51,6 +55,9 @@
<if test="phone != null">
phone,
</if>
<if test="userId != null">
user_id,
</if>
<if test="openid != null">
openid,
</if>
......@@ -80,6 +87,9 @@
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="openid != null">
#{openid,jdbcType=VARCHAR},
</if>
......@@ -109,6 +119,9 @@
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="openid != null">
openid = #{openid,jdbcType=VARCHAR},
</if>
......@@ -132,6 +145,7 @@
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
auditor_name = #{auditorName,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=INTEGER},
openid = #{openid,jdbcType=VARCHAR},
is_use = #{isUse,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
......@@ -139,4 +153,47 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
where auditor_id = #{auditorId,jdbcType=INTEGER}
</update>
<select id="getFirstAuditor" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_auditor
where status = 1
<if test="phone != null and phone != '' ">
and phone = #{phone}
</if>
<if test="auditorId != null ">
and auditor_id &lt;&gt; #{auditorId}
</if>
<if test="auditorName != null and auditorName != '' ">
and auditor_name = #{auditorName}
</if>
<if test="enterpriseId != null ">
and enterprise_id = #{enterpriseId}
</if>
<if test="openid != null and openid != '' ">
and openid = #{openid}
</if>
limit 1
</select>
<update id="delAuditor">
update tab_auditor set status = 0 where status = 1 and auditor_id = #{auditorId}
</update>
<select id="listAuditor" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_auditor
where status = 1
<if test="auditorName != null and auditorName != '' ">
and auditor_name like concat('%', #{auditorName}, '%')
</if>
<if test="auditedGroupId != null ">
and audited_group_id = #{auditedGroupId}
</if>
<if test="isUse != null ">
and is_use = #{isUse}
</if>
<if test="enterpriseId != null ">
and enterprise_id = #{enterpriseId}
</if>
</select>
</mapper>
\ No newline at end of file
<?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.gic.auth.dao.mapper.TabAuditorProjectRelMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabAuditorProjectRel">
<id column="auditor_project_rel_id" jdbcType="INTEGER" property="auditorProjectRelId" />
<mapper namespace="com.gic.auth.dao.mapper.TabAuditorProjectItemRelMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabAuditorProjectItemRel">
<id column="auditor_project_item_rel_id" jdbcType="INTEGER" property="auditorProjectItemRelId" />
<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="project_item_id" jdbcType="INTEGER" property="projectItemId" />
<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">
auditor_project_rel_id, enterprise_id, auditor_id, project_id, status, create_time,
update_time
auditor_project_item_rel_id, enterprise_id, auditor_id, project_item_id, status,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_auditor_project_rel
where auditor_project_rel_id = #{auditorProjectRelId,jdbcType=INTEGER}
from tab_auditor_project_item_rel
where auditor_project_item_rel_id = #{auditorProjectItemRelId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_auditor_project_rel
where auditor_project_rel_id = #{auditorProjectRelId,jdbcType=INTEGER}
delete from tab_auditor_project_item_rel
where auditor_project_item_rel_id = #{auditorProjectItemRelId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabAuditorProjectRel">
insert into tab_auditor_project_rel (auditor_project_rel_id, enterprise_id,
auditor_id, project_id, status,
<insert id="insert" parameterType="com.gic.auth.entity.TabAuditorProjectItemRel">
insert into tab_auditor_project_item_rel (auditor_project_item_rel_id, enterprise_id,
auditor_id, project_item_id, status,
create_time, update_time)
values (#{auditorProjectRelId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER},
#{auditorId,jdbcType=INTEGER}, #{projectId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
values (#{auditorProjectItemRelId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER},
#{auditorId,jdbcType=INTEGER}, #{projectItemId,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
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabAuditorProjectItemRel">
insert into tab_auditor_project_item_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="auditorProjectRelId != null">
auditor_project_rel_id,
<if test="auditorProjectItemRelId != null">
auditor_project_item_rel_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
......@@ -44,8 +44,8 @@
<if test="auditorId != null">
auditor_id,
</if>
<if test="projectId != null">
project_id,
<if test="projectItemId != null">
project_item_id,
</if>
<if test="status != null">
status,
......@@ -58,8 +58,8 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="auditorProjectRelId != null">
#{auditorProjectRelId,jdbcType=INTEGER},
<if test="auditorProjectItemRelId != null">
#{auditorProjectItemRelId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
......@@ -67,8 +67,8 @@
<if test="auditorId != null">
#{auditorId,jdbcType=INTEGER},
</if>
<if test="projectId != null">
#{projectId,jdbcType=INTEGER},
<if test="projectItemId != null">
#{projectItemId,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
......@@ -81,8 +81,8 @@
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabAuditorProjectRel">
update tab_auditor_project_rel
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabAuditorProjectItemRel">
update tab_auditor_project_item_rel
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
......@@ -90,8 +90,8 @@
<if test="auditorId != null">
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="projectId != null">
project_id = #{projectId,jdbcType=INTEGER},
<if test="projectItemId != null">
project_item_id = #{projectItemId,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
......@@ -103,16 +103,84 @@
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where auditor_project_rel_id = #{auditorProjectRelId,jdbcType=INTEGER}
where auditor_project_item_rel_id = #{auditorProjectItemRelId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabAuditorProjectRel">
update tab_auditor_project_rel
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabAuditorProjectItemRel">
update tab_auditor_project_item_rel
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
auditor_id = #{auditorId,jdbcType=INTEGER},
project_id = #{projectId,jdbcType=INTEGER},
project_item_id = #{projectItemId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where auditor_project_rel_id = #{auditorProjectRelId,jdbcType=INTEGER}
where auditor_project_item_rel_id = #{auditorProjectItemRelId,jdbcType=INTEGER}
</update>
<update id="delByAuditorId">
update tab_auditor_project_item_rel
set status = 0
where status = 1
and auditor_id = #{auditorId}
</update>
<insert id="insertSelectiveByNotExist">
INSERT INTO tab_auditor_project_item_rel (
enterprise_id,
auditor_id,
project_item_id,
status,
create_time
) SELECT
#{enterpriseId},
#{auditorId},
#{projectItemId},
#{status},
#{createTime}
FROM
DUAL
WHERE
NOT EXISTS (
SELECT
1
FROM
tab_auditor_project_item_rel tb
WHERE
tb.enterprise_id = #{enterpriseId}
AND tb.auditor_id = #{auditorId}
AND tb.project_item_id = #{projectItemId}
)
</insert>
<update id="updateStatusByProjectItemIds">
update tab_auditor_project_item_rel
set status = 1
where auditor_id = #{auditorId}
and enterprise_id = #{enterpriseId}
<if test="null != ids">
and project_item_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
<select id="listRelByAuditorId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_auditor_project_item_rel
where status = 1
<if test="auditorId != null ">
and auditor_id = #{auditorId}
</if>
order by create_time desc
</select>
<select id="getCountByAuditorIds" resultType="java.util.HashMap">
select
auditor_id auditorId, count(1) projectItemCount
from tab_auditor_project_item_rel
where status = 1
<if test="null != ids">
and auditor_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by auditor_id
</select>
</mapper>
\ No newline at end of file
......@@ -280,4 +280,11 @@
</if>
limit 1
</select>
<select id="countUserByUserIds" resultType="java.lang.Integer">
select count(1) from tab_sys_user where status = 1
and user_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</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.AuditorDTO;
import com.gic.auth.qo.AuditorListQO;
import com.gic.auth.service.AuditorApiService;
import com.gic.auth.web.qo.AuditorQO;
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.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-20 10:31
*/
@RestController
public class AuditorController {
private Logger logger = LogManager.getLogger(AuditorController.class);
@Autowired
private AuditorApiService auditorApiService;
@RequestMapping("/save-auditor")
public RestResponse saveAuditor(AuditorQO auditorQO) {
AuditorDTO auditorDTO = EntityUtil.changeEntityByJSON(AuditorDTO.class, auditorQO);
auditorDTO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
List<Integer> projectItemList = Stream.of(auditorQO.getProjectItems().split(GlobalInfo.FLAG_COMMA)).map(Integer::valueOf).collect(Collectors.toList());
auditorDTO.setProjectItemList(projectItemList);
List<Integer> auditedGroupIdList = Stream.of(auditorQO.getAuditedGroupIds().split(GlobalInfo.FLAG_COMMA)).map(Integer::valueOf).collect(Collectors.toList());
auditorDTO.setAuditedGroupIdList(auditedGroupIdList);
ServiceResponse<String> response = auditorApiService.saveOrUpdateAuditor(auditorDTO);
return ResultControllerUtils.commonResult(response);
}
@RequestMapping("/del-auditor")
public RestResponse delAuditor(Integer auditorId) {
ServiceResponse<Void> response = auditorApiService.delAuditor(auditorId);
return ResultControllerUtils.commonResult(response);
}
@RequestMapping("/get-auditor")
public RestResponse getAuditor(Integer auditorId) {
ServiceResponse<AuditorDTO> response = auditorApiService.getAuditor(auditorId);
return ResultControllerUtils.commonResult(response);
}
@RequestMapping("/list-auditor")
public RestResponse pageAuditor(AuditorListQO auditorListQO) {
auditorListQO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
ServiceResponse<Page<AuditorDTO>> response = auditorApiService.pageAuditor(auditorListQO);
return ResultControllerUtils.commonResult(response);
}
@RequestMapping("/list-auditor-nopage")
public RestResponse listAuditor(AuditorListQO auditorListQO) {
auditorListQO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
ServiceResponse<List<AuditorDTO>> response = auditorApiService.listAuditor(auditorListQO);
return ResultControllerUtils.commonResult(response);
}
}
package com.gic.auth.web.qo;
import javax.validation.constraints.NotBlank;
/**
*
* @Description:
* @author zhiwj
* @date 2019-09-20 13:43
*/
public class AuditorQO {
public interface SaveValid{}
/**
*
*/
private Integer auditorId;
/**
*
*/
private Integer enterpriseId;
/**
* 审核员姓名
*/
@NotBlank(message = "审核员姓名不能为空", groups = SaveValid.class)
private String auditorName;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = SaveValid.class)
private String phone;
/**
* 关联管理员id
*/
private Integer userId;
/**
* 受审项目审批项id
*/
@NotBlank(message = "受审项目不能为空", groups = SaveValid.class)
private String projectItems;
/**
* 受审组id
*/
@NotBlank(message = "受审组不能为空", groups = SaveValid.class)
private String auditedGroupIds;
public Integer getAuditorId() {
return auditorId;
}
public void setAuditorId(Integer auditorId) {
this.auditorId = auditorId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getAuditorName() {
return auditorName;
}
public void setAuditorName(String auditorName) {
this.auditorName = auditorName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getProjectItems() {
return projectItems;
}
public void setProjectItems(String projectItems) {
this.projectItems = projectItems;
}
public String getAuditedGroupIds() {
return auditedGroupIds;
}
public void setAuditedGroupIds(String auditedGroupIds) {
this.auditedGroupIds = auditedGroupIds;
}
}
......@@ -50,4 +50,7 @@
<!--受审组-->
<dubbo:reference interface="com.gic.auth.service.AuditedGroupApiService" id="auditedGroupApiService" timeout="6000" />
<dubbo:reference interface="com.gic.store.service.StoreWidgetApiService" id="storeWidgetApiService" timeout="6000" />
<!--审核员-->
<dubbo:reference interface="com.gic.auth.service.AuditorApiService" id="auditorApiService" 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