|  | @ -24,6 +24,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
	
		
			
				|  | @ -435,18 +436,37 @@ public class CourseService {
 | 
	
		
			
				|  |  |         String sql = "SELECT id,`name`,longitude,latitude FROM base.base_org where del = 1 and type = 4";
 | 
	
		
			
				|  |  |         List<Map<String , Object>> positionList = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = new ArrayList<>();
 | 
	
		
			
				|  |  |         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  |         String nowDate = sdf.format(new Date());
 | 
	
		
			
				|  |  |         if (positionList.size() > 0){
 | 
	
		
			
				|  |  |             for (int i=0;i<positionList.size();i++){
 | 
	
		
			
				|  |  |                 String sql1 = "SELECT id,`name`,photo,address,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
 | 
	
		
			
				|  |  |                 String sql1 = "SELECT id,code,`name`,mobile,photo,address,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
 | 
	
		
			
				|  |  |                 List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 Integer num = 0;
 | 
	
		
			
				|  |  |                 String ksbm = "SELECT COUNT(1) a FROM base_recruit_students WHERE '"+nowDate+"' > create_time AND '"+nowDate+"' < end_time AND del = 1 AND org_code = '"+mapList.get(0).get("code")+"'";
 | 
	
		
			
				|  |  |                 num = jdbcTemplate.queryForObject(ksbm,Integer.class);
 | 
	
		
			
				|  |  |                 if (num > 0){
 | 
	
		
			
				|  |  |                     String sqlNum = "SELECT allm.num - bbm.num num\n" +
 | 
	
		
			
				|  |  |                             "FROM (SELECT num FROM base_recruit_students WHERE org_code = '"+mapList.get(0).get("code")+"') allm,(\n" +
 | 
	
		
			
				|  |  |                             "SELECT COUNT(rsr.id) num FROM base_recruit_students rs,base_recruit_students_record rsr WHERE '"+nowDate+"' >rs.start_time AND rs.org_code = '"+mapList.get(0).get("code")+"'\n" +
 | 
	
		
			
				|  |  |                             "AND '"+nowDate+"' < rs.end_time AND rs.del = 1 AND rs.id = rsr.recruit_students_id AND rsr.status IN (2,3,6)) bbm";
 | 
	
		
			
				|  |  |                     num = jdbcTemplate.queryForObject(sqlNum,Integer.class);
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     num = -1; //未开放报名
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 JSONObject obj = new JSONObject();
 | 
	
		
			
				|  |  |                 obj.put("id",mapList.get(0).get("id"));
 | 
	
		
			
				|  |  |                 obj.put("orgCode",mapList.get(0).get("code"));
 | 
	
		
			
				|  |  |                 obj.put("name",mapList.get(0).get("name"));
 | 
	
		
			
				|  |  |                 obj.put("photo",mapList.get(0).get("photo"));
 | 
	
		
			
				|  |  |                 obj.put("address",mapList.get(0).get("address"));
 | 
	
		
			
				|  |  |                 obj.put("longitude",mapList.get(0).get("longitude"));
 | 
	
		
			
				|  |  |                 obj.put("latitude",mapList.get(0).get("latitude"));
 | 
	
		
			
				|  |  |                 obj.put("mobile",mapList.get(0).get("mobile"));
 | 
	
		
			
				|  |  |                 obj.put("funDistance",mapList.get(0).get("funDistance"));
 | 
	
		
			
				|  |  |                 obj.put("num",num);
 | 
	
		
			
				|  |  |                 obj.put("course","");
 | 
	
		
			
				|  |  |                 list.add(obj);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (list.size() > 0){
 |