Commit 410cc538 authored by lisong's avatar lisong

添加组织机构统计接口

parent 06f3d3aa
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.jcs.api.entity.Organization;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
public interface OrganizationMapper extends BaseMapper<Organization> {
Page<Map<String, Object>> getOrganizationInfo(Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode);
}
package com.yeejoin.amos.boot.module.jcs.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Map;
public interface OrganizationService {
Page<Map<String, Object>> getOrganizationInfo(Page<Map<String, Object>> page, String bizOrgCode);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationMapper">
<select id="getOrganizationInfo" resultType="java.util.Map">
SELECT
(
SELECT
Ifnull (GROUP_CONCAT( cou.biz_org_name ),'') AS
value
FROM
(
SELECT
cdfi.field_value AS userId
FROM
cb_dynamic_form_instance cdfi
WHERE
cdfi.instance_id IN (
SELECT
cdps.instance_id
FROM
cb_duty_person_shift cdps
LEFT JOIN cb_dynamic_form_instance cdfi ON cdps.instance_id = cdfi.instance_id
WHERE
cdfi.field_code = 'postType'
AND field_value = '1665'
AND cdps.duty_date = ( SELECT DATE_FORMAT(NOW(),"%Y-%m-%d"))
)
AND cdfi.field_code = 'userId'
) temp
LEFT JOIN cb_org_usr cou ON cou.sequence_nbr = temp.userId
) AS
value
,
'当值值长' AS name UNION
(
SELECT
(
SELECT
count( 1 ) AS num
FROM
cb_org_usr cou
LEFT JOIN cb_dynamic_form_instance cdfi ON cou.sequence_nbr = cdfi.instance_id
WHERE
cou.biz_org_type = 'PERSON'
AND cdfi.field_code = 'peopleType'
AND field_value = '1601'
AND cou.is_delete = 0
AND cou.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
) AS `value`,
'驻站消防员' AS name
) UNION
(
SELECT
( SELECT COUNT( 1 ) FROM cb_organization_user cou WHERE cou.emergency_team_id = co.sequence_nbr ) AS
value
,
co.emergency_team_name AS name
FROM
cb_organization co
ORDER BY
co.sort
LIMIT 4
)
</select>
</mapper>
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.alibaba.fastjson.JSON;
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.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
@RestController
@Api(tags = "组织机构")
@RequestMapping(value = "/organization")
public class OrganizationController extends BaseController {
@Autowired
private RedisUtils redisUtils;
@Autowired
private OrganizationService organizationService;
@PersonIdentify
@GetMapping(value = "/getOrganizationInfo")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "四横八纵", notes = "四横八棕-组织机构")
public ResponseModel getOrganizationInfo(@RequestParam(value = "pageNumber") int pageNumber,
@RequestParam(value = "pageSize") int pageSize ) {
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String bizOrgCode = null;
if(null != reginParam) {
bizOrgCode = reginParam.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
} else {
return CommonResponseUtil.success(null);
}
Page<Map<String, Object>> mapPage = new Page<>(pageNumber, pageSize);
return CommonResponseUtil.success(organizationService.getOrganizationInfo(mapPage, bizOrgCode));
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class OrganizationImpl implements OrganizationService {
@Autowired
private OrganizationMapper organizationMapper;
@Override
public Page<Map<String, Object>> getOrganizationInfo(Page<Map<String, Object>> page, String bizOrgCode) {
return organizationMapper.getOrganizationInfo(page, bizOrgCode);
}
}
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