|
@@ -5,11 +5,10 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.qmth.boot.tools.signature.SignatureType;
|
|
import com.qmth.boot.tools.signature.SignatureType;
|
|
|
|
+import com.qmth.distributed.print.business.bean.dto.SyncExamCardDto;
|
|
|
|
+import com.qmth.distributed.print.business.bean.dto.SyncExamStudentDto;
|
|
import com.qmth.distributed.print.business.config.DictionaryConfig;
|
|
import com.qmth.distributed.print.business.config.DictionaryConfig;
|
|
-import com.qmth.distributed.print.business.entity.BasicSchool;
|
|
|
|
-import com.qmth.distributed.print.business.entity.ExamPrintPlan;
|
|
|
|
-import com.qmth.distributed.print.business.entity.ExamStudent;
|
|
|
|
-import com.qmth.distributed.print.business.entity.TBSyncTask;
|
|
|
|
|
|
+import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
|
|
import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
|
|
import com.qmth.distributed.print.business.enums.TaskResultEnum;
|
|
import com.qmth.distributed.print.business.enums.TaskResultEnum;
|
|
import com.qmth.distributed.print.business.enums.TaskStatusEnum;
|
|
import com.qmth.distributed.print.business.enums.TaskStatusEnum;
|
|
@@ -18,12 +17,14 @@ import com.qmth.distributed.print.business.util.HttpKit;
|
|
import com.qmth.distributed.print.common.SignatureEntityTest;
|
|
import com.qmth.distributed.print.common.SignatureEntityTest;
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
|
|
import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
|
|
|
|
+import org.apache.commons.codec.digest.DigestUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
+import java.io.*;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
@@ -49,12 +50,21 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
@Autowired
|
|
@Autowired
|
|
private ExamStudentService examStudentService;
|
|
private ExamStudentService examStudentService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamDetailService examDetailService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamCardService examCardService;
|
|
|
|
+
|
|
private ExecutorService executors = Executors.newFixedThreadPool(5);
|
|
private ExecutorService executors = Executors.newFixedThreadPool(5);
|
|
|
|
|
|
private static final String SAVE_EXAM_TYPE = "MULTI_MEDIA";
|
|
private static final String SAVE_EXAM_TYPE = "MULTI_MEDIA";
|
|
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
|
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
|
private static final String POST_METHOD = "POST";
|
|
private static final String POST_METHOD = "POST";
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 定时任务批量同步
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public void syncToCloudReview() {
|
|
public void syncToCloudReview() {
|
|
// 查询可同步计划(同步状态为空:未同步,false:同步失败)
|
|
// 查询可同步计划(同步状态为空:未同步,false:同步失败)
|
|
@@ -69,6 +79,22 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 单个同步
|
|
|
|
+ * @param printPlanId
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void syncDataCloud(Long printPlanId) {
|
|
|
|
+ ExamPrintPlan examPrintPlan = examPrintPlanService.getById(printPlanId);
|
|
|
|
+ if(examPrintPlan == null){
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷计划数据异常");
|
|
|
|
+ }
|
|
|
|
+ if(Objects.nonNull(examPrintPlan.getSyncStatus()) && examPrintPlan.getSyncStatus()){
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷计划数据同步成功");
|
|
|
|
+ }
|
|
|
|
+ executors.execute(syncData(examPrintPlan));
|
|
|
|
+ }
|
|
|
|
+
|
|
private TimerTask syncData(ExamPrintPlan examPrintPlan) {
|
|
private TimerTask syncData(ExamPrintPlan examPrintPlan) {
|
|
return new TimerTask() {
|
|
return new TimerTask() {
|
|
@Override
|
|
@Override
|
|
@@ -89,18 +115,30 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
try {
|
|
try {
|
|
// 校验同步url
|
|
// 校验同步url
|
|
validatUrl();
|
|
validatUrl();
|
|
|
|
+ UpdateWrapper<TBSyncTask> tbSyncTaskUpdateWrapper = new UpdateWrapper<>();
|
|
|
|
+ tbSyncTaskUpdateWrapper.lambda().set(TBSyncTask::getStatus, TaskStatusEnum.RUNNING).eq(TBSyncTask::getId, syncTask.getId());
|
|
|
|
+ tbSyncTaskService.update(tbSyncTaskUpdateWrapper);
|
|
|
|
+
|
|
// 同步计划 -> 对应云阅卷考试
|
|
// 同步计划 -> 对应云阅卷考试
|
|
- Long thirdRelateId = saveExam(examPrintPlan);
|
|
|
|
|
|
+ ExamPrintPlan printPlan = examSave(examPrintPlan);
|
|
// 考试同步成功,才能同步考生和题卡
|
|
// 考试同步成功,才能同步考生和题卡
|
|
- if (Objects.nonNull(thirdRelateId)) {
|
|
|
|
-
|
|
|
|
|
|
+ if (Objects.nonNull(printPlan.getThirdRelateId())) {
|
|
|
|
+ studentSave(printPlan);
|
|
|
|
+ cardUpload(printPlan);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 更新计划状态
|
|
|
|
+ UpdateWrapper<ExamPrintPlan> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.lambda().set(ExamPrintPlan::getSyncStatus, true).eq(ExamPrintPlan::getId, examPrintPlan.getId());
|
|
|
|
+ examPrintPlanService.update(updateWrapper);
|
|
|
|
+
|
|
|
|
+ // 更新日志表
|
|
|
|
+ syncTask.setResult(TaskResultEnum.SUCCESS);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- syncTask.setStatus(TaskStatusEnum.FINISH);
|
|
|
|
syncTask.setResult(TaskResultEnum.ERROR);
|
|
syncTask.setResult(TaskResultEnum.ERROR);
|
|
syncTask.setErrorMessage(e.getMessage());
|
|
syncTask.setErrorMessage(e.getMessage());
|
|
} finally {
|
|
} finally {
|
|
|
|
+ syncTask.setStatus(TaskStatusEnum.FINISH);
|
|
tbSyncTaskService.saveOrUpdate(syncTask);
|
|
tbSyncTaskService.saveOrUpdate(syncTask);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -126,7 +164,7 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
* @param examPrintPlan
|
|
* @param examPrintPlan
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public Long saveExam(ExamPrintPlan examPrintPlan) {
|
|
|
|
|
|
+ public ExamPrintPlan examSave(ExamPrintPlan examPrintPlan) {
|
|
String hostUrl = dictionaryConfig.syncDataDomain().getHostUrl();
|
|
String hostUrl = dictionaryConfig.syncDataDomain().getHostUrl();
|
|
String examSaveUrl = dictionaryConfig.syncDataDomain().getExamSaveUrl();
|
|
String examSaveUrl = dictionaryConfig.syncDataDomain().getExamSaveUrl();
|
|
String postUrl = hostUrl.concat(examSaveUrl);
|
|
String postUrl = hostUrl.concat(examSaveUrl);
|
|
@@ -143,9 +181,9 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
if (jsonObject.containsKey("id")) {
|
|
if (jsonObject.containsKey("id")) {
|
|
Long id = Long.valueOf(jsonObject.get("id").toString());
|
|
Long id = Long.valueOf(jsonObject.get("id").toString());
|
|
UpdateWrapper<ExamPrintPlan> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<ExamPrintPlan> updateWrapper = new UpdateWrapper<>();
|
|
- updateWrapper.lambda().set(ExamPrintPlan::getThirdRelateId, id).set(ExamPrintPlan::getSyncStatus, true);
|
|
|
|
|
|
+ updateWrapper.lambda().set(ExamPrintPlan::getThirdRelateId, id).eq(ExamPrintPlan::getId, examPrintPlan.getId());
|
|
examPrintPlanService.update(updateWrapper);
|
|
examPrintPlanService.update(updateWrapper);
|
|
- return id;
|
|
|
|
|
|
+ return examPrintPlanService.getById(examPrintPlan.getId());
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
@@ -159,14 +197,13 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public void saveStudent(ExamPrintPlan examPrintPlan) {
|
|
|
|
|
|
+ public void studentSave(ExamPrintPlan examPrintPlan) {
|
|
String hostUrl = dictionaryConfig.syncDataDomain().getHostUrl();
|
|
String hostUrl = dictionaryConfig.syncDataDomain().getHostUrl();
|
|
String studentSaveUrl = dictionaryConfig.syncDataDomain().getStudentSaveUrl();
|
|
String studentSaveUrl = dictionaryConfig.syncDataDomain().getStudentSaveUrl();
|
|
String postUrl = hostUrl.concat(studentSaveUrl);
|
|
String postUrl = hostUrl.concat(studentSaveUrl);
|
|
|
|
|
|
- List<ExamStudent> examStudents = examStudentService.listStudentByPrintPlanIdAndSyncStatus(examPrintPlan.getId());
|
|
|
|
- for (ExamStudent examStudent : examStudents) {
|
|
|
|
- Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
|
+ List<SyncExamStudentDto> examStudents = examStudentService.listStudentByPrintPlanIdAndSyncStatus(examPrintPlan.getId());
|
|
|
|
+ for (SyncExamStudentDto examStudent : examStudents) {
|
|
try {
|
|
try {
|
|
//参数
|
|
//参数
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|
|
@@ -175,10 +212,10 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
map.put("studentCode", examStudent.getStudentCode());
|
|
map.put("studentCode", examStudent.getStudentCode());
|
|
map.put("name", examStudent.getStudentName());
|
|
map.put("name", examStudent.getStudentName());
|
|
map.put("college", "无");
|
|
map.put("college", "无");
|
|
-// map.put("className", examStudent.get());
|
|
|
|
|
|
+ map.put("className", getClassName(examStudent.getExtendFields()));
|
|
map.put("teacher", "无");
|
|
map.put("teacher", "无");
|
|
-// map.put("subjectCode", examStudent.get());
|
|
|
|
-// map.put("subjectName", tcPExamStudent.getCourseName());
|
|
|
|
|
|
+ map.put("subjectCode", examStudent.getPaperNumber()); // 取试卷编号
|
|
|
|
+ map.put("subjectName", examStudent.getCourseName());
|
|
|
|
|
|
String result = HttpKit.sendPost(postUrl, getHeaders(examPrintPlan.getSchoolId(), studentSaveUrl), map, null, null, null);
|
|
String result = HttpKit.sendPost(postUrl, getHeaders(examPrintPlan.getSchoolId(), studentSaveUrl), map, null, null, null);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
@@ -198,69 +235,61 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- /*public void saveCard(ExamPrintPlan examPrintPlan) {
|
|
|
|
|
|
+ public void cardUpload(ExamPrintPlan examPrintPlan) {
|
|
String hostUrl = dictionaryConfig.syncDataDomain().getHostUrl();
|
|
String hostUrl = dictionaryConfig.syncDataDomain().getHostUrl();
|
|
- String studentSaveUrl = dictionaryConfig.syncDataDomain().getStudentSaveUrl();
|
|
|
|
- String postUrl = hostUrl.concat(studentSaveUrl);
|
|
|
|
- List<TcPCard> cards = tcPCardMapper.selectListNotSyncSuccess(tcPExam.getId());
|
|
|
|
- cards.forEach(tcPCard -> {
|
|
|
|
- //题卡卡内容
|
|
|
|
- QueryWrapper<TcPCardDetail> tcPCardDetailQueryWrapper = new QueryWrapper<>();
|
|
|
|
- tcPCardDetailQueryWrapper.lambda().eq(TcPCardDetail::getCardId, tcPCard.getId());
|
|
|
|
- TcPCardDetail tcPCardDetail = tcPCardDetailMapper.selectOne(tcPCardDetailQueryWrapper);
|
|
|
|
-
|
|
|
|
- Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
- if (StringUtils.isNotEmpty(tcPCardDetail.getContent())) {
|
|
|
|
|
|
+ String cardUploadUrl = dictionaryConfig.syncDataDomain().getCardUploadUrl();
|
|
|
|
+ String postUrl = hostUrl.concat(cardUploadUrl);
|
|
|
|
+ List<ExamDetailCourse> examDetailCourses = examDetailService.listSyncPaperNumberByPrintPlanId(examPrintPlan.getId());
|
|
|
|
+ if (CollectionUtils.isEmpty(examDetailCourses)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ for (ExamDetailCourse examDetailCours : examDetailCourses) {
|
|
|
|
+ List<SyncExamCardDto> syncExamCardDtos = examCardService.listSyncCardByCourseCodeAndPaperNumber(examDetailCours.getSchoolId(), examDetailCours.getCourseCode(), examDetailCours.getPaperNumber());
|
|
|
|
+ if (CollectionUtils.isEmpty(syncExamCardDtos) || syncExamCardDtos.size() != 1) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("数据异常,通过学校:%s,课程代码:%s,试卷编号:%s查出多个题卡数据", examDetailCours.getSchoolId(), examDetailCours.getCourseCode(), examDetailCours.getPaperNumber()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ SyncExamCardDto syncExamCardDto = syncExamCardDtos.get(0);
|
|
|
|
+ if (StringUtils.isNotEmpty(syncExamCardDto.getContent())) {
|
|
//生成json文件
|
|
//生成json文件
|
|
File file = null;
|
|
File file = null;
|
|
try {
|
|
try {
|
|
- String filePath = makeDirs();
|
|
|
|
- file = FileHelper.createJsonFile(filePath);
|
|
|
|
- createFile(file, tcPCardDetail.getContent());
|
|
|
|
|
|
+ String filePath = SystemConstant.TEMP_FILES_DIR + File.separator + "card-upload" + File.separator + System.currentTimeMillis();
|
|
|
|
+ file = createJsonFile(filePath, syncExamCardDto.getContent());
|
|
Map<String, String> files = new HashMap<>();
|
|
Map<String, String> files = new HashMap<>();
|
|
if (file.exists()) {
|
|
if (file.exists()) {
|
|
- files.put(tcPCard.getTitle(), file.getPath());
|
|
|
|
|
|
+ files.put(syncExamCardDto.getTitle(), file.getPath());
|
|
}
|
|
}
|
|
|
|
|
|
- log.info("同步题卡:考试id:{},题卡id:{},开始同步", tcPExam.getId(), tcPCard.getId());
|
|
|
|
//表单数据
|
|
//表单数据
|
|
Map<String, String> formText = new HashMap<>();
|
|
Map<String, String> formText = new HashMap<>();
|
|
- formText.put("examId", String.valueOf(tcPExam.getExternalId()));
|
|
|
|
- formText.put("subjectCode", tcPCard.getCourseCode());
|
|
|
|
|
|
+ formText.put("examId", String.valueOf(examPrintPlan.getThirdRelateId()));
|
|
|
|
+ formText.put("subjectCode", syncExamCardDto.getPaperNumber());
|
|
formText.put("format", "json");
|
|
formText.put("format", "json");
|
|
formText.put("md5", DigestUtils.md5Hex(new FileInputStream(file)));
|
|
formText.put("md5", DigestUtils.md5Hex(new FileInputStream(file)));
|
|
|
|
|
|
|
|
|
|
- log.info("同步题卡:考试id:{},题卡id:{},请求url:{}, 表单参数:{},表头参数:{},发送请求", tcPExam.getId(), tcPCard.getId(), url, JSONObject.toJSONString(formText), JSONObject.toJSONString(getHeaders(cardUrl)));
|
|
|
|
- String result = HttpKit.sendPost(url, getHeaders(cardUrl), formText, files, null, null);
|
|
|
|
|
|
+ String result = HttpKit.sendPost(postUrl, getHeaders(examDetailCours.getSchoolId(), cardUploadUrl), formText, files, null, null);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
if (jsonObject.containsKey("success")) {
|
|
if (jsonObject.containsKey("success")) {
|
|
- log.info("同步题卡:考试id:{},题卡id:{},请求成功,返回数据:{}", tcPExam.getId(), tcPCard.getId(), result);
|
|
|
|
- resultMap.put("success", true);
|
|
|
|
- resultMap.put("msg", jsonObject.get("success"));
|
|
|
|
|
|
+ String success = jsonObject.get("success").toString();
|
|
|
|
+ if (Boolean.valueOf(success)) {
|
|
|
|
+ UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.lambda().set(ExamCard::getSyncStatus, true).eq(ExamCard::getId, syncExamCardDto.getId());
|
|
|
|
+ examCardService.update(updateWrapper);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- resultMap.put("success", false);
|
|
|
|
- resultMap.put("msg", e.getMessage());
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
} finally {
|
|
} finally {
|
|
if (file != null && file.exists()) {
|
|
if (file != null && file.exists()) {
|
|
file.delete();
|
|
file.delete();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- resultMap.put("success", false);
|
|
|
|
- resultMap.put("msg", "题卡内容为空");
|
|
|
|
}
|
|
}
|
|
- Boolean success = Boolean.valueOf(resultMap.get("success").toString());
|
|
|
|
- String msg = resultMap.get("msg").toString();
|
|
|
|
- log.info("同步题卡:考试id:{},题卡id:{},请求状态:{},返回数据:{}", tcPExam.getId(), tcPCard.getId(), success, msg);
|
|
|
|
|
|
|
|
- String relaName = tcPCard.getCourseName().concat("(").concat(tcPCard.getCourseCode()).concat(")");
|
|
|
|
- TcPExamSyncRecord tcPExamSyncRecord = new TcPExamSyncRecord(tcPExam.getId(), "card", tcPCard.getId(), relaName, success, msg);
|
|
|
|
- saveSyncRecord(tcPExamSyncRecord, "card", cards.size());
|
|
|
|
- log.info("同步题卡:考试id:{},题卡id:{},保存同步记录成功,保存参数:{}", tcPExam.getId(), tcPCard.getId(), JSONObject.toJSONString(tcPExamSyncRecord));
|
|
|
|
- });
|
|
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* http请求头
|
|
* http请求头
|
|
@@ -296,4 +325,41 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
String signature = SignatureEntityTest.build(SignatureType.SECRET, POST_METHOD, url, time, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
|
|
String signature = SignatureEntityTest.build(SignatureType.SECRET, POST_METHOD, url, time, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
|
|
return signature;
|
|
return signature;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private String getClassName(String extendCloumn) {
|
|
|
|
+ List<Map> mapList = JSONObject.parseArray(extendCloumn, Map.class);
|
|
|
|
+ for (Map map : mapList) {
|
|
|
|
+ if (Objects.equals("className", map.get("code").toString())) {
|
|
|
|
+ return map.get("value").toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return "无";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 生成文件
|
|
|
|
+ * @param file 文件路径+文件名称
|
|
|
|
+ * @param conent 要生成的文件内容
|
|
|
|
+ */
|
|
|
|
+ public static File createJsonFile(String url, String conent) {
|
|
|
|
+
|
|
|
|
+ File file = new File(url);
|
|
|
|
+ if (!file.exists()) {
|
|
|
|
+ file.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ BufferedWriter out = null;
|
|
|
|
+ file = new File(file, UUID.randomUUID().toString() + ".json");
|
|
|
|
+ try {
|
|
|
|
+ file.createNewFile();
|
|
|
|
+ out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
|
|
|
|
+ out.write(conent);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ out.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return file;
|
|
|
|
+ }
|
|
}
|
|
}
|