|
|
@@ -0,0 +1,420 @@
|
|
|
+package com.goafanti.admin.controller;
|
|
|
+
|
|
|
+import java.text.ParseException;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
|
|
|
+import com.goafanti.common.bo.Result;
|
|
|
+import com.goafanti.common.constant.AFTConstants;
|
|
|
+import com.goafanti.common.constant.ErrorConstants;
|
|
|
+import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.enums.PatentInfoFields;
|
|
|
+import com.goafanti.common.enums.PatentInfoStatus;
|
|
|
+import com.goafanti.common.enums.PatentRegistrationFields;
|
|
|
+import com.goafanti.common.model.PatentCost;
|
|
|
+import com.goafanti.common.model.PatentInfo;
|
|
|
+import com.goafanti.common.model.PatentLog;
|
|
|
+import com.goafanti.common.model.PatentRegistration;
|
|
|
+import com.goafanti.common.model.User;
|
|
|
+import com.goafanti.common.utils.StringUtils;
|
|
|
+import com.goafanti.patent.bo.InputPatentInfo;
|
|
|
+import com.goafanti.patent.bo.InputPatentRegistration;
|
|
|
+import com.goafanti.patent.bo.PatentRegistrationBo;
|
|
|
+import com.goafanti.patent.service.AdminService;
|
|
|
+import com.goafanti.patent.service.PatentCostService;
|
|
|
+import com.goafanti.patent.service.PatentInfoService;
|
|
|
+import com.goafanti.patent.service.PatentLogService;
|
|
|
+import com.goafanti.patent.service.PatentRegistrationService;
|
|
|
+import com.goafanti.user.service.OrganizationIdentityService;
|
|
|
+import com.goafanti.user.service.UserService;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/api/admin/patent")
|
|
|
+public class AdminPatentApiController extends CertifyApiController {
|
|
|
+ @Resource
|
|
|
+ private PatentInfoService patentInfoService;
|
|
|
+ @Resource
|
|
|
+ private PatentLogService patentLogService;
|
|
|
+ @Resource
|
|
|
+ private OrganizationIdentityService organizationIdentityServivce;
|
|
|
+ @Resource
|
|
|
+ private PatentCostService patentCostService;
|
|
|
+ @Resource
|
|
|
+ private PatentRegistrationService patentRegistrationService;
|
|
|
+ @Resource
|
|
|
+ private AdminService adminService;
|
|
|
+ @Resource
|
|
|
+ private OrgIntellectualPropertyService orgIntellectualPropertyService;
|
|
|
+ @Resource
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除专利
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/delete", method = RequestMethod.GET)
|
|
|
+ public Result deletePatent(@RequestParam(name = "ids[]", required = false) String[] ids) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (ids == null || ids.length < 1) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
|
|
|
+ } else {
|
|
|
+ res.setData(patentInfoService.batchDeleteByPrimaryKey(Arrays.asList(ids)));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 管理端logs
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/logs", method = RequestMethod.GET)
|
|
|
+ public Result patentProcess(String pid) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(pid)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "专利ID"));
|
|
|
+ } else {
|
|
|
+ res.setData(patentLogService.selectProcessByPid(pid));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增专利申请
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/apply", method = RequestMethod.POST)
|
|
|
+ public Result manageApplyPatent(@Valid InputPatentInfo patentInfo, BindingResult bindingResult) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ PatentInfoFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(patentInfo.getUid())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ User curUser = userService.selectByPrimaryKey(patentInfo.getUid());
|
|
|
+ if (!checkCertify(res, curUser)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ String aid = curUser.getAid();
|
|
|
+ PatentInfo pi = new PatentInfo();
|
|
|
+ BeanUtils.copyProperties(patentInfo, pi);
|
|
|
+ res.setData(patentInfoService.savePatentInfo(pi, aid));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 专利详情修改保存
|
|
|
+ *
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/update", method = RequestMethod.POST)
|
|
|
+ public Result managePatentInfo(@Valid InputPatentInfo patentInfo, BindingResult bindingResult,
|
|
|
+ String recordTimeFormattedDate) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ PatentInfoFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(patentInfo.getId())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专利申请", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ PatentInfo p = patentInfoService.selectByPrimaryKey(patentInfo.getId());
|
|
|
+ if (null == p) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专利申请", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ Date recordTime = null;
|
|
|
+ if (!StringUtils.isBlank(recordTimeFormattedDate)) {
|
|
|
+ try {
|
|
|
+ recordTime = DateUtils.parseDate(recordTimeFormattedDate, AFTConstants.YYYYMMDD);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PatentInfo pi = new PatentInfo();
|
|
|
+ PatentLog pl = new PatentLog();
|
|
|
+ pi.setId(patentInfo.getId());
|
|
|
+ BeanUtils.copyProperties(patentInfo, pi);
|
|
|
+ BeanUtils.copyProperties(patentInfo, pl);
|
|
|
+ patentInfoService.updatePatentInfo(pi, pl, recordTime);
|
|
|
+ res.setData(1);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 专利列表
|
|
|
+ *
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/patentList", method = RequestMethod.GET)
|
|
|
+ public Result patentList(Integer serialNumber, String patentNumber, String office, String locationProvince,
|
|
|
+ String unitName, Integer patentCatagory, String patentName, Integer patentState,
|
|
|
+ @RequestParam(name = "createTime[]", required = false) String[] createTime,
|
|
|
+ @RequestParam(name = "patentApplicationDate[]", required = false) String[] patentApplicationDate,
|
|
|
+ String author, String pageNo, String pageSize) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ Integer pNo = 1;
|
|
|
+ Integer pSize = 10;
|
|
|
+ if (StringUtils.isNumeric(pageSize)) {
|
|
|
+ pSize = Integer.parseInt(pageSize);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNumeric(pageNo)) {
|
|
|
+ pNo = Integer.parseInt(pageNo);
|
|
|
+ }
|
|
|
+ res.setData(patentInfoService.getManagePatentList(serialNumber, patentNumber, office, locationProvince,
|
|
|
+ unitName, patentCatagory, patentName, patentState, createTime, patentApplicationDate, author, pNo,
|
|
|
+ pSize));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 待缴费专利管理列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/pendingPaymentList", method = RequestMethod.GET)
|
|
|
+ public Result managePendingPaymentList(String locationProvince, String pageNo, String pageSize) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ Integer pNo = 1;
|
|
|
+ Integer pSize = 10;
|
|
|
+ if (StringUtils.isNumeric(pageSize)) {
|
|
|
+ pSize = Integer.parseInt(pageSize);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNumeric(pageNo)) {
|
|
|
+ pNo = Integer.parseInt(pageNo);
|
|
|
+ }
|
|
|
+ res.setData(patentInfoService.getManagePendingPaymentList(locationProvince, pNo, pSize));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 年费确认缴费
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/confirmPayment", method = RequestMethod.POST)
|
|
|
+ public Result confirmPayment(String cid, String uid) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(cid) || StringUtils.isBlank(uid)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专利申请", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ PatentCost cost = patentCostService.selectByPrimaryKey(cid);
|
|
|
+ if (null == cost) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专利申请", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == cost.getPid()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专利申请", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ PatentInfo info = patentInfoService.selectByPrimaryKey(cost.getPid());
|
|
|
+ if (!uid.equals(info.getUid())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专利申请", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ PatentCost patentCost = new PatentCost();
|
|
|
+ patentCost.setId(cid);
|
|
|
+ patentCost.setAnnualFeeState(1);
|
|
|
+ patentCostService.updateByPrimaryKeySelective(patentCost);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 补正审查通知列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/noticeOfCorrectionList", method = RequestMethod.POST)
|
|
|
+ public Result noticeOfCorrectionList(Date authorizedDate, Integer serialNumber, String patentNumber, String office,
|
|
|
+ String locationProvince, String unitName, Integer patentCatagory, String patentName, Integer patentState,
|
|
|
+ String author, String pageNo, String pageSize) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ Integer pNo = 1;
|
|
|
+ Integer pSize = 10;
|
|
|
+ if (StringUtils.isNumeric(pageSize)) {
|
|
|
+ pSize = Integer.parseInt(pageSize);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNumeric(pageNo)) {
|
|
|
+ pNo = Integer.parseInt(pageNo);
|
|
|
+ }
|
|
|
+ res.setData(patentInfoService.getNoticeOfCorrectionList(authorizedDate, serialNumber, patentNumber, office,
|
|
|
+ locationProvince, unitName, patentCatagory, patentName, patentState, author, pNo, pSize));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 补正审查通知答复确认
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/replyConfirm", method = RequestMethod.POST)
|
|
|
+ public Result replyConfirm(String pid, String uid, Integer patentState) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(pid) || StringUtils.isBlank(uid)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专利申请", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == patentState || patentState != PatentInfoStatus.REVIEWNOTICE.getCode()
|
|
|
+ || patentState != PatentInfoStatus.CORRECTIONNOTICE.getCode()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "专利状态", "专利状态"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ PatentInfo info = patentInfoService.selectByPrimaryKey(pid);
|
|
|
+ if (!uid.equals(info.getUid())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专利申请", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ patentInfoService.updateNoticeOfCorrection(pid, patentState);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 收发详情入口/收发纸件登记
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getRecieveSendList", method = RequestMethod.GET)
|
|
|
+ public Result RecieveSendList(String pageNo, String pageSize) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ Integer pNo = 1;
|
|
|
+ Integer pSize = 10;
|
|
|
+
|
|
|
+ if (StringUtils.isNumeric(pageSize)) {
|
|
|
+ pSize = Integer.parseInt(pageSize);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNumeric(pageNo)) {
|
|
|
+ pNo = Integer.parseInt(pageNo);
|
|
|
+ }
|
|
|
+ res.setData(patentRegistrationService.getRecieveSendList(pNo, pSize));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 收发登记详情编辑保存
|
|
|
+ *
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/saveRecieveSend", method = RequestMethod.POST)
|
|
|
+ public Result recieveSendDetail(BindingResult bindingResult, String rid, String pid,
|
|
|
+ @Valid InputPatentRegistration patentRegistrationBo) {
|
|
|
+ Result res = new Result();
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ PatentRegistrationFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!checkAdminLogin(res)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(pid) || StringUtils.isBlank(rid)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "专利记录ID", "专利记录ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ patentRegistrationService.updateByPrimaryKey(regBo2Reg(rid, pid, patentRegistrationBo));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ private PatentRegistration regBo2Reg(String rid, String pid, InputPatentRegistration patentRegistrationBo) {
|
|
|
+ PatentRegistration patentRegistration = new PatentRegistration();
|
|
|
+ patentRegistration.setId(rid);
|
|
|
+ patentRegistration.setAcceptanceExpressCompany(patentRegistrationBo.getAcceptanceExpressCompany());
|
|
|
+ try {
|
|
|
+ if (!StringUtils.isBlank(patentRegistrationBo.getAcceptanceIssueTime())) {
|
|
|
+ patentRegistration.setAcceptanceIssueTime(
|
|
|
+ DateUtils.parseDate(patentRegistrationBo.getAcceptanceIssueTime(), "yyyy-MM-dd"));
|
|
|
+ } else {
|
|
|
+ patentRegistration.setAcceptanceIssueTime(null);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isBlank(patentRegistrationBo.getAcceptanceReceiveTime())) {
|
|
|
+ patentRegistration.setAcceptanceReceiveTime(
|
|
|
+ DateUtils.parseDate(patentRegistrationBo.getAcceptanceReceiveTime(), "yyyy-MM-dd"));
|
|
|
+ } else {
|
|
|
+ patentRegistration.setAcceptanceReceiveTime(null);
|
|
|
+ }
|
|
|
+ patentRegistration.setAcceptanceTrackingNumber(patentRegistrationBo.getAcceptanceTrackingNumber());
|
|
|
+ patentRegistration.setAuthorizationExpressCompany(patentRegistrationBo.getAuthorizationExpressCompany());
|
|
|
+ if (!StringUtils.isBlank(patentRegistrationBo.getAuthorizationIssueTime())) {
|
|
|
+ patentRegistration.setAuthorizationIssueTime(
|
|
|
+ DateUtils.parseDate(patentRegistrationBo.getAuthorizationIssueTime(), "yyyy-MM-dd"));
|
|
|
+ } else {
|
|
|
+ patentRegistration.setAuthorizationIssueTime(null);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isBlank(patentRegistrationBo.getAuthorizationReceiveTime())) {
|
|
|
+ patentRegistration.setAuthorizationReceiveTime(
|
|
|
+ DateUtils.parseDate(patentRegistrationBo.getAuthorizationReceiveTime(), "yyyy-MM-dd"));
|
|
|
+ } else {
|
|
|
+ patentRegistration.setAuthorizationReceiveTime(null);
|
|
|
+ }
|
|
|
+ patentRegistration.setAuthorizationTrackingNumber(patentRegistrationBo.getAuthorizationTrackingNumber());
|
|
|
+ patentRegistration.setCertificateExpressCompany(patentRegistrationBo.getCertificateExpressCompany());
|
|
|
+ if (!StringUtils.isBlank(patentRegistrationBo.getCertificateIssueTime())) {
|
|
|
+ patentRegistration.setCertificateIssueTime(
|
|
|
+ DateUtils.parseDate(patentRegistrationBo.getCertificateIssueTime(), "yyyy-MM-dd"));
|
|
|
+ } else {
|
|
|
+ patentRegistration.setCertificateIssueTime(null);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isBlank(patentRegistrationBo.getCertificateRecieveTime())) {
|
|
|
+ patentRegistration.setCertificateRecieveTime(
|
|
|
+ DateUtils.parseDate(patentRegistrationBo.getCertificateRecieveTime(), "yyyy-MM-dd"));
|
|
|
+ } else {
|
|
|
+ patentRegistration.setCertificateRecieveTime(null);
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ }
|
|
|
+ patentRegistration.setCertificateTrackingNumber(patentRegistrationBo.getCertificateTrackingNumber());
|
|
|
+ patentRegistration.setPid(pid);
|
|
|
+ return patentRegistration;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|