shenhao 4 роки тому
батько
коміт
3a99dc9a4e

+ 4 - 0
src/main/java/com/ssj/dao/weixin/sales/dao/LibVipServiceDao.java

@@ -346,4 +346,8 @@ public interface LibVipServiceDao extends JpaRepository<LibVipService, String> {
 	@Query(nativeQuery = true, value = "update tb_lib_vip_service set end_time = ?2 where lib_id = ?1 and species='S003' and stat=1 and not exists (select 1 from tb_lib_order_details where tb_lib_order_details.id =tb_lib_vip_service.order_details_id )")
 	@Modifying
 	void updateServiceEndTime(String libId, String endTime);
+
+	@Query(nativeQuery = true, value = "update tb_lib_vip_service set end_time = ?2 where order_details_id = ?1 ")
+	@Modifying
+	void updateServiceEndTimeByOrderDetailId(String orderDetailId, String endTime);
 }

+ 1 - 6
src/main/java/com/ssj/service/sys/fx/service/impl/SysCuratorServiceImpl.java

@@ -89,14 +89,9 @@ public class SysCuratorServiceImpl implements SysCuratorService {
     @Override
     public Map<String, Object> homeworkIndex(String libId, int pageSize, int pageNo, Map<String, Object> params) {
         Map<String, Object> data = new HashMap<>(2);
-        com.baomidou.mybatisplus.extension.plugins.pagination.Page   page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo, pageSize);
-        page.setSearchCount(false);
-
+        Page   page = new Page(pageNo, pageSize);
         List<Map<String, Object>> list = curatorMapper.homeworkIndex(page,params.get("libId").toString(),params.get("queryDate").toString(),params.get("searchValue").toString(), MapUtils.getString(params,"queryEndDate"));
         data.put("list",list);
-        Page page2 = new Page(1,-1);
-        List<Map<String, Object>> list2 = curatorMapper.homeworkIndex(page2,params.get("libId").toString(),params.get("queryDate").toString(),params.get("searchValue").toString(), MapUtils.getString(params,"queryEndDate"));
-        page.setTotal(list2.size());
         data.put("total",page.getTotal());
         return data;
     }

+ 7 - 0
src/main/java/com/ssj/service/weixin/sales/service/LibOrderDetailsService.java

@@ -352,4 +352,11 @@ public interface LibOrderDetailsService extends BaseService<LibOrderDetails, Str
 	 * @return
 	 */
     Page<Map<String, Object>> findForInvoicePageList(Map<String, Object> params, Pageable initPage);
+
+	/**
+	 * 根据订单id,更新vip_service 表的end_time
+	 * @param id
+	 * @param endTime
+	 */
+	void updateServiceEndTime(String id, String endTime);
 }

+ 7 - 0
src/main/java/com/ssj/service/weixin/sales/service/LibVipServiceService.java

@@ -651,4 +651,11 @@ public interface LibVipServiceService extends BaseService<LibVipService, String>
 	void updateStatByLibId(String libId);
 
 	void updateServiceEndTime(String libId, String format);
+
+	/**
+	 * 根据订单id,设置服务结束时间
+	 * @param orderDetailId
+	 * @param endTime
+	 */
+    void updateServiceEndTimeByOrderDetailId(String orderDetailId, String endTime);
 }

+ 5 - 0
src/main/java/com/ssj/service/weixin/sales/service/impl/LibOrderDetailsServiceImpl.java

@@ -1470,4 +1470,9 @@ public class LibOrderDetailsServiceImpl extends BaseServiceImpl<LibOrderDetails,
 		return libOrderDetailsQueryDao.findForInvoicePageList(params,initPage);
 	}
 
+	@Override
+	public void updateServiceEndTime(String orderDetailId, String endTime) {
+		libVipServiceService.updateServiceEndTimeByOrderDetailId(orderDetailId,endTime);
+	}
+
 }

+ 5 - 0
src/main/java/com/ssj/service/weixin/sales/service/impl/LibVipServiceServiceImpl.java

