shenhao пре 2 година
родитељ
комит
6dabc7c9e5

+ 1 - 0
src/main/java/com/ssj/api/domain/vo/vacation/SumPrevMaterialUnitVO.java

@@ -63,6 +63,7 @@ public class SumPrevMaterialUnitVO extends BaseResponse {
     private String grade;
 
     private Date createTime;
+    private Integer unitShowSort;
 
     private List<Map<String,String>> videoList;
 

+ 19 - 10
src/main/java/com/ssj/api/filter/VacationExcelImportHelper.java

@@ -109,6 +109,7 @@ public class VacationExcelImportHelper {
         SumPrevMaterial prevMaterial = null;
         SumPrevMaterial temp = new SumPrevMaterial();
         int i = 0;
+        int unitShowSort = 1;
         for (SumPrevExcelImportVO schoolImport : dataList) {
             //判断 学科	版本	年级	教材链接	上下册 这5个相等那么就是同一条数据
              //(schoolImport.getSemester().equals("上册")?1:2)!=temp.getSemester()
@@ -118,6 +119,7 @@ public class VacationExcelImportHelper {
                     temp = new SumPrevMaterial();
                 }else{
                     prevMaterial = new SumPrevMaterial();
+                    unitShowSort = summerVacationService.getListSizeByParentId(temp.getId()).intValue() +1;
                     BeanUtils.copyProperties(temp,prevMaterial);
                 }
             }
@@ -126,16 +128,22 @@ public class VacationExcelImportHelper {
                     && (schoolImport.getSemester().equals("上册")?1:2) ==temp.getSemester()) {
 
             }else{
-                prevMaterial = new SumPrevMaterial();
-                prevMaterial.setCreateTime(new Date());
-                prevMaterial.setGrade(schoolImport.getGrade());
-                prevMaterial.setSemester(schoolImport.getSemester().equals("上册")?1:2);
-                prevMaterial.setMaterialLink(schoolImport.getMaterialLink());
-                prevMaterial.setSubject(schoolImport.getSubject());
-                prevMaterial.setVersionName(schoolImport.getVersionName());
-                prevMaterial.setVersionType(getVersionNameByType(schoolImport.getVersionName(),schoolImport.getSubject()));
-                prevMaterial.setCreateTime(new Date());
-                prevMaterialMapper.insert(prevMaterial);
+                prevMaterial = summerVacationService.findPreMaterialByAny(schoolImport.getSubject(),schoolImport.getVersionName(),schoolImport.getGrade(),schoolImport.getSemester());
+                if(prevMaterial == null){
+                    prevMaterial.setCreateTime(new Date());
+                    prevMaterial.setGrade(schoolImport.getGrade());
+                    prevMaterial.setSemester(schoolImport.getSemester().equals("上册")?1:2);
+                    prevMaterial.setMaterialLink(schoolImport.getMaterialLink());
+                    prevMaterial.setSubject(schoolImport.getSubject());
+                    prevMaterial.setVersionName(schoolImport.getVersionName());
+                    prevMaterial.setVersionType(getVersionNameByType(schoolImport.getVersionName(),schoolImport.getSubject()));
+                    prevMaterial.setCreateTime(new Date());
+                    prevMaterialMapper.insert(prevMaterial);
+                    unitShowSort = 1;
+                }else{
+                    unitShowSort = summerVacationService.getListSizeByParentId(temp.getId()).intValue() +1;
+                }
+
                 BeanUtils.copyProperties(prevMaterial,temp);
             }
             SumPrevMaterialUnit materialUnit = new SumPrevMaterialUnit();
@@ -146,6 +154,7 @@ public class VacationExcelImportHelper {
             materialUnit.setUnitSort(schoolImport.getUnitSort());
             materialUnit.setParentId(prevMaterial.getId());
             materialUnit.setSubject(schoolImport.getSubject());
+            materialUnit.setUnitShowSort(unitShowSort);
             materialUnit.setCreateTime(new Date());
             prevMaterialUnitMapper.insert(materialUnit);
         }

+ 3 - 0
src/main/java/com/ssj/bean/vacation/SumPrevMaterialUnit.java

@@ -69,4 +69,7 @@ public class SumPrevMaterialUnit {
     @TableField("create_time")
     private Date createTime;
 
+    @TableField("unit_show_sort")
+    private Integer unitShowSort;
+
 }

+ 7 - 1
src/main/java/com/ssj/dao/conch/curator/dao/IVacationLimitDao.java

@@ -32,6 +32,12 @@ public interface IVacationLimitDao extends JpaRepository<TbVacationLimit, String
             "  and lib_id = ?1 limit 1")
     TbVacationLimit findTopValidVocationLimit(String libId);
 
-    @Query(nativeQuery = true, value = "select * from tb_vacation_limit where lib_id=?1 and  (to_days(start_date) <= to_days(now()) AND to_days(end_date) >= to_days(now())) and limit_year=?2 order by type asc")
+    @Query(nativeQuery = true, value = "select t.* from tb_vacation_limit t \n" +
+            " join fx_merchant t11 on t.lib_id = t11.lib_id\n" +
+            "where t.lib_id=?1\n" +
+            "and  (to_days(t.start_date) <= to_days(now()) \n" +
+            "AND to_days(t.end_date) >= to_days(now())) \n" +
+            "and t.limit_year=?2 and TO_DAYS(t11.sign_time)<=TO_DAYS(NOW()) AND TO_DAYS(t11.end_sign_time)>TO_DAYS(NOW())\n" +
+            "order by t.type asc")
     List<TbVacationLimit> findValidVocationList(String libId, String year);
 }

