| | |
| | | |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.file.FileDto; |
| | | import com.java110.intf.common.IFileInnerServiceSMO; |
| | | import com.java110.intf.common.IFileRelInnerServiceSMO; |
| | | import com.java110.intf.user.IQuestionAnswerInnerServiceSMO; |
| | | import com.java110.po.file.FileRelPo; |
| | | import com.java110.po.questionAnswer.QuestionAnswerPo; |
| | | import com.java110.user.bmo.questionAnswer.ISaveQuestionAnswerBMO; |
| | | import com.java110.vo.ResultVo; |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service("saveQuestionAnswerBMOImpl") |
| | | public class SaveQuestionAnswerBMOImpl implements ISaveQuestionAnswerBMO { |
| | | |
| | | @Autowired |
| | | private IQuestionAnswerInnerServiceSMO questionAnswerInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFileInnerServiceSMO fileInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | |
| | | */ |
| | | @Java110Transactional |
| | | public ResponseEntity<String> save(QuestionAnswerPo questionAnswerPo) { |
| | | |
| | | questionAnswerPo.setQaId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_qaId)); |
| | | int flag = questionAnswerInnerServiceSMOImpl.saveQuestionAnswer(questionAnswerPo); |
| | | |
| | | if (flag > 0) { |
| | | //图片 |
| | | List<String> photos = questionAnswerPo.getPhotos(); |
| | | FileRelPo fileRelPo = new FileRelPo(); |
| | | fileRelPo.setFileRelId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_relId)); |
| | | fileRelPo.setObjId(questionAnswerPo.getQaId()); |
| | | //table表示表存储 ftp表示ftp文件存储 |
| | | fileRelPo.setSaveWay("ftp"); |
| | | fileRelPo.setCreateTime(new Date()); |
| | | //图片上传 |
| | | if (photos != null && photos.size() > 0) { |
| | | //28000表示问卷图片 |
| | | fileRelPo.setRelTypeCd("28000"); |
| | | for (String photo : photos) { |
| | | FileDto fileDto = new FileDto(); |
| | | fileDto.setCommunityId("-1"); |
| | | fileDto.setContext(photo); |
| | | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); |
| | | fileDto.setFileName(fileDto.getFileId()); |
| | | String fileName = fileInnerServiceSMOImpl.saveFile(fileDto); |
| | | fileRelPo.setFileRealName(fileName); |
| | | fileRelPo.setFileSaveName(fileName); |
| | | fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | } |
| | | } |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | } |
| | | |
| | | } |
| | | } |