Browse Source

一系列优化

shenhao 3 years ago
parent
commit
33ce51d05f

+ 5 - 0
src/main/java/com/ssj/framework/core/security/manager/TokenManager.java

@@ -353,4 +353,9 @@ public interface TokenManager {
      * @param expireSeconds 新过期时间
      */
     void refreshExpireTime(String key, int expireSeconds);
+
+    /**
+     * 刷新wxtoken
+     */
+    void refreshWxToken();
 }

+ 8 - 1
src/main/java/com/ssj/framework/core/security/manager/impl/RedisTokenManager.java

@@ -793,7 +793,14 @@ public class RedisTokenManager implements TokenManager {
         jedisPool.expire(key, expireSeconds);
     }
 
-	@Override
+    @Override
+    public void refreshWxToken() {
+        //token 已经失效 重新获取
+        jedisPool.del(SSJ_WX_TOKEN);
+        getSSJAccessTokenAndTime();
+    }
+
+    @Override
 	public Map<String,Object> getSSJAccessTokenAndTime() {
 		Map<String,Object> data=new HashMap<String, Object>();
 		String accessToken=get(SSJ_WX_TOKEN);

+ 113 - 18
src/main/java/com/ssj/service/sys/imlibuser/service/impl/TbClassStudentTempServiceImpl.java

@@ -1,9 +1,11 @@
 package com.ssj.service.sys.imlibuser.service.impl;
 
 import java.math.BigDecimal;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -110,6 +112,15 @@ public class TbClassStudentTempServiceImpl extends BaseServiceImpl<TbClassStuden
 		return queryDao.findStudentErrorByPage(searchParam, pageable);
 	}
 
