소스 검색

add 根据合作单位id获取对应乐团的学校缴费

周箭河 4 년 전
부모
커밋
f3096173b2

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CooperationOrganDao.java

@@ -5,6 +5,7 @@ import java.util.Map;
 import java.util.Set;
 
 import com.ym.mec.biz.dal.dto.OrganFullJobResourceNumDto;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
@@ -34,7 +35,15 @@ public interface CooperationOrganDao extends BaseDAO<Integer, CooperationOrgan>
 
     /**
      * 获取全部使用中合作单位
+     *
      * @return
      */
     List<CooperationOrgan> getAllCooperationOrgan();
+
+    /**
+     * 获取合作单位乐团的学校缴费
+     * @param cooperationOrganId
+     * @return
+     */
+    List<MusicGroupPaymentCalender> getCooperationOrganCalender4School(@Param("cooperationOrganId") Integer cooperationOrganId);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CooperationOrganService.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
@@ -9,8 +10,18 @@ public interface CooperationOrganService extends BaseService<Integer, Cooperatio
 
     /**
      * 根据机构编号获取合作单位(教学点)列表
+     *
      * @param organId
      * @return
      */
     List<CooperationOrgan> queryByOrganId(String organId);
+
+
+    /**
+     * 获取合作单位乐团的学校缴费
+     *
+     * @param id
+     * @return
+     */
+    List<MusicGroupPaymentCalender> getCooperationOrganCalender4School(Integer id);
 }

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

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
 
 import java.util.List;
 
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -26,4 +27,9 @@ public class CooperationOrganServiceImpl extends BaseServiceImpl<Integer, Cooper
 	public List<CooperationOrgan> queryByOrganId(String organId) {
 		return cooperationOrganDao.queryByOrganId(organId);
 	}
+
+    @Override
+    public List<MusicGroupPaymentCalender> getCooperationOrganCalender4School(Integer id) {
+		return cooperationOrganDao.getCooperationOrganCalender4School(id);
+    }
 }

+ 63 - 36
mec-biz/src/main/resources/config/mybatis/CooperationOrganMapper.xml

@@ -13,36 +13,41 @@
         <result column="mobile_no_" property="mobileNo"/>
         <result column="address_" property="address"/>
         <result column="is_enable_" property="isEnable"/>
-        <result column="ownership_type_" property="ownershipType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="ownership_type_" property="ownershipType"
+                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
         <result column="full_job_resource_" property="fullJobResource"/>
     </resultMap>
-    
+
     <resultMap type="com.ym.mec.biz.dal.entity.CooperationOrgan" id="ExtCooperationOrgan" extends="CooperationOrgan">
-    	<result column="organ_id_" property="organization.id"/>
-    	<result column="organ_name_" property="organization.name"/>
+        <result column="organ_id_" property="organization.id"/>
+        <result column="organ_name_" property="organization.name"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="CooperationOrgan">
-		SELECT * FROM
-		cooperation_organ WHERE id_ = #{id}
-	</select>
+        SELECT *
+        FROM cooperation_organ
+        WHERE id_ = #{id}
+    </select>
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="CooperationOrgan">
-		SELECT * FROM cooperation_organ AND del_flag_ != 1
-		ORDER BY id_
-	</select>
+        SELECT *
+        FROM cooperation_organ AND del_flag_ != 1
+        ORDER BY id_
+    </select>
 
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CooperationOrgan"
             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO cooperation_organ
