eason.qian 7 years ago
parent 8e886dec43
commit f39c80b2d6

@ -243,4 +243,5 @@ ALTER TABLE sys_notice ADD merchants_type TINYINT(1) DEFAULT 0 NOT NULL COMMENT
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 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;
@ -37,6 +38,9 @@ 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);
@ -142,4 +146,12 @@ public class NoticeInfo {
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;
}
}

@ -136,6 +136,21 @@ public class NoticeManageImpl implements NoticeManage {
notice.put("send_id", manager.getString("manager_id"));
notice.put("send_name", manager.getString("display_name"));
}
if (!notice.getBoolean("merchants_type")){
StringBuilder sendClients = new StringBuilder();
List<JSONObject> clients = clientMapper.listValidClient();
clients.forEach(c -> {
if (c.getInteger("parent_client_id")==null || c.getInteger("parent_client_id")!=9){
String p = c.getString("client_moniker")+",";
sendClients.append(p);
}
});
if (sendClients.length()>0){
notice.put("send_clients",sendClients.substring(0,sendClients.length()-1));
}
}
noticeManageMapper.updateNotice(notice);
if (info.getStatus() != null && info.getSend_clients() != null) {
if (info.getStatus().equals("1") && noticeInfo.getString("status").equals("0") && !info.getSend_clients().isEmpty()) {

@ -7,7 +7,7 @@
WHERE client_id = #{client_id}
</update>
<select id="listValidClient" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_id,c.client_moniker 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', {
@ -93,8 +103,8 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
if (notice.end_time) {
notice.end_time = $filter('date')(notice.end_time, 'yyyyMMdd')
}
if (notice.merchants_type==1){
if (notice.send_clients.length==0){
if (notice.merchants_type == 1) {
if (notice.send_clients.length == 0) {
commonDialog.alert({title: 'Error', content: 'Send Clients is null', type: 'error'});
}
}
@ -111,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 = {};
@ -132,13 +144,30 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
$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',
size: 'sm',
resolve: {
notice: function () {
return $scope.notice;
@ -149,24 +178,17 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
})
};
}]);
app.controller('sendNoticeCtrl', ['$scope', '$http','$state','commonDialog','notice', function ($scope, $http,$state,commonDialog,notice) {
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.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.loadNotices(1);
$state.go('^.detail', {notice_id: $scope.notice.notice_id})
$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'});
@ -176,9 +198,11 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
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);
}
@ -239,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,7 +62,7 @@
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">
<textarea class="form-control" ng-model="notice.intro" type="text"
<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">
@ -103,13 +103,17 @@
<div class="form-group">
<label class="control-label col-sm-2" for="merchants-type">Merchants</label>
<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 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-6" style="display: inline-block" ng-if="notice.merchants_type==1">
<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>

@ -33,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>
@ -51,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>

@ -9,20 +9,20 @@
<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">
<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-2">App Notice</label>
<div class="col-sm-10">
<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-2">App Window</label>
<div class="col-sm-10">
<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>
@ -33,6 +33,6 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" ng-click="sendNotice()">OK</button>
<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