wuwen 4 年之前
父節點
當前提交
148bd4bc7c

+ 31 - 4
src/main/java/com/ssj/api/controller/ApiMerchantController.java

@@ -24,6 +24,7 @@ import com.ssj.framework.core.util.ResponseConstant;
 import com.ssj.framework.core.util.ResponseEntity;
 import com.ssj.service.sys.fx.service.MerchantService;
 import com.ssj.service.weixin.library.service.ILibJoinConsumeService;
+import com.ssj.service.weixin.sales.service.LibVipServiceService;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -39,6 +40,8 @@ public class ApiMerchantController extends BaseController {
 	@Autowired
 	private ILibJoinConsumeService  libJoinConsumeService;
 	
+	@Autowired
+	private LibVipServiceService  libVipServiceService;
 	
 	
 	//1:激活日期之前,生成一条数据为0的记录,重新设置激活日期,设置下一个结算日。
@@ -53,7 +56,7 @@ public class ApiMerchantController extends BaseController {
 	@IgnoreSecurity
 	@RequestMapping(value = "/service")
     @ApiOperation(value = "获取商户套餐信息接口",  notes = "获取商户套餐信息接口")
-    public ResponseEntity getAccessToken(@RequestBody ServiceVo requestVO) {
+    public ResponseEntity service(@RequestBody ServiceVo requestVO) {
 		logger.info("第三方调用接口【service】,请求参数:"+JSONObject.toJSONString(requestVO));
         ResponseEntity responseEntity = new ResponseEntity();
         Map<String,Object> data=new HashMap<String, Object>();
@@ -66,7 +69,11 @@ public class ApiMerchantController extends BaseController {
         			if(consumes==null || consumes.size()<=0) {
         				logger.info("第三方调用接口【service】,商户产生激活期:"+merchant.getId());
         				
-	        			merchant.setCurIsSummary(0);
+        				if(merchant.getComputeTime()==null) {
+        					merchant.setCurIsSummary(1);
+        				}else {
+        					merchant.setCurIsSummary(0);
+        				}
 	        			merchant.setActiveTime(new Date());
 						merchant.setCurSummaryTime(new Date());
 						merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
@@ -84,6 +91,23 @@ public class ApiMerchantController extends BaseController {
 						consume.setRemarks("激活期扣费【服务包扣费】-来源开放接口");
 						consume.setCreateTime(new Date());
 						libJoinConsumeService.save(consume);
+						
+						
+						if(merchant.getComputeTime()==null) {
+							DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+							//调用openApi接口
+							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())));
+						}
         			}else {
         				
         				//自主激活的第一条都要记录,所以判断之前的数据是否有自主激活的,没有就保存一条。
@@ -115,8 +139,11 @@ public class ApiMerchantController extends BaseController {
         		data.put("id", merchant.getId());
         		data.put("libId", merchant.getLibId());
         		data.put("startActiveTime", merchant.getStartActiveTime()!=null ?  format.format(merchant.getStartActiveTime()) : "");
-        		data.put("summaryTime", merchant.getComputeTime()!=null ?  format.format(merchant.getComputeTime()) : "");
-        		data.put("endSummaryTime", merchant.getComputeTime()!=null ? format.format(DateHelper.getMonthDate(merchant.getComputeTime(),merchant.getLibServiceMonth())) : "");
+        		data.put("summaryTime", merchant.getComputeTime()!=null ? 
+        				format.format(merchant.getComputeTime()) :  format.format(merchant.getActiveTime()));
+        		data.put("endSummaryTime", merchant.getComputeTime()!=null ? 
+        				format.format(DateHelper.getMonthDate(merchant.getComputeTime(),merchant.getLibServiceMonth())) : 
+        					format.format(DateHelper.getMonthDate(merchant.getActiveTime(),merchant.getLibServiceMonth())) );
         		data.put("signType", merchant.getSignType());
         		data.put("mealType", merchant.getMealType());
         		data.put("libService", merchant.getLibService());

+ 14 - 12
src/main/java/com/ssj/service/sys/fx/service/impl/MerchantServiceImpl.java

@@ -1519,7 +1519,10 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 				
 				//如果修改了套餐的模式,就重新处理数据 加油包
 				if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
-					List<MerchantSign> merchantSigns=merchantSignService.findMerchantSignByMerchantIdGTTime(oldmerchant.getId(),oldmerchant.getComputeTime(),0);
+					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();
@@ -1557,9 +1560,6 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 						libJoin.setLibService(oldmerchant.getLibService());
 						libJoin.setPlatformService(oldmerchant.getPlatformService());
 						
-						libJoin.setSignType(oldmerchant.getSignType());
-						libJoin.setSignTime(oldmerchant.getSignTime());
-						libJoin.setEndSignTime(oldmerchant.getEndSignTime());
 						libJoinService.save(libJoin);
 					}	
 				}
@@ -1593,8 +1593,11 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 							oldmerchant.getMealType(),
 							oldmerchant.getLibService(),
 							oldmerchant.getStartActiveTime()!=null ? format.format(oldmerchant.getStartActiveTime()) : "",
-							oldmerchant.getComputeTime()!=null ? format.format(oldmerchant.getComputeTime()) : "",
-							oldmerchant.getComputeTime()!=null ? format.format(DateHelper.getMonthDate(oldmerchant.getComputeTime(),oldmerchant.getLibServiceMonth())) : "");
+							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()))
+							);
 				}
 				
 				
