|
|
@@ -1,8 +1,6 @@
|
|
|
package com.ssj.service.sys.fx.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.text.DateFormat;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
@@ -26,7 +24,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.ssj.bean.common.framework.core.domain.Response;
|
|
|
import com.ssj.bean.sys.fx.domain.Merchant;
|
|
|
import com.ssj.bean.sys.fx.domain.MerchantArea;
|
|
|
-import com.ssj.bean.sys.fx.domain.MerchantSign;
|
|
|
import com.ssj.bean.sys.organization.domain.Organization;
|
|
|
import com.ssj.bean.sys.role.domain.Admin;
|
|
|
import com.ssj.bean.weixin.libmy.domain.LibVip;
|
|
|
@@ -46,8 +43,8 @@ import com.ssj.framework.core.rabbitmq.producer.BaseRabbitSend;
|
|
|
import com.ssj.framework.core.util.RedisUtil;
|
|
|
import com.ssj.framework.core.util.SystemResourceLocator;
|
|
|
import com.ssj.service.sys.fx.service.MerchantAreaService;
|
|
|
+import com.ssj.service.sys.fx.service.MerchantMealService;
|
|
|
import com.ssj.service.sys.fx.service.MerchantService;
|
|
|
-import com.ssj.service.sys.fx.service.MerchantSignService;
|
|
|
import com.ssj.service.sys.organization.service.OrganizationService;
|
|
|
import com.ssj.service.sys.role.service.AdminService;
|
|
|
import com.ssj.service.sys.role.service.RoleService;
|
|
|
@@ -98,10 +95,10 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
private MerchantAreaService merchantAreaService;
|
|
|
|
|
|
@Autowired
|
|
|
- private CnAreaService cnAreaService;
|
|
|
+ private MerchantMealService merchantMealService;
|
|
|
|
|
|
@Autowired
|
|
|
- private MerchantSignService merchantSignService;
|
|
|
+ private CnAreaService cnAreaService;
|
|
|
|
|
|
@Autowired
|
|
|
private RoleService roleService;
|
|
|
@@ -1219,6 +1216,23 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
return dao.findMerchantSignBySummaryTime();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Merchant> findMerchantSignByAll() {
|
|
|
+ return dao.findMerchantSignByAll();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Merchant> findMerchantSignByActiveTime() {
|
|
|
+ return dao.findMerchantSignByActiveTime();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Merchant> findMerchantSignByComputeTime() {
|
|
|
+ return dao.findMerchantSignByComputeTime();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//保存旧模式商户
|
|
|
@Override
|
|
|
@Transactional
|
|
|
@@ -1246,19 +1260,13 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
oldmerchant.setLevel(merchant.getLevel());
|
|
|
oldmerchant.setPhone(merchant.getPhone());
|
|
|
oldmerchant.setPrice(merchant.getPrice());
|
|
|
- oldmerchant.setOutPrice(merchant.getOutPrice());
|
|
|
oldmerchant.setStatus(merchant.getStatus());
|
|
|
oldmerchant.setRemarks(merchant.getRemarks());
|
|
|
oldmerchant.setUnitName(merchant.getUnitName());
|
|
|
- oldmerchant.setSignService(merchant.getSignService());
|
|
|
oldmerchant.setType(merchant.getType());
|
|
|
- oldmerchant.setHardwareService(merchant.getHardwareService());
|
|
|
- oldmerchant.setHardwarePrice(merchant.getHardwarePrice());
|
|
|
oldmerchant.setAddress(merchant.getAddress());
|
|
|
- oldmerchant.setLibServiceMonth(0);
|
|
|
oldmerchant.setLocation(location);
|
|
|
|
|
|
- oldmerchant.setMunitPrice(merchant.getMunitPrice());
|
|
|
oldmerchant.setSignerPerson(merchant.getSignerPerson());
|
|
|
oldmerchant.setContractNo(merchant.getContractNo());
|
|
|
//合同签约时间
|
|
|
@@ -1346,14 +1354,17 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
merchant.setLibService(0);
|
|
|
merchant.setPlatformService(0);
|
|
|
merchant.setHardwareService(0);
|
|
|
+ merchant.setSignService(0);
|
|
|
merchant.setHardwarePrice((double)0);
|
|
|
- merchant.setLibServiceMonth(0);
|
|
|
+ merchant.setOutPrice((double)0);
|
|
|
+ merchant.setCurIsSummary(0);
|
|
|
+
|
|
|
merchant.setContractTime(startTime!=null ? DateHelper.parseDate(contractTimeStr, "yyyy-MM-dd") : null);
|
|
|
merchant.setSignTime(startTime!=null ? DateHelper.parseDate(startTime, "yyyy-MM-dd"): null);
|
|
|
merchant.setEndSignTime(endTime!=null ? DateHelper.parseDate(endTime, "yyyy-MM-dd"): null);
|
|
|
merchant.setCreateTime(new Date());
|
|
|
merchant.setSaleLoginName(curadmin.getLoginName());
|
|
|
- merchant.setCurIsSummary(0);
|
|
|
+
|
|
|
String code="SSJ-FX";
|
|
|
if(StringUtils.isNotEmpty(merchant.getParentPosCode())){
|
|
|
Merchant pMerchant =this.getMerchantByPosCode(merchant.getParentPosCode());
|
|
|
@@ -1425,12 +1436,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
Admin curadmin) {
|
|
|
Response response=new Response();
|
|
|
|
|
|
-
|
|
|
if(StringUtils.isNotEmpty(merchant.getId())){
|
|
|
-
|
|
|
- boolean isSignType=false;//修改了服务包
|
|
|
- boolean isServiceMonth=false;//修改了月份
|
|
|
-
|
|
|
Merchant oldmerchant =this.getById(merchant.getId());
|
|
|
|
|
|
if(StringUtils.isNotEmpty(merchant.getLibId())) {
|
|
|
@@ -1441,60 +1447,32 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(merchant.getLibServiceMonth()<oldmerchant.getLibServiceMonth()) {
|
|
|
- response.failure("您充值月份数不可小于当前月份数");
|
|
|
- return response;
|
|
|
- }
|
|
|
-
|
|
|
- //旧的月份
|
|
|
- Integer oldMonth=oldmerchant.getLibServiceMonth();
|
|
|
- //新的月份
|
|
|
- Integer month=merchant.getLibServiceMonth();
|
|
|
-
|
|
|
- if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
|
|
|
- isSignType=true;
|
|
|
- }
|
|
|
- if(!oldmerchant.getLibServiceMonth().equals(merchant.getLibServiceMonth())) {
|
|
|
- isServiceMonth=true;
|
|
|
- }
|
|
|
-
|
|
|
+ oldmerchant.setLibId(merchant.getLibId());
|
|
|
oldmerchant.setDeputyName(merchant.getDeputyName());
|
|
|
oldmerchant.setDeputyPhone(merchant.getDeputyPhone());
|
|
|
oldmerchant.setLegalPerson(merchant.getLegalPerson());
|
|
|
oldmerchant.setLevel(merchant.getLevel());
|
|
|
oldmerchant.setPhone(merchant.getPhone());
|
|
|
- oldmerchant.setPrice(merchant.getPrice());
|
|
|
- oldmerchant.setOutPrice(merchant.getOutPrice());
|
|
|
oldmerchant.setStatus(merchant.getStatus());
|
|
|
oldmerchant.setRemarks(merchant.getRemarks());
|
|
|
oldmerchant.setUnitName(merchant.getUnitName());
|
|
|
- oldmerchant.setSignService(merchant.getSignService());
|
|
|
oldmerchant.setType(merchant.getType());
|
|
|
oldmerchant.setHardwareService(merchant.getHardwareService());
|
|
|
oldmerchant.setHardwarePrice(merchant.getHardwarePrice());
|
|
|
oldmerchant.setAddress(merchant.getAddress());
|
|
|
oldmerchant.setMealType(merchant.getMealType());
|
|
|
- oldmerchant.setLibServiceMonth(merchant.getLibServiceMonth());
|
|
|
oldmerchant.setLocation(location);
|
|
|
-
|
|
|
- oldmerchant.setMunitPrice(merchant.getMunitPrice());
|
|
|
oldmerchant.setSignerPerson(merchant.getSignerPerson());
|
|
|
- oldmerchant.setBuyMonth(merchant.getBuyMonth());
|
|
|
- oldmerchant.setGiveMonth(merchant.getGiveMonth());
|
|
|
oldmerchant.setContractNo(merchant.getContractNo());
|
|
|
- oldmerchant.setPlusAmountPrice(merchant.getPlusAmountPrice());
|
|
|
- oldmerchant.setPlusMonthPrice(merchant.getPlusMonthPrice());
|
|
|
|
|
|
//合同签约时间
|
|
|
if(StringUtils.isNotEmpty(contractTimeStr)) {
|
|
|
oldmerchant.setContractTime(DateHelper.parseDate(contractTimeStr, "yyyy-MM-dd"));
|
|
|
}
|
|
|
-
|
|
|
//合同日期
|
|
|
if(StringUtils.isNotEmpty(startTime)) {
|
|
|
oldmerchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
|
|
|
}
|
|
|
-
|
|
|
//合同日期
|
|
|
if(StringUtils.isNotEmpty(endTime)) {
|
|
|
oldmerchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
|
|
|
@@ -1505,14 +1483,11 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
oldmerchant.setStartActiveTime(DateHelper.parseDate(startActiveTimeStr, "yyyy-MM-dd"));
|
|
|
}
|
|
|
|
|
|
- //激活结束日期,初始化下一个结算日。
|
|
|
+ //激活结束日期
|
|
|
if(StringUtils.isNotEmpty(activeTimeStr)) {
|
|
|
oldmerchant.setActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
-
|
|
|
- oldmerchant.setCurSummaryTime(oldmerchant.getActiveTime());//当前结算日为激活结束日期
|
|
|
- oldmerchant.setNextSummaryTime(DateHelper.getMonthDate(oldmerchant.getCurSummaryTime(),1));//下一个结算日为激活结束日期+1月
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//计费开始日期也可设为空
|
|
|
if(StringUtils.isNotEmpty(computeTimeStr)) {
|
|
|
oldmerchant.setComputeTime(DateHelper.parseDate(computeTimeStr, "yyyy-MM-dd"));
|
|
|
@@ -1520,14 +1495,15 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
oldmerchant.setComputeTime(null);
|
|
|
}
|
|
|
|
|
|
- //重新关联学校
|
|
|
+ this.save(oldmerchant);
|
|
|
+
|
|
|
+ //重新关联学校
|
|
|
if(StringUtils.isNotEmpty(schoollist)) {
|
|
|
//删除所有关联的学校
|
|
|
List<MerchantArea> merchantAreas=merchantAreaService.findSchoolByMerchantList(merchant.getId());
|
|
|
for (MerchantArea merchantArea : merchantAreas) {
|
|
|
merchantAreaService.delete(merchantArea);
|
|
|
}
|
|
|
-
|
|
|
merchantAreas=new ArrayList<MerchantArea>();
|
|
|
String[] areaIds=schoollist.split(";");
|
|
|
for (String areaId : areaIds) {
|
|
|
@@ -1541,79 +1517,11 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
merchantAreaService.save(merchantAreas);
|
|
|
}
|
|
|
|
|
|
- //如果修改了套餐的模式,就重新处理数据 加油包
|
|
|
- if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
|
|
|
- List<MerchantSign> merchantSigns=merchantSignService.findMerchantSignByMerchantIdGTTime(
|
|
|
- oldmerchant.getId(),
|
|
|
- oldmerchant.getComputeTime()!=null ? oldmerchant.getComputeTime() : oldmerchant.getActiveTime(),
|
|
|
- 0);
|
|
|
- Integer signNum=0;
|
|
|
- for (MerchantSign merchantSign : merchantSigns) {
|
|
|
- signNum=signNum+merchantSign.getLibService();
|
|
|
- }
|
|
|
- switch (merchant.getSignType()) {
|
|
|
- case 1:
|
|
|
- oldmerchant.setLibService(30+signNum);
|
|
|
- oldmerchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- oldmerchant.setLibService(50+signNum);
|
|
|
- oldmerchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- oldmerchant.setLibService(100+signNum);
|
|
|
- oldmerchant.setPortNum(400);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- oldmerchant.setLibService(20+signNum);
|
|
|
- oldmerchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- oldmerchant.setLibService(merchant.getLibService());
|
|
|
- oldmerchant.setPortNum(400);
|
|
|
- break;
|
|
|
- default:
|
|
|
- oldmerchant.setLibService(0);
|
|
|
- oldmerchant.setPortNum(0);
|
|
|
- break;
|
|
|
- }
|
|
|
- oldmerchant.setSignType(merchant.getSignType());//更新套餐
|
|
|
- }
|
|
|
- this.save(oldmerchant);
|
|
|
-
|
|
|
- if(isSignType || isServiceMonth) {
|
|
|
- //记录套餐更改记录
|
|
|
- for (int i = oldMonth+1; i <= month; i++) {
|
|
|
- TbLibJoinConsume consume=new TbLibJoinConsume();
|
|
|
- consume.setToLibId(merchant.getLibId());
|
|
|
- consume.setToMerchantId(merchant.getId());
|
|
|
- consume.setLibService(oldmerchant.getLibService());
|
|
|
- consume.setPlatformService(0);
|
|
|
- consume.setType(6);
|
|
|
- consume.setSignType(merchant.getSignType());
|
|
|
- consume.setComputeNum(merchant.getCurIsSummary());
|
|
|
- consume.setRemarks("服务包开通【服务包开通:第"+i+"月】");
|
|
|
- consume.setCreateTime(new Date());
|
|
|
- libJoinConsumeService.save(consume);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //调用openApi接口
|
|
|
+ //重新同步套餐的数据信息
|
|
|
if(StringUtils.isNotEmpty(oldmerchant.getLibId())) {
|
|
|
- DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- libVipServiceService.openApiServiceCRM(
|
|
|
- 3,
|
|
|
- oldmerchant.getLibId(),
|
|
|
- oldmerchant.getSignType(),
|
|
|
- oldmerchant.getMealType(),
|
|
|
- oldmerchant.getLibService(),
|
|
|
- oldmerchant.getStartActiveTime()!=null ? format.format(oldmerchant.getStartActiveTime()) : "",
|
|
|
- oldmerchant.getComputeTime()!=null ? format.format(oldmerchant.getComputeTime()) : format.format(oldmerchant.getActiveTime()),
|
|
|
- oldmerchant.getComputeTime()!=null ?
|
|
|
- format.format(DateHelper.getMonthDate(oldmerchant.getComputeTime(),oldmerchant.getLibServiceMonth())) :
|
|
|
- format.format(DateHelper.getMonthDate(oldmerchant.getActiveTime(),oldmerchant.getLibServiceMonth()))
|
|
|
- );
|
|
|
+ merchantMealService.updateMerchantByMeal(oldmerchant.getId());
|
|
|
}
|
|
|
+
|
|
|
this.syncRecordByMerchant(curadmin.getLoginName(), oldmerchant.getId(),"", "修改套餐商户");
|
|
|
|
|
|
}else{
|
|
|
@@ -1642,6 +1550,8 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
|
|
|
merchant.setLocation(location);
|
|
|
merchant.setPortNum(0);
|
|
|
+ merchant.setPrice((double) 0);
|
|
|
+ merchant.setOutPrice((double) 0);
|
|
|
merchant.setLibService(0);
|
|
|
merchant.setPlatformService(0);
|
|
|
merchant.setHardwareService(0);
|
|
|
@@ -1654,29 +1564,30 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
if(StringUtils.isNotEmpty(contractTimeStr)) {
|
|
|
merchant.setContractTime(DateHelper.parseDate(contractTimeStr, "yyyy-MM-dd"));
|
|
|
}
|
|
|
+ //合同开始日期
|
|
|
+ if(StringUtils.isNotEmpty(startTime)) {
|
|
|
+ merchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+ //合同结束日期
|
|
|
+ if(StringUtils.isNotEmpty(endTime)) {
|
|
|
+ merchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+ //激活开始日期
|
|
|
if(StringUtils.isNotEmpty(startActiveTimeStr)) {
|
|
|
merchant.setStartActiveTime(DateHelper.parseDate(startActiveTimeStr, "yyyy-MM-dd"));
|
|
|
}
|
|
|
+ //激活结束日期
|
|
|
if(StringUtils.isNotEmpty(activeTimeStr)) {
|
|
|
merchant.setActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
-
|
|
|
- merchant.setCurSummaryTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
- merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
|
|
|
}
|
|
|
+ //计费开始日期也可设为空
|
|
|
if(StringUtils.isNotEmpty(computeTimeStr)) {
|
|
|
merchant.setComputeTime(DateHelper.parseDate(computeTimeStr, "yyyy-MM-dd"));
|
|
|
-
|
|
|
- merchant.setCurSummaryTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
- merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(startTime)) {
|
|
|
- merchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(endTime)) {
|
|
|
- merchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
|
|
|
+ }else {
|
|
|
+ merchant.setComputeTime(null);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
String code="SSJ-FX";
|
|
|
if(StringUtils.isNotEmpty(merchant.getParentPosCode())){
|
|
|
Merchant pMerchant =this.getMerchantByPosCode(merchant.getParentPosCode());
|
|
|
@@ -1686,33 +1597,6 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
merchant.setOrgCode(code);
|
|
|
|
|
|
- switch (merchant.getSignType()) {
|
|
|
- case 1:
|
|
|
- merchant.setLibService(30);
|
|
|
- merchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- merchant.setLibService(50);
|
|
|
- merchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- merchant.setLibService(100);
|
|
|
- merchant.setPortNum(400);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- merchant.setLibService(20);
|
|
|
- merchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- merchant.setLibService(merchant.getLibService());
|
|
|
- merchant.setPortNum(400);
|
|
|
- break;
|
|
|
- default:
|
|
|
- merchant.setLibService(0);
|
|
|
- merchant.setPortNum(0);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
//添加admin用户信息
|
|
|
admin=new Admin();
|
|
|
admin.setLoginName(merchant.getPosCode());
|
|
|
@@ -1740,60 +1624,6 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
merchantAreaService.save(merchantAreas);
|
|
|
}
|
|
|
-
|
|
|
- //记录开通商户记录
|
|
|
- for (int i = 1; i <= merchant.getLibServiceMonth(); i++) {
|
|
|
- TbLibJoinConsume consume=new TbLibJoinConsume();
|
|
|
- consume.setToLibId(merchant.getLibId());
|
|
|
- consume.setToMerchantId(merchant.getId());
|
|
|
- consume.setLibService(merchant.getLibService());
|
|
|
- consume.setPlatformService(0);
|
|
|
- consume.setSignType(merchant.getSignType());
|
|
|
- consume.setType(6);
|
|
|
- consume.setComputeNum(merchant.getCurIsSummary());
|
|
|
- consume.setRemarks("服务包开通【服务包开通:第"+i+"月】");
|
|
|
- consume.setCreateTime(new Date());
|
|
|
- libJoinConsumeService.save(consume);
|
|
|
- }
|
|
|
-
|
|
|
- //如果激活时间小于当前时间,生成激活流水。
|
|
|
- if(merchant.getComputeTime()==null && merchant.getActiveTime().getTime()<=new Date().getTime()) {
|
|
|
- merchant.setCurIsSummary(1);
|
|
|
- merchant.setCurSummaryTime(new Date());
|
|
|
- merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
|
|
|
- this.save(merchant);
|
|
|
-
|
|
|
- //记录
|
|
|
- TbLibJoinConsume consume=new TbLibJoinConsume();
|
|
|
- consume.setFromLibId(merchant.getLibId());
|
|
|
- consume.setFromMerchantId(merchant.getId());
|
|
|
- consume.setLibService(merchant.getLibService());
|
|
|
- consume.setPlatformService(0);
|
|
|
- consume.setType(7);
|
|
|
- consume.setComputeNum(merchant.getCurIsSummary());
|
|
|
- consume.setSignType(merchant.getSignType());
|
|
|
- consume.setRemarks("激活期扣费【服务包扣费】");
|
|
|
- consume.setCreateTime(new Date());
|
|
|
- libJoinConsumeService.save(consume);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //调用openApi接口
|
|
|
- if(StringUtils.isNotEmpty(merchant.getLibId())) {
|
|
|
- DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- libVipServiceService.openApiServiceCRM(
|
|
|
- 3,
|
|
|
- merchant.getLibId(),
|
|
|
- merchant.getSignType(),
|
|
|
- merchant.getMealType(),
|
|
|
- merchant.getLibService(),
|
|
|
- merchant.getStartActiveTime()!=null ? format.format(merchant.getStartActiveTime()) : "",
|
|
|
- merchant.getComputeTime()!=null ? format.format(merchant.getComputeTime()) : format.format(merchant.getActiveTime()),
|
|
|
- merchant.getComputeTime()!=null ?
|
|
|
- format.format(DateHelper.getMonthDate(merchant.getComputeTime(),merchant.getLibServiceMonth())) :
|
|
|
- format.format(DateHelper.getMonthDate(merchant.getActiveTime(),merchant.getLibServiceMonth()))
|
|
|
- );
|
|
|
- }
|
|
|
|
|
|
this.syncRecordByMerchant(curadmin.getLoginName(), merchant.getId(),"", "新增套餐商户");
|
|
|
}
|
|
|
@@ -1812,10 +1642,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
Response response=new Response();
|
|
|
|
|
|
if(StringUtils.isNotEmpty(merchant.getId())){
|
|
|
-
|
|
|
- boolean isSignType=false;//修改了服务包
|
|
|
- boolean isServiceMonth=false;//修改了月份
|
|
|
-
|
|
|
+
|
|
|
Merchant oldmerchant =this.getById(merchant.getId());
|
|
|
|
|
|
if(StringUtils.isNotEmpty(merchant.getLibId())) {
|
|
|
@@ -1826,20 +1653,12 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //旧的月份
|
|
|
- Integer oldMonth=oldmerchant.getLibServiceMonth();
|
|
|
-
|
|
|
- if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
|
|
|
- isSignType=true;
|
|
|
- }
|
|
|
-
|
|
|
+ oldmerchant.setLibId(merchant.getLibId());
|
|
|
oldmerchant.setDeputyName(merchant.getDeputyName());
|
|
|
oldmerchant.setDeputyPhone(merchant.getDeputyPhone());
|
|
|
oldmerchant.setLegalPerson(merchant.getLegalPerson());
|
|
|
oldmerchant.setLevel(merchant.getLevel());
|
|
|
oldmerchant.setPhone(merchant.getPhone());
|
|
|
- oldmerchant.setPrice(merchant.getPrice());
|
|
|
- oldmerchant.setOutPrice(merchant.getOutPrice());
|
|
|
oldmerchant.setStatus(merchant.getStatus());
|
|
|
oldmerchant.setRemarks(merchant.getRemarks());
|
|
|
oldmerchant.setUnitName(merchant.getUnitName());
|
|
|
@@ -1849,17 +1668,9 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
oldmerchant.setHardwarePrice(merchant.getHardwarePrice());
|
|
|
oldmerchant.setAddress(merchant.getAddress());
|
|
|
oldmerchant.setMealType(merchant.getMealType());
|
|
|
- oldmerchant.setLibServiceMonth(merchant.getLibServiceMonth());
|
|
|
oldmerchant.setLocation(location);
|
|
|
-
|
|
|
- oldmerchant.setMunitPrice(merchant.getMunitPrice());
|
|
|
oldmerchant.setSignerPerson(merchant.getSignerPerson());
|
|
|
oldmerchant.setContractNo(merchant.getContractNo());
|
|
|
- oldmerchant.setBuyMonth(merchant.getBuyMonth());
|
|
|
- oldmerchant.setGiveMonth(merchant.getGiveMonth());
|
|
|
- oldmerchant.setContractNo(merchant.getContractNo());
|
|
|
- oldmerchant.setPlusAmountPrice(merchant.getPlusAmountPrice());
|
|
|
- oldmerchant.setPlusMonthPrice(merchant.getPlusMonthPrice());
|
|
|
|
|
|
//合同签约时间
|
|
|
if(StringUtils.isNotEmpty(contractTimeStr)) {
|
|
|
@@ -1876,25 +1687,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
oldmerchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
|
|
|
}
|
|
|
|
|
|
- //激活结束日期,初始化下一个结算日。
|
|
|
- if(StringUtils.isNotEmpty(activeTimeStr)) {
|
|
|
- oldmerchant.setStartActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
- oldmerchant.setActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
-
|
|
|
- oldmerchant.setCurSummaryTime(oldmerchant.getActiveTime());//当前结算日为激活结束日期
|
|
|
- oldmerchant.setNextSummaryTime(DateHelper.getMonthDate(oldmerchant.getCurSummaryTime(),1));//下一个结算日为激活结束日期+1月
|
|
|
- }
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(endActiveTimeStr)) {
|
|
|
- oldmerchant.setEndActiveTime(DateHelper.parseDate(endActiveTimeStr, "yyyy-MM-dd"));
|
|
|
- }
|
|
|
-
|
|
|
- Integer month=DateHelper.getDifferMonth(oldmerchant.getActiveTime(), oldmerchant.getEndActiveTime());
|
|
|
- oldmerchant.setLibServiceMonth(month);
|
|
|
-
|
|
|
- if(!oldMonth.equals(month)) {
|
|
|
- isServiceMonth=true;
|
|
|
- }
|
|
|
+ this.save(oldmerchant);
|
|
|
|
|
|
//重新关联学校
|
|
|
if(StringUtils.isNotEmpty(schoollist)) {
|
|
|
@@ -1903,7 +1696,6 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
for (MerchantArea merchantArea : merchantAreas) {
|
|
|
merchantAreaService.delete(merchantArea);
|
|
|
}
|
|
|
-
|
|
|
merchantAreas=new ArrayList<MerchantArea>();
|
|
|
String[] areaIds=schoollist.split(";");
|
|
|
for (String areaId : areaIds) {
|
|
|
@@ -1916,78 +1708,12 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
merchantAreaService.save(merchantAreas);
|
|
|
}
|
|
|
-
|
|
|
- //如果修改了套餐的模式,就重新处理数据 加油包
|
|
|
- if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
|
|
|
- List<MerchantSign> merchantSigns=merchantSignService.findMerchantSignByMerchantIdGTTime(
|
|
|
- oldmerchant.getId(),
|
|
|
- oldmerchant.getComputeTime()!=null ? oldmerchant.getComputeTime() : oldmerchant.getActiveTime(),
|
|
|
- 0);
|
|
|
- Integer signNum=0;
|
|
|
- for (MerchantSign merchantSign : merchantSigns) {
|
|
|
- signNum=signNum+merchantSign.getLibService();
|
|
|
- }
|
|
|
- switch (merchant.getSignType()) {
|
|
|
- case 1:
|
|
|
- oldmerchant.setLibService(30+signNum);
|
|
|
- oldmerchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- oldmerchant.setLibService(50+signNum);
|
|
|
- oldmerchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- oldmerchant.setLibService(100+signNum);
|
|
|
- oldmerchant.setPortNum(400);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- oldmerchant.setLibService(20+signNum);
|
|
|
- oldmerchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- oldmerchant.setLibService(merchant.getLibService());
|
|
|
- oldmerchant.setPortNum(400);
|
|
|
- break;
|
|
|
- default:
|
|
|
- oldmerchant.setLibService(0);
|
|
|
- oldmerchant.setPortNum(0);
|
|
|
- break;
|
|
|
- }
|
|
|
- oldmerchant.setSignType(merchant.getSignType());//更新套餐
|
|
|
- }
|
|
|
- this.save(oldmerchant);
|
|
|
-
|
|
|
- if(isSignType || isServiceMonth) {
|
|
|
- //记录套餐更改记录
|
|
|
- for (int i = oldMonth+1; i <= month; i++) {
|
|
|
- TbLibJoinConsume consume=new TbLibJoinConsume();
|
|
|
- consume.setToLibId(merchant.getLibId());
|
|
|
- consume.setToMerchantId(merchant.getId());
|
|
|
- consume.setLibService(oldmerchant.getLibService());
|
|
|
- consume.setPlatformService(0);
|
|
|
- consume.setType(6);
|
|
|
- consume.setSignType(merchant.getSignType());
|
|
|
- consume.setComputeNum(merchant.getCurIsSummary());
|
|
|
- consume.setRemarks("服务包开通【服务包开通:第"+i+"月】");
|
|
|
- consume.setCreateTime(new Date());
|
|
|
- libJoinConsumeService.save(consume);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //调用openApi接口
|
|
|
+
|
|
|
+ //同步套餐的数据信息
|
|
|
if(StringUtils.isNotEmpty(oldmerchant.getLibId())) {
|
|
|
- DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- libVipServiceService.openApiServiceCRM(
|
|
|
- 3,
|
|
|
- oldmerchant.getLibId(),
|
|
|
- oldmerchant.getSignType(),
|
|
|
- oldmerchant.getMealType(),
|
|
|
- oldmerchant.getLibService(),
|
|
|
- oldmerchant.getActiveTime()!=null ? format.format(oldmerchant.getActiveTime()) : "",
|
|
|
- oldmerchant.getActiveTime()!=null ? format.format(oldmerchant.getActiveTime()) : "",
|
|
|
- oldmerchant.getEndActiveTime()!=null ? format.format(oldmerchant.getEndActiveTime()) : ""
|
|
|
- );
|
|
|
+ merchantMealService.updateMerchantByMeal(oldmerchant.getId());
|
|
|
}
|
|
|
+
|
|
|
this.syncRecordByMerchant(curadmin.getLoginName(), oldmerchant.getId(),"", "修改套餐商户");
|
|
|
|
|
|
}else{
|
|
|
@@ -2016,31 +1742,19 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
|
|
|
merchant.setLocation(location);
|
|
|
merchant.setPortNum(0);
|
|
|
+ merchant.setLibService(0);
|
|
|
merchant.setPlatformService(0);
|
|
|
- merchant.setHardwareService(0);
|
|
|
- merchant.setHardwarePrice((double)0);
|
|
|
merchant.setCreateTime(new Date());
|
|
|
merchant.setSaleLoginName(curadmin.getLoginName());
|
|
|
merchant.setCurIsSummary(0);
|
|
|
+ merchant.setPrice((double) 0);
|
|
|
+ merchant.setOutPrice((double) 0);
|
|
|
+
|
|
|
|
|
|
if(StringUtils.isNotEmpty(contractTimeStr)) {
|
|
|
merchant.setContractTime(DateHelper.parseDate(contractTimeStr, "yyyy-MM-dd"));
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(activeTimeStr)) {
|
|
|
- merchant.setStartActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
- merchant.setActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
-
|
|
|
- merchant.setCurSummaryTime(merchant.getActiveTime());//当前结算日为激活结束日期
|
|
|
- merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));//下一个结算日为激活结束日期+1月
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(endActiveTimeStr)) {
|
|
|
- merchant.setEndActiveTime(DateHelper.parseDate(endActiveTimeStr, "yyyy-MM-dd"));
|
|
|
- }
|
|
|
-
|
|
|
- Integer month=DateHelper.getDifferMonth(merchant.getActiveTime(), merchant.getEndActiveTime());
|
|
|
- merchant.setLibServiceMonth(month);
|
|
|
-
|
|
|
if(StringUtils.isNotEmpty(startTime)) {
|
|
|
merchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
|
|
|
}
|
|
|
@@ -2057,33 +1771,6 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
merchant.setOrgCode(code);
|
|
|
|
|
|
- switch (merchant.getSignType()) {
|
|
|
- case 1:
|
|
|
- merchant.setLibService(30);
|
|
|
- merchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- merchant.setLibService(50);
|
|
|
- merchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- merchant.setLibService(100);
|
|
|
- merchant.setPortNum(400);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- merchant.setLibService(20);
|
|
|
- merchant.setPortNum(200);
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- merchant.setLibService(merchant.getLibService());
|
|
|
- merchant.setPortNum(400);
|
|
|
- break;
|
|
|
- default:
|
|
|
- merchant.setLibService(0);
|
|
|
- merchant.setPortNum(0);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
//添加admin用户信息
|
|
|
admin=new Admin();
|
|
|
admin.setLoginName(merchant.getPosCode());
|
|
|
@@ -2111,63 +1798,29 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
merchantAreaService.save(merchantAreas);
|
|
|
}
|
|
|
-
|
|
|
- //记录开通商户记录
|
|
|
- for (int i = 1; i <= merchant.getLibServiceMonth(); i++) {
|
|
|
- TbLibJoinConsume consume=new TbLibJoinConsume();
|
|
|
- consume.setToLibId(merchant.getLibId());
|
|
|
- consume.setToMerchantId(merchant.getId());
|
|
|
- consume.setLibService(merchant.getLibService());
|
|
|
- consume.setPlatformService(0);
|
|
|
- consume.setSignType(merchant.getSignType());
|
|
|
- consume.setType(6);
|
|
|
- consume.setComputeNum(merchant.getCurIsSummary());
|
|
|
- consume.setRemarks("服务包开通【服务包开通:第"+i+"月】");
|
|
|
- consume.setCreateTime(new Date());
|
|
|
- libJoinConsumeService.save(consume);
|
|
|
- }
|
|
|
-
|
|
|
- //调用openApi接口
|
|
|
- if(StringUtils.isNotEmpty(merchant.getLibId())) {
|
|
|
- DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- libVipServiceService.openApiServiceCRM(
|
|
|
- 3,
|
|
|
- merchant.getLibId(),
|
|
|
- merchant.getSignType(),
|
|
|
- merchant.getMealType(),
|
|
|
- merchant.getLibService(),
|
|
|
- merchant.getActiveTime()!=null ? format.format(merchant.getActiveTime()) : "",
|
|
|
- merchant.getActiveTime()!=null ? format.format(merchant.getActiveTime()) : "",
|
|
|
- merchant.getEndActiveTime()!=null ? format.format(merchant.getEndActiveTime()) : ""
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
this.syncRecordByMerchant(curadmin.getLoginName(), merchant.getId(),"", "新增套餐商户");
|
|
|
}
|
|
|
|
|
|
response.success();
|
|
|
return response;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Merchant updateMerchantByLibService(Merchant merchant) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- public List<Merchant> findMerchantSignByAll() {
|
|
|
- return dao.findMerchantSignByAll();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<Merchant> findMerchantSignByActiveTime() {
|
|
|
- return dao.findMerchantSignByActiveTime();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<Merchant> findMerchantSignByComputeTime() {
|
|
|
- return dao.findMerchantSignByComputeTime();
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|