add contract analysis & pageable

master
wangning 7 years ago
parent 9467e91794
commit 50eb0d8180

@ -1,11 +1,12 @@
package au.com.royalpay.payment.manage.mappers.system;
import java.sql.SQLType;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
@ -27,6 +28,7 @@ public interface ClientsContractMapper {
@AutoSql(type = SqlType.SELECT)
List<JSONObject> list();
List<JSONObject> listWithClientInfo();
PageList<JSONObject> listWithClientInfo(PageBounds pagination);
List<JSONObject> analysisSingstatus();
}

@ -1,9 +1,9 @@
package au.com.royalpay.payment.manage.system.core;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import java.util.Date;
import java.util.List;
public interface ClientContractService {
@ -17,5 +17,7 @@ public interface ClientContractService {
void saveContract(int client_id, Date expire_date, String channel);
List<JSONObject> list();
JSONObject list(PageBounds pagination);
JSONObject analysis();
}

@ -8,8 +8,10 @@ import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
@ -130,7 +132,21 @@ public class ClientContractServiceImpl implements ClientContractService {
}
@Override
public List<JSONObject> list() {
return clientsContractMapper.listWithClientInfo();
public JSONObject list(PageBounds pagination) {
return PageListUtils.buildPageListResult(clientsContractMapper.listWithClientInfo(pagination));
}
@Override
public JSONObject analysis() {
List<JSONObject> contractAnalysis =clientsContractMapper.analysisSingstatus();
JSONObject result = new JSONObject();
for (JSONObject jsonObject : contractAnalysis) {
if(jsonObject.getIntValue("has_sign")==1){
result.put("has_sign",jsonObject.getIntValue("count"));
}else {
result.put("not_sign",jsonObject.getIntValue("count"));
}
}
return result;
}
}

@ -5,9 +5,11 @@ import au.com.royalpay.payment.manage.settlement.core.ManualSettleSupport;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -23,8 +25,13 @@ public class contractController {
private ManualSettleSupport manualSettleSupport;
@ManagerMapping(value = "/contract/list", method = RequestMethod.GET)
public List<JSONObject> contractList() {
return clientContractService.list();
public JSONObject contractList(@RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int limit) {
return clientContractService.list(new PageBounds(page,limit));
}
@ManagerMapping(value = "/contract", method = RequestMethod.GET)
public JSONObject contractAnalysis() {
return clientContractService.analysis();
}
@ManagerMapping(value = "/manualSettle/list", method = RequestMethod.GET)

@ -13,4 +13,9 @@
left join sys_accounts a on a.account_id = cc.sign_account_id
</select>
<select id="analysisSingstatus" resultType="com.alibaba.fastjson.JSONObject">
select count(1) count,has_sign from sys_clients_contract
group by has_sign
</select>
</mapper>

@ -20,9 +20,16 @@ define(['angular'], function (angular) {
})
}]);
app.controller('contractAnalysisCtrl', ['$scope', '$http', '$state', '$filter', 'commonDialog', function ($scope, $http, $state, $filter, commonDialog) {
$scope.getContractAnalysis = function () {
$http.get('/manage/common/analysis/contract/list').then(function (resp) {
$scope.contract_analysis = resp.data;
$scope.pagination = {};
$scope.getContractAnalysis = function (page) {
var params = {};
params.page = page || $scope.pagination.page || 1;
$http.get('/manage/common/analysis/contract/list', {params: params}).then(function (resp) {
$scope.contract = resp.data.data;
$scope.pagination = resp.data.pagination;
});
$http.get('/manage/common/analysis/contract').then(function (resp) {
$scope.analysis = resp.data;
});
};
$scope.getContractAnalysis();

@ -13,7 +13,9 @@
</ul>
<div class="modal-body">
<div class="box box-danger">
<div class="box-header">商户合同情况</div>
<div class="box-header">商户合同情况
<small>(查看合同数:{{analysis.has_sign + analysis.not_sign}},已同意:{{analysis.has_sign}})</small>
</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead>
@ -25,7 +27,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="contract in contract_analysis">
<tr ng-repeat="contract in contract">
<td ng-bind="contract.client_moniker"></td>
<td ng-bind="contract.create_time|date:'dd/MMM/yyyy'"></td>
<td ng-bind="contract.confirm_time|date:'dd/MMM/yyyy'"></td>
@ -34,5 +36,22 @@
</tbody>
</table>
</div>
<div class="modal-footer">
<uib-pagination ng-if="contract.length"
class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="getContractAnalysis()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
</div>
</div>
</div>
Loading…
Cancel
Save