@@ -1718,10 +1721,6 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 						libJoin.setLibService(merchant.getLibService());
 						libJoin.setPlatformService(merchant.getPlatformService());
 						
-						libJoin.setSignType(merchant.getSignType());
-						libJoin.setSignTime(merchant.getSignTime());
-						libJoin.setEndSignTime(merchant.getEndSignTime());
-						
 						libJoinService.save(libJoin);
 					}	
 				}
@@ -1752,8 +1751,11 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 							merchant.getMealType(),
 							merchant.getLibService(),
 							merchant.getStartActiveTime()!=null ? format.format(merchant.getStartActiveTime()) : "",
-							merchant.getComputeTime()!=null ? format.format(merchant.getComputeTime()) : "",
-							merchant.getComputeTime()!=null ? format.format(DateHelper.getMonthDate(merchant.getComputeTime(),merchant.getLibServiceMonth())) : "");
+							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(),"", "新增套餐商户");

+ 70 - 14
src/main/java/com/ssj/service/sys/fx/service/impl/MerchantSignServiceImpl.java

@@ -121,8 +121,10 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 							merchant.getMealType(),
 							merchant.getLibService(),
 							merchant.getStartActiveTime()!=null ? format.format(merchant.getStartActiveTime()) : "",
-							merchant.getComputeTime()!=null ? format.format(merchant.getComputeTime()) : "",
-							merchant.getComputeTime()!=null ? format.format(DateHelper.getMonthDate(merchant.getComputeTime(),merchant.getLibServiceMonth())) : "" );
+							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())));
 				} catch (Exception e) {
 					e.printStackTrace();
 					logger.error("1:处理加油包过期数据,异常:"+e.getMessage());
@@ -167,8 +169,11 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 							merchant.getMealType(),
 							merchant.getLibService(),
 							merchant.getStartActiveTime()!=null ? format.format(merchant.getStartActiveTime()) : "",
-							merchant.getComputeTime()!=null ? format.format(merchant.getComputeTime()) : "",
-							merchant.getComputeTime()!=null ? format.format(DateHelper.getMonthDate(merchant.getComputeTime(),merchant.getLibServiceMonth())) : "" );
+							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()))
+										);
 					
 				} catch (Exception e) {
 					e.printStackTrace();
@@ -182,6 +187,11 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 			List<Merchant> activeMerchants=merchantService.findMerchantSignByActiveTime();
 			for (Merchant merchant : activeMerchants) {
 				try {
+					//如果开始计费时间为null,就不处理
+					if(merchant.getComputeTime()==null) {
+						continue;
+					}
+					
 					merchant.setCurIsSummary(0);
 					merchant.setCurSummaryTime(new Date());
 					merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
@@ -207,11 +217,50 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 			}
 			
 			
-			//3:处理激活日期的下一结算日数据,再生成一条0的结算数据,CurIsSummary=0的,设置下一个结算时间。
+			
+			//3:处理激活日期的数据,设置下一个结算日,CurIsSummary=1
+		    //注:如果在激活日期之前的时间,设置下一个结算日,CurIsSummary=1
+			for (Merchant merchant : activeMerchants) {
+				try {
+					
+					if(merchant.getComputeTime()==null) {
+						merchant.setCurIsSummary(1);
+						merchant.setCurSummaryTime(new Date());
+						merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));
+						merchantService.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);
+					}
+					
+				} catch (Exception e) {
+					e.printStackTrace();
+					logger.error("3:处理商户系统激活日期数据,异常:"+e.getMessage());
+				}
+			}
+			
+			
+			
+			//4:处理激活日期的下一结算日数据,再生成一条0的结算数据,CurIsSummary=0的,设置下一个结算时间。
 		    //注:设置当前的时间
 			List<Merchant> activeEndMerchants=merchantService.findMerchantSignBySummaryTime();
 			for (Merchant merchant : activeEndMerchants) {
 				
+				//如果开始计费时间为null,就不处理
+				if(merchant.getComputeTime()==null) {
+					continue;
+				}
+				
 				//只有在激活期的商户才处理数据。
 				if(merchant.getCurIsSummary()==null || merchant.getCurIsSummary()==0) {
 					try {
@@ -252,17 +301,21 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 
 					} catch (Exception e) {
 						e.printStackTrace();
-						logger.error("3:处理商户激活结算日期数据,异常:"+e.getMessage());
+						logger.error("4:处理商户激活结算日期数据,异常:"+e.getMessage());
 					}
 				}
 			}
 			
 			
 			