+ 7 - 7
src/main/java/com/ssj/dao/sys/fx/dao/impl/FinanceQueryDaoImpl.java

@@ -542,7 +542,7 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
          
          
          selSql.append(" SELECT t.id,t.pos_code,t.unit_name,t.meal_type,me.sign_time,tmo.id as moid,IFNULL(tmo.unit_price,0) as price,tmo.lib_service ,tmo.sign_type, ? as balance_month from fx_merchant t  ");
-         selSql.append(" LEFT JOIN fx_merchant_meal me ON me.merchant_id=t.id AND me.type>1 AND DATE_FORMAT(me.sign_time,'%Y-%m')=? ");
+         selSql.append(" LEFT JOIN fx_merchant_meal me ON me.merchant_id=t.id AND me.type>2 AND DATE_FORMAT(me.sign_time,'%Y-%m')=? ");
          selSql.append(" LEFT JOIN fx_merchant_meal_order tmo ON me.order_id=tmo.id ");
          selSql.append(" WHERE t.`status`!=4 and t.sign_type>=1 and t.type in (5)  ");
          queryParams.add(params.get("startMonth"));
@@ -595,10 +595,10 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
          selSql.append("  SELECT t.id,t.pos_code,t.unit_name,t.type, ");
          
          selSql.append("  ( ");
-         selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>1 AND TO_DAYS( c.sign_time )< TO_DAYS( ? ) ");
+         selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>2 AND TO_DAYS( c.sign_time )< TO_DAYS( ? ) ");
          selSql.append("  ) AS init_1, ");
          selSql.append("  ( ");
-         selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>1 AND TO_DAYS( c.sign_time )< TO_DAYS( ? )  ");
+         selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>2 AND TO_DAYS( c.sign_time )< TO_DAYS( ? )  ");
          selSql.append("  ) AS init_2, ");
          selSql.append("  ( ");
          selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_sign c WHERE c.merchant_id = t.id AND TO_DAYS( c.sign_time )< TO_DAYS( ? )  ");
@@ -610,7 +610,7 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
          selSql.append("  	SELECT IFNULL( SUM( o.price ), 0 ) FROM fx_merchant_meal_order o  WHERE o.merchant_id = t.id AND TO_DAYS( o.create_time )< TO_DAYS( ? ) ");
          selSql.append("  ) AS ir_1, ");
          selSql.append("  ( ");