+	private boolean checkGrade(String grade){
+		boolean check = true;
+		String[] gradeArr = new String[]{"一年级","二年级","三年级","四年级","五年级","六年级","七年级","八年级","九年级"};
+		List<String> list = Arrays.stream(gradeArr).collect(Collectors.toList());
+		if(!list.contains(grade)){
+			check = false;
+		}
+		return check;
+	}
 
 	@Override
 	public synchronized int insertTbClassStudent(TbLibJoin libJoin,TbClassStudentTemp tbLibImStudentTemp) {
@@ -120,22 +131,102 @@ public class TbClassStudentTempServiceImpl extends BaseServiceImpl<TbClassStuden
 			tbLibImStudentTemp.setCreateTime(new Date());
 			tbLibImStudentTemp.setStatus(1);
 			try {
-//				if(StringUtils.isNotEmpty(tbLibImStudentTemp.getSchool())) {
-//					List<PositionSchoolV1Dto> positionSchoolV1Dtos= merchantAreaService.findSchoolList(libJoin.getId());
-//					if(positionSchoolV1Dtos!=null && positionSchoolV1Dtos.size()>0) {
-//						List<String> libJoinSchools=new ArrayList<String>();
-//						for (PositionSchoolV1Dto positionSchoolV1Dto : positionSchoolV1Dtos) {
-//							libJoinSchools.add(positionSchoolV1Dto.getSchoolName());
-//						}
-//						if(!libJoinSchools.contains(tbLibImStudentTemp.getSchool())){
-//							tbLibImStudentTemp.setStatus(0);
-//							tbLibImStudentTemp.setErrorReason("导入的学校未绑定机构");
-//							this.save(tbLibImStudentTemp);
-//							reqNum=0;
-//							return reqNum;
-//						}
-//					}
-//				}
+
+				if(StringUtils.isEmpty(tbLibImStudentTemp.getGrade())){
+					tbLibImStudentTemp.setStatus(0);
+					tbLibImStudentTemp.setErrorReason("年级不能为空");
+					this.save(tbLibImStudentTemp);
+					reqNum=0;
+					return reqNum;
+				}else{
+					if(!checkGrade(tbLibImStudentTemp.getGrade())){
+						tbLibImStudentTemp.setStatus(0);
+						tbLibImStudentTemp.setErrorReason("年级输入不正确,请输入类似一年级、二年级等");
+						this.save(tbLibImStudentTemp);
+						reqNum=0;
+						return reqNum;
+					}
+				}
+				if(StringUtils.isEmpty(tbLibImStudentTemp.getLeagueName())){
+					tbLibImStudentTemp.setStatus(0);
+					tbLibImStudentTemp.setErrorReason("机构不能为空");
+					this.save(tbLibImStudentTemp);
+					reqNum=0;
+					return reqNum;
+				}
+				if(StringUtils.isEmpty(tbLibImStudentTemp.getStudentName())){
+					tbLibImStudentTemp.setStatus(0);
+					tbLibImStudentTemp.setErrorReason("学生姓名不能为空");
+					this.save(tbLibImStudentTemp);
+					reqNum=0;
+					return reqNum;
+				}
+				if(StringUtils.isEmpty(tbLibImStudentTemp.getParentName())){
+					tbLibImStudentTemp.setStatus(0);
+					tbLibImStudentTemp.setErrorReason("主家长姓名不能为空");
+					this.save(tbLibImStudentTemp);
+					reqNum=0;
+					return reqNum;
+				}
+				if(StringUtils.isEmpty(tbLibImStudentTemp.getParentRole())){
+					tbLibImStudentTemp.setStatus(0);
+					tbLibImStudentTemp.setErrorReason("主家长角色不能为空");
+					this.save(tbLibImStudentTemp);
+					reqNum=0;
+					return reqNum;
+				}
+				if(StringUtils.isEmpty(tbLibImStudentTemp.getParentPhone()) || tbLibImStudentTemp.getParentPhone().length()!=11){
+					tbLibImStudentTemp.setStatus(0);
+					tbLibImStudentTemp.setErrorReason("主家长电话不正确");
+					this.save(tbLibImStudentTemp);
+					reqNum=0;
+					return reqNum;
+				}
+				if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentName())) {
+					if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentPhone())){
+						tbLibImStudentTemp.setStatus(0);
+						tbLibImStudentTemp.setErrorReason("副家长角色不正确");
+						this.save(tbLibImStudentTemp);
+						reqNum=0;
+						return reqNum;
+					}else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentRole())){
+						tbLibImStudentTemp.setStatus(0);
+						tbLibImStudentTemp.setErrorReason("副家长角色不正确");
+						this.save(tbLibImStudentTemp);
+						reqNum=0;
+						return reqNum;
+					}
+				}
+				if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentPhone())) {
+					if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentName())){
+						tbLibImStudentTemp.setStatus(0);
+						tbLibImStudentTemp.setErrorReason("副家长角色不正确");
+						this.save(tbLibImStudentTemp);
+						reqNum=0;
+						return reqNum;
+					}else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentRole())){
+						tbLibImStudentTemp.setStatus(0);
+						tbLibImStudentTemp.setErrorReason("副家长角色不正确");
+						this.save(tbLibImStudentTemp);
+						reqNum=0;
+						return reqNum;
+					}
+				}
+				if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentRole())) {
+					if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentName())){
+						tbLibImStudentTemp.setStatus(0);
+						tbLibImStudentTemp.setErrorReason("副家长电话不正确");
+						this.save(tbLibImStudentTemp);
+						reqNum=0;
+						return reqNum;
+					}else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentPhone())){
+						tbLibImStudentTemp.setStatus(0);
+						tbLibImStudentTemp.setErrorReason("副家长电话不正确");
+						this.save(tbLibImStudentTemp);
+						reqNum=0;
+						return reqNum;
+					}
+				}
 				
 				
 				int countVip=libVipService.countByLibId(libJoin.getId());
@@ -201,7 +292,8 @@ public class TbClassStudentTempServiceImpl extends BaseServiceImpl<TbClassStuden
 				}else if (libVips!=null && libVips.size()==1) {
 					libVip=libVips.get(0);
 				}
-				if(libVip==null){//无学生,生成学生
+				//无学生,生成学生
+				if(libVip==null){
 					if(StringUtils.isNotEmpty(tbLibImStudentTemp.getDerver())) {
 						ConchDerver conchDerver = conchDerverService.findByDerver(tbLibImStudentTemp.getDerver().trim());
 						if(conchDerver!=null) {
@@ -360,7 +452,10 @@ public class TbClassStudentTempServiceImpl extends BaseServiceImpl<TbClassStuden
 				
 				//没有班级信息的,不关联班级信息
 				if(StringUtils.isNotEmpty(tbLibImStudentTemp.getClassName())) {
-					TbClass tbClass=tbClassService.getTbClassGradeByLibId(tbLibImStudentTemp.getLibId(),tbLibImStudentTemp.getGrade(), tbLibImStudentTemp.getClassName());
+					/**
+					 * 2021-10 提出导入班级不区分年级,班级名称相同就在同一个班
+					 */
+					TbClass tbClass=tbClassService.getTbClassByLibId(tbLibImStudentTemp.getLibId(), tbLibImStudentTemp.getClassName());
 					if(tbClass==null) {
 						tbClass=new TbClass();
 						tbClass.setLibId(tbLibImStudentTemp.getLibId());

+ 4 - 0
src/main/java/com/ssj/service/weixin/push/service/impl/PushTemplateServiceImpl.java

@@ -179,6 +179,10 @@ public class PushTemplateServiceImpl  extends BaseServiceImpl<PushTemplate, Stri
 								pushTemplate.setTryTime(pushTemplate.getTryTime()+1);
 								pushTemplate.setRemark("errcode:"+result.getString("errcode"));
 								errorNum=errorNum+1;
+								if(result.getString("errcode").equals("40001")){
+									//重新获取ssjtoken
+									tokenManager.refreshWxToken();
+								}
 							}
 						}
 					}

+ 22 - 78
src/main/java/com/ssj/sys/controller/ImLibUserController.java

@@ -262,75 +262,6 @@ public class ImLibUserController extends BaseController {
 						iserror=true;
 						break;
 					}
-					if(StringUtils.isEmpty(tbLibImStudentTemp.getGrade())){
-						response.failure("年级不能为空");
-						iserror=true;
-						break;
-					}else{
-						if(!checkGrade(tbLibImStudentTemp.getGrade())){
-							response.failure("年级输入不正确,请输入类似一年级、二年级等");
-							iserror=true;
-							break;
-						}
-					}
-					if(StringUtils.isEmpty(tbLibImStudentTemp.getLeagueName())){
-						response.failure("机构不能为空");
-						iserror=true;
-						break;
-					}
-					if(StringUtils.isEmpty(tbLibImStudentTemp.getStudentName())){
-						response.failure("学生姓名不能为空");
-						iserror=true;
-						break;
-					}
-					if(StringUtils.isEmpty(tbLibImStudentTemp.getParentName())){
-						response.failure("主家长姓名不能为空");
-						iserror=true;
-						break;
-					}
-					if(StringUtils.isEmpty(tbLibImStudentTemp.getParentRole())){
-						response.failure("主家长角色不能为空");
-						iserror=true;
-						break;
-					}
-					if(StringUtils.isEmpty(tbLibImStudentTemp.getParentPhone()) || tbLibImStudentTemp.getParentPhone().length()!=11){
-						response.failure("主家长电话不正确");
-						iserror=true;
-						break;
-					}
-					if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentName())) {
-						if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentPhone())){
-							response.failure("副家长电话不正确");
-							iserror=true;
-							break;
-						}else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentRole())){
-							response.failure("副家长角色不正确");
-							iserror=true;
-							break;
-						}
-					}
-					if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentPhone())) {
-						if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentName())){
-							response.failure("副家长姓名不正确");
-							iserror=true;
-							break;
-						}else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentRole())){
-							response.failure("副家长角色不正确");
-							iserror=true;
-							break;
-						}
-					}
-					if(StringUtils.isNotEmpty(tbLibImStudentTemp.getViceParentRole())) {
-						if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentName())){
-							response.failure("副家长姓名不正确");
-							iserror=true;
-							break;
-						}else if(StringUtils.isEmpty(tbLibImStudentTemp.getViceParentPhone())){
-							response.failure("副家长电话不正确");
-							iserror=true;
-							break;
-						}
-					}
 				}
 				if(!iserror){
 					int successNum=tbLibImStudentTempService.insertBatchTbClassStudent(tbLibImStudentTemps);
@@ -351,15 +282,7 @@ public class ImLibUserController extends BaseController {
 	}	
 
 
-	private boolean checkGrade(String grade){
-		boolean check = true;
-		String[] gradeArr = new String[]{"一年级","二年级","三年级","四年级","五年级","六年级","七年级","八年级","九年级"};
-		List<String> list = Arrays.stream(gradeArr).collect(Collectors.toList());
-		if(!list.contains(grade)){
-			check = false;
-		}
-		return check;
-	}
+
 
 	//学生列表
 	@RequestMapping(value="/student/list/{libId}")
@@ -728,7 +651,27 @@ public class ImLibUserController extends BaseController {
 	@ResponseBody
 	public Response studentDel(Model model,@PathVariable String vipId) {
 		Response response = new  Response();
+		LibVip libVip=libVipService.getById(vipId);
+		if(libVip!=null) {
+			if (StringUtils.isNotEmpty(libVip.getLibId())) {
+				List<LibVipService> libVipServices = libVipServiceService.findVipIdServiceByLibId(libVip.getLibId(), vipId, "S003");
+				if (libVipServices != null && libVipServices.size() > 0) {
+					for (LibVipService libVipService : libVipServices) {
+						libVipService.setStat(2);
+						libVipService.setEndTime(new Date());
+					}
+					libVipServiceService.save(libVipServices);
+				}
+			}
+
+			TbClassStudent tbClassStudent = tbClassStudentService.findByLibIdAndVipId(libVip.getLibId(), vipId);
+			if (tbClassStudent != null) {
+				tbClassStudentService.delete(tbClassStudent);
+			}
 
+			libVip.setLibId(null);
+			libVipService.save(libVip);
+		}
 		response.success("成功");
 		return response;
 	}
@@ -747,6 +690,7 @@ public class ImLibUserController extends BaseController {
 					if(libVipServices!=null && libVipServices.size()>0) {
 						for (LibVipService libVipService : libVipServices) {
 							libVipService.setStat(2);
+							libVipService.setEndTime(new Date());
 						}
 						libVipServiceService.save(libVipServices);
 					}

+ 1 - 1
src/main/java/com/ssj/sys/interceptor/LoginInterceptor.java

@@ -185,7 +185,7 @@ public class LoginInterceptor extends HandlerInterceptorAdapter{
     public static void initModelAndView(HttpServletRequest request, ModelAndView modelAndView) throws Exception {
         //modelAndView.addObject("sysUrl", "https://sys.sharingschool.com");
         modelAndView.addObject("sysUrl", PropertiesUtil.getValue("gz_sys_url"));
-       // modelAndView.addObject("sysUrl", "http://127.0.0.1:8080");
+//        modelAndView.addObject("sysUrl", "http://127.0.0.1:8080");
         modelAndView.addObject("imgUrl", PropertiesUtil.getValue("GZ_STATIC_FILE_URL"));
     }
 

+ 2 - 7
src/main/resources/mybatis/mapper/CuratorMapper.xml

@@ -649,17 +649,12 @@
 
         <if test="startDate != null and startDate != '' ">
             and t.create_time >= #{startDate}
+            and t1.end_time >= t.create_time
         </if>
         <if test="endDate != null and endDate != '' ">
             and #{endDate} >= t.create_time
+            and t.create_time >= t1.start_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

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

@@ -87,6 +87,7 @@
 						<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>
+						<option  value="15" th:selected="${entity.type==15}" >小塾分组版(深圳)</option>
 					</select>
 				</div>
 			</li>

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

@@ -70,6 +70,7 @@
 				<span th:case="12">小塾学伴(小天才Android平台)</span>
 				<span th:case="13">小蚁学堂(Android)</span>
 				<span th:case="14">小蚁学堂(iOS)</span>
+				<span th:case="15">小塾分组版(深圳)</span>
 			</td>
 			<td>
 				<textarea readonly="readonly" rows="1">[[${item.updateContent}]]</textarea>

+ 9 - 3
src/main/resources/templates/sys/fx/merchantAllEdit.html

@@ -333,18 +333,24 @@
 						${ #httpSession.getAttribute('admin') !=null && 
 						(
 							#lists.contains(#httpSession.getAttribute('admin').authorities,'财务管理员')  ||
-							#lists.contains(#httpSession.getAttribute('admin').authorities,'超级管理员角色')  
+							#lists.contains(#httpSession.getAttribute('admin').authorities,'超级管理员角色')
 						)  }
 						">
 							<a href="javascript:;" th:if="${item.signType!=0 && item.status!=1 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'platServiceAdd(\''+${item.id}+'\')'" class="tablelink">管理费</a>
 						
 							<a href="javascript:;" th:if="${item.posType==1 && item.status!=1 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'joinServiceEdit(\''+${item.id}+'\')'" class="tablelink">塾&nbsp;&nbsp;&nbsp;币</a>
-							<a href="javascript:;" th:if="${item.posType==2 && item.status!=1 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) || item.type eq '4') }"  th:onclick="'libServiceAdd(\''+${item.id}+'\')'" class="tablelink">服务包</a>
-							<a href="javascript:;" th:if="${item.posType==3 && item.status!=1 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) || item.type eq '4') }"  th:onclick="'libServiceScAdd(\''+${item.id}+'\')'" class="tablelink">服务包</a>
+							<a href="javascript:;" th:if="${item.posType==2 && item.status!=1 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) || item.type == 4) }"  th:onclick="'libServiceAdd(\''+${item.id}+'\')'" class="tablelink">服务包</a>
+							<a href="javascript:;" th:if="${item.posType==3 && item.status!=1 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) || item.type == 4) }"  th:onclick="'libServiceScAdd(\''+${item.id}+'\')'" class="tablelink">服务包</a>
 							
 							<a href="javascript:;" th:if="${item.signType!=0 && item.status!=1 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'signServiceAdd(\''+${item.id}+'\')'" class="tablelink">加油包</a>
 							<a href="javascript:;" th:onclick="'openNew2(\''+${item.libId}+'\')'" th:if="${item.status!=1 && item.libId != null}"   class="tablelink">设置</a>
 						</di>
+						<di th:if="
+						${ #httpSession.getAttribute('admin') !=null && #lists.contains(#httpSession.getAttribute('admin').authorities,'商户管理员')}
+						">
+							<a href="javascript:;" th:if="${item.posType==2 && item.status!=1 && ( item.type == 4) }"  th:onclick="'libServiceAdd(\''+${item.id}+'\')'" class="tablelink">服务包</a>
+							<a href="javascript:;" th:if="${item.posType==3 && item.status!=1 && ( item.type == 4) }"  th:onclick="'libServiceScAdd(\''+${item.id}+'\')'" class="tablelink">服务包</a>
+						</di>
 						<a href="javascript:;" th:if="${item.status!=1 && item.libId != null}"  th:onclick="'libServiceXfAdd(\''+${item.id}+'\')'" class="tablelink">续费</a>
 					 </td>