@@ -1957,5 +1957,10 @@ public class LibVipServiceServiceImpl extends BaseServiceImpl<LibVipService, Str
 		libVipServiceDao.updateServiceEndTime(libId,endTime);
 	}
 
+	@Override
+	public void updateServiceEndTimeByOrderDetailId(String orderDetailId, String endTime) {
+		libVipServiceDao.updateServiceEndTimeByOrderDetailId(orderDetailId,endTime);
+	}
+
 
 }

+ 2 - 0
src/main/java/com/ssj/sys/controller/SysCuratorController.java

@@ -116,7 +116,9 @@ public class SysCuratorController extends BaseController {
         Map<String, Object> params = new HashMap<String, Object>();
         String queryDate = request.getParameter("queryDate")==null? DateHelper.format(new Date(),"yyyy-MM-dd"):request.getParameter("queryDate");
         String queryEndDate = request.getParameter("queryEndDate")==null? DateHelper.format(new Date(),"yyyy-MM-dd"):request.getParameter("queryEndDate");
+        String searchSubject = request.getParameter("searchSubject")==null? "语文":request.getParameter("searchSubject");
         params.put("searchValue",searchValue==null?"":searchValue);
+        params.put("searchSubject",searchSubject);
         params.put("queryDate",queryDate);
         params.put("queryEndDate",queryEndDate);
         params.put("libId",libId);

+ 101 - 2
src/main/java/com/ssj/sys/controller/SysOrderController.java

@@ -1,5 +1,7 @@
 package com.ssj.sys.controller;
 
+import com.ssj.bean.common.framework.core.domain.Response;
+import com.ssj.bean.sys.imlibuser.TbClassTeacherTemp;
 import com.ssj.bean.weixin.libmy.domain.LibVip;
 import com.ssj.bean.weixin.order.domain.Order;
 import com.ssj.bean.weixin.sales.domain.LibOrderDetails;
@@ -17,6 +19,9 @@ import com.ssj.service.weixin.sales.service.LibOrderDetailsService;
 import com.ssj.service.weixin.sales.service.LibSalesPriceService;
 import com.ssj.service.weixin.sales.service.LibStaffingService;
 import com.ssj.service.weixin.sales.service.LibVipServiceService;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Controller;
@@ -25,8 +30,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /** 
@@ -395,6 +402,98 @@ public class SysOrderController extends BaseController {
 
 		return response;
 	}
-	
-	
+
+	@RequestMapping(value="/principal/import")
+	@ResponseBody
+	public Response principalImput(Model model, @RequestParam("file") MultipartFile file) {
+		Response response = new  Response();
+		try {
+			List<Map<String,String>> datas=analysisExFile(file);
+			if(datas!=null && datas.size()>0){
+				String  msg = "";
+				int i = 1;
+				for (Map<String,String> map : datas) {
+					//订单编号 data_0
+					//服务到期时间 data_1
+					LibOrderDetails orderDetails = libOrderDetailsService.getByOrderNo(map.get("data_0"));
+					if(Objects.isNull(orderDetails)){
+						msg +="第"+i+"行第一列,";
+						i++;
+						continue;
+					}
+					if(map.containsKey("data_1") && !"".equals(map.get("data_1"))){
+						libOrderDetailsService.updateServiceEndTime(orderDetails.getId(),map.get("data_1"));
+					}else{
+						msg +="第"+i+"行第二列,";
+						i++;
+						continue;
+					}
+
+					i++;
+				}
+			}
+
+		} catch (Exception e) {
+			logger.error("异常", e);
+			response.failure("导入异常:"+e.getMessage());
+		}
+		return response;
+	}
+
+	/**
+	 * ----------------解析文档相关功能-----------------------
+	 */
+
+	public static List<Map<String,String>> analysisExFile(MultipartFile file) throws Exception {
+		List<Map<String,String>> datas=new ArrayList<Map<String,String>>();
+		Map<String,String> map=null;
+
+		@SuppressWarnings("resource")
+		Workbook wb = new XSSFWorkbook(file.getInputStream());
+		Sheet sheet = wb.getSheetAt(0);
+		Row row = null;
+		Cell cell = null;
+		for (Iterator<Row> it = sheet.rowIterator(); it.hasNext();) {
+			map=new LinkedHashMap<String, String>();
+			row = it.next();
+			if (row == null) {
+				break;
+			}
+			if(row.getRowNum()<=0){
+				continue;
+			}
+			if(StringUtils.isEmpty(getValue(row.getCell(0)))){
+				continue;
+			}
+			for (Iterator<Cell> cit =row.cellIterator(); cit.hasNext();) {
+				cell = cit.next();
+				if (cell == null) {
+					break;
+				}
+				if(StringUtils.isEmpty(getValue(cell))){
+					continue;
+				}
+				map.put("data_"+cell.getColumnIndex(), getValue(cell));
+			}
+			datas.add(map);
+		}
+		return datas;
+	}
+
+	public static String getValue(Cell cell){
+		if(cell==null) {
+			return "";
+		}
+		if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()){
+			if(DateUtil.isCellDateFormatted(cell)){
+				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  //设置转成的时间格式
+				Date date = cell.getDateCellValue();//取得的是date类型
+				String datestr = sdf.format(date);//这里是转成String类型了,要哪种按个人需求
+				return datestr;
+			}
+		}
+		cell.setCellType(Cell.CELL_TYPE_STRING);
+		String text=cell.getStringCellValue()!=null ? String.valueOf(cell.getStringCellValue()):"";
+		return text.trim();
+	}
 }

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

