dev_xds
姜玉琦 2024-03-31 23:32:09 +08:00
commit 3ceb360237
20 changed files with 14980 additions and 18 deletions

8283
sql/group.sql 100644

File diff suppressed because it is too large Load Diff

6377
sql/sys_native.sql 100644

File diff suppressed because it is too large Load Diff

BIN
sql/籍贯.xls 100644

Binary file not shown.

BIN
sql/籍贯.xlsx 100644

Binary file not shown.

View File

@ -139,6 +139,42 @@ public class ProjectAttendanceController extends BaseController {
return AjaxResult.success(list);
}
/**
*
* @param where
* @return
*/
@GetMapping("/workerOnDuty")
public TableDataInfo queryWorkerOnDuty(SurProjectAttendanceUser where){
Long deptId= where.getDeptId();
if(deptId==null || deptId<=0){
if (SecurityUtils.isUserB()) {
where.setPrjIds(getProjectIds());
}
}
startPage();
List<SurProjectAttendanceUser> list=attendanceUserService.queryWorkerOnDuty(where);
return getDataTable(list);
}
/**
*
* @param where
* @return
*/
@GetMapping("/groupByWorkerOnDuty")
public AjaxResult groupByWorkerOnDuty(SurProjectAttendanceData where){
Long deptId= where.getDeptId();
if(deptId==null || deptId<=0){
if (SecurityUtils.isUserB()) {
where.setPrjIds(getProjectIds());
}
}
List<SurProjectAttendanceData> list=attendanceUserService.groupByWorkerOnDutyByDept(where);
return AjaxResult.success(list);
}
/**
*
*/

View File

@ -0,0 +1,54 @@
package com.yanzhu.jh.base.domain;
import com.ruoyi.common.core.domain.BaseEntity;
public class SysNative extends BaseEntity {
private Long id;
private String address;
private String provinces;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getProvinces() {
return provinces;
}
public void setProvinces(String provinces) {
this.provinces = provinces;
}
public String getCitiy() {
return citiy;
}
public void setCitiy(String citiy) {
this.citiy = citiy;
}
public String getAreas() {
return areas;
}
public void setAreas(String areas) {
this.areas = areas;
}
private String citiy;
private String areas;
}

View File

@ -0,0 +1,10 @@
package com.yanzhu.jh.base.mapper;
import com.yanzhu.jh.base.domain.SysNative;
import java.util.List;
public interface SysNativeMapper {
public List<SysNative> selectSysNativeListById(Long id);
}

View File

@ -0,0 +1,9 @@
package com.yanzhu.jh.base.service;
import com.yanzhu.jh.base.domain.SysNative;
import java.util.List;
public interface ISysNativeService {
public List<SysNative> selectSysNativeListById(Long id);
}

View File

@ -0,0 +1,19 @@
package com.yanzhu.jh.base.service.impl;
import com.yanzhu.jh.base.domain.SysNative;
import com.yanzhu.jh.base.mapper.SysNativeMapper;
import com.yanzhu.jh.base.service.ISysNativeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SysNativeServiceImpl implements ISysNativeService {
@Autowired
SysNativeMapper sysNativeMapper;
@Override
public List<SysNative> selectSysNativeListById(Long id) {
return sysNativeMapper.selectSysNativeListById(id);
}
}

View File

