Commit 8bf45a47 authored by tianyiming's avatar tianyiming

9411 3.6 在岗人员

parent b5ad4194
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.service.DutyDetailsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
/**
* 获取用户信息
*
*/
@RestController
@RequestMapping(value = "/org/user")
@Api(tags = "用户信息api")
public class OrgUserController {
@Autowired
DutyDetailsService dutyDetailsService;
@Autowired
RedisUtils redisUtils;
/**
* 今日值班运维人员列表清单--分页
*
* @return ResponseModel
*/
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "duty-person/page-list")
@ApiOperation(httpMethod = "GET", value = "今日值班运维人员列表清单", notes = "今日值班运维人员列表清单")
public ResponseModel<IPage<Map<String, Object>>> dutyPersonPageList(
@ApiParam(value = "当前页", required = true) @RequestParam(value = "current") int current,
@ApiParam(value = "页面大小", required = true) @RequestParam(value = "size") int size) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
return ResponseHelper.buildResponse(dutyDetailsService.dutyPersonPageList(current, size, bizOrgCode));
}
}
\ No newline at end of file
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
public interface DutyDetailsMapper {
IPage<Map<String, Object>> selectDutyPersonList(Page page, @Param(value = "dutyDate") String dutyDate, @Param(value = "bizOrgCode") String bizOrgCode);
}
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.Map;
/**
* 服务类
*
*/
public interface DutyDetailsService {
IPage<Map<String, Object>> dutyPersonPageList(int current, int size, String bizOrgCode);
}
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.mapper.DutyDetailsMapper;
import com.yeejoin.equipmanage.service.DutyDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@Service
public class DutyDetailsImpl implements DutyDetailsService {
@Autowired
private DutyDetailsMapper dutyDetailsMapper;
@Autowired
RedisUtils redisUtils;
@Override
public IPage<Map<String, Object>> dutyPersonPageList(int current, int size,String bizOrgCode) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dutyDate = sdf.format(new Date());
Page page = new Page();
if (current > 0){
page.setCurrent((long) (current - 1) *size);
page.setSize(size);
}
return dutyDetailsMapper.selectDutyPersonList(page, dutyDate, 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.equipmanage.mapper.DutyDetailsMapper">
<select id='selectDutyPersonList' resultType="java.util.Map">
SELECT
c.biz_org_name,
IFNULL(c.personImg,'') personImg,
IFNULL(c.job_title,'') job_title,
IFNULL(c.telephone,'') telephone,
d.duty_date
FROM
cb_org_usr c
RIGHT JOIN d_duty_details d ON c.amos_org_id = d.user_id
WHERE
d.duty_date like concat('%',#{dutyDate},'%')
<if test="bizOrgCode != null and bizOrgCode!='' ">
and c.biz_org_code like concat(#{bizOrgCode},'%')
</if>
ORDER BY
d.duty_date DESC
</select>
</mapper>
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