@@ -423,14 +423,16 @@
         <if test="searchValue != '' ">
             and t12.child_name regexp #{searchValue}
         </if>
+        <if test="searchSubject != '' ">
+            and a.SUBJECT  = #{searchSubject}
+        </if>
         ) a
         GROUP BY
         a.create_time,
         a.vip_id
         ORDER BY
         a.vip_id,
-        a.create_time DESC,
-        a.SUBJECT
+        a.create_time DESC
     </select>
 
     <select id="findPageStudentList" resultType="java.util.Map">

+ 2 - 0
src/main/resources/templates/sys/error/activityList.html

@@ -46,6 +46,7 @@
 				<option value="3" th:selected="${ search.get('type')  eq '3' }">19.9电梯广告1</option>
 				<option value="4" th:selected="${ search.get('type')  eq '4' }">19.9电梯广告2</option>
 				<option value="5" th:selected="${ search.get('type')  eq '5' }">19.9电梯广告3</option>
+				<option value="9" th:selected="${ search.get('type')  eq '9' }">19.9电梯广告4</option>
 				<option value="6" th:selected="${ search.get('type')  eq '6' }">19.9元地推</option>
 				<option value="7" th:selected="${ search.get('type')  eq '7' }">19.9元书店</option>
 				<option value="8" th:selected="${ search.get('type')  eq '8' }">19.9元其他渠道</option>
@@ -92,6 +93,7 @@
 						<span th:case="3">19.9电梯广告1</span>
 						<span th:case="4">19.9电梯广告2</span>
 						<span th:case="5">19.9电梯广告3</span>
+						<span th:case="9">19.9电梯广告4</span>
 						<span th:case="6">19.9元地推</span>
 						<span th:case="7">19.9元书店</span>
 						<span th:case="8">19.9元其他渠道</span>

+ 8 - 0
src/main/resources/templates/sys/fx/curator/homeworkIndex.html

@@ -38,6 +38,14 @@
 		<input id="reportType" name="reportType" type="hidden" value="3">
 	<ul class="seachform">
 		<li>
+			<label>科目</label>
+			<select class="scinput select_width" name="searchSubject" id="searchSubject">
+				<option   th:selected="${ search.get('searchSubject')  eq '语文' }" value="语文">语文</option>
+				<option   th:selected="${ search.get('searchSubject')  eq '数学' }" value="数学">数学</option>
+				<option   th:selected="${ search.get('searchSubject')  eq '英语' }" value="英语">英语</option>
+			</select>
+		</li>
+		<li>
 			<label>学生名称</label>
 			<input name="searchValue" type="text" class="scinput" th:value="${search.get('searchValue')}"/>
 		</li>

