shenhao пре 3 година
родитељ
комит
3fce0f11d8

+ 1 - 1
src/main/java/com/ssj/dao/sys/jxy/dao/impl/JxyQueryDaoImpl.java

@@ -129,7 +129,7 @@ public class JxyQueryDaoImpl implements JxyQueryDao {
 	@Override
 	public Page<Map<String, Object>> refundList(Map<String, Object> map, Pageable initPage) {
 		StringBuilder sb = new StringBuilder();
-		sb.append("SELECT t.*,t11.wx_name,t13.unit_name ")
+		sb.append("SELECT t.*,t11.wx_name,t13.unit_name,t13.lib_id ")
 				.append("from fx_merchant_refund t ")
 				.append("left join fx_merchant_meal_order t12 on t.meal_order_id = t12.id ")
 				.append("left join fx_merchant t13 on t12.merchant_id = t13.id ")

+ 11 - 0
src/main/java/com/ssj/refund/dao/IMerchantRefundDao.java

@@ -2,8 +2,12 @@ package com.ssj.refund.dao;
 
 import com.ssj.refund.bean.RefundInfo;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * @author sh
  * @className IMerchantRefundDao
@@ -13,4 +17,11 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface IMerchantRefundDao extends JpaRepository<RefundInfo,String> {
 
+    @Query(nativeQuery = true,value = "update tb_lib_vip set lib_id is null where vip_id in (?1)")
+    @Modifying
+    void invaldVips(List<String> asList);
+
+    @Query(nativeQuery = true,value = "update tb_lib_vip_service set stat=2 where vip_id in (?1) and lib_id=?2 and species='S003' ")
+    @Modifying
+    void invaldVipService(List<String> asList, String libId);
 }

+ 2 - 0
src/main/java/com/ssj/refund/service/IMerchantRefundService.java

@@ -10,4 +10,6 @@ import com.ssj.refund.bean.RefundInfo;
  * @date 2021/7/9
  */
 public interface IMerchantRefundService extends BaseService<RefundInfo,String> {
+
+    void invaldVips(String vipIds,String libId);
 }

+ 11 - 0
src/main/java/com/ssj/refund/service/impl/MerchantRefundServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ssj.refund.service.impl;
 
+import com.google.common.collect.Lists;
 import com.ssj.framework.core.common.service.BaseServiceImpl;
 import com.ssj.refund.bean.RefundInfo;
 import com.ssj.refund.dao.IMerchantRefundDao;
@@ -8,6 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * @author sh
  * @className MerchantRefundServiceImpl
@@ -24,4 +28,11 @@ public class MerchantRefundServiceImpl extends BaseServiceImpl<RefundInfo,String
     public PagingAndSortingRepository<RefundInfo, String> getDao() {
         return dao;
     }
+
+    @Override
+    public void invaldVips(String vipIds,String libId) {
+       String[] array = vipIds.replace("[","").replace("]","").split(",");
+        dao.invaldVips(Arrays.asList(array));
+        dao.invaldVipService(Arrays.asList(array),libId);
+    }
 }

+ 2 - 10
src/main/java/com/ssj/service/sys/fx/service/impl/SysCuratorServiceImpl.java

@@ -105,13 +105,9 @@ public class SysCuratorServiceImpl implements SysCuratorService {
     public Map<String, Object> searchTop(String startDate, String endDate, int pageNo, int pageSize, String subject) {
         Map<String, Object> data = new HashMap<>(2);
         Page   page = new Page(pageNo, pageSize);
-        page.setSearchCount(false);
         List<Map<String, Object>> list = curatorMapper.searchHomeworkAllTop(page,startDate,endDate,subject);
         data.put("list",list);
-        Page page1 = new Page(1,-1);
-        page1.setSearchCount(false);
-        List<Map<String, Object>> listTotal = curatorMapper.searchHomeworkAllTop(page1,startDate,endDate,subject);
-        data.put("total",listTotal.size());
+        data.put("total",page.getTotal());
         return data;
     }
 
@@ -119,12 +115,8 @@ public class SysCuratorServiceImpl implements SysCuratorService {
     public Map<String, Object> searchActiveTop(String startDate, String endDate, int pageNo, int pageSize) {
         Map<String, Object> data = new HashMap<>(2);
         Page   page = new Page(pageNo, pageSize);
-        page.setSearchCount(false);
         List<Map<String, Object>> list = curatorMapper.searchActiveTop(page,startDate,endDate);
-        Page page1 = new Page(1,-1);
-        page1.setSearchCount(false);
-        List<Map<String, Object>> lastList =  curatorMapper.searchActiveTop(page1,startDate,endDate);
-        data.put("total",lastList.size());
+        data.put("total",page.getTotal());
         data.put("list",list);
         return data;
     }

+ 17 - 1
src/main/java/com/ssj/sys/controller/ErrorController.java

@@ -5,6 +5,8 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
 import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
 import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
 import com.alibaba.fastjson.JSON;
+import com.ssj.bean.sys.fx.domain.Merchant;
+import com.ssj.bean.sys.fx.domain.MerchantMealOrder;
 import com.ssj.bean.sys.homework.domain.HomeworkPicture;
 import com.ssj.bean.sys.picturepredeal.domain.PicturePreDeal;
 import com.ssj.bean.sys.role.domain.Admin;
@@ -18,6 +20,8 @@ import com.ssj.refund.bean.RefundInfo;
 import com.ssj.refund.service.IAuditInfoService;
 import com.ssj.refund.service.IMerchantRefundService;
 import com.ssj.service.reading.request.RandomBookReq;
+import com.ssj.service.sys.fx.service.MerchantMealOrderService;
+import com.ssj.service.sys.fx.service.MerchantService;
 import com.ssj.service.sys.fx.service.SysCuratorService;
 import com.ssj.service.sys.homework.service.HomeworkPictureService;
 import com.ssj.service.sys.jxy.service.JxyService;
@@ -75,6 +79,12 @@ public class ErrorController extends BaseController {
     @Autowired
     private SysCuratorService sysCuratorService;
 
+    @Autowired
+    private MerchantService merchantService;
+
+    @Autowired
+    private MerchantMealOrderService mealOrderService;
+
     @RequestMapping("/errorList")
     public String errorList(Model model,
                             @RequestParam(required = false, defaultValue = "10") int pageSize,
@@ -317,6 +327,11 @@ public class ErrorController extends BaseController {
                     apply.setAuditPoint("财务审核");
                 }else{
                     apply.setAuditState(state);
+                    //财务审核通过后,设置学生服务失效
+                    //查询lib_id
+                    MerchantMealOrder mealOrder = mealOrderService.getById(apply.getMealOrderId());
+                    Merchant merchant = merchantService.getById(mealOrder.getMerchantId());
+                    merchantRefundService.invaldVips(apply.getVipIds(),merchant.getLibId());
                 }
             }
             merchantRefundService.save(apply);
@@ -344,6 +359,7 @@ public class ErrorController extends BaseController {
         Map<String, Object> params = new HashMap<String, Object>();
         //是否显示编辑服务时间 1不显示 2显示
         params.put("showEdit",1);
+        params.put("libId",request.getParameter("libId")==null?"":request.getParameter("libId"));
         params.put("stat",request.getParameter("stat")==null?"":request.getParameter("stat"));
         params.put("startDate",request.getParameter("startDate")==null?"":request.getParameter("startDate"));
         params.put("endDate",request.getParameter("endDate")==null?"":request.getParameter("endDate"));
@@ -352,7 +368,7 @@ public class ErrorController extends BaseController {
         params.put("pageNo",pageNo);
         String vipIds = request.getParameter("vipIds")==null?"":request.getParameter("vipIds");
         if(!"".equals(vipIds)){
-            params.put("vipIds",vipIds.replace("[","").replace("]","").split(","));
+            params.put("vipIds",Arrays.asList(vipIds.replace("[","").replace("]","").split(",")));
         }
 
         String classId = request.getParameter("classId")==null?"":request.getParameter("classId");

+ 93 - 37
src/main/resources/mybatis/mapper/CuratorMapper.xml

@@ -468,8 +468,8 @@
         <if test="map.serviceType != null and map.serviceType != '' and map.serviceType!='S999'">
         and t4.correct_type=#{map.serviceType}
     </if>
-        <if test="map.vipIds != null and map.vipIds != '' ">
-            where t2.id in
+        <if test="map.vipIds != null and map.vipIds.size >0 ">
+            and t2.id in
             <foreach collection="map.vipIds" open="(" item="type" separator="," close=")">
                 #{type}
             </foreach>
@@ -581,43 +581,99 @@
         </if>
     </select>
     <select id="searchHomeworkAllTop" resultType="java.util.Map">
-        SELECT sum(totolCount) as totolCount,a.lib_id,b.league_name from (
-            select count(1) as totolCount,t1.lib_id
-            from scon_homework_picture t
-            left join tb_lib_vip t1 on t.vip_id = t1.id
-            where is_delete = 0 and t1.lib_id is not null
-            <if test="startDate != null and startDate != '' ">
-                and t.create_time >= #{startDate}
-            </if>
-            <if test="endDate != null and endDate != '' ">
-                and #{endDate} >= t.create_time
-            </if>
-            <if test="subject != null and subject != '' ">
-                and t.subject = #{subject}
-            </if>
-            group  by t1.lib_id
-            order by totolCount desc)a join tb_lib_join b on a.lib_id = b.id
-            GROUP BY a.lib_id
-            order by totolCount desc
+        SELECT * from (
+            SELECT
+                b.id as lib_id,
+                b.league_name,
+            (
+                        select count(1)
+                        from
+                            scon_homework_picture t
+                 JOIN tb_lib_vip_service t1 ON t.vip_id = t1.vip_id
+                    where   	species = 'S003'
+        <if test="startDate != null and startDate != '' ">
+            and t.create_time >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and #{endDate} >= t.create_time
+        </if>
+        <if test="startDate != null and startDate != '' ">
+            and t1.end_time >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and #{endDate} >= t1.start_time
+        </if>
+        <if test="subject != null and subject != '' ">
+            and t.subject = #{subject}
+        </if>
+                        and t1.lib_id = b.id
+                    ) as totolCount
+            FROM
+                 tb_lib_join b
+	 ) a where a.totolCount>0
+	 order by a.totolCount desc
     </select>
     <select id="searchActiveTop" resultType="java.util.Map">
-        SELECT a.lib_id,a.league_name,sum(active_count) as active_count,a.all_vips,a.sign_type,sum(100*a.active_count/all_vips) as percent from (
-            select  t2.league_name,t1.lib_id ,
-            (select count(1) from tb_lib_vip a where a.lib_id = t1.lib_id) as all_vips,
-            count(distinct  t.vip_id) as active_count,case when t2.sign_type=0 then '旧' else '新' end sign_type
-            from scon_homework t
-            left join tb_lib_vip t1 on t.vip_id = t1.id
-            join tb_lib_join t2 on t1.lib_id = t2.id
-            where  1=1
-            <if test="startDate != null and startDate != '' ">
-                and t.create_time >= #{startDate}
-            </if>
-            <if test="endDate != null and endDate != '' ">
-                and #{endDate} >= t.create_time
-            </if>
-            group  by t1.lib_id
-        )a GROUP BY a.lib_id
-        order by percent desc,a.lib_id
+        SELECT
+        a.lib_id,
+        a.league_name,
+        count1 as active_count,
+        a.all_vips,
+        a.sign_type,
+        count1*100   / all_vips  AS percent
+        FROM
+        (
+
+        SELECT 	j.league_name,j.id as lib_id,
+        (
+        SELECT
+        count( DISTINCT a.vip_id )
+        FROM
+        tb_lib_vip_service a
+        WHERE
+        species = 'S003'
+        <if test="startDate != null and startDate != '' ">
+            and a.end_time >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and #{endDate} >= a.start_time
+        </if>
+        and a.lib_id=j.id
+        ) AS all_vips,
+        (
+        select count(DISTINCT t.vip_id)
+        from
+        scon_homework t
+        JOIN tb_lib_vip_service t1 ON t.vip_id = t1.vip_id
+        where  	species = 'S003'
+
+        <if test="startDate != null and startDate != '' ">
+            and t.create_time >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and #{endDate} >= t.create_time
+        </if>
+        <if test="startDate != null and startDate != '' ">
+            and t1.end_time >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and #{endDate} >= t1.start_time
+        </if>
+
+        and t1.lib_id = j.id
+        ) as count1,
+        CASE
+        WHEN j.sign_type = 0 THEN
+        '旧' ELSE '新'
+        END sign_type
+        from tb_lib_join j
+        )a
+        where a.count1>0
+        GROUP BY
+        a.lib_id
+        ORDER BY
+        percent DESC,
+        a.lib_id
     </select>
     <select id="selectCountByLibId" resultType="java.lang.Long">
         select count(1) from tb_lib_vip where lib_id=#{libId}

+ 3 - 1
src/main/resources/templates/sys/appinfo/appinfoAdd.html

@@ -84,7 +84,9 @@
 						<option  value="11" th:selected="${entity.type==11}" >小塾学伴pad(Android)</option>
 						<option  value="10" th:selected="${entity.type==10}" >小塾学伴(iOS)</option>
 						<option  value="9" th:selected="${entity.type==9}" >小塾学伴(Android)</option>
-						<option  value="9" th:selected="${entity.type==12}" >小塾学伴(小天才Android平台)</option>
+						<option  value="12" th:selected="${entity.type==12}" >小塾学伴(小天才Android平台)</option>
+						<option  value="13" th:selected="${entity.type==13}" >小蚁学堂(Android)</option>
+						<option  value="14" th:selected="${entity.type==14}" >小蚁学堂(iOS)</option>
 					</select>
 				</div>
 			</li>

+ 3 - 0
src/main/resources/templates/sys/appinfo/appinfoList.html

@@ -67,6 +67,9 @@
 				<span th:case="11">小塾学伴pad(Android)</span>
 				<span th:case="10">小塾学伴(iOS)</span>
 				<span th:case="9">小塾学伴(Android)</span>
+				<span th:case="12">小塾学伴(小天才Android平台)</span>
+				<span th:case="13">小蚁学堂(Android)</span>
+				<span th:case="14">小蚁学堂(iOS)</span>
 			</td>
 			<td>
 				<textarea readonly="readonly" rows="1">[[${item.updateContent}]]</textarea>

+ 1 - 1
src/main/resources/templates/sys/refund/refundList.html

@@ -95,7 +95,7 @@
 					<td><a th:if="${item.get('meal_order_id')}" th:href="@{/sys/fx/merchantMealList.html(orderId=${item.get('meal_order_id')})}"  class="tablelink" th:text="${item.get('meal_order_id')}"></a></td>
 					<td th:text="${item.get('refund_option')}"></td>
 					<td th:text="${item.get('other_reason')}"></td>
-					<td><a th:if="${item.get('student_count')}" th:href="@{/sys/error/vipList.html(vipIds=${item.get('vip_ids')})}"  class="tablelink" th:text="${item.get('student_count')}"></a></td>
+					<td><a th:if="${item.get('student_count')}" th:href="@{/sys/error/vipList.html(vipIds=${item.get('vip_ids')},libId=${item.get('lib_id')})}"  class="tablelink" th:text="${item.get('student_count')}"></a></td>
 					<td th:text="${item.get('unit_price')}"></td>
 					<td th:text="${item.get('refund_price')}"></td>
 					<td th:switch="${item.get('audit_state')}">