Commit a46efbdd authored by daijunxiong's avatar daijunxiong

删除启动类多余代码

parent 044f62c4
package com.mortals.xhx;
import com.mortals.framework.springcloud.boot.BaseWebApplication;
import com.mortals.xhx.module.dept.dao.ibatis.DeptDaoImpl;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl;
import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ImportResource;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@EnableFeignClients
@SpringBootApplication(scanBasePackages = {"com.mortals"})
@ServletComponentScan("com.mortals")
@ImportResource(locations = {"classpath:config/spring-config.xml"})
@Component
public class ManagerApplication extends BaseWebApplication {
// @Bean
......@@ -28,165 +19,11 @@ public class ManagerApplication extends BaseWebApplication {
// }
@Autowired
private DeptDaoImpl deptDao1;
private static DeptDaoImpl deptDao;
@Autowired
private StaffDaoImpl staffDao1;
private static StaffDaoImpl staffDao;
@Autowired
private StaffService service1;
private static StaffService service;
@Autowired
private DeptService deptService1;
private static DeptService deptService;
@PostConstruct
public void init() {
deptDao = deptDao1;
staffDao = staffDao1;
service = service1;
deptService = deptService1;
}
public static void main(String[] args) {
SpringApplication.run(ManagerApplication.class, args);
System.out.println("考勤管理项目启动!!!!!!!!!!!!!");
//人员-部门跟新 统计
// try {
// //部门同步
// String resultDept = ArtemisPostTest.callPostApiGetDeptList();
// JSONObject jsonObjectDept = JSON.parseObject(resultDept);
// JSONObject jsonObjectDept1 = jsonObjectDept.getJSONObject("data");
// DeptHikData deptHikData = JSONObject.parseObject(jsonObjectDept1.toJSONString(), DeptHikData.class);
// if (Objects.nonNull(deptHikData)) {
// for (ListDept listDept : deptHikData.getList()) {
// //查询数据库信息
// DeptEntity deptEntity = deptDao.queryDept(listDept.getOrgIndexCode());
// DeptEntity deptEntityParent = deptDao.queryDeptParient(listDept.getParentOrgIndexCode());
// //新增
// if (Objects.isNull(deptEntity)) {
// deptEntity.initAttrValue();
// if (Objects.nonNull(deptEntityParent)) {
// deptEntity.setParentId(deptEntityParent.getId());
// }
// deptEntity.setDeptName(listDept.getOrgName());
// deptEntity.setDeptCode(listDept.getOrgIndexCode());
// deptEntity.setAncestors(listDept.getOrgPath());
// deptEntity.setDeptStatus(1);
// deptEntity.setOrderNum(0);
// deptEntity.setRemark(listDept.getParentOrgIndexCode());
// deptEntity.setCreateTime(new Date());
// deptEntity.setCreateUserId(Long.valueOf(1));
// deptEntity.setUpdateTime(new Date());
// deptEntity.setUpdateUserId(Long.valueOf(1));
// deptService.save(deptEntity);
// } else {
// //更新
// deptEntity.initAttrValue();
// if (Objects.nonNull(deptEntityParent)) {
// deptEntity.setParentId(deptEntityParent.getId());
// }
// deptEntity.setDeptName(listDept.getOrgName());
// deptEntity.setDeptCode(listDept.getOrgIndexCode());
// deptEntity.setAncestors(listDept.getOrgPath());
// deptEntity.setCreateTime(new Date());
// deptEntity.setPersonNum(0);
// deptEntity.setCreateUserId(Long.valueOf(1));
// deptService.update(deptEntity);
// }
// }
// }
// //同步员工
// String resultPerson = ArtemisPostTest.callPostApiGetPersonList();
// JSONObject jsonObject = JSON.parseObject(resultPerson);
// JSONObject jsonObject1 = jsonObject.getJSONObject("data");
// PersonHikData personHikData = JSONObject.parseObject(jsonObject1.toJSONString(), PersonHikData.class);
// if (Objects.nonNull(personHikData)) {
// for (ListItem list : personHikData.getList()) {
// //根据id获取本地数据
// StaffEntity staffEntity1 = staffDao.queryHik(list.getPersonId());
// DeptEntity deptEntity = deptDao.queryDept(list.getOrgIndexCode());
// //判断本地数据是否为空
// if (Objects.isNull(staffEntity1)) {
// //新增员工信息
// staffEntity1.initAttrValue();
// if (Objects.nonNull(staffEntity1)) {
// staffEntity1.setDeptId(deptEntity.getId());
// }
// staffEntity1.setName(list.getPersonName());
// staffEntity1.setRemarkId(list.getPersonId());
// staffEntity1.setPicUri(list.getPersonPhoto().getPicUri());
// staffEntity1.setServerIndexCode(list.getPersonPhoto().getServerIndexCode());
// staffEntity1.setDeptName(list.getOrgName());
// staffEntity1.setSource(1);
// staffEntity1.setStatus(1);
// staffEntity1.setGender(list.getGender());
// staffEntity1.setWorkNum(list.getJobNo());
// staffEntity1.setCreateUserId(Long.valueOf(1));
// staffEntity1.setCreateTime(new Date());
// if (list.getBirthday() != null) {
// staffEntity1.setBirthday((Date) list.getBirthday());
// }
// if (list.getPhoneNo() != null) {
// staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo()));
// }
// service.save(staffEntity1);
// //统计各级部门员工数量
// DeptEntity deptEntity1 = deptService.get(staffEntity1.getDeptId());
// String ancestor = deptEntity1.getAncestors().split(",", 2)[1];
// String[] ancestors = ancestor.split(",");
// for (String newAncestor : ancestors) {
// DeptEntity deptEntity2 = deptService.get(Long.valueOf(newAncestor));
// if (Objects.nonNull(deptEntity2)) {
// deptEntity2.setPersonNum(deptEntity2.getPersonNum() + 1);
// deptService.update(deptEntity2);
// }
// }
//
// }
// //本地数据不为空
// else {
// //更新员工信息
// staffEntity1.initAttrValue();
// if (Objects.nonNull(deptEntity)) {
// staffEntity1.setDeptId(deptEntity.getId());
// }
// staffEntity1.setName(list.getPersonName());
// staffEntity1.setRemarkId(list.getPersonId());
// staffEntity1.setPicUri(list.getPersonPhoto().getPicUri());
// staffEntity1.setServerIndexCode(list.getPersonPhoto().getServerIndexCode());
// staffEntity1.setDeptName(list.getOrgName());
// staffEntity1.setGender(list.getGender());
// staffEntity1.setWorkNum(list.getJobNo());
// staffEntity1.setCreateUserId(Long.valueOf(1));
// staffEntity1.setCreateTime(new Date());
// if (list.getBirthday() != null) {
// staffEntity1.setBirthday((Date) list.getBirthday());
// }
// if (list.getPhoneNo() != null) {
// staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo()));
// }
// service.update(staffEntity1);
// //统计各级部门员工数量
// DeptEntity deptEntity1 = deptService.get(staffEntity1.getDeptId());
// String ancestor = deptEntity1.getAncestors().split(",", 2)[1];
// String[] ancestors = ancestor.split(",");
// for (String newAncestor : ancestors) {
// DeptEntity deptEntity2 = deptService.get(Long.valueOf(newAncestor));
// if (Objects.nonNull(deptEntity2)) {
// deptEntity2.setPersonNum(deptEntity2.getPersonNum() + 1);
// deptService.update(deptEntity2);
// }
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment