Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

yanliming 1 rok temu
rodzic
commit
0f01d098a5

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

@@ -20,5 +20,5 @@ public interface WishInfoUserRecordDAO {
 	int countByWish(String wishInfoId);
 	int countByWishAndStatus(@Param("wishInfoId")String wishInfoId, @Param("status")String status);
 	String getLastSerialNumber(String date);
-	int countByUser(String regUserId);
+	int countByUser(@Param(value="regUserId") String regUserId);
 }

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

@@ -24,6 +24,9 @@ public class LoveProject {
 	
 				@ApiModelProperty(value = "标题")
 	private String title;
+
+	@ApiModelProperty(value = "副标题")
+	private String secondTitle;
 	
 				@ApiModelProperty(value = "内容")
 	private String content;

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

@@ -6,6 +6,7 @@
 	<resultMap id="LoveProjectMap" type="com.jpsoft.employment.modules.base.entity.LoveProject">
 		<id property="id" column="id_" />
 			<result property="title" column="title_" />
+		<result property="secondTitle" column="second_title" />
 			<result property="content" column="content_" />
 			<result property="image" column="image_" />
 			<result property="contactPhone" column="contact_phone" />
@@ -26,11 +27,12 @@
 	-->
 	<![CDATA[
 		insert into base_love_project
-	    (id_,title_,content_,image_,contact_phone,contacts_,type_,create_by,create_time,update_by,update_time,del_flag,feedback_method)
+	    (id_,title_,second_title,content_,image_,contact_phone,contacts_,type_,create_by,create_time,update_by,update_time,del_flag,feedback_method)
 		values
 		(
 #{id,jdbcType=VARCHAR}
 ,#{title,jdbcType=VARCHAR}
+,#{secondTitle,jdbcType=VARCHAR}
 ,#{content,jdbcType=VARCHAR}
 ,#{image,jdbcType=VARCHAR}
 ,#{contactPhone,jdbcType=VARCHAR}
@@ -54,6 +56,9 @@
 				<if test="title!=null">
 		title_=#{title,jdbcType=VARCHAR},
 		</if>
+			<if test="secondTitle!=null">
+				second_title=#{secondTitle,jdbcType=VARCHAR},
+			</if>
 				<if test="content!=null">
 		content_=#{content,jdbcType=VARCHAR},
 		</if>

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

@@ -2,6 +2,7 @@ package com.jpsoft.employment.modules.base.api;
 
 import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.Page;
+import com.jpsoft.employment.config.OSSConfig;
 import com.jpsoft.employment.exception.CustomException;
 import com.jpsoft.employment.modules.base.entity.RegUser;
 import com.jpsoft.employment.modules.base.service.RegUserService;
@@ -9,6 +10,7 @@ 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.OSSUtil;
 import com.jpsoft.employment.modules.common.utils.PojoUtils;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -20,6 +22,7 @@ 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 org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.*;
@@ -32,6 +35,9 @@ public class RegUserApi {
     @Value("${jwt.secret}")
     private String jwtSecret;
 
+    @Autowired
+    private OSSConfig ossConfig;
+
     @Autowired
     private RegUserService regUserService;
 
@@ -139,4 +145,78 @@ public class RegUserApi {
 
         return msgResult;
     }
+
+    @PostMapping("updateDetails")
+    @ApiOperation(value = "更新个人信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="nickName", value="昵称", required=false, paramType="query"),
+            @ApiImplicitParam(name="headImg", value="头像", required=false, paramType="query"),
+            @ApiImplicitParam(name="openId", value="openId", required=true, paramType="query"),
+    })
+    public MessageResult updateDetails(String nickName, String headImg, String openId) {
+        MessageResult messageResult = new MessageResult<>();
+
+        try {
+            if (StrUtil.isBlank(openId)) {
+                throw new Exception("微信标识不存在");
+            }
+
+            if (StringUtils.isNotEmpty(openId)) {
+                RegUser regUser = regUserService.getByOpenId(openId);
+
+                if (regUser != null) {
+                    regUser.setNickName(nickName);
+                    regUser.setHeadImg(headImg);
+                    regUser.setUpdateBy(regUser.getId());
+                    regUser.setUpdateTime(new Date());
+                    regUserService.update(regUser);
+
+                    messageResult.setResult(true);
+                    messageResult.setCode(200);
+                    messageResult.setData(regUser);
+                }
+                else {
+                    throw new CustomException("openid不存在");
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            logger.error(ex.getMessage());
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+//    @PostMapping("uploadPicture")
+//    @ApiOperation(value="上传图片")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name="subFolder",value = "路径",required = true,paramType = "form"),
+//            @ApiImplicitParam(name = "photoFile",value = "员工照片", required = true,paramType="form", dataType = "__file")
+//    })
+//    public MessageResult<Map> uploadPicture(String subFolder, MultipartFile photoFile){
+//        MessageResult<Map> messageResult = new MessageResult<>();
+//
+//        try {
+//            String fileName = photoFile.getOriginalFilename();
+//            String rawFileUrl = OSSUtil.upload(ossConfig,"/" + subFolder,fileName,photoFile.getInputStream());
+//
+//            Map<String,Object> dataMap = new HashMap<>();
+//            dataMap.put("fileName", fileName);
+//            dataMap.put("fileUrl", rawFileUrl);
+//
+//            messageResult.setResult(true);
+//            messageResult.setData(dataMap);
+//            messageResult.setCode(200);
+//        } catch (Exception e) {
+//            logger.error(e.getMessage(),e);
+//
+//            messageResult.setResult(false);
+//            messageResult.setMessage(e.getMessage());
+//        }
+//
+//        return messageResult;
+//    }
 }

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

@@ -120,10 +120,10 @@ wx:
   appSecret: aaf8db83ff69c3716a62e3d5bd21c292
 applet:
   #小程序
-#  appId: wx0526fcf6d276854f
-#  appSecret: a55f9fef68b3d1dfdee5b5638b502cd4
-  appId: wx7eec18cd89b9d777
-  appSecret: 5a0aa258fda3e75097a80764dab73202
+  appId: wx0526fcf6d276854f
+  appSecret: a55f9fef68b3d1dfdee5b5638b502cd4
+#  appId: wx7eec18cd89b9d777
+#  appSecret: 5a0aa258fda3e75097a80764dab73202
 
 #oss:
 #  accessKeyId: LTAILGOo7bwpkvnq