Fancy
2025-01-07 28f6317f7189d5c4a7e64f57dd6c7fc2011f8632
attend user
4个文件已修改
42 ■■■■■ 已修改文件
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaAssemblyWorkLastMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportCtrl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportSv.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaAssemblyWorkLastMapper.java
@@ -3,7 +3,9 @@
import cn.hutool.json.JSONObject;
import com.dy.pmsGlobal.pojoSta.StaAssemblyWorkLast;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -38,4 +40,6 @@
    StaAssemblyWorkLast existsEntity(StaAssemblyWorkLast record);
    List<JSONObject> queryWorkList();
    List<JSONObject> queryAttendUser(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("todayDt") Date todayDt);
}
pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
@@ -366,6 +366,28 @@
                                     LEFT JOIN ba_user us  ON FIND_IN_SET(us.id,w.assistants) GROUP BY w.id
            ) sawl ON ps.id = sawl.station_id
    </select>
    <select id="queryAttendUser" resultType="cn.hutool.json.JSONObject">
        WITH  total AS    (
        SELECT DISTINCT user_id,dt AS login_time FROM sta_assembly_work_last
        union
        SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(a.assistants, ',', b.help_topic_id + 1 ), ',', - 1 ) AS user_id ,login_time
        FROM
        (SELECT assistants ,dt AS login_time FROM sta_assembly_work_last)  a
        JOIN mysql.help_topic AS b ON b.help_topic_id <![CDATA[ < ]]> ( LENGTH( a.assistants ) - LENGTH( REPLACE ( a.assistants, ',', '' ) ) + 1 )
        union
        SELECT DISTINCT user_id ,end_time AS login_time FROM sta_assembly_work_history WHERE end_time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP}
        union
        SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(c.assistants, ',', d.help_topic_id + 1 ), ',', - 1 ) AS user_id ,login_time
        FROM
        (SELECT assistants,end_time AS login_time FROM sta_assembly_work_history WHERE end_time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP})  c
        JOIN mysql.help_topic AS d ON d.help_topic_id <![CDATA[ < ]]> ( LENGTH( c.assistants ) - LENGTH( REPLACE ( c.assistants, ',', '' ) ) + 1 ))
        SELECT MAX(CASE record.title WHEN 'require_attend' THEN record.count_user ELSE 0 END) require_attend,
        MAX(CASE record.title WHEN 'actual_attend' THEN record.count_user ELSE 0 END) actual_attend
        FROM
        (SELECT COUNT(DISTINCT user_id) AS count_user,'require_attend' AS title  FROM total WHERE user_id !=''
        UNION
        SELECT COUNT(DISTINCT user_id) AS count_user,'actual_attend' AS title  FROM total WHERE user_id !=''  AND login_time <![CDATA[ < ]]>  #{todayDt,jdbcType=TIMESTAMP}) record
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete
pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportCtrl.java
@@ -76,6 +76,15 @@
    /**
     * 任务看板  查询在产任务看板
     * */
    @GetMapping(path="queryAttendUser")
    @Log("查询人员出勤率")
    public BaseResponse<List<JSONObject>> queryAttendUser(){
        List<JSONObject> list = sv.queryAttendUser();
        return BaseResponseUtils.buildSuccess(list);
    }
    /**
     * 任务看板  查询在产任务看板
     * */
    @GetMapping(path="queryOrderList")
    @Log("查询订单看板")
    public BaseResponse<List<JSONObject>> queryOrderList(){
pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/screen/ScreenReportSv.java
@@ -214,4 +214,11 @@
        List<JSONObject> list = deviceProductionLogDao.queryTopError(startDt, endDt);
        return list;
    }
    public List<JSONObject> queryAttendUser() {
        Date startDt = Date.from(LocalDateTime.of(LocalDate.now().minusDays(2000), LocalTime.of(0, 0, 0)).atZone(ZoneId.systemDefault()).toInstant());
        Date endDt = new Date();
        Date todayDt = Date.from(LocalDateTime.of(LocalDate.now(), LocalTime.of(0, 0, 0)).atZone(ZoneId.systemDefault()).toInstant());
        List<JSONObject> list = assemblyWorkLastDao.queryAttendUser(startDt, endDt,todayDt);
        return list;
    }
}