| | |
| | | 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; |
| | | |
| | |
| | | StaAssemblyWorkLast existsEntity(StaAssemblyWorkLast record); |
| | | |
| | | List<JSONObject> queryWorkList(); |
| | | |
| | | List<JSONObject> queryAttendUser(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("todayDt") Date todayDt); |
| | | } |
| | |
| | | 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 |
| | |
| | | /** |
| | | * 任务看板 查询在产任务看板 |
| | | * */ |
| | | @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(){ |
| | |
| | | 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; |
| | | } |
| | | } |