Pārlūkot izejas kodu

企业端修改:
1.单位信息修改完善。
2.消息读取完善。
3.用户登录完善。

tomatozq 5 gadi atpakaļ
vecāks
revīzija
04b9088e88

+ 7 - 3
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/controller/CompanyController.java

@@ -64,9 +64,14 @@ public class CompanyController {
             //todo
             AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
 
-            if (StringUtils.isEmpty(companyInfoDTO.getId())){
-                Company company = new Company();
+            Company company = null;
 
+            if (!StringUtils.isEmpty(companyInfoDTO.getId())){
+                company = companyService.get(companyInfoDTO.getId());
+            }
+
+            if (company==null) {
+                company = new Company();
                 PojoUtils.map(companyInfoDTO, company);
 
                 company.setId(UUID.randomUUID().toString());
@@ -79,7 +84,6 @@ public class CompanyController {
                 messageResult.setData(company.getId());
             }
             else {
-                Company company = companyService.get(companyInfoDTO.getId());
                 PojoUtils.map(companyInfoDTO, company);
                 company.setUpdateTime(new Date());
                 company.setUpdateBy(principal.getName());

+ 16 - 8
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/controller/MessageController.java

@@ -89,21 +89,29 @@ public class MessageController {
     @ApiOperation(value="未读消息数量")
     @GetMapping(value = "unReadCount")
     public MessageResult<Long> unReadCount(HttpServletRequest request){
+
         AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
-        Company company = companyService.findByCreateBy(principal.getName());
         MessageResult<Long> msgResult = new MessageResult<>();
 
-        Map<String,Object> searchParams = new HashMap<>();
-        searchParams.put("recipientId",company.getId());
+        Company company = companyService.findByCreateBy(principal.getName());
 
-        List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time","desc"));
-        searchParams.put("status",false);
+        if(company!=null) {
+            Map<String, Object> searchParams = new HashMap<>();
+            searchParams.put("recipientId", company.getId());
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("create_time", "desc"));
+            searchParams.put("status", false);
 
-        Page<Message> page = messageService.pageSearch(searchParams,1,1,sortList);
+            Page<Message> page = messageService.pageSearch(searchParams, 1, 1, sortList);
+
+            msgResult.setData(page.getTotal());
+        }
+        else{
+            msgResult.setData(0L);
+        }
 
         msgResult.setResult(true);
-        msgResult.setData(page.getTotal());
 
         return msgResult;
     }

+ 1 - 1
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/pub/controller/UserController.java

@@ -86,7 +86,7 @@ public class UserController {
         }
         catch (Exception ex){
             msgResult.setResult(false);
-            msgResult.setMessage(ex.getMessage());
+            msgResult.setMessage("用户名或密码错误!" + ex.getMessage());
         }
 
         return  msgResult;