Ver código fonte

微信注册与登录

jz.kai 1 ano atrás
pai
commit
2e401e42eb

+ 2 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/WishInfoUserRecord.java

@@ -26,9 +26,11 @@ public class WishInfoUserRecord {
 
 	@ApiModelProperty(value = "心愿信息ID")
 	private String wishInfoId;
+	private WishInfo wishInfo;
 
 	@ApiModelProperty(value = "学员心愿ID")
 	private String studentAspirationsId;
+	private StudentAspirations studentAspirations;
 
 	@ApiModelProperty(value = "是否现场互换心愿")
 	private Boolean isSpot;

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

@@ -154,6 +154,12 @@
 			<if test="searchParams.wishInfoId != null">
 				and wish_info_id = #{searchParams.wishInfoId}
 			</if>
+			<if test="searchParams.createBy != null">
+				and create_by = #{searchParams.createBy}
+			</if>
+			<if test="searchParams.status != null">
+				and status_ = #{searchParams.status}
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}

+ 3 - 2
web/src/main/java/com/jpsoft/employment/config/WebMvcConfig.java

@@ -72,6 +72,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/mobile/training/trainingDetail")
 				.excludePathPatterns("/wechat/decryptData")
 				.excludePathPatterns("/mobile/user/saveLoginRecord")
+				//用户
+				.excludePathPatterns("/base/api/regUser/saveRegUser")
+				.excludePathPatterns("/base/api/regUser/getByOpenId")
 				//心愿互换
 				.excludePathPatterns("/base/api/wish/list")
 				.excludePathPatterns("/base/api/wish/edit")
@@ -81,7 +84,5 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/base/api/love/list")
 				.excludePathPatterns("/base/api/love/edit")
 		;
-
-
 	}
 }

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

