Parcourir la source

成果管理-列表,审核

liliang4869 il y a 7 ans
Parent
commit
1e3b095bb9

+ 10 - 0
src/main/java/com/goafanti/achievement/bo/InputAchievement.java

@@ -129,6 +129,16 @@ public class InputAchievement {
 	
 	private Integer serialNumber;
 
+	private String auditInfo;
+	
+	public String getAuditInfo() {
+		return auditInfo;
+	}
+
+	public void setAuditInfo(String auditInfo) {
+		this.auditInfo = auditInfo;
+	}
+
 	public Integer getSerialNumber() {
 		return serialNumber;
 	}

+ 46 - 1
src/main/java/com/goafanti/achievement/controller/AdminAchievementApiController.java

@@ -1,9 +1,12 @@
 package com.goafanti.achievement.controller;
 
+import java.util.List;
+
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -15,14 +18,20 @@ import com.goafanti.admin.service.AftFileService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.dao.AchievementKeywordMapper;
+import com.goafanti.common.dao.AchievementMapper;
+import com.goafanti.common.dao.AchievementPublishMapper;
 import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.enums.AchievementAuditStatus;
 import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.common.model.AchievementPublish;
 import com.goafanti.common.model.AftFile;
 import com.goafanti.common.service.BranchInformationService;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.portal.bo.AchievementResultObject;
 import com.goafanti.user.service.UserService;
+
 @RestController
 @RequestMapping(value = "/api/admin/achievement")
 public class AdminAchievementApiController extends CertifyApiController {
@@ -40,7 +49,10 @@ public class AdminAchievementApiController extends CertifyApiController {
     AchievementPublishService	achievementPublishService;
     @Resource
     BranchInformationService	branchInformationService;
-     
+	@Autowired
+	private AchievementKeywordMapper		achievementKeywordMapper;
+	@Autowired
+	private AchievementPublishMapper achievementPublishMapper;
     /**
      * 个人成果所有人列表
      */
@@ -74,6 +86,39 @@ public class AdminAchievementApiController extends CertifyApiController {
     	return res;
     }
     
+    @RequestMapping(value="/audit" ,method=RequestMethod.POST)
+    private Result auditAchievemnt(String id,Integer auditResult,String auditInfo) {
+    	Result result=new Result();
+    	if(id == null || auditResult == null || auditResult.intValue()!=0 && auditResult.intValue()!=1)
+    	{
+    		result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"",""));return result;
+    	}
+    	AchievementResultObject achievementResultObject=achievementService.getAchievementDetailById(id);
+    	if(achievementResultObject==null) {
+    		result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"未找到成果","成果Id"));return result;
+    	}
+    	if(achievementResultObject.getAuditStatus()!= AchievementAuditStatus.SUBMIT.getCode()) {
+    		result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"未找到成果","当前状态不可审核"));return result;
+    	}
+    	achievementService.updateAuditAchievement( id,auditResult,auditInfo);
+    	return result; 
+    }
+	@RequestMapping(value = "/achievementDetail",method=RequestMethod.GET)
+	private Result Detail(String id) {
+		Result result=new Result();
+		if (StringUtils.isBlank(id)) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return result;
+		}
+		
+		AchievementResultObject achievementObjects=achievementService.getAchievementDetailById(id);
+		List<String>keywords=achievementKeywordMapper.getKeywordsByAchievementId(id);
+		List<String> publishPages=achievementPublishMapper.getPublishPagesById(id);
+		achievementObjects.setKeywords(keywords);
+		achievementObjects.setPublishPages(publishPages);
+		result.setData(achievementObjects);
+		return result;
+	}
     /**
      * 个人成果详情详情
      */

+ 9 - 2
src/main/java/com/goafanti/achievement/controller/UserAchievementApiController.java

@@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.alibaba.druid.support.logging.Log;
+import com.alibaba.fastjson.JSONObject;
 import com.goafanti.achievement.bo.InputAchievement;
 import com.goafanti.achievement.service.AchievementOrderService;
 import com.goafanti.achievement.service.AchievementService;
@@ -41,9 +43,11 @@ import com.goafanti.common.model.AchievementOrder;
 import com.goafanti.common.model.AftFile;
 import com.goafanti.common.model.Demand;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.portal.bo.AchievementObject;
 import com.goafanti.portal.bo.AchievementResultObject;
+import com.google.gson.JsonObject;
 
 @RestController
 @RequestMapping(value = "/api/user/achievement")
