PatentInfoServiceImpl.java 19 KB

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