Commit 7afa8b64 authored by 高建强's avatar 高建强

item:人员导入新增数据同步

parent b25b6eb9
......@@ -4,7 +4,6 @@ import java.io.InputStream;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
......@@ -13,14 +12,11 @@ import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spire.ms.System.Collections.Specialized.CollectionsUtil;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto;
import io.github.classgraph.json.JSONUtils;
import io.micrometer.core.instrument.util.JsonUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
......@@ -34,6 +30,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
......@@ -73,12 +71,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.entity.RescueEquipment;
import com.yeejoin.amos.boot.module.common.api.entity.SpecialPositionStaff;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyCarServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonShiftServiceImpl;
......@@ -193,12 +185,15 @@ public class ExcelServiceImpl {
@Autowired
private OrgUsrMapper orgUsrMapper;
@Autowired
private IDataSyncService dataSyncService;
@Value("${logic}")
Boolean logic;
@Autowired
SignServiceImpl signServiceImpl;
public void templateExport(HttpServletResponse response, ExcelDto excelDto) throws ClassNotFoundException {
String url = excelDto.getClassUrl();
Class<?> clz = Class.forName(url);
......@@ -207,7 +202,7 @@ public class ExcelServiceImpl {
}
public void commonExport(HttpServletResponse response, ExcelDto excelDto, Map par) {
// ReginParams reginParams= getCurrentAllInfo();
// boolean authFalg= false;
// if(reginParams ==null) {
......@@ -304,7 +299,7 @@ public class ExcelServiceImpl {
break;
}
String nameString =null;
Long bizCompanyId =null;
Long bizCompanyId =null;
if(par!=null && par.size()>0) {
nameString =par.containsKey("name")?par.get("name").toString():null;
bizCompanyId =par.containsKey("bizCompanyId")?Long.parseLong(par.get("bizCompanyId").toString()):null;
......@@ -940,6 +935,14 @@ public class ExcelServiceImpl {
// 保存其余项
orgUsrExcelDto.setOrgUsrId(orgUsrDto.getSequenceNbr().toString());
savePeopleItem(orgUsrExcelDto);
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
dataSyncService.OrgUsrSyncDtoDataSync(orgUsrDto.getSequenceNbr());
}
});
}
} catch (Exception e) {
e.printStackTrace();
......@@ -1237,7 +1240,7 @@ public class ExcelServiceImpl {
}
private void excelImportFireStation(MultipartFile multipartFile) throws Exception {
List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1);
Map<String, String> maps = getAllBuildingIdForParentBuilingIds(excelDtoList);
List<FireStation> excelEntityList = new ArrayList<>();
......@@ -1570,7 +1573,7 @@ public class ExcelServiceImpl {
redisUtils.set(uuidString, 2);
}
}
}
private void ImportDutyPerson(MultipartFile multipartFile, String dutyType) throws Exception {
String fileName = multipartFile.getOriginalFilename();
......@@ -1607,7 +1610,7 @@ public class ExcelServiceImpl {
dutyFirstAidService.saveImportData(dataList);
}
}
}
private void initDutyFirstAidData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
......@@ -1660,7 +1663,7 @@ public class ExcelServiceImpl {
Map<String, Object> dutyPersonDtoMap = Bean.BeantoMap(dutyFirstAidDto);
dataList.add(dutyPersonDtoMap);
}
}
private void excelImportSafeReport(MultipartFile multipartFile) throws Exception {
......
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