考勤ID增加Cfg_ID
parent
fdc8f217d9
commit
e2c98b0c3a
|
|
@ -14,3 +14,19 @@ WHERE ac.is_default = 1 AND ac.enabled = 1
|
|||
) ac ON pmad.project_id = ac.project_id
|
||||
SET pmad.cfg_id = ac.cfg_id
|
||||
WHERE pmad.att_device = 'device' AND pmad.cfg_id = 0;
|
||||
|
||||
### 2.attendance_ubi_data表增加cfg_id保存配置ID
|
||||
|
||||
更新历史数据
|
||||
|
||||
UPDATE attendance_ubi_data a
|
||||
SET cfg_id = (
|
||||
SELECT id
|
||||
FROM attendance_cfg
|
||||
WHERE project_id = a.projectid
|
||||
AND com_id = a.comId
|
||||
AND is_default = 1
|
||||
AND enabled = 1
|
||||
LIMIT 1
|
||||
)
|
||||
WHERE a.cfg_id IS NULL;
|
||||
|
|
|
|||
|
|
@ -1736,6 +1736,7 @@ CREATE TABLE `attendance_ubi_data` (
|
|||
`comName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '公司名称',
|
||||
`projectId` int DEFAULT NULL COMMENT '项目ID',
|
||||
`projectName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '项目名称',
|
||||
`cfg_id` int DEFAULT NULL COMMENT '配置ID',
|
||||
`sub_dept_id` int DEFAULT NULL COMMENT '单位ID',
|
||||
`sub_dept_name` varchar(255) DEFAULT NULL COMMENT '单位名称',
|
||||
`userId` int DEFAULT NULL COMMENT '用户ID',
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ public class AttendanceUbiData extends BaseEntity
|
|||
@Excel(name = "项目ID")
|
||||
private Long projectId;
|
||||
|
||||
/** 配置ID */
|
||||
@Excel(name = "配置ID")
|
||||
private Long cfgId;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
|
@ -180,6 +184,15 @@ public class AttendanceUbiData extends BaseEntity
|
|||
{
|
||||
return projectId;
|
||||
}
|
||||
public void setCfgId(Long cfgId)
|
||||
{
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
|
||||
public Long getCfgId()
|
||||
{
|
||||
return cfgId;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
|
|
|
|||
|
|
@ -64,8 +64,18 @@ public interface AttendanceUbiDataMapper
|
|||
*/
|
||||
public int deleteAttendanceUbiDataByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询考勤统计
|
||||
* @param attendanceUbiData 查询条件
|
||||
* @return 考勤统计集合
|
||||
*/
|
||||
List<AttendanceUbiData> queryStatistics(AttendanceUbiData attendanceUbiData);
|
||||
|
||||
/**
|
||||
* 根据用户ID列表查询考勤信息
|
||||
* @param attendanceUbiData 查询条件
|
||||
* @return 考勤信息集合
|
||||
*/
|
||||
List<AttendanceUbiData> queryStatisticsByUserIds(AttendanceUbiData attendanceUbiData);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="comName" column="comName"/>
|
||||
<result property="projectName" column="projectName"/>
|
||||
<result property="projectId" column="projectId" />
|
||||
<result property="cfgId" column="cfg_id" />
|
||||
<result property="subDeptId" column="sub_dept_id" />
|
||||
<result property="subDeptName" column="sub_dept_name" />
|
||||
<result property="userId" column="userId" />
|
||||
|
|
@ -37,13 +38,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectAttendanceUbiDataVo">
|
||||
select id, comId, projectId, userId, userName, sub_dept_group, sub_dept_group_name, craft_type, craft_post,admitGuid,
|
||||
select id, comId, projectId, cfg_id, userId, userName, sub_dept_group, sub_dept_group_name, craft_type, craft_post,admitGuid,
|
||||
eventGuid,inPhoto,outPhoto,comName,projectName,sub_dept_id,sub_dept_name,work_area_id,
|
||||
inTime, outTime, deviceNo, is_del, state, remark, create_by, create_time, update_by, update_time from attendance_ubi_data
|
||||
</sql>
|
||||
|
||||
<sql id="selectAttendanceUbiDataAllVo">
|
||||
select id, comId, projectId, userId, userName, sub_dept_group, sub_dept_group_name, craft_type, craft_post,admitGuid,
|
||||
select id, comId, projectId, cfg_id, userId, userName, sub_dept_group, sub_dept_group_name, craft_type, craft_post,admitGuid,
|
||||
eventGuid,inPhoto,outPhoto,inData,outData,comName,projectName,sub_dept_id,sub_dept_name,work_area_id,
|
||||
inTime, outTime, deviceNo, is_del, state, remark, create_by, create_time, update_by, update_time from attendance_ubi_data
|
||||
</sql>
|
||||
|
|
@ -235,7 +236,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select u.craft_type as craftType, count(1) as total from attendance_ubi_data d
|
||||
left join pro_project_info_subdepts_users u on u.user_id = d.userId
|
||||
<where>
|
||||
<if test="projectId != null "> and d.projectId = #{projectId}</if>
|
||||
<if test="projectId != null ">
|
||||
and d.projectId = #{projectId}
|
||||
and d.cfg_id in (select id from attendance_cfg where project_id=#{projectId} and is_default=1 and enabled=1)
|
||||
</if>
|
||||
<if test="subDeptId != null "> and d.sub_dept_id = #{subDeptId}</if>
|
||||
<if test="subDeptGroup != null "> and d.sub_dept_group = #{subDeptGroup}</if>
|
||||
and date(d.create_time) = CURDATE()
|
||||
|
|
@ -247,7 +251,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select DATE_FORMAT(days.attendanceTime, '%m-%d') as attendanceTime,days.total from(
|
||||
select date(d.create_time) as attendanceTime, count(1) as total from attendance_ubi_data d
|
||||
<where>
|
||||
<if test="projectId != null "> and d.projectId = #{projectId}</if>
|
||||
<if test="projectId != null ">
|
||||
and d.projectId = #{projectId}
|
||||
and d.cfg_id in (select id from attendance_cfg where project_id=#{projectId} and is_default=1 and enabled=1)
|
||||
</if>
|
||||
<if test="subDeptId != null "> and d.sub_dept_id = #{subDeptId}</if>
|
||||
<if test="subDeptGroup != null "> and d.sub_dept_group = #{subDeptGroup}</if>
|
||||
and date(d.create_time) >= CURDATE() - INTERVAL 7 DAY
|
||||
|
|
@ -261,7 +268,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT dt comName, count(1) comId
|
||||
from (SELECT DISTINCT userid, date (ifNull(inTime, outTime)) dt from attendance_ubi_data
|
||||
<where>
|
||||
<if test="prjId != null "> and projectid = #{prjId}</if>
|
||||
<if test="prjId != null ">
|
||||
and projectid = #{prjId}
|
||||
and cfg_id in (select id from attendance_cfg where project_id=#{prjId} and is_default=1 and enabled=1)
|
||||
</if>
|
||||
and is_del = 0
|
||||
and date(ifNull(inTime,outTime)) <![CDATA[ >= ]]> date(#{dateStart}) and date(ifNull(outTime,inTime)) <![CDATA[ <= ]]> date(#{dateEnd})
|
||||
</where>
|
||||
|
|
@ -272,6 +282,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getRealAttendance" resultMap="AttendanceUbiDataResult">
|
||||
<include refid="selectAttendanceUbiDataVo"/>
|
||||
where projectid=#{prjId} and is_del=0 and date(ifNull(inTime,outTime)) = date(CURDATE())
|
||||
and cfg_id in (select id from attendance_cfg where project_id=#{prjId} and is_default=1 and enabled=1)
|
||||
order by ifNull(inTime,outTime) DESC
|
||||
LIMIT 4
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ public class UniCallBackController {
|
|||
ProProjectInfoSubdeptsUsers proUser = userList.get(0);
|
||||
AttendanceUbiData addData = new AttendanceUbiData();
|
||||
addData.setAdmitGuid(admitGuid);
|
||||
addData.setCfgId(cfgId);
|
||||
addData.setComName(proUser.getComName());
|
||||
addData.setProjectName(proUser.getProjectName());
|
||||
addData.setSubDeptId(proUser.getSubDeptId());
|
||||
|
|
|
|||
|
|
@ -69,6 +69,11 @@ public interface IAttendanceCfgService
|
|||
*/
|
||||
AttendanceCfg selectDefaultCfgByProjectAndCom(Long projectId, Long comId);
|
||||
|
||||
/**
|
||||
* 根据项目ID和公司ID获取默认考勤配置
|
||||
*/
|
||||
AttendanceCfg getDefaultAttendanceCfg(Long projectId, Long comId);
|
||||
|
||||
/**
|
||||
* 根据设备编号查询默认配置
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -177,6 +177,14 @@ public class AttendanceCfgServiceImpl implements IAttendanceCfgService
|
|||
return attendanceCfgMapper.selectDefaultCfgByProjectAndCom(projectId, comId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目ID和公司ID获取默认考勤配置
|
||||
*/
|
||||
@Override
|
||||
public AttendanceCfg getDefaultAttendanceCfg(Long projectId, Long comId) {
|
||||
return attendanceCfgMapper.selectDefaultCfgByProjectAndCom(projectId, comId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备编号查询默认配置
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -11,11 +11,13 @@ import com.yanzhu.common.core.enums.UserPostEnums;
|
|||
import com.yanzhu.common.core.utils.DateUtils;
|
||||
import com.yanzhu.common.core.utils.StringUtils;
|
||||
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||
import com.yanzhu.manage.domain.AttendanceCfg;
|
||||
import com.yanzhu.manage.domain.AttendanceUbiData;
|
||||
import com.yanzhu.manage.domain.ProMobileAttendanceData;
|
||||
import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers;
|
||||
import com.yanzhu.manage.mapper.AttendanceUbiDataMapper;
|
||||
import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper;
|
||||
import com.yanzhu.manage.service.IAttendanceCfgService;
|
||||
import com.yanzhu.manage.service.IAttendanceUbiDataService;
|
||||
import com.yanzhu.manage.service.IProProjectInfoSubdeptsUsersService;
|
||||
import com.yanzhu.system.mapper.SysDictDataMapper;
|
||||
|
|
@ -44,6 +46,10 @@ public class AttendanceUbiDataServiceImpl implements IAttendanceUbiDataService
|
|||
@Autowired
|
||||
private ProProjectInfoSubdeptsUsersMapper proProjectInfoSubdeptsUsersMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IAttendanceCfgService attendanceCfgService;
|
||||
|
||||
@Autowired
|
||||
private IProProjectInfoSubdeptsUsersService proProjectInfoSubdeptsUsersService;
|
||||
/**
|
||||
|
|
@ -320,6 +326,8 @@ public class AttendanceUbiDataServiceImpl implements IAttendanceUbiDataService
|
|||
if(user==null){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
attendance.setProjectId(attData.getProjectId());
|
||||
attendance.setUserId(user.getUserId());
|
||||
attendance.setIsDel(0L);
|
||||
|
|
@ -353,6 +361,11 @@ public class AttendanceUbiDataServiceImpl implements IAttendanceUbiDataService
|
|||
attendance.setId(list.get(0).getId());
|
||||
return updateAttendanceUbiData(attendance);
|
||||
}else{
|
||||
//根据projectId+comId获取默认考勤配置
|
||||
AttendanceCfg attendanceCfg=attendanceCfgService.getDefaultAttendanceCfg(attData.getProjectId(),user.getComId());
|
||||
if(attendanceCfg!=null){
|
||||
attendance.setCfgId(attendanceCfg.getId());
|
||||
}
|
||||
return insertAttendanceUbiData(attendance);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue