Ver código fonte

无效退款

shenhao 4 anos atrás
pai
commit
eb5316b204

+ 7 - 0
src/main/java/com/ssj/dao/weixin/adminsale/dao/AdminSaleQueryDao.java

@@ -150,4 +150,11 @@ public interface AdminSaleQueryDao {
 
 	Map<String, Object> findOrderById(String detailId);
 
+	/**
+	 * 查询还在使用的订单
+	 * @param params
+	 * @param initPage
+	 * @return
+	 */
+    Page<Map<String, Object>> getMealOrder(Map<String, Object> params, Pageable initPage);
 }

+ 23 - 1
src/main/java/com/ssj/dao/weixin/adminsale/dao/impl/AdminSaleQueryDaoImpl.java

@@ -297,6 +297,28 @@ public class AdminSaleQueryDaoImpl implements AdminSaleQueryDao {
         List<Map<String, Object>> list = dao.findMap(selSQL.toString(), queryParams.toArray());
 		return list ==null ?null:list.get(0);
 	}
-	
+
+    @Override
+    public Page<Map<String, Object>> getMealOrder(Map<String, Object> params, Pageable initPage) {
+        StringBuilder selSQL = new StringBuilder();
+        List<Object> queryParams = new ArrayList<Object>();
+        selSQL.append("SELECT min(t11.sign_time) as sign_time,max(t11.end_sign_time) as end_sign_time,t.buy_month,t.price,t.lib_service,count(1) as tf_count,t.id,t.order_no,t13.lib_id \n");
+        selSQL.append("FRom fx_merchant_meal_order t \n");
+        selSQL.append("left join fx_merchant_meal t11 on t.id = t11.order_id\n");
+        selSQL.append("left join fx_merchant t13 on t.merchant_id = t13.id\n");
+        selSQL.append("left join tb_orders t12 on t.order_no = t12.order_no\n");
+        selSQL.append("where  TO_DAYS(t11.end_sign_time) >TO_DAYS(NOW())\n");
+        if(params.containsKey("libId")){
+            selSQL.append("and t13.lib_id = ? \n");
+            queryParams.add(params.get("libId"));
+        }
+        if(params.containsKey("id")){
+            selSQL.append(" and t.id = ? \n");
+            queryParams.add(params.get("id"));
+        }
+        selSQL.append("GROUP BY t.id");
+        return dao.findPage(selSQL.toString(),queryParams.toArray(),initPage);
+    }
+
 
 }

+ 3 - 0
src/main/java/com/ssj/dao/weixin/library/dao/IBookManagerDao.java

@@ -372,4 +372,7 @@ public interface IBookManagerDao extends JpaRepository<TbLibManager, String> {
 
 	@Query(nativeQuery = true,value = "select * from tb_lib_manager where type=?1 and state=?2  and create_time  is not null order by create_time desc limit 1")
 	TbLibManager findExerciseByTypeAndState(int type,int state);
+
+	@Query(nativeQuery = true,value ="select * from  tb_lib_manager where telephone=?1 and type = ?2 and state=1 and is_cancelled=0 " )
+	TbLibManager findByPhoneAndType(String phone, int type);
 }

+ 185 - 0
src/main/java/com/ssj/refund/bean/RefundInfo.java

