Merge branch 'actChairty' into develop_client_permission

master
luoyang14z7 6 years ago
commit c87a9bc10b

@ -17,12 +17,12 @@ public interface ActChairtyService {
JSONObject listChairClients(int page, int limit);
void disableClient(String clientMoniker);
List<JSONObject> getWeekendAnalysis(JSONObject params);
PageList<JSONObject> getClientRank(JSONObject params);
JSONObject gettotal();

@ -58,12 +58,6 @@ public class ActChairtyServiceImp implements ActChairtyService {
return PageListUtils.buildPageListResult(clients);
}
@Override
public void disableClient(String clientMoniker) {
actChairtyMapper.disableClient(clientMoniker);
}
@Override
public List<JSONObject> getWeekendAnalysis(JSONObject params) {
List<JSONObject> result = new ArrayList<>();
@ -90,6 +84,23 @@ public class ActChairtyServiceImp implements ActChairtyService {
return getChairtyWeekRaking;
}
@Override
public JSONObject gettotal() {
List<JSONObject> gettotalnum = actChairtyMapper.chairtyClientNum();
int amount=0 ;
double chairty=0.00;
for (JSONObject gettotals : gettotalnum) {
amount += gettotals.getIntValue("sum_ordernum");
chairty += gettotals.getDoubleValue("count_ordernum") * 0.01;
}
BigDecimal bg = new BigDecimal(chairty);
double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
JSONObject gettotal = new JSONObject();
gettotal.put("amount", amount);
gettotal.put("chairty", f1);
return gettotal;
}
}

@ -42,11 +42,6 @@ public class ActChairtyController {
actChairtyService.configClient(clientMoniker, config, manager);
}
@ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.DELETE, role = { ManagerRole.ADMIN })
public void disableClient(@PathVariable String clientMoniker) {
actChairtyService.disableClient(clientMoniker);
}
@ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
public List<JSONObject> traAnalysis(ActChairtyQuery params) {
return actChairtyService.getWeekendAnalysis(params.params());
@ -59,4 +54,9 @@ public class ActChairtyController {
}
return PageListUtils.buildPageListResult(clientRank);
}
@ManagerMapping(value = "/total", method = RequestMethod.GET, role = {ManagerRole.ADMIN})
public JSONObject getTotal() {
return actChairtyService.gettotal();
}
}

@ -23,9 +23,6 @@ public interface ActChairtyMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject chairtyClient);
@AutoSql(type = SqlType.DELETE)
void disableClient(@Param("client_moniker") String clientMoniker);
PageList<JSONObject> chairtyClientNum(PageBounds pageBounds);
List<JSONObject> getChairtyWeekstartAnalysis(@Param("begin") Date begin, @Param("end") Date end);
@ -34,5 +31,7 @@ public interface ActChairtyMapper {
PageList<JSONObject> getChairtyWeekRaking(@Param("begin") Date begin, @Param("end") Date end,PageBounds pageBounds);
List<JSONObject> chairtyClientNum();
}

@ -6,29 +6,21 @@ select client_moniker,active_time,IFNULL(count(org_id),0) as count_ordernum,ifnu
from act_charity
left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time
and pmt_transactions.refund_id is null and pmt_transactions.channel != 'Settlement'
GROUP BY act_charity.client_id order by sum_ordernum desc
</select>
<!--
<select id="getChairtyWeekAnalysis" resultType="com.alibaba.fastjson.JSONObject">
select weekofyear(DATE_FORMAT(transaction_time,'%Y-%m-%d'))-weekofyear(DATE_FORMAT(transaction_time,'%Y-%m-%d')-interval day(DATE_FORMAT(transaction_time,'%Y-%m-%d'))-1 day)+1 as weekon,IFNULL(count(org_id),0) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum
from act_charity
inner JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
and pmt_transactions.transaction_type='Credit'
and pmt_transactions.transaction_time&gt;=#{begin}
and pmt_transactions.transaction_time&lt;=#{end}
group by weekon order by weekon asc;
</select>-->
<select id="getChairtyWeekstartAnalysis" resultType="com.alibaba.fastjson.JSONObject">
select DATE_FORMAT(pmt_transactions.transaction_time,'%Y-%m-%d') as weekstart from act_charity
inner JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
where dayofweek(pmt_transactions.transaction_time)=2 and pmt_transactions.transaction_time&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end}
and pmt_transactions.refund_id is null and pmt_transactions.channel != 'Settlement'
group by weekstart order by weekstart asc;
</select>
<select id="getChairtyWeekAnalysis" resultType="com.alibaba.fastjson.JSONObject">
select count(pmt_transactions.org_id) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end}
and pmt_transactions.refund_id is null and pmt_transactions.channel != 'Settlement'
</select>
@ -36,6 +28,5 @@ GROUP BY act_charity.client_id order by sum_ordernum desc
select act_charity.client_moniker,((count(pmt_transactions.org_id)) * 0.01) as chair_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end}
GROUP BY act_charity.client_moniker order by sum_ordernum desc
</select>
</mapper>

