|
|
@@ -11,6 +11,10 @@ import java.util.function.Function;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.lc.ibps.org.party.builder.PartyPositionUserBuilder;
|
|
|
+import com.lc.ibps.org.party.persistence.entity.*;
|
|
|
+import com.lc.ibps.org.party.persistence.vo.*;
|
|
|
+import com.lc.ibps.org.party.repository.*;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.context.annotation.Scope;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -48,34 +52,6 @@ import com.lc.ibps.org.party.builder.PartyEntityBuilder;
|
|
|
import com.lc.ibps.org.party.builder.PartyRelBuilder;
|
|
|
import com.lc.ibps.org.party.persistence.dao.PartyEmployeeDao;
|
|
|
import com.lc.ibps.org.party.persistence.dao.PartyEmployeeQueryDao;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyAttrValuePo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyEmployeePo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyEntityPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyOrgPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyPositionPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyRelPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyUniquePo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyUserGroupPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyUserLimitPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyUserPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyUserRolePo;
|
|
|
-import com.lc.ibps.org.party.persistence.vo.PartyAttrValueVo;
|
|
|
-import com.lc.ibps.org.party.persistence.vo.PartyEmployeeVo;
|
|
|
-import com.lc.ibps.org.party.persistence.vo.PartyPositionVo;
|
|
|
-import com.lc.ibps.org.party.persistence.vo.PartyRoleVo;
|
|
|
-import com.lc.ibps.org.party.persistence.vo.TenantUserRelationVo;
|
|
|
-import com.lc.ibps.org.party.repository.PartyAttrValueRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyEmployeeRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyEntityRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyGroupRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyOrgRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyPositionRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyRelRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyUniqueRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyUserGroupRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyUserLimitRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyUserRepository;
|
|
|
-import com.lc.ibps.org.party.repository.PartyUserRoleRepository;
|
|
|
import com.lc.ibps.org.spi.SpiUserService;
|
|
|
import com.lc.ibps.org.spi.SpiUserServiceUtil;
|
|
|
|
|
|
@@ -109,6 +85,9 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
@Resource
|
|
|
@Lazy
|
|
|
private PartyPositionRepository partyPositionRepository;
|
|
|
+ @Resource
|
|
|
+ @Lazy
|
|
|
+ private PartyPositionUserRepository partyPositionUserRepository;
|
|
|
@Resource
|
|
|
@Lazy
|
|
|
private PartyUserLimitRepository partyUserLimitRepository;
|
|
|
@@ -514,6 +493,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
public void createByCascade(PartyEmployeeVo vo){
|
|
|
getData().setId(UniqueIdUtil.getId());
|
|
|
assignPosition(vo.getPositionVoList());
|
|
|
+ assignResponsibility(vo.getPartyPositionUser());
|
|
|
create();
|
|
|
createUser(vo.getUser());
|
|
|
// 用户角色关系需要保证角色、用户id都存在,必须先创建用户
|
|
|
@@ -528,6 +508,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
*/
|
|
|
public void updateByCascade(PartyEmployeeVo vo){
|
|
|
assignPosition(vo.getPositionVoList());
|
|
|
+ assignResponsibility(vo.getPartyPositionUser());
|
|
|
update();
|
|
|
updateUser(vo.getUser());
|
|
|
// 用户角色关系需要保证角色、用户id都存在,必须先创建用户
|
|
|
@@ -563,8 +544,8 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
/**
|
|
|
* 添加员工岗位信息、保存员工与岗位关系(主岗位、主负责人)
|
|
|
*
|
|
|
- * @param posId
|
|
|
- * @param employeeList
|
|
|
+ * @paramposId
|
|
|
+ * @paramemployeeList
|
|
|
*/
|
|
|
private void addPositionInfo(PartyEmployeePo data, String userId, String[] posIds) {
|
|
|
// 更新员工岗位信息
|
|
|
@@ -590,7 +571,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
* 岗位添加员工
|
|
|
*
|
|
|
* @param posId
|
|
|
- * @param employeeList
|
|
|
+ * @paramemployeeList
|
|
|
*/
|
|
|
public void addUsertoPos(String posId, String[] userIds) {
|
|
|
for(String userId : userIds){
|
|
|
@@ -655,7 +636,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
* 添加员工组织信息
|
|
|
*
|
|
|
* @param orgId
|
|
|
- * @param userJsonArr
|
|
|
+ * @paramuserJsonArr
|
|
|
*/
|
|
|
public void addOrgInfo(String orgId, String[] aryIds) {
|
|
|
for(String userId : aryIds){
|
|
|
@@ -806,7 +787,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
/**
|
|
|
* 添加用户岗位
|
|
|
*
|
|
|
- * @param id
|
|
|
+ * @paramid
|
|
|
* @param posIds
|
|
|
*/
|
|
|
public void addPosition(String userId, String posIds) {
|
|
|
@@ -820,7 +801,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
/**
|
|
|
* 添加用户组织
|
|
|
*
|
|
|
- * @param id
|
|
|
+ * @paramid
|
|
|
* @param orgId
|
|
|
*/
|
|
|
public void addOrg(String userId, String orgId) {
|
|
|
@@ -883,7 +864,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
/**
|
|
|
* 删除员工岗位信息
|
|
|
*
|
|
|
- * @param id
|
|
|
+ * @paramid
|
|
|
* @param posIds
|
|
|
*/
|
|
|
public void removePosInfo(String userId, String posIds) {
|
|
|
@@ -924,7 +905,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
/**
|
|
|
* 删除员工组织信息、保存默认员工-角色
|
|
|
*
|
|
|
- * @param id
|
|
|
+ * @paramid
|
|
|
* @param orgId
|
|
|
*/
|
|
|
public void removeOrgInfo(String userId, String orgId) {
|
|
|
@@ -1026,6 +1007,18 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
// 添加用户岗位信息
|
|
|
assignUserPosRel(po.getId(), positionVoList);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 添加员工职责
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private void assignResponsibility(List<PartyPositionUserPo> responsibilityVoList){
|
|
|
+ if(BeanUtils.isEmpty(responsibilityVoList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ PartyEmployeePo po = getData();
|
|
|
+ // 添加用户岗位信息
|
|
|
+ assignUserRespRel(po.getId(), responsibilityVoList);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 添加用户角色
|
|
|
@@ -1070,7 +1063,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
* 添加用户岗位关系
|
|
|
*
|
|
|
* @param userId
|
|
|
- * @param posJsonArr
|
|
|
+ * @paramposJsonArr
|
|
|
*/
|
|
|
private void assignUserPosRel(String userId, List<PartyPositionVo> positionVoList) {
|
|
|
StringBuilder posIds = new StringBuilder();
|
|
|
@@ -1104,12 +1097,31 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
}
|
|
|
addPosition(userId, posIds.toString());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加用户岗位关系
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @param
|
|
|
+ */
|
|
|
+ private void assignUserRespRel(String userId, List<PartyPositionUserPo> responsibilityVoList) {
|
|
|
+ StringBuilder posNames = new StringBuilder();
|
|
|
+ //进入这里标识一定有岗位数据
|
|
|
+ //直接删除原来的岗位,再add新的就可以不需要考虑id,应为是通过名称来决定数据的唯一性
|
|
|
+ partyPositionUserRepository.deleteByUserId(userId);
|
|
|
+ //删除后重新开始add
|
|
|
+ for(PartyPositionUserPo partyPositionUser : responsibilityVoList){
|
|
|
+ //初始参与属性对象空对象
|
|
|
+ partyPositionUser = PartyPositionUserBuilder.build(userId,partyPositionUser);
|
|
|
+ partyPositionUserRepository.newInstance(partyPositionUser).create();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 添加用户角色关系
|
|
|
*
|
|
|
- * @param userId
|
|
|
- * @param roleJsonArr
|
|
|
+ * @paramuserId
|
|
|
+ * @paramroleJsonArr
|
|
|
*/
|
|
|
private void assignUserRoleRel(List<PartyRoleVo> roleVoList, boolean isReSet) {
|
|
|
PartyEmployeePo po = getData();
|
|
|
@@ -1236,8 +1248,8 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
* 禁用用户
|
|
|
*
|
|
|
* @param ids
|
|
|
- * @param lockMode
|
|
|
- * @param time
|
|
|
+ * @paramlockMode
|
|
|
+ * @paramtime
|
|
|
*/
|
|
|
public void disable(String ids) {
|
|
|
String[] idArr = ids.split(StringPool.COMMA);
|
|
|
@@ -1324,7 +1336,7 @@ public class PartyEmployee extends AbstractDomain<String, PartyEmployeePo> {
|
|
|
/**
|
|
|
* 锁定用户
|
|
|
*
|
|
|
- * @param ids
|
|
|
+ * @paramids
|
|
|
* @param lockMode
|
|
|
* @param time
|
|
|
*/
|