UploadPatentBatchService.java 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. package cn.cslg.pas.service;
  2. import cn.cslg.pas.common.core.base.Constants;
  3. import cn.cslg.pas.common.model.PatentCell;
  4. import cn.cslg.pas.common.model.dto.TaskWebSocketDTO;
  5. import cn.cslg.pas.common.model.params.*;
  6. import cn.cslg.pas.common.model.vo.ProjectImportPatentVO;
  7. import cn.cslg.pas.common.model.vo.TaskParams;
  8. import cn.cslg.pas.common.model.vo.UploadParamsVO;
  9. import cn.cslg.pas.common.model.vo.UploadSettingVO;
  10. import cn.cslg.pas.common.utils.*;
  11. import cn.cslg.pas.domain.*;
  12. import cn.cslg.pas.mapper.ImportErrorLogMapper;
  13. import cn.cslg.pas.mapper.WebTaskMapper;
  14. import cn.cslg.pas.service.asso.AssoProductPatentService;
  15. import cn.hutool.extra.spring.SpringUtil;
  16. import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  17. import lombok.RequiredArgsConstructor;
  18. import org.apache.poi.ss.usermodel.PictureData;
  19. import org.springframework.context.annotation.Lazy;
  20. import org.springframework.scheduling.annotation.Async;
  21. import org.springframework.stereotype.Service;
  22. import org.springframework.transaction.annotation.Transactional;
  23. import org.springframework.transaction.interceptor.TransactionAspectSupport;
  24. import java.text.ParseException;
  25. import java.text.SimpleDateFormat;
  26. import java.util.*;
  27. import java.util.stream.Collectors;
  28. @Service
  29. @RequiredArgsConstructor(onConstructor_ = {@Lazy})
  30. public class UploadPatentBatchService {
  31. private final FileUtils fileUtils;
  32. private final SystemDictService systemDictService;
  33. private final PatentImageService patentImageService;
  34. private final PatentService patentService;
  35. private final PatentAgencyService patentAgencyService;
  36. private final PatentInstructionTextService patentInstructionTextService;
  37. private final PatentRightService patentRightService;
  38. private final PatentAgentService patentAgentService;
  39. private final PatentPledgeService patentPledgeService;
  40. private final PatentLicensorService patentLicensorService;
  41. private final PatentSimpleFamilyService patentSimpleFamilyService;
  42. private final PatentInventorService patentInventorService;
  43. private final ProjectPatentLinkService projectPatentLinkService;
  44. private final ProjectFieldPatentLinkService projectFieldPatentLinkService;
  45. private final ProjectFolderPatentLinkService projectFolderPatentLinkService;
  46. private final PatentApplicantLinkService patentApplicantLinkService;
  47. private final PatentApplicantService patentApplicantService;
  48. private final PatentLabelService patentLabelService;
  49. private final PatentClassNumberLinkService patentClassNumberLinkService;
  50. private final PatentAffairService patentAffairService;
  51. private final ImportErrorLogMapper importErrorLogMapper;
  52. private final AssoProductPatentService assoProductPatentService;
  53. private final PatentInstructionService patentInstructionService;
  54. private static int FLAG = 0;
  55. @Async("singleThreadAsyncTaskExecutor")
  56. public void uploadPatentBatch(TaskParams params, ProjectImportPatentVO projectImportPatentVO) {
  57. //获得专利总数量
  58. Integer total = params.getRowList().size();
  59. try {
  60. //拿到存放在服务器的专利数据来源配置文件uploadSetting.json并按行读取文件字符流,返回整个文件字符串
  61. String getSettingJson = fileUtils.analysisJsonFile();
  62. //查找并装载本次导入的专利需要的数据源(如智慧芽)的对应配置(如前台传来的数据来源id是1,即“智慧芽”,那么jsonData装载的就是智慧芽的数据源配置)
  63. List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFiles(projectImportPatentVO, getSettingJson);
  64. //装载所有专利的摘要附图(key:专利行数 value:专利行数对应的专利的摘要附图图片数据)
  65. Map<String, PictureData> pictureDataMap = ExcelUtils.getDataFromExcel(params.getPath());
  66. //遍历所有专利(专利总数量),将数据进行装配并进行数据库操作
  67. for (int i = 0; i < params.getRowList().size(); i++) {
  68. //获取每一行的数据
  69. Map<Object, Object> row = params.getRowList().get(i);
  70. //专利基础数据装配(此步与数据源配置文件对象相关)
  71. UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
  72. //专利基础数据入库(专利表"os_patent"):专利基础数据根据UploadParamsVO中patent对象装载的专利号patentNo查询专利表“os_patent”,如果存在就将表中专利的Id装载到patent的id属性上,如果不存在就先将该专利数据入表后再装载Id
  73. getOneOrInsertOne(uploadParamsVO);
  74. //摘要附图数据装配及入库(摘要附图表"os_patent_img")
  75. PictureData pictureData = pictureDataMap.get(String.valueOf(i + 1));
  76. if (uploadParamsVO.getPatent() != null) {
  77. if (uploadParamsVO.getPatent().getId() != null && pictureData != null) {
  78. uploadParamsVO.getPatent().setAbstractPath(patentImageService.updatePatentImage(uploadParamsVO.getPatent().getId(), pictureData));
  79. }
  80. }
  81. //代理机构数据装配及入库(代理机构表"os_patent_agency")
  82. if (uploadParamsVO.getPatent() != null) {
  83. if (uploadParamsVO.getPatent().getAgencyId() != null) {
  84. uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(uploadParamsVO.getPatent().getAgencyId()));
  85. }
  86. }
  87. //将装配对象中的数据保存到数据库
  88. dataToDB(params, uploadParamsVO, projectImportPatentVO);
  89. //通过WebSocket 在每一次循环结束后 向前端发送完成进度
  90. WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
  91. .setTaskId(params.getTaskId())
  92. .setProjectId(projectImportPatentVO.getProjectId())
  93. .setComplete(false)
  94. .setIndex(i)
  95. .setTaskType(Constants.TASK_IMPORT_PATENT)
  96. .setPercentage(total == 0 ? 0 : Math.round((total.equals(i) ? (i * 1D) : (i + 1D)) / total * 100D))
  97. .setFileName("")
  98. .setOldName(params.getOldName())
  99. .setUrl("")
  100. .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
  101. }
  102. SpringUtil.getBean(ProjectService.class).setImportPatentTaskStatus(2, params.getTaskId());
  103. WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
  104. .setTaskId(params.getTaskId())
  105. .setProjectId(projectImportPatentVO.getProjectId())
  106. .setComplete(true)
  107. .setIndex(total)
  108. .setTaskType(Constants.TASK_IMPORT_PATENT)
  109. .setPercentage(100L)
  110. .setFileName("")
  111. .setOldName(params.getOldName())
  112. .setUrl("")
  113. .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
  114. } catch (Exception e) {
  115. e.printStackTrace();
  116. SpringUtil.getBean(ProjectService.class).setImportPatentTaskStatus(3, params.getTaskId());
  117. if (FLAG > 0) {
  118. int successCount = total - FLAG;
  119. WebSocketServer.sendInfo(Response.error("部分数据上传成功" + "\n" + "成功条数:" + successCount + "失败条数:" + FLAG), params.getUserId());
  120. }
  121. FLAG = 0;
  122. }
  123. }
  124. /**
  125. * @return uploadParamsVO 返回一个由processData方法填充完数据的Pojo类
  126. * @date 2022/7/7
  127. * @name 解析配置文件
  128. * @description uploadPatentBatch的兄弟方法
  129. */
  130. // @Async("singleThreadAsyncTaskExecutor")
  131. public String uploadPatentBatchBro(TaskParams params) {
  132. Integer total = params.getTotal();
  133. Integer index = params.getIndex();
  134. try {
  135. //先解析Json文件 获得配置文件的Json串
  136. String getSettingJson = fileUtils.analysisJsonFile();
  137. //查找需求数据源的对应配置
  138. List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFilesBro(getSettingJson);
  139. Map<String, PictureData> pictureDataMap = ExcelUtils.getDataFromExcel(params.getPath());
  140. //将数据进行装配并进行数据库操作
  141. //获取每一行的数据
  142. Map<Object, Object> row = params.getRowList().get(0);
  143. //基础数据装配
  144. UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
  145. //查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
  146. getOneOrInsertOne(uploadParamsVO);
  147. //专利信息需要特殊处理部分
  148. //专利信息(摘要附图)数据装配
  149. PictureData pictureData = pictureDataMap.get(String.valueOf(index + 1));
  150. if (uploadParamsVO.getPatent() != null) {
  151. if (uploadParamsVO.getPatent().getId() != null && pictureData != null) {
  152. uploadParamsVO.getPatent().setAbstractPath(patentImageService.updatePatentImage(uploadParamsVO.getPatent().getId(), pictureData));
  153. }
  154. }
  155. //专利信息(代理机构)数据装配
  156. if (uploadParamsVO.getPatent() != null) {
  157. if (uploadParamsVO.getPatent().getAgencyId() != null) {
  158. uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(uploadParamsVO.getPatent().getAgencyId()));
  159. }
  160. }
  161. //将装配对象中的数据保存到数据库
  162. dataToDBBro(params, uploadParamsVO);
  163. ImportTaskPatent importTaskPatent = new ImportTaskPatent();
  164. importTaskPatent.setImportTaskId(params.getTaskId());
  165. importTaskPatent.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
  166. importTaskPatent.insert();
  167. //通过WebSocket 在每一次循环结束后 向前端发送完成进度
  168. WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
  169. .setTaskId(params.getTaskId())
  170. .setComplete(false)
  171. .setIndex(0)
  172. .setTaskType(Constants.TASK_IMPORT_PATENT)
  173. .setPercentage(total == 0 ? 0 : Math.round((total.equals(index) ? (index * 1D) : (index + 1D)) / total * 100D))
  174. .setFileName("")
  175. .setOldName(params.getOldName())
  176. .setUrl("")
  177. .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
  178. return Response.success(uploadParamsVO.getPatent().getPatentNo());
  179. } catch (Exception e) {
  180. return Response.error();
  181. }
  182. }
  183. /**
  184. * @param uploadParamsVO 全局类
  185. * @date 2022-7-11
  186. * @name 数据库交互
  187. * @description 将装配完毕的VO类向数据库中不同的表进行添加或修改操作
  188. */
  189. @Transactional(rollbackFor = Exception.class)
  190. public void dataToDB(TaskParams params, UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
  191. try {
  192. //保存法律状态(表"os_patent")
  193. if (uploadParamsVO.getPatent() != null) {
  194. List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
  195. Integer simpleStatus = Integer.parseInt(systemDictList.stream()
  196. .filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getLabel().equals(uploadParamsVO.getPatentSimpleStatus()))
  197. .findFirst()
  198. .orElse(new SystemDict()).getValue());
  199. uploadParamsVO.getPatent().setSimpleStatus(simpleStatus);
  200. uploadParamsVO.getPatent().updateById();
  201. }
  202. //保存权利要求(表"os_patent_right")
  203. patentRightBusiness(uploadParamsVO);
  204. //保存说明书(表"os_patent_instruction_text")
  205. if (uploadParamsVO.getPatentInstructionText() != null) {
  206. patentInstructionTextBusiness(uploadParamsVO);
  207. }
  208. //保存代理人(表"os_patent_agent"、表"os_patent_agent_link")
  209. if (uploadParamsVO.getPatentAgentList() != null) {
  210. patentAgentBusiness(uploadParamsVO);
  211. }
  212. //保存简单同族(表"")
  213. patentSimplyFamilyBusiness(uploadParamsVO);
  214. //保存质押质权人(表"os_patent_pledge")
  215. if (uploadParamsVO.getPatentPledgeList() != null) {
  216. patentPledgeBusiness(uploadParamsVO);
  217. }
  218. //保存许可人(表"os_patent_licensor")
  219. if (uploadParamsVO.getPatentLicensorList() != null) {
  220. patentLicensorBusiness(uploadParamsVO);
  221. }
  222. //保存发明人(表"os_patent_inventor"、表"os_patent_inventor_relation")
  223. patentInventorBusiness(uploadParamsVO);
  224. //保存申请人(原始)/权利人(当前)(表"os_patent_applicant"、表"os_applicant_attr")
  225. patentApplicationBusiness(uploadParamsVO);
  226. //保存申请人地址(表"")
  227. patentApplicationAddressBusiness(uploadParamsVO);
  228. //保存专题库关联专利信息(表"os_thematic_pid")
  229. if (uploadParamsVO.getPatent() != null) {
  230. patentThematicPidBusiness(uploadParamsVO, projectImportPatentVO.getProjectId());
  231. }
  232. //保存标引内容关联专利信息(表"os_patent_field_patent_link"、"os_patent_field_text")
  233. if (uploadParamsVO.getPatent() != null) {
  234. patentProjectFieldPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
  235. }
  236. //保存文件夹关联专利信息(表"os_portfolio_link")
  237. if (uploadParamsVO.getPatent() != null) {
  238. patentProjectFolderPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
  239. }
  240. //保存标签(表"os_patent_label")
  241. if (uploadParamsVO.getPatentLabelList() != null) {
  242. patentLabelBusiness(uploadParamsVO, projectImportPatentVO);
  243. }
  244. //保存分类号关联(表"os_patent_typeno")
  245. patentTypeNoBusiness(uploadParamsVO);
  246. //保存事务信息(表"os_patent_affair")
  247. patentAffairBusiness(uploadParamsVO);
  248. //保存自定义字段
  249. if (uploadParamsVO.getCustomerFieldList() != null) {
  250. patentFieldBusiness(params, uploadParamsVO, projectImportPatentVO);
  251. }
  252. } catch (Exception e) {
  253. e.printStackTrace();
  254. if (uploadParamsVO.getPatent() != null) {
  255. ImportErrorLog importErrorLog = new ImportErrorLog();
  256. importErrorLog.setPatentId(uploadParamsVO.getPatent().getId())
  257. .setPatentNo(uploadParamsVO.getPatent().getPatentNo())
  258. .setCreateTime(new SimpleDateFormat("yyyy-MM-dd 24HI:mm:ss").format(new Date()))
  259. .setCreateUserId(Integer.parseInt(params.getUserId()))
  260. .setMistakeMessage(e.getMessage())
  261. .setProjectId(params.getProjectId());
  262. importErrorLogMapper.insert(importErrorLog);
  263. FLAG += 1;
  264. }
  265. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  266. }
  267. }
  268. /**
  269. * @param uploadParamsVO 全局类
  270. * @date 2022-7-11
  271. * @name 数据库交互
  272. * @description 将装配完毕的VO类向数据库中不同的表进行添加或修改操作(dataToDB兄弟类)
  273. */
  274. @Transactional(rollbackFor = Exception.class)
  275. public void dataToDBBro(TaskParams params, UploadParamsVO uploadParamsVO) {
  276. try {
  277. //专利信息 OS_PATENT
  278. if (uploadParamsVO.getPatent() != null) {
  279. List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
  280. Integer simpleStatus = Integer.parseInt(systemDictList.stream()
  281. .filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getLabel().equals(uploadParamsVO.getPatentSimpleStatus()))
  282. .findFirst()
  283. .orElse(new SystemDict()).getValue());
  284. uploadParamsVO.getPatent().setSimpleStatus(simpleStatus);
  285. uploadParamsVO.getPatent().updateById();
  286. }
  287. //权利要求 OS_PATENT_RIGHT
  288. patentRightBusiness(uploadParamsVO);
  289. //说明书(文本) OS_PATENT_INSTRUCTION_TEXT
  290. if (uploadParamsVO.getPatentInstructionText() != null) {
  291. patentInstructionTextBusiness(uploadParamsVO);
  292. }
  293. //代理人 OS_PATENT_AGENT
  294. if (uploadParamsVO.getPatentAgentList() != null) {
  295. patentAgentBusiness(uploadParamsVO);
  296. }
  297. //质押质权人 OS_PATENT_PLEDGE
  298. if (uploadParamsVO.getPatentPledgeList() != null) {
  299. patentPledgeBusiness(uploadParamsVO);
  300. }
  301. //许可人 OS_PATENT_LICENSOR
  302. if (uploadParamsVO.getPatentLicensorList() != null) {
  303. patentLicensorBusiness(uploadParamsVO);
  304. }
  305. //简单同族 OS_PATENT_SIMPLEFAMILY
  306. patentSimplyFamilyBusiness(uploadParamsVO);
  307. //发明人 OS_PATENT_INVENTOR
  308. patentInventorBusiness(uploadParamsVO);
  309. //申请人(原始)/权利人(当前) OS_PATENT_APPLICATION || OS_APPLICATION_ATTR
  310. patentApplicationBusiness(uploadParamsVO);
  311. //申请人地址 OS_PATENT_APPLICATION
  312. patentApplicationAddressBusiness(uploadParamsVO);
  313. //分类号关联 OS_PATENT_TYPENO
  314. patentTypeNoBusiness(uploadParamsVO);
  315. //事务信息 OS_PATENT_AFFAIR
  316. patentAffairBusiness(uploadParamsVO);
  317. } catch (Exception e) {
  318. e.printStackTrace();
  319. if (uploadParamsVO.getPatent() != null) {
  320. ImportErrorLog importErrorLog = new ImportErrorLog();
  321. importErrorLog.setPatentId(uploadParamsVO.getPatent().getId())
  322. .setPatentNo(uploadParamsVO.getPatent().getPatentNo())
  323. .setCreateTime(new SimpleDateFormat("yyyy-MM-dd 24HI:mm:ss").format(new Date()))
  324. .setCreateUserId(Integer.parseInt(params.getUserId()))
  325. .setMistakeMessage(e.getMessage())
  326. .setProjectId(params.getProjectId());
  327. importErrorLogMapper.insert(importErrorLog);
  328. FLAG += 1;
  329. }
  330. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  331. }
  332. }
  333. /**
  334. * @param uploadParamsVO 全局类
  335. * @date 2022-7-11
  336. * @name 工具方法
  337. * @description 查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
  338. */
  339. public void getOneOrInsertOne(UploadParamsVO uploadParamsVO) {
  340. if (uploadParamsVO.getPatent() != null) {
  341. uploadParamsVO.getPatent().setPatentNo(uploadParamsVO.getPatent().getPatentNo().trim());
  342. //用专利号查询该条数据是否存在
  343. Patent patent = patentService.getByPatentNo(uploadParamsVO.getPatent().getPatentNo());
  344. //如果不存在就新增一条
  345. if (patent == null) {
  346. uploadParamsVO.getPatent().insert();
  347. } else {
  348. uploadParamsVO.getPatent().setId(patent.getId());
  349. }
  350. }
  351. }
  352. //权利要求
  353. public void patentRightBusiness(UploadParamsVO uploadParamsVO) {
  354. //创建PatentRightParams对象保存权要基本信息
  355. PatentRightParams patentRightParams = new PatentRightParams();
  356. //装载专利id
  357. patentRightParams.setPatentId(uploadParamsVO.getPatent().getId());
  358. //装载专利号
  359. patentRightParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
  360. if (uploadParamsVO.getPatentRight() != null) {
  361. //装载权利要求原文
  362. patentRightParams.setContent(uploadParamsVO.getPatentRight().getContent());
  363. //装载权利要求译文
  364. patentRightParams.setContentOut(uploadParamsVO.getPatentRight().getContentOut());
  365. }
  366. if (uploadParamsVO.getSelfContent() != null) {
  367. //装载独立权要
  368. patentRightParams.setSelfContent(uploadParamsVO.getSelfContent());
  369. }
  370. //开始保存权要入库(1.格式化权要 2.理出主次权要父子关系 3.权要入表"os_patent_right")
  371. patentRightService.updatePatentRight(patentRightParams);
  372. //暂未使用
  373. patentRightService.importAuthority(patentRightParams);
  374. }
  375. //说明书文本
  376. public void patentInstructionTextBusiness(UploadParamsVO uploadParamsVO) {
  377. //创建PatentInstructionTextParams对象装载说明书相关数据
  378. PatentInstructionTextParams patentInstructionTextParams = new PatentInstructionTextParams();
  379. //装载专利id
  380. patentInstructionTextParams.setPatentId(uploadParamsVO.getPatent().getId());
  381. //装载说明书
  382. patentInstructionTextParams.setManual(uploadParamsVO.getPatentInstructionText().getManual());
  383. //装载说明书(译)
  384. patentInstructionTextParams.setManualOut(uploadParamsVO.getPatentInstructionText().getManualOut());
  385. //开始保存说明书入表“os_patent_instruction_text”
  386. patentInstructionTextService.updatePatentInstructionText(patentInstructionTextParams);
  387. }
  388. //代理人
  389. public void patentAgentBusiness(UploadParamsVO uploadParamsVO) {
  390. //创建PatentAgentParams对象装载代理人相关数据
  391. PatentAgentParams patentAgentParams = new PatentAgentParams();
  392. //装载专利id
  393. patentAgentParams.setPatentId(uploadParamsVO.getPatent().getId());
  394. List<String> agentList = uploadParamsVO.getPatentAgentList().stream().map(PatentAgent::getName).collect(Collectors.toList());
  395. //装载代理人集合
  396. patentAgentParams.setAgent(agentList);
  397. //开始保存代理人信息入表“os_patent_agent”
  398. patentAgentService.updatePatentAgent(patentAgentParams);
  399. }
  400. //质押质权人
  401. public void patentPledgeBusiness(UploadParamsVO uploadParamsVO) {
  402. //创建PatentPledgeParams对象装载质押质权人相关数据
  403. PatentPledgeParams patentPledgeParams = new PatentPledgeParams();
  404. //装载专利id
  405. patentPledgeParams.setPatentId(uploadParamsVO.getPatent().getId());
  406. List<String> pledgeeList = uploadParamsVO.getPatentPledgeList().stream().map(PatentPledge::getPledgee).collect(Collectors.toList());
  407. List<String> pledgorList = uploadParamsVO.getPatentPledgeList().stream().map(PatentPledge::getPledgor).collect(Collectors.toList());
  408. //装载质权人集合
  409. patentPledgeParams.setPledgee(pledgeeList);
  410. //装载质押人集合
  411. patentPledgeParams.setPledgor(pledgorList);
  412. //开始保存质押质权人信息入表“os_patent_pledge”
  413. patentPledgeService.updatePatentPledge(patentPledgeParams);
  414. }
  415. //许可人
  416. public void patentLicensorBusiness(UploadParamsVO uploadParamsVO) {
  417. //创建PatentLicensorParams对象装载许可人相关数据
  418. PatentLicensorParams patentLicensorParams = new PatentLicensorParams();
  419. //装载专利id
  420. patentLicensorParams.setPatentId(uploadParamsVO.getPatent().getId());
  421. List<String> licensorList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getLicensor).collect(Collectors.toList());
  422. List<String> licenseeList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getLicensee).collect(Collectors.toList());
  423. List<String> typeList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getType).collect(Collectors.toList());
  424. //装载许可人
  425. patentLicensorParams.setLicensor(licensorList);
  426. //装载被许可人
  427. patentLicensorParams.setLicensee(licenseeList);
  428. //装载许可类型
  429. patentLicensorParams.setType(typeList);
  430. //开始保存许可人相关信息入专利信息许可人表“os_patent_licensor”
  431. patentLicensorService.updatePatentLicensor(patentLicensorParams);
  432. }
  433. //简单同族
  434. public void patentSimplyFamilyBusiness(UploadParamsVO uploadParamsVO) {
  435. //创建PatentSimpleFamilyParams对象装载简单同族相关数据
  436. PatentSimpleFamilyParams patentSimpleFamilyParams = new PatentSimpleFamilyParams();
  437. if (uploadParamsVO.getSimpleFamily() != null) {
  438. //装载简单同族
  439. patentSimpleFamilyParams.setSimpleFamily(uploadParamsVO.getSimpleFamily());
  440. }
  441. if (uploadParamsVO.getPatSnapFamily() != null) {
  442. //装载PatSnap同族
  443. patentSimpleFamilyParams.setPatSnapFamily(uploadParamsVO.getPatSnapFamily());
  444. }
  445. if (uploadParamsVO.getInpadocFamily() != null) {
  446. //装载Inpadoc同族
  447. patentSimpleFamilyParams.setInpadocFamily(uploadParamsVO.getInpadocFamily());
  448. }
  449. //装载专利id
  450. patentSimpleFamilyParams.setPatentId(uploadParamsVO.getPatent().getId());
  451. //装载专利号
  452. patentSimpleFamilyParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
  453. //开始
  454. patentSimpleFamilyService.updatePatentSimpleFamily(patentSimpleFamilyParams);
  455. }
  456. //发明人
  457. public void patentInventorBusiness(UploadParamsVO uploadParamsVO) {
  458. //创建PatentInventorParams对象装载发明人相关数据
  459. PatentInventorParams patentInventorParams = new PatentInventorParams();
  460. if (uploadParamsVO.getPatentInventorList() != null) {
  461. List<String> addressList = uploadParamsVO.getPatentInventorList().stream().map(PatentInventor::getAddress).filter(Objects::nonNull).collect(Collectors.toList());
  462. //装载发明人地址集合
  463. patentInventorParams.setAddressList(addressList);
  464. List<String> nameList = uploadParamsVO.getPatentInventorList().stream().map(PatentInventor::getName).collect(Collectors.toList());
  465. //装载发明人名称集合
  466. patentInventorParams.setNameList(nameList);
  467. }
  468. if (uploadParamsVO.getFirstName() != null) {
  469. //装载第一发明人名称
  470. patentInventorParams.setFirstName(uploadParamsVO.getFirstName());
  471. }
  472. if (uploadParamsVO.getFirstAddress() != null) {
  473. //装载第一发明人地址
  474. patentInventorParams.setFirstAddress(uploadParamsVO.getFirstAddress());
  475. }
  476. //装载专利号
  477. patentInventorParams.setPatentId(uploadParamsVO.getPatent().getId());
  478. //开始装载发明人表实体类相关信息、专利与发明人关联表实体类集合相关信息,然后各自数据分别插入这两张表
  479. patentInventorService.updatePatentInventor(patentInventorParams);
  480. }
  481. //申请人(原始)/权利人(当前)
  482. public void patentApplicationBusiness(UploadParamsVO uploadParamsVO) {
  483. // 根据本条数据的名字查询所有的申请人信息
  484. List<String> name = new ArrayList<>();
  485. if (uploadParamsVO.getPatentApplicantCurrentName() != null) {
  486. name.addAll(uploadParamsVO.getPatentApplicantCurrentName());
  487. }
  488. if (uploadParamsVO.getPatentApplicantOriginalName() != null) {
  489. name.addAll(uploadParamsVO.getPatentApplicantOriginalName());
  490. }
  491. if (uploadParamsVO.getPatentApplicantStandardCurrentName() != null) {
  492. name.addAll(uploadParamsVO.getPatentApplicantStandardCurrentName());
  493. }
  494. if (uploadParamsVO.getPatentApplicantStandardOriginalName() != null) {
  495. name.addAll(uploadParamsVO.getPatentApplicantStandardOriginalName());
  496. }
  497. if (name.size() != 0) {
  498. List<PatentApplicant> patentApplicantList = patentApplicantService.list(Wrappers.<PatentApplicant>lambdaQuery().in(PatentApplicant::getName, name));
  499. //权利人
  500. if (uploadParamsVO.getPatentApplicantCurrentName() != null || uploadParamsVO.getPatentApplicantStandardCurrentName() != null)
  501. patentApplicantLinkService.updatePatentApplicantLink(uploadParamsVO.getPatentApplicantCurrentName(), uploadParamsVO.getPatentApplicantStandardCurrentName(), 1, uploadParamsVO.getPatent().getId(), patentApplicantList);
  502. //申请人
  503. if (uploadParamsVO.getPatentApplicantOriginalName() != null || uploadParamsVO.getPatentApplicantStandardOriginalName() != null)
  504. patentApplicantLinkService.updatePatentApplicantLink(uploadParamsVO.getPatentApplicantOriginalName(), uploadParamsVO.getPatentApplicantStandardOriginalName(), 2, uploadParamsVO.getPatent().getId(), patentApplicantList);
  505. }
  506. }
  507. public void patentApplicationAddressBusiness(UploadParamsVO uploadParamsVO) {
  508. PatentApplicantAddressParams patentApplicantAddressParams = new PatentApplicantAddressParams();
  509. patentApplicantAddressParams.setPatentId(uploadParamsVO.getPatent().getId());
  510. patentApplicantAddressParams.setCurrentAddress(uploadParamsVO.getPatentApplicantCurrentAddress());
  511. patentApplicantAddressParams.setOriginalAddress(uploadParamsVO.getPatentApplicantOriginalAddress());
  512. patentApplicantAddressParams.setCurrentCountry(uploadParamsVO.getPatentApplicantCurrentCountry());
  513. patentApplicantAddressParams.setOriginalCountry(uploadParamsVO.getPatentApplicantOriginalCountry());
  514. patentApplicantAddressParams.setFirstCurrentAddress(uploadParamsVO.getFirstAddress());
  515. patentApplicantService.updatePatentApplicantAddress(patentApplicantAddressParams);
  516. }
  517. public void patentThematicPidBusiness(UploadParamsVO uploadParamsVO, Integer projectId) {
  518. projectPatentLinkService.updateProjectPatent(projectId, uploadParamsVO.getPatent().getId());
  519. }
  520. public void patentProjectFieldPatentLinkBusiness(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
  521. projectFieldPatentLinkService.updateProjectFieldPatentLink(projectImportPatentVO, uploadParamsVO.getPatent().getId());
  522. }
  523. public void patentProjectFolderPatentLinkBusiness(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
  524. projectFolderPatentLinkService.updateProjectFolderLink(projectImportPatentVO, uploadParamsVO.getPatent().getId());
  525. }
  526. private void patentLabelBusiness(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
  527. PatentLabelParams patentLabelParams = new PatentLabelParams();
  528. patentLabelParams.setPatentId(uploadParamsVO.getPatent().getId());
  529. patentLabelParams.setProjectId(projectImportPatentVO.getProjectId());
  530. List<String> labelList = uploadParamsVO.getPatentLabelList().stream().map(PatentLabel::getName).collect(Collectors.toList());
  531. patentLabelParams.setLabel(labelList);
  532. patentLabelService.updatePatentLabel(patentLabelParams);
  533. }
  534. public void patentTypeNoBusiness(UploadParamsVO uploadParamsVO) {
  535. PatentClassNumberParams patentClassNumberParams = new PatentClassNumberParams();
  536. if (uploadParamsVO.getMainIpc() != null) {
  537. patentClassNumberParams.setMainIpc(uploadParamsVO.getMainIpc());
  538. }
  539. if (uploadParamsVO.getMainUpc() != null) {
  540. patentClassNumberParams.setMainUpc(uploadParamsVO.getMainUpc());
  541. }
  542. if (uploadParamsVO.getCpcList() != null) {
  543. patentClassNumberParams.setCpcList(uploadParamsVO.getCpcList());
  544. }
  545. if (uploadParamsVO.getLocList() != null) {
  546. patentClassNumberParams.setLocList(uploadParamsVO.getLocList());
  547. }
  548. if (uploadParamsVO.getUpcList() != null) {
  549. patentClassNumberParams.setUpcList(uploadParamsVO.getUpcList());
  550. }
  551. if (uploadParamsVO.getIpcList() != null) {
  552. patentClassNumberParams.setIpcList(uploadParamsVO.getIpcList());
  553. }
  554. patentClassNumberParams.setPatentId(uploadParamsVO.getPatent().getId());
  555. patentClassNumberLinkService.updatePatentClassNumberLink(patentClassNumberParams);
  556. }
  557. public void patentAffairBusiness(UploadParamsVO uploadParamsVO) {
  558. PatentAffairParams patentAffairParams = new PatentAffairParams();
  559. if (uploadParamsVO.getPatentAffair() != null) {
  560. patentAffairParams.setContent(uploadParamsVO.getPatentAffair().getContent());
  561. patentAffairParams.setStatusList(uploadParamsVO.getPatentAffair().getStatus());
  562. patentAffairParams.setDateTime(uploadParamsVO.getPatentAffair().getDateTime());
  563. }
  564. if (uploadParamsVO.getSimpleStatus() != null) {
  565. List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
  566. Integer simpleStatus = Integer.parseInt(systemDictList.stream()
  567. .filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getLabel().equals(uploadParamsVO.getSimpleStatus()))
  568. .findFirst()
  569. .orElse(new SystemDict()).getValue());
  570. patentAffairParams.setSimpleStatus(simpleStatus);
  571. }
  572. patentAffairParams.setPatentId(uploadParamsVO.getPatent().getId());
  573. patentAffairService.updatePatientAffair(patentAffairParams);
  574. }
  575. private void patentFieldBusiness(TaskParams params, UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
  576. PatentCustomFieldParams patentCustomFieldParams = new PatentCustomFieldParams();
  577. for (int i = 0; i < uploadParamsVO.getCustomerFieldList().size(); i++) {
  578. patentCustomFieldParams.setPatentId(uploadParamsVO.getPatent().getId());
  579. patentCustomFieldParams.setProjectId(projectImportPatentVO.getProjectId());
  580. patentCustomFieldParams.setUserId(Integer.parseInt(params.getUserId()));
  581. patentCustomFieldParams.put(uploadParamsVO.getCustomerFieldList().get(i).getKey(), uploadParamsVO.getCustomerFieldList().get(i).getFieldList());
  582. }
  583. patentService.updatePatentCustomField(patentCustomFieldParams);
  584. }
  585. @Async("singleThreadAsyncTaskExecutor")
  586. public void uploadPatentForProduct(TaskParams params, Integer productId) {
  587. Integer total = params.getRowList().size();
  588. try {
  589. //先解析Json文件 获得配置文件的Json串
  590. String getSettingJson = fileUtils.analysisJsonFile();
  591. //查找需求数据源的对应配置
  592. List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFilesBro(getSettingJson);
  593. Map<String, PictureData> pictureDataMap = ExcelUtils.getDataFromExcel(params.getPath());
  594. //将数据进行装配并进行数据库操作
  595. for (int i = 0; i < params.getRowList().size(); i++) {
  596. //获取每一行的数据
  597. Map<Object, Object> row = params.getRowList().get(i);
  598. //基础数据装配
  599. UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
  600. //查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
  601. getOneOrInsertOne(uploadParamsVO);
  602. //专利信息需要特殊处理部分
  603. //专利信息(摘要附图)数据装配
  604. PictureData pictureData = pictureDataMap.get(String.valueOf(i + 1));
  605. if (uploadParamsVO.getPatent() != null) {
  606. if (uploadParamsVO.getPatent().getId() != null && pictureData != null) {
  607. uploadParamsVO.getPatent().setAbstractPath(patentImageService.updatePatentImage(uploadParamsVO.getPatent().getId(), pictureData));
  608. }
  609. }
  610. //专利信息(代理机构)数据装配
  611. if (uploadParamsVO.getPatent() != null) {
  612. if (uploadParamsVO.getPatent().getAgencyId() != null) {
  613. uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(uploadParamsVO.getPatent().getAgencyId()));
  614. }
  615. }
  616. //将装配对象中的数据保存到数据库
  617. dataToDBBro(params, uploadParamsVO);
  618. //添加关联关系
  619. assoProductPatentService.addPatents(Arrays.asList(uploadParamsVO.getPatent().getPatentNo()), productId);
  620. //通过WebSocket 在每一次循环结束后 向前端发送完成进度
  621. WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
  622. .setTaskId(params.getTaskId())
  623. .setComplete(false)
  624. .setIndex(i)
  625. .setTaskType(Constants.TASK_IMPORT_PATENT)
  626. .setPercentage(total == 0 ? 0 : Math.round((total.equals(i) ? (i * 1D) : (i + 1D)) / total * 100D))
  627. .setFileName("")
  628. .setOldName(params.getOldName())
  629. .setUrl("")
  630. .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
  631. }
  632. SpringUtil.getBean(ProjectService.class).setImportPatentTaskStatus(2, params.getTaskId());
  633. WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
  634. .setTaskId(params.getTaskId())
  635. .setComplete(true)
  636. .setIndex(total)
  637. .setTaskType(Constants.TASK_IMPORT_PATENT)
  638. .setPercentage(100L)
  639. .setFileName("")
  640. .setOldName(params.getOldName())
  641. .setUrl("")
  642. .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
  643. } catch (Exception e) {
  644. e.printStackTrace();
  645. SpringUtil.getBean(ProjectService.class).setImportPatentTaskStatus(3, params.getTaskId());
  646. if (FLAG > 0) {
  647. int successCount = total - FLAG;
  648. WebSocketServer.sendInfo(Response.error("部分数据上传成功" + "\n" + "成功条数:" + successCount + "失败条数:" + FLAG), params.getUserId());
  649. }
  650. FLAG = 0;
  651. }
  652. }
  653. /**
  654. * @date 2022-7-11
  655. * @name 数据库交互
  656. * @description 将装配完毕的VO类向数据库中不同的表进行添加或修改操作(dataToDB兄弟类)
  657. */
  658. @Transactional(rollbackFor = Exception.class)
  659. public String dataToDBCell(PatentCell patentCell) throws ParseException {
  660. UploadParamsVO uploadParamsVO = new UploadParamsVO();
  661. Patent patent = new Patent();
  662. //设置专利号
  663. patent.setPatentNo(patentCell.getPatentNo());
  664. //设置摘要
  665. patent.setAbstractStr(patentCell.getAbstrText());
  666. //设置标题
  667. patent.setName(patentCell.getTitle());
  668. //设置公开日
  669. SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
  670. if (patentCell.getPubilcDate() != null) {
  671. Date date = simpleDateFormat.parse(patentCell.getPubilcDate());
  672. Integer ts = (int) date.getTime();
  673. patent.setPublicDate(ts);
  674. }
  675. //设置申请号
  676. patent.setApplicationNo(patentCell.getApplicationNo());
  677. //设置申请日
  678. if (patentCell.getApplicationDate() != null) {
  679. Date date = simpleDateFormat.parse(patentCell.getApplicationDate());
  680. Integer ts = (int) date.getTime();
  681. patent.setApplicationDate(ts);
  682. }
  683. //设置摘要附图
  684. patent.setAbstractPath(patentCell.getPicUrl());
  685. //设置pdf文档
  686. if (patentCell.getPdf() != null) {
  687. patentInstructionService.edit(patentCell.getPatentNo(), patentCell.getPdf());
  688. }
  689. //设置公开号
  690. patent.setPublicNo(patentCell.getPublicNo());
  691. uploadParamsVO.setSimpleStatus(patentCell.getStatue());
  692. uploadParamsVO.setPatent(patent);
  693. getOneOrInsertOne(uploadParamsVO);
  694. if (patentCell.getAgency() != null && !patentCell.getAgency().equals("")) {
  695. uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(patentCell.getAgency()));
  696. }
  697. try {
  698. //专利信息 OS_PATENT
  699. if (uploadParamsVO.getPatent() != null) {
  700. List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
  701. Integer simpleStatus = Integer.parseInt(systemDictList.stream()
  702. .filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getLabel().equals(uploadParamsVO.getPatentSimpleStatus()))
  703. .findFirst()
  704. .orElse(new SystemDict()).getValue());
  705. uploadParamsVO.getPatent().setSimpleStatus(simpleStatus);
  706. uploadParamsVO.getPatent().updateById();
  707. }
  708. uploadParamsVO.setPatentRight(new PatentRight());
  709. uploadParamsVO.getPatentRight().setContent(StringUtils.join(patentCell.getRights(), ""));
  710. uploadParamsVO.setSelfContent(patentCell.getMainRignt());
  711. //权利要求 OS_PATENT_RIGHT
  712. if (uploadParamsVO.getPatentRight().getContent() != null) {
  713. patentRightBusiness(uploadParamsVO);
  714. }
  715. //说明书(文本) OS_PATENT_INSTRUCTION_TEXT
  716. uploadParamsVO.setPatentInstructionText(new PatentInstructionText());
  717. uploadParamsVO.getPatentInstructionText().setManual(patentCell.getPatentInstructionText());
  718. if (uploadParamsVO.getPatentInstructionText().getManual() != null) {
  719. patentInstructionTextBusiness(uploadParamsVO);
  720. }
  721. //发明人 OS_PATENT_INVENTOR
  722. if (patentCell.getInventors().size() != 0) {
  723. PatentInventorParams patentInventorParams = new PatentInventorParams();
  724. patentInventorParams.setPatentId(uploadParamsVO.getPatent().getId());
  725. patentInventorParams.setNameList(patentCell.getInventors());
  726. patentInventorParams.setAddressList(new ArrayList<>());
  727. patentInventorService.updatePatentInventor(patentInventorParams);
  728. }
  729. //申请人(原始)/权利人(当前) OS_PATENT_APPLICATION || OS_APPLICATION_ATTR
  730. uploadParamsVO.setPatentApplicantCurrentName(patentCell.getApplicationCurrents());
  731. uploadParamsVO.setPatentApplicantOriginalName(patentCell.getApplicationPersons());
  732. patentApplicationBusiness(uploadParamsVO);
  733. //申请人地址 OS_PATENT_APPLICATION
  734. uploadParamsVO.setPatentApplicantOriginalAddress(patentCell.getApplicationAddress());
  735. patentApplicationAddressBusiness(uploadParamsVO);
  736. //分类号关联 OS_PATENT_TYPENO
  737. uploadParamsVO.setIpcList(patentCell.getIpc());
  738. uploadParamsVO.setMainIpc(patentCell.getMainIpc());
  739. patentTypeNoBusiness(uploadParamsVO);
  740. //代理人 OS_PATENT_AGENT
  741. if (patentCell.getAgencyPersons() != null && patentCell.getAgencyPersons().size() != 0) {
  742. PatentAgentParams patentAgentParams = new PatentAgentParams();
  743. patentAgentParams.setPatentId(uploadParamsVO.getPatent().getId());
  744. patentAgentParams.setAgent(patentCell.getAgencyPersons());
  745. patentAgentService.updatePatentAgent(patentAgentParams);
  746. }
  747. //事务信息 OS_PATENT_AFFAIR
  748. if (patentCell.getPatentAffairs() != null && patentCell.getPatentAffairs().size() > 0) {
  749. patentAffairService.updatePatientAffairs(patentCell.getPatentAffairs(), uploadParamsVO.getPatent().getId());
  750. }
  751. //当专题库id不为null时添加专利到专题库
  752. if (patentCell.getProjectId() != null) {
  753. projectPatentLinkService.updateProjectPatent(patentCell.getProjectId(), uploadParamsVO.getPatent().getId());
  754. }
  755. return Response.success();
  756. } catch (Exception e) {
  757. e.printStackTrace();
  758. if (uploadParamsVO.getPatent() != null) {
  759. ImportErrorLog importErrorLog = new ImportErrorLog();
  760. importErrorLog.setPatentId(uploadParamsVO.getPatent().getId())
  761. .setPatentNo(uploadParamsVO.getPatent().getPatentNo())
  762. .setCreateTime(new SimpleDateFormat("yyyy-MM-dd 24HI:mm:ss").format(new Date()));
  763. // .setCreateUserId(Integer.parseInt(params.getUserId()))
  764. // .setMistakeMessage(e.getMessage())
  765. // .setProjectId(params.getProjectId());
  766. importErrorLogMapper.insert(importErrorLog);
  767. FLAG += 1;
  768. }
  769. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  770. return Response.error();
  771. }
  772. }
  773. }