@@ -122,7 +126,9 @@ public class UserAchievementApiController extends CertifyApiController {
 		 String startDate, String endDate,
 		 Integer pageNo, Integer pageSize) {
 		Result res = new Result();
-		
+		Pagination<AchievementObject>  data = achievementService.listMyAchievement(auditStatus, name, dataCategory,
+				 startDate, endDate, pageNo, pageSize);
+		System.out.println(JSONObject.toJSONString(data)+"-----------------------------");
 		res.setData(achievementService.listMyAchievement(auditStatus, name, dataCategory,
 				 startDate, endDate, pageNo, pageSize));
 		return res;
@@ -153,6 +159,7 @@ public class UserAchievementApiController extends CertifyApiController {
 		Achievement a = new Achievement();
 		BeanUtils.copyProperties(ia, a);
 		a.setOwnerId(TokenManager.getUserId());
+		a.setInfoSources(1);
 		List<String> webPages = new ArrayList<String>();
 		List<String> appPages = new ArrayList<String>();
 		PageConstants.putAchievement(publishPages, webPages, appPages);
@@ -298,7 +305,7 @@ public class UserAchievementApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
 			return res;
 		}
-		if (AchievementAuditStatus.CREATE.getCode() != achievementResultObject.getAuditStatus()) {
+		if (AchievementAuditStatus.CREATE.getCode() != achievementResultObject.getAuditStatus() && AchievementAuditStatus.UNAUDITED.getCode()!=achievementResultObject.getAuditStatus()) {
 		res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核,"));
 		return res;
 	} 

+ 2 - 0
src/main/java/com/goafanti/achievement/service/AchievementService.java

@@ -85,5 +85,7 @@ public interface AchievementService {
 	List<AchievementObject>getBoutiquePatent(int size);
 	
 	List<AchievementObject>guessYouLike(int size);
+	
+	int updateAuditAchievement(String id,Integer auditResult,String auditInfo);
 
 }

+ 23 - 3
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java

@@ -111,8 +111,8 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			a.setTechBrokerId(TokenManager.getAdminId());
 		}
 		a.setReleaseStatus(AchievementReleaseStatus.UNRELEASE.getCode());
-		a.setAuditStatus(0);
-		if (AchievementAuditStatus.SUBMIT.getCode().equals(a.getAuditStatus())) {
+	
+		if (AchievementAuditStatus.SUBMIT.getCode()==a.getAuditStatus()) {
 			
 			createAuditorNotice(a);
 		} else {
@@ -127,7 +127,8 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			}
 		} 
 		a.setCreateTime(now.getTime());
-		a.setOrgId(ownerId);		
+		a.setOrgId(ownerId);	
+		a.setInfoSources(1);
 		achievementMapper.insert(a);
 		disposeAchievementKeyword(keywords, a, false);
 		disposeAchievementPublish(a,webPages,appPages,false);
@@ -781,4 +782,23 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 				pageNo, pageSize);
 	}
 
+	@Override
+	public int updateAuditAchievement(String id, Integer auditResult,String auditInfo) {
+		// TODO Auto-generated method stub
+		int auditStatus=AchievementAuditStatus.AUDITED.getCode().intValue();
+		if(auditResult.intValue() == 0) {
+			auditStatus=AchievementAuditStatus.UNAUDITED.getCode().intValue();
+		}
+		else auditStatus=AchievementAuditStatus.AUDITED.getCode().intValue();
+		Achievement achievement=new Achievement();
+		achievement.setId(id);
+		achievement.setAuditStatus(auditStatus);
+		achievement.setAuditInfo(auditInfo);
+		achievement.setReleaseDate(new Date());
+		achievementMapper.updateByPrimaryKeySelective(achievement);
+		return auditStatus;
+	}
+	
+	
+
 }

+ 4 - 2
src/main/java/com/goafanti/common/dao/AchievementMapper.java

