فهرست منبع

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	common/src/main/java/com/jpsoft/employment/modules/base/entity/WishInfo.java
#	common/src/main/java/com/jpsoft/employment/modules/base/entity/WishInfoUserRecord.java
#	common/src/main/resources/mapper/base/LoveProject.xml
yanliming 1 سال پیش
والد
کامیت
9567628b7d
25فایلهای تغییر یافته به همراه660 افزوده شده و 47 حذف شده
  1. 1 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/AddressInfoDAO.java
  2. 2 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/RegUserDAO.java
  3. 1 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/StudentAspirationsDAO.java
  4. 2 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/WishInfoUserRecordDAO.java
  5. 3 0
      common/src/main/java/com/jpsoft/employment/modules/base/entity/StudentAspirations.java
  6. 6 1
      common/src/main/java/com/jpsoft/employment/modules/base/entity/WishInfo.java
  7. 47 40
      common/src/main/java/com/jpsoft/employment/modules/base/entity/WishInfoUserRecord.java
  8. 1 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/AddressInfoService.java
  9. 2 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/RegUserService.java
  10. 1 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/StudentAspirationsService.java
  11. 2 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/WishInfoUserRecordService.java
  12. 6 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/AddressInfoServiceImpl.java
  13. 10 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/RegUserServiceImpl.java
  14. 6 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/StudentAspirationsServiceImpl.java
  15. 10 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/WishInfoUserRecordServiceImpl.java
  16. 3 0
      common/src/main/resources/mapper/base/AddressInfo.xml
  17. 1 1
      common/src/main/resources/mapper/base/LoveProject.xml
  18. 6 0
      common/src/main/resources/mapper/base/RegUser.xml
  19. 11 1
      common/src/main/resources/mapper/base/StudentAspirations.xml
  20. 3 0
      common/src/main/resources/mapper/base/WishInfo.xml
  21. 20 3
      common/src/main/resources/mapper/base/WishInfoUserRecord.xml
  22. 8 1
      web/src/main/java/com/jpsoft/employment/config/WebMvcConfig.java
  23. 99 0
      web/src/main/java/com/jpsoft/employment/modules/base/api/LoveApi.java
  24. 142 0
      web/src/main/java/com/jpsoft/employment/modules/base/api/RegUserApi.java
  25. 267 0
      web/src/main/java/com/jpsoft/employment/modules/base/api/WishApi.java

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/AddressInfoDAO.java

