|
@ -6,6 +6,7 @@ import com.yihu.jw.exception.business.file_upload.FailedUploadFileException;
|
|
|
import com.yihu.jw.file_upload.FileUploadService;
|
|
|
import com.yihu.jw.patient.dao.settings.AccountAppealDao;
|
|
|
import com.yihu.jw.restmodel.base.patient.AccountAppealVO;
|
|
|
import com.yihu.jw.restmodel.iot.common.UploadVO;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@ -35,7 +36,7 @@ public class AccountAppealService extends BaseJpaService<AccountAppealDO, Accoun
|
|
|
@Autowired
|
|
|
private FileUploadService fileUploadService;
|
|
|
|
|
|
@Value("fastDFS.fastdfs_file_url")
|
|
|
@Value("${fastDFS.fastdfs_file_url}")
|
|
|
private String fastdfsUrl;
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@ -44,7 +45,9 @@ public class AccountAppealService extends BaseJpaService<AccountAppealDO, Accoun
|
|
|
Assert.notNull(mobile, "申诉手机号不可为空");
|
|
|
Assert.notNull(name, "申诉姓名不可为空");
|
|
|
Assert.notNull(idcard, "申诉证件号不可为空");
|
|
|
AccountAppealDO accoutAppeal = new AccountAppealDO();
|
|
|
if (!CollectionUtils.isEmpty(images)) {
|
|
|
StringBuilder img = new StringBuilder();
|
|
|
images.forEach(one -> {
|
|
|
InputStream inputStream = null;
|
|
|
try {
|
|
@ -54,18 +57,20 @@ public class AccountAppealService extends BaseJpaService<AccountAppealDO, Accoun
|
|
|
}
|
|
|
String fileName = one.getOriginalFilename();
|
|
|
try {
|
|
|
fileUploadService.uploadStream(inputStream, fileName, fastdfsUrl);
|
|
|
UploadVO uploadVO = fileUploadService.uploadStream(inputStream, fileName, fastdfsUrl);
|
|
|
img.append(uploadVO.getFullUrl()).append(",");
|
|
|
} catch (Exception e) {
|
|
|
throw new FailedUploadFileException("账号申诉证件图片上传失败");
|
|
|
}
|
|
|
});
|
|
|
accoutAppeal.setImg(img.toString());
|
|
|
}
|
|
|
AccountAppealDO accoutAppeal = new AccountAppealDO();
|
|
|
accoutAppeal.setType(type.getValue());
|
|
|
accoutAppeal.setName(name);
|
|
|
accoutAppeal.setIdcard(idcard);
|
|
|
accoutAppeal.setContent(content);
|
|
|
accoutAppeal.setMobile(mobile);
|
|
|
this.save(accoutAppeal);
|
|
|
return accoutAppeal;
|
|
|
}
|
|
|
}
|