| | |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.intf.common.ICarInoutInnerServiceSMO; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | |
| | | |
| | | public static final String DOMAIN = "OSS"; |
| | | public static final String BUCKET_NAME = "bucketName"; |
| | | public static final String ERROR_FOLDER = "导入错误记录/"; // 错误文件存储目录 |
| | | public static final String ERROR_FOLDER = "小区车辆进出场导入文件异常地址"; // 错误文件存储目录 |
| | | |
| | | @Autowired |
| | | private ICommunityInnerServiceSMO communityInnerServiceSMO; |
| | |
| | | } |
| | | |
| | | // 构建小区在OSS中的文件夹路径 |
| | | String communityFolder = "小区车辆进出场明细/" + communityName + "/"; |
| | | String communityFolder = MappingCache.getValue("OSS", "小区车辆进出场导入文件地址") + communityName + "/"; |
| | | |
| | | // 检查该小区文件夹是否存在 |
| | | if (!doesFolderExist(ossClient, bucketName, communityFolder)) { |
| | |
| | | |
| | | // 将解析成功的数据存入数据库,使用你的Service实现 |
| | | if (result.getSuccessRecords() != null && !result.getSuccessRecords().isEmpty()) { |
| | | int min = 100000000; |
| | | int max = 999999999; |
| | | Random RANDOM = new Random(); |
| | | for (CarInoutPo carInoutPo : result.getSuccessRecords()) { |
| | | // carInoutPo.setInoutId("937510345"); |
| | | carInoutPo.setInoutId((min + RANDOM.nextInt(max - min + 1))+""); |
| | | carInoutPo.setInoutId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_inoutId)); |
| | | carInoutPo.setCommunityId(community.getCommunityId()); |
| | | } |
| | | int[] counts = carInoutInnerServiceSMOImpl.batchSaveCarInout(result.getSuccessRecords()); |
| | |
| | | // 创建错误文件名,在原文件名前加"错误_" |
| | | String errorFileName = "错误_" + originalFileName; |
| | | // 错误文件存储路径 |
| | | String errorFileKey = ERROR_FOLDER + communityName + "/" + errorFileName; |
| | | String errorFileKey = MappingCache.getValue(DOMAIN, ERROR_FOLDER) + communityName + "/" + errorFileName; |
| | | |
| | | // 生成错误Excel文件 |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | |
| | | * 获取最近11天的日期字符串(格式:yyyy-MM-dd) |
| | | */ |
| | | private List<String> getRecent11Days() { |
| | | List<String> dates = new ArrayList<>(); |
| | | List<String> date = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | |
| | | for (int i = 0; i < 11; i++) { |
| | | dates.add(sdf.format(calendar.getTime())); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); // 前一天 |
| | | } |
| | | // 获取当前日期的前一天 |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | date.add(sdf.format(calendar.getTime())); |
| | | |
| | | return dates; |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 记录解析结果的内部类 |
| | | */ |