add cashier disable

master
luoyang 5 years ago
parent 70b1ca4cea
commit 078d74f85d

@ -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"));

@ -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);
}

@ -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);

@ -70,14 +70,16 @@
</a>
</td>
<td>
<a class="text-primary" style="padding-right: 5px" role="button" title="Edit"
<a ng-if="cashier.is_valid" class="text-primary" style="padding-right: 5px" role="button" title="Edit"
ui-sref=".edit({cashier_id:cashier.cashier_id})">
<i class="fa fa-pencil-square-o"></i>
</a> |
<a class="text-primary" style="padding-right: 5px" role="button" title="Detail"
</a>
<span ng-if="cashier.is_valid"> |</span>
<a ng-if="cashier.is_valid" class="text-primary" style="padding-right: 5px" role="button" title="Detail"
ui-sref=".detail({cashier_id:cashier.cashier_id})">
<i class="fa fa-search"></i>
</a> |
</a>
<span ng-if="cashier.is_valid"> |</span>
<a ng-if="cashier.is_valid" role="button" class="text-danger text-bold" ng-click="disableCashier(cashier)">Disable</a>
<a ng-if="!cashier.is_valid" role="button" class="text-success text-bold" ng-click="enableCashier(cashier)">Enable</a>
</td>

Loading…
Cancel
Save