@@ -0,0 +1,185 @@
+package com.ssj.refund.bean;
+
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.math.BigDecimal;
+
+/**
+ * @author sh
+ * @className refundInfo
+ * @description
+ * @date 2021/7/9
+ */
+@Entity
+@Table(name="fx_merchant_refund")
+public class RefundInfo extends BaseEntity {
+    /**
+     * 支付订单no
+     * 没有订单默认值1
+     */
+    private String orderNo;
+    /**
+     * 服务包订单id
+     */
+    private String mealOrderId;
+    /**
+     * 收款人姓名
+     */
+    private String yourName;
+    /**
+     * 开户行
+     */
+    private String openBank;
+    /**
+     * 收款银行账号
+     */
+    private String bankAccount;
+    /**
+     * 退款原因选项
+     */
+    private String refundOption;
+    /**
+     * 其他的原因
+     */
+    private String otherReason;
+    /**
+     * 选择退费的学生
+     */
+    private String vipIds;
+    /**
+     * 审核状态
+     */
+    private int auditState;
+    /**
+     * 退费学生数量
+     */
+    private int studentCount;
+
+    private BigDecimal unitPrice;
+
+    private BigDecimal refundPrice;
+
+    /**
+     * 审核节点
+     */
+    private String auditPoint;
+
+    /**
+     * 微信用户id
+     */
+    private String userId;
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getMealOrderId() {
+        return mealOrderId;
+    }
+
+    public void setMealOrderId(String mealOrderId) {
+        this.mealOrderId = mealOrderId;
+    }
+
+    public String getYourName() {
+        return yourName;
+    }
+
+    public void setYourName(String yourName) {
+        this.yourName = yourName;
+    }
+
+    public String getOpenBank() {
+        return openBank;
+    }
+
+    public void setOpenBank(String openBank) {
+        this.openBank = openBank;
+    }
+
+    public String getBankAccount() {
+        return bankAccount;
+    }
+
+    public void setBankAccount(String bankAccount) {
+        this.bankAccount = bankAccount;
+    }
+
+    public String getRefundOption() {
+        return refundOption;
+    }
+
+    public void setRefundOption(String refundOption) {
+        this.refundOption = refundOption;
+    }
+
+    public String getOtherReason() {
+        return otherReason;
+    }
+
+    public void setOtherReason(String otherReason) {
+        this.otherReason = otherReason;
+    }
+
+    public String getVipIds() {
+        return vipIds;
+    }
+
+    public void setVipIds(String vipIds) {
+        this.vipIds = vipIds;
+    }
+
+    public int getAuditState() {
+        return auditState;
+    }
+
+    public void setAuditState(int auditState) {
+        this.auditState = auditState;
+    }
+
+    public int getStudentCount() {
+        return studentCount;
+    }
+
+    public void setStudentCount(int studentCount) {
+        this.studentCount = studentCount;
+    }
+
+    public String getAuditPoint() {
+        return auditPoint;
+    }
+
+    public void setAuditPoint(String auditPoint) {
+        this.auditPoint = auditPoint;
+    }
+
+    public BigDecimal getUnitPrice() {
+        return unitPrice;
+    }
+
+    public void setUnitPrice(BigDecimal unitPrice) {
+        this.unitPrice = unitPrice;
+    }
+
+    public BigDecimal getRefundPrice() {
+        return refundPrice;
+    }
+
+    public void setRefundPrice(BigDecimal refundPrice) {
+        this.refundPrice = refundPrice;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+}

+ 16 - 0
src/main/java/com/ssj/refund/dao/IMerchantRefundDao.java

@@ -0,0 +1,16 @@
+package com.ssj.refund.dao;
+
+import com.ssj.refund.bean.RefundInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author sh
+ * @className IMerchantRefundDao
+ * @description dao
+ * @date 2021/7/9
+ */
+@Repository
+public interface IMerchantRefundDao extends JpaRepository<RefundInfo,String> {
+
+}

+ 13 - 0
src/main/java/com/ssj/refund/service/IMerchantRefundService.java

@@ -0,0 +1,13 @@
+package com.ssj.refund.service;
+
+import com.ssj.framework.core.common.service.BaseService;
+import com.ssj.refund.bean.RefundInfo;
+
+/**
+ * @author sh
+ * @className IMerchantRefundService
+ * @description 商户退款interface
+ * @date 2021/7/9
+ */
+public interface IMerchantRefundService extends BaseService<RefundInfo,String> {
+}

+ 27 - 0
src/main/java/com/ssj/refund/service/impl/MerchantRefundServiceImpl.java

@@ -0,0 +1,27 @@
+package com.ssj.refund.service.impl;
+
+import com.ssj.framework.core.common.service.BaseServiceImpl;
+import com.ssj.refund.bean.RefundInfo;
+import com.ssj.refund.dao.IMerchantRefundDao;
+import com.ssj.refund.service.IMerchantRefundService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author sh
+ * @className MerchantRefundServiceImpl
+ * @description implement
+ * @date 2021/7/9
+ */
+@Service
+public class MerchantRefundServiceImpl extends BaseServiceImpl<RefundInfo,String> implements IMerchantRefundService {
+
+    @Autowired
+    private IMerchantRefundDao dao;
+
+    @Override
+    public PagingAndSortingRepository<RefundInfo, String> getDao() {
+        return dao;
+    }
+}

+ 11 - 2
src/main/java/com/ssj/service/weixin/adminsale/service/AdminSaleService.java

@@ -63,6 +63,15 @@ public interface AdminSaleService {
 
 
 	Map<String, Object> findOrderById(String detailId);
-	
-	
+
+
+	/**
+	 * 查询未消费的订单
+	 * @param params
+	 * @param initPage
+	 * @return
+	 */
+    Page<Map<String, Object>> getMealOrder(Map<String, Object> params, Pageable initPage);
+
+    void saveRefundInfo(String id, String orderNo, String yourName, String openBank, String bankAccount, String[] otherValue, String otherInput, String[] vipIds,String userId);
 }

+ 46 - 1
src/main/java/com/ssj/service/weixin/adminsale/service/impl/AdminSaleServiceImpl.java

@@ -4,15 +4,21 @@ import com.ssj.bean.weixin.user.domain.User;
 import com.ssj.dao.weixin.adminsale.dao.AdminSaleQueryDao;
 import com.ssj.framework.core.util.SystemResourceLocator;
 import com.ssj.framework.weixin.util.BarcodeFactory;
+import com.ssj.refund.bean.RefundInfo;
+import com.ssj.refund.service.IMerchantRefundService;
 import com.ssj.service.weixin.adminsale.service.AdminSaleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.File;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -23,6 +29,9 @@ public class AdminSaleServiceImpl  implements AdminSaleService {
 
     @Autowired
     private AdminSaleQueryDao  adminSaleQueryDao;
+
+    @Autowired
+	private IMerchantRefundService merchantRefundService;
 	
 	@Override
 	public Page<Map<String, Object>> findVipBySaleAndLibIdPage(
@@ -171,7 +180,43 @@ public class AdminSaleServiceImpl  implements AdminSaleService {
 		return adminSaleQueryDao.findOrderById(detailId);
 	}
 
-	
+	@Override
+	public Page<Map<String, Object>> getMealOrder(Map<String, Object> params, Pageable initPage) {
+		return adminSaleQueryDao.getMealOrder(params,initPage);
+	}
+
+	@Override
+	public void saveRefundInfo(String id, String orderNo, String yourName, String openBank, String bankAccount, String[] otherValue, String otherInput, String[] vipIds,String userId) {
+		RefundInfo info = new RefundInfo();
+		info.setMealOrderId(id);
+		if("1".equals(orderNo)){
+			info.setBankAccount(bankAccount);
+			info.setYourName(yourName);
+			info.setOpenBank(openBank);
+		}else{
+			info.setOrderNo(orderNo);
+		}
+		String refundOption = Arrays.toString(otherValue);
+		info.setRefundOption(refundOption);
+		if(refundOption.contains("其他")){
+			info.setOtherReason(otherInput);
+		}
+		info.setVipIds(Arrays.toString(vipIds));
+		//业务审核
+		info.setAuditState(1);
+		info.setAuditPoint("业务审核");
+		info.setStudentCount(vipIds.length);
+		info.setUserId(userId);
+		//计算单价
+		Map<String,Object> params = new HashMap<>();
+		params.put("id",id);
+		Page<Map<String,Object>> page = this.getMealOrder(params, new PageRequest(0, 1));
+		Map<String,Object> map = page.getContent().get(0);
+		BigDecimal unitPrice = new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString())).divide(new BigDecimal(map.get("lib_service").toString())).setScale(2, RoundingMode.HALF_UP);
+		info.setUnitPrice(unitPrice);
+		info.setRefundPrice(unitPrice.multiply(new BigDecimal(String.valueOf(info.getStudentCount()))).setScale(2,RoundingMode.HALF_UP));
+		merchantRefundService.save(info);
+	}
 
 
 }

+ 8 - 0
src/main/java/com/ssj/service/weixin/library/service/IBookManagerService.java

@@ -304,4 +304,12 @@ public interface IBookManagerService extends BaseService<TbLibManager, String> {
 
 	List<TbLibManager> findAllByUserIdAndTypeAndStatus(String teacherId,int type);
 
+	/**
+	 * 通过电话号码查询角色
+	 * @param phone
+	 * @param type
+	 * @return
+	 */
+	TbLibManager findByPhoneAndType(String phone, int type);
+
 }

+ 5 - 0
src/main/java/com/ssj/service/weixin/library/service/impl/BookManagerServiceImpl.java

@@ -560,6 +560,11 @@ public class BookManagerServiceImpl extends BaseServiceImpl<TbLibManager, String
         return dao.findAllByUserIdAndTypeAndStatus(teacherId,type);
     }
 
+    @Override
+    public TbLibManager findByPhoneAndType(String phone, int type) {
+        return dao.findByPhoneAndType(phone,type);
+    }
+
 }
 
 

+ 117 - 6
src/main/java/com/ssj/weixin/adminsale/controller/AdminSaleController.java

@@ -1,9 +1,11 @@
 package com.ssj.weixin.adminsale.controller;
 
+import com.ssj.bean.sys.fx.domain.Merchant;
 import com.ssj.bean.weixin.card.domain.LibCardInfo;
 import com.ssj.bean.weixin.libmy.domain.LibReadVip;
 import com.ssj.bean.weixin.libmy.domain.LibVip;
 import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
+import com.ssj.bean.weixin.libmy.domain.TbLibManager;
 import com.ssj.bean.weixin.problem.domain.Experience;
 import com.ssj.bean.weixin.problem.domain.RequestMethodLog;
 import com.ssj.bean.weixin.sales.domain.LibOrderDetails;
@@ -15,6 +17,8 @@ import com.ssj.framework.basic.utils.DateHelper;
 import com.ssj.framework.core.common.controller.BaseController;
 import com.ssj.framework.core.util.ResponseConstant;
 import com.ssj.framework.core.util.ResponseEntity;
+import com.ssj.service.conch.parents.v2.request.ModuleListReq;
+import com.ssj.service.sys.fx.service.MerchantService;
 import com.ssj.service.weixin.adminsale.service.AdminSaleService;
 import com.ssj.service.weixin.adminsale.service.InvoiceManageService;
 import com.ssj.service.weixin.card.service.ILibMainCardService;
@@ -30,6 +34,7 @@ import com.ssj.service.weixin.user.service.UserService;
 import com.ssj.weixin.manager.entity.TbLibReadManager;
 import com.ssj.weixin.manager.service.IReadManagerService;
 import com.ssj.weixin.util.UserUtil;
+import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -40,10 +45,8 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.math.RoundingMode;
+import java.util.*;
 
 
 @Controller
