|
@@ -1,6 +1,31 @@
|
|
|
package com.ssj.service.weixin.sales.service.impl;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
+import org.hibernate.validator.constraints.NotBlank;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
+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.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ssj.alipay.utils.AlipayOrderHelper;
|
|
|
import com.ssj.bean.curator.TbVacationLimit;
|
|
|
import com.ssj.bean.sys.give.GiveRecord;
|
|
@@ -8,21 +33,32 @@ 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.order.domain.Order;
|
|
|
-import com.ssj.bean.weixin.sales.domain.*;
|
|
|
+import com.ssj.bean.weixin.sales.domain.LibBorrowedService;
|
|
|
+import com.ssj.bean.weixin.sales.domain.LibOrderDetails;
|
|
|
+import com.ssj.bean.weixin.sales.domain.LibSalesPrice;
|
|
|
+import com.ssj.bean.weixin.sales.domain.LibVipService;
|
|
|
+import com.ssj.bean.weixin.sales.domain.WorkDay;
|
|
|
import com.ssj.bean.weixin.user.domain.User;
|
|
|
import com.ssj.bean.weixin.zyb.domain.ZuoybCourse;
|
|
|
-import com.ssj.dao.weixin.sales.dao.*;
|
|
|
+import com.ssj.dao.weixin.sales.dao.LibCourseDao;
|
|
|
+import com.ssj.dao.weixin.sales.dao.LibSalesPriceDao;
|
|
|
+import com.ssj.dao.weixin.sales.dao.LibStaffingQueryDao;
|
|
|
+import com.ssj.dao.weixin.sales.dao.LibVipServiceDao;
|
|
|
+import com.ssj.dao.weixin.sales.dao.LibVipServiceQueryDao;
|
|
|
import com.ssj.framework.basic.utils.DateHelper;
|
|
|
import com.ssj.framework.core.common.service.BaseServiceImpl;
|
|
|
import com.ssj.framework.core.persistence.DynamicSpecifications;
|
|
|
import com.ssj.framework.core.persistence.SearchFilter;
|
|
|
import com.ssj.framework.core.security.manager.TokenManager;
|
|
|
+import com.ssj.framework.core.util.HttpRemote;
|
|
|
+import com.ssj.framework.core.util.PropertiesUtil;
|
|
|
import com.ssj.framework.core.util.ResponseConstant;
|
|
|
import com.ssj.framework.core.util.ResponseEntity;
|
|
|
import com.ssj.framework.core.util.StringUtil;
|
|
|
import com.ssj.framework.core.util.SystemResourceLocator;
|
|
|
import com.ssj.framework.weixin.pay.OrderHelper;
|
|
|
import com.ssj.framework.weixin.pay.OrderUtil;
|
|
|
+import com.ssj.framework.weixin.pay.util.MD5Util;
|
|
|
import com.ssj.framework.weixin.util.DateUtil;
|
|
|
import com.ssj.service.conch.common.dto.ServiceRecordDto;
|
|
|
import com.ssj.service.conch.common.request.PayVipBatchReq;
|
|
@@ -39,22 +75,6 @@ import com.ssj.service.weixin.sales.service.LibVipServiceService;
|
|
|
import com.ssj.service.weixin.sales.service.WorkDayService;
|
|
|
import com.ssj.service.weixin.user.service.UserService;
|
|
|
import com.ssj.service.weixin.zuoyb.service.ZuoybCourseService;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
-import org.hibernate.validator.constraints.NotBlank;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.cache.annotation.Cacheable;
|
|
|
-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.math.BigDecimal;
|
|
|
-import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author ZhangCaibao
|
|
@@ -1682,29 +1702,59 @@ public class LibVipServiceServiceImpl extends BaseServiceImpl<LibVipService, Str
|
|
|
tokenManager.delString("CACH_SERVICE:ChildServiceList:com.ssj.service.weixin.sales.service.impl.LibVipServiceServiceImplgetChildServiceList" + vipId);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void removeLibService(String libId, Integer num) {
|
|
|
- if (num != null) {
|
|
|
- TbLibJoin libJoin = joinService.getById(libId);
|
|
|
- if (libJoin != null) {
|
|
|
- int studentNum = vipService.countByLibId(libId);
|
|
|
- //降级后的学生数大于机构可签约数,直接失效所有
|
|
|
- if (studentNum > num) {
|
|
|
- //将馆下所有相关校区服务失效
|
|
|
- libVipServiceDao.clearServiceByLibId(libId);
|
|
|
- //解绑馆下所有学生
|
|
|
- vipService.updateLibId(libId);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- //将馆下所有相关校区服务失效
|
|
|
- libVipServiceDao.clearServiceByLibId(libId);
|
|
|
- //解绑馆下所有学生
|
|
|
- vipService.updateLibId(libId);
|
|
|
- }
|
|
|
|
|
|
+ String host=PropertiesUtil.getValue("API_OPEN_URL");
|
|
|
+ String appid="zhidian";
|
|
|
+ String accessKey="Zhidian@34889_";
|
|
|
+
|
|
|
+ String accessToken=createOpenToken(appid, accessKey);
|
|
|
+ String url=host+"/open/api/parents/share/dealServiceCRM?appid="+appid+"&accessToken="+accessToken;
|
|
|
+
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
+ json.put("appid", libId);
|
|
|
+ json.put("libId", libId);
|
|
|
+ json.put("num", num);
|
|
|
+
|
|
|
+ try {
|
|
|
+ logger.info("调用第三方接口【dealServiceCRM】,请求URL:"+url);
|
|
|
+ logger.info("调用第三方接口【dealServiceCRM】,请求参数:"+json);
|
|
|
+ String text=HttpRemote.POSTMethod(url, json.toJSONString());
|
|
|
+ logger.info("调用第三方接口【dealServiceCRM】,返回结果:"+text);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.info("调用第三方接口【dealServiceCRM】,异常");
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ public static String createOpenToken(String appid, String accessKey) {
|
|
|
+ long time = System.currentTimeMillis() / 60000;
|
|
|
+ return MD5Util.MD5Encode(appid + accessKey + time, "utf-8");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String appid="zhidian";
|
|
|
+ String accessKey="Zhidian@34889_";
|
|
|
+ String accessToken=createOpenToken(appid, accessKey);
|
|
|
+ String url="https://master.sharingschool.com/open/api/parents/share/dealServiceCRM?appid="+appid+"&accessToken="+accessToken;
|
|
|
+
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
+ json.put("libId", "11");
|
|
|
+ json.put("num", 22);
|
|
|
+ try {
|
|
|
+ String text=HttpRemote.POSTMethod(url, json.toJSONString());
|
|
|
+ System.out.println("调用第三方接口【dealServiceCRM】,返回结果:"+text);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|