merge conflict

master
wangning 7 years ago
commit 65d0ab888a

@ -240,4 +240,8 @@ 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 '截止日期';
ALTER TABLE sys_notice ADD `desc` VARCHAR(1000) NULL COMMENT '简介';

@ -16,6 +16,7 @@ public class NoticeInfo {
private final DateFormat format = new SimpleDateFormat("yyyyMMdd");
@NotNull
private String title;
private String desc;
private String end_time;
private String content;
private String status;
@ -24,6 +25,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 +38,10 @@ public class NoticeInfo {
}
}
res.put("title",title);
if (desc != null){
res.put("desc",desc);
}
res.put("merchants_type",merchants_type);
if (content != null){
res.put("content",content);
}
@ -132,4 +138,20 @@ 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;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

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

@ -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,c.parent_client_id 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">

@ -4,6 +4,16 @@
define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) {
'use strict';
var merchantTypes = [
{
"label": "All",
"value": 0
},
{
"label": "Custom",
"value": 1
}];
var app = angular.module('noticeApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload', 'ng.uditor']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('notice', {
@ -92,11 +102,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;
@ -112,6 +121,8 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
};
}]);
app.controller('noticeDetailCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog', 'notice', function ($scope, $http, $state, $uibModal, commonDialog, notice) {
$scope.init = {};
$scope.notice = notice.data;
$scope.pagination = {};
$scope.params = {};
@ -128,17 +139,70 @@ 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.toggleAppWindow = function () {
if (!$scope.init.is_app_window) {
$scope.init.is_app_window = true;
return;
}
$http.put('/sys/notice/' + $scope.notice.notice_id + '/app_window', {is_app_window: $scope.notice.is_app_window}).then(function () {
commonDialog.alert({
title: 'Success',
content: "修改成功",
type: 'success'
})
}, function (resp) {
commonDialog.alert({
title: 'failed to change App Window status',
content: resp.data.message,
type: 'error'
});
})
};
$scope.sendNotice = function () {
$uibModal.open({
templateUrl: '/static/config/notice/templates/send_notice_dialog.html',
controller: 'sendNoticeCtrl',
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) {
$scope.errmsg = null;
$scope.saveNoticeResult = true;
$scope.notice.status = 1;
$http.put('/sys/notice/' + $scope.notice.notice_id, $scope.notice).then(function (resp) {
$scope.saveNoticeResult = false;
commonDialog.alert({title: 'Success', content: 'Send a notice successfully', type: 'success'});
$scope.close();
$state.go('notice.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.merchantTypes = angular.copy(merchantTypes);
$scope.saveNoticeResult = false;
$scope.notice = notice.data;
$scope.notice.merchants_type = $scope.notice.merchants_type ? 1 : 0;
if (notice.data.end_time != null) {
$scope.notice.end_time = new Date(notice.data.end_time);
}
@ -199,8 +263,8 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
}
}]);
app.controller('clientsSectorCtrl', ['$scope', '$http', 'notice', 'clients', 'commonDialog','$state', function ($scope, $http, notice, clients, commonDialog,$state) {
$scope.partners=angular.copy(clients)||{};
app.controller('clientsSectorCtrl', ['$scope', '$http', 'notice', 'clients', 'commonDialog', '$state', function ($scope, $http, notice, clients, commonDialog, $state) {
$scope.partners = angular.copy(clients) || {};
// $scope.select={};
$scope.selectedPartners = "";
$scope.selectAll = function () {

@ -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.desc" 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,22 @@
</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">
<select class="form-control" ng-model="notice.merchants_type" id="merchants-type">
<option value="0">ALL</option>
<option value="1">Custom</option>
<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>-->
<select class="form-control" name="merchants_type" required ng-model="notice.merchants_type"
id="merchants-type"
ng-options="state.value as state.label for state in merchantTypes">
<option value="">Please Choose</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.status=='0'|| notice.status==null) && 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">
@ -30,7 +33,7 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Intro</label>
<label class="control-label col-sm-2">Content</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind-html="notice.content"></p>
</div>
@ -48,31 +51,38 @@
<p class="form-control-static" ng-bind="notice.end_time|limitTo:10"></p>
</div>
</div>
<div class="form-group" ng-if="notice.merchant_type">
<div class="form-group">
<label class="control-label col-sm-2">Merchants</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="notice.end_time|limitTo:10"></p>
<p class="form-control-static" ng-if="!notice.merchants_type">全部商户</p>
<p class="form-control-static" ng-if="notice.merchants_type">自定义商户</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"></label>
<div class="col-sm-10">
<textarea readonly style="width: 100%" class="form-control-static" ng-bind="notice.send_clients"></textarea>
</div>
</div>
<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" disabled ng-model="notice.is_tomail" bs-switch>
<label class="control-label col-sm-4">Emails</label>
<div class="col-sm-6">
<input type="checkbox" switch-active="false" 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" disabled ng-model="partner.is_to_app" bs-switch>
<label class="control-label col-sm-4">App Notice</label>
<div class="col-sm-6">
<input type="checkbox" switch-active="false" 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" disabled ng-model="partner.is_app_window" bs-switch>
<label class="control-label col-sm-4">App Window</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="notice.is_app_window" bs-switch switch-change="toggleAppWindow()">
</div>
</div>
</div>

@ -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-4">Emails</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="notice.is_tomail" bs-switch>
</div>
</div>
<div class="col-sm-6">
<label class="control-label col-sm-4">App Notice</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="notice.is_to_app" bs-switch>
</div>
</div>
<div class="col-sm-6">
<label class="control-label col-sm-4">App Window</label>
<div class="col-sm-6">
<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="submit()">OK</button>
<button type="button" class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
</div>
Loading…
Cancel
Save