@@ -41,7 +41,7 @@ public class LoveApi {
     @Autowired
     private DataDictionaryService dataDictionaryService;
 
-    @ApiOperation(value="心愿单列表")
+    @ApiOperation(value="项目列表")
     @RequestMapping(value = "list",method = RequestMethod.POST)
     @ApiImplicitParams({
             @ApiImplicitParam(name="title", value="名称", required=false, paramType="query"),
@@ -68,7 +68,7 @@ public class LoveApi {
         return msgResult;
     }
 
-    @ApiOperation(value="心愿单详情")
+    @ApiOperation(value="项目详情")
     @GetMapping("edit/{id}")
     @ApiImplicitParams({
             @ApiImplicitParam(name="id", value="ID", required=true, paramType="query"),

+ 113 - 25
web/src/main/java/com/jpsoft/employment/modules/base/api/WishApi.java

@@ -42,6 +42,58 @@ public class WishApi {
     @Autowired
     private RegUserService regUserService;
 
+    @ApiOperation(value="我的捐赠列表")
+    @RequestMapping(value = "myWishList",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="status", value="互换状态", required=false, paramType="query"),
+    })
+    public MessageResult myWishList(
+        String status,
+        @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+        @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+        HttpServletRequest request){
+        MessageResult msgResult = new MessageResult<>();
+        String subject = (String)request.getAttribute("subject");
+
+        Map<String,Object> searchParams = new HashMap<>();
+        searchParams.put("createBy",subject);
+        if (StringUtils.isNotEmpty(status)) {
+            searchParams.put("status",status);
+        }
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time","desc"));
+
+        Page<WishInfoUserRecord> page = wishInfoUserRecordService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+        for(WishInfoUserRecord wishInfoUserRecord : page.getResult()){
+            wishInfoUserRecord.setWishInfo(wishInfoService.get(wishInfoUserRecord.getWishInfoId()));
+            wishInfoUserRecord.setStudentAspirations(studentAspirationsService.get(wishInfoUserRecord.getStudentAspirationsId()));
+        }
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="捐赠详情")
+    @RequestMapping(value = "wishInfoUserRecordEdit",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="id", value="ID", required=true, paramType="query"),
+    })
+    public MessageResult wishInfoUserRecordEdit(String id){
+        MessageResult msgResult = new MessageResult<>();
+
+        WishInfoUserRecord wishInfoUserRecord = wishInfoUserRecordService.get(id);
+        wishInfoUserRecord.setWishInfo(wishInfoService.get(wishInfoUserRecord.getWishInfoId()));
+        wishInfoUserRecord.setStudentAspirations(studentAspirationsService.get(wishInfoUserRecord.getStudentAspirationsId()));
+
+        msgResult.setResult(true);
+        msgResult.setData(wishInfoUserRecord);
+
+        return msgResult;
+    }
+
     @ApiOperation(value="心愿单列表")
     @RequestMapping(value = "list",method = RequestMethod.POST)
     @ApiImplicitParams({
@@ -139,26 +191,33 @@ public class WishApi {
     @Transactional(rollbackFor = Exception.class)
     @ApiImplicitParams({
             @ApiImplicitParam(name="wishInfoId", value="心愿信息ID", required=true, paramType="query"),
-            @ApiImplicitParam(name="isSpot", value="是否现场互换心愿", required=true, paramType="query"),
+            @ApiImplicitParam(name="isSpot", value="是否现场互换心愿", required=true, paramType="query", dataType = "Boolean"),
+            @ApiImplicitParam(name="studentAspirationsId", value="学员心愿ID", 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,
+    public MessageResult add(String wishInfoId, String studentAspirationsId, Boolean isSpot,
         String recipients, String recipientsPhone, String recipientsRegion, String recipientsAddress,
         HttpServletRequest request){
-        MessageResult<WishInfoUserRecord> msgResult = new MessageResult<>();
+        MessageResult msgResult = new MessageResult<>();
         String subject = (String)request.getAttribute("subject");
 
         try {
+            AddressInfo addressInfo = addressInfoService.get("00000000-0000-0000-0000-000000000000");
+
             WishInfoUserRecord wishInfoUserRecord = new WishInfoUserRecord();
             wishInfoUserRecord.setId(UUID.randomUUID().toString());
             wishInfoUserRecord.setRegUserId(subject);
             wishInfoUserRecord.setWishInfoId(wishInfoId);
+            wishInfoUserRecord.setStudentAspirationsId(studentAspirationsId);
             wishInfoUserRecord.setIsSpot(isSpot);
             wishInfoUserRecord.setStatus("0");
             wishInfoUserRecord.setNum(getSerialNumber());
+            wishInfoUserRecord.setSender(addressInfo.getRecipients());
+            wishInfoUserRecord.setSenderPhone(addressInfo.getPhone());
+            wishInfoUserRecord.setSenderAddress(addressInfo.getRegion() + addressInfo.getDetailAddress());
             wishInfoUserRecord.setRecipients (recipients);
             wishInfoUserRecord.setRecipientsPhone(recipientsPhone);
             wishInfoUserRecord.setRecipientsAddress(recipientsRegion + recipientsAddress);
@@ -167,30 +226,10 @@ public class WishApi {
             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);
-            }
+            setAddress(recipients, recipientsPhone, recipientsRegion, recipientsAddress, request);
 
             msgResult.setResult(true);
+            msgResult.setData(wishInfoUserRecord.getId());
         }
         catch(Exception ex){
             logger.error(ex.getMessage(),ex);
@@ -248,6 +287,55 @@ public class WishApi {
         return msgResult;
     }
 
+    @ApiOperation(value="保存地址")
+    @RequestMapping(value = "setAddress",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="recipients", value="收件人", required=true, paramType="query"),
+            @ApiImplicitParam(name="recipientsPhone", value="收件人电话", required=true, paramType="query"),
+            @ApiImplicitParam(name="recipientsRegion", value="收件人区域", required=true, paramType="query"),
+            @ApiImplicitParam(name="recipientsAddress", value="收件人地址", required=true, paramType="query"),
+    })
+    public MessageResult setAddress(String recipients, String recipientsPhone, String recipientsRegion, String recipientsAddress, HttpServletRequest request){
+        MessageResult msgResult = new MessageResult<>();
+        String subject = (String)request.getAttribute("subject");
+
+        try {
+            AddressInfo addressInfo = addressInfoService.getByUser(subject);
+            if(addressInfo == null) {
+                addressInfo = new AddressInfo();
+                addressInfo.setId(UUID.randomUUID().toString());
+                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;
+    }
+
     private String getSerialNumber() {
         String serialNumber = "";
 

+ 3 - 3
web/src/main/resources/application.yml

@@ -120,9 +120,9 @@ wx:
   appId: wx014362202dd87dd7
   appSecret: aaf8db83ff69c3716a62e3d5bd21c292
 applet:
-  #三得利小程序
-  appId: wx7eec18cd89b9d777
-  appSecret: 5a0aa258fda3e75097a80764dab73202
+  #小程序
+  appId: wx0526fcf6d276854f
+  appSecret: a55f9fef68b3d1dfdee5b5638b502cd4
 
 #oss:
 #  accessKeyId: LTAILGOo7bwpkvnq