zouxuan 5 lat temu
rodzic
commit
8dca718153

+ 5 - 4
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/MenuController.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
@@ -23,7 +24,7 @@ public class MenuController extends BaseController {
     private SysMenuService sysMenuService;
 
     @ApiOperation("新增菜单")
-    @PutMapping("/add")
+    @PutMapping(value = "/add",consumes = MediaType.APPLICATION_JSON_VALUE)
     public Object getMenu(@RequestBody SysMenu sysMenu) {
         SysMenu menuByPermission = sysMenuService.findMenuByPermission(sysMenu.getPermission());
         if(menuByPermission != null){
@@ -40,7 +41,7 @@ public class MenuController extends BaseController {
     }
 
     @ApiOperation("根据菜单id修改菜单")
-    @PutMapping("/update")
+    @PutMapping(value = "/update",consumes = MediaType.APPLICATION_JSON_VALUE)
     public Object updateMenu(@RequestBody SysMenu sysMenu) {
         SysMenu menuByPermission = sysMenuService.findMenuByPermission(sysMenu.getPermission());
         if(menuByPermission != null && !menuByPermission.getId().equals(sysMenu.getId())){
@@ -52,13 +53,13 @@ public class MenuController extends BaseController {
     }
 
     @ApiOperation("根据菜单id查询菜单")
-    @GetMapping("/{id}")
+    @GetMapping(value = "/{id}",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object getMenu(@ApiParam(value = "菜单编号", required = true) @PathVariable("id") Integer id) {
         return succeed(sysMenuService.get(id));
     }
 
     @ApiOperation("查询用户可访问菜单树状结构")
-    @GetMapping("/findByUser")
+    @GetMapping(value = "/findByUser",consumes = MediaType.APPLICATION_JSON_VALUE)
     public Object findByUser(@RequestBody(required = false) MenuQueryInfo menuQueryInfo) {
         AuthUser user = SecurityUtils.getUser();
         if(user != null){

+ 9 - 8
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/RoleController.java

@@ -10,6 +10,7 @@ import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
@@ -27,19 +28,19 @@ public class RoleController extends BaseController {
     private SysMenuService sysMenuService;
 
     @ApiOperation("根据权限id查询角色")
-    @GetMapping("/{id}")
+    @GetMapping(value = "/{id}",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object getRole(@ApiParam(value = "权限编号", required = true) @PathVariable("id") Integer id) {
         return succeed(sysRoleService.get(id));
     }
 
     @ApiOperation("删除角色")
-    @PostMapping("/del/{id}")
+    @PostMapping(value = "/del/{id}",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object delRole(@ApiParam(value = "权限编号", required = true) @PathVariable("id") Integer id) {
         return succeed(sysRoleService.delete(id));
     }
 
     @ApiOperation("修改角色")
-    @PostMapping("/update")
+    @PostMapping(value = "/update",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object updateRole(SysRole sysRole) {
         SysRole roleByCode = sysRoleService.findRoleByCode(sysRole.getRoleCode());
         if(roleByCode != null && !roleByCode.getId().equals(sysRole.getId())){
@@ -51,7 +52,7 @@ public class RoleController extends BaseController {
     }
 
     @ApiOperation("新增角色")
-    @PostMapping("/add")
+    @PostMapping(value = "/add",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object addRole(SysRole sysRole) {
         SysRole roleByCode = sysRoleService.findRoleByCode(sysRole.getRoleCode());
         if(roleByCode != null){
@@ -62,7 +63,7 @@ public class RoleController extends BaseController {
     }
 
     @ApiOperation("分页查询角色列表")
-    @GetMapping("/queryPage")
+    @GetMapping(value = "/queryPage",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object queryPage(QueryInfo queryInfo) {
         return succeed(sysRoleService.queryPage(queryInfo));
     }
@@ -70,7 +71,7 @@ public class RoleController extends BaseController {
     @ApiOperation("角色新增菜单权限(批量)")
     @ApiImplicitParams({ @ApiImplicitParam(name = "roleId", value = "角色编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "menuIds", value = "菜单id,逗号分隔", required = true, dataType = "String") })
-    @PostMapping("/addRoleMenu")
+    @PostMapping(value = "/addRoleMenu",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object addRoleMenu(String roleId,String menuIds) {
         if(StringUtils.isEmpty(roleId) || StringUtils.isEmpty(menuIds)){
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
@@ -82,7 +83,7 @@ public class RoleController extends BaseController {
     @ApiOperation("角色删除菜单权限(批量)")
     @ApiImplicitParams({ @ApiImplicitParam(name = "roleId", value = "角色编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "menuIds", value = "菜单id,逗号分隔", required = true, dataType = "String") })
-    @PostMapping("/delRoleMenu")
+    @PostMapping(value = "/delRoleMenu",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object delRoleMenu(String roleId,String menuIds) {
         if(StringUtils.isEmpty(roleId) || StringUtils.isEmpty(menuIds)){
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
@@ -93,7 +94,7 @@ public class RoleController extends BaseController {
 
     @ApiOperation("根据角色编号查询拥有的菜单列表")
     @ApiImplicitParams({ @ApiImplicitParam(name = "roleId", value = "角色编号", required = true, dataType = "Integer")})
-    @GetMapping("/getMenus")
+    @GetMapping(value = "/getMenus",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object getMenus(Integer roleId) {
         if(roleId == null){
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);

+ 8 - 7
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/SmsCodeController.java

@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
@@ -34,19 +35,19 @@ public class SmsCodeController extends BaseController {
     @Autowired
     private RedisTemplate<String,String> redisTemplate;
 
-    @ApiOperation("发送登录短信验证码")
+    @ApiOperation(value = "发送登录短信验证码")
     @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String")
-    @PostMapping("/sendSms")
+    @PostMapping(value = "/sendSms",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     @PreAuthorize("@pcs.hasPermissions('sys_user_manage')")
     public Object sendLoginVerifyCode(String mobile) {
         smsCodeService.sendValidCode(mobile);
         return succeed();
     }
 
-    @ApiOperation("校验短信验证码")
+    @ApiOperation(value = "校验短信验证码")
     @ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String"),
             @ApiImplicitParam(name = "code", value = "短信验证码", required = true, dataType = "String") })
-    @PostMapping("/verifySmsCode")
+    @PostMapping(value = "/verifySmsCode",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     public Object verifySmsCode(String phone,String code) {
         if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
@@ -57,7 +58,7 @@ public class SmsCodeController extends BaseController {
         return failed();
     }
 
-    @PostMapping("/verifyLoginImage")
+    @PostMapping(value = "/verifyLoginImage",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     @ApiOperation("校验登录图形验证码")
     @ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String"),
             @ApiImplicitParam(name = "code", value = "验证码", required = true, dataType = "String") })
@@ -74,10 +75,10 @@ public class SmsCodeController extends BaseController {
         return failed(SecurityConstants.VERIFY_FAILURE);
     }
 
-    @GetMapping("/getLoginImage")
+    @GetMapping(value = "/getLoginImage",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     @ApiOperation("获取登录图片验证码")
     @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String")
-    public void getKaptchaImage(HttpServletResponse response,@RequestParam(value = "phone", required = true) String phone) throws Exception {
+    public void getKaptchaImage(HttpServletResponse response,String phone) throws Exception {
         if(StringUtils.isEmpty(phone)){
             return;
         }

+ 8 - 52
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/TokenController.java

@@ -2,7 +2,6 @@ package com.ym.mec.auth.web.controller;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.auth.core.service.AccessTokenService;
 import com.ym.mec.auth.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -15,7 +14,6 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.*;
-import org.springframework.security.core.Authentication;
 import org.springframework.security.oauth2.common.OAuth2AccessToken;
 import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
 import org.springframework.util.LinkedMultiValueMap;
@@ -26,8 +24,6 @@ import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.client.RestTemplate;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Base64;
 import java.util.Map;
@@ -44,28 +40,18 @@ public class TokenController extends BaseController {
 
 	@Autowired
 	private ObjectMapper objectMapper;
-	
-	@Autowired
-	private AccessTokenService accessTokenService;
 
 	@Autowired
 	private SysUserService userService;
     
-    @PostMapping("/smsLogin")
+    @PostMapping(value = "/smsLogin",consumes = MediaType.APPLICATION_JSON_VALUE)
 	@ApiOperation(value = "短信验证码的方式登录")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "smsCode", value = "验证码", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "clientSecret", value = "固定传 app", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "clientId", value = "固定传 app", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String") })
-    public Object smsLogin(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
-    	
-    	String clientId = request.getParameter("clientId");
-		String clientSecret = request.getParameter("clientSecret");
-		if (StringUtils.isBlank(clientId) || StringUtils.isBlank(clientSecret)) {
-			return failed("没有指定客户端或秘钥");
-		}
-		
-        return succeed(accessTokenService.getAccessToken(clientId, clientSecret, authentication));
+    public Object smsLogin() {
+		return succeed();
     }
 
     @GetMapping("/queryUserInfo")
@@ -87,47 +73,17 @@ public class TokenController extends BaseController {
 		return failed("获取用户信息失败");
     }
     
-    @PostMapping("/usernameLogin")
+    @PostMapping(value = "/usernameLogin",consumes = MediaType.APPLICATION_JSON_VALUE)
 	@ApiOperation(value = "手机号密码方式登录")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "clientSecret", value = "固定传 app", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "clientId", value = "固定传 app", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "username", value = "手机号", required = true, dataType = "String") })
-    public Object usernameLogin(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
-    	
-    	String clientId = request.getParameter("clientId");
-		String clientSecret = request.getParameter("clientSecret");
-		if (StringUtils.isBlank(clientId) || StringUtils.isBlank(clientSecret)) {
-			return failed("没有指定客户端或秘钥");
-		}
-		
-        return succeed(accessTokenService.getAccessToken(clientId, clientSecret, authentication));
+    public Object usernameLogin() {
+		return succeed();
     }
 
-	/*@PostMapping(value = "/loginIn")
-	//@PreAuthorize("hasAnyAuthority('sys_user_manage')")
-	public HttpResponseResult login(String username, String password, String clientId, String clientSecret) throws IOException {
-		String url = "http://auth-server/oauth/token";
-
-		String base64ClientCredentials = Base64.getEncoder().encodeToString((clientId + ":" + clientSecret).getBytes());
-
-		HttpHeaders headers = new HttpHeaders();
-		headers.add("Authorization", "Basic " + base64ClientCredentials);
-		headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
-
-		MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
-		params.add("username", username);
-		params.add("password", password);
-		params.add("grant_type", "password");
-
-		HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
-
-		ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
-
-		return succeed(objectMapper.readValue(resp.getBody(), Map.class));
-	}*/
-
-	@PostMapping(value = "/refreshToken")
+	@PostMapping(value = "/refreshToken",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	@ApiOperation(value = "刷新token")
 	public HttpResponseResult refreshToken(String refreshToken, String clientId, String clientSecret) throws IOException {
 		String url = "http://auth-server/oauth/token";
@@ -149,7 +105,7 @@ public class TokenController extends BaseController {
 		return succeed(objectMapper.readValue(resp.getBody(), Map.class));
 	}
 
-	@PostMapping(value = "exit")
+	@PostMapping(value = "exit",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	@ApiOperation(value = "推出登录")
 	public HttpResponseResult logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION) String authHeader) {
 		if (StringUtils.isBlank(authHeader)) {

+ 17 - 18
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java

@@ -10,14 +10,20 @@ import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.security.AuthUser;
 import com.ym.mec.common.security.SecurityUtils;
 import com.ym.mec.common.validcode.SmsCodeService;
-import io.swagger.annotations.*;
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Date;
-import java.util.HashMap;
 
 @RestController()
 @RequestMapping("user")
@@ -33,18 +39,11 @@ public class UserController extends BaseController {
 	@Autowired
 	private SmsCodeService smsCodeService;
 
-	/*@ApiOperation("根据用户名查询用户信息接口")
-	@ApiImplicitParam(name = "username", value = "用户名", required = true, dataType = "String", paramType = "path")
-	@GetMapping("/{username}")
-	public Object getUser(@PathVariable("username") String username) {
-		return succeed(sysUserService.queryUserInfoByUsername(username));
-	}*/
-
 	@ApiOperation(value = "分页查询用户信息")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "userType", value = "用户类型", required = false, dataType = "String"),
 			@ApiImplicitParam(name = "createStartDate", value = "开始注册时间", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "createEndDate", value = "结束注册时间", required = true, dataType = "String") })
-	@GetMapping("/queryPage")
+	@GetMapping(value = "/queryPage",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	public Object queryPage(SysUserQueryInfo queryInfo) {
 		return succeed(sysUserService.queryPage(queryInfo));
 	}
@@ -59,13 +58,13 @@ public class UserController extends BaseController {
 		return failed();
 	}
 
-	@GetMapping("/queryUserByPhone")
+	@GetMapping(value = "/queryUserByPhone",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	public SysUser queryUserByPhone(String mobile) {
 		return sysUserService.queryByPhone(mobile);
 	}
 
 	@ApiOperation(value = "新增用户")
-	@PostMapping("/add")
+	@PostMapping(value = "/add",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	public Object add(SysUser sysUser) {
 //		sysUser.setPassword(new BCryptPasswordEncoder().encode(sysUser.getPassword()));
 		sysUserService.insert(sysUser);
@@ -73,7 +72,7 @@ public class UserController extends BaseController {
 	}
 
 	@ApiOperation(value = "设置密码")
-	@PostMapping("/setPassword")
+	@PostMapping(value = "/setPassword",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	@ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "authCode", value = "验证码", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String") })
@@ -95,7 +94,7 @@ public class UserController extends BaseController {
 	}
 
 	@ApiOperation(value = "修改密码")
-	@PostMapping("/updatePassword")
+	@PostMapping(value = "/updatePassword",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	@ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "authCode", value = "验证码", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "newPassword", value = "新密码", required = true, dataType = "String"),
@@ -132,7 +131,7 @@ public class UserController extends BaseController {
 	}*/
 
 	@ApiOperation(value = "修改用户")
-	@PostMapping("/update")
+	@PostMapping(value = "/update",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	public Object update(SysUser sysUser) {
 		AuthUser user = SecurityUtils.getUser();
 		if(user != null){
@@ -158,7 +157,7 @@ public class UserController extends BaseController {
 	@ApiOperation(value = "用户角色新增")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer"),
 			@ApiImplicitParam(name = "roleIds", value = "角色id,逗号分隔", required = true, dataType = "String") })
-	@PostMapping("/addRole")
+	@PostMapping(value = "/addRole",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	public Object getRole(String userId,String roleIds) {
 		if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(roleIds)){
 			return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
@@ -170,7 +169,7 @@ public class UserController extends BaseController {
 	@ApiOperation(value = "用户角色删除")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer"),
 			@ApiImplicitParam(name = "roleIds", value = "角色id,逗号分隔", required = true, dataType = "String") })
-	@PostMapping("/delRole")
+	@PostMapping(value = "/delRole",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	public Object delRole(String userId,String roleIds) {
 		if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(roleIds)){
 			return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);

+ 7 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMessageDao.java

@@ -5,5 +5,11 @@ import com.ym.mec.common.dal.BaseDAO;
 
 public interface SysMessageDao extends BaseDAO<Long, SysMessage> {
 
-	
+
+    /**
+     * 获取用户未读消息数
+     * @param id
+     * @return
+     */
+    int findNewMessageNum(Integer id);
 }

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysMessageService.java

@@ -5,4 +5,10 @@ import com.ym.mec.common.service.BaseService;
 
 public interface SysMessageService extends BaseService<Long, SysMessage> {
 
+    /**
+     * 获取用户未读消息数
+     * @param id
+     * @return
+     */
+    int findNewMessageNum(Integer id);
 }

+ 5 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java

@@ -19,5 +19,9 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage>  im
 	public BaseDAO<Long, SysMessage> getDAO() {
 		return sysMessageDao;
 	}
-	
+
+	@Override
+	public int findNewMessageNum(Integer id) {
+		return sysMessageDao.findNewMessageNum(id);
+	}
 }

+ 6 - 3
mec-biz/src/main/resources/config/mybatis/SysMessageMapper.xml

@@ -41,9 +41,9 @@
         </selectKey>
         -->
         INSERT INTO sys_message
-        (id_,title_,content_,type_,status_,receiver_,send_time_,error_msg_,create_on_,modify_on_,user_id_,memo_,read_status_)
-        VALUES(#{id},#{title},#{content},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{receiver},#{sendTime},#{errorMsg},now(),now(),#{userId},#{memo},#{readStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
+        (id_,title_,content_,type_,receiver_,send_time_,error_msg_,create_on_,modify_on_,user_id_,memo_)
+        VALUES(#{id},#{title},#{content},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{receiver},#{sendTime},#{errorMsg},now(),now(),#{userId},#{memo})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -102,4 +102,7 @@
     <select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM sys_message
 	</select>
+    <select id="findNewMessageNum" resultType="java.lang.Integer">
+SELECT * FROM sys_message WHERE status_ = 4 AND read_status_ = 0
+    </select>
 </mapper>

+ 0 - 5
mec-im/pom.xml

@@ -101,11 +101,6 @@
         <artifactId>spring-boot-maven-plugin</artifactId>
       </plugin>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.8.0</version>
-      </plugin>
-      <plugin>
         <groupId>com.spotify</groupId>
         <artifactId>docker-maven-plugin</artifactId>
       </plugin>

+ 6 - 1
mec-web/src/main/java/com/ym/mec/web/controller/SysMessageController.java

@@ -1,6 +1,7 @@
 package com.ym.mec.web.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.ChargeType;
 import com.ym.mec.biz.dal.entity.SysMessage;
 import com.ym.mec.biz.service.ChargeTypeService;
@@ -52,7 +53,11 @@ public class SysMessageController extends BaseController {
     @ApiOperation(value = "获取用户未读消息条数")
     @PostMapping("/findNewMessageNum")
     public Object findNewMessageNum(){
-        return succeed();
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser == null){
+            return failed("请重新登录");
+        }
+        return succeed(sysMessageService.findNewMessageNum(sysUser.getId()));
     }
 
     @ApiOperation(value = "分页查询消息提醒列表")