PatentInfoServiceImpl.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. package com.goafanti.patent.service.impl;
  2. import java.text.ParseException;
  3. import java.util.ArrayList;
  4. import java.util.Arrays;
  5. import java.util.Calendar;
  6. import java.util.Date;
  7. import java.util.HashMap;
  8. import java.util.List;
  9. import java.util.Map;
  10. import java.util.UUID;
  11. import org.springframework.beans.BeanUtils;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.stereotype.Service;
  14. import com.goafanti.common.constant.AFTConstants;
  15. import com.goafanti.common.dao.ContractMapper;
  16. import com.goafanti.common.dao.NoticeMapper;
  17. import com.goafanti.common.dao.OrgIntellectualPropertyMapper;
  18. import com.goafanti.common.dao.OrganizationIdentityMapper;
  19. import com.goafanti.common.dao.PatentCostMapper;
  20. import com.goafanti.common.dao.PatentInfoMapper;
  21. import com.goafanti.common.dao.PatentLogMapper;
  22. import com.goafanti.common.dao.PatentRegistrationMapper;
  23. import com.goafanti.common.dao.UserMapper;
  24. import com.goafanti.common.enums.ContractBusinessStatus;
  25. import com.goafanti.common.enums.DeleteStatus;
  26. import com.goafanti.common.enums.IntellectualPropertyType;
  27. import com.goafanti.common.enums.NoticeReadStatus;
  28. import com.goafanti.common.enums.NoticeStatus;
  29. import com.goafanti.common.enums.PatentAnnualFeeStatus;
  30. import com.goafanti.common.enums.PatentInfoStatus;
  31. import com.goafanti.common.enums.PatentPaymentStatus;
  32. import com.goafanti.common.model.Admin;
  33. import com.goafanti.common.model.Contract;
  34. import com.goafanti.common.model.Notice;
  35. import com.goafanti.common.model.OrgIntellectualProperty;
  36. import com.goafanti.common.model.OrganizationIdentity;
  37. import com.goafanti.common.model.PatentCost;
  38. import com.goafanti.common.model.PatentInfo;
  39. import com.goafanti.common.model.PatentLog;
  40. import com.goafanti.common.model.PatentRegistration;
  41. import com.goafanti.common.model.User;
  42. import com.goafanti.common.utils.DateUtils;
  43. import com.goafanti.common.utils.StringUtils;
  44. import com.goafanti.core.mybatis.BaseMybatisDao;
  45. import com.goafanti.core.mybatis.page.Pagination;
  46. import com.goafanti.core.shiro.token.TokenManager;
  47. import com.goafanti.patent.bo.PatentAnnualFeeTaskBo;
  48. import com.goafanti.patent.bo.PatentContractListBo;
  49. import com.goafanti.patent.bo.PatentExpireBo;
  50. import com.goafanti.patent.bo.PatentInfoDetailBo;
  51. import com.goafanti.patent.bo.PatentManageListBo;
  52. import com.goafanti.patent.bo.PatentNoticeOfCorrectionBo;
  53. import com.goafanti.patent.bo.PatentPendingBo;
  54. import com.goafanti.patent.service.PatentInfoService;
  55. @Service
  56. public class PatentInfoServiceImpl extends BaseMybatisDao<PatentInfoMapper> implements PatentInfoService {
  57. @Autowired
  58. private PatentInfoMapper patentInfoMapper;
  59. @Autowired
  60. private UserMapper userMapper;
  61. @Autowired
  62. private PatentRegistrationMapper patentRegistrationMapper;
  63. @Autowired
  64. private PatentCostMapper patentCostMapper;
  65. @Autowired
  66. private PatentLogMapper patentLogMapper;
  67. @Autowired
  68. private OrgIntellectualPropertyMapper orgIntellectualPropertyMapper;
  69. @Autowired
  70. private NoticeMapper noticeMapper;
  71. @Autowired
  72. private OrganizationIdentityMapper organizationIdentityMapper;
  73. @Autowired
  74. private ContractMapper contractMapper;
  75. @Override
  76. public PatentInfo insert(PatentInfo patentInfo) {
  77. patentInfoMapper.insert(patentInfo);
  78. return patentInfo;
  79. }
  80. @Override
  81. public int updateByPrimaryKeySelective(PatentInfo patentInfo) {
  82. return patentInfoMapper.updateByPrimaryKeySelective(patentInfo);
  83. }
  84. @Override
  85. public PatentInfo selectByPrimaryKey(String id) {
  86. return patentInfoMapper.selectByPrimaryKey(id);
  87. }
  88. @SuppressWarnings("unchecked")
  89. @Override
  90. public Pagination<PatentInfo> getClientApplyList(String uid, String patentNumber, String patentName,
  91. Integer patentCatagory, Integer patentState, Integer pageNo, Integer pageSize) {
  92. Map<String, Object> params = new HashMap<>();
  93. if (uid == null) {
  94. return null;
  95. } else {
  96. params.put("uid", uid);
  97. }
  98. if (patentNumber != null && patentNumber != "") {
  99. params.put("patentNumber", patentNumber);
  100. }
  101. if (patentName != null && patentName != "") {
  102. params.put("patentName", patentName);
  103. }
  104. if (patentCatagory != null) {
  105. params.put("patentCatagory", patentCatagory);
  106. }
  107. if (patentState != null) {
  108. params.put("patentState", patentState);
  109. }
  110. if (pageNo == null || pageNo < 0) {
  111. pageNo = 1;
  112. }
  113. if (pageSize == null || pageSize < 0 || pageSize > 10) {
  114. pageSize = 10;
  115. }
  116. return (Pagination<PatentInfo>) findPage("findClientApplyListByPage", "findClentApplyCount", params, pageNo,
  117. pageSize);
  118. }
  119. @SuppressWarnings("unchecked")
  120. @Override
  121. public Pagination<PatentManageListBo> getManagePatentList(String contractId, Integer serialNumber,
  122. String patentNumber, String office, Integer locationProvince, String unitName, Integer patentCatagory,
  123. String patentName, Integer patentState, String[] cDate, String[] pDate, String author, String uid,
  124. Integer pageNo, Integer pageSize) {
  125. Map<String, Object> params = new HashMap<>();
  126. Date cStart = null;
  127. Date cEnd = null;
  128. Date pStart = null;
  129. Date pEnd = null;
  130. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  131. params.put("principal", TokenManager.getAdminId());
  132. }
  133. if (cDate != null && cDate.length > 0) {
  134. try {
  135. cStart = StringUtils.isBlank(cDate[0]) ? null : DateUtils.parseDate(cDate[0], AFTConstants.YYYYMMDD);
  136. cEnd = StringUtils.isBlank(cDate[1]) ? null
  137. : DateUtils.addDays(DateUtils.parseDate(cDate[1], AFTConstants.YYYYMMDD), 1);
  138. } catch (ParseException e) {
  139. }
  140. }
  141. if (pDate != null && pDate.length > 0) {
  142. try {
  143. pStart = StringUtils.isBlank(pDate[0]) ? null : DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
  144. pEnd = StringUtils.isBlank(pDate[1]) ? null
  145. : DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
  146. } catch (ParseException e) {
  147. }
  148. }
  149. if (cStart != null) {
  150. params.put("cStart", cStart);
  151. }
  152. if (cEnd != null) {
  153. params.put("cEnd", cEnd);
  154. }
  155. if (pStart != null) {
  156. params.put("pStart", pStart);
  157. }
  158. if (pEnd != null) {
  159. params.put("pEnd", pEnd);
  160. }
  161. if (!StringUtils.isBlank(contractId)) {
  162. params.put("contractId", contractId);
  163. }
  164. if (serialNumber != null) {
  165. params.put("serialNumber", serialNumber);
  166. }
  167. if (patentNumber != null && patentNumber != "") {
  168. params.put("patentNumber", patentNumber);
  169. }
  170. if (office != null && office != "") {
  171. params.put("office", office);
  172. }
  173. if (locationProvince != null ) {
  174. params.put("locationProvince", locationProvince);
  175. }
  176. if (unitName != null && unitName != "") {
  177. params.put("unitName", unitName);
  178. }
  179. if (patentCatagory != null) {
  180. params.put("patentCatagory", patentCatagory);
  181. }
  182. if (patentName != null && patentName != "") {
  183. params.put("patentName", patentName);
  184. }
  185. if (patentState != null) {
  186. params.put("patentState", patentState);
  187. }
  188. if (author != null && author != "") {
  189. params.put("author", author);
  190. }
  191. if (uid != null && uid != "") {
  192. params.put("uid", uid);
  193. }
  194. if (pageNo == null || pageNo < 0) {
  195. pageNo = 1;
  196. }
  197. if (pageSize == null || pageSize < 0 || pageSize > 1000) {
  198. pageSize = 10;
  199. }
  200. return (Pagination<PatentManageListBo>) findPage("findManagePatentListByPage", "findManagePatentCount", params,
  201. pageNo, pageSize);
  202. }
  203. @SuppressWarnings("unchecked")
  204. @Override
  205. public Pagination<PatentPendingBo> getManagePendingPaymentList(Integer locationProvince, Integer pageNo,
  206. Integer pageSize) {
  207. Map<String, Object> params = new HashMap<>();
  208. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  209. params.put("principal", TokenManager.getAdminId());
  210. }
  211. if (locationProvince != null ) {
  212. params.put("locationProvince", locationProvince);
  213. }
  214. if (pageNo == null || pageNo < 0) {
  215. pageNo = 1;
  216. }
  217. if (pageSize == null || pageSize < 0 ) {
  218. pageSize = 10;
  219. }
  220. return (Pagination<PatentPendingBo>) findPage("findManagePendingPaymentListByPage",
  221. "findManagePendingPaymentCount", params, pageNo, pageSize);
  222. }
  223. @SuppressWarnings("unchecked")
  224. @Override
  225. public Pagination<PatentNoticeOfCorrectionBo> getNoticeOfCorrectionList(Date authorizedDate, Integer serialNumber,
  226. String patentNumber, String office, Integer locationProvince, String unitName, Integer patentCatagory,
  227. String patentName, Integer patentState, String author, Integer pageNo, Integer pageSize) {
  228. Map<String, Object> params = new HashMap<>();
  229. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  230. params.put("principal", TokenManager.getAdminId());
  231. }
  232. if (authorizedDate != null) {
  233. params.put("authorizedDate", authorizedDate);
  234. }
  235. if (serialNumber != null) {
  236. params.put("serialNumber", serialNumber);
  237. }
  238. if (patentNumber != null && patentNumber != "") {
  239. params.put(patentNumber, patentNumber);
  240. }
  241. if (office != null && office != "") {
  242. params.put("office", office);
  243. }
  244. if (locationProvince != null ) {
  245. params.put("locationProvince", locationProvince);
  246. }
  247. if (unitName != null && unitName != "") {
  248. params.put("unitName", unitName);
  249. }
  250. if (patentCatagory != null) {
  251. params.put("patentCatagory", patentCatagory);
  252. }
  253. if (patentName != null && patentName != "") {
  254. params.put("patentName", patentName);
  255. }
  256. if (patentState != null) {
  257. params.put("patentState", patentState);
  258. }
  259. if (author != null && author != "") {
  260. params.put("author", patentState);
  261. }
  262. if (pageNo == null || pageNo < 0) {
  263. pageNo = 1;
  264. }
  265. if (pageSize == null || pageSize < 0 || pageSize > 10) {
  266. pageSize = 10;
  267. }
  268. return (Pagination<PatentNoticeOfCorrectionBo>) findPage("findNoticeOfCorrectionListByPage",
  269. "findNoticeOfCorrectionCount", params, pageNo, pageSize);
  270. }
  271. @Override
  272. public int batchDeleteByPrimaryKey(List<String> id) {
  273. return patentInfoMapper.batchDeleteByPrimaryKey(id);
  274. }
  275. @Override
  276. public PatentInfo savePatentInfo(PatentInfo patentInfo, String salesman) {
  277. patentInfo.setFounder(salesman);
  278. patentInfo.setPatentState(PatentInfoStatus.DELIVERD.getCode());
  279. patentInfo.setPrincipal(TokenManager.getAdminId());
  280. patentInfo = disposePatentInfoSave(patentInfo);
  281. PatentLog log = new PatentLog();
  282. log.setId(UUID.randomUUID().toString());
  283. log.setPid(patentInfo.getId());
  284. log.setRecordTime(patentInfo.getRecordTime());
  285. log.setState(PatentInfoStatus.CREATE.getCode());
  286. log.setPrincipal(salesman);
  287. log.setOperator(salesman);
  288. log.setComment(patentInfo.getPatentDes());
  289. patentLogMapper.insert(log);
  290. if (!StringUtils.isBlank(patentInfo.getPatentProryStatementUrl())) {
  291. OrganizationIdentity oi = organizationIdentityMapper.selectOrgIdentityByUserId(patentInfo.getUid());
  292. oi.setPatentProryStatementUrl(patentInfo.getPatentProryStatementUrl());
  293. organizationIdentityMapper.updateByPrimaryKeySelective(oi);
  294. }
  295. createNotice(patentInfo, log);
  296. PatentLog l = new PatentLog();
  297. l.setId(UUID.randomUUID().toString());
  298. l.setPid(patentInfo.getId());
  299. Calendar now = Calendar.getInstance();
  300. now.set(Calendar.MILLISECOND, 0);
  301. l.setRecordTime(now.getTime());
  302. l.setState(PatentInfoStatus.DELIVERD.getCode());
  303. l.setPrincipal(TokenManager.getAdminId());
  304. l.setOperator(salesman);
  305. patentLogMapper.insert(l);
  306. createNotice(patentInfo, l);
  307. return patentInfo;
  308. }
  309. @Override
  310. public void updatePatentInfo(PatentInfo p, PatentLog log, Date recordTime) {
  311. if (!StringUtils.isBlank(p.getPatentProryStatementUrl())) {
  312. OrganizationIdentity oi = organizationIdentityMapper.selectOrgIdentityByUserId(p.getUid());
  313. oi.setPatentProryStatementUrl(p.getPatentProryStatementUrl());
  314. organizationIdentityMapper.updateByPrimaryKeySelective(oi);
  315. }
  316. if (null != log.getState() && recordTime != null && null != log.getPrincipal()) {
  317. log.setId(UUID.randomUUID().toString());
  318. log.setPid(p.getId());
  319. log.setRecordTime(recordTime);
  320. if (TokenManager.getToken() instanceof Admin) {
  321. log.setOperator(TokenManager.getAdminId());
  322. }
  323. if (PatentInfoStatus.getStatus(log.getState()) == PatentInfoStatus.ACCEPT) {
  324. p.setPatentApplicationDate(recordTime);
  325. } else if (PatentInfoStatus.getStatus(log.getState()) == PatentInfoStatus.AUTHORIZE) {
  326. p.setAuthorizedDate(recordTime);
  327. } else if (PatentInfoStatus.getStatus(log.getState()) == PatentInfoStatus.REVIEWNOTICE) {
  328. p.setRecordTime(recordTime);
  329. } else if (PatentInfoStatus.getStatus(log.getState()) == PatentInfoStatus.CORRECTIONNOTICE) {
  330. p.setRecordTime(recordTime);
  331. }
  332. if (PatentInfoStatus.getStatus(log.getState()) != PatentInfoStatus.CIRCULATION) {
  333. p.setPatentState(log.getState());
  334. }
  335. p.setPrincipal(log.getPrincipal());
  336. patentLogMapper.insert(log);
  337. if (PatentInfoStatus.getStatus(p.getPatentState()) == PatentInfoStatus.AUTHORIZE) {
  338. OrgIntellectualProperty o = new OrgIntellectualProperty();
  339. o.setId(UUID.randomUUID().toString());
  340. o.setUid(p.getUid());
  341. o.setPid(p.getId());
  342. o.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  343. o.setIntellectualPropertyNumber(p.getPatentNumber());
  344. o.setIntellectualPropertyName(p.getPatentName());
  345. o.setCatagory(1);
  346. o.setObtainWay(1);
  347. o.setAuthorizationNumber(p.getPatentNumber());
  348. o.setAuthorizationDate(p.getAuthorizedDate());
  349. o.setEvaluationCategory((3 == p.getPatentCatagory()) ? 0 : 1);
  350. o.setType(IntellectualPropertyType.PATENT.getCode());
  351. o.setPropertyRightUrl(p.getPatentCertificateUrl());
  352. orgIntellectualPropertyMapper.insert(o);
  353. }
  354. if (PatentInfoStatus.getStatus(p.getPatentState()) == PatentInfoStatus.LICENSE) {
  355. OrgIntellectualProperty o = orgIntellectualPropertyMapper.selectOrgIntellectualPropertyByPid(p.getId());
  356. if (null != o) {
  357. Integer i = 0;
  358. switch (p.getPatentCatagory()) {
  359. case 0:
  360. i = 0;
  361. break;
  362. case 1:
  363. i = 2;
  364. break;
  365. case 2:
  366. i = 3;
  367. break;
  368. case 3:
  369. i = 11;
  370. break;
  371. }
  372. o.setCatagory(i);
  373. orgIntellectualPropertyMapper.updateByPrimaryKeySelective(o);
  374. }
  375. }
  376. createNotice(p, log);
  377. }
  378. patentInfoMapper.updateByPrimaryKeySelective(p);
  379. }
  380. @Override
  381. public void updateNoticeOfCorrection(String pid, Integer patentState) {
  382. PatentInfo patentInfo = new PatentInfo();
  383. patentInfo.setId(pid);
  384. if (patentState == PatentInfoStatus.REVIEWNOTICE.getCode()) {
  385. patentInfo.setPatentState(PatentInfoStatus.REVIEWREPLY.getCode());
  386. } else if (patentState == PatentInfoStatus.CORRECTIONNOTICE.getCode()) {
  387. patentInfo.setPatentState(PatentInfoStatus.CORRECTIONREPLY.getCode());
  388. }
  389. patentInfoMapper.updateByPrimaryKeySelective(patentInfo);
  390. PatentLog patentLog = new PatentLog();
  391. PatentInfo p = patentInfoMapper.selectByPrimaryKey(pid);
  392. patentLog.setId(UUID.randomUUID().toString());
  393. patentLog.setPid(pid);
  394. patentLog.setState(p.getPatentState());
  395. patentLog.setOperator(TokenManager.getAdminId());
  396. patentLog.setPrincipal(p.getPrincipal());
  397. Calendar now = Calendar.getInstance();
  398. now.set(Calendar.MILLISECOND, 0);
  399. patentLog.setRecordTime(now.getTime());
  400. patentLogMapper.insert(patentLog);
  401. }
  402. @Override
  403. public PatentInfoDetailBo selectPatentInfoDetail(String id) {
  404. return patentInfoMapper.selectPatentInfoDetail(id);
  405. }
  406. @Override
  407. public int batchCirculation(String[] ids, String recordTimeFormattedDate, PatentLog pl) {
  408. Date recordTime = null;
  409. try {
  410. recordTime = DateUtils.parseDate(recordTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS);
  411. } catch (ParseException e) {
  412. }
  413. pl.setRecordTime(recordTime);
  414. List<PatentLog> p = new ArrayList<PatentLog>();
  415. List<PatentInfo> list = patentInfoMapper.selectByPrimaryKeys(Arrays.asList(ids));
  416. if (null != list && list.size() > 0) {
  417. PatentLog patentLog = null;
  418. for (PatentInfo patentInfo : list) {
  419. patentLog = new PatentLog();
  420. BeanUtils.copyProperties(pl, patentLog);
  421. patentLog.setId(UUID.randomUUID().toString());
  422. patentLog.setPid(patentInfo.getId());
  423. patentLog.setOperator(TokenManager.getAdminId());
  424. p.add(patentLog);
  425. if (PatentInfoStatus.CIRCULATION.getCode() != patentLog.getState()) {
  426. patentInfo.setPatentState(patentLog.getState());
  427. patentInfoMapper.updateByPrimaryKeySelective(patentInfo);
  428. }
  429. createNotice(patentInfo, patentLog);
  430. }
  431. return patentLogMapper.batchInsert(p);
  432. }
  433. return 0;
  434. }
  435. // 专利年费到期
  436. @Override
  437. public List<PatentExpireBo> selectExpireRecord() {
  438. return patentInfoMapper.selectExpireRecord();
  439. }
  440. @Override
  441. public PatentInfo insertPatentInfo(PatentInfo patentInfo, String aid) {
  442. patentInfo.setPatentState(PatentInfoStatus.CREATE.getCode());
  443. patentInfo.setPrincipal(aid);
  444. PatentInfo p = disposePatentInfoSave(patentInfo);
  445. PatentLog log = new PatentLog();
  446. log.setId(UUID.randomUUID().toString());
  447. log.setPid(patentInfo.getId());
  448. log.setRecordTime(patentInfo.getRecordTime());
  449. log.setState(PatentInfoStatus.CREATE.getCode());
  450. log.setPrincipal(aid);
  451. log.setComment(patentInfo.getPatentDes());
  452. patentLogMapper.insert(log);
  453. createNotice(patentInfo, log);
  454. return p;
  455. }
  456. private PatentInfo disposePatentInfoSave(PatentInfo patentInfo) {
  457. patentInfo.setId(UUID.randomUUID().toString());
  458. patentInfo.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  459. patentInfo.setConfirmState(0);
  460. Calendar now = Calendar.getInstance();
  461. now.set(Calendar.MILLISECOND, 0);
  462. patentInfo.setCreateTime(now.getTime());
  463. patentInfoMapper.insert(patentInfo);
  464. PatentRegistration patentRegistration = new PatentRegistration();
  465. patentRegistration.setId(UUID.randomUUID().toString());
  466. patentRegistration.setPid(patentInfo.getId());
  467. patentRegistrationMapper.insert(patentRegistration);
  468. PatentCost patentCost = new PatentCost();
  469. patentCost.setId(UUID.randomUUID().toString());
  470. patentCost.setPid(patentInfo.getId());
  471. patentCost.setAnnualFeeState(0);
  472. patentCost.setPaymentState(0);
  473. patentCostMapper.insert(patentCost);
  474. return patentInfo;
  475. }
  476. @Override
  477. public List<PatentContractListBo> listContractPatentByContractId(String contractId) {
  478. return patentInfoMapper.listContractPatentByContractId(contractId);
  479. }
  480. @Override
  481. public void batchInsertContractRecord(Contract contract) {
  482. List<PatentInfo> pi = new ArrayList<>();
  483. List<PatentRegistration> pr = new ArrayList<>();
  484. List<PatentCost> pc = new ArrayList<>();
  485. List<PatentLog> pl = new ArrayList<>();
  486. contract.setPatentStatus(ContractBusinessStatus.CREATE.getCode());
  487. contractMapper.updateByPrimaryKeySelective(contract);
  488. for (int i = 0; i < contract.getPatentNum(); i++) {
  489. PatentInfo p = new PatentInfo();
  490. PatentLog l = new PatentLog();
  491. PatentRegistration r = new PatentRegistration();
  492. PatentCost c = new PatentCost();
  493. p.setId(UUID.randomUUID().toString());
  494. p.setUid(contract.getUid());
  495. p.setContractId(contract.getId());
  496. p.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  497. p.setFounder(TokenManager.getAdminId());
  498. p.setPrincipal(TokenManager.getAdminId());
  499. p.setPatentState(PatentInfoStatus.CREATE.getCode());
  500. Calendar now = Calendar.getInstance();
  501. now.set(Calendar.MILLISECOND, 0);
  502. p.setCreateTime(now.getTime());
  503. p.setContacts(contract.getContacts());
  504. l.setId(UUID.randomUUID().toString());
  505. l.setPid(p.getId());
  506. l.setPrincipal(TokenManager.getAdminId());
  507. l.setOperator(TokenManager.getAdminId());
  508. l.setRecordTime(now.getTime());
  509. l.setState(PatentInfoStatus.CREATE.getCode());
  510. r.setId(UUID.randomUUID().toString());
  511. r.setPid(p.getId());
  512. c.setId(UUID.randomUUID().toString());
  513. c.setPid(p.getId());
  514. c.setAnnualFeeState(PatentAnnualFeeStatus.UNPAID.getCode());
  515. c.setPaymentState(PatentPaymentStatus.UNPAID.getCode());
  516. pi.add(p);
  517. pr.add(r);
  518. pc.add(c);
  519. pl.add(l);
  520. }
  521. patentInfoMapper.batchInsert(pi);
  522. patentRegistrationMapper.batchInsert(pr);
  523. patentCostMapper.batchInsert(pc);
  524. patentLogMapper.batchInsert(pl);
  525. }
  526. @Override
  527. public List<PatentAnnualFeeTaskBo> findAnnualFeeTaskBo() {
  528. return patentInfoMapper.findAnnualFeeTaskBo();
  529. }
  530. private void createNotice(PatentInfo p, PatentLog l) {
  531. PatentInfo info = patentInfoMapper.selectByPrimaryKey(p.getId());
  532. Notice n = new Notice();
  533. Calendar now = Calendar.getInstance();
  534. now.set(Calendar.MILLISECOND, 0);
  535. n.setId(UUID.randomUUID().toString());
  536. n.setCreateTime(now.getTime());
  537. n.setReaded(NoticeReadStatus.UNREAD.getCode());
  538. User u = userMapper.selectByPrimaryKey(p.getUid());
  539. if (null != u) {
  540. n.setPid(u.getAid());
  541. }
  542. n.setUid(p.getUid());
  543. n.setRid(p.getId());
  544. n.setAid(l.getPrincipal());
  545. n.setContent("编号" + info.getSerialNumber() + " " + PatentInfoStatus.getStatus(l.getState()).getDesc());
  546. n.setNoticeType(NoticeStatus.PATENTINFO.getCode());
  547. noticeMapper.insert(n);
  548. }
  549. }