+ 61 - 11
src/main/resources/templates/sys/order/vipOrderList.html

@@ -69,20 +69,29 @@
 	  <li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">
 			<input type="button" id="button" style="width: 100px;" class="scbtnbution" value="导出订单明细" />
 		</li>
+		<li th:if="${ #httpSession.getAttribute('admin') !=null  &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW') }">
+			<input type="button" id="principalimput" style="width: 100px;height: 30px"  class="scbtn" value=" + 导入校长" />
+			<div style="display: none">
+				<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" id="principalfile" />
+			</div>
+		</li>
+		<li th:if="${ #httpSession.getAttribute('admin') !=null  &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW') }">
+			<a th:href="@{/static/sys/excel/order.xlsx?1}"><input type="button" style="background: #ccc no-repeat center;width: 100px;height: 30px"  class="scbtn" value="服务失效模板" /></a>
+		</li>
 		<!-- <li th:if="${ #httpSession.getAttribute('admin') !=null  &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW') }">
 			<input type="button" id="detailbutton" style="width: 120px;" class="scbtnbution" value="各馆月度销售" />
 		</li> -->
-		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">
-			<input type="button" id="ybbutton" style="width: 120px;" class="scbtnbution" value="财务月报" />
-		</li>
-		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">
-			<input type="button" id="gxbuttonA" style="width: 120px;" class="scbtnbution" value="共享模式A" />
-		</li>
-		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">
-			<input type="button" id="gxbuttonB" style="width: 120px;" class="scbtnbution" value="共享模式B" />
-		</li>
-		<li th:if="${ #httpSession.getAttribute('admin') !=null    &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW') }">
-			<input type="button" id="zbbutton" style="width: 120px;" class="scbtnbution" value="人员月度销售" />
+<!--		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">-->
+<!--			<input type="button" id="ybbutton" style="width: 120px;" class="scbtnbution" value="财务月报" />-->
+<!--		</li>-->
+<!--		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">-->
+<!--			<input type="button" id="gxbuttonA" style="width: 120px;" class="scbtnbution" value="共享模式A" />-->
+<!--		</li>-->
+<!--		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">-->
+<!--			<input type="button" id="gxbuttonB" style="width: 120px;" class="scbtnbution" value="共享模式B" />-->
+<!--		</li>-->
+<!--		<li th:if="${ #httpSession.getAttribute('admin') !=null    &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW') }">-->
+<!--			<input type="button" id="zbbutton" style="width: 120px;" class="scbtnbution" value="人员月度销售" />-->
 		</li>
 	</ul>
 	</form>
@@ -219,7 +228,48 @@ $("#detailbutton").on('click',function(){
 	$("#seachform").submit();
 	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/order/vipOrderList.html";
 });
+$("#principalimput").on('click',function (){
+	$("#principalfile").click();
+})
+var $principalfile =  $("#principalfile");
+$principalfile.change(function () {
+	if($(this).val() != ""){
+		filePrincipalLoad(this);
+	}
+})
 
+function filePrincipalLoad(ele){
+	var formData = new FormData();
+	var name = $(ele).val();
+	var files = $(ele)[0].files[0];
+	formData.append("file", files);
+	formData.append("name", name);
+	$.ajax({
+		url: "[[${sysUrl}]]/sys/imlibuser/principal/import",
+		type: 'POST',
+		data: formData,
+		processData: false,
+		contentType: false,
+		beforeSend: function () {
+			parent.layer.msg("数据正在导入中....",{icon:2});
+		},
+		success: function (responseStr) {
+			if(responseStr.meta.success){
+				parent.layer.msg("导入成功",{icon:1});
+				parent.location.reload();
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			}else{
+				parent.layer.msg(responseStr.meta.message,{icon:11});
+				$("#principalfile").val("");
+			}
+		}
+		,
+		error : function (responseStr) {
+			parent.layer.msg("导入失败,请刷新后重试!",{icon:11});
+			$("#principalfile").val("");
+		}
+	});
+}
 </script>
 
 </html>