-         selSql.append("  	SELECT IFNULL(o.price*count(1)/(o.buy_month+o.give_month), 0 ) FROM fx_merchant_meal c LEFT JOIN fx_merchant_meal_order o ON c.order_id=o.id WHERE c.merchant_id = t.id AND c.type>1 AND c.remarks is NULL	 AND TO_DAYS( c.sign_time )< TO_DAYS( ?)  ");
+         selSql.append("  	SELECT IFNULL(o.price*count(1)/(o.buy_month+o.give_month), 0 ) FROM fx_merchant_meal c LEFT JOIN fx_merchant_meal_order o ON c.order_id=o.id WHERE c.merchant_id = t.id AND c.type>2 AND c.remarks is NULL	 AND TO_DAYS( c.sign_time )< TO_DAYS( ?)  ");
          selSql.append("  ) AS ir_2, ");
          selSql.append("  ( ");
          selSql.append("  	SELECT IFNULL( SUM( o.price ), 0 ) FROM fx_merchant_sign_order o  WHERE o.merchant_id = t.id  AND TO_DAYS( o.create_time )< TO_DAYS( ? ) ");
@@ -626,10 +626,10 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
          selSql.append("  ) AS ir_6, ");
          
          selSql.append("  ( ");
-         selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>1  AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
+         selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>2  AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
          selSql.append("  ) AS count_1, ");
          selSql.append("  ( ");
