同步考勤数据到黔送
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.evection.entity.EvectionBean;
|
||||
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 java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 小程序同步定时器
|
||||
|
|
@ -20,60 +23,34 @@ import java.util.List;
|
|||
@Repository("WechatPushDao")
|
||||
public interface WechatPushDao {
|
||||
|
||||
|
||||
List<SysUser> getPersonList();
|
||||
|
||||
List<SysUser> getWeChatPersonList();
|
||||
|
||||
void insertWechatPerson(SysUser user);
|
||||
|
||||
void updateWechatPerson(SysUser user);
|
||||
|
||||
void updateWebPassword(SysUser wechatUser);
|
||||
|
||||
void updateWebOpenId(SysUser wechatUser);
|
||||
|
||||
void updateWechatIsPd(SysUser user);
|
||||
|
||||
List<AttFaceBean> getWeChatFaceList();
|
||||
|
||||
List<AttFaceBean> getWebFaceList();
|
||||
|
||||
void insertWebFace(AttFaceBean user);
|
||||
|
||||
void updateWebFace(AttFaceBean user);
|
||||
|
||||
/**
|
||||
* 授予人脸重新录入权限时调用
|
||||
* @param user
|
||||
*/
|
||||
void updateWechatIsFace(SysUser user);
|
||||
|
||||
/**
|
||||
* 审核人脸时调用
|
||||
* @String isCheck
|
||||
*/
|
||||
void checkWechatIsFace(SysUser user);
|
||||
|
||||
/**
|
||||
* 查询请假数据
|
||||
* @return
|
||||
*/
|
||||
List<EvectionBean> getWechatLeaveList();
|
||||
|
||||
SysOrg getOrgInfoByUserId(Long userId);
|
||||
|
||||
void insertWebLeave(EvectionBean bean);
|
||||
|
||||
void updateWechatLeave(EvectionBean bean);
|
||||
|
||||
void deleteWechatLeave();
|
||||
|
||||
List<EvectionBean> getWebLeaveList();
|
||||
|
||||
void insertWechatLeave(EvectionBean bean);
|
||||
|
||||
List<AttSourceDataBean> getWechatAttList();
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 考勤组类型
|
||||
* 0 默认 1 外勤 2 正常
|
||||
*/
|
||||
private String isOutsideAtt;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Integer proId;
|
||||
|
||||
public AttSourceDataBean(Long userId, String orgId, String attCurrentDay, String attType) {
|
||||
this.userId = userId;
|
||||
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.evection.entity.EvectionBean;
|
||||
import com.bonus.system.holiday.entity.HolidayBean;
|
||||
import com.bonus.system.index.entity.MapBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.beanutils.MappedPropertyDescriptor;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
|
@ -98,7 +100,7 @@ public class WechatTasks {
|
|||
/**
|
||||
* 休假出差数据同步定时器
|
||||
*/
|
||||
@Scheduled(fixedDelay = 60000 * 10)
|
||||
// @Scheduled(fixedDelay = 60000 * 10)
|
||||
@Async
|
||||
public void leaveTask() {
|
||||
log.info("--------休假出差数据定时器开启------");
|
||||
|
|
@ -177,7 +179,7 @@ public class WechatTasks {
|
|||
/**
|
||||
* 考勤数据同步定时器
|
||||
*/
|
||||
// @Scheduled(fixedDelay = 60000 * 10)
|
||||
@Scheduled(fixedDelay = 60000 * 10)
|
||||
@Async
|
||||
public void wechatAttTask() {
|
||||
log.info("--------考勤数据定时器开启------");
|
||||
|
|
@ -194,6 +196,7 @@ public class WechatTasks {
|
|||
// 如果Map中没有该userId的组织机构信息,则从数据库查询
|
||||
SysOrg orgInfo = dao.getOrgInfoByUserName(userName);
|
||||
if (orgInfo != null) {
|
||||
bean.setIdNumber(orgInfo.getIdNumber());
|
||||
double distanceMeters = 0;
|
||||
try {
|
||||
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 method2 = "updateWechatAttList";
|
||||
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("--------考勤数据定时器完毕------");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,4 +100,9 @@ public class SysOrg {
|
|||
|
||||
/** 子菜单 */
|
||||
private List<SysOrg> children = new ArrayList<SysOrg>();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String idNumber;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ public class MapBean {
|
|||
*/
|
||||
private Integer orgId;
|
||||
|
||||
/**
|
||||
* 项目部编号
|
||||
*/
|
||||
private Integer proId;
|
||||
|
||||
/**
|
||||
* 项目部名称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<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 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})
|
||||
|
|
@ -33,46 +30,58 @@
|
|||
#{examineStatus},#{hostUserId},#{hostUserName},#{isAgree},#{location},#{source},
|
||||
#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{remark})
|
||||
</insert>
|
||||
<update id="updateWechatPerson">
|
||||
update gz_attendance_wechat.sys_user_wechat set user_name = #{userName},phone = #{phone},
|
||||
password = #{password},update_time = #{updateTime},is_cadre = #{isCadre},is_face = #{isFace}
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<insert id="pushAttDataToQsy">
|
||||
<foreach collection="list" item="item" separator=";">
|
||||
INSERT INTO gz_cloud_test.fc_sup_attendance (
|
||||
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 sys_user set password = #{password} where user_id = #{userId}
|
||||
</update>
|
||||
<update id="updateWebOpenId">
|
||||
update sys_user set open_id = #{openId} where user_id = #{userId}
|
||||
</update>
|
||||
<update id="updateWechatIsPd">
|
||||
update gz_attendance_wechat.sys_user_wechat set is_pd = #{isPd} where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateWebFace">
|
||||
update sys_user_face set new_face = #{newFace},new_face_features = #{newFaceFeatures},is_check = #{isCheck},
|
||||
collection_time = #{collectionTime},examine_time = #{examineTime}
|
||||
where user_id = #{userId}
|
||||
</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
|
||||
su.user_id,
|
||||
|
|
@ -106,19 +115,6 @@
|
|||
GROUP BY
|
||||
user_id
|
||||
</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
|
||||
|
|
@ -126,9 +122,6 @@
|
|||
FROM
|
||||
sys_user_face
|
||||
</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
|
||||
|
|
@ -156,13 +149,6 @@
|
|||
leave_apply
|
||||
where is_active = '1'
|
||||
</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
|
||||
distinct
|
||||
|
|
@ -171,16 +157,27 @@
|
|||
so.org_name,
|
||||
agt.att_range,
|
||||
so.lon,
|
||||
so.lat
|
||||
so.lat,
|
||||
su.id_number
|
||||
FROM
|
||||
att_group_person_relation ag
|
||||
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 sys_user su ON su.user_id = ag.user_id AND su.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 sys_user su ON su.user_id = ag.user_id AND su.is_active = '1'
|
||||
WHERE
|
||||
su.user_name = #{userName}
|
||||
limit 1
|
||||
</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>
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
1.maven 换环境 gz_att_prod
|
||||
2.AttSourceDataMapper.xml 中 gz_cloud_test -> gz_cloud
|
||||
3.com.bonus.system.att.utils.IpAndPathConfig 修改对应环境
|
||||
4.com.bonus.system.att.tasks AttTasks 与 WechatTasks 定时器开启
|
||||
3.WechatPushMapper.xml 中 gz_cloud_test -> gz_cloud
|
||||
4.com.bonus.system.att.utils.IpAndPathConfig 修改对应环境
|
||||
5.com.bonus.system.att.tasks AttTasks 与 WechatTasks 定时器开启
|
||||
Loading…
Reference in New Issue