|
@@ -6,10 +6,12 @@ import com.bz.smart_city.commom.util.UserUtil;
|
|
import com.bz.smart_city.dao.pay.PayControlRecordMapper;
|
|
import com.bz.smart_city.dao.pay.PayControlRecordMapper;
|
|
import com.bz.smart_city.dao.pay.PayControlRuleMapper;
|
|
import com.bz.smart_city.dao.pay.PayControlRuleMapper;
|
|
import com.bz.smart_city.dao.pay.PayRechargeaccountMapper;
|
|
import com.bz.smart_city.dao.pay.PayRechargeaccountMapper;
|
|
|
|
+import com.bz.smart_city.dao.pay.archives.PayBaseCustomerandmeterrelaMapper;
|
|
import com.bz.smart_city.dto.LoginUser;
|
|
import com.bz.smart_city.dto.LoginUser;
|
|
import com.bz.smart_city.dto.pay.PayRechargeaccountDto;
|
|
import com.bz.smart_city.dto.pay.PayRechargeaccountDto;
|
|
import com.bz.smart_city.entity.pay.PayControlRecord;
|
|
import com.bz.smart_city.entity.pay.PayControlRecord;
|
|
import com.bz.smart_city.entity.pay.PayControlRule;
|
|
import com.bz.smart_city.entity.pay.PayControlRule;
|
|
|
|
+import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
|
|
import com.bz.smart_city.service.pay.PayControlRuleService;
|
|
import com.bz.smart_city.service.pay.PayControlRuleService;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -32,6 +34,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
PayRechargeaccountMapper payRechargeaccountMapper;
|
|
PayRechargeaccountMapper payRechargeaccountMapper;
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Integer add(PayControlRule payControlRule){
|
|
public Integer add(PayControlRule payControlRule){
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
@@ -55,7 +58,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
public List<PayControlRule>findList(String name){
|
|
public List<PayControlRule>findList(String name){
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
|
|
BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
|
|
- return payControlRuleMapper.findList(name,customerId);
|
|
|
|
|
|
+ return payControlRuleMapper.findList(null,name,customerId);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -64,7 +67,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
|
|
BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
|
|
|
|
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
- List<PayControlRule> payControlRules = payControlRuleMapper.findList(name,customerId);
|
|
|
|
|
|
+ List<PayControlRule> payControlRules = payControlRuleMapper.findList(null,name,customerId);
|
|
return new Pagination<>(payControlRules);
|
|
return new Pagination<>(payControlRules);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -114,6 +117,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
* @param value 判断值
|
|
* @param value 判断值
|
|
* @return 符合条件返回true
|
|
* @return 符合条件返回true
|
|
*/
|
|
*/
|
|
|
|
+ @Override
|
|
public boolean ConditionDebtDay(String accountId,String condition,String value){
|
|
public boolean ConditionDebtDay(String accountId,String condition,String value){
|
|
Integer day = payControlRuleMapper.findDebtDay(accountId);
|
|
Integer day = payControlRuleMapper.findDebtDay(accountId);
|
|
int paramDay = Integer.valueOf(value).intValue();
|
|
int paramDay = Integer.valueOf(value).intValue();
|
|
@@ -162,6 +166,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
* @param value 判断值
|
|
* @param value 判断值
|
|
* @return 符合条件返回true
|
|
* @return 符合条件返回true
|
|
*/
|
|
*/
|
|
|
|
+ @Override
|
|
public boolean ConditionDebtMoney(String accountId,String condition,String value){
|
|
public boolean ConditionDebtMoney(String accountId,String condition,String value){
|
|
BigDecimal money = payControlRuleMapper.findDebtMoney(accountId);
|
|
BigDecimal money = payControlRuleMapper.findDebtMoney(accountId);
|
|
if(money != null){
|
|
if(money != null){
|
|
@@ -257,6 +262,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
* @param value 判断值
|
|
* @param value 判断值
|
|
* @return 符合条件返回true
|
|
* @return 符合条件返回true
|
|
*/
|
|
*/
|
|
|
|
+ @Override
|
|
public boolean ConditionUsedMoney(String accountId,String condition,String value){
|
|
public boolean ConditionUsedMoney(String accountId,String condition,String value){
|
|
BigDecimal money = payControlRuleMapper.findUseMoeny(accountId);
|
|
BigDecimal money = payControlRuleMapper.findUseMoeny(accountId);
|
|
if(money != null){
|
|
if(money != null){
|
|
@@ -303,6 +309,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
* @param value 判断值
|
|
* @param value 判断值
|
|
* @return 符合条件返回true
|
|
* @return 符合条件返回true
|
|
*/
|
|
*/
|
|
|
|
+ @Override
|
|
public boolean ConditionOpenUsed(String accountId,String condition,String value){
|
|
public boolean ConditionOpenUsed(String accountId,String condition,String value){
|
|
Integer state = payControlRuleMapper.findDebtDay(accountId);
|
|
Integer state = payControlRuleMapper.findDebtDay(accountId);
|
|
int paramValue = Integer.valueOf(value).intValue();
|
|
int paramValue = Integer.valueOf(value).intValue();
|
|
@@ -333,6 +340,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
* @param value 判断值
|
|
* @param value 判断值
|
|
* @return 符合条件返回true
|
|
* @return 符合条件返回true
|
|
*/
|
|
*/
|
|
|
|
+ @Override
|
|
public boolean ConditionRechargeAndDebt(String accountId,String condition,String value){
|
|
public boolean ConditionRechargeAndDebt(String accountId,String condition,String value){
|
|
BigDecimal Recharge = payControlRuleMapper.findUseMoeny(accountId);
|
|
BigDecimal Recharge = payControlRuleMapper.findUseMoeny(accountId);
|
|
if(Recharge == null)
|
|
if(Recharge == null)
|
|
@@ -392,4 +400,49 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * @param id 阀控规则ID
|
|
|
|
+ * @param accountId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Integer GetConditionReusl(Integer id,String accountId){
|
|
|
|
+ List<PayControlRule> payControlRules = payControlRuleMapper.findList(id,null,null);
|
|
|
|
+ if(payControlRules.size() ==1){
|
|
|
|
+ String condition= payControlRules.get(0).getOperator();
|
|
|
|
+ String value = payControlRules.get(0).getValue();
|
|
|
|
+ boolean bl = false;
|
|
|
|
+ switch (payControlRules.get(0).getConditionId()){
|
|
|
|
+ case 1:{
|
|
|
|
+ bl = ConditionDebtDay(accountId,condition,value);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case 2:{
|
|
|
|
+ bl = ConditionDebtMoney(accountId,condition,value);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case 3:{
|
|
|
|
+ bl = ConditionRecharge(accountId,condition,value);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case 4:{
|
|
|
|
+ bl = ConditionOpenUsed(accountId,condition,value);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case 5:{
|
|
|
|
+ bl= ConditionRechargeAndDebt(accountId,condition,value);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(bl){
|
|
|
|
+ return new Integer(payControlRules.get(0).getAction());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|