@@ -90,8 +93,11 @@ public class AdminSaleController  extends BaseController {
 
 	@Autowired
 	private InvoiceManageService invoiceManageService;
-	
-	
+
+	@Autowired
+	private MerchantService merchantService;
+
+
 	@RequestMapping("/index")
 	public String index(Model model,String libId) {
 		String userId = UserUtil.getUserId(request);
@@ -719,4 +725,109 @@ public class AdminSaleController  extends BaseController {
 		}
 		return response;
 	}
+
+	@RequestMapping("/refundIndex")
+	public String refundIndex(Model model){
+		String userId = UserUtil.getUserId(request);
+		//查询是哪个校区的校长
+		TbLibManager manager = libManagerService.findByUserIdAndType(userId,4);
+		//默认查不到校区1
+		if(Objects.nonNull(manager)){
+			TbLibJoin join = joinService.getById(manager.getLibId());
+			model.addAttribute("join",join);
+			return "weixin/invoice/select_order";
+		}else{
+			return "weixin/invoice/selectPhone";
+		}
+
+	}
+	@RequestMapping("/refundOrderIndex")
+	public String refundIndex(Model model,String libId){
+		TbLibJoin join = joinService.getById(libId);
+		model.addAttribute("join",join);
+		model.addAttribute("libId",libId);
+		return "weixin/invoice/select_order";
+
+	}
+
+	@ResponseBody
+	@RequestMapping(value = "/getJoinInfo",method = RequestMethod.POST)
+	public ResponseEntity getJoinInfo(String phone){
+		ResponseEntity responseEntity = new ResponseEntity();
+		Map<String,Object> data = new HashMap<>();
+		TbLibManager manager = libManagerService.findByPhoneAndType(phone,4);
+		if(Objects.nonNull(manager)){
+			data.put("libId",manager.getLibId());
+			return responseEntity.success(data,"获取成功!");
+		}else{
+			return  responseEntity.failure("未查询到此电话号码的校长!");
+		}
+	}
+
+	@RequestMapping(value = "/getLibStudentList",method = RequestMethod.POST)
+	@ResponseBody
+	public ResponseEntity getLibStudentList(String libId,int pageSize,int pageNo){
+		ResponseEntity responseEntity = new ResponseEntity();
+		Map<String,Object> params = new HashMap<>();
+		params.put("EQ_libId",libId);
+		Page<LibVip> page = libVipService.findByPage(params, initPage(pageNo,pageSize));
+		Map<String,Object> data = new HashMap<>();
+		data.put("list", page.getContent());
+		data.put("pageNo", pageNo);
+		data.put("pageSize", pageSize);
+		data.put("totalSize", page.getTotalElements());
+		return responseEntity.success(data,"获取成功");
+	}
+
+	@RequestMapping(value = "/getMealOrder",method = RequestMethod.POST)
+	@ResponseBody
+	public ResponseEntity getMealOrder(String libId,int pageSize,int pageNo){
+		ResponseEntity responseEntity = new ResponseEntity();
+		Map<String,Object> params = new HashMap<>();
+		Map<String,Object> data = new HashMap<>();
+		params.put("libId",libId);
+		Page<Map<String,Object>> page = adminSaleService.getMealOrder(params, initPage(pageNo,pageSize));
+		data.put("list", page.getContent());
+		data.put("pageNo", pageNo);
+		data.put("pageSize", pageSize);
+		data.put("totalSize", page.getTotalElements());
+		return responseEntity.success(data,"获取成功");
+	}
+
+	@RequestMapping("/refundOther")
+	public String refundOther(Model model,String id){
+		Map<String,Object> params = new HashMap<>();
+		params.put("id",id);
+		Page<Map<String,Object>> page = adminSaleService.getMealOrder(params, initPage(1,1));
+		Map<String,Object> map = page.getContent().get(0);
+		//SELECT min(t11.sign_time) as sign_time,max(t11.end_sign_time) as end_sign_time,
+		// t.buy_month,t.price,t.lib_service,count(1) as tf_count,t.id,t.order_no
+		BigDecimal unitPrice = new BigDecimal(map.get("price").toString()).divide(new BigDecimal(map.get("buy_month").toString())).divide(new BigDecimal(map.get("lib_service").toString())).setScale(2, RoundingMode.HALF_UP);
+		model.addAttribute("unitPrice",unitPrice);
+		model.addAttribute("orderNo",map.get("orderNo")==null?"1":map.get("orderNo"));
+		model.addAttribute("price",map.get("price"));
+		model.addAttribute("sign_time",map.get("sign_time"));
+		model.addAttribute("end_sign_time",map.get("end_sign_time"));
+		model.addAttribute("backMonth", MapUtils.getInteger(map,"tf_count"));
+		model.addAttribute("libService", MapUtils.getInteger(map,"lib_service"));
+		model.addAttribute("libId",map.get("lib_id"));
+		model.addAttribute("id",map.get("id"));
+		return "weixin/invoice/add_refund";
+
+	}
+
+	@RequestMapping(value = "/saveRefundInfo",method = RequestMethod.POST)
+	@ResponseBody
+	public ResponseEntity saveRefundInfo(String id,String orderNo,String yourName,String openBank,String bankAccount,@RequestParam(value = "otherValue[]") String[] otherValue,String otherInput,@RequestParam(value = "vipIds[]")String[] vipIds){
+		ResponseEntity responseEntity = new ResponseEntity();
+		try {
+			adminSaleService.saveRefundInfo(id,orderNo,yourName,openBank,bankAccount,otherValue,otherInput,vipIds,UserUtil.getUserId(request));
+			responseEntity.success("提交成功");
+		}catch (Exception e){
+			e.printStackTrace();
+			responseEntity.failure("提交出现了点问题,请联系管理员!");
+		}
+
+		return responseEntity;
+	}
 }

+ 19 - 18
src/main/java/com/ssj/weixin/interceptor/SetControlDataInterceptor.java

@@ -89,22 +89,23 @@ public class SetControlDataInterceptor extends HandlerInterceptorAdapter {
         response.setContentType("text/html;charset=UTF-8");
         String url = request.getServletPath() + (request.getPathInfo() == null ? "" : request.getPathInfo());
         if (checkRequestURIIntNotFilterList(request,url)) { return true; }
-        boolean bool= UserUtil.WeixinOauth2(request,response);//是否从微信浏览器分享进来
-        if(!bool){
-     	   return false;
-        }
-        User user = UserUtil.getUser(request);
-        if(!notCheckPhoneList.contains(url)){
-			if(StringUtils.isEmpty(user.getMobile())){
-				String sysUrl=SystemResourceLocator.getValue("gz_book_url").toString();
-				//String sysUrl= "http://localhost:8081/";
-				response.sendRedirect(sysUrl+"/weixin/mylib/bindingMobilePhone.html?redirectUrl="+(sysUrl+url));
-				return false;
-			}
-        }
-        // 初始化用户信息<必须>
-        return checkRequestURIIntNotFilterList(request,response,url);
-        //return true;
+
+//        boolean bool= UserUtil.WeixinOauth2(request,response);//是否从微信浏览器分享进来
+//        if(!bool){
+//     	   return false;
+//        }
+//        User user = UserUtil.getUser(request);
+//        if(!notCheckPhoneList.contains(url)){
+//			if(StringUtils.isEmpty(user.getMobile())){
+//				String sysUrl=SystemResourceLocator.getValue("gz_book_url").toString();
+//				//String sysUrl= "http://localhost:8081/";
+//				response.sendRedirect(sysUrl+"/weixin/mylib/bindingMobilePhone.html?redirectUrl="+(sysUrl+url));
+//				return false;
+//			}
+//        }
+//        // 初始化用户信息<必须>
+//        return checkRequestURIIntNotFilterList(request,response,url);
+        return true;
     }
     
     //运行Controller后运行
