Explorar o código

新增乐保导出

周箭河 %!s(int64=4) %!d(string=hai) anos
pai
achega
3bee551ae4

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

@@ -42,8 +42,16 @@ public interface CooperationOrganDao extends BaseDAO<Integer, CooperationOrgan>
 
     /**
      * 获取合作单位乐团的学校缴费
+     *
      * @param cooperationOrganId
      * @return
      */
     List<MusicGroupPaymentCalender> getCooperationOrganCalender4School(@Param("cooperationOrganId") Integer cooperationOrganId);
+
+    /**
+     * 根据合作单位ids获取合作单位
+     * @param ids
+     * @return
+     */
+    List<CooperationOrgan> getCooperationOrganByIds(@Param("ids") List<Integer> ids);
 }

+ 35 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -55,12 +55,25 @@ public class ExportServiceImpl implements ExportService {
     private StoragePluginContext storagePluginContext;
     @Autowired
     private ManagerDownloadDao managerDownloadDao;
+    @Autowired
+    private CooperationOrganDao cooperationOrganDao;
 
     @Override
     @Async
     public void orderList(Map<String, Object> params, ManagerDownload managerDownload) throws Exception {
         List<StudentPaymentOrderExportDto> studentPaymentOrderExportDtos = studentPaymentOrderService.ExportQueryPage(params);
         long i = 1;
+        Map<Integer, String> cooperationOrganMap = new HashMap<>();
+        List<Integer> cooperationOrganIds = studentPaymentOrderExportDtos.stream()
+                .filter(e -> OrderTypeEnum.OUTORDER.equals(e.getType()))
+                .filter(e -> e.getMusicGroupId() != null)
+                .map(e -> Integer.valueOf(e.getMusicGroupId()))
+                .distinct()
+                .collect(Collectors.toList());
+        if (cooperationOrganIds.size() > 0) {
+            List<CooperationOrgan> cooperationOrgans = cooperationOrganDao.getCooperationOrganByIds(cooperationOrganIds);
+            cooperationOrganMap = cooperationOrgans.stream().collect(Collectors.toMap(CooperationOrgan::getId, CooperationOrgan::getName));
+        }
         for (StudentPaymentOrderExportDto row : studentPaymentOrderExportDtos) {
             if (row.getActualAmount() == null) {
                 row.setActualAmount(BigDecimal.ZERO);
@@ -223,6 +236,11 @@ public class ExportServiceImpl implements ExportService {
                     row.setEduTeacher(cooperationOrgan.getLinkman() != null ? cooperationOrgan.getLinkman() : row.getEduTeacher());
                 }
             }
+            if (row.getType().equals(OrderTypeEnum.OUTORDER) && row.getMusicGroupId() != null) {
+                if (cooperationOrganMap.containsKey(Integer.valueOf(row.getMusicGroupId()))) {
+                    row.setCooperationOrganName(cooperationOrganMap.get(Integer.valueOf(row.getMusicGroupId())));
+                }
+            }
             if (row.getMusicGroupId() != null && row.getMusicGroupId().equals("null")) {
                 row.setMusicGroupId("");
             }
@@ -279,6 +297,18 @@ public class ExportServiceImpl implements ExportService {
     @Async
     public void routeOrderList(Map<String, Object> params, ManagerDownload managerDownload) throws Exception {
         List<StudentPaymentOrderExportDto> studentPaymentOrderExportDtos = studentPaymentRouteOrderDao.ExportQueryPage(params);
+
+        Map<Integer, String> cooperationOrganMap = new HashMap<>();
+        List<Integer> cooperationOrganIds = studentPaymentOrderExportDtos.stream()
+                .filter(e -> OrderTypeEnum.OUTORDER.equals(e.getType()))
+                .filter(e -> e.getMusicGroupId() != null)
+                .map(e -> Integer.valueOf(e.getMusicGroupId()))
+                .distinct()
+                .collect(Collectors.toList());
+        if (cooperationOrganIds.size() > 0) {
+            List<CooperationOrgan> cooperationOrgans = cooperationOrganDao.getCooperationOrganByIds(cooperationOrganIds);
+            cooperationOrganMap = cooperationOrgans.stream().collect(Collectors.toMap(CooperationOrgan::getId, CooperationOrgan::getName));
+        }
         long i = 1;
         for (StudentPaymentOrderExportDto row : studentPaymentOrderExportDtos) {
             if (row.getActualAmount() == null) {
@@ -442,6 +472,11 @@ public class ExportServiceImpl implements ExportService {
                     row.setEduTeacher(cooperationOrgan.getLinkman() != null ? cooperationOrgan.getLinkman() : row.getEduTeacher());
                 }
             }
+            if (row.getType().equals(OrderTypeEnum.OUTORDER) && row.getMusicGroupId() != null) {
+                if (cooperationOrganMap.containsKey(Integer.valueOf(row.getMusicGroupId()))) {
+                    row.setCooperationOrganName(cooperationOrganMap.get(Integer.valueOf(row.getMusicGroupId())));
+                }
+            }
             if (row.getMusicGroupId() != null && row.getMusicGroupId().equals("null")) {
                 row.setMusicGroupId("");
             }

+ 12 - 4
mec-biz/src/main/resources/config/mybatis/CooperationOrganMapper.xml

@@ -35,7 +35,8 @@
     <!-- 全查询 -->
     <select id="findAll" resultMap="CooperationOrgan">
         SELECT *
-        FROM cooperation_organ WHERE del_flag_ != 1
+        FROM cooperation_organ
+        WHERE del_flag_ != 1
         ORDER BY id_
     </select>
 
@@ -173,10 +174,17 @@
             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_
+                 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')
+          AND mgpc.pay_user_type_ = 'SCHOOL'
+          AND mgpc.status_ IN ('NO', 'OPEN', 'OVER')
         ORDER BY mgpc.payment_valid_start_date_ ASC
     </select>
+
+    <select id="getCooperationOrganByIds" resultMap="CooperationOrgan">
+        SELECT * FROM cooperation_organ WHERE id_ IN
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </select>
 </mapper>