6 changed files with 421 additions and 0 deletions
-
35src/main/java/com/xujie/sys/modules/auth/service/impl/AuthBusinessServiceImpl.java
-
64src/main/java/com/xujie/sys/modules/auth/service/impl/AuthGroupMemberServiceImpl.java
-
83src/main/java/com/xujie/sys/modules/auth/service/impl/AuthGroupServiceImpl.java
-
25src/main/java/com/xujie/sys/modules/auth/service/impl/AuthHistServiceImpl.java
-
153src/main/java/com/xujie/sys/modules/auth/service/impl/AuthRuleServiceImpl.java
-
61src/main/java/com/xujie/sys/modules/auth/service/impl/AuthStepServiceImpl.java
@ -0,0 +1,35 @@ |
|||
package com.xujie.sys.modules.auth.service.Impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.xujie.sys.common.utils.PageUtils; |
|||
import com.xujie.sys.modules.auth.data.AuthBusinessData; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthBusinessDataVo; |
|||
import com.xujie.sys.modules.auth.mapper.AuthBusinessMapper; |
|||
import com.xujie.sys.modules.auth.service.AuthBusinessService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author Jia |
|||
* @description 针对表【sys_user_business_role】的数据库操作Service实现 |
|||
* @createDate 2024-08-20 12:31:44 |
|||
*/ |
|||
@Service |
|||
public class AuthBusinessServiceImpl extends ServiceImpl<AuthBusinessMapper, AuthBusinessData> implements AuthBusinessService { |
|||
|
|||
@Autowired |
|||
private AuthBusinessMapper authBusinessMapper; |
|||
|
|||
@Override |
|||
public PageUtils authBusinessSearch(AuthBusinessDataVo inData) { |
|||
IPage<AuthBusinessDataVo> AuthBusinessList = this.authBusinessMapper.authBusinessSearch(new Page<AuthBusinessDataVo>(inData.getPage(), inData.getLimit()), inData); |
|||
return new PageUtils(AuthBusinessList); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,64 @@ |
|||
package com.xujie.sys.modules.auth.service.Impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.xujie.sys.modules.auth.data.AuthGroupData; |
|||
import com.xujie.sys.modules.auth.data.AuthGroupMemberData; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthBusinessDataVo; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthGroupMemberDataVo; |
|||
import com.xujie.sys.modules.auth.service.AuthGroupMemberService; |
|||
import com.xujie.sys.modules.auth.mapper.AuthGroupMemberMapper; |
|||
import com.xujie.sys.modules.sys.dao.SysUserDao; |
|||
import com.xujie.sys.modules.sys.entity.SysUserEntity; |
|||
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; |
|||
|
|||
/** |
|||
* @author Jia |
|||
* @description 针对表【auth_group_member】的数据库操作Service实现 |
|||
* @createDate 2024-08-22 16:48:36 |
|||
*/ |
|||
@Service |
|||
public class AuthGroupMemberServiceImpl extends ServiceImpl<AuthGroupMemberMapper, AuthGroupMemberData> |
|||
implements AuthGroupMemberService{ |
|||
|
|||
|
|||
@Autowired |
|||
private AuthGroupMemberMapper authGroupMemberMapper; |
|||
|
|||
@Override |
|||
public List<AuthGroupMemberDataVo> authGroupBusinessSearch(AuthGroupData data) { |
|||
List<AuthGroupMemberDataVo> authGroupMemberDataVos = authGroupMemberMapper.authGroupBusinessSearch(data); |
|||
return authGroupMemberDataVos; |
|||
} |
|||
|
|||
@Override |
|||
public List<AuthGroupMemberDataVo> authGroupBusinessSearch2(AuthGroupData data) { |
|||
List<AuthGroupMemberDataVo> authGroupMemberDataVos = authGroupMemberMapper.authGroupBusinessSearch2(data); |
|||
return authGroupMemberDataVos; |
|||
} |
|||
|
|||
@Override |
|||
public void addAuthGroupMemberBusiness(AuthGroupMemberDataVo data) { |
|||
data.getAuthBusinessList().forEach(item -> { |
|||
data.setUserId(item.getUserId()); |
|||
data.setCreateDate(new Date()); |
|||
authGroupMemberMapper.insert(data); |
|||
}); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAuthGroupMemberBusiness(AuthGroupMemberDataVo data) { |
|||
data.getAuthBusinessList().forEach(item -> { |
|||
authGroupMemberMapper.deleteById(item.getAuthGroupMemberId()); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,83 @@ |
|||
package com.xujie.sys.modules.auth.service.Impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.sun.org.apache.bcel.internal.generic.NEW; |
|||
import com.xujie.sys.common.utils.PageUtils; |
|||
import com.xujie.sys.modules.auth.data.AuthGroupData; |
|||
import com.xujie.sys.modules.auth.data.AuthStepData; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthBusinessDataVo; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthGroupDataVo; |
|||
import com.xujie.sys.modules.auth.mapper.AuthStepMapper; |
|||
import com.xujie.sys.modules.auth.service.AuthGroupService; |
|||
import com.xujie.sys.modules.auth.mapper.AuthGroupMapper; |
|||
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; |
|||
|
|||
/** |
|||
* @author Jia |
|||
* @description 针对表【auth_group】的数据库操作Service实现 |
|||
* @createDate 2024-08-21 11:24:00 |
|||
*/ |
|||
@Service |
|||
public class AuthGroupServiceImpl extends ServiceImpl<AuthGroupMapper, AuthGroupData> |
|||
implements AuthGroupService { |
|||
|
|||
@Autowired |
|||
private AuthGroupMapper authGroupMapper; |
|||
|
|||
@Autowired |
|||
private AuthStepMapper authStepMapper; |
|||
|
|||
@Override |
|||
public PageUtils authGroupSearch(AuthGroupData inData) { |
|||
IPage<AuthGroupDataVo> AuthGroupList = this.authGroupMapper.authGroupSearch(new Page<AuthGroupData>(inData.getPage(), inData.getLimit()), inData); |
|||
return new PageUtils(AuthGroupList); |
|||
} |
|||
|
|||
@Override |
|||
public void authGroupSave(AuthGroupData data) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("site", data.getSite()); |
|||
map.put("group_no", data.getGroupNo()); |
|||
List<AuthGroupData> list = authGroupMapper.selectByMap(map); |
|||
if (!list.isEmpty()) { |
|||
throw new RuntimeException("该site下已存在相同的审批组"); |
|||
} |
|||
data.setCreateDate(new Date()); |
|||
authGroupMapper.insert(data); |
|||
} |
|||
|
|||
@Override |
|||
public void authGroupEdit(AuthGroupData data) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("auth_group_no", data.getGroupNo()); |
|||
List<AuthStepData> authStepList = authStepMapper.selectByMap(map); |
|||
if (!authStepList.isEmpty()) { |
|||
throw new RuntimeException("该审批组已被审批步骤应用,无法进行修改!"); |
|||
} |
|||
data.setUpdateDate(new Date()); |
|||
authGroupMapper.updateById(data); |
|||
} |
|||
|
|||
@Override |
|||
public void authGroupDelete(AuthGroupData data) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("auth_group_no", data.getGroupNo()); |
|||
List<AuthStepData> authStepList = authStepMapper.selectByMap(map); |
|||
if (!authStepList.isEmpty()) { |
|||
throw new RuntimeException("该审批组已被审批步骤应用,无法删除!"); |
|||
} |
|||
authGroupMapper.deleteById(data.getAuthGroupId()); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,25 @@ |
|||
package com.xujie.sys.modules.auth.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.xujie.sys.modules.auth.data.AuthHistData; |
|||
import com.xujie.sys.modules.auth.service.AuthHistService; |
|||
import com.xujie.sys.modules.auth.mapper.AuthHistMapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author Jia |
|||
* @description 针对表【auth_hist(审批记录表)】的数据库操作Service实现 |
|||
* @createDate 2024-11-01 15:21:32 |
|||
*/ |
|||
@Service |
|||
public class AuthHistServiceImpl extends ServiceImpl<AuthHistMapper, AuthHistData> |
|||
implements AuthHistService{ |
|||
|
|||
public void saveAuthHist(AuthHistData authHistData) { |
|||
this.save(authHistData); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,153 @@ |
|||
package com.xujie.sys.modules.auth.service.Impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.xujie.sys.common.utils.PageUtils; |
|||
import com.xujie.sys.modules.auth.data.AuthGroupData; |
|||
import com.xujie.sys.modules.auth.data.AuthHistData; |
|||
import com.xujie.sys.modules.auth.data.AuthRuleData; |
|||
import com.xujie.sys.modules.auth.data.AuthStepData; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthGroupDataVo; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthRuleDataVo; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthStepDataVo; |
|||
import com.xujie.sys.modules.auth.mapper.AuthGroupMapper; |
|||
import com.xujie.sys.modules.auth.mapper.AuthStepMapper; |
|||
import com.xujie.sys.modules.auth.service.AuthRuleService; |
|||
import com.xujie.sys.modules.auth.mapper.AuthRuleMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @author Jia |
|||
* @description 针对表【auth_rule】的数据库操作Service实现 |
|||
* @createDate 2024-08-21 18:34:17 |
|||
*/ |
|||
@Service |
|||
public class AuthRuleServiceImpl extends ServiceImpl<AuthRuleMapper, AuthRuleData> |
|||
implements AuthRuleService{ |
|||
|
|||
@Autowired |
|||
private AuthRuleMapper authRuleMapper; |
|||
|
|||
@Autowired |
|||
private AuthStepMapper authStepMapper; |
|||
|
|||
@Autowired |
|||
private com.xujie.sys.modules.auth.service.impl.AuthHistServiceImpl authHistService; |
|||
|
|||
@Override |
|||
public PageUtils authRuleSearch(AuthRuleData inData) { |
|||
IPage<AuthRuleDataVo> AuthRuleList = this.authRuleMapper.authRuleSearch(new Page<AuthRuleData>(inData.getPage(), inData.getLimit()), inData); |
|||
return new PageUtils(AuthRuleList); |
|||
} |
|||
|
|||
@Override |
|||
public void authRuleSave(AuthRuleData data) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("site", data.getSite()); |
|||
map.put("rule_no", data.getRuleNo()); |
|||
List<AuthRuleData> list = authRuleMapper.selectByMap(map); |
|||
if (list.size() > 0) { |
|||
throw new RuntimeException("该site下已存在相同的审批规则"); |
|||
} |
|||
data.setPriority(1); |
|||
data.setCreateDate(new Date()); |
|||
authRuleMapper.insert(data); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void authRuleEdit(AuthRuleData data) { |
|||
// Map<String, Object> map = new HashMap<>(); |
|||
// map.put("site", data.getSite()); |
|||
// map.put("bu_no", data.getBuNo()); |
|||
// map.put("rule_no", data.getRuleNo()); |
|||
// List<AuthRuleData> list = authRuleMapper.selectByMap(map); |
|||
// if (list.size() > 0) { |
|||
// throw new RuntimeException("该site下已存在相同的审批规则"); |
|||
// } |
|||
data.setUpdateDate(new Date()); |
|||
authRuleMapper.updateById(data); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void authRuleDelete(AuthRuleData data) { |
|||
AuthStepData authStepData = new AuthStepData(); |
|||
authStepData.setAuthRuleId(data.getAuthRuleId()); |
|||
List<AuthStepDataVo> authStepDataVos = authStepMapper.authStepSearch(authStepData); |
|||
if (!authStepDataVos.isEmpty()) { |
|||
throw new RuntimeException("该审批规则下存在审批步骤,不可删除"); |
|||
} |
|||
authRuleMapper.deleteById(data.getAuthRuleId()); |
|||
} |
|||
|
|||
@Override |
|||
public List<AuthRuleDataVo> getBusinessTypeList(AuthRuleDataVo data) { |
|||
List<AuthRuleDataVo> businessTypeList = authRuleMapper.getBusinessTypeList(data); |
|||
return businessTypeList; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void getFormAuthRule(String recordType,String site,String buNo,String orderRef1) { |
|||
AuthRuleDataVo authRuleData = authRuleMapper.getFormAuthRule(recordType,site,buNo); |
|||
List<AuthStepDataVo> authStepsByRuleId = authStepMapper.getAuthStepsByRuleId(authRuleData.getAuthRuleId()); |
|||
for (AuthStepDataVo authStepDataVo : authStepsByRuleId) { |
|||
AuthHistData authHistData = new AuthHistData(); |
|||
authHistData.setRecordTypeDb(recordType); |
|||
authHistData.setOrderRef1(orderRef1); |
|||
authHistData.setSite(site); |
|||
authHistData.setAuthRuleId(authStepDataVo.getAuthRuleId()); |
|||
authHistData.setStepId(authStepDataVo.getStepNo()); |
|||
authHistData.setAuthTypeDb(authStepDataVo.getAuthTypeDb()); |
|||
|
|||
if (Objects.equals(authStepDataVo.getAuthTypeDb(), "U")){ |
|||
authHistData.setAuthUserId(authStepDataVo.getAuthUserNo()); |
|||
} else { |
|||
authHistData.setAuthGroupId(authStepDataVo.getAuthGroupNo()); |
|||
} |
|||
|
|||
authHistData.setAuthFlag("N"); |
|||
|
|||
// 如果是同时审批则CanAuthFlag为Y |
|||
if (authRuleData.getIsSimultaneous()) { |
|||
authHistData.setCanAuthFlag("Y"); |
|||
} else { |
|||
// 如果是首步骤则CanAuthFlag为Y其余的都为N |
|||
if (authStepDataVo.getFirstStepFlag().equals("Y")) { |
|||
authHistData.setCanAuthFlag("Y"); |
|||
} else { |
|||
authHistData.setCanAuthFlag("N"); |
|||
} |
|||
} |
|||
|
|||
if (authStepDataVo.getFirstStepFlag().equals("Y")){ |
|||
authHistData.setFirstStepFlag("Y"); |
|||
authHistData.setLastStepFlag("N"); |
|||
} else if (authStepDataVo.getLastStepFlag().equals("Y")){ |
|||
authHistData.setFirstStepFlag("N"); |
|||
authHistData.setLastStepFlag("Y"); |
|||
} else { |
|||
authHistData.setFirstStepFlag("N"); |
|||
authHistData.setLastStepFlag("N"); |
|||
} |
|||
|
|||
try { |
|||
authHistService.saveAuthHist(authHistData); |
|||
} catch (Exception e) { |
|||
throw new RuntimeException("审批记录保存失败:" + e.getMessage()); |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,61 @@ |
|||
package com.xujie.sys.modules.auth.service.Impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.xujie.sys.modules.auth.data.AuthStepData; |
|||
import com.xujie.sys.modules.auth.data.vo.AuthStepDataVo; |
|||
import com.xujie.sys.modules.auth.service.AuthStepService; |
|||
import com.xujie.sys.modules.auth.mapper.AuthStepMapper; |
|||
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; |
|||
|
|||
/** |
|||
* @author Jia |
|||
* @description 针对表【auth_step】的数据库操作Service实现 |
|||
* @createDate 2024-08-21 18:50:33 |
|||
*/ |
|||
@Service |
|||
public class AuthStepServiceImpl extends ServiceImpl<AuthStepMapper, AuthStepData> |
|||
implements AuthStepService{ |
|||
|
|||
@Autowired |
|||
private AuthStepMapper authStepMapper; |
|||
|
|||
|
|||
@Override |
|||
public List<AuthStepDataVo> authStepSearch(AuthStepData data) { |
|||
return authStepMapper.authStepSearch(data); |
|||
} |
|||
@Override |
|||
public void authStepSave(AuthStepData data) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("rule_id", data.getAuthRuleId()); |
|||
map.put("step_no", data.getStepNo()); |
|||
List<AuthStepData> list = authStepMapper.selectByMap(map); |
|||
if (!list.isEmpty()) { |
|||
throw new RuntimeException("该审批规则下已存在相同步骤号!"); |
|||
} |
|||
data.setCreateDate(new Date()); |
|||
authStepMapper.insert(data); |
|||
} |
|||
|
|||
@Override |
|||
public void authStepEdit(AuthStepData data) { |
|||
data.setUpdateDate(new Date()); |
|||
authStepMapper.updateById(data); |
|||
} |
|||
|
|||
@Override |
|||
public void authStepDelete(AuthStepData data) { |
|||
authStepMapper.deleteById(data); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue