存为版本取消存入map表,同步接口
This commit is contained in:
parent
66e1c77e3b
commit
981ea3ad4a
|
|
@ -29,4 +29,10 @@ public interface JclOrgMapper {
|
||||||
int updateMapById(@Param("id") Integer id,@Param("fplan") Integer fplan,@Param("fonjob") Integer fonjob,@Param("currentDate") Date currentDate);
|
int updateMapById(@Param("id") Integer id,@Param("fplan") Integer fplan,@Param("fonjob") Integer fonjob,@Param("currentDate") Date currentDate);
|
||||||
|
|
||||||
List<JclOrgMap> getJclOrgMapByType(@Param("fType") String fType, @Param("currentDate") Date currentDate);
|
List<JclOrgMap> getJclOrgMapByType(@Param("fType") String fType, @Param("currentDate") Date currentDate);
|
||||||
|
|
||||||
|
int deleteAllMap(@Param("currentDate") Date currentDate);
|
||||||
|
|
||||||
|
int updateAllMap(@Param("currentDate") Date currentDate, @Param("yesterday") Date yesterday);
|
||||||
|
|
||||||
|
int insertResToMap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,4 +74,55 @@
|
||||||
<select id="getJclOrgMapByType" resultType="com.engine.organization.entity.map.JclOrgMap">
|
<select id="getJclOrgMapByType" resultType="com.engine.organization.entity.map.JclOrgMap">
|
||||||
select * from jcl_org_map where ftype = #{fType} AND FDATEBEGIN <= #{currentDate} AND FDATEEND >= #{currentDate}
|
select * from jcl_org_map where ftype = #{fType} AND FDATEBEGIN <= #{currentDate} AND FDATEEND >= #{currentDate}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!--删除当天所有数据-->
|
||||||
|
<delete id="deleteAllMap">
|
||||||
|
delete from jcl_org_map where fdatebegin = #{currentDate}
|
||||||
|
</delete>
|
||||||
|
<!--修改所有失效日期-->
|
||||||
|
<update id="updateAllMap">
|
||||||
|
update jcl_org_map
|
||||||
|
<set>
|
||||||
|
fdateend=#{yesterday},
|
||||||
|
</set>
|
||||||
|
where fdateend > #{currentDate}
|
||||||
|
</update>
|
||||||
|
<!--初始化人员数据-->
|
||||||
|
<insert id="insertResToMap" databaseId="sqlserver">
|
||||||
|
insert into jcl_org_map
|
||||||
|
(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,fleaderimg,
|
||||||
|
fleaderjobid,fleaderjob,fleaderlv,fleaderst,fparentid,fobjparentid,
|
||||||
|
fisvitual,fdatebegin,fdateend)
|
||||||
|
select a.id+300000000,4,a.id,a.uuid,0,'行政维度',a.workcode,a.LASTNAME,a.messagerurl,
|
||||||
|
c.id,c.jobtitlename,null,null, isnull( b.id, '' ) +200000000,b.id,
|
||||||
|
0,convert(varchar(100),getDate(),23),'2099-12-31'
|
||||||
|
from hrmresource a
|
||||||
|
left join jcl_org_job b ON a.JOBTITLE = b.ec_jobTitle
|
||||||
|
left join HrmJobTitles c on b.ec_jobTitle = c.id
|
||||||
|
where a.status < 4
|
||||||
|
</insert>
|
||||||
|
<!--初始化岗位-->
|
||||||
|
<insert id="insertJobToMap">
|
||||||
|
insert into jcl_org_map
|
||||||
|
(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,
|
||||||
|
fparentid,fobjparentid,
|
||||||
|
fplan,fonjob,fisvitual,fdatebegin,fdateend)
|
||||||
|
select a.id+200000000,3,a.id,g.uuid,0,'行政维度',a.job_no,g.jobtitlename,
|
||||||
|
ec_department+100000000,
|
||||||
|
ec_department,
|
||||||
|
isnull(e.fcnt,0),isnull(f.fcnt,0),0,convert(varchar(100),getDate(),23),'2099-12-31'
|
||||||
|
from JCL_ORG_job as a
|
||||||
|
left join (select job_id,sum(isnull(staff_num,0)) fcnt from JCL_ORG_STAFF
|
||||||
|
where plan_id in (select id from JCL_ORG_STAFFPLAN
|
||||||
|
where time_start <= convert(varchar(100),getDate(),23) and time_end > convert(varchar(100),getDate(),23)) and delete_type=0
|
||||||
|
group by job_id) e on a.id=e.job_id
|
||||||
|
left join (select jobtitle,count(1) fcnt from hrmresource group by jobtitle) f
|
||||||
|
on f.JOBTITLE=a.id
|
||||||
|
left join HrmJobTitles g on a.ec_jobTitle = g.id
|
||||||
|
where isnull(a.delete_type,0) <> 1 and isnull(a.forbidden_tag,0) <> 1
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -21,4 +21,6 @@ public interface OrgChartService {
|
||||||
|
|
||||||
Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user);
|
Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user);
|
||||||
|
|
||||||
|
Map<String, Object> synchronousData(Map<String, Object> request2Map, User user);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,17 @@ package com.engine.organization.service.impl;
|
||||||
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateField;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.engine.core.impl.Service;
|
import com.engine.core.impl.Service;
|
||||||
|
import com.engine.organization.entity.map.JclOrgMap;
|
||||||
import com.engine.organization.entity.scheme.po.GradePO;
|
import com.engine.organization.entity.scheme.po.GradePO;
|
||||||
import com.engine.organization.entity.scheme.po.LevelPO;
|
import com.engine.organization.entity.scheme.po.LevelPO;
|
||||||
|
import com.engine.organization.entity.staff.po.StaffPO;
|
||||||
|
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||||
import com.engine.organization.mapper.scheme.GradeMapper;
|
import com.engine.organization.mapper.scheme.GradeMapper;
|
||||||
import com.engine.organization.mapper.scheme.LevelMapper;
|
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||||
|
import com.engine.organization.mapper.staff.StaffMapper;
|
||||||
import com.engine.organization.service.OrgChartService;
|
import com.engine.organization.service.OrgChartService;
|
||||||
import com.engine.organization.util.HasRightUtil;
|
import com.engine.organization.util.HasRightUtil;
|
||||||
|
import com.engine.organization.util.OrganizationDateUtil;
|
||||||
import com.engine.organization.util.db.DBType;
|
import com.engine.organization.util.db.DBType;
|
||||||
import com.engine.organization.util.db.MapperProxyFactory;
|
import com.engine.organization.util.db.MapperProxyFactory;
|
||||||
import com.engine.organization.util.detach.DetachUtil;
|
import com.engine.organization.util.detach.DetachUtil;
|
||||||
|
|
@ -497,6 +502,36 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JclOrgMapper getJclOrgMapMapper() {
|
||||||
|
return MapperProxyFactory.getProxy(JclOrgMapper.class);
|
||||||
|
}
|
||||||
|
private StaffMapper getStaffMapper() {
|
||||||
|
return MapperProxyFactory.getProxy(StaffMapper.class);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> synchronousData(Map<String, Object> request2Map, User user) {
|
||||||
|
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||||
|
java.sql.Date date = new java.sql.Date(OrganizationDateUtil.stringToDate(currentDate).getTime());
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(date);
|
||||||
|
Calendar calendar = weaver.common.DateUtil.addDay(cal, -1);
|
||||||
|
java.sql.Date time = new java.sql.Date(calendar.getTime().getTime());
|
||||||
|
// 自下向上刷新
|
||||||
|
getJclOrgMapMapper().deleteAllMap(date);
|
||||||
|
getJclOrgMapMapper().updateAllMap(date,time);
|
||||||
|
//同步人员信息
|
||||||
|
getJclOrgMapMapper().insertResToMap();
|
||||||
|
//同步岗位信息
|
||||||
|
JclOrgMap jclOrgMap = new JclOrgMap();
|
||||||
|
|
||||||
|
// StaffPO staffPO = getStaffMapper().getStaffsByParamId(Integer.parseInt(type), null, null, String.valueOf(id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
static class OrgSelectItem {
|
static class OrgSelectItem {
|
||||||
private String id;
|
private String id;
|
||||||
private String fnumber;
|
private String fnumber;
|
||||||
|
|
|
||||||
|
|
@ -51,17 +51,17 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
||||||
case 1:
|
case 1:
|
||||||
paramMap = getCompanyVersionMapper().getHrmSubComp(id);
|
paramMap = getCompanyVersionMapper().getHrmSubComp(id);
|
||||||
saveSubComToVersion(paramMap, user);
|
saveSubComToVersion(paramMap, user);
|
||||||
saveSubComToMap(paramMap);
|
// saveSubComToMap(paramMap);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
paramMap = getCompanyVersionMapper().getHrmDepartment(id);
|
paramMap = getCompanyVersionMapper().getHrmDepartment(id);
|
||||||
saveDeptToVersion(paramMap, user);
|
saveDeptToVersion(paramMap, user);
|
||||||
saveDeptToMap(paramMap);
|
// saveDeptToMap(paramMap);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
paramMap = getCompanyVersionMapper().getHrmResource(id);
|
paramMap = getCompanyVersionMapper().getHrmResource(id);
|
||||||
saveHrmToVersion(paramMap, user);
|
saveHrmToVersion(paramMap, user);
|
||||||
saveHrmToMap(paramMap);
|
// saveHrmToMap(paramMap);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.engine.organization.web;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.engine.common.util.ParamUtil;
|
import com.engine.common.util.ParamUtil;
|
||||||
import com.engine.common.util.ServiceUtil;
|
import com.engine.common.util.ServiceUtil;
|
||||||
|
import com.engine.organization.util.response.ReturnResult;
|
||||||
import com.engine.organization.wrapper.OrgChartWrapper;
|
import com.engine.organization.wrapper.OrgChartWrapper;
|
||||||
import weaver.hrm.HrmUserVarify;
|
import weaver.hrm.HrmUserVarify;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
|
@ -143,4 +144,21 @@ public class OrgChartController {
|
||||||
return JSONObject.toJSONString(apidatas);
|
return JSONObject.toJSONString(apidatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步组织数据
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/synchronousData")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public ReturnResult synchronousData(@Context HttpServletRequest request, @Context HttpServletResponse
|
||||||
|
response) {
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||||
|
return ReturnResult.successed(getOrgChartWrapper(user).synchronousData(params));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ReturnResult.exceptionHandle(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,8 @@ public class OrgChartWrapper extends Service {
|
||||||
return getOrgChartService(user).asyncCompanyData(request2Map, user);
|
return getOrgChartService(user).asyncCompanyData(request2Map, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> synchronousData(Map<String, Object> request2Map) {
|
||||||
|
return getOrgChartService(user).synchronousData(request2Map, user);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue