Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/dxf
This commit is contained in:
commit
c86e37495d
|
|
@ -29,4 +29,19 @@ public interface JclOrgMapper {
|
|||
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);
|
||||
|
||||
int deleteAllMap(@Param("currentDate") Date currentDate);
|
||||
|
||||
int updateAllMap(@Param("currentDate") Date currentDate, @Param("yesterday") Date yesterday);
|
||||
|
||||
int insertResToMap();
|
||||
|
||||
int insertJobToMap();
|
||||
|
||||
int insertDeptToMap();
|
||||
|
||||
int insertSubComToMap();
|
||||
|
||||
int insertComToMap();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,4 +74,90 @@
|
|||
<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>
|
||||
|
||||
|
||||
<!--删除当天所有数据-->
|
||||
<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.ec_jobTitle
|
||||
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>
|
||||
<!--同步部门信息-->
|
||||
<insert id="insertDeptToMap">
|
||||
insert into jcl_org_map
|
||||
(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,fleader,fleaderimg,
|
||||
fleadername,fleaderjobid,fleaderjob,fleaderlv,fleaderst,fparentid,fobjparentid,
|
||||
fplan,fonjob,fisvitual,fdatebegin,fdateend)
|
||||
select a.id+100000000,2,a.id,a.uuid,0,'行政维度',a.DEPARTMENTCODE,a.departmentname,cast(a.BMFZR as varchar(10)),b.messagerurl,
|
||||
b.lastname,b.jobtitle,c.jobtitlemark,null,null,
|
||||
(case isnull(a.supdepid,0) when 0 then a.subcompanyid1 else a.supdepid+100000000 end),
|
||||
(case isnull(a.supdepid,0) when 0 then a.subcompanyid1 else a.supdepid end),
|
||||
0,0,0,convert(varchar(100),getDate(),23),'2099-12-31'
|
||||
from
|
||||
HrmDepartment as a
|
||||
left join hrmresource as b on cast(a.BMFZR as varchar(10))=cast(b.ID as varchar(10))
|
||||
left join hrmjobtitles as c on b.JOBTITLE=c.id
|
||||
where isnull(a.canceled,0) <> 1
|
||||
</insert>
|
||||
<!--同步分部信息-->
|
||||
<insert id="insertSubComToMap">
|
||||
insert into jcl_org_map
|
||||
(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,fleader,fleaderimg,
|
||||
fleadername,fleaderjobid,fleaderjob,fleaderlv,fleaderst,fparentid,fobjparentid,
|
||||
fplan,fonjob,fisvitual,fdatebegin,fdateend)
|
||||
select a.id,1,a.id,a.uuid,0,'行政维度', '',a.subcompanyname,null,'',
|
||||
'',NULL,'','','',isnull(a.supsubcomid,0),isnull(a.supsubcomid,0),
|
||||
0,0,0,convert(varchar(100),getDate(),23),'2099-12-31' from hrmsubcompany as a
|
||||
where isnull(a.canceled,0) <> 1
|
||||
</insert>
|
||||
<!--同步集团信息-->
|
||||
<insert id="insertComToMap">
|
||||
INSERT INTO jcl_org_map ( id, ftype, fobjid, uuid,fclass, fclassname, fnumber, fname,
|
||||
fleader, fleaderimg, fleadername, fleaderjobid, fleaderjob, fparentid,fobjparentid,
|
||||
fplan, fonjob, fisvitual, fdatebegin, fdateend)
|
||||
SELECT 0, 0, 0, uuid, 0, '行政维度', '00', companyname,
|
||||
0, NULL, NULL, 0, NULL, -1, 0,
|
||||
0, 0, 0, convert(varchar(100),getDate(),23), '2099-12-31' FROM hrmcompany
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -21,4 +21,6 @@ public interface OrgChartService {
|
|||
|
||||
Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user);
|
||||
|
||||
String 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.DateUtil;
|
||||
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.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.LevelMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.service.OrgChartService;
|
||||
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.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
|
|
@ -497,6 +502,68 @@ 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 String 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();
|
||||
//同步岗位信息
|
||||
getJclOrgMapMapper().insertJobToMap();
|
||||
//同步部门信息
|
||||
getJclOrgMapMapper().insertDeptToMap();
|
||||
//同步分部信息
|
||||
getJclOrgMapMapper().insertSubComToMap();
|
||||
//同步集团信息
|
||||
getJclOrgMapMapper().insertComToMap();
|
||||
|
||||
//刷新在岗数、编制数(从岗位向上刷,岗位不需处理)
|
||||
List<JclOrgMap> jclOrgMaps = getJclOrgMapMapper().getJclOrgMapByType("3",date);
|
||||
for (JclOrgMap jclOrgMap : jclOrgMaps){
|
||||
int id = jclOrgMap.getId();
|
||||
countJobAndPlans("3",id,currentDate);
|
||||
}
|
||||
return "同步成功";
|
||||
}
|
||||
/**
|
||||
* 刷新在岗、编制数
|
||||
*/
|
||||
void countJobAndPlans(String type,int id,String currentDate) {
|
||||
java.sql.Date date = new java.sql.Date(OrganizationDateUtil.stringToDate(currentDate).getTime());
|
||||
RecordSet rs = new RecordSet();
|
||||
//处理上级
|
||||
String sql = "select fparentid from jcl_org_map where ftype=? and id=? and fdateend>?";
|
||||
String typeSql = "select ftype from jcl_org_map where id=? and fdateend>?";
|
||||
rs.executeQuery(sql, type, id, currentDate);
|
||||
String fparentid = null;
|
||||
String ftype = null;
|
||||
if (rs.next()) {
|
||||
fparentid = rs.getString("fparentid");
|
||||
rs.executeQuery(typeSql, fparentid, currentDate);
|
||||
if (rs.next()) {
|
||||
ftype = rs.getString("ftype");
|
||||
}
|
||||
}
|
||||
JclOrgMap jclOrgMap = getJclOrgMapMapper().getSumPlanAndJobByFParentId(date, fparentid);
|
||||
getJclOrgMapMapper().updateMapById(Integer.parseInt(fparentid), jclOrgMap.getFPlan(), jclOrgMap.getFOnJob(), date);
|
||||
|
||||
if (!"-1".equals(fparentid)) {
|
||||
countJobAndPlans(ftype, Integer.parseInt(fparentid), String.valueOf(currentDate));
|
||||
}
|
||||
}
|
||||
static class OrgSelectItem {
|
||||
private String id;
|
||||
private String fnumber;
|
||||
|
|
|
|||
|
|
@ -51,17 +51,17 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
|||
case 1:
|
||||
paramMap = getCompanyVersionMapper().getHrmSubComp(id);
|
||||
saveSubComToVersion(paramMap, user);
|
||||
saveSubComToMap(paramMap);
|
||||
// saveSubComToMap(paramMap);
|
||||
break;
|
||||
case 2:
|
||||
paramMap = getCompanyVersionMapper().getHrmDepartment(id);
|
||||
saveDeptToVersion(paramMap, user);
|
||||
saveDeptToMap(paramMap);
|
||||
// saveDeptToMap(paramMap);
|
||||
break;
|
||||
case 4:
|
||||
paramMap = getCompanyVersionMapper().getHrmResource(id);
|
||||
saveHrmToVersion(paramMap, user);
|
||||
saveHrmToMap(paramMap);
|
||||
// saveHrmToMap(paramMap);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.organization.web;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.OrgChartWrapper;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -143,4 +144,21 @@ public class OrgChartController {
|
|||
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);
|
||||
}
|
||||
|
||||
public String synchronousData(Map<String, Object> request2Map) {
|
||||
return getOrgChartService(user).synchronousData(request2Map, user);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue