|
@@ -12,7 +12,6 @@ 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;
|
|
@@ -28,6 +27,7 @@ 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.fx.domain.Merchant;
|
|
|
import com.ssj.bean.sys.give.GiveRecord;
|
|
|
import com.ssj.bean.weixin.libmy.domain.LibVip;
|
|
|
import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
|
|
@@ -64,6 +64,7 @@ import com.ssj.service.conch.common.dto.ServiceRecordDto;
|
|
|
import com.ssj.service.conch.common.request.PayVipBatchReq;
|
|
|
import com.ssj.service.conch.curator.service.v1.IVacationLimitService;
|
|
|
import com.ssj.service.conch.parents.v2.dto.ServiceRecordV1Dto;
|
|
|
+import com.ssj.service.sys.fx.service.MerchantService;
|
|
|
import com.ssj.service.sys.give.GiveRecordService;
|
|
|
import com.ssj.service.weixin.library.service.IBookManagerService;
|
|
|
import com.ssj.service.weixin.library.service.ILibJoinService;
|
|
@@ -121,6 +122,8 @@ public class LibVipServiceServiceImpl extends BaseServiceImpl<LibVipService, Str
|
|
|
private IVacationLimitService vacationLimitService;
|
|
|
@Autowired
|
|
|
private GiveRecordService giveRecordService;
|
|
|
+ @Autowired
|
|
|
+ private MerchantService merchantService;
|
|
|
@Override
|
|
|
public PagingAndSortingRepository<LibVipService, String> getDao() {
|
|
|
return libVipServiceDao;
|
|
@@ -1663,24 +1666,7 @@ public class LibVipServiceServiceImpl extends BaseServiceImpl<LibVipService, Str
|
|
|
return serviceList;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void insertLibCorrectService(@NotBlank String vipId, @NotBlank String libId) {
|
|
|
- LibVipService libVipService = new LibVipService();
|
|
|
- libVipService.setVipId(vipId);
|
|
|
- libVipService.setLibId(libId);
|
|
|
- libVipService.setStartTime(new Date());
|
|
|
- libVipService.setEndTime(DateUtil.parse_yyyyMMdd("9999-01-01"));
|
|
|
- libVipService.setStat(1);
|
|
|
- libVipService.setSpecies("S003");
|
|
|
- libVipService.setType("C025");
|
|
|
- libVipService.setCreateTime(new Date());
|
|
|
- //为校区批改服务
|
|
|
- libVipService.setCorrectType(5);
|
|
|
- //排所有服务优先级第4
|
|
|
- libVipService.setServiceSort(4);
|
|
|
- this.save(libVipService);
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public LibVipService findCorrectTypeByVipId(String vipId){
|
|
|
return libVipServiceDao.findCorrectTypeByVipId(vipId);
|
|
@@ -1703,6 +1689,127 @@ public class LibVipServiceServiceImpl extends BaseServiceImpl<LibVipService, Str
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void insertLibServiceByType(String vipId, String libId, Date endDate, int signType) {
|
|
|
+ if (signType > 0) {
|
|
|
+ //新套餐,需要给校区服务和批改服务两个,结束时间保持一致
|
|
|
+ if (endDate == null) {
|
|
|
+ //查询这个馆下有没有有效的服务
|
|
|
+ endDate = this.getEndDate(vipId, libId);
|
|
|
+ }
|
|
|
+ this.insertLibCorrectService(vipId, libId, endDate);
|
|
|
+ this.insertLibService(vipId, libId, endDate);
|
|
|
+ } else {
|
|
|
+ //老套餐,只需要给指定的校区服务
|
|
|
+ this.insertLibService(vipId, libId, endDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void insertLibCorrectServiceByType(String vipId, String libId, Date endDate, int signType) {
|
|
|
+ if (signType > 0) {
|
|
|
+ //新套餐,给的这个服务需要和校区服务保持一致的结束时间
|
|
|
+ if (endDate == null) {
|
|
|
+ //查询这个馆下有没有有效的服务
|
|
|
+ endDate = this.getEndDate(vipId, libId);
|
|
|
+ }
|
|
|
+ this.insertLibCorrectService(vipId, libId, endDate);
|
|
|
+ } else {
|
|
|
+ //老套餐,直接给永久服务
|
|
|
+ this.insertLibCorrectService(vipId, libId, DateUtil.parse_yyyyMMdd("9999-01-01"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取馆服务的结束时间
|
|
|
+ *
|
|
|
+ * @param vipId
|
|
|
+ * @param libId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ Date getEndDate(String vipId, String libId) {
|
|
|
+ Merchant merchant=merchantService.getMerchantByLibId(libId);
|
|
|
+ return merchant.getNextSummaryTime();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增校区批改服务
|
|
|
+ *
|
|
|
+ * @param vipId
|
|
|
+ * @param libId
|
|
|
+ * @param endDate
|
|
|
+ */
|
|
|
+ void insertLibCorrectService(String vipId, String libId, Date endDate) {
|
|
|
+ Date now = new Date();
|
|
|
+ //之前的校区批改服务
|
|
|
+ LibVipService libVipService = libVipServiceDao.findTopByVipIdAndLibIdAndSpeciesAndTypeOrderByCreateTimeDesc(vipId, libId, "S003", "C025");
|
|
|
+ if (libVipService == null) {
|
|
|
+ libVipService = new LibVipService();
|
|
|
+ libVipService.setVipId(vipId);
|
|
|
+ libVipService.setLibId(libId);
|
|
|
+ libVipService.setStartTime(now);
|
|
|
+ libVipService.setEndTime(endDate);
|
|
|
+ libVipService.setStat(1);
|
|
|
+ libVipService.setSpecies("S003");
|
|
|
+ libVipService.setType("C025");
|
|
|
+ libVipService.setCreateTime(now);
|
|
|
+ //为校区批改服务
|
|
|
+ libVipService.setCorrectType(5);
|
|
|
+ //排所有服务优先级第4
|
|
|
+ libVipService.setServiceSort(4);
|
|
|
+ this.save(libVipService);
|
|
|
+ } else {
|
|
|
+ libVipService.setStat(1);
|
|
|
+ this.save(libVipService);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新加校区服务
|
|
|
+ *
|
|
|
+ * @param vipId
|
|
|
+ * @param libId
|
|
|
+ * @param endDate
|
|
|
+ */
|
|
|
+ void insertLibService(String vipId, String libId, Date endDate) {
|
|
|
+ Date now = new Date();
|
|
|
+ //是否期满
|
|
|
+ boolean expired = false;
|
|
|
+ if (!DateHelper.compareTwoDate(now, endDate)) {
|
|
|
+ expired = true;
|
|
|
+ }
|
|
|
+ //之前的校区服务
|
|
|
+ LibVipService libVipService = libVipServiceDao.findTopByVipIdAndLibIdAndSpeciesAndTypeOrderByCreateTimeDesc(vipId, libId, "S003", "C024");
|
|
|
+ if (libVipService == null) {
|
|
|
+ libVipService = new LibVipService();
|
|
|
+ libVipService.setVipId(vipId);
|
|
|
+ libVipService.setLibId(libId);
|
|
|
+ libVipService.setStartTime(now);
|
|
|
+ libVipService.setEndTime(endDate);
|
|
|
+ libVipService.setSpecies("S003");
|
|
|
+ libVipService.setType("C024");
|
|
|
+ libVipService.setCreateTime(now);
|
|
|
+ //为校区服务
|
|
|
+ libVipService.setCorrectType(2);
|
|
|
+ //排所有服务优先级第3
|
|
|
+ libVipService.setServiceSort(3);
|
|
|
+ this.save(libVipService);
|
|
|
+ }
|
|
|
+ if (expired) {
|
|
|
+ //期满,设置为失效
|
|
|
+ libVipService.setStat(2);
|
|
|
+ this.save(libVipService);
|
|
|
+ } else {
|
|
|
+ libVipService.setStat(1);
|
|
|
+ this.save(libVipService);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void openApiServiceCRM(Integer type,String libId,Integer num,String endTime) {
|