zouxuan před 4 roky
rodič
revize
cb09e05588

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -166,4 +166,20 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      */
     List<MusicGroupPaymentCalenderAuditDto> queryAuditList(Map<String, Object> params);
 
+    /**
+     * 统计预计缴费人数
+     *
+     * @param id
+     * @return
+     */
+    List<Map<Long, Long>> countExpectNum(@Param("id") Long id);
+
+    /**
+     * 统计预计缴费人数
+     *
+     * @param id
+     * @return
+     */
+    List<Map<Long, Long>> countActualNum(@Param("id") Long id);
+
 }

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDetailDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -167,4 +168,11 @@ public interface MusicGroupPaymentCalenderDetailDao extends BaseDAO<Long, MusicG
      * @return java.util.List<com.ym.mec.biz.dal.dto.SimpleUserDto>
      */
 	List<SimpleUserDto> querySimpleUserDto(@Param("calenderId") Integer calenderId, @Param("musicGroupId") String musicGroupId);
+
+	/**
+	 * 统计实际收款金额
+	 * @param id
+	 * @return
+	 */
+	BigDecimal sumActualAmount(@Param("id") Long id);
 }

+ 8 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java

@@ -14,10 +14,17 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 
 	/**
 	 * 创建缴费信息
-	 * @param musicGroupPaymentCalenderDto
+	 * @param musicGroupPaymentCalender
 	 * @return
 	 */
 	boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender);
+
+	/**
+	 * 获取明细
+	 * @param id
+	 * @return
+	 */
+	Object getDetail(Long id);
 	
 	/**
 	 * 更新缴费信息

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -205,6 +205,20 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	}
 
 	@Override
+	public Object getDetail(Long id) {
+		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
+		Map<Long, Long> expectNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countExpectNum(id));
+		Map<Long, Long> actualNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countActualNum(id));
+		calender.setActualNum(actualNumMap.get(id) == null ? 0 : actualNumMap.get(id).intValue());
+		calender.setExpectNum(expectNumMap.get(id) == null ? 0 : expectNumMap.get(id).intValue());
+		BigDecimal sumActualAmount = musicGroupPaymentCalenderDetailDao.sumActualAmount(id);
+		Map<String, Object> result = new HashMap<>(2);
+		result.put("calender", calender);
+		result.put("sumActualAmount", sumActualAmount);
+		return result;
+	}
+
+	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public int update(MusicGroupPaymentCalender musicGroupPaymentCalender) {
 		

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml

@@ -356,4 +356,8 @@
 		LEFT JOIN `subject` s ON s.id_ = sr.subject_id_
 		WHERE mgpcd.music_group_payment_calender_id_ = #{calenderId}
 	</select>
+	<select id="sumActualAmount" resultType="java.math.BigDecimal">
+		SELECT SUM(mgpcd.actual_amount_) FROM music_group_payment_calender_detail mgpcd
+		WHERE mgpcd.music_group_payment_calender_id_ = #{id}
+	</select>
 </mapper>

+ 11 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -408,4 +408,15 @@
         ORDER BY create_time_ DESC
         <include refid="global.limit"/>
     </select>
+    <select id="countExpectNum" resultType="java.util.Map">
+        SELECT mgpcd.music_group_payment_calender_id_ 'key',COUNT(DISTINCT mgpcd.user_id_) 'value' FROM music_group_payment_calender_detail mgpcd
+        WHERE mgpcd.music_group_payment_calender_id_ = #{id}
+        GROUP BY mgpcd.music_group_payment_calender_id_
+    </select>
+    <select id="countActualNum" resultType="java.util.Map">
+        SELECT mgpcd.music_group_payment_calender_id_ 'key',COUNT(DISTINCT mgpcd.user_id_) 'value' FROM music_group_payment_calender_detail mgpcd
+        WHERE mgpcd.music_group_payment_calender_id_ = #{id}
+        AND mgpcd.payment_status_ = 'PAID_COMPLETED'
+        GROUP BY mgpcd.music_group_payment_calender_id_
+    </select>
 </mapper>

+ 8 - 1
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -44,6 +44,13 @@ public class MusicGroupPaymentCalenderController extends BaseController {
         return succeed(musicGroupPaymentCalenderService.queryPage(queryInfo));
     }
 
+    @ApiOperation(value = "获取缴费信息")
+    @GetMapping("/getDetail")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/getDetail')")
+    public Object getDetail(Long id) {
+        return succeed(musicGroupPaymentCalenderService.getDetail(id));
+    }
+
     @ApiOperation(value = "新增乐团缴费日历")
     @PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
@@ -117,7 +124,7 @@ public class MusicGroupPaymentCalenderController extends BaseController {
 
     @ApiOperation(value = "乐团缴费日历审核拒绝")
     @PostMapping("/auditRefuse")
-    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/auditPass')")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/auditRefuse')")
     public Object auditRefuse(Long calenderId,String auditMemo) {
         musicGroupPaymentCalenderService.auditRefuse(calenderId,auditMemo);
         return succeed();