update code
parent
eba10b7cb7
commit
e0f32fb7df
|
@ -133,7 +133,7 @@ public class Constants
|
|||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
*/
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi","com.yanzhu.jh"};
|
||||
|
||||
/**
|
||||
* 定时任务违规的字符
|
||||
|
|
|
@ -77,6 +77,15 @@ public class SurProjectAttendanceCfgController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SurProjectAttendanceCfg surProjectAttendanceCfg)
|
||||
{
|
||||
SurProjectAttendanceCfg where=new SurProjectAttendanceCfg();
|
||||
where.setProjectId(surProjectAttendanceCfg.getProjectId());
|
||||
where.setSubDeptId(surProjectAttendanceCfg.getSubDeptId());
|
||||
where.setVendorsCode(surProjectAttendanceCfg.getVendorsCode());
|
||||
List<SurProjectAttendanceCfg> list=surProjectAttendanceCfgService.selectSurProjectAttendanceCfgList(where);
|
||||
if(list.size()>0){
|
||||
SurProjectAttendanceCfg it=list.get(0);
|
||||
return AjaxResult.error("项目【"+it.getProjectName()+"】总包单位【"+it.getUnitName()+"】已添加过此厂商【"+it.getVendorName()+"】的配置了!");
|
||||
}
|
||||
return toAjax(surProjectAttendanceCfgService.insertSurProjectAttendanceCfg(surProjectAttendanceCfg));
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,36 @@ public class SurProjectAttendanceCfg extends BaseEntity
|
|||
@Excel(name = "状态")
|
||||
private Long state;
|
||||
|
||||
|
||||
private String projectName;
|
||||
private String unitName;
|
||||
|
||||
private String vendorName;
|
||||
|
||||
public String getVendorName() {
|
||||
return vendorName;
|
||||
}
|
||||
|
||||
public void setVendorName(String vendorName) {
|
||||
this.vendorName = vendorName;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getUnitName() {
|
||||
return unitName;
|
||||
}
|
||||
|
||||
public void setUnitName(String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long isDel;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.yanzhu.jh.project.domain;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
@ -15,13 +16,21 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
/** */
|
||||
private Long id;
|
||||
|
||||
/** 配置项ID,可以获取项目ID和总包ID */
|
||||
@Excel(name = "配置项ID,可以获取项目ID和总包ID")
|
||||
private Long cfgid;
|
||||
|
||||
/** 厂商编号参考字典attendance_vendors */
|
||||
@Excel(name = "厂商编号参考字典attendance_vendors")
|
||||
private String vendorsCode;
|
||||
|
||||
/** 服务端ID */
|
||||
@Excel(name = "服务端ID")
|
||||
private Long serverid;
|
||||
|
||||
/** 工人Id */
|
||||
@Excel(name = "工人Id")
|
||||
private Long workerId;
|
||||
|
@ -34,6 +43,30 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
@Excel(name = "考勤时间yyyy-MM-dd HH:mm:ss")
|
||||
private String attendanceTime;
|
||||
|
||||
/** 身份证号 */
|
||||
@Excel(name = "身份证号")
|
||||
private String identification;
|
||||
|
||||
/** 队伍id */
|
||||
@Excel(name = "队伍id")
|
||||
private Long teamId;
|
||||
|
||||
/** 工种编码 */
|
||||
@Excel(name = "工种编码")
|
||||
private String workTypeCode;
|
||||
|
||||
/** 分包商id */
|
||||
@Excel(name = "分包商id")
|
||||
private Long companyId;
|
||||
|
||||
/** 平台对应分包商ID */
|
||||
@Excel(name = "平台对应分包商ID")
|
||||
private Long vendorId;
|
||||
|
||||
/** 新旧系统项目标识0:新系统项目; 1:旧系统项目 */
|
||||
@Excel(name = "新旧系统项目标识0:新系统项目; 1:旧系统项目")
|
||||
private Long projectType;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String deviceCode;
|
||||
|
@ -42,18 +75,43 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
@Excel(name = "作业面Id")
|
||||
private String workPointId;
|
||||
|
||||
/** 照片 */
|
||||
@Excel(name = "照片")
|
||||
private String scanPhoto;
|
||||
|
||||
/** 服务返回的JSON */
|
||||
@Excel(name = "服务返回的JSON")
|
||||
private String other;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
/** */
|
||||
@Excel(name = "")
|
||||
private Long state;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
/** */
|
||||
@Excel(name = "")
|
||||
private Long isDel;
|
||||
|
||||
public static SurProjectAttendanceData create(JSONObject json) {
|
||||
SurProjectAttendanceData d=new SurProjectAttendanceData();
|
||||
d.attendanceTime=json.getString("time");
|
||||
d.attendanceType=json.getString("type");
|
||||
d.serverid=json.getLong("id");
|
||||
d.workerId=json.getLong("workerId");
|
||||
d.identification=json.getString("identification");
|
||||
d.teamId=json.getLong("teamId");
|
||||
d.workTypeCode=json.getString("workTypeCode");
|
||||
d.companyId=json.getLong("companyId");
|
||||
d.vendorId=json.getLong("vendorId");
|
||||
d.projectType=json.getLong("projectType");
|
||||
d.deviceCode=json.getString("deviceCode");
|
||||
d.workPointId=json.getString("workPointId");
|
||||
d.scanPhoto=json.getString("scanPhoto");
|
||||
//d.other=json.toJSONString();
|
||||
d.state=0l;
|
||||
d.isDel=0l;
|
||||
return d;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
@ -63,6 +121,15 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
{
|
||||
return id;
|
||||
}
|
||||
public void setCfgid(Long cfgid)
|
||||
{
|
||||
this.cfgid = cfgid;
|
||||
}
|
||||
|
||||
public Long getCfgid()
|
||||
{
|
||||
return cfgid;
|
||||
}
|
||||
public void setVendorsCode(String vendorsCode)
|
||||
{
|
||||
this.vendorsCode = vendorsCode;
|
||||
|
@ -72,6 +139,15 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
{
|
||||
return vendorsCode;
|
||||
}
|
||||
public void setServerid(Long serverid)
|
||||
{
|
||||
this.serverid = serverid;
|
||||
}
|
||||
|
||||
public Long getServerid()
|
||||
{
|
||||
return serverid;
|
||||
}
|
||||
public void setWorkerId(Long workerId)
|
||||
{
|
||||
this.workerId = workerId;
|
||||
|
@ -99,6 +175,60 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
{
|
||||
return attendanceTime;
|
||||
}
|
||||
public void setIdentification(String identification)
|
||||
{
|
||||
this.identification = identification;
|
||||
}
|
||||
|
||||
public String getIdentification()
|
||||
{
|
||||
return identification;
|
||||
}
|
||||
public void setTeamId(Long teamId)
|
||||
{
|
||||
this.teamId = teamId;
|
||||
}
|
||||
|
||||
public Long getTeamId()
|
||||
{
|
||||
return teamId;
|
||||
}
|
||||
public void setWorkTypeCode(String workTypeCode)
|
||||
{
|
||||
this.workTypeCode = workTypeCode;
|
||||
}
|
||||
|
||||
public String getWorkTypeCode()
|
||||
{
|
||||
return workTypeCode;
|
||||
}
|
||||
public void setCompanyId(Long companyId)
|
||||
{
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public Long getCompanyId()
|
||||
{
|
||||
return companyId;
|
||||
}
|
||||
public void setVendorId(Long vendorId)
|
||||
{
|
||||
this.vendorId = vendorId;
|
||||
}
|
||||
|
||||
public Long getVendorId()
|
||||
{
|
||||
return vendorId;
|
||||
}
|
||||
public void setProjectType(Long projectType)
|
||||
{
|
||||
this.projectType = projectType;
|
||||
}
|
||||
|
||||
public Long getProjectType()
|
||||
{
|
||||
return projectType;
|
||||
}
|
||||
public void setDeviceCode(String deviceCode)
|
||||
{
|
||||
this.deviceCode = deviceCode;
|
||||
|
@ -117,6 +247,15 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
{
|
||||
return workPointId;
|
||||
}
|
||||
public void setScanPhoto(String scanPhoto)
|
||||
{
|
||||
this.scanPhoto = scanPhoto;
|
||||
}
|
||||
|
||||
public String getScanPhoto()
|
||||
{
|
||||
return scanPhoto;
|
||||
}
|
||||
public void setOther(String other)
|
||||
{
|
||||
this.other = other;
|
||||
|
@ -149,12 +288,21 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("cfgid", getCfgid())
|
||||
.append("vendorsCode", getVendorsCode())
|
||||
.append("serverid", getServerid())
|
||||
.append("workerId", getWorkerId())
|
||||
.append("attendanceType", getAttendanceType())
|
||||
.append("attendanceTime", getAttendanceTime())
|
||||
.append("identification", getIdentification())
|
||||
.append("teamId", getTeamId())
|
||||
.append("workTypeCode", getWorkTypeCode())
|
||||
.append("companyId", getCompanyId())
|
||||
.append("vendorId", getVendorId())
|
||||
.append("projectType", getProjectType())
|
||||
.append("deviceCode", getDeviceCode())
|
||||
.append("workPointId", getWorkPointId())
|
||||
.append("scanPhoto", getScanPhoto())
|
||||
.append("other", getOther())
|
||||
.append("state", getState())
|
||||
.append("remark", getRemark())
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.yanzhu.jh.project.domain;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
@ -15,9 +16,17 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
/** */
|
||||
private Long id;
|
||||
|
||||
/** 配置项ID,可以获取项目ID和总包ID */
|
||||
@Excel(name = "配置项ID,可以获取项目ID和总包ID")
|
||||
private Long cfgid;
|
||||
|
||||
/** 厂商编号参考字典attendance_vendors */
|
||||
@Excel(name = "厂商编号参考字典attendance_vendors")
|
||||
private String vendorsCode;
|
||||
|
||||
/** 工人id */
|
||||
@Excel(name = "工人id")
|
||||
private Long workerId;
|
||||
|
@ -138,10 +147,42 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
@Excel(name = "服务返回的JSON")
|
||||
private String other;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
/** */
|
||||
@Excel(name = "")
|
||||
private Long isDel;
|
||||
|
||||
public static SurProjectAttendanceUser create(JSONObject json) {
|
||||
SurProjectAttendanceUser u=new SurProjectAttendanceUser();
|
||||
u.workerId=json.getLong("workerId");
|
||||
u.laborWorkerId=json.getLong("laborWorkerId");
|
||||
u.workerCategory=json.getLong("workerCategory");
|
||||
u.qrCode=json.getLong("qrCode");
|
||||
u.name=json.getString("name");
|
||||
u.ethnic=json.getString("ethnic");
|
||||
u.nativePlace=json.getString("nativePlace");
|
||||
u.gender=json.getLong("gender");
|
||||
u.birthDate=json.getLong("birthDate");
|
||||
u.phone=json.getString("phone");
|
||||
u.recentPhoto=json.getString("recentPhoto");
|
||||
u.groupId=json.getLong("groupId");
|
||||
u.groupName=json.getString("groupName");
|
||||
u.leader=json.getBoolean("leader")?1:0;
|
||||
u.workTypeCode=json.getString("workTypeCode");
|
||||
u.workTypeName=json.getString("workTypeName");
|
||||
u.specWorkType=json.getBoolean("specWorkType")?1:0;
|
||||
u.hatCode=json.getString("hatCode");
|
||||
u.state=json.getLong("state");
|
||||
u.enterDate=json.getString("enterDate");
|
||||
u.exitDate=json.getString("exitDate");
|
||||
u.companyId=json.getLong("companyId");
|
||||
u.companyName=json.getString("companyName");
|
||||
u.vendorId=json.getLong("vendorId");
|
||||
u.teamId=json.getInteger("teamId");
|
||||
u.teamName=json.getString("teamName");
|
||||
u.enterType=json.getString("enterType");
|
||||
u.other=json.toJSONString();
|
||||
u.isDel=0l;
|
||||
return u;
|
||||
}
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
@ -151,6 +192,24 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
{
|
||||
return id;
|
||||
}
|
||||
public void setCfgid(Long cfgid)
|
||||
{
|
||||
this.cfgid = cfgid;
|
||||
}
|
||||
|
||||
public Long getCfgid()
|
||||
{
|
||||
return cfgid;
|
||||
}
|
||||
public void setVendorsCode(String vendorsCode)
|
||||
{
|
||||
this.vendorsCode = vendorsCode;
|
||||
}
|
||||
|
||||
public String getVendorsCode()
|
||||
{
|
||||
return vendorsCode;
|
||||
}
|
||||
public void setWorkerId(Long workerId)
|
||||
{
|
||||
this.workerId = workerId;
|
||||
|
@ -435,6 +494,8 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("cfgid", getCfgid())
|
||||
.append("vendorsCode", getVendorsCode())
|
||||
.append("workerId", getWorkerId())
|
||||
.append("laborWorkerId", getLaborWorkerId())
|
||||
.append("workerCategory", getWorkerCategory())
|
||||
|
|
|
@ -58,4 +58,6 @@ public interface SurProjectAttendanceDataMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceDataByIds(Long[] ids);
|
||||
|
||||
public long getLastServerId(SurProjectAttendanceData where);
|
||||
}
|
||||
|
|
|
@ -58,4 +58,8 @@ public interface ISurProjectAttendanceDataService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceDataById(Long id);
|
||||
|
||||
public void add(SurProjectAttendanceData sdata);
|
||||
|
||||
public long getLastServerId(SurProjectAttendanceData where);
|
||||
}
|
||||
|
|
|
@ -58,4 +58,6 @@ public interface ISurProjectAttendanceUserService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceUserById(Long id);
|
||||
|
||||
public void add(SurProjectAttendanceUser user);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,8 @@ public class SurProjectAttendanceDataServiceImpl implements ISurProjectAttendanc
|
|||
@Override
|
||||
public int insertSurProjectAttendanceData(SurProjectAttendanceData surProjectAttendanceData)
|
||||
{
|
||||
surProjectAttendanceData.setCreateBy(SecurityUtils.getUsername());
|
||||
|
||||
surProjectAttendanceData.setCreateBy("task");
|
||||
surProjectAttendanceData.setCreateTime(DateUtils.getNowDate());
|
||||
return surProjectAttendanceDataMapper.insertSurProjectAttendanceData(surProjectAttendanceData);
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ public class SurProjectAttendanceDataServiceImpl implements ISurProjectAttendanc
|
|||
@Override
|
||||
public int updateSurProjectAttendanceData(SurProjectAttendanceData surProjectAttendanceData)
|
||||
{
|
||||
surProjectAttendanceData.setUpdateBy(SecurityUtils.getUsername());
|
||||
surProjectAttendanceData.setUpdateBy("task");
|
||||
surProjectAttendanceData.setUpdateTime(DateUtils.getNowDate());
|
||||
return surProjectAttendanceDataMapper.updateSurProjectAttendanceData(surProjectAttendanceData);
|
||||
}
|
||||
|
@ -95,4 +96,24 @@ public class SurProjectAttendanceDataServiceImpl implements ISurProjectAttendanc
|
|||
{
|
||||
return surProjectAttendanceDataMapper.deleteSurProjectAttendanceDataById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SurProjectAttendanceData sdata) {
|
||||
SurProjectAttendanceData where=new SurProjectAttendanceData();
|
||||
where.setVendorsCode(sdata.getVendorsCode());
|
||||
where.setCfgid(sdata.getCfgid());
|
||||
where.setServerid(sdata.getServerid());
|
||||
List<SurProjectAttendanceData> list=selectSurProjectAttendanceDataList(where);
|
||||
if(list.size()==0){
|
||||
insertSurProjectAttendanceData(sdata);
|
||||
}else{
|
||||
sdata.setId(list.get(0).getId());
|
||||
updateSurProjectAttendanceData(sdata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastServerId(SurProjectAttendanceData where) {
|
||||
return surProjectAttendanceDataMapper.getLastServerId(where);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SurProjectAttendanceUserServiceImpl implements ISurProjectAttendanc
|
|||
@Override
|
||||
public int insertSurProjectAttendanceUser(SurProjectAttendanceUser surProjectAttendanceUser)
|
||||
{
|
||||
surProjectAttendanceUser.setCreateBy(SecurityUtils.getUsername());
|
||||
surProjectAttendanceUser.setCreateBy("task");
|
||||
surProjectAttendanceUser.setCreateTime(DateUtils.getNowDate());
|
||||
return surProjectAttendanceUserMapper.insertSurProjectAttendanceUser(surProjectAttendanceUser);
|
||||
}
|
||||
|
@ -67,7 +67,8 @@ public class SurProjectAttendanceUserServiceImpl implements ISurProjectAttendanc
|
|||
@Override
|
||||
public int updateSurProjectAttendanceUser(SurProjectAttendanceUser surProjectAttendanceUser)
|
||||
{
|
||||
surProjectAttendanceUser.setUpdateBy(SecurityUtils.getUsername());
|
||||
|
||||
surProjectAttendanceUser.setUpdateBy("task");
|
||||
surProjectAttendanceUser.setUpdateTime(DateUtils.getNowDate());
|
||||
return surProjectAttendanceUserMapper.updateSurProjectAttendanceUser(surProjectAttendanceUser);
|
||||
}
|
||||
|
@ -95,4 +96,18 @@ public class SurProjectAttendanceUserServiceImpl implements ISurProjectAttendanc
|
|||
{
|
||||
return surProjectAttendanceUserMapper.deleteSurProjectAttendanceUserById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SurProjectAttendanceUser user) {
|
||||
SurProjectAttendanceUser where=new SurProjectAttendanceUser();
|
||||
where.setWorkerId(user.getWorkerId());
|
||||
where.setCfgid(user.getCfgid());
|
||||
List<SurProjectAttendanceUser> list=selectSurProjectAttendanceUserList(where);
|
||||
if(list.size()==0){
|
||||
insertSurProjectAttendanceUser(user);
|
||||
}else{
|
||||
user.setId(list.get(0).getId());
|
||||
updateSurProjectAttendanceUser(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
package com.yanzhu.jh.project.task;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceCfg;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceData;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceUser;
|
||||
import com.yanzhu.jh.project.service.ISurProjectAttendanceCfgService;
|
||||
import com.yanzhu.jh.project.service.ISurProjectAttendanceDataService;
|
||||
import com.yanzhu.jh.project.service.ISurProjectAttendanceUserService;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -15,21 +24,47 @@ import java.util.stream.Collectors;
|
|||
|
||||
@Component("attendanceTask")
|
||||
public class AttendanceTask {
|
||||
//private static final String APP_ID_PARAM_NAME="appid";
|
||||
//private static final String SIGN_PARAM_NAME="sign";
|
||||
//private static String appId = "8fba899a21c64be4aa25bf0f3314ad5c";
|
||||
//private static String appSecret = "426b3d8280620176d80a826eebef3579";
|
||||
|
||||
public static void syncWorker(String appid,String secret,String projectld,int page){
|
||||
@Autowired
|
||||
ISurProjectAttendanceUserService attendanceUserService;
|
||||
|
||||
@Autowired
|
||||
ISurProjectAttendanceCfgService attendanceCfgService;
|
||||
|
||||
@Autowired
|
||||
ISurProjectAttendanceDataService attendanceDataService;
|
||||
public void syncWorker(){
|
||||
SurProjectAttendanceCfg where =new SurProjectAttendanceCfg();
|
||||
where.setEnabled(1l);
|
||||
where.setIsDel(0l);
|
||||
where.setVendorsCode("gld");
|
||||
List<SurProjectAttendanceCfg> list=attendanceCfgService.selectSurProjectAttendanceCfgList(where);
|
||||
for(SurProjectAttendanceCfg it :list){
|
||||
String param= it.getVendorsParameter();
|
||||
if(Strings.isNotEmpty(param)){
|
||||
try{
|
||||
JSONObject jo=JSON.parseObject(param);
|
||||
String appId=jo.getString("appId");
|
||||
String secret=jo.getString("secret");
|
||||
String projectId=jo.getString("projectId");
|
||||
doSyncWorker(appId,secret,projectId,1,it);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void doSyncWorker(String appid,String secret,String projectld,int page,SurProjectAttendanceCfg it){
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("projectId", projectld);
|
||||
params.put("start", "2000-01-01 00:00:00");
|
||||
params.put("end", "2099-01-01 00:00:00");
|
||||
params.put("pageNo",""+page);
|
||||
params.put("pageSize", "1000");
|
||||
params.put("appid","8fba899a21c64be4aa25bf0f3314ad5c");
|
||||
params.put("appid",appid);
|
||||
String sign = getSign(params,secret);
|
||||
String host="https://glm.glodon.com/api/open";
|
||||
params.put("sign",sign);
|
||||
String path="/worker/new/allWorkerInfo";
|
||||
HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(host + path)).newBuilder();
|
||||
params.forEach((s, o) -> {
|
||||
|
@ -39,14 +74,87 @@ public class AttendanceTask {
|
|||
.url(urlBuilder.build())
|
||||
.build();
|
||||
String data=getResult(request);
|
||||
System.out.println("data:"+data);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
JSONArray arr=jo.getJSONArray("data");
|
||||
if(arr!=null && arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
SurProjectAttendanceUser user=SurProjectAttendanceUser.create(json);
|
||||
user.setVendorsCode(it.getVendorsCode());
|
||||
user.setCfgid(it.getId());
|
||||
attendanceUserService.add(user);
|
||||
}
|
||||
}
|
||||
if(arr.size()==1000){
|
||||
doSyncWorker(appid,secret,projectld,page+1,it);
|
||||
}
|
||||
}
|
||||
public static void main2(String[] args) {
|
||||
syncWorker("8fba899a21c64be4aa25bf0f3314ad5c","426b3d8280620176d80a826eebef3579","719148569880576",1);
|
||||
public static void main(String[] args) {
|
||||
//syncWorker("8fba899a21c64be4aa25bf0f3314ad5c","426b3d8280620176d80a826eebef3579","719148569880576",1);
|
||||
//doSyncAttendanceData("8fba899a21c64be4aa25bf0f3314ad5c","426b3d8280620176d80a826eebef3579","719148569880576",0,null);
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
public void syncAttendanceData(){
|
||||
SurProjectAttendanceCfg where =new SurProjectAttendanceCfg();
|
||||
where.setEnabled(1l);
|
||||
where.setIsDel(0l);
|
||||
where.setVendorsCode("gld");
|
||||
List<SurProjectAttendanceCfg> list=attendanceCfgService.selectSurProjectAttendanceCfgList(where);
|
||||
for(SurProjectAttendanceCfg it :list){
|
||||
String param= it.getVendorsParameter();
|
||||
if(Strings.isNotEmpty(param)){
|
||||
try{
|
||||
JSONObject jo=JSON.parseObject(param);
|
||||
String appId=jo.getString("appId");
|
||||
String secret=jo.getString("secret");
|
||||
String projectId=jo.getString("projectId");
|
||||
SurProjectAttendanceData dwhere=new SurProjectAttendanceData();
|
||||
dwhere.setCfgid(it.getId());
|
||||
long startId=attendanceDataService.getLastServerId(dwhere);
|
||||
doSyncAttendanceData(appId,secret,projectId,startId,it);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void doSyncAttendanceData(String appid,String secret,String projectld,long id,SurProjectAttendanceCfg it){
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("projectId", projectld);
|
||||
params.put("startId",""+id);
|
||||
params.put("pageSize", "500");
|
||||
params.put("appid",appid);
|
||||
String sign = getSign(params,secret);
|
||||
String host="https://glm.glodon.com/api/open";
|
||||
params.put("sign",sign);
|
||||
String path="/attendance/card";
|
||||
HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(host + path)).newBuilder();
|
||||
params.forEach((s, o) -> {
|
||||
urlBuilder.addQueryParameter(s, (String) o);
|
||||
});
|
||||
Request request = new Request.Builder()
|
||||
.url(urlBuilder.build())
|
||||
.build();
|
||||
String data=getResult(request);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
JSONArray arr=jo.getJSONArray("data");
|
||||
long lastId=0;
|
||||
if(arr!=null && arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
SurProjectAttendanceData sdata=SurProjectAttendanceData.create(json);
|
||||
lastId=sdata.getServerid();
|
||||
sdata.setCfgid(it.getId());
|
||||
sdata.setVendorsCode(it.getVendorsCode());
|
||||
attendanceDataService.add(sdata);
|
||||
}
|
||||
}
|
||||
System.out.println("-------->"+id+","+lastId);
|
||||
if(arr.size()==500){
|
||||
doSyncAttendanceData(appid,secret,projectld,lastId,it);
|
||||
}
|
||||
}
|
||||
public static void main3(String[] args){
|
||||
System.out.println("-------1--------->AttendanceUserTask.syncWorker");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("projectId", "719148569880576");
|
||||
|
@ -70,6 +178,7 @@ public class AttendanceTask {
|
|||
String data=getResult(request);
|
||||
System.out.println("data:"+data);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,10 +18,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="projectName" column="projectName"/>
|
||||
<result property="unitName" column="unitName"/>
|
||||
<result property="vendorName" column="vendorName"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSurProjectAttendanceCfgVo">
|
||||
select id, project_id, sub_dept_id, vendors_code, vendors_parameter, enabled, state, remark, is_del, create_by, create_time, update_by, update_time from sur_project_attendance_cfg
|
||||
select *
|
||||
from (
|
||||
SELECT a.*,sp.projectName,pu.unitName,sdd1.dict_label vendorName FROM sur_project_attendance_cfg a
|
||||
LEFT JOIN sur_project sp ON a.project_id = sp.id
|
||||
LEFT JOIN sur_project_unit_info pu ON a.sub_dept_id=pu.unitId AND a.project_id=pu.projectId
|
||||
LEFT JOIN sys_dict_data sdd1 ON sdd1.dict_type = 'attendance_vendors' AND sdd1.dict_value = a.vendors_code
|
||||
) sur_project_attendance_cfg
|
||||
</sql>
|
||||
|
||||
<select id="selectSurProjectAttendanceCfgList" parameterType="SurProjectAttendanceCfg" resultMap="SurProjectAttendanceCfgResult">
|
||||
|
|
|
@ -6,12 +6,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<resultMap type="SurProjectAttendanceData" id="SurProjectAttendanceDataResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cfgid" column="cfgid" />
|
||||
<result property="vendorsCode" column="vendors_code" />
|
||||
<result property="serverid" column="serverid" />
|
||||
<result property="workerId" column="workerId" />
|
||||
<result property="attendanceType" column="attendance_type" />
|
||||
<result property="attendanceTime" column="attendance_time" />
|
||||
<result property="identification" column="identification" />
|
||||
<result property="teamId" column="teamId" />
|
||||
<result property="workTypeCode" column="workTypeCode" />
|
||||
<result property="companyId" column="companyId" />
|
||||
<result property="vendorId" column="vendorId" />
|
||||
<result property="projectType" column="projectType" />
|
||||
<result property="deviceCode" column="device_code" />
|
||||
<result property="workPointId" column="work_point_id" />
|
||||
<result property="scanPhoto" column="scanPhoto" />
|
||||
<result property="other" column="other" />
|
||||
<result property="state" column="state" />
|
||||
<result property="remark" column="remark" />
|
||||
|
@ -23,18 +32,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectSurProjectAttendanceDataVo">
|
||||
select id, vendors_code, workerId, attendance_type, attendance_time, device_code, work_point_id, other, state, remark, is_del, create_by, create_time, update_by, update_time from sur_project_attendance_data
|
||||
select id, cfgid, vendors_code, serverid, workerId, attendance_type, attendance_time, identification, teamId, workTypeCode, companyId, vendorId, projectType, device_code, work_point_id, scanPhoto, other, state, remark, is_del, create_by, create_time, update_by, update_time from sur_project_attendance_data
|
||||
</sql>
|
||||
|
||||
<select id="selectSurProjectAttendanceDataList" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
|
||||
<include refid="selectSurProjectAttendanceDataVo"/>
|
||||
<where>
|
||||
<if test="cfgid != null "> and cfgid = #{cfgid}</if>
|
||||
<if test="vendorsCode != null and vendorsCode != ''"> and vendors_code = #{vendorsCode}</if>
|
||||
<if test="serverid != null "> and serverid = #{serverid}</if>
|
||||
<if test="workerId != null "> and workerId = #{workerId}</if>
|
||||
<if test="attendanceType != null and attendanceType != ''"> and attendance_type = #{attendanceType}</if>
|
||||
<if test="attendanceTime != null and attendanceTime != ''"> and attendance_time = #{attendanceTime}</if>
|
||||
<if test="identification != null and identification != ''"> and identification = #{identification}</if>
|
||||
<if test="teamId != null "> and teamId = #{teamId}</if>
|
||||
<if test="workTypeCode != null and workTypeCode != ''"> and workTypeCode = #{workTypeCode}</if>
|
||||
<if test="companyId != null "> and companyId = #{companyId}</if>
|
||||
<if test="vendorId != null "> and vendorId = #{vendorId}</if>
|
||||
<if test="projectType != null "> and projectType = #{projectType}</if>
|
||||
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
|
||||
<if test="workPointId != null and workPointId != ''"> and work_point_id = #{workPointId}</if>
|
||||
<if test="scanPhoto != null and scanPhoto != ''"> and scanPhoto = #{scanPhoto}</if>
|
||||
<if test="other != null and other != ''"> and other = #{other}</if>
|
||||
<if test="state != null "> and state = #{state}</if>
|
||||
<if test="isDel != null "> and is_del = #{isDel}</if>
|
||||
|
@ -49,12 +67,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="insertSurProjectAttendanceData" parameterType="SurProjectAttendanceData" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sur_project_attendance_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid,</if>
|
||||
<if test="vendorsCode != null">vendors_code,</if>
|
||||
<if test="serverid != null">serverid,</if>
|
||||
<if test="workerId != null">workerId,</if>
|
||||
<if test="attendanceType != null">attendance_type,</if>
|
||||
<if test="attendanceTime != null">attendance_time,</if>
|
||||
<if test="identification != null">identification,</if>
|
||||
<if test="teamId != null">teamId,</if>
|
||||
<if test="workTypeCode != null">workTypeCode,</if>
|
||||
<if test="companyId != null">companyId,</if>
|
||||
<if test="vendorId != null">vendorId,</if>
|
||||
<if test="projectType != null">projectType,</if>
|
||||
<if test="deviceCode != null">device_code,</if>
|
||||
<if test="workPointId != null">work_point_id,</if>
|
||||
<if test="scanPhoto != null">scanPhoto,</if>
|
||||
<if test="other != null">other,</if>
|
||||
<if test="state != null">state,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
|
@ -65,12 +92,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">#{cfgid},</if>
|
||||
<if test="vendorsCode != null">#{vendorsCode},</if>
|
||||
<if test="serverid != null">#{serverid},</if>
|
||||
<if test="workerId != null">#{workerId},</if>
|
||||
<if test="attendanceType != null">#{attendanceType},</if>
|
||||
<if test="attendanceTime != null">#{attendanceTime},</if>
|
||||
<if test="identification != null">#{identification},</if>
|
||||
<if test="teamId != null">#{teamId},</if>
|
||||
<if test="workTypeCode != null">#{workTypeCode},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="vendorId != null">#{vendorId},</if>
|
||||
<if test="projectType != null">#{projectType},</if>
|
||||
<if test="deviceCode != null">#{deviceCode},</if>
|
||||
<if test="workPointId != null">#{workPointId},</if>
|
||||
<if test="scanPhoto != null">#{scanPhoto},</if>
|
||||
<if test="other != null">#{other},</if>
|
||||
<if test="state != null">#{state},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
|
@ -85,12 +121,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateSurProjectAttendanceData" parameterType="SurProjectAttendanceData">
|
||||
update sur_project_attendance_data
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid = #{cfgid},</if>
|
||||
<if test="vendorsCode != null">vendors_code = #{vendorsCode},</if>
|
||||
<if test="serverid != null">serverid = #{serverid},</if>
|
||||
<if test="workerId != null">workerId = #{workerId},</if>
|
||||
<if test="attendanceType != null">attendance_type = #{attendanceType},</if>
|
||||
<if test="attendanceTime != null">attendance_time = #{attendanceTime},</if>
|
||||
<if test="identification != null">identification = #{identification},</if>
|
||||
<if test="teamId != null">teamId = #{teamId},</if>
|
||||
<if test="workTypeCode != null">workTypeCode = #{workTypeCode},</if>
|
||||
<if test="companyId != null">companyId = #{companyId},</if>
|
||||
<if test="vendorId != null">vendorId = #{vendorId},</if>
|
||||
<if test="projectType != null">projectType = #{projectType},</if>
|
||||
<if test="deviceCode != null">device_code = #{deviceCode},</if>
|
||||
<if test="workPointId != null">work_point_id = #{workPointId},</if>
|
||||
<if test="scanPhoto != null">scanPhoto = #{scanPhoto},</if>
|
||||
<if test="other != null">other = #{other},</if>
|
||||
<if test="state != null">state = #{state},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
|
@ -113,4 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="getLastServerId" parameterType="SurProjectAttendanceData" resultType="Long">
|
||||
SELECT IF(MAX(serverid),MAX(serverid),0) serverid FROM sur_project_attendance_data WHERE cfgid=#{cfgid}
|
||||
</select>
|
||||
</mapper>
|
|
@ -6,6 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<resultMap type="SurProjectAttendanceUser" id="SurProjectAttendanceUserResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cfgid" column="cfgid" />
|
||||
<result property="vendorsCode" column="vendors_code" />
|
||||
<result property="workerId" column="workerId" />
|
||||
<result property="laborWorkerId" column="laborWorkerId" />
|
||||
<result property="workerCategory" column="workerCategory" />
|
||||
|
@ -45,12 +47,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectSurProjectAttendanceUserVo">
|
||||
select id, workerId, laborWorkerId, workerCategory, qrCode, name, ethnic, nativePlace, gender, birthDate, phone, degreeName, photo, recentPhoto, groupId, groupName, leader, workTypeCode, workTypeName, specWorkType, hatCode, state, enterDate, exitDate, companyId, companyName, vendorId, teamId, teamName, enterType, other, remark, is_del, create_by, create_time, update_by, update_time from sur_project_attendance_user
|
||||
select id, cfgid, vendors_code, workerId, laborWorkerId, workerCategory, qrCode, name, ethnic, nativePlace, gender, birthDate, phone, degreeName, photo, recentPhoto, groupId, groupName, leader, workTypeCode, workTypeName, specWorkType, hatCode, state, enterDate, exitDate, companyId, companyName, vendorId, teamId, teamName, enterType, other, remark, is_del, create_by, create_time, update_by, update_time from sur_project_attendance_user
|
||||
</sql>
|
||||
|
||||
<select id="selectSurProjectAttendanceUserList" parameterType="SurProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
|
||||
<include refid="selectSurProjectAttendanceUserVo"/>
|
||||
<where>
|
||||
<if test="cfgid != null "> and cfgid = #{cfgid}</if>
|
||||
<if test="vendorsCode != null and vendorsCode != ''"> and vendors_code = #{vendorsCode}</if>
|
||||
<if test="workerId != null "> and workerId = #{workerId}</if>
|
||||
<if test="laborWorkerId != null "> and laborWorkerId = #{laborWorkerId}</if>
|
||||
<if test="workerCategory != null "> and workerCategory = #{workerCategory}</if>
|
||||
|
@ -93,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="insertSurProjectAttendanceUser" parameterType="SurProjectAttendanceUser" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sur_project_attendance_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid,</if>
|
||||
<if test="vendorsCode != null">vendors_code,</if>
|
||||
<if test="workerId != null">workerId,</if>
|
||||
<if test="laborWorkerId != null">laborWorkerId,</if>
|
||||
<if test="workerCategory != null">workerCategory,</if>
|
||||
|
@ -131,6 +137,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">#{cfgid},</if>
|
||||
<if test="vendorsCode != null">#{vendorsCode},</if>
|
||||
<if test="workerId != null">#{workerId},</if>
|
||||
<if test="laborWorkerId != null">#{laborWorkerId},</if>
|
||||
<if test="workerCategory != null">#{workerCategory},</if>
|
||||
|
@ -173,6 +181,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateSurProjectAttendanceUser" parameterType="SurProjectAttendanceUser">
|
||||
update sur_project_attendance_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid = #{cfgid},</if>
|
||||
<if test="vendorsCode != null">vendors_code = #{vendorsCode},</if>
|
||||
<if test="workerId != null">workerId = #{workerId},</if>
|
||||
<if test="laborWorkerId != null">laborWorkerId = #{laborWorkerId},</if>
|
||||
<if test="workerCategory != null">workerCategory = #{workerCategory},</if>
|
||||
|
|
Loading…
Reference in New Issue