@ -347,10 +347,7 @@ margin-bottom: 10%;"/>
<i class="fa fa-money"></i> <span>合同签约情况</span>
</a>
</li>
<li class="header nav-header"
ng-if="('1011110'|withRole) || currentUser.org_id==null">公益服务测试|Act Chairty
</li>
<li ui-sref-active="active">
<li ui-sref-active="active" ng-if="'actChairty'|withModule">
<a ui-sref="act_chairty" ui-sref-opts="{reload:true}">
<i class="fa fa-users"></i> <span>半边天公益活动</span>
</a>

@ -28,11 +28,6 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
$scope.loadClients();
$scope.new_conf = {};
$scope.ctrl = {dateInput: false};
$scope.disableClient = function (client) {
$http.delete('/actchairty/clients/' + client.client_moniker).then(function () {
$scope.loadClients();
});
};
$scope.submitClient = function () {
$scope.errmsg = null;
var conf = {
@ -80,27 +75,14 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
$http.get('/actchairty/clients', {params: params}).then(function (resp) {
$scope.chairtyPartnersRanking = resp.data.data;
$scope.total_ranking_pagination = resp.data.pagination;
var amount = 0;
var chairty = 0;
angular.forEach(resp.data.data, function (data) {
amount += parseFloat(data.sum_ordernum);
chairty += parseFloat(data.chairty_num)
return amount,chairty;
});
$scope.totalAmount = amount;
$scope.totalChairty = Math.round(chairty*100)/100; ;
})
};
$scope.getTotalCashBack = function () {
});
$scope.getTotalAmount = function () {
$http.get('/actchairty/total').then(function (resp) {
$scope.totalAmount = resp.data.amount;
$scope.totalChairty = resp.data.chairty;
})
};
};
$scope.getClientsCashbackRankingByDate = function (date,page) {
$scope.event_date = date;
var params = {};
@ -116,9 +98,6 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
}
$http.get('/actchairty/ranking', {params: params}).then(function (resp) {
$scope.cashbackPartnersRankingByDate = resp.data.data;
if(resp.data.data != null){
}
$scope.day_ranking_pagination = resp.data.pagination;
});
};
@ -197,7 +176,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
$scope.doPartnerTotalRanking(1);
};
$scope.doAnalysis(1);
$scope.getTotalCashBack(1);
$scope.getTotalAmount(1);
$scope.settleDelayEchart = function (chart) {
chart.on('click', function (params) {
$scope.cashBack_total_daily = $scope.cashbackDaily[params.dataIndex].chairty_amount;

@ -46,7 +46,6 @@
<th>订单量</th>
<th>订单金额</th>
<th>捐款额</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
@ -56,9 +55,6 @@
<td ng-bind="client.count_ordernum"></td>
<td ng-bind="client.sum_ordernum"></td>
<td ng-bind="client.chairty_num"></td>
<td>
<a role="button" class="text-danger" ng-click="disableClient(client)"><i class="fa fa-ban"></i></a>
</td>
</tr>
</tbody>
</table>

Loading…
Cancel
Save