Browse Source

BUG修复

anderx 8 years ago
parent
commit
0f7c466f1e

+ 45 - 0
src/main/java/com/goafanti/achievement/bo/AchievementInterestBo.java

@@ -0,0 +1,45 @@
+package com.goafanti.achievement.bo;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.goafanti.common.constant.AFTConstants;
+
+public class AchievementInterestBo {
+	private String id;
+	private String name;
+	private Date createTime;
+	private Integer type;
+	public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Date getCreateTime() {
+		return createTime;
+	}
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+	public String getCreateTimeFormattedDate() {
+		if (this.createTime == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDD);
+		}
+	}
+	public Integer getType() {
+		return type;
+	}
+	public void setType(Integer type) {
+		this.type = type;
+	}
+}

+ 146 - 0
src/main/java/com/goafanti/app/controller/AppAchievementDemandController.java

@@ -0,0 +1,146 @@
+package com.goafanti.app.controller;
+
+
+
+import javax.annotation.Resource;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import com.goafanti.achievement.service.AchievementService;
+import com.goafanti.activity.service.ActivityService;
+import com.goafanti.banners.service.BannersService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.BaseApiController;
+
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.demand.service.DemandService;
+import com.goafanti.news.service.NewsService;
+import com.goafanti.user.service.UserCareerService;
+import com.goafanti.user.service.UserIdentityService;
+import com.goafanti.user.service.UserInterestService;
+
+@RestController
+@RequestMapping(path = "/open/api/open/achievement", method = RequestMethod.GET)
+public class AppAchievementDemandController extends BaseApiController {
+	@Resource
+	private BannersService		bannersService;
+	@Resource
+	private ActivityService		activityService;
+	@Resource
+	private NewsService			newsService;
+	@Resource
+	private AchievementService	achievementService;
+	@Resource
+	private DemandService		demandService;
+	@Resource
+	private UserCareerService		userCareerService;
+	@Resource
+	private UserInterestService userInterestService; 
+	@Resource
+	private UserIdentityService	userIdentityService;
+	
+	/**
+	 * 成果列表
+	 */
+	@RequestMapping(value = "/achievementList", method = RequestMethod.GET)
+	private Result achievementList(Integer auditStatus, Integer serialNumber, String name, String keyword, Integer category,
+			Integer ownerType, Integer status, String releaseDateStartDate, String releaseDateEndDate,
+			Integer releaseStatus,String ownerId,String pageNo, String pageSize) {
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(achievementService.listAppUserAchievement(auditStatus, serialNumber, name, keyword, category,
+				ownerType, status, releaseDateStartDate, releaseDateEndDate, releaseStatus,ownerId, pNo, pSize));
+		return res;
+	}
+	/**
+	 * 成果详情
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
+	private Result userDetail(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
+			return res;
+		}
+		res.setData(achievementService.selectUserOwnerDetail(id));
+		return res;
+	}
+	/**
+	 * 需求列表
+	 */
+	@RequestMapping(value = "/demandList", method = RequestMethod.GET)
+	public Result demandList(Integer auditStatus, Integer serialNumber, String name, String keyword, Integer demandType,
+			String validityPeriodStartDate, String validityPeriodEndDate, Integer status, Integer releaseStatus,
+			String releaseDateStartDate, String releaseDateEndDate, String pageNo, String pageSize) {
+		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(demandService.listAppDemand(auditStatus, serialNumber, name, keyword, demandType,
+				validityPeriodStartDate, validityPeriodEndDate, status, releaseStatus, releaseDateStartDate,
+				releaseDateEndDate, pNo, pSize));
+		return res;
+	}
+	/**
+	 * 需求详情
+	 */
+	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
+	public Result DemandDetail(String id) {
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		res.setData(demandService.selectDemandDetail(id));
+		return res;
+	}
+	/**
+	 * 关注列表
+	 */
+	@RequestMapping(value = "/interestList", method = RequestMethod.GET)
+	public Result interestList(String uid,Integer type) {
+		Result res = new Result();
+		if (StringUtils.isBlank(uid)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到ID", "ID"));
+			return res;
+		}
+		res.setData(demandService.selectinterest(uid,type));
+		return res;
+	}
+	/**
+	 * 专家列表
+	 */
+	@RequestMapping(value = "/expertsList", method = RequestMethod.GET)
+	public Result expertsList(String industry, Integer pNo, Integer pSize) {
+		Result res = new Result();
+		res.setData(userIdentityService.expertsList(industry,  pNo,  pSize));
+		return res;
+	}
+	/**
+	 * 专家详情
+	 */
+	@RequestMapping(value = "/expertsDetail", method = RequestMethod.GET)
+	public Result expertsDetail(String uid) {
+		Result res = new Result();
+		res.setData(userIdentityService.expertsDetail(uid));
+		return res;
+	}
+	
+}

+ 1 - 1
src/main/java/com/goafanti/common/dao/UserIdentityMapper.java

@@ -4,7 +4,7 @@ import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.model.UserIdentityExample;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.user.bo.AuditorUserIdentityDetailBo;
-import com.goafanti.user.bo.UserCareerBo;
+
 import com.goafanti.user.bo.UserIdentityBo;
 import com.goafanti.user.bo.UserNames;
 

+ 59 - 0
src/main/java/com/goafanti/common/enums/InterestType.java

