同步考勤数据到黔送
This commit is contained in:
parent
a3b07c2b9c
commit
bbce2e5a2b
|
|
@ -9,9 +9,12 @@ import com.bonus.system.att.entity.OrgChangeBean;
|
||||||
import com.bonus.system.basic.domain.SysOrg;
|
import com.bonus.system.basic.domain.SysOrg;
|
||||||
import com.bonus.system.evection.entity.EvectionBean;
|
import com.bonus.system.evection.entity.EvectionBean;
|
||||||
import com.bonus.system.holiday.entity.HolidayBean;
|
import com.bonus.system.holiday.entity.HolidayBean;
|
||||||
|
import com.bonus.system.index.entity.MapBean;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序同步定时器
|
* 小程序同步定时器
|
||||||
|
|
@ -20,60 +23,34 @@ import java.util.List;
|
||||||
@Repository("WechatPushDao")
|
@Repository("WechatPushDao")
|
||||||
public interface WechatPushDao {
|
public interface WechatPushDao {
|
||||||
|
|
||||||
|
|
||||||
List<SysUser> getPersonList();
|
List<SysUser> getPersonList();
|
||||||
|
|
||||||
List<SysUser> getWeChatPersonList();
|
|
||||||
|
|
||||||
void insertWechatPerson(SysUser user);
|
|
||||||
|
|
||||||
void updateWechatPerson(SysUser user);
|
|
||||||
|
|
||||||
void updateWebPassword(SysUser wechatUser);
|
void updateWebPassword(SysUser wechatUser);
|
||||||
|
|
||||||
void updateWebOpenId(SysUser wechatUser);
|
void updateWebOpenId(SysUser wechatUser);
|
||||||
|
|
||||||
void updateWechatIsPd(SysUser user);
|
|
||||||
|
|
||||||
List<AttFaceBean> getWeChatFaceList();
|
|
||||||
|
|
||||||
List<AttFaceBean> getWebFaceList();
|
List<AttFaceBean> getWebFaceList();
|
||||||
|
|
||||||
void insertWebFace(AttFaceBean user);
|
void insertWebFace(AttFaceBean user);
|
||||||
|
|
||||||
void updateWebFace(AttFaceBean user);
|
void updateWebFace(AttFaceBean user);
|
||||||
|
|
||||||
/**
|
|
||||||
* 授予人脸重新录入权限时调用
|
|
||||||
* @param user
|
|
||||||
*/
|
|
||||||
void updateWechatIsFace(SysUser user);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 审核人脸时调用
|
|
||||||
* @String isCheck
|
|
||||||
*/
|
|
||||||
void checkWechatIsFace(SysUser user);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询请假数据
|
* 查询请假数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<EvectionBean> getWechatLeaveList();
|
|
||||||
|
|
||||||
SysOrg getOrgInfoByUserId(Long userId);
|
SysOrg getOrgInfoByUserId(Long userId);
|
||||||
|
|
||||||
void insertWebLeave(EvectionBean bean);
|
void insertWebLeave(EvectionBean bean);
|
||||||
|
|
||||||
void updateWechatLeave(EvectionBean bean);
|
|
||||||
|
|
||||||
void deleteWechatLeave();
|
|
||||||
|
|
||||||
List<EvectionBean> getWebLeaveList();
|
List<EvectionBean> getWebLeaveList();
|
||||||
|
|
||||||
void insertWechatLeave(EvectionBean bean);
|
void insertWechatLeave(EvectionBean bean);
|
||||||
|
|
||||||
List<AttSourceDataBean> getWechatAttList();
|
|
||||||
|
|
||||||
SysOrg getOrgInfoByUserName(String userName);
|
SysOrg getOrgInfoByUserName(String userName);
|
||||||
|
|
||||||
|
void pushAttDataToQsy(@Param("list")List<AttSourceDataBean> attSourceList);
|
||||||
|
|
||||||
|
MapBean getProOrgToQsy(AttSourceDataBean c);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,14 @@ public class AttSourceDataBean {
|
||||||
private String groupType;
|
private String groupType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考勤组类型
|
* 0 默认 1 外勤 2 正常
|
||||||
*/
|
*/
|
||||||
private String isOutsideAtt;
|
private String isOutsideAtt;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private Integer proId;
|
||||||
|
|
||||||
public AttSourceDataBean(Long userId, String orgId, String attCurrentDay, String attType) {
|
public AttSourceDataBean(Long userId, String orgId, String attCurrentDay, String attType) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.orgId = orgId;
|
this.orgId = orgId;
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,10 @@ import com.bonus.system.att.utils.WorkdayCalculator;
|
||||||
import com.bonus.system.basic.domain.SysOrg;
|
import com.bonus.system.basic.domain.SysOrg;
|
||||||
import com.bonus.system.evection.entity.EvectionBean;
|
import com.bonus.system.evection.entity.EvectionBean;
|
||||||
import com.bonus.system.holiday.entity.HolidayBean;
|
import com.bonus.system.holiday.entity.HolidayBean;
|
||||||
|
import com.bonus.system.index.entity.MapBean;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
|
import org.apache.commons.beanutils.MappedPropertyDescriptor;
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
|
@ -98,7 +100,7 @@ public class WechatTasks {
|
||||||
/**
|
/**
|
||||||
* 休假出差数据同步定时器
|
* 休假出差数据同步定时器
|
||||||
*/
|
*/
|
||||||
@Scheduled(fixedDelay = 60000 * 10)
|
// @Scheduled(fixedDelay = 60000 * 10)
|
||||||
@Async
|
@Async
|
||||||
public void leaveTask() {
|
public void leaveTask() {
|
||||||
log.info("--------休假出差数据定时器开启------");
|
log.info("--------休假出差数据定时器开启------");
|
||||||
|
|
@ -177,7 +179,7 @@ public class WechatTasks {
|
||||||
/**
|
/**
|
||||||
* 考勤数据同步定时器
|
* 考勤数据同步定时器
|
||||||
*/
|
*/
|
||||||
// @Scheduled(fixedDelay = 60000 * 10)
|
@Scheduled(fixedDelay = 60000 * 10)
|
||||||
@Async
|
@Async
|
||||||
public void wechatAttTask() {
|
public void wechatAttTask() {
|
||||||
log.info("--------考勤数据定时器开启------");
|
log.info("--------考勤数据定时器开启------");
|
||||||
|
|
@ -194,6 +196,7 @@ public class WechatTasks {
|
||||||
// 如果Map中没有该userId的组织机构信息,则从数据库查询
|
// 如果Map中没有该userId的组织机构信息,则从数据库查询
|
||||||
SysOrg orgInfo = dao.getOrgInfoByUserName(userName);
|
SysOrg orgInfo = dao.getOrgInfoByUserName(userName);
|
||||||
if (orgInfo != null) {
|
if (orgInfo != null) {
|
||||||
|
bean.setIdNumber(orgInfo.getIdNumber());
|
||||||
double distanceMeters = 0;
|
double distanceMeters = 0;
|
||||||
try {
|
try {
|
||||||
distanceMeters = calculateDistance(bean.getAttLat(), bean.getAttLon(), orgInfo.getLat().doubleValue(), orgInfo.getLon().doubleValue(), DistanceCalculator.Unit.METERS);
|
distanceMeters = calculateDistance(bean.getAttLat(), bean.getAttLon(), orgInfo.getLat().doubleValue(), orgInfo.getLon().doubleValue(), DistanceCalculator.Unit.METERS);
|
||||||
|
|
@ -230,6 +233,19 @@ public class WechatTasks {
|
||||||
String jsonStr2 = FastJsonHelper.beanListToJsonArrStr(attSourceList);
|
String jsonStr2 = FastJsonHelper.beanListToJsonArrStr(attSourceList);
|
||||||
String method2 = "updateWechatAttList";
|
String method2 = "updateWechatAttList";
|
||||||
String string2 = httpPost(method2, jsonStr2);
|
String string2 = httpPost(method2, jsonStr2);
|
||||||
|
//将数据同步到黔送云库
|
||||||
|
//1.先从黔送云库获取到在场人员的组织工程
|
||||||
|
attSourceList.forEach(c -> {
|
||||||
|
if(c.getIdNumber() != null){
|
||||||
|
MapBean mapBean= dao.getProOrgToQsy(c);
|
||||||
|
c.setProId(mapBean.getProId());
|
||||||
|
c.setOrgId(String.valueOf(mapBean.getOrgId()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//2.推送到人员考勤表
|
||||||
|
if(!attSourceList.isEmpty()){
|
||||||
|
dao.pushAttDataToQsy(attSourceList);
|
||||||
|
}
|
||||||
log.info("--------考勤数据定时器完毕------");
|
log.info("--------考勤数据定时器完毕------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,4 +100,9 @@ public class SysOrg {
|
||||||
|
|
||||||
/** 子菜单 */
|
/** 子菜单 */
|
||||||
private List<SysOrg> children = new ArrayList<SysOrg>();
|
private List<SysOrg> children = new ArrayList<SysOrg>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String idNumber;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ public class MapBean {
|
||||||
*/
|
*/
|
||||||
private Integer orgId;
|
private Integer orgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目部编号
|
||||||
|
*/
|
||||||
|
private Integer proId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目部名称
|
* 项目部名称
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,7 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.bonus.system.att.dao.WechatPushDao">
|
<mapper namespace="com.bonus.system.att.dao.WechatPushDao">
|
||||||
<insert id="insertWechatPerson">
|
|
||||||
insert into gz_attendance_wechat.sys_user_wechat(user_id,user_name,phone,password,is_pd,is_face,update_time,is_cadre)
|
|
||||||
values(#{userId},#{userName},#{phone},#{password},#{isPd},#{isFace},#{updateTime},#{isCadre})
|
|
||||||
</insert>
|
|
||||||
<insert id="insertWebFace">
|
<insert id="insertWebFace">
|
||||||
insert into sys_user_face(user_id,applied_face,applied_face_features,new_face,new_face_features,is_check,collection_time,examine_time)
|
insert into sys_user_face(user_id,applied_face,applied_face_features,new_face,new_face_features,is_check,collection_time,examine_time)
|
||||||
values(#{userId},#{appliedFace},#{appliedFaceFeatures},#{newFace},#{newFaceFeatures},#{isCheck},#{collectionTime},#{examineTime})
|
values(#{userId},#{appliedFace},#{appliedFaceFeatures},#{newFace},#{newFaceFeatures},#{isCheck},#{collectionTime},#{examineTime})
|
||||||
|
|
@ -33,46 +30,58 @@
|
||||||
#{examineStatus},#{hostUserId},#{hostUserName},#{isAgree},#{location},#{source},
|
#{examineStatus},#{hostUserId},#{hostUserName},#{isAgree},#{location},#{source},
|
||||||
#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{remark})
|
#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{remark})
|
||||||
</insert>
|
</insert>
|
||||||
<update id="updateWechatPerson">
|
|
||||||
update gz_attendance_wechat.sys_user_wechat set user_name = #{userName},phone = #{phone},
|
<insert id="pushAttDataToQsy">
|
||||||
password = #{password},update_time = #{updateTime},is_cadre = #{isCadre},is_face = #{isFace}
|
<foreach collection="list" item="item" separator=";">
|
||||||
where user_id = #{userId}
|
INSERT INTO gz_cloud_test.fc_sup_attendance (
|
||||||
</update>
|
name,
|
||||||
|
id_number,
|
||||||
|
org_id,
|
||||||
|
pro_id,
|
||||||
|
attendance_type,
|
||||||
|
attendance_date,
|
||||||
|
attendance_time,
|
||||||
|
lon,
|
||||||
|
lat,
|
||||||
|
attendance_external,
|
||||||
|
attendance_remark
|
||||||
|
) VALUES (
|
||||||
|
#{item.name},
|
||||||
|
#{item.idNumber},
|
||||||
|
#{item.orgId},
|
||||||
|
#{item.proId},
|
||||||
|
CASE
|
||||||
|
WHEN #{item.attType} = '1' THEN '上班'
|
||||||
|
WHEN #{item.attType} = '2' THEN '下班'
|
||||||
|
ELSE '默认'
|
||||||
|
END,
|
||||||
|
#{item.attCurrentDay},
|
||||||
|
#{item.attCurrentTime},
|
||||||
|
#{item.attLon},
|
||||||
|
#{item.attLat},
|
||||||
|
CASE
|
||||||
|
WHEN #{item.isOutsideAtt} = '1' THEN '外勤'
|
||||||
|
WHEN #{item.isOutsideAtt} = '2' THEN '注册'
|
||||||
|
ELSE '默认'
|
||||||
|
END,
|
||||||
|
#{item.remark}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateWebPassword">
|
<update id="updateWebPassword">
|
||||||
update sys_user set password = #{password} where user_id = #{userId}
|
update sys_user set password = #{password} where user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateWebOpenId">
|
<update id="updateWebOpenId">
|
||||||
update sys_user set open_id = #{openId} where user_id = #{userId}
|
update sys_user set open_id = #{openId} where user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateWechatIsPd">
|
|
||||||
update gz_attendance_wechat.sys_user_wechat set is_pd = #{isPd} where user_id = #{userId}
|
|
||||||
</update>
|
|
||||||
<update id="updateWebFace">
|
<update id="updateWebFace">
|
||||||
update sys_user_face set new_face = #{newFace},new_face_features = #{newFaceFeatures},is_check = #{isCheck},
|
update sys_user_face set new_face = #{newFace},new_face_features = #{newFaceFeatures},is_check = #{isCheck},
|
||||||
collection_time = #{collectionTime},examine_time = #{examineTime}
|
collection_time = #{collectionTime},examine_time = #{examineTime}
|
||||||
where user_id = #{userId}
|
where user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateWechatIsFace">
|
|
||||||
update gz_attendance_wechat.sys_user_wechat set is_face = #{isFace} where user_id = #{userId}
|
|
||||||
</update>
|
|
||||||
<update id="checkWechatIsFace">
|
|
||||||
update gz_attendance_wechat.sys_user_face_wechat
|
|
||||||
<if test="isCheck == '1'">
|
|
||||||
set is_check = #{isCheck},applied_face = new_face,applied_face_features = new_face_features
|
|
||||||
</if>
|
|
||||||
<if test="isCheck == '2'">
|
|
||||||
set is_check = #{isCheck},new_face = null,new_face_features = null
|
|
||||||
</if>
|
|
||||||
where user_id = #{userId}
|
|
||||||
</update>
|
|
||||||
<update id="updateWechatLeave">
|
|
||||||
update gz_attendance_wechat.leave_apply_wechat set id = #{id} where uuid = #{uuid}
|
|
||||||
</update>
|
|
||||||
<delete id="deleteWechatLeave">
|
|
||||||
delete gz_attendance_wechat.leave_apply_wechat where id is not null And uuid is not null
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<select id="getPersonList" resultType="com.bonus.system.api.domain.SysUser">
|
<select id="getPersonList" resultType="com.bonus.system.api.domain.SysUser">
|
||||||
SELECT
|
SELECT
|
||||||
su.user_id,
|
su.user_id,
|
||||||
|
|
@ -106,19 +115,6 @@
|
||||||
GROUP BY
|
GROUP BY
|
||||||
user_id
|
user_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getWeChatPersonList" resultType="com.bonus.system.api.domain.SysUser">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
gz_attendance_wechat.sys_user_wechat
|
|
||||||
WHERE is_active = '1'
|
|
||||||
</select>
|
|
||||||
<select id="getWeChatFaceList" resultType="com.bonus.system.att.entity.AttFaceBean">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
gz_attendance_wechat.sys_user_face_wechat
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getWebFaceList" resultType="com.bonus.system.att.entity.AttFaceBean">
|
<select id="getWebFaceList" resultType="com.bonus.system.att.entity.AttFaceBean">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -126,9 +122,6 @@
|
||||||
FROM
|
FROM
|
||||||
sys_user_face
|
sys_user_face
|
||||||
</select>
|
</select>
|
||||||
<select id="getWechatLeaveList" resultType="com.bonus.system.evection.entity.EvectionBean">
|
|
||||||
select * from gz_attendance_wechat.leave_apply_wechat where is_active = '1' and id is null
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getOrgInfoByUserId" resultType="com.bonus.system.basic.domain.SysOrg">
|
<select id="getOrgInfoByUserId" resultType="com.bonus.system.basic.domain.SysOrg">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -156,13 +149,6 @@
|
||||||
leave_apply
|
leave_apply
|
||||||
where is_active = '1'
|
where is_active = '1'
|
||||||
</select>
|
</select>
|
||||||
<select id="getWechatAttList" resultType="com.bonus.system.att.entity.AttSourceDataBean">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
from
|
|
||||||
gz_attendance_wechat.att_source_data_wechat
|
|
||||||
where is_active = '1' and is_outside_att = '0'
|
|
||||||
</select>
|
|
||||||
<select id="getOrgInfoByUserName" resultType="com.bonus.system.basic.domain.SysOrg">
|
<select id="getOrgInfoByUserName" resultType="com.bonus.system.basic.domain.SysOrg">
|
||||||
SELECT
|
SELECT
|
||||||
distinct
|
distinct
|
||||||
|
|
@ -171,16 +157,27 @@
|
||||||
so.org_name,
|
so.org_name,
|
||||||
agt.att_range,
|
agt.att_range,
|
||||||
so.lon,
|
so.lon,
|
||||||
so.lat
|
so.lat,
|
||||||
|
su.id_number
|
||||||
FROM
|
FROM
|
||||||
att_group_person_relation ag
|
att_group_person_relation ag
|
||||||
LEFT JOIN sys_organization so ON so.id = ag.org_id AND so.is_active = '1'
|
LEFT JOIN sys_organization so ON so.id = ag.org_id AND so.is_active = '1'
|
||||||
LEFT JOIN att_group_setting agt on agt.group_id = ag.group_id and agt.is_active = '1'
|
LEFT JOIN att_group_setting agt on agt.group_id = ag.group_id and agt.is_active = '1'
|
||||||
LEFT JOIN sys_user su ON su.user_id = ag.user_id AND su.is_active = '1'
|
LEFT JOIN sys_user su ON su.user_id = ag.user_id AND su.is_active = '1'
|
||||||
WHERE
|
WHERE
|
||||||
su.user_name = #{userName}
|
su.user_name = #{userName}
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getProOrgToQsy" resultType="com.bonus.system.index.entity.MapBean">
|
||||||
|
SELECT
|
||||||
|
If(PROJECT_ID is null,0,PROJECT_ID) AS proId,
|
||||||
|
If(ORG_ID is null,0,ORG_ID) AS orgId
|
||||||
|
FROM
|
||||||
|
gz_cloud_test.bm_sup_attend_history
|
||||||
|
WHERE
|
||||||
|
ID_NUMBER = #{idNumber}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
1.maven 换环境 gz_att_prod
|
1.maven 换环境 gz_att_prod
|
||||||
2.AttSourceDataMapper.xml 中 gz_cloud_test -> gz_cloud
|
2.AttSourceDataMapper.xml 中 gz_cloud_test -> gz_cloud
|
||||||
3.com.bonus.system.att.utils.IpAndPathConfig 修改对应环境
|
3.WechatPushMapper.xml 中 gz_cloud_test -> gz_cloud
|
||||||
4.com.bonus.system.att.tasks AttTasks 与 WechatTasks 定时器开启
|
4.com.bonus.system.att.utils.IpAndPathConfig 修改对应环境
|
||||||
|
5.com.bonus.system.att.tasks AttTasks 与 WechatTasks 定时器开启
|
||||||
Loading…
Reference in New Issue