|
|
@@ -11,6 +11,7 @@ import com.jpsoft.employment.modules.base.entity.TrainingInfo;
|
|
|
import com.jpsoft.employment.modules.base.service.TrainingInfoService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import net.sf.json.JSONArray;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -58,6 +59,14 @@ public class TrainingInfoController {
|
|
|
trainingInfo.setCreateTime(new Date());
|
|
|
trainingInfo.setStatus("0");
|
|
|
|
|
|
+ if (trainingInfo.getFileList().size() > 0) {
|
|
|
+ List<FileDTO> fileList = trainingInfo.getFileList();
|
|
|
+
|
|
|
+ JSONArray jsonArray = JSONArray.fromObject(fileList);
|
|
|
+
|
|
|
+ trainingInfo.setFile(jsonArray.toString());
|
|
|
+ }
|
|
|
+
|
|
|
int affectCount = trainingInfoService.insert(trainingInfo);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
@@ -86,6 +95,25 @@ public class TrainingInfoController {
|
|
|
TrainingInfo trainingInfo = trainingInfoService.get(id);
|
|
|
|
|
|
if (trainingInfo != null) {
|
|
|
+ if (StringUtils.isNotEmpty(trainingInfo.getFile())) {
|
|
|
+ JSONArray jsonArray = JSONArray.fromObject(trainingInfo.getFile());
|
|
|
+
|
|
|
+ List<FileDTO> fileDTOList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(object);
|
|
|
+ String name = jsonObject.get("name").toString();
|
|
|
+ String url = jsonObject.get("url").toString();
|
|
|
+
|
|
|
+ FileDTO fileDTO = new FileDTO();
|
|
|
+ fileDTO.setName(name);
|
|
|
+ fileDTO.setUrl(url);
|
|
|
+ fileDTOList.add(fileDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ trainingInfo.setFileList(fileDTOList);
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(trainingInfo);
|
|
|
} else {
|
|
|
@@ -234,6 +262,26 @@ public class TrainingInfoController {
|
|
|
if (enterpriseInfo != null) {
|
|
|
trainingInfo.setEnterpriseName(enterpriseInfo.getName());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(trainingInfo.getFile())) {
|
|
|
+ JSONArray jsonArray = JSONArray.fromObject(trainingInfo.getFile());
|
|
|
+
|
|
|
+ List<FileDTO> fileDTOList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(object);
|
|
|
+ String name = jsonObject.get("name").toString();
|
|
|
+ String url = jsonObject.get("url").toString();
|
|
|
+
|
|
|
+ FileDTO fileDTO = new FileDTO();
|
|
|
+ fileDTO.setName(name);
|
|
|
+ fileDTO.setUrl(url);
|
|
|
+ fileDTOList.add(fileDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ trainingInfo.setFileList(fileDTOList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|