Commit aea74809 by 刘鑫

feat: 提取代码 方便代码跟踪

1 parent 6dd90739
......@@ -204,81 +204,88 @@ public class BeanRemoteServiceImpl {
log.warn("分站:{}工程师{}没有工号", departId, userDetailInfo.getUsername());
continue;
}
final Address address = userDetailInfo.getAddress();
//fixme 正式同步需移除当前逻辑
engineerCode = "BEAN" + engineerCode;
//查询是否有当前工程师工号
EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(engineerCode);
//获取有用信息保存工程师信息
if (Objects.isNull(engineerInfo)) {
engineerInfo = new EngineerInfoEntity();
}
engineerInfo.setEngineerCode(engineerCode);
engineerInfo.setName(userDetailInfo.getUsername());
engineerInfo.setGroupId(departId);
engineerInfo.setCosmosId(userDetailInfo.getHrId());
engineerInfo.setGender(userDetailInfo.getGender());
engineerInfo.setBirth(StringUtils.isBlank(userDetailInfo.getBirthday()) ? "" : getYear(userDetailInfo.getBirthday()));
engineerInfo.setAddress("");
engineerInfo.setPhone(userDetailInfo.getCellPhone());
engineerInfo.setKind(1 == userDetailInfo.getPartTimeRepair() ? 2 : 1);
engineerInfo.setGrade(Objects.isNull(userDetailInfo.getGrade()) ? "" : userDetailInfo.getGrade());
// engineerInfo.setCredentials();
//默认汽车
engineerInfo.setVehicle(1);
engineerInfo.setBeanStatus(0 == userDetailInfo.getIsDelete() ? 1 : 0);
//fixme 工作地址存贮
Address address = userDetailInfo.getAddress();
if (Objects.nonNull(address)) {
engineerInfo.setWorkAddress(address.getAddress());
} else {
engineerInfo.setWorkAddress("");
}
engineerInfo.setCreateTime(LocalDateTime.now());
engineerInfo.setUpdateTime(LocalDateTime.now());
EngineerInfoEntity engineerInfo = getEngineerInfoEntity(departId, engineerCode, userDetailInfo, address);
engineerInfoDao.save(engineerInfo);
engineerInfoDao.flush();
//保存业务属性信息--常用出发地信息
EngineerBusinessEntity engineerBusiness = engineerBusinessDao.getByEngineerCode(engineerCode);
if (Objects.nonNull(engineerBusiness)) {
continue;
}
EngineerBusinessEntity engineerBusiness = getEngineerBusiness(engineerCode, address);
if (engineerBusiness == null){ continue;}
engineerBusinessDao.save(engineerBusiness);
}
}
engineerBusiness = new EngineerBusinessEntity();
engineerBusiness.setEngineerCode(engineerCode);
//以下为数据库默认值
engineerBusiness.setWorkOn("08:00");
engineerBusiness.setWorkOff("18:00");
engineerBusiness.setMaxMinute(600);
engineerBusiness.setMaxNum(0);
engineerBusiness.setMaxDistance(0);
//fixme 工作地址存贮
if (Objects.nonNull(address)) {
engineerBusiness.setAddress(Objects.isNull(address.getAddress()) ? "" : address.getAddress());
engineerBusiness.setX(Objects.isNull(address.getLongitude()) ? "" : address.getLongitude());
engineerBusiness.setY(Objects.isNull(address.getLatitude()) ? "" : address.getLatitude());
} else {
engineerBusiness.setAddress("");
engineerBusiness.setX("");
engineerBusiness.setY("");
}
private EngineerInfoEntity getEngineerInfoEntity(String departId, String engineerCode, BeanUserDetail userDetailInfo, Address address) {
//查询是否有当前工程师工号
EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(engineerCode);
//获取有用信息保存工程师信息
if (Objects.isNull(engineerInfo)) {
engineerInfo = new EngineerInfoEntity();
}
engineerInfo.setEngineerCode(engineerCode);
engineerInfo.setName(userDetailInfo.getUsername());
engineerInfo.setGroupId(departId);
engineerInfo.setCosmosId(userDetailInfo.getHrId());
engineerInfo.setGender(userDetailInfo.getGender());
engineerInfo.setBirth(StringUtils.isBlank(userDetailInfo.getBirthday()) ? "" : getYear(userDetailInfo.getBirthday()));
engineerInfo.setAddress("");
engineerInfo.setPhone(userDetailInfo.getCellPhone());
engineerInfo.setKind(1 == userDetailInfo.getPartTimeRepair() ? 2 : 1);
engineerInfo.setGrade(Objects.isNull(userDetailInfo.getGrade()) ? "" : userDetailInfo.getGrade());
// engineerInfo.setCredentials();
//默认汽车
engineerInfo.setVehicle(1);
engineerInfo.setBeanStatus(0 == userDetailInfo.getIsDelete() ? 1 : 0);
engineerBusiness.setVehicle("1");
engineerBusiness.setVehicleNo("");
engineerBusiness.setPriority(1);
engineerBusiness.setDeparture(3);
engineerBusiness.setDispatchStrategy("CENTER");
engineerBusiness.setCreateTime(LocalDateTime.now());
engineerBusiness.setUpdateTime(LocalDateTime.now());
engineerBusinessDao.save(engineerBusiness);
//fixme 工作地址存贮
if (Objects.nonNull(address)) {
engineerInfo.setWorkAddress(address.getAddress());
} else {
engineerInfo.setWorkAddress("");
}
engineerInfo.setCreateTime(LocalDateTime.now());
engineerInfo.setUpdateTime(LocalDateTime.now());
return engineerInfo;
}
private EngineerBusinessEntity getEngineerBusiness(String engineerCode, Address address) {
EngineerBusinessEntity engineerBusiness = engineerBusinessDao.getByEngineerCode(engineerCode);
if (Objects.nonNull(engineerBusiness)) {
return null;
}
engineerBusiness = new EngineerBusinessEntity();
engineerBusiness.setEngineerCode(engineerCode);
//以下为数据库默认值
engineerBusiness.setWorkOn("08:00");
engineerBusiness.setWorkOff("18:00");
engineerBusiness.setMaxMinute(600);
engineerBusiness.setMaxNum(0);
engineerBusiness.setMaxDistance(0);
//fixme 工作地址存贮
if (Objects.nonNull(address)) {
engineerBusiness.setAddress(Objects.isNull(address.getAddress()) ? "" : address.getAddress());
engineerBusiness.setX(Objects.isNull(address.getLongitude()) ? "" : address.getLongitude());
engineerBusiness.setY(Objects.isNull(address.getLatitude()) ? "" : address.getLatitude());
} else {
engineerBusiness.setAddress("");
engineerBusiness.setX("");
engineerBusiness.setY("");
}
engineerBusiness.setVehicle("1");
engineerBusiness.setVehicleNo("");
engineerBusiness.setPriority(1);
engineerBusiness.setDeparture(3);
engineerBusiness.setDispatchStrategy("CENTER");
engineerBusiness.setCreateTime(LocalDateTime.now());
engineerBusiness.setUpdateTime(LocalDateTime.now());
return engineerBusiness;
}
private Date converter(String timestamp) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!