Commit cfe322d2 authored by 李腾威's avatar 李腾威

修改单位树接口 单位/机构/人员 批量导入

parent 8dd06002
...@@ -16,12 +16,9 @@ import org.apache.ibatis.annotations.Param; ...@@ -16,12 +16,9 @@ import org.apache.ibatis.annotations.Param;
* @date 2021-06-18 * @date 2021-06-18
*/ */
public interface OrgUsrMapper extends BaseMapper<OrgUsr> { public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
/**
* 根据parent_id查上级机构名
* @param biz_org_code
* @return
*/
String selectUpUnitByParam(@Param("biz_org_code")String biz_org_code); String selectUpUnitByParam(@Param("biz_org_code")String biz_org_code);
List<Map<String, Object>> selectPersonList(Map<String, Object> map); List<Map<String, Object>> selectPersonList(Map<String, Object> map);
List<OrgUsr> selectCompanyDepartmentMsg();
} }
...@@ -103,4 +103,6 @@ public interface IOrgUsrService { ...@@ -103,4 +103,6 @@ public interface IOrgUsrService {
* @throws Exception * @throws Exception
*/ */
Map<String, Object> selectForShowById (OrgUsr orgUsr,Long id) throws Exception; Map<String, Object> selectForShowById (OrgUsr orgUsr,Long id) throws Exception;
List<OrgUsr> selectCompanyDepartmentMsg();
} }
package com.yeejoin.amos.boot.module.jcs.api.vo; package com.yeejoin.amos.boot.module.jcs.api.vo;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
......
...@@ -4,7 +4,6 @@ import java.io.Serializable; ...@@ -4,7 +4,6 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
...@@ -14,29 +14,18 @@ ...@@ -14,29 +14,18 @@
</if> </if>
</select> </select>
<select id="selectPersonList" resultType="Map"> <select id="selectCompanyDepartmentMsg" resultType="com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr">
select * from ( SELECT
SELECT sequence_nbr,
DISTINCT biz_org_name,
u.sequence_nbr sequenceNbr, biz_org_type,
u.biz_org_name bizOrgName, parent_id
u.biz_org_code bizOrgCode, FROM
<if test="fields != null"> `cb_org_usr`
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then v.field_value end) ${item}</foreach> WHERE
</if> is_delete = 0
FROM and biz_org_type = "COMPANY" or biz_org_type = "DEPARTMENT"
cb_org_usr u LEFT JOIN </select>
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
where u.parent_id = #{parentId}
AND u.biz_org_type = #{bizOrgType}
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
)a where a.sequenceNbr is not null
LIMIT #{pageNum}, #{pageSize}
</select>
</mapper> </mapper>
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller; ...@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
...@@ -13,11 +12,9 @@ import java.util.Map; ...@@ -13,11 +12,9 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFromValueDto;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertFormValueVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgDepartmentFormVo; import com.yeejoin.amos.boot.module.jcs.api.vo.OrgDepartmentFormVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgMenuVo; import com.yeejoin.amos.boot.module.jcs.api.vo.OrgMenuVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgUsrFormVo;
import org.apache.commons.lang3.StringUtils; 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.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -37,7 +34,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -37,7 +34,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils; import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue; import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgDepartmentVo; import com.yeejoin.amos.boot.module.jcs.api.vo.OrgDepartmentVo;
......
...@@ -2,8 +2,6 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller; ...@@ -2,8 +2,6 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -13,25 +11,18 @@ import java.util.Map; ...@@ -13,25 +11,18 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgDepartmentFormVo;
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.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils; import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr;
...@@ -178,7 +169,7 @@ public class OrgPersonController { ...@@ -178,7 +169,7 @@ public class OrgPersonController {
/** /**
* *
* * 根据orgCode查询
* @param orgCode * @param orgCode
* @return * @return
*/ */
...@@ -211,21 +202,21 @@ public class OrgPersonController { ...@@ -211,21 +202,21 @@ public class OrgPersonController {
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
// /** /**
// * * 导入人员信息
// * *
// * @param orgCode * @return
// * @return */
// */ @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @RequestMapping(value = "/saveDepartment", method = RequestMethod.POST)
// @RequestMapping(value = "/{orgCode}/users", method = RequestMethod.GET) @ApiOperation(httpMethod = "POST", value = "导入人员信息", notes = "导入人员信息")
// @ApiOperation(httpMethod = "GET", value = "根据orgCode查询人员", notes = "根据orgCode查询人员") public ResponseModel saveCompany(HttpServletRequest request, @RequestBody List<OrgPersonVo> OrgPersonVo) {
// public ResponseModel selectUsersByOrgCode(HttpServletRequest request, String pageNum, String pageSize, @PathVariable Long orgCode) { for (int i = 0; i < OrgPersonVo.size(); i++) {
// Map<String, Object> columnMap = new HashMap<>(); OrgUsr orgUsr = new OrgUsr();
// columnMap.put("is_delete",CommonConstant.IS_DELETE_00); BeanUtils.copyProperties(OrgPersonVo.get(i), orgUsr);
// columnMap.put("biz_org_code", orgCode); orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
// columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON); iOrgUsrService.saveOrgUsrAlertFormValue(orgUsr,OrgPersonVo.get(i).getAlertFormValue());
// return ResponseHelper.buildResponse( iOrgUsrService.listByMap(columnMap)); }
// } return ResponseHelper.buildResponse(null);
}
} }
...@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller; ...@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -13,8 +12,6 @@ import java.util.Map; ...@@ -13,8 +12,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFromValueDto;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertFormValueVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgMenuVo; import com.yeejoin.amos.boot.module.jcs.api.vo.OrgMenuVo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -36,7 +33,6 @@ import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; ...@@ -36,7 +33,6 @@ import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils; import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue; import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgDepartmentVo; import com.yeejoin.amos.boot.module.jcs.api.vo.OrgDepartmentVo;
...@@ -164,19 +160,19 @@ public class OrgUsrController extends BaseController { ...@@ -164,19 +160,19 @@ public class OrgUsrController extends BaseController {
/** /**
* 获取单位树
* *
* 获取单位部门树
* @param * @param
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTree", method = RequestMethod.GET) @RequestMapping(value = "/companyTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取单位树", notes = "获取单位树") @ApiOperation(httpMethod = "GET", value = "获取单位部门树", notes = "获取单位部门树")
public ResponseModel< List<OrgMenuVo>>selectCompanyTree() throws Exception { public ResponseModel< List<OrgMenuVo>>selectCompanyTree() throws Exception {
Map<String, Object> columnMap = new HashMap<>(); Map<String, Object> columnMap = new HashMap<>();
columnMap.put("is_delete", CommonConstant.IS_DELETE_00); columnMap.put("is_delete", CommonConstant.IS_DELETE_00);
columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_COMPANY); columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_COMPANY);
List<OrgMenuVo> menus = iOrgUsrService.getTree(null, iOrgUsrService.listByMap(columnMap), OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType"); List<OrgMenuVo> menus = iOrgUsrService.getTree(null, iOrgUsrService.selectCompanyDepartmentMsg(), OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType");
return ResponseHelper.buildResponse(menus); return ResponseHelper.buildResponse(menus);
} }
...@@ -236,15 +232,35 @@ public class OrgUsrController extends BaseController { ...@@ -236,15 +232,35 @@ public class OrgUsrController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/saveDepartment", method = RequestMethod.POST) @RequestMapping(value = "/saveDepartment", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "导入部门信息", notes = "导入部门信息") @ApiOperation(httpMethod = "POST", value = "导入部门信息", notes = "导入部门信息")
public ResponseModel saveDepartment(HttpServletRequest request, @RequestBody OrgDepartmentVo OrgDepartmentVo, @PathVariable Long id) { public ResponseModel saveDepartment(HttpServletRequest request, @RequestBody List<OrgDepartmentVo> OrgDepartmentVo, @PathVariable Long id) {
// 导入部门信息的前提条件:单位信息已经存在 for (int i = 0; i < OrgDepartmentVo.size(); i++) {
if (iOrgUsrService.getById(id) == null) { // 导入部门信息的前提条件:单位信息已经存在
return ResponseHelper.buildResponse("单位信息需存在才可导入部门信息"); if (iOrgUsrService.getById(id) == null) {
return ResponseHelper.buildResponse("单位信息需存在才可导入部门信息");
}
OrgUsr orgUsr = new OrgUsr();
BeanUtils.copyProperties(OrgDepartmentVo.get(i), orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_DEPARTMENT);
iOrgUsrService.saveOrgUsrAlertFormValue(orgUsr,OrgDepartmentVo.get(i).getAlertFormValue());
}
return ResponseHelper.buildResponse(null);
}
/**
* 导入单位信息
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/saveDepartment", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "导入单位信息", notes = "导入单位信息")
public ResponseModel saveCompany(HttpServletRequest request, @RequestBody List<OrgUsrVo> OrgUsrVo) {
for (int i = 0; i < OrgUsrVo.size(); i++) {
OrgUsr orgUsr = new OrgUsr();
BeanUtils.copyProperties(OrgUsrVo.get(i), orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY);
iOrgUsrService.saveOrgUsrAlertFormValue(orgUsr,OrgUsrVo.get(i).getAlertFormValue());
} }
OrgUsr orgUsr = new OrgUsr();
BeanUtils.copyProperties(OrgDepartmentVo, orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_DEPARTMENT);
iOrgUsrService.saveOrgUsrAlertFormValue(orgUsr,OrgDepartmentVo.getAlertFormValue());
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
......
...@@ -21,7 +21,6 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -21,7 +21,6 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -379,4 +378,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto,OrgUsr,OrgUsrMappe ...@@ -379,4 +378,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto,OrgUsr,OrgUsrMappe
} }
return result; return result;
} }
@Override
public List<OrgUsr> selectCompanyDepartmentMsg() {
return this.baseMapper.selectCompanyDepartmentMsg();
}
} }
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