old mode 100644
new mode 100755
| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.dto.attendanceClasses.AttendanceClassesDto; |
| | | import com.java110.dto.attendance.AttendanceClassesDto; |
| | | import com.java110.dto.org.OrgStaffRelDto; |
| | | import com.java110.entity.order.Business; |
| | | import com.java110.dto.system.Business; |
| | | import com.java110.intf.common.IAttendanceClassesInnerServiceSMO; |
| | | import com.java110.intf.user.IOrgStaffRelInnerServiceSMO; |
| | | import com.java110.job.adapt.DatabusAdaptImpl; |
| | | import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn; |
| | | import com.java110.po.attendanceClasses.AttendanceClassesPo; |
| | | import com.java110.po.attendance.AttendanceClassesPo; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Override |
| | | public void execute(Business business, List<Business> businesses) { |
| | | JSONObject data = business.getData(); |
| | | JSONArray businessOwnerAttendances = new JSONArray(); |
| | | if (data.containsKey(AttendanceClassesPo.class.getSimpleName())) { |
| | | Object bObj = data.get(AttendanceClassesPo.class.getSimpleName()); |
| | | JSONArray businessOwnerAttendances = null; |
| | | if (bObj instanceof JSONObject) { |
| | | businessOwnerAttendances = new JSONArray(); |
| | | businessOwnerAttendances.add(bObj); |
| | | } else if (bObj instanceof List) { |
| | | businessOwnerAttendances = JSONArray.parseArray(JSONObject.toJSONString(bObj)); |
| | |
| | | businessOwnerAttendances = (JSONArray) bObj; |
| | | } |
| | | //JSONObject businessOwnerAttendance = data.getJSONObject("businessOwnerAttendance"); |
| | | for (int bOwnerAttendanceIndex = 0; bOwnerAttendanceIndex < businessOwnerAttendances.size(); bOwnerAttendanceIndex++) { |
| | | JSONObject businessOwnerAttendance = businessOwnerAttendances.getJSONObject(bOwnerAttendanceIndex); |
| | | doSendOwnerAttendance(business, businessOwnerAttendance); |
| | | } else { |
| | | if (data instanceof JSONObject) { |
| | | businessOwnerAttendances.add(data); |
| | | } |
| | | } |
| | | |
| | | for (int bOwnerAttendanceIndex = 0; bOwnerAttendanceIndex < businessOwnerAttendances.size(); bOwnerAttendanceIndex++) { |
| | | JSONObject businessOwnerAttendance = businessOwnerAttendances.getJSONObject(bOwnerAttendanceIndex); |
| | | doSendOwnerAttendance(business, businessOwnerAttendance); |
| | | } |
| | | } |
| | | |
| | |
| | | Assert.listOnlyOne(attendanceDtos, "未找到考勤班组"); |
| | | |
| | | //查询考勤组下的员工 |
| | | String classObjType = attendanceDtos.get(0).getClassesObjType(); |
| | | List<JSONObject> staffs = null; |
| | | switch (classObjType) { |
| | | case AttendanceClassesDto.CLASSES_OBJ_TYPE_PARTMENT: |
| | | staffs = getPartmentStaff(attendanceDtos.get(0)); |
| | | break; |
| | | default: |
| | | staffs = new ArrayList<>(); |
| | | } |
| | | // String classObjType = attendanceDtos.get(0).getClassesObjType(); |
| | | // List<JSONObject> staffs = null; |
| | | // switch (classObjType) { |
| | | // case AttendanceClassesDto.CLASSES_OBJ_TYPE_PARTMENT: |
| | | // staffs = getPartmentStaff(attendanceDtos.get(0)); |
| | | // break; |
| | | // default: |
| | | // staffs = new ArrayList<>(); |
| | | // } |
| | | |
| | | |
| | | JSONObject postParameters = new JSONObject(); |
| | |
| | | postParameters.put("extClassesId", attendanceDtos.get(0).getClassesId()); |
| | | postParameters.put("extCommunityId", "-1"); |
| | | postParameters.put("attrs", JSONArray.parseArray(JSONArray.toJSONString(attendanceDtos.get(0).getAttrs()))); |
| | | hcOwnerAttendanceAsynImpl.addAttendance(postParameters, staffs); |
| | | hcOwnerAttendanceAsynImpl.addAttendance(postParameters, null); |
| | | } |
| | | |
| | | private List<JSONObject> getPartmentStaff(AttendanceClassesDto attendanceClassesDto) { |
| | |
| | | staffObj.put("extClassesId", attendanceClassesDto.getClassesId()); |
| | | staffObj.put("extStaffId", orgStaffRelDto1.getStaffId()); |
| | | staffObj.put("staffName", orgStaffRelDto1.getStaffName()); |
| | | staffObj.put("departmentId", orgStaffRelDto1.getDepartmentId()); |
| | | staffObj.put("departmentName", orgStaffRelDto1.getDepartmentName()); |
| | | staffObj.put("departmentId", attendanceClassesDto.getClassesObjId()); |
| | | staffObj.put("departmentName", attendanceClassesDto.getClassesObjName()); |
| | | staffObjs.add(staffObj); |
| | | } |
| | | return staffObjs; |