@@ -0,0 +1,59 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+public enum InterestType {
+	ACHIEVEMENT(0, "成果"),
+	DEMAND(1, "需求"),
+	EXPERTS(2, "专家"),
+	POLICY(3,"政策"),
+	UNAUDITED(4,"活动"),
+	OTHER(5, "其他");
+
+	private InterestType(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, InterestType> status = new HashMap<Integer, InterestType>();
+
+	static {
+		for (InterestType value : InterestType.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static InterestType getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static InterestType getStatus(String code) {
+		if (StringUtils.isNumeric(code)) {
+			return getStatus(Integer.parseInt(code));
+		}
+		return OTHER;
+	}
+
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+
+	private Integer	code;
+	private String	desc;
+
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}
+

+ 5 - 5
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -1412,10 +1412,10 @@
 	</select>
 	<select id="userInterest" resultType="com.goafanti.user.bo.UserInterestBo">
 		select
-		uid.uid as id,uid.username as name,uc.work_unit as workUnit,uc.position ,ui.create_time as createTime
-		from user_interest ui
-		LEFT  join user_identity uid on ui.to_uid=uid.uid
-		LEFT  join user_career uc on ui.to_uid=uc.uid
-		where from_uid=#{uid,jdbcType=VARCHAR}
+		t.to_uid as id,y.username as name,y.work_unit as workUnit,y.professional_title as professionalTitle,t.create_time as createTime
+		from user_interest t
+		LEFT  join user_identity y on t.to_uid=y.uid
+		LEFT  join user u on t.to_uid=u.id
+		where t.from_uid=#{uid,jdbcType=VARCHAR}
 	</select>
 </mapper>

+ 45 - 0
src/main/java/com/goafanti/demand/bo/DemandInterestBo.java

@@ -0,0 +1,45 @@
+package com.goafanti.demand.bo;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.goafanti.common.constant.AFTConstants;
+
+public class DemandInterestBo {
+	private String id;
+	private String name;
+	private Date createTime;
+	private Integer type;
+	public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Date getCreateTime() {
+		return createTime;
+	}
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+	public String getCreateTimeFormattedDate() {
+		if (this.createTime == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDD);
+		}
+	}
+	public Integer getType() {
+		return type;
+	}
+	public void setType(Integer type) {
+		this.type = type;
+	}
+}

+ 45 - 0
src/main/java/com/goafanti/news/bo/newsInterestBo.java

@@ -0,0 +1,45 @@
+package com.goafanti.news.bo;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.goafanti.common.constant.AFTConstants;
+
+public class newsInterestBo {
+	private String id;
+	private String title;
+	private Date createTime;
+	private Integer type;
+	public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	public String getTitle() {
+		return title;
+	}
+	public void setTitle(String title) {
+		this.title = title;
+	}
+	public Date getCreateTime() {
+		return createTime;
+	}
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+	public String getCreateTimeFormattedDate() {
+		if (this.createTime == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDD);
+		}
+	}
+	public Integer getType() {
+		return type;
+	}
+	public void setType(Integer type) {
+		this.type = type;
+	}
+}

+ 60 - 0
src/main/java/com/goafanti/user/bo/UserInterestBo.java

@@ -0,0 +1,60 @@
+package com.goafanti.user.bo;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.goafanti.common.constant.AFTConstants;
+
+public class UserInterestBo {
+	
+	private String id;
+	private String name;
+	private String workUnit;
+	private String professionalTitle;
+	private Date createTime;
+	private Integer type;
+	public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Date getCreateTime() {
+		return createTime;
+	}
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+	public String getCreateTimeFormattedDate() {
+		if (this.createTime == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDD);
+		}
+	}
+	public Integer getType() {
+		return type;
+	}
+	public void setType(Integer type) {
+		this.type = type;
+	}
+	public String getWorkUnit() {
+		return workUnit;
+	}
+	public void setWorkUnit(String workUnit) {
+		this.workUnit = workUnit;
+	}
+	public String getProfessionalTitle() {
+		return professionalTitle;
+	}
+	public void setProfessionalTitle(String professionalTitle) {
+		this.professionalTitle = professionalTitle;
+	}
+}

+ 1 - 1
src/main/java/com/goafanti/user/service/UserCareerService.java

@@ -2,7 +2,7 @@ package com.goafanti.user.service;
 
 import com.goafanti.common.model.UserCareer;
 import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.user.bo.UserCareerBo;
+
 
 public interface UserCareerService {
 

+ 1 - 1
src/main/java/com/goafanti/user/service/UserInterestService.java

@@ -3,7 +3,7 @@ package com.goafanti.user.service;
 import com.goafanti.common.model.UserInterest;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.user.bo.InterestUserListBo;
-import com.goafanti.user.bo.UserCareerBo;
+
 import com.goafanti.user.bo.UserIdentityBo;
 
 

+ 1 - 1
src/main/java/com/goafanti/user/service/impl/UserCareerServiceImpl.java

@@ -12,7 +12,7 @@ import com.goafanti.common.model.UserCareer;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.demand.bo.DemandListBo;
-import com.goafanti.user.bo.UserCareerBo;
+
 import com.goafanti.user.service.UserCareerService;
 @Service
 public class UserCareerServiceImpl extends BaseMybatisDao<UserCareerMapper> implements UserCareerService{

+ 1 - 1
src/main/java/com/goafanti/user/service/impl/UserInterestServiceImpl.java

@@ -16,7 +16,7 @@ import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.user.bo.InterestUserListBo;
-import com.goafanti.user.bo.UserCareerBo;
+
 import com.goafanti.user.bo.UserIdentityBo;
 import com.goafanti.user.service.UserInterestService;