ソースを参照

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/ssj/dao/sys/train/dao/impl/TrainQueryDaoImpl.java
shenhao 5 年 前
コミット
1281c3c22d

+ 10 - 0
src/main/java/com/ssj/bean/sys/train/bean/ExamInfo.java

@@ -29,6 +29,8 @@ public class ExamInfo extends BaseEntity {
 	
 	private Integer score;
 	
+	private Integer status;
+	
 	private Date createTime;
 
 	public Integer getRoleType() {
@@ -103,6 +105,14 @@ public class ExamInfo extends BaseEntity {
 		this.score = score;
 	}
 
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
 	
 	
 }

+ 5 - 1
src/main/java/com/ssj/dao/sys/fx/dao/MerchantDao.java

@@ -43,8 +43,12 @@ public interface MerchantDao extends JpaRepository<Merchant, String> {
 	@Query(nativeQuery = true, value = " SELECT t.* from fx_merchant t LEFT JOIN tb_lib_vip v ON t.lib_id=v.lib_id WHERE v.id IS NOT NULL AND v.id=?1 ORDER BY t.create_time DESC LIMIT 1 ")
 	public Merchant getMerchantByVipId(String vipId);
 	
-	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type in (1,2,3) AND TO_DAYS(t.end_sign_time)<TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
+	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type in (1,2,3) AND TO_DAYS(t.end_sign_time)<=TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
 	public List<Merchant> findMerchantSignByEndTime();
 	
+	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type in (1,2,3) AND TO_DAYS(t.next_summary_time)<=TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
+	public List<Merchant> findMerchantSignBySummaryTime();
+	
+	
 	
 }

+ 1 - 1
src/main/java/com/ssj/dao/sys/train/dao/ExamInfoDao.java

@@ -12,7 +12,7 @@ import com.ssj.bean.sys.train.bean.ExamInfo;
 @Repository
 public interface ExamInfoDao extends JpaRepository<ExamInfo, String> {
 
-	@Query(nativeQuery = true,value = "SELECT * from tr_exam_info t WHERE t.video_id=?1 ORDER BY t.exam_num asc ")
+	@Query(nativeQuery = true,value = "SELECT * from tr_exam_info t WHERE t.status=1 and t.video_id=?1 ORDER BY t.exam_num asc ")
 	List<ExamInfo> findExamInfoByVideoId(String videoId);
 
 }

+ 6 - 0
src/main/java/com/ssj/dao/sys/train/dao/VideoInfoDao.java

@@ -12,4 +12,10 @@ public interface VideoInfoDao extends JpaRepository<VideoInfo, String> {
 
 	@Query(nativeQuery = true,value =  "SELECT * FROM tr_video_info t WHERE t.`status`=1 AND t.role_type=?1 AND t.indes>( SELECT v.indes from `tr_video_info` v WHERE v.id=?2 ) ORDER BY t.indes ASC LIMIT 1 ")
 	public VideoInfo getVideoInfoByMax(Integer roleType,String id);
+	
+	@Query(nativeQuery = true,value =  "SELECT * FROM tr_video_info t WHERE t.role_type=?1 AND t.indes=?2 LIMIT 1 ")
+	public VideoInfo getVideoInfoByIndes(Integer roleType,Integer indes);
+	
+	@Query(nativeQuery = true,value =  "SELECT * from tr_video_info t WHERE t.role_type=?1 ORDER BY t.indes desc LIMIT 1 ")
+	public VideoInfo getVideoInfoByMaxIndes(Integer roleType);
 }

+ 4 - 4
src/main/java/com/ssj/dao/sys/train/dao/impl/TrainQueryDaoImpl.java

@@ -24,9 +24,9 @@ public class TrainQueryDaoImpl  implements TrainQueryDao {
 	public Page<Map<String, Object>> findTrainVideoInfoByPage(Map<String, Object> params, Pageable pageable) {
 		StringBuilder sb = new StringBuilder();
 		List<Object> param = new ArrayList<>();
-        sb.append(" SELECT * from tr_video_info t WHERE 1=1 ");
+        sb.append(" SELECT *,(SELECT count(1) from tr_exam_info e WHERE e.status=1 and e.video_id=t.id ) as exam_num from tr_video_info t WHERE 1=1 ");
         if(params.get("roleType")!=null && StringUtils.isNotEmpty(params.get("roleType").toString())) {
-       	 	sb.append(" t.role_type=?  ");
+       	 	sb.append(" and t.role_type=?  ");
        	 	param.add(params.get("roleType"));
         }
         if(params.get("module")!=null && StringUtils.isNotEmpty(params.get("module").toString())) {
@@ -41,7 +41,7 @@ public class TrainQueryDaoImpl  implements TrainQueryDao {
        	  	sb.append(" and t.status =? ");
        	  	param.add(params.get("status"));
         }
-        sb.append(" ORDER BY t.indes ASC,t.create_time DESC ");
+        sb.append(" ORDER BY t.role_type ASC,t.indes ASC ");
         return dao.findPage(sb.toString(),param.toArray(),pageable);
 	}
 
@@ -223,7 +223,7 @@ public class TrainQueryDaoImpl  implements TrainQueryDao {
        	  	sb.append(" AND t.title like concat('%',?,'%')  ");
        	  	param.add(params.get("name"));
         }
-        sb.append("  ORDER BY t.create_time DESC ");
+        sb.append("  ORDER BY t.type ASC,t.create_time DESC ");
         return dao.findPage(sb.toString(),param.toArray(),pageable);
 	}
 

+ 34 - 33
src/main/java/com/ssj/framework/core/xss/XssAndSqlHttpServletRequestWrapper.java

@@ -111,39 +111,40 @@ public class XssAndSqlHttpServletRequestWrapper extends HttpServletRequestWrappe
      * @return
      */
     private static String xssEncode(String s) {
-        if (s == null || s.isEmpty()) {
-            return s;
-        } else {
-            s = stripXSSAndSql(s);
-        }
-        StringBuilder sb = new StringBuilder(s.length() + 16);
-        for (int i = 0; i < s.length(); i++) {
-            char c = s.charAt(i);
-            switch (c) {
-                case '>':
-                    sb.append(">");// 转义大于号
-                    break;
-                case '<':
-                    sb.append("<");// 转义小于号
-                    break;
-                // case '\'':
-                // sb.append("'");// 转义单引号
-                // break;
-                // case '\"':
-                // sb.append(""");// 转义双引号
-                // break;
-                case '&':
-                    sb.append("&");// 转义&
-                    break;
-                case '#':
-                    sb.append("#");// 转义#
-                    break;
-                default:
-                    sb.append(c);
-                    break;
-            }
-        }
-        return sb.toString();
+    	return s;
+//        if (s == null || s.isEmpty()) {
+//            return s;
+//        } else {
+//            s = stripXSSAndSql(s);
+//        }
+//        StringBuilder sb = new StringBuilder(s.length() + 16);
+//        for (int i = 0; i < s.length(); i++) {
+//            char c = s.charAt(i);
+//            switch (c) {
+//                case '>':
+//                    sb.append(">");// 转义大于号
+//                    break;
+//                case '<':
+//                    sb.append("<");// 转义小于号
+//                    break;
+//                // case '\'':
+//                // sb.append("'");// 转义单引号
+//                // break;
+//                // case '\"':
+//                // sb.append(""");// 转义双引号
+//                // break;
+//                case '&':
+//                    sb.append("&");// 转义&
+//                    break;
+//                case '#':
+//                    sb.append("#");// 转义#
+//                    break;
+//                default:
+//                    sb.append(c);
+//                    break;
+//            }
+//        }
+//        return sb.toString();
     }
 
     /**

+ 1 - 1
src/main/java/com/ssj/quartz/web/JobController.java

@@ -39,7 +39,7 @@ public class JobController{
     @PostConstruct
     public void initialize() {
         try {
-            reStartAllJobs();
+            //reStartAllJobs();
             logger.info("INIT SUCCESS");
         } catch (Exception e) {
             logger.info("INIT EXCEPTION : " + e.getMessage());

+ 2 - 0
src/main/java/com/ssj/service/sys/fx/service/MerchantService.java

@@ -129,6 +129,8 @@ public interface MerchantService extends BaseService<Merchant, String> {
 	//套餐过期的商户
 	List<Merchant> findMerchantSignByEndTime();
 	
+	List<Merchant> findMerchantSignBySummaryTime();
+	
 
 
 }

+ 5 - 0
src/main/java/com/ssj/service/sys/fx/service/impl/MerchantServiceImpl.java

@@ -1207,6 +1207,11 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 	public List<Merchant> findMerchantSignByEndTime() {
 		return dao.findMerchantSignByEndTime();
 	}
+
+	@Override
+	public List<Merchant> findMerchantSignBySummaryTime() {
+		return dao.findMerchantSignBySummaryTime();
+	}
 	
 
 }

+ 73 - 0
src/main/java/com/ssj/service/sys/fx/service/impl/MerchantSignServiceImpl.java

@@ -18,11 +18,14 @@ import com.ssj.bean.sys.fx.domain.Merchant;
 import com.ssj.bean.sys.fx.domain.MerchantSign;
 import com.ssj.bean.weixin.libmy.domain.LibVip;
 import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
+import com.ssj.bean.weixin.libmy.domain.TbLibJoinConsume;
 import com.ssj.dao.sys.fx.dao.FxQueryDao;
 import com.ssj.dao.sys.fx.dao.MerchantSignDao;
+import com.ssj.framework.basic.utils.DateHelper;
 import com.ssj.framework.core.common.service.BaseServiceImpl;
 import com.ssj.service.sys.fx.service.MerchantService;
 import com.ssj.service.sys.fx.service.MerchantSignService;
+import com.ssj.service.weixin.library.service.ILibJoinConsumeService;
 import com.ssj.service.weixin.library.service.ILibJoinService;
 import com.ssj.service.weixin.library.service.ILibVipService;
 
@@ -45,6 +48,9 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 	private ILibJoinService libJoinService;
 	
 	@Autowired
+	private ILibJoinConsumeService libJoinConsumeService;
+	
+	@Autowired
 	private ILibVipService libVipService;
 	
     @Override
@@ -81,6 +87,18 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 						
 					}
 				}
+				
+				//记录加油包记录
+				TbLibJoinConsume consume=new TbLibJoinConsume();
+				consume.setFromLibId(merchant.getLibId());
+				consume.setFromMerchantId(merchant.getId());
+				consume.setLibService(merchantSign.getLibService());
+				consume.setPlatformService(0);
+				consume.setType(2);
+				consume.setRemarks("消费【加油包过期】");
+				consume.setCreateTime(new Date());
+				libJoinConsumeService.save(consume);
+				
 			} catch (Exception e) {
 				e.printStackTrace();
 			}
@@ -90,6 +108,7 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 		//2:处理商户主套餐过期的数据
 		List<Merchant> merchants=merchantService.findMerchantSignByEndTime();
 		for (Merchant merchant : merchants) {
+			Integer libService=merchant.getLibService();
 			try {
 				List<MerchantSign> signs=this.findMerchantSignByMerchantId(merchant.getId(), 0);
 				for (MerchantSign merchantSign : signs) {
@@ -101,15 +120,57 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 				
 				merchant.setSignTime(null);
 				merchant.setEndSignTime(null);
+				merchant.setCurSummaryTime(null);
+				merchant.setNextSummaryTime(null);
 				merchant.setLibService(0);
 				merchantService.save(merchant);
 				
 				this.syncMerchantByLibJoin(merchant);
+				
+				try {
+					//记录
+					TbLibJoinConsume consume=new TbLibJoinConsume();
+					consume.setFromLibId(merchant.getLibId());
+					consume.setFromMerchantId(merchant.getId());
+					consume.setLibService(libService);
+					consume.setPlatformService(0);
+					consume.setType(2);
+					consume.setRemarks("消费【主套餐过期】");
+					consume.setCreateTime(new Date());
+					libJoinConsumeService.save(consume);
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+				
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		
+		//2:处理商户结算的数据
+		List<Merchant> summaryMerchants=merchantService.findMerchantSignBySummaryTime();
+		for (Merchant merchant : summaryMerchants) {
+			try {
+				//记录
+				TbLibJoinConsume consume=new TbLibJoinConsume();
+				consume.setToLibId(merchant.getLibId());
+				consume.setToMerchantId(merchant.getId());
+				consume.setLibService(merchant.getLibService());
+				consume.setPlatformService(0);
+				consume.setType(2);
+				consume.setRemarks("消费【套餐月结算】");
+				consume.setCreateTime(new Date());
+				libJoinConsumeService.save(consume);
 			} catch (Exception e) {
 				e.printStackTrace();
 			}
 			
+			merchant.setCurIsSummary(0);
+			merchant.setCurSummaryTime(new Date());
+			merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
+			merchantService.save(merchant);
 		}
+		
 	}
     
     
@@ -154,6 +215,18 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 		
 		//同步商户表与机构表
 		this.syncMerchantByLibJoin(merchant);
+		
+		//记录加油包记录
+		TbLibJoinConsume consume=new TbLibJoinConsume();
+		consume.setToLibId(merchant.getLibId());
+		consume.setToMerchantId(merchant.getId());
+		consume.setLibService(merchantSign.getLibService());
+		consume.setPlatformService(0);
+		consume.setType(1);
+		consume.setRemarks("加油包充值");
+		consume.setCreateTime(new Date());
+		libJoinConsumeService.save(consume);
+		
 	}
 
 	

+ 59 - 14
src/main/java/com/ssj/service/sys/role/service/impl/AdminServiceImpl.java

@@ -1,10 +1,29 @@
 package com.ssj.service.sys.role.service.impl;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.ssj.bean.sys.fx.domain.Merchant;
 import com.ssj.bean.sys.fx.domain.MerchantArea;
 import com.ssj.bean.sys.role.domain.Admin;
 import com.ssj.bean.sys.role.domain.AdminRole;
 import com.ssj.bean.sys.role.domain.Role;
+import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
+import com.ssj.bean.weixin.libmy.domain.TbLibJoinConsume;
 import com.ssj.dao.sys.role.dao.AdminDao;
 import com.ssj.dao.sys.role.dao.AdminRoleDao;
 import com.ssj.dao.sys.role.dao.RoleQueryDao;
@@ -17,18 +36,8 @@ import com.ssj.service.sys.fx.service.MerchantAreaService;
 import com.ssj.service.sys.fx.service.MerchantService;
 import com.ssj.service.sys.role.service.AdminService;
 import com.ssj.service.sys.role.service.RoleService;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.data.repository.PagingAndSortingRepository;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
+import com.ssj.service.weixin.library.service.ILibJoinConsumeService;
+import com.ssj.service.weixin.library.service.ILibJoinService;
 @Service
 @Transactional
 public class AdminServiceImpl extends BaseServiceImpl<Admin, String> implements AdminService {
@@ -54,6 +63,12 @@ public class AdminServiceImpl extends BaseServiceImpl<Admin, String> implements
 	private MerchantAreaService merchantAreaService;
 	
 	@Autowired
+	private ILibJoinService libJoinService;
+	
+	@Autowired
+	private ILibJoinConsumeService libJoinConsumeService;
+	
+	@Autowired
 	private RedisUtil redisUtil;
 	
 	@Override
@@ -153,9 +168,39 @@ public class AdminServiceImpl extends BaseServiceImpl<Admin, String> implements
 				}
 				merchantAreaService.save(merchantAreas);
 			}
+			
 			merchantService.save(merchant);
-			//计算结算日期。
-			merchantService.computeMerchantSummaryTime(merchant);
+			
+			//商户同步学币/人数 到机构 / 时间
+			if(StringUtils.isNotEmpty(merchant.getLibId())) {
+				TbLibJoin  libJoin= libJoinService.getById(merchant.getLibId());
+				if(libJoin!=null) {
+					libJoin.setLibService(merchant.getLibService());
+					libJoin.setPlatformService(merchant.getPlatformService());
+					
+					libJoin.setSignType(merchant.getSignType());
+					libJoin.setSignTime(merchant.getSignTime());
+					libJoin.setEndSignTime(merchant.getEndSignTime());
+					
+					libJoinService.save(libJoin);
+				}	
+			}
+			
+			if(merchant.getSignType()==0) {
+				//判断的是否是旧模式兼容,修改了签约的时间,重新计算结算时间
+				merchantService.computeMerchantSummaryTime(merchant);
+			}else {
+				//记录加油包记录
+				TbLibJoinConsume consume=new TbLibJoinConsume();
+				consume.setToLibId(merchant.getLibId());
+				consume.setToMerchantId(merchant.getId());
+				consume.setLibService(merchant.getLibService());
+				consume.setPlatformService(0);
+				consume.setType(1);
+				consume.setRemarks("充值【套餐模式开通】");
+				consume.setCreateTime(new Date());
+				libJoinConsumeService.save(consume);
+			}
 			merchantService.syncRecordByMerchant(sessionUserName, merchant.getId(),ip, "新增商户");
 		}
 		return admin;

+ 4 - 0
src/main/java/com/ssj/service/sys/train/service/VideoInfoService.java

@@ -20,4 +20,8 @@ public interface VideoInfoService extends BaseService<VideoInfo, String> {
 	
 	public VideoInfo getVideoInfoByMax(Integer roleType,String id);
 	
+	public VideoInfo getVideoInfoByIndes(Integer roleType,Integer indes);
+	
+	public VideoInfo getVideoInfoByMaxIndes(Integer roleType);
+	
 }

+ 10 - 0
src/main/java/com/ssj/service/sys/train/service/impl/VideoInfoServiceImpl.java

@@ -50,6 +50,16 @@ public class VideoInfoServiceImpl extends BaseServiceImpl<VideoInfo, String> imp
 	public VideoInfo getVideoInfoByMax(Integer roleType, String id) {
 		return videoInfoDao.getVideoInfoByMax(roleType, id);
 	}
+
+	@Override
+	public VideoInfo getVideoInfoByIndes(Integer roleType, Integer indes) {
+		return videoInfoDao.getVideoInfoByIndes(roleType, indes);
+	}
+
+	@Override
+	public VideoInfo getVideoInfoByMaxIndes(Integer roleType) {
+		return videoInfoDao.getVideoInfoByMaxIndes(roleType);
+	}
 	
 	
 

+ 27 - 6
src/main/java/com/ssj/sys/controller/FxController.java

@@ -56,6 +56,7 @@ import com.ssj.bean.sys.fx.domain.MerchantSign;
 import com.ssj.bean.sys.organization.domain.Organization;
 import com.ssj.bean.sys.role.domain.Admin;
 import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
+import com.ssj.bean.weixin.libmy.domain.TbLibJoinConsume;
 import com.ssj.bean.weixin.problem.domain.CnArea;
 import com.ssj.framework.basic.common.bean.SplitPage;
 import com.ssj.framework.basic.utils.DateHelper;
@@ -1391,8 +1392,9 @@ public class FxController  extends BaseController {
 				merchantAreaService.save(merchantAreas);
 			}
 			
-			//如果修改了套餐的模式,就重新处理数据,清理加油包
-			if(oldmerchant.getSignType()!=merchant.getSignType()) {
+			Integer mealNum=0;
+			//如果修改了套餐的模式,就重新处理数据 加油包
+			if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
 				oldmerchant.setSignType(merchant.getSignType());
 				List<MerchantSign> merchantSigns=merchantSignService.findMerchantSignByMerchantId(merchant.getId(),0);
 				Integer signNum=0;
@@ -1402,18 +1404,20 @@ public class FxController  extends BaseController {
 				switch (merchant.getSignType()) {
 				case 1:
 					oldmerchant.setLibService(30+signNum);
+					mealNum=30;
 					break;
 				case 2:
 					oldmerchant.setLibService(50+signNum);
+					mealNum=50;
 					break;
 				case 3:
 					oldmerchant.setLibService(100+signNum);
+					mealNum=100;
 					break;
 				default:
 					oldmerchant.setLibService(0);
 					break;
 				}
-
 			}
 			
 			//判断的是否是旧模式兼容,修改了签约的时间,重新计算结算时间
@@ -1432,8 +1436,8 @@ public class FxController  extends BaseController {
 			}else {
 				oldmerchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
 				oldmerchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
-				oldmerchant.setCurSummaryTime(null);
-				oldmerchant.setNextSummaryTime(null);
+				oldmerchant.setCurSummaryTime(oldmerchant.getSignTime());
+				oldmerchant.setNextSummaryTime(DateHelper.getMonthDate(oldmerchant.getCurSummaryTime(),1));
 			}
 			
 			//商户同步学币/人数 到机构 / 时间
@@ -1453,6 +1457,20 @@ public class FxController  extends BaseController {
 			
 			merchantService.save(oldmerchant);
 			merchantService.syncRecordByMerchant(curadmin.getLoginName(), oldmerchant.getId(),WebUtil.getRemoteAddr(request), "修改商户");
+			
+			//记录加油包记录
+			if(mealNum>0) {
+				TbLibJoinConsume consume=new TbLibJoinConsume();
+				consume.setToLibId(merchant.getLibId());
+				consume.setToMerchantId(merchant.getId());
+				consume.setLibService(oldmerchant.getLibService());
+				consume.setPlatformService(0);
+				consume.setType(1);
+				consume.setRemarks("充值【套餐模式更改】");
+				consume.setCreateTime(new Date());
+				libJoinConsumeService.save(consume);
+			}
+			
 		}else{
 			List<Merchant> posCodeMerchants=merchantService.getMerchantByLikePosCode(merchant.getPosCode());
 			if(posCodeMerchants!=null && posCodeMerchants.size()>0){
@@ -1480,6 +1498,10 @@ public class FxController  extends BaseController {
 			
 			merchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
 			merchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
+			if(merchant.getSignType()!=0) {
+				merchant.setCurSummaryTime(merchant.getSignTime());
+				merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
+			}
 			switch (merchant.getSignType()) {
 			case 1:
 				merchant.setLibService(30);
@@ -1494,7 +1516,6 @@ public class FxController  extends BaseController {
 				merchant.setLibService(0);
 				break;
 			}
-			
 			adminService.saveFXAdmin(merchant, password, curadmin.getLoginName(), province, city, area,schoollist,WebUtil.getRemoteAddr(request));
 		}
 		response.success("成功");

+ 42 - 11
src/main/java/com/ssj/sys/controller/TrainController.java

@@ -54,7 +54,7 @@ public class TrainController extends BaseController {
 			throws Exception {
 		
 		Map<String, Object> params = new HashMap<String, Object>();
-		params.put("rolType", request.getParameter("rolType")==null?"":request.getParameter("rolType"));
+		params.put("roleType", request.getParameter("roleType")==null?"1":request.getParameter("roleType"));
 		params.put("module", request.getParameter("module")==null?"":request.getParameter("module"));
 		params.put("title", request.getParameter("title")==null?"":request.getParameter("title"));
 		params.put("index", request.getParameter("index")==null?"":request.getParameter("index"));
@@ -95,7 +95,6 @@ public class TrainController extends BaseController {
     	if(StringUtils.isNotEmpty(param.getId())) {
 	    	VideoInfo videoInfo=videoInfoService.getById(param.getId());
 	    	videoInfo.setDescription(param.getDescription());
-	    	videoInfo.setIndes(param.getIndes());
 	    	videoInfo.setModule(param.getModule());
 	    	videoInfo.setRoleType(param.getRoleType());
 	    	videoInfo.setStatus(param.getStatus());
@@ -103,17 +102,39 @@ public class TrainController extends BaseController {
 	    	videoInfo.setUpdateTime(new Date());
 	    	videoInfoService.save(videoInfo);
     	}else {
+    		Integer indes=1;
+    		VideoInfo maxVideoInfo=videoInfoService.getVideoInfoByMaxIndes(param.getRoleType());
+    		if(maxVideoInfo!=null) {
+    			indes=maxVideoInfo.getIndes()+1;
+    		}
+    		param.setIndes(indes);
     		param.setCreateTime(new Date());
     		videoInfoService.save(param);
     	}
     	response.success();
     	return response;
 	 }
+	 
+	 
+	 @RequestMapping("/video/indes/update")
+	 @ResponseBody
+	 public Response videoIndesUpdate(Model model,String id,Integer indes) throws Exception{
+    	Response response = new  Response();
+    	if(StringUtils.isNotEmpty(id)) {
+	    	VideoInfo videoInfo=videoInfoService.getById(id);
+	    	VideoInfo indesVideoInfo=videoInfoService.getVideoInfoByIndes(videoInfo.getRoleType(), indes);
+	    	if(indesVideoInfo!=null) {
+	    		response.failure("排序号,同端下不可重复喔,请重新填写。");
+	    		return response;
+	    	}
+	    	videoInfo.setIndes(indes);
+	    	videoInfoService.save(videoInfo);
+    	}
+    	response.success();
+    	return response;
+	 }
 	
 	
-	
-
-	
 	@RequestMapping("/pace/list")
 	public String paceList(Model model,
 			@RequestParam(required = false, defaultValue = "10") int pageSize,
@@ -178,12 +199,13 @@ public class TrainController extends BaseController {
 	
 	@RequestMapping("/import/exam/info")
 	@ResponseBody
-    public ResponseEntity importDeviceData(HttpServletRequest request, HttpServletResponse response,
+    public Response importDeviceData(HttpServletRequest request, 
     		@RequestParam("file") MultipartFile file,String videoId)
     				throws Exception {
-		ResponseEntity responseEntity = new  ResponseEntity();
+		Response response = new  Response();
 		try {
 			VideoInfo videoInfo=videoInfoService.getById(videoId);
+			List<ExamInfo> oldExamInfos=examInfoService.findExamInfoByVideoId(videoId);
 			List<Map<String,String>> datas=ImLibUserController.analysisExFile(file);
 			if(datas!=null && datas.size()>0){
 				List<ExamInfo> examInfos=new ArrayList<ExamInfo>();
@@ -198,6 +220,7 @@ public class TrainController extends BaseController {
 					examInfo.setOptions(map.get("data_3"));
 					examInfo.setAnswer(map.get("data_4"));
 					examInfo.setScore(Integer.valueOf(map.get("data_5")));
+					examInfo.setStatus(1);
 					if(map.containsKey("data_6") && StringUtils.isNotEmpty(map.get("data_6"))) {
 						examInfo.setId(map.get("data_6"));
 					}
@@ -206,12 +229,18 @@ public class TrainController extends BaseController {
 				}
 				examInfoService.save(examInfos);
 			}
-			
+			if(oldExamInfos!=null && oldExamInfos.size()>0){
+				for (ExamInfo examInfo : oldExamInfos) {
+					examInfo.setStatus(2);
+				}
+				examInfoService.save(oldExamInfos);
+			}
+			response.success();
 		} catch (Exception e) {
 			logger.error("异常", e);
-			responseEntity.failure("导入异常:"+e.getMessage());
+			response.failure("导入异常:"+e.getMessage());
 		}
-		return responseEntity;
+		return response;
     }
 	
 	
@@ -224,7 +253,7 @@ public class TrainController extends BaseController {
 		
 		Map<String, Object> params = new HashMap<String, Object>();
 		params.put("type", request.getParameter("type")==null?"":request.getParameter("type"));
-		params.put("rolType", request.getParameter("rolType")==null?"":request.getParameter("rolType"));
+		params.put("roleType", request.getParameter("roleType")==null?"":request.getParameter("roleType"));
 		params.put("module", request.getParameter("module")==null?"":request.getParameter("module"));
 		params.put("title", request.getParameter("title")==null?"":request.getParameter("title"));
 		
@@ -264,10 +293,12 @@ public class TrainController extends BaseController {
     	if(StringUtils.isNotEmpty(param.getId())) {
     		VideoFile videoFile=videoFileService.getById(param.getId());
     		videoFile.setModule(param.getModule());
+    		videoFile.setType(param.getType());
     		videoFile.setRoleType(param.getRoleType());
     		videoFile.setStatus(param.getStatus());
     		videoFile.setTitle(param.getTitle());
     		videoFile.setFormat(param.getFormat());
+    		videoFile.setUrl(param.getUrl());
     		videoFile.setUpdateTime(new Date());
     		videoFileService.save(videoFile);
     	}else {

+ 2 - 0
src/main/resources/templates/sys/fx/consumeList.html

@@ -105,6 +105,7 @@
  		    	<th style="width: 6%">平台塾币</th>
 <!-- 		        <th>备注</th>  -->
 		        <th style="width: 10%">操作时间</th> 
+		        <th style="width: 100px">备注</th>
 		    </tr>
 		</thead>
 		<tbody>
@@ -135,6 +136,7 @@
 					<td th:text="${item.platform_service}"></td>
 <!-- 					<td th:text="${item.remarks}"></td>  -->
 					<td th:text="${#calendars.format(item.create_time,'yyyy-MM-dd HH:mm:ss')}" ></td>  
+					<td th:text="${item.remarks}"></td>
 			</tr>
 		</tbody>
 	</table>

+ 4 - 4
src/main/resources/templates/sys/fx/merchantAdd.html

@@ -126,12 +126,12 @@ dtext{
 				<div class="vocation" style="margin-right: 5px; width: 345px">
 					<select name="signType" id="signType" class="select1"  > 
 						<option value="0" th:selected="${merchant.signType==0 ? true : false}">旧模式</option>
-						<option value="1" th:selected="${merchant.signType==1 ? true : false}">优选套餐</option>
-						<option value="2" th:selected="${merchant.signType==2 ? true : false}">VIP套餐</option>
-						<option value="3" th:selected="${merchant.signType==3 ? true : false}">尊享套餐</option>
+						<option value="1" th:selected="${merchant.signType==1 ? true : false}">优选套餐(服务包1)</option>
+						<option value="2" th:selected="${merchant.signType==2 ? true : false}">VIP套餐(服务包2)</option>
+						<option value="3" th:selected="${merchant.signType==3 ? true : false}">尊享套餐(服务包3)</option>
 					</select>
 				</div>
-				<label th:if="${merchant.id!=null}"  style="width: 230px;color:red">[修改套餐模式,会直接影响加油包有效性 ]</label>
+				<label th:if="${merchant.id!=null}"  style="width: 230px;color:red">[修改套餐模式,会影响加油包有效性 ]</label>
 			</li>
 			
 			<li>

+ 4 - 48
src/main/resources/templates/sys/train/file_edit.html

@@ -129,51 +129,9 @@
 </div>
 </body>
 
-<!--视频插件调用方法-->
-<script>
-$(function () {
-	//视频
-	jsModern.video("#video");
-	//播放视频
-	$(".VideoBtn").click(function () {
-		var video = document.getElementById("videoShow");
-		video.play();
-		$('.VideoBtn').hide();
-	})
-})
-</script>
 
-<script type="text/javascript">
-var tool = 
-	[
-		"fullscreen", "undo", "redo", "|",
-		"bold", "italic", "underline", "fontborder", "strikethrough", "superscript", "subscript", "removeformat", "formatmatch", "autotypeset", "blockquote", "pasteplain", "|", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "cleardoc", "|",
-		"rowspacingtop", "rowspacingbottom", "lineheight", "|",
-		"customstyle", "paragraph", "fontfamily", "fontsize", "|",
-		"directionalityltr", "directionalityrtl", "indent", "|",
-		"justifyleft", "justifycenter", "justifyright", "justifyjustify", "|", "touppercase", "tolowercase", "|",
-		"imagenone", "imageleft", "imageright", "imagecenter", "|",
-		"emotion","pagebreak", "template", "|",
-		"horizontal", "date", "time", "spechars",  "|",
-		"inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "charts", "|",
-		"preview", "searchreplace","drafts" 
-		];
-          
-var editor = new baidu.editor.ui.Editor({
-	//toolbars: [tool],
-	elementPathEnabled : false
-    ,wordCount:false         //是否开启字数统计
-    ,maximumWords:2000       //允许的最大字符数
-    ,wordCountMsg:'当前已输入 {#count} 个字符,您还可以输入{#leave} 个字符'
-    //超出字数限制提示  留空支持多语言自动切换,否则按此配置显示
-    ,wordOverFlowMsg:'<span style="color:red;">你输入的字符个数已经超出最大允许值!</span>' 
-});
-
-$(function(){
-	editor.render('editor');
-	editor.ready( function () { editor.setContent( $('#description').val() ); });  
-});
-</script>
+
+
 
 <script type="text/javascript">
 $(function () {
@@ -181,16 +139,14 @@ $(function () {
 })
 
 function saveFrom(){
-	var contents = UE.getEditor('editor').getContent();
-	$('#description').val(contents);
-	var url="[[${sysUrl}]]/sys/train/video/save";
+	var url="[[${sysUrl}]]/sys/train/file/save";
 	var params = $("#submitFrom").serialize();
 	$.post(url,params,function(data){
 		if(data != null){
 				if(data.meta.success){
 					layer.msg("操作成功!",{icon:1});
 			    	setTimeout(function(){
-			    		window.location.href ='[[${sysUrl}]]/sys/train/video/list.html';
+			    		window.location.href ='[[${sysUrl}]]/sys//train/file/list.html';
 					},1000);
 				}else{
 					layer.msg(data.meta.message,{icon:11});

+ 4 - 4
src/main/resources/templates/sys/train/video_edit.html

@@ -103,10 +103,10 @@
 				<label>资料路径:<b>*</b></label>
 				<input type="text" name="url" class="dfinput fl" id="url" th:value="${videoInfo.url}"/>
 			</li>
-			<li class="clearfix" >
-				<label>排序(顺序):<b>*</b></label>
-				<input type="text" name="indes" class="dfinput fl" id="index" th:value="${videoInfo.indes}"/>
-			</li>
+<!-- 			<li class="clearfix" > -->
+<!-- 				<label>排序(顺序):<b>*</b></label> -->
+<!-- 				<input type="number" name="indes" class="dfinput fl" id="index" th:value="${videoInfo.indes}"/> -->
+<!-- 			</li> -->
 			<li class="clearfix" >
 				<label>发布状态:<b>*</b></label>
 				<select class="scinput select_width"  name="status"   style="width: 345px;" >

+ 32 - 8
src/main/resources/templates/sys/train/video_list.html

@@ -102,6 +102,7 @@
 		    	<th >排序(从小到大)</th>
 		    	<th >状态 </th>
 		    	<th >上传时间 </th>
+		    	<th >小测题量 </th>
 		    	<th >操作 </th>
 		    </tr> 
 		</thead>
@@ -117,13 +118,16 @@
 				<td th:text="${item.module}"></td>
 				<td th:text="${item.title}"></td>
 				<td th:text="${item.url}"></td>
-				<td th:text="${item.indes}"></td>
+				<td >
+					<input type="number" th:value="${item.indes}" th:onBlur="'updateIndes(\''+${item.id}+'\',this)'" class="dfinput" style="width: 60px; height: 30px;">
+				</td>
 				<td  th:switch="${item.status}">
 				   <span th:case="0" >未发布</span>
 				   <span th:case="1" >发布</span>
 				   <span th:case="2" style="color:red">已下架</span>
 				</td>
 				<td th:text="${item.create_time}"></td>
+				<td th:text="${item.exam_num}"></td>
 				<td >
 					<a th:href="@{/sys/train/video/edit.html(id=${item.id})}" class="tablelink">编辑</a>
 					<a href="javascript:;"  th:if="${item.status==0 || item.status==2 }" th:onclick="'joinServiceEdit(\''+${item.id}+'\')'" class="tablelink">发布</a>
@@ -158,10 +162,10 @@ $(function () {
 	            contentType: false,
 	            processData: false,
 	            success: function (data) {
-	                if (data.status == "success") {
+	            	if(data.meta.success){
 	                	parent.layer.msg("导入成功",{icon:1});
 				    	setTimeout(function(){
-				    		location.reload();
+				    		$(".scbtn").click();
 						},500);
 	                }else {
 	                    alert(data.msg);
@@ -176,11 +180,31 @@ $(function () {
 	
 })
 
-	
-	function importexaminfo(videoId) {
-		$("#importexaminfo_file_id").val(videoId);
-		$("#importexaminfo_file").click();
-    };
+
+function updateIndes(id,obj){
+	var url="[[${sysUrl}]]/sys/train/video/indes/update";
+	var params = {
+			"id":id,
+			"indes":$(obj).val()
+	};
+	$.post(url,params,function(data){
+			if(data != null){
+				if(data.meta.success){
+					layer.msg("操作成功!",{icon:1});
+					setTimeout(function(){
+						$(".scbtn").click();
+					},500);
+				}else{
+					layer.msg(data.meta.message,{icon:11});
+				}
+		}
+	});
+}
+
+function importexaminfo(videoId) {
+	$("#importexaminfo_file_id").val(videoId);
+	$("#importexaminfo_file").click();
+};
 
 </script>