eason.qian 7 years ago
parent 08426e8a5a
commit 8e886dec43

@ -240,4 +240,7 @@ ALTER TABLE `financial_bd_prize_log`
ALTER TABLE sys_notice ADD merchants_type TINYINT(1) DEFAULT 0 NOT NULL COMMENT '商户范围0全部商户 1自定义商户';
ALTER TABLE sys_notice ADD is_app_window TINYINT(1) DEFAULT 0 COMMENT '是否需要APP弹框';
ALTER TABLE sys_notice ADD is_app_window TINYINT(1) DEFAULT 0 COMMENT '是否需要APP弹框';
ALTER TABLE sys_notice MODIFY end_time DATE NOT NULL COMMENT '截止日期';

@ -24,6 +24,7 @@ public class NoticeInfo {
private boolean is_tomail_cc_stockholder;
private boolean is_to_app;
private boolean is_app_window;
private int merchants_type=0;
private String notice_id;
public JSONObject toJson() {
@ -36,6 +37,7 @@ public class NoticeInfo {
}
}
res.put("title",title);
res.put("merchants_type",merchants_type);
if (content != null){
res.put("content",content);
}
@ -132,4 +134,12 @@ public class NoticeInfo {
public void setIs_app_window(boolean is_app_window) {
this.is_app_window = is_app_window;
}
public int getMerchants_type() {
return merchants_type;
}
public void setMerchants_type(int merchants_type) {
this.merchants_type = merchants_type;
}
}

@ -24,4 +24,5 @@ public interface NoticeManage {
JSONObject listNoticeReadClients(String noticeId, int page, int limit);
void toggleNoticeAppWindow(String noticeId, Boolean isAppWindow);
}

@ -8,6 +8,7 @@ import java.util.List;
import javax.annotation.Resource;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -99,18 +100,20 @@ public class NoticeManageImpl implements NoticeManage {
notice.put("create_time", date);
notice.put("create_id", manager.getString("manager_id"));
notice.put("create_name", manager.getString("display_name"));
noticeManageMapper.createNotice(notice);
if (noticeInfo.getStatus() != null && noticeInfo.getStatus().equals("1")) {
List<JSONObject> clients = clientMapper.listClients();
if (!clients.isEmpty()) {
for (JSONObject client : clients) {
client.put("create_time", date);
client.put("notice_id", notice.getString("notice_id"));
noticePartnerMapper.save(client);
}
if (!notice.getBoolean("merchants_type")){
String sendClients = "";
List<JSONObject> clients = clientMapper.listValidClient();
clients.forEach(c -> {
String p = c+",";
sendClients.concat(p);
});
if (sendClients.length()>0){
sendClients.substring(0,sendClients.length()-1);
}
notice.put("send_clients",sendClients);
}
noticeManageMapper.createNotice(notice);
return notice;
}
@ -201,6 +204,15 @@ public class NoticeManageImpl implements NoticeManage {
return PageListUtils.buildPageListResult(clients);
}
@Override
public void toggleNoticeAppWindow(String noticeId, Boolean isAppWindow) {
JSONObject notice = noticeManageMapper.getNoticeDetailById(noticeId);
if (notice.getDate("end_time")!=null && notice.getDate("end_time").compareTo(new Date())<0){
throw new ForbiddenException("The Notice has expired");
}
notice.put("is_app_window",isAppWindow);
noticeManageMapper.updateNotice(notice);
}
}

@ -52,6 +52,12 @@ public class NoticeManageController {
return noticeManage.listNoticeReadClients(noticeId,page,limit);
}
@ManagerMapping(value = "/{noticeId}/app_window", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void toggleNoticeAppWindow(@PathVariable String noticeId, @RequestBody JSONObject jsonObject){
Boolean isAppWindow = jsonObject.getBoolean("is_app_window");
noticeManage.toggleNoticeAppWindow(noticeId,isAppWindow);
}
@ManagerMapping(value = "/{noticeId}/clients", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public int listNoticeClients(@PathVariable String noticeId){
return noticeManage.listNoticeClients(noticeId);

@ -7,7 +7,7 @@
WHERE client_id = #{client_id}
</update>
<select id="listValidClient" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_id FROM sys_clients c
SELECT c.client_id,c.client_moniker FROM sys_clients c
WHERE is_valid=1 and (approve_result = 1 or approve_result = 2)
</select>
<select id="listGreenChannel" resultType="com.alibaba.fastjson.JSONObject">

@ -92,11 +92,10 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
var notice = angular.copy($scope.notice);
if (notice.end_time) {
notice.end_time = $filter('date')(notice.end_time, 'yyyyMMdd')
} else {
if (notice.status == '1') {
commonDialog.alert({title: 'Error', content: 'Expiry Date can not be null', type: 'error'});
$scope.notice.status = '0';
return;
}
if (notice.merchants_type==1){
if (notice.send_clients.length==0){
commonDialog.alert({title: 'Error', content: 'Send Clients is null', type: 'error'});
}
}
$scope.saveNoticeResult = true;
@ -128,12 +127,53 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
$scope.clients = resp.data.data;
$scope.pagination = resp.data.pagination;
});
}
};
if ($scope.notice.status == '1') {
$scope.listClients();
$scope.totalClients();
}
$scope.sendNotice = function () {
$uibModal.open({
templateUrl: '/static/config/notice/templates/send_notice_dialog.html',
controller: 'sendNoticeCtrl',
size: 'sm',
resolve: {
notice: function () {
return $scope.notice;
}
}
}).result.then(function () {
commonDialog.alert({title: '操作成功', content: '您成功修改了密码', type: 'success'})
})
};
}]);
app.controller('sendNoticeCtrl', ['$scope', '$http','$state','commonDialog','notice', function ($scope, $http,$state,commonDialog,notice) {
$scope.notice = angular.copy(notice);
$scope.submit = function (form) {
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') <= 0) {
item.$dirty = true;
}
});
return;
}
$scope.errmsg = null;
$scope.saveNoticeResult = true;
$http.put('/sys/notice/' + $scope.notice.notice_id, notice).then(function (resp) {
$scope.saveNoticeResult = false;
commonDialog.alert({title: 'Success', content: 'Send a notice successfully', type: 'success'});
$scope.loadNotices(1);
$state.go('^.detail', {notice_id: $scope.notice.notice_id})
}, function (resp) {
$scope.saveNoticeResult = false;
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
}
}]);
app.controller('noticeEditCtrl', ['$scope', '$http', '$filter', '$timeout', '$state', '$uibModal', 'commonDialog', 'notice',
function ($scope, $http, $filter, $timeout, $state, $uibModal, commonDialog, notice) {
$scope.saveNoticeResult = false;

@ -62,8 +62,8 @@
ng-class="{'has-error':noticeForm.intro.$invalid && noticeForm.intro.$dirty}">
<label class="control-label col-sm-2" for="title-input">Intro</label>
<div class="col-sm-8">
<input class="form-control" ng-model="notice.title" type="textarea"
id="intro-input" name="intro" maxlength="400">
<textarea class="form-control" ng-model="notice.intro" type="text"
id="intro-input" name="intro" maxlength="400"/>
<div ng-messages="noticeForm.intro.$error"
ng-if="noticeForm.intro.$dirty">
<p class="small text-danger" ng-message="maxlength">Less Than 400
@ -79,9 +79,9 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="endtime-input">Expiry Date</label>
<label class="control-label col-sm-2" for="endtime-input">* Expiry Date</label>
<div class="col-sm-2" style="display: inline-block">
<input class="form-control" id="endtime-input"
<input class="form-control" id="endtime-input" required
ng-model="notice.end_time"
uib-datepicker-popup size="10" placeholder="Expiry Date"
is-open="dateEnd.open" ng-click="dateEnd.open=true"
@ -102,18 +102,18 @@
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="merchants-type">Merchants</label>
<div class="col-sm-8" style="display: inline-block" ng-if="notice.status=='0'|| notice.status==null">
<div class="col-sm-2" style="display: inline-block" ng-if="notice.status=='0'|| notice.status==null">
<select class="form-control" ng-model="notice.merchants_type" id="merchants-type">
<option value="0">ALL</option>
<option value="1">Custom</option>
</select>
</div>
<div class="col-sm-8" style="display: inline-block" ng-if="notice.merchants==1">
<input class="form-control" ng-model="notice.send_clients" type="textarea"
id="send-clients-input" name="send_clients">
<div class="col-sm-6" style="display: inline-block" ng-if="notice.merchants_type==1">
<textarea class="form-control" ng-model="notice.send_clients" type="text"
id="send-clients-input" name="send_clients"/>
<p class="small text-danger" ng-if="notice.merchants_type==1">以PartnerCode1,PartnerCode2..的形式填写</p>
</div>
<p class="small text-danger">以PartnerCode1,PartnerCode2..的形式填写</p>
<div class="col-sm-8" ng-if="notice.status=='1'">
<p class="form-control-static" ng-bind="notice.send_clients"></p>
</div>

@ -20,6 +20,9 @@
ui-sref="notice.edit({notice_id:notice.notice_id})">
<i class="fa fa-edit"></i> Edit
</a>
<a role="button" class="pull-right" ng-if="notice.status==0" ng-click="sendNotice(notice)">
<i class="fa fa-edit"></i> Send
</a>
</div>
<div class="panel-body">
<div class="form-horizontal">

@ -0,0 +1,38 @@
<div class="modal-header">
<h4>Send Notice</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<form name="sendNoticeForm" novalidate>
<div class="form-group">
<label class="control-label col-sm-2">Send Channels</label>
<div class="col-sm-10">
<div class="col-sm-6">
<label class="control-label col-sm-2">Emails</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="notice.is_tomail" bs-switch>
</div>
</div>
<div class="col-sm-6">
<label class="control-label col-sm-2">App Notice</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="notice.is_to_app" bs-switch>
</div>
</div>
<div class="col-sm-6">
<label class="control-label col-sm-2">App Window</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="notice.is_app_window" bs-switch>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" ng-click="sendNotice()">OK</button>
<button type="button" class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
</div>
Loading…
Cancel
Save