Commit 308f5731 by 314581947

审核员接口添加参数判断

parent d87033c9
......@@ -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
......@@ -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
......@@ -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);
}
......@@ -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();
}
}
......@@ -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();
}
}
......@@ -51,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);
......
......@@ -7,14 +7,14 @@ 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.AuditorApiService;
import com.gic.auth.service.AuditorAuditedGroupRelService;
import com.gic.auth.service.AuditorProjectItemRelService;
import com.gic.auth.service.AuditorService;
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;
......@@ -44,6 +44,10 @@ public class AuditorApiServiceImpl implements AuditorApiService {
private AuditorProjectItemRelService auditorProjectItemRelService;
@Autowired
private AuditorAuditedGroupRelService auditorAuditedGroupRelService;
@Autowired
private ProjectItemApiService projectItemApiService;
@Autowired
private AuditedGroupService auditedGroupService;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -56,6 +60,14 @@ public class AuditorApiServiceImpl implements AuditorApiService {
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);
......@@ -84,6 +96,13 @@ public class AuditorApiServiceImpl implements AuditorApiService {
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) {
......
......@@ -32,4 +32,5 @@
<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
......@@ -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
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