-			//4:处理开始计费日期,生成一条真实的数据30,设置当前的时间, 设置下一个结算日,CurIsSummary=+1,真实开始结算。
+			//5:处理开始计费日期,生成一条真实的数据30,设置当前的时间, 设置下一个结算日,CurIsSummary=+1,真实开始结算。
 			List<Merchant> computeMerchants=merchantService.findMerchantSignByComputeTime();
 			for (Merchant merchant : computeMerchants) {
 				try {
+					//如果开始计费时间为null,就不处理
+					if(merchant.getComputeTime()==null) {
+						continue;
+					}
 					
 					//记录激活期的结算
 					TbLibJoinConsume consume=new TbLibJoinConsume();
@@ -298,13 +351,13 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 
 				} catch (Exception e) {
 					e.printStackTrace();
-					logger.error("2:处理商户系统激活日期数据,异常:"+e.getMessage());
+					logger.error("5:处理商户系统激活日期数据,异常:"+e.getMessage());
 				}
 			}
 			
 			
 			
-			//5:处理商户结算的数据
+			//6:处理商户结算的数据
 			List<Merchant> summaryMerchants=merchantService.findMerchantSignBySummaryTime();
 			for (Merchant merchant : summaryMerchants) {
 				try {
@@ -381,7 +434,7 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 					
 				} catch (Exception e) {
 					e.printStackTrace();
-					logger.error("2:处理商户结算的数据,异常:"+e.getMessage());
+					logger.error("6:处理商户结算的数据,异常:"+e.getMessage());
 				}
 				
 			}
@@ -402,7 +455,7 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 		
 		//开始计费时间是否大等于今天。
 		boolean isGTDay=false;
-		Date computeTime=merchant.getComputeTime();
+		Date computeTime=merchant.getComputeTime()!=null ? merchant.getComputeTime(): merchant.getActiveTime();
 		if(computeTime.getTime()<=new Date().getTime()) {
 			computeTime=new Date();
 			isGTDay=true;
@@ -495,7 +548,7 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 			break;
 		}
 		
-		if(merchant.getComputeTime().getTime()<=new Date().getTime()) {
+		if(computeTime.getTime()<=new Date().getTime()) {
 			TbLibJoinConsume consume=null;
 			switch (signType) {
 			case 4:
@@ -548,8 +601,11 @@ public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, Strin
 						merchant.getMealType(),
 						merchant.getLibService(),
 						merchant.getStartActiveTime()!=null ? format.format(merchant.getStartActiveTime()) : "",
-						merchant.getComputeTime()!=null ? format.format(merchant.getComputeTime()) : "",
-						merchant.getComputeTime()!=null ? format.format(DateHelper.getMonthDate(merchant.getComputeTime(),merchant.getLibServiceMonth())) : "" );
+						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())) 
+									);
 			}
 		}
 		

+ 1 - 1
src/main/java/com/ssj/service/weixin/sales/service/impl/LibVipServiceServiceImpl.java