-         selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>1  AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
+         selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>2  AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
          selSql.append("  ) AS count_2, ");
          selSql.append("  ( ");
          selSql.append("  	SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_sign c WHERE c.merchant_id = t.id AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
@@ -641,7 +641,7 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
          selSql.append("  	SELECT IFNULL( SUM( o.price ), 0 ) FROM fx_merchant_meal_order o  WHERE o.merchant_id = t.id AND TO_DAYS( o.create_time )>= TO_DAYS( ? ) AND TO_DAYS( o.create_time )<= TO_DAYS(? ) ");
          selSql.append("  ) AS pr_1, ");
          selSql.append("  ( ");
-         selSql.append("  	SELECT IFNULL(sum(o.price/( o.buy_month + o.give_month)), 0 ) FROM fx_merchant_meal c LEFT JOIN fx_merchant_meal_order o ON c.order_id=o.id WHERE c.merchant_id = t.id AND c.type>1 AND (c.remarks  <> '开始计费期'  or c.remarks is null) AND TO_DAYS( c.sign_time )>= TO_DAYS( ?) AND TO_DAYS( c.sign_time )<= TO_DAYS(?) ");
+         selSql.append("  	SELECT IFNULL(sum(o.price/( o.buy_month + o.give_month)), 0 ) FROM fx_merchant_meal c LEFT JOIN fx_merchant_meal_order o ON c.order_id=o.id WHERE c.merchant_id = t.id AND c.type>2 AND (c.remarks  <> '开始计费期'  or c.remarks is null) AND TO_DAYS( c.sign_time )>= TO_DAYS( ?) AND TO_DAYS( c.sign_time )<= TO_DAYS(?) ");
          selSql.append("  ) AS pr_2, ");
          selSql.append("  ( ");
          selSql.append("  	SELECT IFNULL( SUM( o.price ), 0 ) FROM fx_merchant_sign_order o WHERE o.merchant_id = t.id  AND TO_DAYS( o.create_time )>= TO_DAYS( ? ) AND TO_DAYS( o.create_time )<= TO_DAYS(? ) ");

+ 1 - 1
src/main/java/com/ssj/dao/sys/fx/dao/impl/FxQueryDaoImpl.java

@@ -907,7 +907,7 @@ public class FxQueryDaoImpl implements FxQueryDao {
         selSql.append("  UNION ALL");
         selSql.append("  	SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,IF(t.remarks='开始计费期',0,o.unit_price),IF(t.remarks='开始计费期',0,o.price),o.buy_month,o.give_month,o.sign_type,o.type,t.lib_service,t.sign_time as time,2 as cap_type from fx_merchant_meal t  ");
         selSql.append("  	LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");
-        selSql.append(" 	LEFT JOIN fx_merchant_meal_order o ON t.order_id=o.id where t.status=1 and t.type>1 ");//激活期的流水,不统计到资金流水表
+        selSql.append(" 	LEFT JOIN fx_merchant_meal_order o ON t.order_id=o.id where t.status=1 and t.type>2 ");//激活期的流水,不统计到资金流水表
         selSql.append("  UNION ALL");
         selSql.append("  	SELECT m.id,m.type as merchant_type,m.pos_code,m.unit_name,0 as price,t.price,0 as buy_month,0 as give_month,0 as sign_type,0 as type,0 as lib_service,t.create_time as time,3 as cap_type from fx_merchant_plat_order t  ");
         selSql.append("   	LEFT JOIN fx_merchant m ON t.merchant_id=m.id ");

+ 2 - 0
src/main/java/com/ssj/service/vacation/ISummerVacationService.java

@@ -37,4 +37,6 @@ public interface ISummerVacationService {
     void delRevMaterialVersion(VersionVo param);
 
     SumPrevMaterial findPreMaterialByAny(String subject, String versionName, String grade, String semester);
+
+    Integer getListSizeByParentId(String id);
 }

+ 25 - 14
src/main/java/com/ssj/service/vacation/impl/SummerVacationServiceImpl.java

@@ -120,24 +120,30 @@ public class SummerVacationServiceImpl implements ISummerVacationService {
                     .eq("unit_id",sumPrevMaterial.getUnitId()));
         }
         List<VersionUnitListVo> list = param.getUnitList();
+        SumPrevMaterial sumPrevMaterial = prevMaterialMapper.selectById(param.getParentId());
+        int  unitShowSort = this.getListSizeByParentId(param.getParentId()).intValue() +1;
         if(list!=null && list.size()>0){
             for (VersionUnitListVo vo:list){
-                SumPrevMaterialUnit sumPrevMaterial = new SumPrevMaterialUnit();
-                sumPrevMaterial.setParentId(param.getParentId());
-                sumPrevMaterial.setUnitId(param.getUnitId());
-                sumPrevMaterial.setUnitName(param.getUnitName());
-                sumPrevMaterial.setVideoLink(vo.getVideoLink());
-                sumPrevMaterial.setVideoName(vo.getVideoName());
-                sumPrevMaterial.setCreateTime(new Date());
-                prevMaterialUnitMapper.insert(sumPrevMaterial);
+                SumPrevMaterialUnit sumPrevMaterialUnit = new SumPrevMaterialUnit();
+                sumPrevMaterialUnit.setParentId(param.getParentId());
+                sumPrevMaterialUnit.setUnitId(param.getUnitId());
+                sumPrevMaterialUnit.setUnitName(param.getUnitName());
+                sumPrevMaterialUnit.setVideoLink(vo.getVideoLink());
+                sumPrevMaterialUnit.setVideoName(vo.getVideoName());
+                sumPrevMaterialUnit.setCreateTime(new Date());
+                sumPrevMaterialUnit.setSubject(sumPrevMaterial.getSubject());
+                sumPrevMaterialUnit.setUnitShowSort(unitShowSort);
+                prevMaterialUnitMapper.insert(sumPrevMaterialUnit);
             }
         }else{
-            SumPrevMaterialUnit sumPrevMaterial = new SumPrevMaterialUnit();
-            sumPrevMaterial.setParentId(param.getParentId());
-            sumPrevMaterial.setUnitId(param.getUnitId());
-            sumPrevMaterial.setUnitName(param.getUnitName());
-            sumPrevMaterial.setCreateTime(new Date());
-            prevMaterialUnitMapper.insert(sumPrevMaterial);
+            SumPrevMaterialUnit sumPrevMaterialUnit = new SumPrevMaterialUnit();
+            sumPrevMaterialUnit.setParentId(param.getParentId());
+            sumPrevMaterialUnit.setUnitId(param.getUnitId());
+            sumPrevMaterialUnit.setUnitName(param.getUnitName());
+            sumPrevMaterialUnit.setCreateTime(new Date());
+            sumPrevMaterialUnit.setSubject(sumPrevMaterial.getSubject());
+            sumPrevMaterialUnit.setUnitShowSort(unitShowSort);
+            prevMaterialUnitMapper.insert(sumPrevMaterialUnit);
         }
 
     }
