Commit c124018d authored by 廖旭伟's avatar 廖旭伟

事项申请列表查询条件增加工作人员用户id

parent 98512f44
......@@ -18,4 +18,6 @@ import java.util.Date;
public class MatterApplyVo extends BaseEntityLong {
/** 申请材料 */
private List<MatterApplyDatumEntity> applyDatumList;
/** 用户id */
private Long userId;
}
\ No newline at end of file
package com.mortals.xhx.module.apply.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import com.mortals.xhx.module.apply.model.ApproverEntity;
......@@ -19,4 +20,12 @@ public interface ApproverService extends ICRUDService<ApproverEntity,Long>{
ApproverDao getDao();
void updateUserList(List<UserPhpPdu> list);
/**
* 根据用户id查询部门
* @param userId
* @return
* @throws AppException
*/
String getDeptCodeByUser(Long userId) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.apply.service.impl;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.SecurityUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import com.mortals.xhx.module.apply.model.ApproverQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -29,6 +32,9 @@ import java.util.List;
@Slf4j
public class ApproverServiceImpl extends AbstractCRUDServiceImpl<ApproverDao, ApproverEntity, Long> implements ApproverService {
@Autowired
private UserService userService;
@Override
public void updateUserList(List<UserPhpPdu> list) {
if(!CollectionUtils.isEmpty(list)){
......@@ -70,4 +76,20 @@ public class ApproverServiceImpl extends AbstractCRUDServiceImpl<ApproverDao, Ap
}
}
}
@Override
public String getDeptCodeByUser(Long userId) throws AppException {
UserEntity userEntity = userService.get(userId);
if(userEntity==null){
throw new AppException("用户id不正确,找不到对应的用户信息");
}
ApproverEntity approverEntity = this.selectOne(new ApproverQuery().loginName(userEntity.getLoginName()));
if(approverEntity==null){
throw new AppException("该用户不是预审工作人员");
}
if(StringUtils.isEmpty(approverEntity.getDeptCode())){
throw new AppException("该工作人员没有配置管辖部门");
}
return approverEntity.getDeptCode();
}
}
\ No newline at end of file
......@@ -4,10 +4,12 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.module.apply.dao.MatterApplyDao;
import com.mortals.xhx.module.apply.model.MatterApplyDatumEntity;
import com.mortals.xhx.module.apply.model.MatterApplyDatumQuery;
import com.mortals.xhx.module.apply.model.MatterApplyEntity;
import com.mortals.xhx.module.apply.service.ApproverService;
import com.mortals.xhx.module.apply.service.MatterApplyDatumService;
import com.mortals.xhx.module.apply.service.MatterApplyService;
import lombok.extern.slf4j.Slf4j;
......@@ -31,6 +33,8 @@ public class MatterApplyServiceImpl extends AbstractCRUDServiceImpl<MatterApplyD
@Autowired
private MatterApplyDatumService matterApplyDatumService;
@Autowired
private ApproverService approverService;
@Override
protected void saveBefore(MatterApplyEntity entity, Context context) throws AppException {
......@@ -61,6 +65,23 @@ public class MatterApplyServiceImpl extends AbstractCRUDServiceImpl<MatterApplyD
entity.setApplyState(0);
}
@Override
protected MatterApplyEntity findBefore(MatterApplyEntity params, Context context) throws AppException {
if(params.getUserId()!=null){
String deptCode = approverService.getDeptCodeByUser(params.getUserId());
params.setDeptCode(deptCode);
}
return params;
}
@Override
protected MatterApplyEntity findBefore(MatterApplyEntity params, PageInfo pageInfo, Context context) throws AppException {
if(params.getUserId()!=null){
String deptCode = approverService.getDeptCodeByUser(params.getUserId());
params.setDeptCode(deptCode);
}
return params;
}
@Override
protected void updateAfter(MatterApplyEntity entity, Context context) throws AppException {
if(CollectionUtils.isNotEmpty(entity.getApplyDatumList())){
......
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