@@ -126,8 +127,8 @@ public class SetControlDataInterceptor extends HandlerInterceptorAdapter {
         	tokenManager.createWxOpenId(openid, subscribe);
         }
         modelAndView.addObject("subscribe",subscribe);
-        modelAndView.addObject("sysUrl", SystemResourceLocator.getValue("gz_book_url"));
-       // modelAndView.addObject("sysUrl", "http://127.0.0.1:8081");
+//        modelAndView.addObject("sysUrl", SystemResourceLocator.getValue("gz_book_url"));
+        modelAndView.addObject("sysUrl", "http://127.0.0.1:8080");
         modelAndView.addObject("imgUrl", SystemResourceLocator.getValue("STATIC_FILE_URL"));
 
     }

+ 2 - 2
src/main/java/com/ssj/weixin/util/UserUtil.java

@@ -118,8 +118,8 @@ public class UserUtil {
 		HttpSession session = request.getSession();
         User user = (User) session.getAttribute("user");
         if(user==null){
-        	String openId=(String) session.getAttribute("openId");
-       	//String openId="o2VMi1qnP07FMr27dk75AVbeaygU";
+//        	String openId=(String) session.getAttribute("openId");
+       	String openId="o2VMi1qnP07FMr27dk75AVbeaygU";
         	if(openId !=null){
         		UserService userService= SystemResourceLocator.getBean(UserService.class);
         		user=userService.findByAccount(openId);

+ 374 - 0
src/main/resources/templates/weixin/invoice/add_refund.html

@@ -0,0 +1,374 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org">
+
+<head>
+	<meta charset="utf-8">
+	<title>退款申请</title>
+	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+
+	<!--标准mui.css-->
+	<link href="style/jquery-weui.css" th:href="@{/static/style/jquery-weui.css(version=${#dates.format(#calendars.createNow(),'yyyyMMdd')})}" rel="stylesheet"/>
+	<script th:include="weixin/common/includeJS_CSS" th:remove="tag" ></script>
+	<link href="style/vipcard.css" th:href="@{/static/style/vipcard.css(version=2021042510)}" rel="stylesheet"/>
+	<script src="js/jquery-weui.js" th:src="@{/static/js/jquery-weui.js}"></script>
+	<!--App自定义的css-->
+	<!--<link rel="stylesheet" type="text/css" href="../css/app.css" />-->
+	<style>
+		.mui-card .mui-control-content {
+			padding: 10px;
+		}
+		.mui-control-content {
+			height: 650px;
+		}
+		.mui-control-content .lineform .type{
+			margin-left: 18px;
+		}
+		.me-div-text{
+			font-size: 18px;
+			font-weight: bold;
+			margin-left: 10px;
+		}
+	</style>
+</head>
+
+<body>
+<header class="mui-bar mui-bar-nav">
+	<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
+	<h1 class="mui-title">商户退款申请</h1>
+</header>
+<div class="mui-content">
+	<div style="padding: 10px 10px;" id="tabTop1">
+		<div id="segmentedControl" class="mui-segmented-control">
+			<a class="mui-control-item mui-active" href="#item1">选择退款学生</a>
+			<a class="mui-control-item" href="#item2">其他信息</a>
+		</div>
+	</div>
+	<div id="itemNext1">
+		<div id="item1" class="mui-control-content mui-active">
+			<div id="pullrefresh" class="mui-scroll-wrapper">
+				<div class="mui-scroll">
+					<ul class="mui-table-view" id="studentPull">
+					</ul>
+				</div>
+			</div>
+		</div>
+		<div id="item2" class="mui-control-content vipcard panel">
+			<div class="mui-card">
+				<div th:if="${orderNo ne '1'}">
+				<div class="lineform self">
+					<div class="dc_flex">
+						<div class="type">订单号(原路径退回)</div>
+						<div class="dc_hd">[[${orderNo}]]</div>
+					</div>
+				</div>
+			</div>
+				<div class="lineform self">
+					<div class="dc_flex">
+						<div class="type">订单总金额</div>
+						<div class="dc_hd">[[${price}]]</div>
+					</div>
+				</div>
+				<div class="lineform self">
+					<div class="dc_flex">
+						<div class="type">订单端口数</div>
+						<div class="dc_hd">[[${libService}]]</div>
+					</div>
+				</div>
+				<div class="lineform self">
+					<div class="dc_flex">
+						<div class="type">退款总月数</div>
+						<div class="dc_hd">[[${backMonth}]]</div>
+					</div>
+				</div>
+				<div class="lineform self">
+					<div class="dc_flex">
+						<div class="type">预计退款金额</div>
+						<div class="dc_hd" >
+							<input type="text"  placeholder="实际退款金额以审核后的金额为准" id="showPrice"  name="backPrice" />
+						</div>
+					</div>
+				</div>
+			</div>
+			<div th:if="${orderNo eq '1'}" class="mui-card">
+				<div class="lineform self">
+					<div class="dc_flex">
+						<div class="type">收款人姓名</div>
+						<div class="dc_hd"><input type="text" name="yourName" id="yourName" placeholder="填写收款人真实姓名"/></div>
+					</div>
+				</div>
+				<div class="lineform self">
+					<div class="dc_flex">
+						<div class="type">开户行信息</div>
+						<div class="dc_hd"><input type="text" name="openBank" id="openBank" placeholder="填写开户行信息"/></div>
+					</div>
+				</div>
+				<div class="lineform self" id="self">
+					<div class="dc_flex">
+						<div class="type">收款人银行账号</div>
+						<div class="dc_hd"><input type="text" name="bankAccount" id="bankAccount" placeholder="填写收款人银行账号"/></div>
+					</div>
+				</div>
+			</div>
+			<!--退费原因 -->
+			<div class="mui-card">
+				<div class="me-div-text">退费原因</div>
+				<form class="mui-input-group">
+					<div class="mui-input-row mui-checkbox mui-left">
+						<label>没效果</label>
+						<input name="checkbox" value="没效果" type="checkbox" >
+					</div>
+					<div class="mui-input-row mui-checkbox mui-left">
+						<label>体验不好</label>
+						<input name="checkbox" value="体验不好" type="checkbox" checked>
+					</div>
+					<div class="mui-input-row mui-checkbox mui-left">
+						<label>孩子不愿意使用</label>
+						<input name="checkbox" type="checkbox" value="孩子不愿意使用">
+					</div>
+					<div class="mui-input-row mui-checkbox mui-left">
+						<label>特殊安排不需要(出国、转学等)</label>
+						<input name="checkbox" type="checkbox" value="特殊安排不需要(出国、转学等)">
+					</div>
+					<div class="mui-input-row mui-checkbox mui-left">
+						<label>其他</label>
+						<input name="checkbox" type="checkbox" value="其他">
+					</div>
+					<div class="mui-input-row mui-left mui-hidden" id="otherDiv">
+						<input name="other" type="text" value="" id="otherValueId" placeholder="输入其他原因">
+					</div>
+				</form>
+			</div>
+			<div class="panelbttom">
+				<a href="javascript:save();" id="save"  class="btn-blue">确定</a>
+			</div>
+		</div>
+	</div>
+</div>
+<script id="list_tpl" type="text/html">
+	{{# if(d.list!=null && d.list.length > 0){ }}
+	{{# for(var i = 0, len = d.list.length; i < len; i++){ }}
+	<li class="mui-table-view-cell mui-checkbox mui-left">
+		<input type="checkbox" name="childCheckbox" value="{{d.list[i].id}}" />孩子姓名:{{=d.list[i].childName}}
+	</li>
+	{{# } }}
+	{{# } }}
+</script>
+<script>
+	mui.init({
+		swipeBack: true, //启用右滑关闭功能
+		pullRefresh: {
+			container: '#pullrefresh',
+			up: {
+				contentrefresh: '正在加载...',
+				callback: pullupRefresh,
+				contentnomore:'没有更多数据了',//可选,请求完毕若没有更多数据时显示
+				auto:true //页面加载完就加载一次
+			}
+		}
+	});
+	// (function($) {
+	// 	$('#scroll').scroll({
+	// 		indicators: true //是否显示滚动条
+	// 	});
+	// })(mui);
+
+
+	var pageVal = 0;
+	var totalPage = 1;
+	var countVal = 10;
+	var libId = '[[${libId}]]';
+	var unitPrice = '[[${unitPrice}]]';
+
+	/**
+	 * 上拉加载具体业务实现
+	 */
+	function pullupRefresh() {
+		setTimeout(function() {
+			mui('#pullrefresh').pullRefresh().endPullupToRefresh((pageVal++ > totalPage -1)); //参数为true代表没有更多数据了。
+
+
+			var paramVal = {pageNo:pageVal,pageSize:countVal,libId:libId};
+
+
+			loadData(paramVal);
+
+		}, 1000);
+	}
+	// mui.ready(function() {
+	// 	mui('#studentPull').pullRefresh().pullupLoading();
+	// });
+
+	// mui.later(function(){
+	// 	mui('#studentPull').pullRefresh();
+	// 	console.log('定位到进入详情的页面');
+	// },500);
+
+	mui("body").on('tap','.list span',function(event){
+		this.click();
+	});
+	mui('.mui-content').on('tap','#save',function(){document.location.href=this.href;});
+
+	mui('#studentPull').on('change', 'input', function() {
+		var list = document.getElementById('studentPull');
+		var count = list.querySelectorAll('input[type="checkbox"]:checked').length;
+		$("#showPrice").val((Number(count)*Number(unitPrice)).toFixed(2));
+	});
+
+	mui('.mui-input-group').on('change', 'input', function() {
+		if(this.value == '其他'){
+			var done = document.getElementById("otherDiv");
+			if (this.checked) {
+				if (done.classList.contains("mui-hidden")) {
+					done.classList.remove("mui-hidden");
+				}
+			} else {
+				if (!done.classList.contains("mui-hidden")) {
+					done.classList.add("mui-hidden");
+				}
+			}
+		}
+	});
+	//加载数据
+	function loadData(params){
+		setTimeout(function () {
+			mui.ajax('[[@{/weixin/adminsale/getLibStudentList}]]',{
+				data:params,
+				dataType:'json',
+				type:'POST',
+				success:function(data){
+					if(data && data.code == 999){
+						if(data.data.totalSize > 0){
+							var table = document.getElementById("studentPull")
+							var listTpl = document.getElementById("list_tpl").innerHTML;
+
+							if(data.data.pageNo == 1){
+								laytpl(listTpl).render(data.data, function(html){
+									table.innerHTML = html;
+								});
+							}else{
+								laytpl(listTpl).render(data.data, function(html){
+									table.insertAdjacentHTML('beforeEnd', html);
+								});
+							}
+
+							var rowCount = data.data.totalSize;
+
+							if ((rowCount % countVal) == 0) {
+								totalPage = rowCount / countVal;
+							} else {
+								totalPage = parseInt((rowCount / countVal)) + 1;
+							}
+						}else{
+
+						}
+					}else{
+
+					}
+				},
+				error : function() {
+				}
+			});
+		}, 200);
+	}
+
+	function save(){
+		var orderNo = '[[${orderNo}]]';
+		if(orderNo == '1'){
+			//需要填写银行信息
+			var yourName = $('#yourName').val();
+			if(yourName == ''){
+				$.toast("填写收款人真实姓名","cancel");
+				return;
+			}
+			var openBank = $('#openBank').val();
+			if(openBank == ''){
+				$.toast("填写开户行信息","cancel");
+				return;
+			}
+			var bankAccount = $('#bankAccount').val();
+			if(bankAccount == ''){
+				$.toast("填写收款人银行账号","cancel");
+				return;
+			}
+		}
+
+		var checkedValues = checkValue();
+		if(checkedValues.length==0){
+			$.toast("请选择需要退费的学生","cancel");
+			return;
+		}
+		var otherValue = checkOtherValue();
+		var otherInput = $("#otherValueId").val();
+		if(otherValue.indexOf("其他")>0){
+			if(otherInput === ''){
+				$.toast("请输入其他原因","cancel");
+				return;
+			}
+		}
+		$('#save').attr('href','javascript:void(0);');
+		var url ="[[${sysUrl}]]/weixin/adminsale/saveRefundInfo";
+		var params;
+		if(orderNo == '1'){
+			params ={
+				'id' : '[[${id}]]',
+				'orderNo' : '[[${orderNo}]]',
+				'yourName' : yourName,
+				'openBank' : openBank,
+				'bankAccount' : bankAccount,
+				'otherValue' : otherValue,
+				'otherInput' : otherInput,
+				'vipIds' : checkedValues,
+			};
+		}else{
+			params ={
+				'id' : '[[${id}]]',
+				'orderNo' : '[[${orderNo}]]',
+				'otherValue' : otherValue,
+				'otherInput' : otherInput,
+				'vipIds' : checkedValues
+			};
+		}
+
+		$.post(url,params,function(data){
+			if (data.code == 999) {
+				$.toast(data.msg,"ok");
+				var jumpUrl ="[[${sysUrl}]]/weixin/adminsale/refundOrderIndex?libId="+libId;
+				location.replace(jumpUrl);
+				event.returnValue=false;
+				return false;
+			}else{
+				$.toast(data.msg,"cancel");
+				$('#save').attr('href','javascript:save();');
+			}
+		});
+	}
+
+	function checkValue() {
+		var list = document.getElementById('studentPull');
+		var checkboxArray = [].slice.call(list.querySelectorAll('input[type="checkbox"]'));
+		var checkedValues = [];
+		checkboxArray.forEach(function(box) {
+			if (box.checked) {
+				checkedValues.push(box.value);
+			}
+		});
+		return checkedValues;
+	}
+	function checkOtherValue() {
+		var list =  document.getElementsByClassName("mui-input-group").item(0);
+		var checkboxArray = [].slice.call(list.querySelectorAll('input[type="checkbox"]'));
+		var checkedValues = [];
+		checkboxArray.forEach(function(box) {
+			if (box.checked) {
+				checkedValues.push(box.value);
+			}
+		});
+		return checkedValues;
+	}
+</script>
+
+</body>
+
+</html>

+ 67 - 0
src/main/resources/templates/weixin/invoice/selectPhone.html

@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html lang="en" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
+ user-scalable=no">
+    <title>选择校区</title>
+    <link rel="stylesheet" href="/static/css/bindingMobilePhone.css">
+    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
+          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
+    <script src="js/jquery.min.js" th:src="@{/static/js/jquery.min.js}"></script>
+    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"
+            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
+            crossorigin="anonymous"></script>
+</head>
+<body>
+<div class="wrap">
+    <header><span>通过校区校长预留手机号搜索校区</span></header>
+    <div class="user-info">
+        <input id="phone" class="weui-input" type="text"  placeholder="请输入手机号"  
+        	style="ime-mode:disabled;" maxlength="11" onpaste="return false;" onkeyup="this.value=this.value.replace(/\D/g,'')"/>
+        <div class="btn">确定</div>
+    </div>
+</div>
+<script>
+	
+	$(function (){
+        $(".btn").click(function (){
+            subData();
+        });
+	})
+
+    function subData(){
+        var phone=$("#phone").val();
+        if(phone==''){
+            alert("请输入手机号码");
+            return false;
+        }
+        if(phone.length!=11){
+            alert("输入手机号码有误");
+            return false;
+        }
+        $.ajax({
+            url: "[[${sysUrl}]]/weixin/adminsale/getJoinInfo",
+            type: 'POST',
+            dataType: 'json',
+            data: {
+                'phone': phone
+            },
+            success: function(data) {
+                if (data && data.code == 999) {
+                    alert("查询成功");
+                    setTimeout(function () {
+                        location.replace('[[${sysUrl}]]/weixin/adminsale/refundOrderIndex?libId='+data.data.libId);
+                    }, 2000);
+                }else{
+                    alert(data.msg);
+                }
+            }
+        });
+    }
+</script>
+
+</body>
+</html>

+ 139 - 0
src/main/resources/templates/weixin/invoice/select_order.html

@@ -0,0 +1,139 @@
+<!DOCTYPE html>
+<html lang="zh-cmn-Hans" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
+    <title>退款订单选择</title>
+    <script th:include="weixin/common/includeJS_CSS" th:remove="tag" ></script>
+    <link href="style/sale.css" th:href="@{/static/style/sale.css(version=1003)}" rel="stylesheet"/>
+    <link href="style/administrator.css" th:href="@{/static/style/administrator.css(version=${#dates.format(#calendars.createNow(),'yyyyMMdd')})}" rel="stylesheet"/>
+    <link href="style/jquery-weui.css" th:href="@{/static/style/jquery-weui.css(version=${#dates.format(#calendars.createNow(),'yyyyMMdd')})}" rel="stylesheet"/>
+	<script src="js/jquery-weui.js" th:src="@{/static/js/jquery-weui.js}"></script>
+	<link rel="stylesheet" type="text/css" th:href="@{/static/style/mui.picker.min.css}" />
+	<script th:src="@{/static/js/mui/mui.picker.min.js}"></script>
+</head>
+<style>
+
+</style>
+<body class="bg_f2">
+	<nav class="mui-bar mui-bar-nav mui-text-center">
+		<div class="mui-gray">[[${join.leagueName}]]</div>
+	</nav>
+	<!--内容-->
+	<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
+		<div class="mui-content">
+			<div class="salebox">
+				<div class="buy_fuwu_item" id="list">
+						<!-- 数据显示 -->
+				</div>
+				<div class="weui-loadmore weui-loadmore_line">
+	            <span class="weui-loadmore__tips">已经到底啦</span>
+	        </div>
+			</div>
+		</div>
+	</div>
+	<script type="text/javascript">
+		(function($) {
+			$.init();
+		})(mui);
+	</script>
+<script id="list_tpl" type="text/html">
+{{# if(d.list!=null && d.list.length > 0){ }}
+{{# for(var i = 0, len = d.list.length; i < len; i++){ }}
+<div class="list">
+	<p class="txt">剩余月数/购买月数:{{=d.list[i].tf_count}}/{{=d.list[i].buy_month}}</p>
+	<p class="txt">剩余起始月:{{=d.list[i].sign_time}}</p>
+	<p class="txt">剩余终止月:{{=d.list[i].end_sign_time}}</p>
+	<p class="txt buy_fuwu_item_edit">订单总金额:{{=d.list[i].price}} <span class="edit" onclick="editFp('{{=d.list[i].id}}')" >选择<span class="arrow_right"></span></span></p>
+</div>
+{{# } }}
+{{# } }}
+</script>
+
+ <script type="text/javascript">
+    mui.init({
+		pullRefresh: {
+			container: '#pullrefresh',
+			up: {
+				contentrefresh: '正在加载...',
+				callback: pullupRefresh
+			}
+		}
+	});
+	
+	var pageVal = 0;
+ 	var totalPage = 1;
+ 	var countVal = 10;
+	var libId = '[[${libId}]]';
+	
+ 	/**
+ 	 * 上拉加载具体业务实现
+ 	 */
+ 	function pullupRefresh() {
+
+ 		setTimeout(function() {
+ 			mui('#pullrefresh').pullRefresh().endPullupToRefresh((pageVal++ > totalPage -1)); //参数为true代表没有更多数据了。
+ 							
+ 			
+ 			var paramVal = {pageNo:pageVal,pageSize:countVal,libId:libId};
+ 			
+ 			
+ 			loadData(paramVal);
+ 			
+ 		}, 1000);
+ 	}
+ 	mui.ready(function() {
+ 		mui('#pullrefresh').pullRefresh().pullupLoading();
+ 	});
+
+ 	function editFp(id){
+ 		window.location.href = "[[${sysUrl}]]/weixin/adminsale/refundOther.html?id="+id;
+ 	}
+ 	mui("body").on('tap','.list span',function(event){
+ 		this.click();
+ 	});
+ 	//加载数据
+ 	function loadData(params){
+ 		setTimeout(function () {
+ 			mui.ajax('[[@{/weixin/adminsale/getMealOrder}]]',{
+ 				data:params,
+ 				dataType:'json',
+ 				type:'POST',
+ 				success:function(data){
+ 					if(data && data.code == 999){
+ 						if(data.data.totalSize > 0){
+ 					 		var table = document.getElementById("list")
+ 					 		var listTpl = document.getElementById("list_tpl").innerHTML;
+ 					 
+ 							 if(data.data.pageNo == 1){
+ 					        	laytpl(listTpl).render(data.data, function(html){
+ 									table.innerHTML = html;
+ 								});
+ 					        }else{
+ 				        	 	laytpl(listTpl).render(data.data, function(html){
+ 									table.insertAdjacentHTML('beforeEnd', html);
+ 							 	});
+ 					        }
+ 					 
+ 					 		var rowCount = data.data.totalSize;
+ 					 		
+ 							 if ((rowCount % countVal) == 0) {
+ 								 totalPage = rowCount / countVal;
+ 							} else {
+ 								totalPage = parseInt((rowCount / countVal)) + 1;
+ 							}
+ 						}else{
+ 							
+ 						}		 
+ 					}else{
+ 						
+ 					}
+ 				 },
+ 				error : function() {
+ 				}
+ 			});
+ 		}, 200);
+ 	} 
+ </script>
+</body>
+</html>