@@ -1728,7 +1728,7 @@ public class LibVipServiceServiceImpl extends BaseServiceImpl<LibVipService, Str
      */
     Date getEndDate(String vipId, String libId) {
         Merchant merchant=merchantService.getMerchantByLibId(libId);
-        return DateHelper.getMonthDate(merchant.getComputeTime(),merchant.getLibServiceMonth());
+        return DateHelper.getMonthDate(merchant.getComputeTime()!=null ? merchant.getComputeTime() : merchant.getActiveTime() ,merchant.getLibServiceMonth());
     }
 
 

+ 9 - 7
src/main/java/com/ssj/sys/controller/FxController.java

@@ -1352,10 +1352,6 @@ public class FxController  extends BaseController {
 				response.failure("新模式的结束激活日期不可为空");
 		        return response;
 			}
-			if(StringUtils.isEmpty(computeTimeStr)) {
-				response.failure("新模式的计费开始日不可为空");
-		        return response;
-			}
 			if(merchant.getLibServiceMonth()==null || merchant.getLibServiceMonth()<=0) {
 				response.failure("新模式的充值月份数不可小于0");
 		        return response;
@@ -1877,7 +1873,9 @@ public class FxController  extends BaseController {
 						monthStr=obj.getLibServiceMonth()+"/"+obj.getCurIsSummary();
 						startActiveTimeStr=DateHelper.format(obj.getStartActiveTime(), "yyyy-MM-dd") ;
 						activeTimeStr=DateHelper.format(obj.getActiveTime(), "yyyy-MM-dd") ;
-						computeTimeStr=DateHelper.format(obj.getComputeTime(), "yyyy-MM-dd") ;
+						if(obj.getComputeTime()!=null) {
+							computeTimeStr=DateHelper.format(obj.getComputeTime(), "yyyy-MM-dd") ;
+						}
 						libService_1=obj.getLibService()+"";
 						break;
 					case "2":
@@ -1885,7 +1883,9 @@ public class FxController  extends BaseController {
 						monthStr=obj.getLibServiceMonth()+"/"+obj.getCurIsSummary();
 						startActiveTimeStr=DateHelper.format(obj.getStartActiveTime(), "yyyy-MM-dd") ;
 						activeTimeStr=DateHelper.format(obj.getActiveTime(), "yyyy-MM-dd") ;
-						computeTimeStr=DateHelper.format(obj.getComputeTime(), "yyyy-MM-dd") ;
+						if(obj.getComputeTime()!=null) {
+							computeTimeStr=DateHelper.format(obj.getComputeTime(), "yyyy-MM-dd") ;
+						}
 						libService_1=obj.getLibService()+"";
 						break;
 					case "3":
@@ -1893,7 +1893,9 @@ public class FxController  extends BaseController {
 						monthStr=obj.getLibServiceMonth()+"/"+obj.getCurIsSummary();
 						startActiveTimeStr=DateHelper.format(obj.getStartActiveTime(), "yyyy-MM-dd") ;
 						activeTimeStr=DateHelper.format(obj.getActiveTime(), "yyyy-MM-dd") ;
-						computeTimeStr=DateHelper.format(obj.getComputeTime(), "yyyy-MM-dd") ;
+						if(obj.getComputeTime()!=null) {
+							computeTimeStr=DateHelper.format(obj.getComputeTime(), "yyyy-MM-dd") ;
+						}
 						libService_1=obj.getLibService()+"";
 						break;
 					default:

+ 11 - 0
src/main/resources/templates/sys/finance/allList6.html

@@ -16,6 +16,17 @@
 	.date_width{
 	     width: 150px;
 	}
+	
+	.tablelist th,td{
+		white-space: nowrap;
+		text-overflow: ellipsis;
+		overflow: hidden;
+	}
+	#mealServiceAdd .zwfb_shop_table {
+		margin-top: 10px
+	}
+	
+	
 </style>
 <body>
 <div class="place">

+ 1 - 1
src/main/resources/templates/sys/fx/merchantAdd.html

@@ -172,7 +172,7 @@ dtext{
 			</li>
 			
 			<li>
-				<label><b >【服务包模式】</b>计费开始日期:<b >*</b></label>
+				<label><b >【服务包模式】</b>计费开始日期:<b ></b></label>
 				<input type="text"  class="dfinput fl"  id="computeTime" name="computeTime"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',autoPickDate:true})" autocomplete="off" th:value="${#dates.format(merchant.computeTime, 'yyyy-MM-dd')}" placeholder="计费开始日期">
 			</li>