| | |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.smo.IPhotoSMO; |
| | | import com.java110.dto.file.FileDto; |
| | | import com.java110.dto.file.FileRelDto; |
| | | import com.java110.intf.common.IFileInnerServiceSMO; |
| | | import com.java110.intf.common.IFileRelInnerServiceSMO; |
| | | import com.java110.po.file.FileRelPo; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PhotoSMOImpl implements IPhotoSMO { |
| | |
| | | @Autowired(required = false) |
| | | private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl; |
| | | |
| | | public int savePhoto(String photo, String objId, String communityId){ |
| | | return savePhoto(photo,objId,communityId,"11000"); |
| | | } |
| | | |
| | | @Override |
| | | public int savePhoto(String photo, String objId, String communityId) { |
| | | public int savePhoto(String photo, String objId, String communityId,String relTypeCd) { |
| | | if (StringUtil.isEmpty(photo)) { |
| | | return 0; |
| | | } |
| | |
| | | photo = fileName; |
| | | } |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.put("fileRelId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fileRelId)); |
| | | businessUnit.put("relTypeCd", "11000"); |
| | | businessUnit.put("relTypeCd", relTypeCd); |
| | | businessUnit.put("saveWay", "table"); |
| | | businessUnit.put("objId", objId); |
| | | businessUnit.put("fileRealName", photo); |
| | | businessUnit.put("fileSaveName", photo); |
| | | |
| | | FileRelDto fileRelDto = new FileRelDto(); |
| | | fileRelDto.setObjId(objId); |
| | | List<FileRelDto> fileRelDtos = fileRelInnerServiceSMOImpl.queryFileRels(fileRelDto); |
| | | |
| | | if(fileRelDtos == null || fileRelDtos.size()< 1){ |
| | | businessUnit.put("fileRelId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fileRelId)); |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | return fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | } |
| | | |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | return fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | fileRelPo.setFileRelId(fileRelDtos.get(0).getFileRelId()); |
| | | return fileRelInnerServiceSMOImpl.updateFileRel(fileRelPo); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | } |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.put("fileRelId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fileRelId)); |
| | | businessUnit.put("relTypeCd", "11000"); |
| | | businessUnit.put("saveWay", "table"); |
| | | businessUnit.put("objId", objId); |
| | | businessUnit.put("fileRealName", reqJson.getString("photo")); |
| | | businessUnit.put("fileSaveName", reqJson.getString("photo")); |
| | | |
| | | FileRelDto fileRelDto = new FileRelDto(); |
| | | fileRelDto.setObjId(objId); |
| | | List<FileRelDto> fileRelDtos = fileRelInnerServiceSMOImpl.queryFileRels(fileRelDto); |
| | | |
| | | if(fileRelDtos == null || fileRelDtos.size()< 1){ |
| | | businessUnit.put("fileRelId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fileRelId)); |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | return fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | } |
| | | |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | return fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | fileRelPo.setFileRelId(fileRelDtos.get(0).getFileRelId()); |
| | | return fileRelInnerServiceSMOImpl.updateFileRel(fileRelPo); |
| | | |
| | | |
| | | } |
| | | |
| | | } |