Antiloveg 8 years ago
parent
commit
149578be66

+ 9 - 4
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -1020,10 +1020,7 @@ public class AdminApiController extends CertifyApiController {
 
 		OrgIntellectualProperty p = orgIntellectualPropertyService.findByUidAndIntellectualPropertyNumber(
 				orgIntellectualProperty.getUid(), orgIntellectualProperty.getIntellectualPropertyNumber());
-		if (null != p) {
-			res.getError().add(buildError("", "当前知识产权编号已录入,无法重复提交!"));
-			return res;
-		}
+		
 
 		if (!StringUtils.isBlank(authorizationDateFormattedDate)) {
 			try {
@@ -1036,12 +1033,20 @@ public class AdminApiController extends CertifyApiController {
 		BeanUtils.copyProperties(orgIntellectualProperty, oip);
 
 		if (StringUtils.isBlank(oip.getId())) {
+			if (null != p) {
+				res.getError().add(buildError("", "当前知识产权编号已录入,无法重复提交!"));
+				return res;
+			}
 			oip.setId(UUID.randomUUID().toString());
 			oip.setEvaluationCategory((oip.getCatagory() >= 2 && oip.getCatagory() <= 4) ? 1 : 0);
 			oip.setDeletedSign(DeleteStatus.UNDELETE.getCode());
 			oip.setType(IntellectualPropertyType.COMMON.getCode());
 			res.setData(orgIntellectualPropertyService.insert(oip));
 		} else {
+			if (null != p && !p.getId().equals(oip.getId())){
+				res.getError().add(buildError("", "当前知识产权编号已录入,无法重复提交!"));
+				return res;
+			}
 			oip.setEvaluationCategory(orgIntellectualProperty.getCatagory() <= 2 ? 1 : 0);
 			res.setData(orgIntellectualPropertyService.updateByPrimaryKeySelective(oip));
 		}

+ 9 - 4
src/main/java/com/goafanti/cognizance/controller/CognizanceApiController.java

@@ -1613,10 +1613,7 @@ public class CognizanceApiController extends CertifyApiController {
 		}
 		
 		OrgIntellectualProperty p = orgIntellectualPropertyService.findByUidAndIntellectualPropertyNumber(TokenManager.getUserId(), orgIntellectualProperty.getIntellectualPropertyNumber());
-		if (null != p){
-			res.getError().add(buildError("", "当前知识产权编号已录入,无法重复提交!"));
-			return res;
-		}
+		
 		if (!StringUtils.isBlank(authorizationDateFormattedDate)) {
 			try {
 				orgIntellectualProperty.setAuthorizationDate(
@@ -1628,6 +1625,10 @@ public class CognizanceApiController extends CertifyApiController {
 		BeanUtils.copyProperties(orgIntellectualProperty, oip);
 
 		if (StringUtils.isBlank(oip.getId())) {
+			if (null != p){
+				res.getError().add(buildError("", "当前知识产权编号已录入,无法重复提交!"));
+				return res;
+			}
 			oip.setId(UUID.randomUUID().toString());
 			oip.setUid(TokenManager.getUserId());
 			oip.setEvaluationCategory((oip.getCatagory() >= 2 && oip.getCatagory() <= 4) ? 1 : 0);
@@ -1635,6 +1636,10 @@ public class CognizanceApiController extends CertifyApiController {
 			oip.setType(IntellectualPropertyType.COMMON.getCode());
 			res.setData(orgIntellectualPropertyService.insert(oip));
 		} else {
+			if (null != p && !p.getId().equals(oip.getId())){
+				res.getError().add(buildError("", "当前知识产权编号已录入,无法重复提交!"));
+				return res;
+			}
 			oip.setEvaluationCategory(oip.getCatagory() <= 2 ? 1 : 0);
 			res.setData(orgIntellectualPropertyService.updateByPrimaryKeySelective(oip));
 		}

+ 1 - 1
src/main/webapp/WEB-INF/views/portal/detail/demandDetail.html

@@ -32,7 +32,7 @@
 			</div>
 			<div class="col-md-5">
 				<ul class="nav_content">
-					<li><a href="/protal/search/demand.html">技术交易</a></li>
+					<li><a th:href="${basePath + '/protal/search/demand.html'}">技术交易</a></li>
 					<li class="active"><a href="#">需求</a></li>
 				</ul>
 			</div>