|
@@ -1223,6 +1223,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public Response saveMerchantByUsed(
|
|
|
Merchant merchant,
|
|
|
String startTime,String endTime,String password,String province,String city,String area,String schoollist,String location,
|
|
@@ -1410,6 +1411,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public Response saveMerchantByNew(
|
|
|
Merchant merchant,
|
|
|
String startTime,String endTime,String startActiveTimeStr,String activeTimeStr,String computeTimeStr,String password,String province,String city,String area,String schoollist,String location,
|
|
@@ -1418,18 +1420,18 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
|
|
|
if(StringUtils.isNotEmpty(merchant.getId())){
|
|
|
|
|
|
- boolean isLibId=false;
|
|
|
- boolean isSignType=false;
|
|
|
- boolean isMealType=false;
|
|
|
- boolean isServiceMonth=false;
|
|
|
+ boolean isSignType=false;//修改了服务包
|
|
|
+ boolean isServiceMonth=false;//修改了月份
|
|
|
+
|
|
|
Merchant oldmerchant =this.getById(merchant.getId());
|
|
|
|
|
|
- //发生了旧转新
|
|
|
+ //发生了旧转新,记录旧模式的币,端,当前时间。
|
|
|
if(oldmerchant.getSignType()==0) {
|
|
|
oldmerchant.setLibServiceOdd(oldmerchant.getLibService());
|
|
|
oldmerchant.setPortNumOdd(oldmerchant.getPortNum());
|
|
|
oldmerchant.setChangeTime(new Date());
|
|
|
}
|
|
|
+
|
|
|
if(StringUtils.isNotEmpty(merchant.getLibId())) {
|
|
|
Merchant libMerchant=this.getMerchantByLibId(merchant.getLibId());
|
|
|
if(libMerchant!=null && !libMerchant.getId().equals(merchant.getId())) {
|
|
@@ -1437,6 +1439,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
return response;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if(merchant.getLibServiceMonth()<oldmerchant.getLibServiceMonth()) {
|
|
|
response.failure("您充值月份数不可小于当前月份数");
|
|
|
return response;
|
|
@@ -1450,18 +1453,10 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
|
|
|
isSignType=true;
|
|
|
}
|
|
|
- if(!oldmerchant.getMealType().equals(merchant.getMealType())) {
|
|
|
- isMealType=true;
|
|
|
- }
|
|
|
if(!oldmerchant.getLibServiceMonth().equals(merchant.getLibServiceMonth())) {
|
|
|
isServiceMonth=true;
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(merchant.getLibId())) {
|
|
|
- if(!merchant.getLibId().equals(oldmerchant.getLibId())) {
|
|
|
- isLibId=true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
oldmerchant.setDeputyName(merchant.getDeputyName());
|
|
|
oldmerchant.setDeputyPhone(merchant.getDeputyPhone());
|
|
|
oldmerchant.setLegalPerson(merchant.getLegalPerson());
|
|
@@ -1481,35 +1476,44 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
oldmerchant.setLibServiceMonth(merchant.getLibServiceMonth());
|
|
|
oldmerchant.setLocation(location);
|
|
|
|
|
|
+ //合同日期
|
|
|
+ if(StringUtils.isNotEmpty(startTime)) {
|
|
|
+ oldmerchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
|
|
|
+ }
|
|
|
|
|
|
+ //合同日期
|
|
|
+ if(StringUtils.isNotEmpty(endTime)) {
|
|
|
+ oldmerchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+
|
|
|
+ //激活开始日期
|
|
|
if(StringUtils.isNotEmpty(startActiveTimeStr)) {
|
|
|
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(activeTimeStr)) {
|
|
|
- oldmerchant.setCurSummaryTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
- oldmerchant.setNextSummaryTime(DateHelper.getMonthDate(oldmerchant.getCurSummaryTime(),1));
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
+ //计费开始日期也可设为空
|
|
|
if(StringUtils.isNotEmpty(computeTimeStr)) {
|
|
|
oldmerchant.setComputeTime(DateHelper.parseDate(computeTimeStr, "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"));
|
|
|
+ }else {
|
|
|
+ oldmerchant.setComputeTime(null);
|
|
|
}
|
|
|
|
|
|
- //删除所有关联的学校
|
|
|
- List<MerchantArea> merchantAreas=merchantAreaService.findSchoolByMerchantList(merchant.getId());
|
|
|
- for (MerchantArea merchantArea : merchantAreas) {
|
|
|
- merchantAreaService.delete(merchantArea);
|
|
|
- }
|
|
|
//重新关联学校
|
|
|
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) {
|
|
@@ -1550,50 +1554,38 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
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());
|
|
|
+ oldmerchant.setSignType(merchant.getSignType());//更新套餐
|
|
|
}
|
|
|
-
|
|
|
- //商户同步学币/人数 到机构 / 时间
|
|
|
-// if(StringUtils.isNotEmpty(merchant.getLibId())) {
|
|
|
-// oldmerchant.setLibId(merchant.getLibId());
|
|
|
-// TbLibJoin libJoin= libJoinService.getById(oldmerchant.getLibId());
|
|
|
-// if(libJoin!=null) {
|
|
|
-// libJoin.setLibService(oldmerchant.getLibService());
|
|
|
-// libJoin.setPlatformService(oldmerchant.getPlatformService());
|
|
|
-//
|
|
|
-// libJoinService.save(libJoin);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
this.save(oldmerchant);
|
|
|
|
|
|
- if(isSignType || isMealType || isServiceMonth || isLibId) {
|
|
|
-
|
|
|
- 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);
|
|
|
- }
|
|
|
+ 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接口
|
|
|
+ }
|
|
|
+
|
|
|
+ //调用openApi接口
|
|
|
+ if(StringUtils.isNotEmpty(oldmerchant.getLibId())) {
|
|
|
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
libVipServiceService.openApiServiceCRM(
|
|
|
3,
|
|
@@ -1608,8 +1600,6 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
format.format(DateHelper.getMonthDate(oldmerchant.getActiveTime(),oldmerchant.getLibServiceMonth()))
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
this.syncRecordByMerchant(curadmin.getLoginName(), oldmerchant.getId(),"", "修改套餐商户");
|
|
|
|
|
|
}else{
|
|
@@ -1645,8 +1635,6 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
merchant.setCreateTime(new Date());
|
|
|
merchant.setSaleLoginName(curadmin.getLoginName());
|
|
|
merchant.setCurIsSummary(0);
|
|
|
- merchant.setSignTime(startTime!=null ? DateHelper.parseDate(startTime, "yyyy-MM-dd"):null);
|
|
|
- merchant.setEndSignTime(endTime!=null ? DateHelper.parseDate(endTime, "yyyy-MM-dd"): null);
|
|
|
|
|
|
if(StringUtils.isNotEmpty(startActiveTimeStr)) {
|
|
|
merchant.setStartActiveTime(DateHelper.parseDate(startActiveTimeStr, "yyyy-MM-dd"));
|
|
@@ -1656,8 +1644,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(computeTimeStr)) {
|
|
|
merchant.setComputeTime(DateHelper.parseDate(computeTimeStr, "yyyy-MM-dd"));
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(activeTimeStr)) {
|
|
|
+
|
|
|
merchant.setCurSummaryTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
|
|
|
merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
|
|
|
}
|
|
@@ -1668,6 +1655,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
merchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
String code="SSJ-FX";
|
|
|
if(StringUtils.isNotEmpty(merchant.getParentPosCode())){
|
|
|
Merchant pMerchant =this.getMerchantByPosCode(merchant.getParentPosCode());
|
|
@@ -1676,6 +1664,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
code=code+"-"+merchant.getPosCode();
|
|
|
}
|
|
|
merchant.setOrgCode(code);
|
|
|
+
|
|
|
switch (merchant.getSignType()) {
|
|
|
case 1:
|
|
|
merchant.setLibService(30);
|
|
@@ -1692,6 +1681,10 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
merchant.setLibService(20);
|
|
|
merchant.setPortNum(200);
|
|
|
break;
|
|
|
+ case 5:
|
|
|
+ merchant.setLibService(merchant.getLibService());
|
|
|
+ merchant.setPortNum(400);
|
|
|
+ break;
|
|
|
default:
|
|
|
merchant.setLibService(0);
|
|
|
merchant.setPortNum(0);
|
|
@@ -1725,19 +1718,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
|
|
|
}
|
|
|
merchantAreaService.save(merchantAreas);
|
|
|
}
|
|
|
-
|
|
|
- //商户同步学币/人数 到机构 / 时间
|
|
|
-// if(StringUtils.isNotEmpty(merchant.getLibId())) {
|
|
|
-// TbLibJoin libJoin= libJoinService.getById(merchant.getLibId());
|
|
|
-// if(libJoin!=null) {
|
|
|
-// libJoin.setLibService(merchant.getLibService());
|
|
|
-// libJoin.setPlatformService(merchant.getPlatformService());
|
|
|
-//
|
|
|
-// libJoinService.save(libJoin);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
//记录开通商户记录
|
|
|
for (int i = 1; i <= merchant.getLibServiceMonth(); i++) {
|
|
|
TbLibJoinConsume consume=new TbLibJoinConsume();
|