Commit 2adfedb4 authored by chenzhao's avatar chenzhao

值班管理卡片接口

parent 1db7e543
......@@ -149,6 +149,9 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
* @return
*/
Page<Map<String, Object>> getPersonInfoByPage(Page page, @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> dutyCardCount( @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> dutyCardList (@Param("bizOrgCode") String bizOrgCode);
}
......@@ -34,6 +34,11 @@ public interface IDutyCommonService {
*/
IPage<Map<String, Object>> pageListDetail(int current, int size, String beginDate, String endDate, String bizOrgCode) throws ParseException;
List<Map<String, Object>> dutyCardCount(String bizOrgCode)throws ParseException;
List<Map<String, Object>> dutyCardList(String bizOrgCode)throws ParseException;
/**
* 值班明细
*
......@@ -47,7 +52,6 @@ public interface IDutyCommonService {
*
* @param beginDate
* @param endDate
* @param dutyType
* @return
* @throws ParseException
*/
......
......@@ -623,4 +623,131 @@ WHERE
HAVING
peopleType = 1602
</select>
<select id="dutyCardCount" resultType="java.util.Map">
SELECT
'1601' as peopleType,
count(*) as total
from
(SELECT
c.sequence_nbr as id,
c.biz_org_name as userName,
IFNULL( cf.mobile_phone, '' ) telephone,
'驻站消防员' as peopleType
FROM
cb_org_usr c
RIGHT JOIN cb_sign cs ON c.sequence_nbr = cs.USER_ID
LEFT JOIN cb_firefighters cf ON CONCAT( c.sequence_nbr, '' ) = cf.org_usr_id
AND cf.is_delete = 0
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = c.sequence_nbr
AND cfp.is_delete = 0
WHERE
c.sequence_nbr IS NOT NULL
AND cs.sign_time LIKE concat( CURRENT_DATE ( ), '%' )
AND c.biz_org_code LIKE concat(#{bizOrgCode},'%')
GROUP BY
cs.USER_ID
ORDER BY
cs.sign_time DESC) d
union all
SELECT
b.peopleType,
count( * ) as total
FROM
(
SELECT
ou.sequence_nbr AS id,
ou.biz_org_name AS userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IF
(
MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END ) = '',
NULL,
MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END )
) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
(
SELECT
IFNULL( max( CASE WHEN fi.field_code = 'userId' THEN fi.field_value END ), ps.instance_id ) AS id
FROM
cb_duty_person_shift ps
LEFT JOIN cb_dynamic_form_instance fi ON fi.instance_id = ps.instance_id
WHERE
ps.duty_date = CURRENT_DATE
GROUP BY
fi.instance_id
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
where ou.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY
a.id
) b WHERE b.peopleType != '1601'
GROUP BY
peopleType
</select>
<select id="dutyCardList" resultType="java.util.Map">
(SELECT
c.sequence_nbr as id,
c.biz_org_name as userName,
IFNULL( cf.mobile_phone, '' ) telephone,
'驻站消防员' as peopleType
FROM
cb_org_usr c
RIGHT JOIN cb_sign cs ON c.sequence_nbr = cs.USER_ID
LEFT JOIN cb_firefighters cf ON CONCAT( c.sequence_nbr, '' ) = cf.org_usr_id
AND cf.is_delete = 0
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = c.sequence_nbr
AND cfp.is_delete = 0
WHERE
c.sequence_nbr IS NOT NULL
AND cs.sign_time LIKE concat( CURRENT_DATE ( ), '%' )
AND c.biz_org_code LIKE concat(#{bizOrgCode},'%')
GROUP BY
cs.USER_ID
ORDER BY
cs.sign_time DESC)
UNION all
(SELECT
id,
userName,
telephone,
(select name from cb_data_dictionary WHERE code = b.peopleType ) as peopleType
FROM
(
SELECT
ou.sequence_nbr AS id,
ou.biz_org_name AS userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IF
(
MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END ) = '',
NULL,
MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END )
) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
(
SELECT
IFNULL( max( CASE WHEN fi.field_code = 'userId' THEN fi.field_value END ), ps.instance_id ) AS id
FROM
cb_duty_person_shift ps
LEFT JOIN cb_dynamic_form_instance fi ON fi.instance_id = ps.instance_id
WHERE
ps.duty_date = CURRENT_DATE
GROUP BY
fi.instance_id
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
where ou.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY
a.id
) b WHERE b.peopleType != '1601')
</select>
</mapper>
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -24,6 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -79,6 +81,38 @@ public class DutyPersonController extends BaseController {
return ResponseHelper.buildResponse(iDutyPersonService.pageListDetail(current, size, beginDate, endDate, bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/cardDetailCount")
@ApiOperation(httpMethod = "GET", value = "值班管理卡片人员统计", notes = "值班管理卡片人员统计")
public ResponseModel<Map<String, Object>> cardDetail() throws ParseException {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String bizOrgCode = ObjectUtils.isEmpty(selectedOrgInfo) || ObjectUtils.isEmpty(selectedOrgInfo.getPersonIdentity()) ? "" : selectedOrgInfo.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return ResponseHelper.buildResponse(null);
}
Map<String, Object> map = new HashMap<>();
List<Map<String, Object>> maps = iDutyPersonService.dutyCardCount(bizOrgCode);
maps.forEach(e->map.put(e.get("peopleType").toString(),e.get("total")));
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/cardList")
@ApiOperation(httpMethod = "GET", value = "值班管理卡片人员统计", notes = "值班管理卡片人员统计")
public ResponseModel<List<Map<String, Object>>> cardList() throws ParseException {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String bizOrgCode = ObjectUtils.isEmpty(selectedOrgInfo) || ObjectUtils.isEmpty(selectedOrgInfo.getPersonIdentity()) ? "" : selectedOrgInfo.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return ResponseHelper.buildResponse(null);
}
return ResponseHelper.buildResponse(iDutyPersonService.dutyCardList(bizOrgCode));
}
/**
* 值班列表视图--不分页
*
......
......@@ -149,6 +149,17 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
return dynamicFormInstanceMapper.getPersonInfoByPage(new Page(current, size), bizOrgCode);
}
public List<Map<String, Object>> dutyCardCount(String bizOrgCode)
throws ParseException {
return dynamicFormInstanceMapper.dutyCardCount( bizOrgCode);
}
public List<Map<String, Object>> dutyCardList( String bizOrgCode)
throws ParseException {
return dynamicFormInstanceMapper.dutyCardList(bizOrgCode);
}
private void fillDutyShiftData(String beginDate, String endDate, Map<String, Object> m) throws ParseException {
// 获取值班的实例id
String instanceId = m.get("instanceId").toString();
......
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