@@ -182,6 +188,11 @@ public class SummerVacationServiceImpl implements ISummerVacationService {
         return prevMaterialMapper.selectOne(new QueryWrapper<SumPrevMaterial>().eq("subject",subject).eq("grade",grade).eq("version_name",versionName).eq("semester",semester.equals("上册")?1:2));
     }
 
+    @Override
+    public Integer getListSizeByParentId(String id) {
+        return prevMaterialUnitMapper.selectCount(new QueryWrapper<SumPrevMaterialUnit>().eq("parent_id",id));
+    }
+
     private String getVersionNameByType(int type,String subject){
         Map<String, List<VersionConfig>> data = SystemResourceLocator.getVersionList(subject);
         String reStr = "";

+ 2 - 1
src/main/java/com/ssj/sys/controller/FxController.java

@@ -4494,6 +4494,7 @@ public class FxController  extends BaseController {
 					break;
 				case "2":
 					map.put("type","赠送");
+					map.put("unit_price",0);
 					break;
 				case "3":
 					map.put("type","购买");
@@ -5013,7 +5014,7 @@ public class FxController  extends BaseController {
         
         List<Map<String, Object>> mapList=page.getContent();
         for (Map<String, Object> map : mapList) {
-        	if(Integer.parseInt(map.get("cap_type").toString())==0) {
+        	if(Integer.parseInt(map.get("cap_type").toString())==1) {
         	    if(Integer.parseInt(map.get("lib_service").toString())==0){
                     map.put("pr_1","");
                 }else{

+ 2 - 2
src/main/resources/mybatis/mapper/SummerVacationMapper.xml

@@ -21,11 +21,11 @@
         order by create_time desc
     </select>
     <select id="getUnitList" resultType="com.ssj.api.domain.vo.vacation.SumPrevMaterialUnitVO">
-        select t.id,t.unit_name,t.unit_id,t11.version_type,t11.version_name,t11.grade,t.video_link,t.video_name,t.create_time
+        select t.id,t.unit_name,t.unit_id,t11.version_type,t11.version_name,t11.grade,t.video_link,t.video_name,t.create_time,t.unit_show_sort
         from tb_sum_prev_material_unit_xs t
         join tb_sum_prev_material_xs t11 on t.parent_id = t11.id
         where t11.id=#{id}
-         order by t.create_time desc
+         order by t.unit_show_sort asc
     </select>
     <select id="vacationRevPage" resultType="com.ssj.api.domain.vo.vacation.SumRevMaterialVO">
         select id,subject ,version_type,version_name

+ 5 - 1
src/main/resources/templates/sys/fx/merchantMealList.html

@@ -94,7 +94,11 @@
 					<td th:text="${item.lib_service}"></td>
 					<td th:text="${#calendars.format(item.sign_time,'yyyy-MM-dd')}" ></td>  
 					<td th:text="${#calendars.format(item.end_sign_time,'yyyy-MM-dd')}" ></td>  
-					<td th:text="${item.unit_price}"></td>
+					<td th:switch="${item.type}">
+						<span th:case="1" th:text="${item.unit_price}"></span>
+						<span th:case="2" >0</span>
+						<span th:case="3" th:text="${item.unit_price}"></span>
+					</td>
 					<td th:text="${#calendars.format(item.create_time,'yyyy-MM-dd HH:mm:ss')}" ></td>  
 			</tr>
 		</tbody>

+ 0 - 1
src/main/resources/templates/sys/vacation/review.html

@@ -1130,7 +1130,6 @@
         cursor: pointer;
     }
     .link2{
-        width: 120px;
         margin-top:5px;
         white-space: nowrap;
         overflow: hidden;