Commit aedbe27b authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 7a2393a8 6662d296
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
...@@ -10,11 +11,14 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationRequstD ...@@ -10,11 +11,14 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationRequstD
import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException; import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcOpeningApplicationServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcOpeningApplicationServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.vo.TzsUserInfoVo;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -253,4 +257,31 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -253,4 +257,31 @@ public class JyjcOpeningApplicationController extends BaseController {
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.getUnitListByRecord(record)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.getUnitListByRecord(record));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/user-list")
@ApiOperation(httpMethod = "GET", value = "查询指定公司、指定人员类型的人员列表,默认当前登录人所在公司", notes = "查询指定公司、指定人员类型的人员列表,默认当前登录人所在公司")
public ResponseModel<List<TzsUserInfoVo>> getBizUserInfosByUnitCode(@ApiParam(value = "公司编码") @RequestParam(required = false) String unitCode,
@ApiParam(value = "人员类型", allowableValues = "jy,jc") @RequestParam String personType) {
if (StringUtils.isEmpty(unitCode)) {
ReginParams reginParams = getSelectedOrgInfo();
unitCode = reginParams.getCompany().getCompanyCode();
}
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.getUserListByUnitCodeAndPost(unitCode, personType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/user-map")
@ApiOperation(httpMethod = "GET", value = "查询指定公司、指定人员类型的人员列表,默认当前登录人所在公司,map", notes = "查询指定公司、指定人员类型的人员列表,默认当前登录人所在公司,map")
public ResponseModel<Map<String, List<TzsUserInfoVo>>> getBizUserInfosByUnitCodeMap(@ApiParam(value = "公司编码") @RequestParam(required = false) String unitCode,
@ApiParam(value = "人员类型", allowableValues = "jy,jc") @RequestParam String personType) {
if (StringUtils.isEmpty(unitCode)) {
ReginParams reginParams = getSelectedOrgInfo();
unitCode = reginParams.getCompany().getCompanyCode();
}
// 前端表单特殊结构封装 ,key有用不能更换
Map<String, List<TzsUserInfoVo>> result = new HashMap<>();
result.put("userInfos", jyjcOpeningApplicationServiceImpl.getUserListByUnitCodeAndPost(unitCode, personType));
return ResponseHelper.buildResponse(result);
}
} }
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl; package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -16,12 +17,15 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo; ...@@ -16,12 +17,15 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.vo.TzsUserInfoVo;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.commons.lang3.ObjectUtils;
import org.redisson.api.RBucket; import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -29,6 +33,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext; ...@@ -29,6 +33,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author Administrator * @author Administrator
...@@ -88,6 +93,8 @@ public class CommonServiceImpl { ...@@ -88,6 +93,8 @@ public class CommonServiceImpl {
return userInfoMapper.selectList(userInfoQueryWrapper); return userInfoMapper.selectList(userInfoQueryWrapper);
} }
private void castPersonType2Post(LambdaQueryWrapper<TzsUserInfo> userInfoQueryWrapper, String personType) { private void castPersonType2Post(LambdaQueryWrapper<TzsUserInfo> userInfoQueryWrapper, String personType) {
if (personType.equals(OpenBizTypeEnum.JY.getCode())) { if (personType.equals(OpenBizTypeEnum.JY.getCode())) {
userInfoQueryWrapper.like(TzsUserInfo::getPost, jyUserPost); userInfoQueryWrapper.like(TzsUserInfo::getPost, jyUserPost);
......
...@@ -148,6 +148,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -148,6 +148,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
/** /**
* 编辑、工作台暂存逻辑 * 编辑、工作台暂存逻辑
*
* @param model 对象 * @param model 对象
* @return JyjcOpeningApplicationModel * @return JyjcOpeningApplicationModel
*/ */
...@@ -177,6 +178,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -177,6 +178,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
/** /**
* 提交、保存并提交逻辑 * 提交、保存并提交逻辑
*
* @param model 对象 * @param model 对象
* @return JyjcOpeningApplicationModel * @return JyjcOpeningApplicationModel
*/ */
...@@ -401,10 +403,9 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -401,10 +403,9 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
jyjcOpeningApplicationModel.setOpenBizType(OpenBizTypeEnum.JY.getCode()); jyjcOpeningApplicationModel.setOpenBizType(OpenBizTypeEnum.JY.getCode());
unitCode = reginParams.getCompany().getCompanyCode(); unitCode = reginParams.getCompany().getCompanyCode();
jyjcOpeningApplicationModel.setUnitCodeName(reginParams.getCompany().getCompanyName()); jyjcOpeningApplicationModel.setUnitCodeName(reginParams.getCompany().getCompanyName());
jyjcOpeningApplicationModel.setUnitCode(unitCode);
// 设置检测资质信息,前端需要按照开通的业务类型自行过滤,全部数据 // 设置检测资质信息,前端需要按照开通的业务类型自行过滤,全部数据
setBaseUnitLicences(unitCode, jyjcOpeningApplicationModel, false); setBaseUnitLicences(unitCode, jyjcOpeningApplicationModel, false);
// 设置检验、检测人员信息,前端需要按照开通的业务类型自行过滤,全部数据
setJYJCUserList(unitCode, jyjcOpeningApplicationModel, false);
// 设置业务有效期的默认值与yjcOpeningApplicationModel.setOpenBizType(OpenBizTypeEnum.JY.getCode())对应 // 设置业务有效期的默认值与yjcOpeningApplicationModel.setOpenBizType(OpenBizTypeEnum.JY.getCode())对应
setDefaultExpiryDate(jyjcOpeningApplicationModel); setDefaultExpiryDate(jyjcOpeningApplicationModel);
} }
...@@ -519,6 +520,39 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -519,6 +520,39 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
} }
} }
private void castPersonType2Post(LambdaQueryWrapper<TzsUserInfo> userInfoQueryWrapper, String personType) {
if (personType.equals(OpenBizTypeEnum.JY.getCode())) {
userInfoQueryWrapper.like(TzsUserInfo::getPost, jyUserPost);
}
if (personType.equals(OpenBizTypeEnum.JC.getCode())) {
userInfoQueryWrapper.like(TzsUserInfo::getPost, jcUserPost);
}
}
public List<TzsUserInfoVo> getUserListByUnitCodeAndPost(String unitCode, String personType) {
LambdaQueryWrapper<TzsUserInfo> userInfoQueryWrapper = new LambdaQueryWrapper<>();
userInfoQueryWrapper.eq(TzsUserInfo::getUnitCode, unitCode);
this.castPersonType2Post(userInfoQueryWrapper, personType);
userInfoQueryWrapper.eq(BaseEntity::getIsDelete, false);
List<TzsUserInfo> userInfos = userInfoMapper.selectList(userInfoQueryWrapper);
return userInfos.stream().map(userInfo -> {
TzsUserInfoVo vo = new TzsUserInfoVo();
BeanUtils.copyProperties(userInfo, vo, "identification", "profile", "permissionItem", "appointDoc");
if (!ObjectUtils.isEmpty(userInfo.getPermissionItem())) {
vo.setPermissionItem(JSON.parseArray(userInfo.getPermissionItem()));
vo.setPermissionItemName(this.castItemCode2Name(userInfo.getPermissionItem()));
}
if (!ObjectUtils.isEmpty(userInfo.getPost())) {
vo.setPost(JSON.parseArray(userInfo.getPost()));
}
if (!ObjectUtils.isEmpty(userInfo.getAppointDoc())) {
vo.setAppointDoc(JSON.parseArray(userInfo.getAppointDoc()));
}
vo.setPermissionLevelName(this.getDictNameByCode(userInfo.getPermissionLevel()));
return vo;
}).collect(Collectors.toList());
}
private String castItemCode2Name(String permissionItem) { private String castItemCode2Name(String permissionItem) {
if (permissionItemList == null) { if (permissionItemList == null) {
FeignClientResult<List<DictionarieValueModel>> itemDicts = Systemctl.dictionarieClient.dictValues(ZZXM_JYJC_DICT_KEY); FeignClientResult<List<DictionarieValueModel>> itemDicts = Systemctl.dictionarieClient.dictValues(ZZXM_JYJC_DICT_KEY);
......
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