|
@@ -21,6 +21,8 @@ import org.jeecg.modules.geke.makeUpCard.entity.MakeUpCard;
|
|
|
import org.jeecg.modules.geke.makeUpCard.service.IMakeUpCardService;
|
|
|
import org.jeecg.modules.geke.salary.entity.Salary;
|
|
|
import org.jeecg.modules.geke.salary.service.ISalaryService;
|
|
|
+import org.jeecg.modules.geke.userchange.entity.UserChage;
|
|
|
+import org.jeecg.modules.geke.userchange.service.IUserChageService;
|
|
|
import org.jeecg.modules.geke.userquit.entity.UserQuit;
|
|
|
import org.jeecg.modules.geke.userquit.service.IUserQuitService;
|
|
|
import org.jeecg.modules.geke.vacation.entity.Vacation;
|
|
@@ -101,6 +103,9 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
@Autowired
|
|
|
private IUserQuitService userQuitService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserChageService userChageService;
|
|
|
+
|
|
|
|
|
|
private DepartmentService departmentService=new DepartmentService();
|
|
|
|
|
@@ -774,10 +779,10 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
now.add(Calendar.DAY_OF_MONTH, -30);
|
|
|
startDate = now.getTime().getTime()/1000;
|
|
|
stDate = now.getTime();
|
|
|
- List<String> list = WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),null);
|
|
|
+ List<String> list = WeixinVacationList(String.valueOf(startDate),String.valueOf(endDate),null);
|
|
|
userQuitService.deleteQuit(sDate,eDate);
|
|
|
for (String ls:list){//循环审批id
|
|
|
- UserQuit quit = WeixinUserQuit(ls);
|
|
|
+ UserQuit quit = WeixinUserQuit(ls);
|
|
|
if (quit!=null){
|
|
|
lst.add(quit);
|
|
|
}
|
|
@@ -788,6 +793,78 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 人事变动
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> WeixinChange() throws IOException, ParseException {
|
|
|
+ Map<String,Object>map=new HashMap<>();
|
|
|
+ UrlData.getVacationToken();
|
|
|
+ UrlData.getToken();
|
|
|
+ String msg="ok";
|
|
|
+ List<UserQuit>lst=new ArrayList<>();
|
|
|
+ Calendar now = Calendar.getInstance();//获取系统时间实列
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ int actualMaximum = now.getActualMaximum(Calendar.DAY_OF_MONTH);//获取前端传过来的时间获取月份的总天数
|
|
|
+ String sDate = "";
|
|
|
+ String eDate = "";
|
|
|
+ Date stDate = null;
|
|
|
+ Date enDate = null;
|
|
|
+ long startDate;
|
|
|
+ long endDate;
|
|
|
+ endDate =now.getTime().getTime()/1000;
|
|
|
+ enDate = now.getTime();
|
|
|
+ now.add(Calendar.DAY_OF_MONTH, -30);
|
|
|
+ startDate = now.getTime().getTime()/1000;
|
|
|
+ stDate = now.getTime();
|
|
|
+ List<String> list = WeixinVacationList(String.valueOf(startDate),String.valueOf(endDate),null);
|
|
|
+ for (String ls:list){//循环审批id
|
|
|
+ UserChage userChage = WeixinUserChange(ls);
|
|
|
+ boolean f=false;
|
|
|
+ if (userChage!=null){
|
|
|
+ try {
|
|
|
+ f= userChageService.save(userChage);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> editUserChange() throws IOException, ParseException {
|
|
|
+ Calendar now = Calendar.getInstance();//获取系统时间实列
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date stDate =null;
|
|
|
+ Date enDate = now.getTime();
|
|
|
+ now.add(Calendar.DAY_OF_MONTH, -30);
|
|
|
+ now.add(Calendar.DAY_OF_MONTH, -30);
|
|
|
+ stDate=now.getTime();
|
|
|
+ List<UserChage> userChages = userChageService.listDate(sdf.format(stDate), sdf.format(enDate));
|
|
|
+ if (userChages!=null&&userChages.size()>0){
|
|
|
+ userChages.forEach(str->{
|
|
|
+ SysUser sysUser=new SysUser();
|
|
|
+ sysUser.setId(str.getUserId());
|
|
|
+ if (str.getEndPost()!=null&&!str.getEndPost().equals("")){
|
|
|
+ String one = sysPositionMapper.getOne(str.getEndPost());
|
|
|
+ if (one!=null){
|
|
|
+ sysUser.setPost(one);
|
|
|
+ }
|
|
|
+ }if (str.getEndWages()!=null&&!str.getEndWages().equals("")){
|
|
|
+ sysUser.setWagesOne(str.getEndWages());
|
|
|
+ }
|
|
|
+ sysUserService.updateById(sysUser);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 补卡
|
|
|
* @return
|
|
@@ -1102,6 +1179,114 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取微信审批实列-人事变动信息
|
|
|
+ * @param ls
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ public UserChage WeixinUserChange(String ls) throws IOException {
|
|
|
+ Map<String, Object> headers = Maps.newHashMap();//请求头集合
|
|
|
+ headers.put("Content-Type", "application/json; charset=utf-8");
|
|
|
+ ObjectMapper mapper = new ObjectMapper();//json转换实列
|
|
|
+ Map<String, Object> params = Maps.newHashMap();
|
|
|
+ UserChage userChage=null;
|
|
|
+ String errcode = "";
|
|
|
+ Map mapTypes = null;
|
|
|
+ try {
|
|
|
+ String createUrl = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail?access_token=" + UrlData.VacationToken;//调用企业微信审批详情接口
|
|
|
+ params.put("sp_no", ls);//审批id参数
|
|
|
+ String res = MyHttpUtils.httpPostRequestWithJson(createUrl, headers, params);//发送请求
|
|
|
+ mapTypes = JSON.parseObject(res);//json格式转换为map集合
|
|
|
+ errcode = mapTypes.get("errcode").toString();//获取接口返回的状态码
|
|
|
+ if (errcode.equals("0")) {//判断接口是否请求成功
|
|
|
+ WeixinApproval weixinApproval = JSONArray.parseObject(mapTypes.get("info").toString(), WeixinApproval.class);//字符串转实体类
|
|
|
+ if (weixinApproval != null && weixinApproval.getSp_status().equals("2")) {//获取数据库字段所需的数据
|
|
|
+ if (weixinApproval.getSp_name().equals("人事变动")) {
|
|
|
+ userChage = new UserChage();
|
|
|
+ userChage.setId(weixinApproval.getSp_no());
|
|
|
+ String us = weixinApproval.getApplyer().toString();
|
|
|
+ mapTypes = JSON.parseObject(us);
|
|
|
+ userChage.setConmitId(mapTypes.get("userid").toString());
|
|
|
+ //userChage.setDeptId(mapTypes.get("partyid").toString());
|
|
|
+ userChage.setConmitDate(new Date(Long.valueOf(weixinApproval.getApply_time()) * 1000));
|
|
|
+ List<Object> apply_data = weixinApproval.getApply_data();
|
|
|
+ String o = apply_data.get(0).toString();
|
|
|
+ mapTypes = JSON.parseObject(o);
|
|
|
+ String contents = mapTypes.get("contents").toString();
|
|
|
+ List<Map<String, Object>> tl = mapper.readValue(contents, new TypeReference<List<Map<String, Object>>>() {
|
|
|
+ });
|
|
|
+ Map value = null;
|
|
|
+ Map types = null;
|
|
|
+ for (Map str:tl){
|
|
|
+ if (str.get("control").equals("Selector")){
|
|
|
+ types = (Map) str.get("value");
|
|
|
+ types=(Map) types.get("selector");
|
|
|
+ List<Map<String, Object>> l = (List<Map<String, Object>>) types.get("options");
|
|
|
+ l = (List<Map<String, Object>>)l.get(0).get("value");
|
|
|
+ types=(Map) l.get(0);
|
|
|
+ userChage.setType(types.get("text").toString());
|
|
|
+ }else if (str.get("control").equals("Table")){
|
|
|
+ types = (Map) str.get("value");
|
|
|
+ List<Map<String, Object>> t =(List<Map<String, Object>>)types.get("children");
|
|
|
+ t =(List<Map<String, Object>>)t.get(0).get("list");
|
|
|
+ for (Map sr:t){
|
|
|
+ List<Map<String, Object>> tt=null;
|
|
|
+ if (sr.get("control").equals("Contact")){
|
|
|
+ types = (Map) sr.get("value");
|
|
|
+ List<Map<String, Object>> members = (List<Map<String, Object>>) types.get("members");
|
|
|
+ List<Map<String, Object>> departments = (List<Map<String, Object>>) types.get("departments");
|
|
|
+ if (types.get("members")!=null&&members.size()>0){
|
|
|
+ tt=(List<Map<String, Object>>)types.get("members");
|
|
|
+ userChage.setUserId(tt.get(0).get("userid").toString());
|
|
|
+ userChage.setRealname(tt.get(0).get("name").toString());
|
|
|
+ }else if (types.get("departments")!=null&&departments.size()>0){
|
|
|
+ tt= (List<Map<String, Object>>)types.get("departments");
|
|
|
+ userChage.setDeptId(tt.get(0).get("openapi_id").toString());
|
|
|
+ userChage.setDeptName(tt.get(0).get("name").toString());
|
|
|
+ }
|
|
|
+ }else if (sr.get("control").equals("Text")) {
|
|
|
+ List<Map<String,Object>>lis=(List<Map<String, Object>>)sr.get("title");
|
|
|
+ String f=null;
|
|
|
+ if (lis.get(0).get("text").equals("原职位")){
|
|
|
+ f="1";
|
|
|
+ }else if (lis.get(0).get("text").equals("新职位")){
|
|
|
+ f="2";
|
|
|
+ }else if (lis.get(0).get("text").equals("原薪资")){
|
|
|
+ f="3";
|
|
|
+ }else if (lis.get(0).get("text").equals("调整后薪资")){
|
|
|
+ f="4";
|
|
|
+ }
|
|
|
+ types=(Map) sr.get("value");
|
|
|
+ if (f!=null&&f.equals("1")){
|
|
|
+ userChage.setStartPost(types.get("text").toString());
|
|
|
+ }else if (f!=null&&f.equals("2")){
|
|
|
+ userChage.setEndPost(types.get("text").toString());
|
|
|
+ }else if (f!=null&&f.equals("3")){
|
|
|
+ userChage.setStartWages(types.get("text").toString());
|
|
|
+ }else if (f!=null&&f.equals("4")){
|
|
|
+ userChage.setEndWages(types.get("text").toString());
|
|
|
+ }
|
|
|
+ }else if (sr.get("control").equals("Date")) {
|
|
|
+ types=(Map) sr.get("value");
|
|
|
+ types=(Map) types.get("date");
|
|
|
+ userChage.setTime(new Date(Long.valueOf(types.get("s_timestamp").toString()) * 1000));
|
|
|
+ }else if (sr.get("control").equals("Textarea")) {
|
|
|
+ types=(Map) sr.get("value");
|
|
|
+ userChage.setDemo(types.get("text").toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return userChage;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取微信审批实列-入职,转正,离职信息
|