@@ -15,4 +15,5 @@ public interface AddressInfoDAO {
 	int delete(String id);
 	List<AddressInfo> list();
 	List<AddressInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+	AddressInfo getByUser(String userId);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/RegUserDAO.java

@@ -15,4 +15,6 @@ public interface RegUserDAO {
 	int delete(String id);
 	List<RegUser> list();
 	List<RegUser> search(Map<String, Object> searchParams, List<Sort> sortList);
+	RegUser getByPhone(String phone);
+	RegUser getByOpenId(String openId);
 }

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/StudentAspirationsDAO.java

@@ -15,4 +15,5 @@ public interface StudentAspirationsDAO {
 	int delete(String id);
 	List<StudentAspirations> list();
 	List<StudentAspirations> search(Map<String, Object> searchParams, List<Sort> sortList);
+	List<StudentAspirations> findByWish(String wishInfoId);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/WishInfoUserRecordDAO.java

@@ -15,4 +15,6 @@ public interface WishInfoUserRecordDAO {
 	int delete(String id);
 	List<WishInfoUserRecord> list();
 	List<WishInfoUserRecord> search(Map<String, Object> searchParams, List<Sort> sortList);
+	int countByWish(String wishInfoId);
+	String getLastSerialNumber(String date);
 }

+ 3 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/StudentAspirations.java

@@ -24,6 +24,9 @@ public class StudentAspirations {
 	
 				@ApiModelProperty(value = "心愿名称")
 	private String name;
+
+	@ApiModelProperty(value = "学员姓名")
+	private String studentName;
 	
 				@ApiModelProperty(value = "创建人")
 	private String createBy;

+ 6 - 1
common/src/main/java/com/jpsoft/employment/modules/base/entity/WishInfo.java

@@ -7,6 +7,8 @@ import java.math.BigDecimal;
 import java.util.List;
 
 import org.springframework.data.annotation.Transient;
+import java.util.List;
+
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -64,8 +66,11 @@ public class WishInfo {
 			@ApiModelProperty(value = "是否删除")
 	private Boolean delFlag;
 
-	@ApiModelProperty(value = "数量")
+	@ApiModelProperty(value = "已换数量")
 	private Integer recordAmount;
+	@ApiModelProperty(value = "心愿列表")
+	private List<StudentAspirations> aspirationList;
+}
 
 
 	@Transient

+ 47 - 40
common/src/main/java/com/jpsoft/employment/modules/base/entity/WishInfoUserRecord.java

@@ -4,8 +4,6 @@ import java.io.Serializable;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
-
-import org.springframework.data.annotation.Transient;
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -18,71 +16,80 @@ import lombok.Data;
 @Data
 @ApiModel(value = "base_wish_info_user_record的实体类")
 public class WishInfoUserRecord {
-		@ApiModelProperty(value = "ID")
+	@ApiModelProperty(value = "ID")
 	private String id;
-	
-				@ApiModelProperty(value = "人员ID")
+
+	@ApiModelProperty(value = "人员ID")
 	private String regUserId;
-	
-				@ApiModelProperty(value = "心愿信息ID")
+
+	@ApiModelProperty(value = "心愿信息ID")
 	private String wishInfoId;
-	
-				@ApiModelProperty(value = "是否现场互换心愿")
+
+	@ApiModelProperty(value = "学员心愿ID")
+	private String studentAspirationsId;
+
+	@ApiModelProperty(value = "是否现场互换心愿")
 	private Boolean isSpot;
-	
-				@ApiModelProperty(value = "互换状态(0:互换中,1:已完成)")
+
+	@ApiModelProperty(value = "互换状态(0:互换中,1:已完成)")
 	private String status;
-	
-				@ApiModelProperty(value = "流水号")
+
+	@ApiModelProperty(value = "流水号")
 	private String num;
-	
-				@ApiModelProperty(value = "是否删除")
+
+	@ApiModelProperty(value = "是否删除")
 	private Boolean delFlag;
-	
-				@ApiModelProperty(value = "创建人")
+
+	@ApiModelProperty(value = "创建人")
 	private String createBy;
-	
-					@ApiModelProperty(value = "创建时间")
+
+	@ApiModelProperty(value = "创建时间")
 	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
 	private Date createTime;
-	
-			@ApiModelProperty(value = "更新人")
+
+	@ApiModelProperty(value = "更新人")
 	private String updateBy;
-	
-					@ApiModelProperty(value = "更新时间")
+
+	@ApiModelProperty(value = "更新时间")
 	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
 	private Date updateTime;
-	
-			@ApiModelProperty(value = "寄件人")
+
+	@ApiModelProperty(value = "寄件人")
 	private String sender;
-	
-				@ApiModelProperty(value = "寄件人地址")
+
+	@ApiModelProperty(value = "寄件人地址")
 	private String senderAddress;
-	
-				@ApiModelProperty(value = "寄件人电话")
+
+	@ApiModelProperty(value = "寄件人电话")
 	private String senderPhone;
-	
-				@ApiModelProperty(value = "收件人")
+
+	@ApiModelProperty(value = "收件人")
 	private String recipients;
-	
-				@ApiModelProperty(value = "收件人地址")
+
+	@ApiModelProperty(value = "收件人地址")
 	private String recipientsAddress;
-	
-				@ApiModelProperty(value = "收件人电话")
+
+	@ApiModelProperty(value = "收件人电话")
 	private String recipientsPhone;
-	
-					@ApiModelProperty(value = "完成时间")
+
+	@ApiModelProperty(value = "完成时间")
 	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
 	private Date completionTime;
-	
-				@ApiModelProperty(value = "发货时间")
+
+	@ApiModelProperty(value = "发货时间")
 	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
 	private Date deliveryTime;
 
+
+	@ApiModelProperty(value = "用户头像")
+	private String regUserHeadImg;
+	@ApiModelProperty(value = "交换礼物")
+	private String aspirationsName;
+
 	@Transient
 	@ApiModelProperty(value = "人员ID")
 	private String regUserName;
@@ -100,5 +107,5 @@ public class WishInfoUserRecord {
 	@Transient
 	@ApiModelProperty(value = "学生类型")
 	private String studentType;
-	
+
 	}

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/AddressInfoService.java

@@ -14,4 +14,5 @@ public interface AddressInfoService {
 	int delete(String id);
 	List<AddressInfo> list();
 	Page<AddressInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+	AddressInfo getByUser(String userId);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/RegUserService.java

@@ -14,4 +14,6 @@ public interface RegUserService {
 	int delete(String id);
 	List<RegUser> list();
 	Page<RegUser> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+	RegUser getByPhone(String phone);
+	RegUser getByOpenId(String openId);
 }

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/StudentAspirationsService.java

@@ -14,4 +14,5 @@ public interface StudentAspirationsService {
 	int delete(String id);
 	List<StudentAspirations> list();
 	Page<StudentAspirations> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+	List<StudentAspirations> findByWish(String wishInfoId);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/WishInfoUserRecordService.java

@@ -14,4 +14,6 @@ public interface WishInfoUserRecordService {
 	int delete(String id);
 	List<WishInfoUserRecord> list();
 	Page<WishInfoUserRecord> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+	int countByWish(String wishInfoId);
+	String getLastSerialNumber(String date);
 }

+ 6 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/AddressInfoServiceImpl.java

@@ -67,4 +67,10 @@ public class AddressInfoServiceImpl implements AddressInfoService {
         
         return page;
 	}
+
+	@Override
+	public AddressInfo getByUser(String userId) {
+		// TODO Auto-generated method stub
+		return addressInfoDAO.getByUser(userId);
+	}
 }

+ 10 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/RegUserServiceImpl.java

@@ -67,4 +67,14 @@ public class RegUserServiceImpl implements RegUserService {
         
         return page;
 	}
+
+	@Override
+	public RegUser getByPhone(String phone) {
+		return regUserDAO.getByPhone(phone);
+	}
+
+	@Override
+	public RegUser getByOpenId(String openId) {
+		return regUserDAO.getByOpenId(openId);
+	}
 }

+ 6 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/StudentAspirationsServiceImpl.java

@@ -67,4 +67,10 @@ public class StudentAspirationsServiceImpl implements StudentAspirationsService
         
         return page;
 	}
+
+	@Override
+	public List<StudentAspirations> findByWish(String wishInfoId) {
+		// TODO Auto-generated method stub
+		return studentAspirationsDAO.findByWish(wishInfoId);
+	}
 }

+ 10 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/WishInfoUserRecordServiceImpl.java

@@ -67,4 +67,14 @@ public class WishInfoUserRecordServiceImpl implements WishInfoUserRecordService
         
         return page;
 	}
+
+	@Override
+	public int countByWish(String wishInfoId) {
+		return wishInfoUserRecordDAO.countByWish(wishInfoId);
+	}
+
+	@Override
+	public String getLastSerialNumber(String date) {
+		return wishInfoUserRecordDAO.getLastSerialNumber(date);
+	}
 }

