2022-09-27 21:19:37 +08:00
|
|
|
package com.engine.bjcj220907.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.druid.support.json.JSONUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.engine.bjcj220907.entity.Attend4MonthBonus;
|
|
|
|
|
import com.engine.bjcj220907.service.GetKQ4OverseasAllowanceCountService;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.kq.cmd.report.GetKQReportCmd;
|
|
|
|
|
import com.weaver.general.BaseBean;
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Harryxzy
|
|
|
|
|
* @date 2022/09/27 15:56
|
|
|
|
|
* @description 拉取考勤中数据供境外津贴使用
|
|
|
|
|
*/
|
|
|
|
|
public class GetKQ4OverseasAllowanceCountServiceImpl extends Service implements GetKQ4OverseasAllowanceCountService {
|
|
|
|
|
|
|
|
|
|
BaseBean baseBean = new BaseBean();
|
|
|
|
|
/***
|
|
|
|
|
* @description 获取境外常驻用户考勤中请假天数以及公务回国天数
|
|
|
|
|
* @return Map<String,Double>
|
|
|
|
|
* @author Harryxzy
|
|
|
|
|
* @date 2022/9/27 15:58
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Double> getKQDatas(Attend4MonthBonus attend4MonthBonus) {
|
|
|
|
|
baseBean.writeLog("开始获取考勤数据,参数{}", attend4MonthBonus);
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM");
|
|
|
|
|
List<Map> columnsList = new ArrayList<>();
|
|
|
|
|
List<Map<String, String>> dataList = new ArrayList<>();
|
|
|
|
|
try {
|
|
|
|
|
Map<String, Object> paramsMap = new HashMap<String, Object>();
|
|
|
|
|
paramsMap.put("typeselect", "6");
|
|
|
|
|
paramsMap.put("pageIndex", 1);
|
|
|
|
|
paramsMap.put("pageSize", 10000);
|
|
|
|
|
paramsMap.put("fromDate", sdf.format(attend4MonthBonus.getBeginDate()));
|
|
|
|
|
paramsMap.put("toDate", sdf.format(attend4MonthBonus.getEndDate()));
|
|
|
|
|
paramsMap.put("viewScope", "0");
|
|
|
|
|
paramsMap.put("isNoAccount", "1");
|
|
|
|
|
paramsMap.put("attendanceSerial", "0");
|
|
|
|
|
paramsMap.put("status", "9");
|
|
|
|
|
Map<String, Object> temp = new HashMap<String, Object>();
|
|
|
|
|
temp.put("data", JSONObject.toJSONString(paramsMap));
|
|
|
|
|
temp.put("reportType", "month");
|
2022-09-28 15:58:46 +08:00
|
|
|
baseBean.writeLog("开始执行GetKQReportCmd");
|
2022-09-27 21:19:37 +08:00
|
|
|
Map execute = commandExecutor.execute(new GetKQReportCmd(temp,user));
|
2022-09-28 15:58:46 +08:00
|
|
|
baseBean.writeLog("GetKQReportCmd执行成功");
|
2022-09-27 21:19:37 +08:00
|
|
|
// 获取列数据
|
|
|
|
|
columnsList = (List<Map>) execute.get("columns");
|
|
|
|
|
List c = new ArrayList();
|
2022-09-28 15:58:46 +08:00
|
|
|
String[] gwhgDataIndex={""};
|
2022-09-27 21:19:37 +08:00
|
|
|
columnsList.stream().forEach(column->{
|
|
|
|
|
if(column.get("title").equals("旷工")){
|
|
|
|
|
c.add(column.get("dataIndex"));
|
|
|
|
|
}
|
|
|
|
|
if(column.get("title").equals("出差及请假")){
|
|
|
|
|
List<Map> children =(List<Map>) column.get("children");
|
|
|
|
|
children.stream().forEach(i->{
|
2022-09-28 15:58:46 +08:00
|
|
|
if((!i.get("title").equals("境内年假")) && (!i.get("title").equals("境外年假")) && (!i.get("title").equals("工伤"))){
|
2022-09-27 21:19:37 +08:00
|
|
|
c.add(i.get("dataIndex"));
|
|
|
|
|
}
|
2022-09-28 15:58:46 +08:00
|
|
|
if(i.get("title").equals("公务回国") ){
|
|
|
|
|
gwhgDataIndex[0] =(String) column.get("dataIndex");
|
|
|
|
|
}
|
2022-09-27 21:19:37 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
baseBean.writeLog("计算缺勤列:"+c);
|
|
|
|
|
dataList = (List<Map<String, String>>) execute.get("datas");
|
2022-09-28 15:58:46 +08:00
|
|
|
// 获取每个人的缺勤天数、及公务回国天数
|
2022-09-27 21:19:37 +08:00
|
|
|
Map<String, Double> qqDays = new HashMap<>();
|
2022-09-28 15:58:46 +08:00
|
|
|
String[] gwhgS= {""};
|
|
|
|
|
dataList.stream().forEach(i->{
|
|
|
|
|
double[] qq={0.0};
|
|
|
|
|
c.stream().forEach(j->{
|
|
|
|
|
// 累加各种请假天数
|
|
|
|
|
qq[0]+=Double.parseDouble(i.get(j));
|
|
|
|
|
});
|
|
|
|
|
String qqStr = i.get("resourceId") +"-qq";
|
|
|
|
|
qqDays.put(qqStr,qq[0]);
|
|
|
|
|
String gwhgStr = i.get("resourceId") + "-gwhg";
|
|
|
|
|
if(!gwhgDataIndex[0].equals("")){
|
|
|
|
|
gwhgS[0] = i.get(gwhgDataIndex[0]);
|
|
|
|
|
}else {
|
|
|
|
|
gwhgS[0] ="0";
|
|
|
|
|
}
|
|
|
|
|
qqDays.put(gwhgStr,Double.valueOf(gwhgS[0]));
|
|
|
|
|
});
|
|
|
|
|
baseBean.writeLog("获取的考勤缺勤及公务回国天数,{}", JSONUtils.toJSONString(qqDays));
|
2022-09-27 21:19:37 +08:00
|
|
|
return qqDays;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
baseBean.writeLog("获取考勤数据失败{}", e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|