diff --git a/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierOrderServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierOrderServiceImp.java index 2a49581a6..3b279a7ce 100644 --- a/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierOrderServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierOrderServiceImp.java @@ -4,13 +4,13 @@ import au.com.royalpay.payment.manage.cashiers.beans.CashierQueryBean; import au.com.royalpay.payment.manage.cashiers.core.CashierOrderService; import au.com.royalpay.payment.manage.mappers.cashiers.CashierMapper; import au.com.royalpay.payment.manage.mappers.cashiers.CashierOrderMapper; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.springframework.stereotype.Service; -import org.springframework.util.Assert; import javax.annotation.Resource; @@ -36,8 +36,10 @@ public class CashierOrderServiceImp implements CashierOrderService { @Override public JSONObject listCashierOrders(String cashier_id, JSONObject partner, CashierQueryBean query) { - JSONObject cashier = cashierMapper.findOne(cashier_id); - Assert.notNull(cashier, "cashier not found"); + JSONObject cashier = cashierMapper.findIsValidById(cashier_id); + if (cashier == null) { + throw new BadRequestException("Cashier Not Found Or Disabled"); + } String timezone = partner.getJSONObject("client").getString("timezone"); JSONObject params = query.params(timezone); params.put("client_id", partner.getIntValue("client_id")); diff --git a/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierServiceImp.java index b7a5862cd..09d4343e9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierServiceImp.java @@ -82,6 +82,13 @@ public class CashierServiceImp implements CashierService { throw new ForbiddenException("You have no permission!"); } cashier.put("is_valid", isValid); + if (!isValid) { + cashier.put("wechat_openid", null); + cashier.put("nick_name", null); + cashier.put("headimgurl", null); + cashier.put("phone", null); + cashier.put("photo", null); + } cashierMapper.update(cashier); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/cashiers/CashierMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/cashiers/CashierMapper.java index c495ca7b6..b52161bc7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/cashiers/CashierMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/cashiers/CashierMapper.java @@ -1,11 +1,12 @@ package au.com.royalpay.payment.manage.mappers.cashiers; -import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; -import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; -import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; +import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; +import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; +import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; +import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -26,6 +27,10 @@ public interface CashierMapper { @AutoSql(SqlType.SELECT) JSONObject findOne(@Param("cashier_id") String cashier_id); + @AutoSql(SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1") + JSONObject findIsValidById(@Param("cashier_id") String cashier_id); + @AutoSql(SqlType.INSERT) void save(JSONObject cashier); diff --git a/src/main/ui/static/payment/cashiers/templates/cashiers.html b/src/main/ui/static/payment/cashiers/templates/cashiers.html index 725b26446..cfe9f8637 100644 --- a/src/main/ui/static/payment/cashiers/templates/cashiers.html +++ b/src/main/ui/static/payment/cashiers/templates/cashiers.html @@ -70,14 +70,16 @@ - - | - + | + - | + + | Disable Enable