@@ -20,7 +20,7 @@ public interface AchievementMapper {
 	int deleteByPrimaryKey(String id);
 
 	int insert(Achievement record);
-
+  
 	int insertSelective(Achievement record);
 
 	Achievement selectByPrimaryKey(String id);
@@ -36,7 +36,7 @@ public interface AchievementMapper {
 	AchievementOrgOwnerDetailBo selectOrgOwnerDetail(String id);
 
 	void insertBatch(List<Achievement> achievementList);
-
+ 
 	AchievementDetailBo selectAchievementDetail(String uid, String id);
 	
 	AchievementDetailBo selectAchievementDetail(String id);
@@ -71,4 +71,6 @@ public interface AchievementMapper {
 	
 	AchievementResultObject getAchievementDetailById(String id);
 	
+
+	
 }

+ 14 - 10
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -90,7 +90,7 @@
       transfer_mode, bargaining_mode, transfer_price,  patent_case, 
       awards, team_des, parameter,  status, 
       create_time, release_status, release_date, 
-      deleted_sign, audit_status,international_flag,boutique,is_hot)
+      deleted_sign, audit_status,international_flag,boutique,is_hot,info_sources)
     values (#{id,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER}, #{dataCategory,jdbcType=INTEGER}, 
       #{name,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR}, #{category,jdbcType=INTEGER}, 
       #{summary,jdbcType=VARCHAR}, #{introduction,jdbcType=LONGVARCHAR}, #{technicalPictureUrl,jdbcType=VARCHAR}, 
@@ -103,7 +103,7 @@
     #{status,jdbcType=INTEGER}, 
       #{createTime,jdbcType=TIMESTAMP}, #{releaseStatus,jdbcType=INTEGER}, #{releaseDate,jdbcType=TIMESTAMP}, 
       #{deletedSign,jdbcType=INTEGER}, #{auditStatus,jdbcType=INTEGER},
-       #{internationalFlag,jdbcType=INTEGER},#{boutique,jdbcType=INTEGER},#{isHot,jdbcType=INTEGER})
+       #{internationalFlag,jdbcType=INTEGER},#{boutique,jdbcType=INTEGER},#{isHot,jdbcType=INTEGER},#{infoSources,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.Achievement">
     insert into achievement
@@ -550,6 +550,9 @@
        <if test="isHot != null">
         is_hot = #{isHot,jdbcType=INTEGER},
       </if>
+       <if test="auditInfo != null">
+        audit_info = #{auditInfo,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -1241,18 +1244,18 @@ order by release_date limit #{0}
   		a.release_date as releaseDate, 
   		a.audit_status as auditStatus,
   		a.boutique,
-  		b.identify_name as ownerName,
+  		b.identify_name as ownerName
   	from achievement a
   	left join user b on a.owner_id = b.id 
-  	where a.deleted_sign = 0 
+  	where a.deleted_sign = 0 and info_sources=1
 	<if test="ownerId != null">
   		and a.owner_id = #{ownerId,jdbcType=VARCHAR}
   	</if>
   	<if test="name != null">
-		and a.name like concat('%',#{name,jdbcType=VARCHAR},'%'}
+		and a.name like concat('%',#{name,jdbcType=VARCHAR},'%');
 	</if>
 	<if test="ownerName != null">
-		and b.identify_name like concat('%',#{ownerName,jdbcType=VARCHAR},'%')
+		and b.identify_name =#{ownerName,jdbcType=VARCHAR}
 	</if>
 	<if test="auditStatus != null">
 		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
@@ -1269,7 +1272,6 @@ order by release_date limit #{0}
 	<if test="endDate != null">
 	   and  a.release_date <![CDATA[ =< ]]> #{endDate,jdbcType=TIMESTAMP}
 	</if>
-	order by serial_number desc
 	<if test="page_sql!=null">
 			${page_sql}
 	</if>
@@ -1279,7 +1281,7 @@ order by release_date limit #{0}
   		count(0)
   	from achievement a
   	left join user b on a.owner_id = b.id 
-  	where a.deleted_sign = 0 
+  	where a.deleted_sign = 0 and info_sources=1
 	<if test="ownerId != null">
   		and a.owner_id = #{ownerId,jdbcType=VARCHAR}
   	</if>
@@ -1287,7 +1289,7 @@ order by release_date limit #{0}
 		and a.name like concat('%',#{name,jdbcType=VARCHAR},'%'}
 	</if>
 	<if test="ownerName != null">
-		and b.identify_name like concat('%',#{ownerName,jdbcType=VARCHAR},'%')
+		and b.identify_name=#{ownerName,jdbcType=VARCHAR}
 	</if>
 	<if test="auditStatus != null">
 		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
@@ -1329,7 +1331,8 @@ a.id,
 	a.bargaining_mode as bargainingMode,
 	a.boutique,
 	a.is_hot as isHot,
-	a.audit_status as auditStatus
+	a.audit_status as auditStatus,
+	a.audit_info as auditInfo
 from
 	achievement a
 left join field_glossory fg on
@@ -1339,4 +1342,5 @@ left join field_glossory fgg on
 where
 	a.id = #{0}
 </select>
+
 </mapper>

+ 9 - 0
src/main/java/com/goafanti/common/model/Achievement.java

@@ -296,6 +296,15 @@ public class Achievement {
 	private Integer infoSources;
 	private String introduction;
 	
+String auditInfo;
+
+	public String getAuditInfo() {
+	return auditInfo;
+}
+
+public void setAuditInfo(String auditInfo) {
+	this.auditInfo = auditInfo;
+}
 
 	public String getIntroduction() {
 		return introduction;

+ 2 - 1
src/main/java/com/goafanti/portal/bo/AchievementObject.java

@@ -1,6 +1,7 @@
 package com.goafanti.portal.bo;
 
-import java.sql.Date;
+
+import java.util.Date;
 
 import com.goafanti.achievement.bo.InputAchievement;
 import com.goafanti.common.enums.AchievementCategory;