+ 3 - 0
common/src/main/resources/mapper/base/AddressInfo.xml

@@ -83,6 +83,9 @@
 	<select id="get" parameterType="string" resultMap="AddressInfoMap">
 		select * from base_address_info where id_=#{0}
 	</select>
+	<select id="getByUser" parameterType="string" resultMap="AddressInfoMap">
+		select * from base_address_info where reg_user_id=#{0} limit 1
+	</select>
 	<select id="exist" parameterType="string" resultType="int">
 		select count(*) from base_address_info where id_=#{0}
 	</select>

+ 1 - 1
common/src/main/resources/mapper/base/LoveProject.xml

@@ -104,7 +104,7 @@
 			select * from base_love_project
 		]]>
 		<where>
-			del_flag=false
+			del_flag = 0
 			<if test="searchParams.title != null">
 				and title_ like #{searchParams.title}
 			</if>

+ 6 - 0
common/src/main/resources/mapper/base/RegUser.xml

@@ -89,6 +89,12 @@
 	<select id="list" resultMap="RegUserMap">
 		select * from base_reg_user
 	</select>
+	<select id="getByPhone" parameterType="string" resultMap="RegUserMap">
+		select * from base_reg_user where del_flag = 0 and phone_ = #{0} limit 1
+	</select>
+	<select id="getByOpenId" parameterType="string" resultMap="RegUserMap">
+		select * from base_reg_user where del_flag = 0 and open_id = #{0} limit 1
+	</select>
 	<select id="search" parameterType="hashmap" resultMap="RegUserMap">
 		<![CDATA[
 			select * from base_reg_user

+ 11 - 1
common/src/main/resources/mapper/base/StudentAspirations.xml

@@ -7,6 +7,7 @@
 		<id property="id" column="id_" />
 			<result property="wishInfoId" column="wish_info_id" />
 			<result property="name" column="name_" />
+		<result property="studentName" column="student_name" />
 			<result property="createBy" column="create_by" />
 			<result property="createTime" column="create_time" />
 			<result property="updateBy" column="update_by" />
@@ -21,12 +22,13 @@
 	-->
 	<![CDATA[
 		insert into base_student_aspirations
-	    (id_,wish_info_id,name_,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,wish_info_id,name_,student_name,create_by,create_time,update_by,update_time,del_flag)
 		values
 		(
 #{id,jdbcType=VARCHAR}
 ,#{wishInfoId,jdbcType=VARCHAR}
 ,#{name,jdbcType=VARCHAR}
+,#{studentName,jdbcType=VARCHAR}
 ,#{createBy,jdbcType=VARCHAR}
 ,#{createTime,jdbcType= TIMESTAMP }
 ,#{updateBy,jdbcType=VARCHAR}
@@ -47,6 +49,9 @@
 				<if test="name!=null">
 		name_=#{name,jdbcType=VARCHAR},
 		</if>
+			<if test="studentName!=null">
+				student_name=#{studentName,jdbcType=VARCHAR},
+			</if>
 				<if test="createBy!=null">
 		create_by=#{createBy,jdbcType=VARCHAR},
 		</if>
@@ -74,6 +79,11 @@
 	<select id="list" resultMap="StudentAspirationsMap">
 		select * from base_student_aspirations
 	</select>
+	<select id="findByWish" parameterType="string" resultMap="StudentAspirationsMap">
+		SELECT * FROM base_student_aspirations
+		WHERE del_flag = 0
+		AND wish_info_id = #{0}
+	</select>
 	<select id="search" parameterType="hashmap" resultMap="StudentAspirationsMap">
 		<![CDATA[
 			select * from base_student_aspirations

+ 3 - 0
common/src/main/resources/mapper/base/WishInfo.xml

@@ -113,6 +113,9 @@
 			<if test="searchParams.title != null">
 				and title_ like #{searchParams.title}
 			</if>
+			<if test="searchParams.category != null">
+				and category_ = #{searchParams.category}
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}

+ 20 - 3
common/src/main/resources/mapper/base/WishInfoUserRecord.xml

@@ -7,6 +7,7 @@
 		<id property="id" column="id_" />
 			<result property="regUserId" column="reg_user_id" />
 			<result property="wishInfoId" column="wish_info_id" />
+		<result property="studentAspirationsId" column="student_aspirations_id" />
 			<result property="isSpot" column="is_spot" />
 			<result property="status" column="status_" />
 			<result property="num" column="num_" />
@@ -32,12 +33,13 @@
 	-->
 	<![CDATA[
 		insert into base_wish_info_user_record
-	    (id_,reg_user_id,wish_info_id,is_spot,status_,num_,del_flag,create_by,create_time,update_by,update_time,sender_,sender_address,sender_phone,recipients_,recipients_address,recipients_phone,completion_time,delivery_time)
+	    (id_,reg_user_id,wish_info_id,student_aspirations_id,is_spot,status_,num_,del_flag,create_by,create_time,update_by,update_time,sender_,sender_address,sender_phone,recipients_,recipients_address,recipients_phone,completion_time,delivery_time)
 		values
 		(
 #{id,jdbcType=VARCHAR}
 ,#{regUserId,jdbcType=VARCHAR}
 ,#{wishInfoId,jdbcType=VARCHAR}
+,#{studentAspirationsId,jdbcType=VARCHAR}
 ,#{isSpot,jdbcType= NUMERIC }
 ,#{status,jdbcType=VARCHAR}
 ,#{num,jdbcType=VARCHAR}
@@ -69,6 +71,9 @@
 				<if test="wishInfoId!=null">
 		wish_info_id=#{wishInfoId,jdbcType=VARCHAR},
 		</if>
+			<if test="studentAspirationsId!=null">
+				student_aspirations_id=#{studentAspirationsId,jdbcType=VARCHAR},
+			</if>
 				<if test="isSpot!=null">
 		is_spot=#{isSpot,jdbcType= NUMERIC },
 		</if>
@@ -126,6 +131,17 @@
 	<select id="exist" parameterType="string" resultType="int">
 		select count(*) from base_wish_info_user_record where id_=#{0}
 	</select>
+	<select id="getLastSerialNumber" parameterType="string" resultType="string">
+		SELECT num_ FROM base_wish_info_user_record
+		WHERE num_ LIKE #{0}
+		ORDER BY num_ DESC
+		LIMIT 1
+	</select>
+	<select id="countByWish" parameterType="string" resultType="int">
+		SELECT COUNT(*) FROM base_wish_info_user_record
+		WHERE del_flag = 0
+		AND wish_info_id = #{0}
+	</select>
 	<select id="list" resultMap="WishInfoUserRecordMap">
 		select * from base_wish_info_user_record
 	</select>
@@ -134,8 +150,9 @@
 			select * from base_wish_info_user_record
 		]]>
 		<where>
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+			del_flag = 0
+			<if test="searchParams.wishInfoId != null">
+				and wish_info_id = #{searchParams.wishInfoId}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 8 - 1
web/src/main/java/com/jpsoft/employment/config/WebMvcConfig.java

@@ -72,7 +72,14 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/mobile/training/trainingDetail")
 				.excludePathPatterns("/wechat/decryptData")
 				.excludePathPatterns("/mobile/user/saveLoginRecord")
-
+				//心愿互换
+				.excludePathPatterns("/base/api/wish/list")
+				.excludePathPatterns("/base/api/wish/edit")
+				.excludePathPatterns("/base/api/wish/wishTypeList")
+				.excludePathPatterns("/base/api/wish/recentlyList")
+				//项目互动
+				.excludePathPatterns("/base/api/love/list")
+				.excludePathPatterns("/base/api/love/edit")
 		;
 
 

+ 99 - 0
web/src/main/java/com/jpsoft/employment/modules/base/api/LoveApi.java

@@ -0,0 +1,99 @@
+package com.jpsoft.employment.modules.base.api;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.base.entity.LoveProject;
+import com.jpsoft.employment.modules.base.entity.WishInfo;
+import com.jpsoft.employment.modules.base.entity.WishInfoUserRecord;
+import com.jpsoft.employment.modules.base.service.LoveProjectService;
+import com.jpsoft.employment.modules.base.service.StudentAspirationsService;
+import com.jpsoft.employment.modules.base.service.WishInfoService;
+import com.jpsoft.employment.modules.base.service.WishInfoUserRecordService;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import com.jpsoft.employment.modules.sys.entity.DataDictionary;
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/api/love")
+@Api(description = "爱心项目")
+public class LoveApi {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private LoveProjectService loveProjectService;
+    @Autowired
+    private WishInfoUserRecordService wishInfoUserRecordService;
+    @Autowired
+    private StudentAspirationsService studentAspirationsService;
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
+    @ApiOperation(value="心愿单列表")
+    @RequestMapping(value = "list",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="title", value="名称", required=false, paramType="query"),
+    })
+    public MessageResult list(
+            String title,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize){
+        MessageResult msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+        if (StringUtils.isNotEmpty(title)) {
+            searchParams.put("title","%" + title + "%");
+        }
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time","desc"));
+
+        Page<LoveProject> page = loveProjectService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="心愿单详情")
+    @GetMapping("edit/{id}")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="id", value="ID", required=true, paramType="query"),
+    })
+    public MessageResult<LoveProject> edit(@PathVariable("id") String id){
+        MessageResult<LoveProject> msgResult = new MessageResult<>();
+
+        try {
+            LoveProject loveProject = loveProjectService.get(id);
+
+            if (loveProject != null) {
+                msgResult.setResult(true);
+                msgResult.setData(loveProject);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}

+ 142 - 0
web/src/main/java/com/jpsoft/employment/modules/base/api/RegUserApi.java

@@ -0,0 +1,142 @@
+package com.jpsoft.employment.modules.base.api;
+
+import cn.hutool.core.util.StrUtil;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.exception.CustomException;
+import com.jpsoft.employment.modules.base.entity.RegUser;
+import com.jpsoft.employment.modules.base.service.RegUserService;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.utils.DES3;
+import com.jpsoft.employment.modules.common.utils.JwtUtil;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/api/regUser")
+public class RegUserApi {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Value("${jwt.secret}")
+    private String jwtSecret;
+
+    @Autowired
+    private RegUserService regUserService;
+
+    @PostMapping("saveRegUser")
+    @ApiOperation(value = "一键注册(公开接口)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="nickName", value="昵称", required=false, paramType="query"),
+            @ApiImplicitParam(name="realName", value="真实姓名", required=false, paramType="query"),
+            @ApiImplicitParam(name="phone", value="电话号码", required=true, paramType="query"),
+            @ApiImplicitParam(name="openId", value="openId", required=true, paramType="query"),
+            @ApiImplicitParam(name="headImg", value="头像", required=false, paramType="query"),
+    })
+    public MessageResult<Map> saveRegUser(String nickName, String realName, String phone, String openId, String headImg) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+            if (StrUtil.isBlank(openId)) {
+                throw new Exception("微信标识不存在");
+            }
+
+            if (StrUtil.isBlank(phone)) {
+                throw new Exception("手机号不能为空");
+            }
+
+            RegUser regUser = null;
+            String token = null;
+            if (StringUtils.isNotEmpty(openId)) {
+                regUser = regUserService.getByPhone(phone);
+
+                if (regUser != null) {
+                    regUser.setOpenId(openId);
+                    regUser.setUpdateBy(regUser.getId());
+                    regUser.setUpdateTime(new Date());
+                    regUserService.update(regUser);
+
+                    token = JwtUtil.createToken(jwtSecret, regUser.getId(), DateTime.now().plusHours(6).toDate());
+                } else {
+                    regUser = new RegUser();
+                    regUser.setId(UUID.randomUUID().toString());
+                    regUser.setNickName(nickName);
+                    regUser.setRealName(realName);
+                    regUser.setPhone(phone);
+                    regUser.setOpenId(openId);
+                    regUser.setHeadImg(headImg);
+                    regUser.setDelFlag(false);
+                    regUser.setCreateBy(regUser.getId());
+                    regUser.setCreateTime(new Date());
+                    regUserService.insert(regUser);
+
+                    token = JwtUtil.createToken(jwtSecret, regUser.getId(), DateTime.now().plusHours(6).toDate());
+                }
+            }
+
+            Map<String, Object> map = new HashMap<>();
+            map.put("token", token);
+            map.put("regUser", regUser);
+
+            messageResult.setData(map);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            logger.error(ex.getMessage());
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @GetMapping("getByOpenId")
+    @ApiOperation(value = "登录(公开接口)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="openId", value="openId", required=true, paramType="query"),
+    })
+    public MessageResult<Map> getByOpenId(String openId) {
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        try {
+            RegUser regUser= regUserService.getByOpenId(openId);
+
+            if (regUser != null) {
+                String token = JwtUtil.createToken(jwtSecret, regUser.getId(), DateTime.now().plusDays(7).toDate());
+
+                Map<String, Object> dataMap = new HashMap<String, Object>();
+                dataMap.put("regUser", regUser);
+                dataMap.put("token", token);
+
+                msgResult.setData(dataMap);
+                msgResult.setResult(true);
+            } else {
+                throw new CustomException("openid不存在");
+            }
+        } catch (Exception ex) {
+            if (ex instanceof CustomException) {
+                logger.error(ex.getMessage());
+            } else {
+                logger.error(ex.getMessage(), ex);
+            }
+
+            msgResult.setMessage(ex.getMessage());
+            msgResult.setResult(false);
+        }
+
+        return msgResult;
+    }
+}

+ 267 - 0
web/src/main/java/com/jpsoft/employment/modules/base/api/WishApi.java

@@ -0,0 +1,267 @@
+package com.jpsoft.employment.modules.base.api;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.base.entity.*;
+import com.jpsoft.employment.modules.base.service.*;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import com.jpsoft.employment.modules.sys.entity.DataDictionary;
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/api/wish")
+@Api(description = "心愿互换")
+public class WishApi {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private AddressInfoService addressInfoService;
+    @Autowired
+    private WishInfoService wishInfoService;
+    @Autowired
+    private WishInfoUserRecordService wishInfoUserRecordService;
+    @Autowired
+    private StudentAspirationsService studentAspirationsService;
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+    @Autowired
+    private RegUserService regUserService;
+
+    @ApiOperation(value="心愿单列表")
+    @RequestMapping(value = "list",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="title", value="名称", required=false, paramType="query"),
+            @ApiImplicitParam(name="category", value="类别", required=false, paramType="query"),
+    })
+    public MessageResult list(
+            String title, String category,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize){
+        MessageResult msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+        if (StringUtils.isNotEmpty(title)) {
+            searchParams.put("title","%" + title + "%");
+        }
+        if (StringUtils.isNotEmpty(category)) {
+            searchParams.put("category",category);
+        }
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time","desc"));
+
+        Page<WishInfo> page = wishInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="最近互换心愿列表")
+    @RequestMapping(value = "recentlyList",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="wishInfoId", value="心愿信息ID", required=true, paramType="query"),
+    })
+    public MessageResult recentlyList(String wishInfoId){
+        MessageResult msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+        if (StringUtils.isNotEmpty(wishInfoId)) {
+            searchParams.put("wishInfoId",wishInfoId);
+        }
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time","desc"));
+
+        Page<WishInfoUserRecord> page = wishInfoUserRecordService.pageSearch(searchParams,1,5,false,sortList);
+        for(WishInfoUserRecord wishInfoUserRecord : page.getResult()){
+            RegUser regUser = regUserService.get(wishInfoUserRecord.getRegUserId());
+            wishInfoUserRecord.setRegUserHeadImg(regUser.getHeadImg());
+            StudentAspirations studentAspirations = studentAspirationsService.get(wishInfoUserRecord.getStudentAspirationsId());
+            wishInfoUserRecord.setAspirationsName(studentAspirations.getName());
+        }
+
+        msgResult.setResult(true);
+        msgResult.setData(page.getResult());
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="心愿单详情")
+    @RequestMapping(value = "edit",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="id", value="ID", required=true, paramType="query"),
+    })
+    public MessageResult<WishInfo> edit(String id){
+        MessageResult<WishInfo> msgResult = new MessageResult<>();
+
+        try {
+            WishInfo wishInfo = wishInfoService.get(id);
+            wishInfo.setRecordAmount(wishInfoUserRecordService.countByWish(id));
+            wishInfo.setAspirationList(studentAspirationsService.findByWish(id));
+
+            if (wishInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(wishInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="提交心愿单")
+    @RequestMapping(value = "add",method = RequestMethod.POST)
+    @Transactional(rollbackFor = Exception.class)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="wishInfoId", value="心愿信息ID", required=true, paramType="query"),
+            @ApiImplicitParam(name="isSpot", value="是否现场互换心愿", required=true, paramType="query"),
+            @ApiImplicitParam(name="recipients", value="收件人", required=false, paramType="query"),
+            @ApiImplicitParam(name="recipientsPhone", value="收件人电话", required=false, paramType="query"),
+            @ApiImplicitParam(name="recipientsRegion", value="收件人区域", required=false, paramType="query"),
+            @ApiImplicitParam(name="recipientsAddress", value="收件人地址", required=false, paramType="query"),
+    })
+    public MessageResult<WishInfoUserRecord> add(String wishInfoId, Boolean isSpot,
+        String recipients, String recipientsPhone, String recipientsRegion, String recipientsAddress,
+        HttpServletRequest request){
+        MessageResult<WishInfoUserRecord> msgResult = new MessageResult<>();
+        String subject = (String)request.getAttribute("subject");
+
+        try {
+            WishInfoUserRecord wishInfoUserRecord = new WishInfoUserRecord();
+            wishInfoUserRecord.setId(UUID.randomUUID().toString());
+            wishInfoUserRecord.setRegUserId(subject);
+            wishInfoUserRecord.setWishInfoId(wishInfoId);
+            wishInfoUserRecord.setIsSpot(isSpot);
+            wishInfoUserRecord.setStatus("0");
+            wishInfoUserRecord.setNum(getSerialNumber());
+            wishInfoUserRecord.setRecipients (recipients);
+            wishInfoUserRecord.setRecipientsPhone(recipientsPhone);
+            wishInfoUserRecord.setRecipientsAddress(recipientsRegion + recipientsAddress);
+            wishInfoUserRecord.setDelFlag(false);
+            wishInfoUserRecord.setCreateBy(subject);
+            wishInfoUserRecord.setCreateTime(new Date());
+            wishInfoUserRecordService.insert(wishInfoUserRecord);
+
+            AddressInfo addressInfo = addressInfoService.getByUser(subject);
+            if(addressInfo == null) {
+                addressInfo = new AddressInfo();
+                addressInfo.setRecipients(recipients);
+                addressInfo.setPhone(recipientsPhone);
+                addressInfo.setRegion(recipientsRegion);
+                addressInfo.setDetailAddress(recipientsAddress);
+                addressInfo.setRegUserId(subject);
+                addressInfo.setDelFlag(false);
+                addressInfo.setCreateBy(subject);
+                addressInfo.setCreateTime(new Date());
+                addressInfoService.insert(addressInfo);
+            }
+            else {
+                addressInfo.setRecipients(recipients);
+                addressInfo.setPhone(recipientsPhone);
+                addressInfo.setRegion(recipientsRegion);
+                addressInfo.setDetailAddress(recipientsAddress);
+                addressInfo.setUpdateBy(subject);
+                addressInfo.setUpdateTime(new Date());
+                addressInfoService.update(addressInfo);
+            }
+
+            msgResult.setResult(true);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="心愿类型列表")
+    @RequestMapping(value = "wishTypeList",method = RequestMethod.POST)
+    public MessageResult<List> wishTypeList(){
+        MessageResult<List> messageResult = new MessageResult<>();
+
+        try {
+            List<DataDictionary> list = dataDictionaryService.findByCatalogName("心愿类型");
+            messageResult.setData(list);
+
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @ApiOperation(value="地址详情")
+    @RequestMapping(value = "getAddress",method = RequestMethod.POST)
+    public MessageResult<AddressInfo> getAddress(HttpServletRequest request){
+        MessageResult<AddressInfo> msgResult = new MessageResult<>();
+        String subject = (String)request.getAttribute("subject");
+
+        try {
+            AddressInfo addressInfo = addressInfoService.getByUser(subject);
+
+            if (addressInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(addressInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    private String getSerialNumber() {
+        String serialNumber = "";
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        serialNumber = sdf.format(new Date());
+
+        String lastSerialNumber = wishInfoUserRecordService.getLastSerialNumber(serialNumber + "%");
+        if(lastSerialNumber == null){
+            serialNumber = serialNumber + "0001";
+        }
+        else{
+            serialNumber = serialNumber + String.format("%04d",Integer.valueOf(lastSerialNumber.substring(8)) + 1);
+        }
+
+        return serialNumber;
+    }
+}