-        (id_,name_,linkman_,job_,mobile_no_,address_,organ_id_,create_time_,update_time_,ownership_type_,is_enable_,full_job_resource_)
-        VALUES(#{id},#{name},#{linkman},#{job},#{mobileNo},#{address},#{organId},now(),now(),
-        #{ownershipType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{isEnable},#{fullJobResource})
+        (id_, name_, linkman_, job_, mobile_no_, address_, organ_id_, create_time_, update_time_, ownership_type_,
+         is_enable_, full_job_resource_)
+        VALUES (#{id}, #{name}, #{linkman}, #{job}, #{mobileNo}, #{address}, #{organId}, now(), now(),
+                #{ownershipType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{isEnable},
+                #{fullJobResource})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -85,24 +90,26 @@
 
     <!-- 根据主键删除一条记录 -->
     <update id="delete">
-		UPDATE cooperation_organ SET del_flag_ = 1 WHERE id_ =#{id}
-	</update>
+        UPDATE cooperation_organ
+        SET del_flag_ = 1
+        WHERE id_ = #{id}
+    </update>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ExtCooperationOrgan"
             parameterType="map">
         SELECT co.*,o.name_ organ_name_ FROM cooperation_organ co left join organization o on co.organ_id_ = o.id_
         <where>
-                co.del_flag_ != 1
+            co.del_flag_ != 1
             <if test="search != null">
                 AND (co.id_ LIKE CONCAT('%',#{search},'%') OR co.name_ LIKE CONCAT('%',#{search},'%'))
             </if>
-	        <if test="organId != null">
-	            AND FIND_IN_SET(co.organ_id_,#{organId})
-	        </if>
-	        <if test="isEnable != null">
-	            AND co.is_enable_ = #{isEnable}
-	        </if>
+            <if test="organId != null">
+                AND FIND_IN_SET(co.organ_id_,#{organId})
+            </if>
+            <if test="isEnable != null">
+                AND co.is_enable_ = #{isEnable}
+            </if>
             <if test="fullJobResource != null">
                 AND co.full_job_resource_ = #{fullJobResource}
             </if>
@@ -113,42 +120,62 @@
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM cooperation_organ
+        SELECT COUNT(*) FROM cooperation_organ
         <where>
             del_flag_ != 1
             <if test="search != null">
                 AND (id_ LIKE CONCAT('%',#{search},'%') OR name_ LIKE CONCAT('%',#{search},'%'))
             </if>
-	        <if test="organId != null">
-	            AND FIND_IN_SET(organ_id_,#{organId})
-	        </if>
-	        <if test="isEnable != null">
-	            AND is_enable_ = #{isEnable}
-	        </if>
+            <if test="organId != null">
+                AND FIND_IN_SET(organ_id_,#{organId})
+            </if>
+            <if test="isEnable != null">
+                AND is_enable_ = #{isEnable}
+            </if>
             <if test="fullJobResource != null">
                 AND full_job_resource_ = #{fullJobResource}
             </if>
         </where>
-	</select>
+    </select>
 
     <select id="queryByOrganId" resultMap="CooperationOrgan">
-        SELECT * FROM cooperation_organ WHERE FIND_IN_SET(organ_id_,#{organId}) AND del_flag_ != 1 AND is_enable_ = 1
+        SELECT *
+        FROM cooperation_organ
+        WHERE FIND_IN_SET(organ_id_, #{organId})
+          AND del_flag_ != 1
+          AND is_enable_ = 1
     </select>
 
     <select id="queryNameByIds" resultType="java.util.Map">
-        SELECT co.id_ 'key',co.name_ 'value' FROM cooperation_organ co
-        WHERE FIND_IN_SET(co.id_,#{organIds}) AND co.del_flag_ != 1
+        SELECT co.id_ 'key', co.name_ 'value'
+        FROM cooperation_organ co
+        WHERE FIND_IN_SET(co.id_, #{organIds})
+          AND co.del_flag_ != 1
     </select>
 
     <select id="getOrganFullJobResourceNum" resultType="com.ym.mec.biz.dal.dto.OrganFullJobResourceNumDto">
-        SELECT organ_id_ organId,COUNT(*) num FROM cooperation_organ
-        WHERE full_job_resource_ =1 AND del_flag_ = 0
+        SELECT organ_id_ organId, COUNT(*) num
+        FROM cooperation_organ
+        WHERE full_job_resource_ = 1
+          AND del_flag_ = 0
         GROUP BY organ_id_
     </select>
 
     <!-- 获取全部使用中的合作单位 -->
     <select id="getAllCooperationOrgan" resultMap="CooperationOrgan">
-        SELECT * FROM cooperation_organ
+        SELECT *
+        FROM cooperation_organ
         WHERE del_flag_ = 0
     </select>
+
+    <!-- 获取合作单位乐团的的学校缴费 -->
+    <select id="getCooperationOrganCalender4School"
+            resultMap="com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao.MusicGroupPaymentCalender">
+        SELECT mgpc.*
+        FROM music_group mg
+                 LEFT JOIN music_group_payment_calender mgpc ON mgpc.music_group_id_ = mg.id_
+        WHERE mg.cooperation_organ_id_ = #{cooperationOrganId}
+          AND mgpc.pay_user_type_ = 'SCHOOL'
+          AND mgpc.status_ IN ('NO', 'OPEN', 'OVER')
+    </select>
 </mapper>

+ 17 - 8
mec-web/src/main/java/com/ym/mec/web/controller/CooperationOrganController.java

@@ -5,9 +5,11 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.page.CooperationOrganQueryInfo;
 import com.ym.mec.biz.service.CooperationOrganService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -61,18 +63,18 @@ public class CooperationOrganController extends BaseController {
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('cooperationOrgan/queryPage')")
     public Object queryPage(CooperationOrganQueryInfo queryInfo) {
-		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		if (sysUser == null) {
-			return failed("用户信息获取失败");
-		}
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
         Employee employee = employeeDao.get(sysUser.getId());
         if (StringUtils.isEmpty(queryInfo.getOrganId())) {
             queryInfo.setOrganId(employee.getOrganIdList());
-        }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
             return failed("用户所在分部异常");
-        }else {
+        } else {
             List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-            if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
                 return failed("非法请求");
             }
         }
@@ -82,7 +84,14 @@ public class CooperationOrganController extends BaseController {
     @ApiOperation(value = "根据机构编号获取合作单位(教学点)列表")
     @GetMapping("/queryByOrganId")
     @PreAuthorize("@pcs.hasPermissions('cooperationOrgan/queryByOrganId')")
-    public Object queryByOrganId(String organId){
+    public Object queryByOrganId(String organId) {
         return succeed(cooperationOrganService.queryByOrganId(organId));
     }
+
+    @ApiOperation(value = "根据合作单位id获取学校缴费")
+    @GetMapping("/getCalenders")
+    @PreAuthorize("@pcs.hasPermissions('cooperationOrgan/getCalenders')")
+    public HttpResponseResult<List<MusicGroupPaymentCalender>> getCalenders(Integer id) {
+        return succeed(cooperationOrganService.getCooperationOrganCalender4School(id));
+    }
 }