@ -217,7 +217,7 @@ public class SurProjectAttendanceUser extends BaseEntity
u.ethnic=j.getString("minor");
u.phone=j.getString("workPhone");
u.nativePlace=j.getString("address");
u.gender=j.getLong("sex")==0l?1l:0l;
u.gender=j.getLongValue("sex",0)==0l?1l:0l;
String tmp=j.getString("birthday");
if(StrUtil.isNotEmpty(tmp)) {
try {

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.yanzhu.jh.project.domain.SurProjectAttendanceCfg;
import com.yanzhu.jh.project.domain.SurProjectAttendanceData;
import com.yanzhu.jh.project.domain.SurProjectAttendanceUser;
/**
@ -116,4 +117,17 @@ public interface SurProjectAttendanceUserMapper
public List<SurProjectAttendanceUser> todayAttendanceOtherData(Map<String,Object> data);
/**
*
* @param where
* @return
*/
List<SurProjectAttendanceUser> queryWorkerOnDuty(SurProjectAttendanceUser where);
/**
*
* @param where
* @return
*/
List<SurProjectAttendanceData> groupByWorkerOnDutyByDept(SurProjectAttendanceData where);
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.yanzhu.jh.project.domain.SurProjectAttendanceCfg;
import com.yanzhu.jh.project.domain.SurProjectAttendanceData;
import com.yanzhu.jh.project.domain.SurProjectAttendanceUser;
/**
@ -110,4 +111,18 @@ public interface ISurProjectAttendanceUserService
* @return
*/
public List<SurProjectAttendanceUser> selectSurProjectAttendanceUserListJgw(SurProjectAttendanceUser surProjectAttendanceUser);
/**
*
* @param where
* @return
*/
public List<SurProjectAttendanceUser> queryWorkerOnDuty(SurProjectAttendanceUser where);
/**
*
* @param where
* @return
*/
List<SurProjectAttendanceData> groupByWorkerOnDutyByDept(SurProjectAttendanceData where);
}

View File

@ -134,7 +134,8 @@ public class SurProjectAttendanceGroupServiceImpl implements ISurProjectAttendan
@Override
public void add(SurProjectAttendanceGroup group) {
SurProjectAttendanceGroup where=new SurProjectAttendanceGroup();
where.setServerid(group.getServerid());
where.setServerid(group.getCompanyId());
where.setCfgid(group.getCfgid());
List<SurProjectAttendanceGroup> list=selectSurProjectAttendanceGroupViewList(where);
if(list.size()==0){
insertSurProjectAttendanceGroup(group);

View File

@ -8,6 +8,7 @@ import java.util.Map;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.yanzhu.jh.project.domain.SurProjectAttendanceCfg;
import com.yanzhu.jh.project.domain.SurProjectAttendanceData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.project.mapper.SurProjectAttendanceUserMapper;
@ -161,6 +162,11 @@ public class SurProjectAttendanceUserServiceImpl implements ISurProjectAttendanc
SurProjectAttendanceUser old=list.get(0);
if(user.getVendorsCode().equals("jgw")){
user.setCompanyId(old.getCompanyId());
String oldNav=old.getNativePlace();
String newNav=user.getNativePlace();
if(oldNav==null || !oldNav.equals(newNav)){
old.setNativePlace(newNav);
}
}
user.setId(old.getId());
updateSurProjectAttendanceUser(user);
@ -221,6 +227,26 @@ public class SurProjectAttendanceUserServiceImpl implements ISurProjectAttendanc
return surProjectAttendanceUserMapper.selectSurProjectAttendanceUserListJgw(surProjectAttendanceUser);
}
/**
*
* @param where
* @return
*/
@Override
public List<SurProjectAttendanceUser> queryWorkerOnDuty(SurProjectAttendanceUser where) {
return surProjectAttendanceUserMapper.queryWorkerOnDuty(where);
}
/**
*
* @param where
* @return
*/
@Override
public List<SurProjectAttendanceData> groupByWorkerOnDutyByDept(SurProjectAttendanceData where) {
return surProjectAttendanceUserMapper.groupByWorkerOnDutyByDept(where);
}
private Date findDate(List<SurProjectAttendanceUser> datas, SurProjectAttendanceUser u, String type) {
for (SurProjectAttendanceUser user:datas) {
if(user.getWorkerId().equals(u.getWorkerId()) && user.getName().equals(type)){

View File

@ -3,7 +3,7 @@ package com.yanzhu.jh.project.task;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
@ -11,12 +11,11 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.sign.Md5Utils;
import com.ruoyi.common.utils.uuid.UUID;
import com.yanzhu.jh.base.domain.SysNative;
import com.yanzhu.jh.base.service.ISysNativeService;
import com.yanzhu.jh.project.domain.SurProjectAttendanceCfg;
import com.yanzhu.jh.project.domain.SurProjectAttendanceData;
import com.yanzhu.jh.project.domain.SurProjectAttendanceGroup;
@ -30,6 +29,7 @@ import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -49,6 +49,36 @@ public class AttendanceJgwTask {
@Autowired
private RedisCache redisCache;
@Autowired
private ISysNativeService sysNativeService;
private String getNative(long id){
String ckey="attendance_jgw_native_"+id;
Object obj=redisCache.getCacheObject(ckey);
String tmp="";
if(obj!=null){
tmp=obj.toString();
if(StrUtil.isNotEmpty(tmp)){
return tmp;
}
}
List<SysNative> list=sysNativeService.selectSysNativeListById(id);
if(list.size()==0){
id=id/100*100;
list=sysNativeService.selectSysNativeListById(id);
if(list.size()==0){
id=id/10000*10000;
list=sysNativeService.selectSysNativeListById(id);
}
}
if(list.size()==0){
tmp="";
}else{
tmp= list.get(0).getAddress();
}
redisCache.setCacheObject(ckey, tmp, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.DAYS);
return tmp;
}
private String getWorkTypeName(String appid,String token,String type,String key){
String ckey="attendance_jgw_work_type_"+type;
Object obj=redisCache.getCacheObject(ckey);
@ -56,7 +86,7 @@ public class AttendanceJgwTask {
if(obj==null){
map=getJobTypeData(appid,token,type);
if(map!=null){
redisCache.setCacheObject(key, ckey, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.DAYS);
redisCache.setCacheObject(ckey, map, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.DAYS);
}else{
return "未知";
}
@ -107,8 +137,9 @@ public class AttendanceJgwTask {
String appid="6a6f24fe35b04ee0bcf31cfb46ed1051";
String secret="c3h5enh4MjAyNHN1Yw==";
String prjId="db955e11ef774e63968a47c3dc2acc15";//"b67f1baa6dca4558a16bf90a4681b82e";//
String phone="18171295380";
//String prjId="db955e11ef774e63968a47c3dc2acc15";//"b67f1baa6dca4558a16bf90a4681b82e";//
String prjId="e66a49d5550c49ffb030c49b84ccf8ea";//泾河新城荟锦坊二期
String phone="18392322772";
String token= getToken(appid,secret);
if(token==null || token.length()==0){
return;
@ -118,16 +149,16 @@ public class AttendanceJgwTask {
String subcontractorId=new AttendanceJgwTask().getSubcontractor(appid,token,phone);
String leaderTeamId="a643aaf5fdeb4c8fb0d8c7307881ce97";
System.out.println(subcontractorId);
findWorkerByLeader(appid,token,leaderTeamId);
//findWorkerByLeader(appid,token,leaderTeamId);
//findDirectlyUnderTeam(appid,token,prjId,subcontractorId,0);
//queryProject(appid,token,phone,0);;
//findAddWorkerByProject(appid,token,prjId,0);
findUpdateWorkerByProject(appid,token,prjId,0);
findAddWorkerByProject(appid,token,prjId,0);
//findUpdateWorkerByProject(appid,token,prjId,0);
//findAttendanceByProject(appid,token,prjId);
//findTeamByProjectId(appid,token,prjId);
//findProContractorByProjectId(appid,token,prjId);
//getJobTypeData(appid,token,"0");
findDirectlyUnderTeam(appid,token,prjId);
//findDirectlyUnderTeam(appid,token,prjId);
}
public static void findDirectlyUnderTeam(String appId,String token,String projectId,String subcontractorId,int rowId){
String path="/webapi/project/findDirectlyUnderTeam";
@ -539,12 +570,18 @@ public class AttendanceJgwTask {
int cnt=0;
for(int i=0;i<arr.size();i++){
JSONObject json=arr.getJSONObject(i);
String idNumber=json.getString("idNumber");
if(StrUtil.isEmpty(idNumber)){
String a="xx";
}else{
}
String workerStatus= json.getString("workerStatus");
if("02".equals(workerStatus)){
cnt++;
}
SurProjectAttendanceUser user=SurProjectAttendanceUser.createFromJgw(json);
if(user.getName().equals("李文国")){
if(user.getName().equals("王利")){
String k=user.getName();
JSONArray arr2= json.getJSONArray("corpName");
Object o=arr2.get(0);
@ -732,6 +769,18 @@ public class AttendanceJgwTask {
user.setVendorsCode(it.getVendorsCode());
user.setCfgid(it.getId());
user.setAppId(appId);
String idNumber=json.getString("idNumber");//身份证
if(StrUtil.isNotEmpty(idNumber) && idNumber.length()>6){
try {
long idStr = Long.parseLong(idNumber.substring(0, 6));
String natstr=getNative(idStr);
if(StrUtil.isNotEmpty(natstr)){
user.setNativePlace(natstr);
}
}catch (Exception ex){
}
}
attendanceUserService.add(user);
}
doSyncWorker(jo,endId,it);

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yanzhu.jh.base.mapper.SysNativeMapper">
<resultMap type="SysNative" id="SysNativeResult">
<result property="id" column="id" />
<result property="address" column="address" />
<result property="provinces" column="provinces" />
<result property="citiy" column="citiy" />
<result property="areas" column="areas" />
</resultMap>
<select id="selectSysNativeListById" parameterType="Long" resultMap="SysNativeResult">
SELECT * FROM sys_native WHERE id=#{id}
</select>
</mapper>

View File

@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="nodeType != null "> and node_lvl = #{nodeType}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
</where>
ORDER BY node_lvl,id
</select>
<select id="selectBaseBuildNodeById" parameterType="Long" resultMap="BaseBuildNodeResult">

View File

@ -354,7 +354,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="groupAllByComany" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
select g.companyTypeId,count(1) id from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
where u.cfgid=c.id and u.state=0 and u.companyId=g.companyId and u.state=0
and g.companyTypeId in (1,2,3,4,5,6,8)
and g.companyTypeId in (0,1,2,3,4,5,6,8)
<if test="projectId!=null and projectId>0">
and c.project_id=#{projectId}
</if>

View File

@ -405,7 +405,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and g.companyTypeId in (1,6)
</if>
<if test="id==2">
and g.companyTypeId in (2,3,4,5)
and g.companyTypeId in (0,2,3,4,5)
</if>
<if test="id==8">
and g.companyTypeId =8
@ -438,7 +438,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and g.companyTypeId in (1,6)
</if>
<if test="id==2">
and g.companyTypeId in (2,3,4,5)
and g.companyTypeId in (0,2,3,4,5)
</if>
<if test="id==8">
and g.companyTypeId =8
@ -469,7 +469,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and g.companyTypeId in (1,6)
</if>
<if test="id==2">
and g.companyTypeId in (2,3,4,5)
and g.companyTypeId in (0,2,3,4,5)
</if>
<if test="id==8">
and g.companyTypeId =8
@ -509,4 +509,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
group by workerid
</select>
<select id="queryWorkerOnDuty" parameterType="SurProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
SELECT u.*,b.project_id,b.sub_dept_id
FROM sur_project_attendance_user u,sur_project_attendance_cfg b,view_sur_project_attendance_group g
WHERE u.cfgid=b.id and u.state=0 and u.companyId=g.companyId
<if test="id==101">
and g.companyTypeId in (1,6)
</if>
<if test="id==102">
and g.companyTypeId =8
</if>
<if test="id==103">
and g.companyTypeId in (0,2,3,4,5)
</if>
<if test="projectId!=null and projectId>0">
and b.project_id=#{projectId}
</if>
<if test="deptId!=null and deptId>0">
and b.project_id in (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
<if test="prjIds !=null and prjIds.size()>0">
and b.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="groupByWorkerOnDutyByDept" parameterType="SurProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
SELECT p.id, p.projectName NAME,c.dept_name groupName,g.companyTypeId companyId,COUNT(1) cfgid
FROM sur_project_attendance_user u,sur_project_attendance_cfg b,view_sur_project_attendance_group g,sur_project p,sys_dept c
where u.cfgid=b.id and u.state=0 and u.companyId=g.companyId and b.project_id=p.id and c.dept_id=b.sub_dept_id
and g.companyTypeId in (1,6,0,2,3,4,5,8)
<if test="deptId!=null and deptId>0">
and b.project_id in (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
<if test="prjIds !=null and prjIds.size()>0">
and b.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by p.projectName,c.dept_name,g.companyTypeId,p.id
order by p.id
</select>
</mapper>

View File

@ -69,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="files != null and files != ''"> and files = #{files}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
</where>
order by node_lvl,id
</select>
<select id="selectSurProjectBuildNodeDataById" parameterType="Long" resultMap="SurProjectBuildNodeDataResult">