Przeglądaj źródła

查看机构详情

guo00guo 5 lat temu
rodzic
commit
5412fd3c6d

+ 12 - 0
site/src/main/java/com/mooctest/crowd/site/controller/AgencyController.java

@@ -140,6 +140,18 @@ public class AgencyController extends BaseSearchController {
         return new ResponseVO(ServerCode.SUCCESS ,agencyService.getDetailById(userId));
     }
 
+    /**
+     * 获取机构认证简单的信息
+     *
+     * @param userId
+     * @return
+     */
+    @LoginRequired
+    @RequestMapping(value = "/user/{userId}/agency/common", method = RequestMethod.GET)
+    public ResponseVO getAgencyInfoCommon(@PathVariable("userId") Long userId) {
+        return new ResponseVO(ServerCode.SUCCESS ,agencyService.getAgencyInfoCommon(userId));
+    }
+
     @RequestMapping(value = "/agency/list", method = RequestMethod.GET)
     public List<EvaluationAgencyVO> getAgencyList() {
         return agencyService.getAgencyList();

+ 34 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/AgencyDetailVO.java

@@ -0,0 +1,34 @@
+package com.mooctest.crowd.site.data.vo;
+
+import com.mooctest.crowd.domain.domainobject.EvaluationAgency;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.beans.BeanUtils;
+
+import java.sql.Timestamp;
+
+/**
+ * @author: Diors.Po
+ * @Email: 171256175@qq.com
+ * @date 2019-08-12 02:59
+ */
+@Data
+@NoArgsConstructor
+public class AgencyDetailVO {
+    private String evaluationAgencyName;
+    private String address;
+    private String agencyPhoto;
+    private Integer isAuthentication;
+    private Long taskCount;
+    private StatusVO authStatus;
+    private String legalPersonName;
+    private Timestamp checkTime;
+    private Double allTaskPrice;
+
+
+    public AgencyDetailVO(EvaluationAgency agency) {
+        BeanUtils.copyProperties(agency, this);
+        this.authStatus = new StatusVO();
+        this.authStatus.initAuthStatus(this.isAuthentication);
+    }
+}

+ 1 - 1
site/src/main/java/com/mooctest/crowd/site/data/vo/EvaluationAgencyVO.java

@@ -47,7 +47,7 @@ public class EvaluationAgencyVO implements Serializable {
     private String idCardPositivePhoto;//身份证正面照
     private String idCardBackPhoto;//身份证反面照
     private Date idCardDeadTime;
-
+    private Timestamp checkTime;
     private Double allTaskPrice;
 
 

+ 3 - 0
site/src/main/java/com/mooctest/crowd/site/service/AgencyService.java

@@ -4,6 +4,7 @@ import com.mooctest.crowd.site.command.AgencyResourceAbilityUpdateCommand;
 import com.mooctest.crowd.site.command.ApplyAgencyAuthCommand;
 import com.mooctest.crowd.site.command.GenerateAgencyCommand;
 import com.mooctest.crowd.site.data.dto.UserDTO;
+import com.mooctest.crowd.site.data.vo.AgencyDetailVO;
 import com.mooctest.crowd.site.data.vo.AgencyVO;
 import com.mooctest.crowd.site.data.vo.EvaluationAgencyVO;
 
@@ -37,4 +38,6 @@ public interface AgencyService {
     AgencyVO rejectAuth(Long userId, String explain);
 
     AgencyVO getAgencyDetails(Long userId);
+
+    AgencyDetailVO getAgencyInfoCommon(Long userId);
 }

+ 18 - 0
site/src/main/java/com/mooctest/crowd/site/service/impl/AgencyServiceImpl.java

@@ -16,6 +16,7 @@ import com.mooctest.crowd.site.command.ApplyAgencyAuthCommand;
 import com.mooctest.crowd.site.command.GenerateAgencyCommand;
 import com.mooctest.crowd.site.data.dto.UserDTO;
 import com.mooctest.crowd.site.data.enums.RoleType;
+import com.mooctest.crowd.site.data.vo.AgencyDetailVO;
 import com.mooctest.crowd.site.data.vo.AgencyVO;
 import com.mooctest.crowd.site.data.vo.EvaluationAgencyVO;
 import com.mooctest.crowd.site.data.vo.UserVO;
@@ -112,6 +113,22 @@ public class AgencyServiceImpl implements AgencyService {
         return agencyVO;
     }
 
+
+
+    @Override
+    public AgencyDetailVO getAgencyInfoCommon(Long userId){
+        EvaluationAgency agency = evaluationAgencyRepo.findAgencyByUserId(userId);
+        AgencyDetailVO agencyVO = new AgencyDetailVO(agency);
+        /*
+        先根据机构的userId查询出机构信息,再从user_task_count表里面找到这个机构的接的任务的数量。
+         */
+        UserTaskCount taskCountByUserId = userRepo.getUserTaskCountByUserId(userId);
+        if(taskCountByUserId != null){
+            agencyVO.setTaskCount(taskCountByUserId.getCount());
+        }
+        return agencyVO;
+    }
+
     /**
      * 获取首页机构 more模糊查询
      *
@@ -257,4 +274,5 @@ public class AgencyServiceImpl implements AgencyService {
         }
         return agencyVO;
     }
+
 }