Kaynağa Gözat

结算相关

wuwen 4 yıl önce
ebeveyn
işleme
ce51f75b3c

+ 4 - 4
src/main/java/com/ssj/dao/sys/fx/dao/MerchantDao.java

@@ -43,16 +43,16 @@ public interface MerchantDao extends JpaRepository<Merchant, String> {
 	@Query(nativeQuery = true, value = " SELECT t.* from fx_merchant t LEFT JOIN tb_lib_vip v ON t.lib_id=v.lib_id WHERE v.id IS NOT NULL AND v.id=?1 ORDER BY t.create_time DESC LIMIT 1 ")
 	public Merchant getMerchantByVipId(String vipId);
 	
-	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type in (1,2,3)  ORDER BY t.create_time ASC ")
+	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type>=1  ORDER BY t.create_time ASC ")
 	public List<Merchant> findMerchantSignByAll();
 	
-	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type in (1,2,3) AND TO_DAYS(t.next_summary_time)=TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
+	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type>=1 AND TO_DAYS(t.next_summary_time)=TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
 	public List<Merchant> findMerchantSignBySummaryTime();
 	
-	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type in (1,2,3) AND TO_DAYS(t.active_time)=TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
+	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type>=1 AND TO_DAYS(t.active_time)=TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
 	public List<Merchant> findMerchantSignByActiveTime();
 	
-	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type in (1,2,3) AND TO_DAYS(t.compute_time)=TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
+	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type>=1 AND TO_DAYS(t.compute_time)=TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
 	public List<Merchant> findMerchantSignByComputeTime();
 	
 	

+ 1 - 1
src/main/java/com/ssj/dao/weixin/library/dao/ILibJoinConsumeDao.java

@@ -19,7 +19,7 @@ public interface ILibJoinConsumeDao extends JpaRepository<TbLibJoinConsume, Stri
 	@Query(nativeQuery = true, value = " SELECT IFNULL(SUM(t.lib_service),0) as count from tb_lib_join_consume t where t.from_lib_id in ?1 AND t.type in (5) AND TO_DAYS(t.create_time)>=TO_DAYS(?2) AND TO_DAYS(t.create_time)<TO_DAYS(?3) ORDER BY t.create_time ASC ")
 	Integer countTbLibJoinDistributionByConsumeTime(String[] libIds,Date startTime,Date endTime);
 	
-	@Query(nativeQuery = true, value = " SELECT IFNULL(SUM(t.lib_service),0) as count from tb_lib_join_consume t where t.from_merchant_id in ?1 AND t.type in (2,3) AND TO_DAYS(t.create_time)>=TO_DAYS(?2) AND TO_DAYS(t.create_time)<TO_DAYS(?3) ORDER BY t.create_time ASC ")
+	@Query(nativeQuery = true, value = " SELECT IFNULL(SUM(t.lib_service),0) as count from tb_lib_join_consume t where t.from_merchant_id in ?1 AND t.type in (2,3) AND TO_DAYS(t.create_time)>=TO_DAYS(?2) AND TO_DAYS(t.create_time)<=TO_DAYS(?3) ORDER BY t.create_time ASC ")
 	Integer countMerchantConsumeByConsumeTime(String[] merchantIds,Date startTime,Date endTime);
 	
 	@Query(nativeQuery = true, value = " SELECT IFNULL(COUNT(1),0) from tb_lib_join_consume t WHERE t.from_merchant_id=?1 AND t.type=2 AND t.vip_id is NOT NULL AND TO_DAYS(DATE_SUB(NOW(),INTERVAL 1 DAY))=TO_DAYS(t.create_time) ")

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

@@ -877,17 +877,16 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 					//商户余的币>=还需扣的币时,扣除现有的。
 					if(libService>=needNum) {
 						merchant.setLibService(libService-needNum);
-						needNum=0;
 						
 						//记录扣币情况
-						syncMerchantByLibJoinAndConsume(merchant, needNum, "当前商户 [ "+merchant.getUnitName()+" ] 扣币,结算日服务扣币-商户端口:"+portNum+"-商户现存币数:"+libService+"-商户消费币数:"+consumeNum+"-商户需扣币数:"+needNum);
-					
+						syncMerchantByLibJoinAndConsume(merchant, needNum, "当前商户 [ "+merchant.getUnitName()+" ] 扣币,结算日服务扣币-商户端口:"+portNum+"-商户现存币数:"+libService+"-商户与子级消费币数:"+consumeNum+"-商户需扣币数:"+needNum);
+						needNum=0;
 					}else {
 						//不够的,先扣完自己的,再向上级扣,统一查出所有上级的列表。先从反向上开始扣,不够再向上扣。
 						merchant.setLibService(libService);
 						needNum=needNum-libService;
 						//记录扣币情况
-						syncMerchantByLibJoinAndConsume(merchant, libService, "当前商户 [ "+merchant.getUnitName()+" ] 扣币,结算日服务扣币-商户端口:"+portNum+"-商户现存币数:"+libService+"-商户消费币数:"+consumeNum+"-商户需扣币数:"+needNum);
+						syncMerchantByLibJoinAndConsume(merchant, libService, "当前商户 [ "+merchant.getUnitName()+" ] 扣币,结算日服务扣币-商户端口:"+portNum+"-商户现存币数:"+libService+"-商户与子级消费币数:"+consumeNum+"-商户需扣币数:"+needNum);
 
 						List<Merchant> parentMerchants=new ArrayList<Merchant>();
 						findParentMerchantList(parentMerchants, merchant);
@@ -896,9 +895,9 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 							//够扣了,跳出for,else不够扣,再向上扣。
 							if(parentMerchant.getLibService()>=needNum) {
 								parentMerchant.setLibService(parentMerchant.getLibService()-needNum);
-								needNum=0;
 								//记录扣币情况
 								syncMerchantByLibJoinAndConsume(parentMerchant, needNum, "商户 [ "+merchant.getUnitName()+" ] 向上级扣币,结算日服务扣币-商户需扣币数:"+needNum);
+								needNum=0;
 								break;
 							}else {
 								parentMerchant.setLibService(parentMerchant.getLibService());
@@ -2014,6 +2013,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 					case 3:
 						merchant.setLibService(100);
 						merchant.setPortNum(400);
+						break;
 					case 4:
 						merchant.setLibService(20);
 						merchant.setPortNum(200);

+ 3 - 3
src/main/resources/templates/sys/fx/merchantAllList.html

@@ -292,20 +292,20 @@
 		<li>
 			<label>机构端口:</label>
 			<label><b id="port_num">0</b> 个</label>
-			<input th:if="${curMerchant.posCode eq 'sishujia' || curMerchant.orgCode ne 'SSJ-FX' }"  onclick="joinServiceAdd(2);" type="button" style="width: 70px;height: 30px;border-radius: 50px;"  class="scbtn isportnum" value=" 添加 " />
+			<input  onclick="joinServiceAdd(2);" type="button" style="width: 70px;height: 30px;border-radius: 50px;"  class="scbtn isportnum" value=" 添加 " />
 		</li>
 		
 		<li>
 			<label>机构塾币:</label>
 			<label><b id="lib_service_num">0</b> 个</label>
-			<input th:if="${curMerchant.posCode eq 'sishujia'}" onclick="joinServiceAdd(1);" type="button" style="width: 70px;height: 30px;border-radius: 50px;margin-right: 10px;"  class="scbtn" value=" 添加 " />&nbsp;
+			<input  onclick="joinServiceAdd(1);" type="button" style="width: 70px;height: 30px;border-radius: 50px;margin-right: 10px;"  class="scbtn" value=" 添加 " />&nbsp;
 			<input onclick="merchantallot(1);" type="button" style="width: 70px;height: 30px;border-radius: 50px;background: #ffb752!important;"  class="scbtn" value=" 分配 " />
 		</li>
 		
 		<li>
 			<label>平台塾币:</label>
 			<label><b id="platform_service_num">0</b> 个</label>
-			<input th:if="${curMerchant.posCode eq 'sishujia'}" onclick="joinServiceAdd(3);" type="button" style="width: 70px;height: 30px;border-radius: 50px;margin-right: 10px;"  class="scbtn" value=" 添加 " />&nbsp;
+			<input  onclick="joinServiceAdd(3);" type="button" style="width: 70px;height: 30px;border-radius: 50px;margin-right: 10px;"  class="scbtn" value=" 添加 " />&nbsp;
 			<input onclick="merchantallot(2);" type="button" style="width: 70px;height: 30px;border-radius: 50px;background: #ffb752!important;"  class="scbtn" value=" 分配 " />
 		</li>