diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActBean.java b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActBean.java index 5e6c3c103..c3590a756 100644 --- a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActBean.java @@ -1,16 +1,23 @@ package au.com.royalpay.payment.manage.activities.app_index.beans; +import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateUtils; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import javax.xml.crypto.Data; +import java.text.ParseException; +import java.util.Date; + /** * Created by yuan on 2018/3/14. */ public class AppActBean { + private static final String[] DATE_PATTERNS = {"yyyy-MM-dd"}; private String act_name; private String act_url; - private String parms_json; + private String params_json; private Boolean is_valid = true; private String desc; private String act_content; @@ -18,6 +25,8 @@ public class AppActBean { private Boolean is_show_window; private String act_img; private String window_img; + private String active_date; + private String expire_date; public JSONObject toJsonParam(){ @@ -28,8 +37,8 @@ public class AppActBean { if(StringUtils.isNotEmpty(act_url)){ params.put("act_url",act_url); } - if(StringUtils.isNotEmpty(parms_json)){ - params.put("parms_json",parms_json); + if(StringUtils.isNotEmpty(params_json)){ + params.put("params_json",params_json); } if(StringUtils.isNotEmpty(desc)){ params.put("desc",desc); @@ -46,6 +55,22 @@ public class AppActBean { if(StringUtils.isNotEmpty(window_img)){ params.put("window_img",window_img); } + if (active_date != null) { + try { + Date fromDate = DateUtils.parseDate(active_date, DATE_PATTERNS); + params.put("active_date", fromDate); + } catch (ParseException e) { + throw new ParamInvalidException("active_date", "error.payment.valid.invalid_date_format"); + } + } + if (expire_date != null) { + try { + Date fromDate = DateUtils.parseDate(expire_date, DATE_PATTERNS); + params.put("expire_date", fromDate); + } catch (ParseException e) { + throw new ParamInvalidException("expire_date", "error.payment.valid.invalid_date_format"); + } + } params.put("is_show_window",is_show_window); params.put("is_valid",is_valid); return params; @@ -67,12 +92,12 @@ public class AppActBean { this.act_url = act_url; } - public String getParms_json() { - return parms_json; + public String getParams_json() { + return params_json; } - public void setParms_json(String parms_json) { - this.parms_json = parms_json; + public void setParams_json(String params_json) { + this.params_json = params_json; } public String getDesc() { @@ -130,4 +155,20 @@ public class AppActBean { public void setIs_valid(Boolean is_valid) { this.is_valid = is_valid; } + + public String getActive_date() { + return active_date; + } + + public void setActive_date(String active_date) { + this.active_date = active_date; + } + + public String getExpire_date() { + return expire_date; + } + + public void setExpire_date(String expire_date) { + this.expire_date = expire_date; + } } diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html index 2307b1969..e6057232c 100644 --- a/src/main/ui/manage.html +++ b/src/main/ui/manage.html @@ -283,6 +283,11 @@ margin-bottom: 10%;"/> ng-if="('1011110'|withRole) || currentUser.org_id==null">营销服务|Promotion +
  • + + 活动管理|Activity Manage + +
  • 店长行动|Activities @@ -413,12 +418,6 @@ margin-bottom: 10%;"/>
  • -
  • - - App Act - -
  • -
  • 积分商城|Integral Mall diff --git a/src/main/ui/static/actapp/app_act_list.js b/src/main/ui/static/actapp/app_act_list.js index 2ba083d6c..35cc04915 100644 --- a/src/main/ui/static/actapp/app_act_list.js +++ b/src/main/ui/static/actapp/app_act_list.js @@ -21,7 +21,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS } }) }]); - app.controller('appActListCtrl', ['$scope', '$state', '$http','commonDialog', function ($scope, $state, $http,commonDialog) { + app.controller('appActListCtrl', ['$scope', '$state', '$http','commonDialog','$filter', function ($scope, $state, $http,commonDialog,$filter) { $scope.pagination = {}; $scope.params = {}; $scope.loadActAppList = function (page) { @@ -33,7 +33,8 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }); }; $scope.publishedOrIsValid = function (act) { - $scope.act = angular.copy(act); + $scope.act = {}; + $scope.act.act_id = act.act_id; $scope.act.is_valid = !act.is_valid; $http.put('/manager/app/act/' + $scope.act.act_id, $scope.act).then(function (resp) { commonDialog.alert({title: 'Success', content: '修改成功', type: 'success'}); @@ -45,8 +46,9 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.loadActAppList(1); }]); - app.controller('appActNewCtrl', ['$rootScope', '$scope', '$http', 'commonDialog','$state', function ($rootScope, $scope, $http, commonDialog,$state) { + app.controller('appActNewCtrl', ['$rootScope', '$scope', '$http', 'commonDialog','$state','$filter', function ($rootScope, $scope, $http, commonDialog,$state,$filter) { $scope.actDetail = {}; + $scope.ctrl = {dateInput: false}; $scope.submit = function (form) { $scope.errmsg = null; if (form.$invalid) { @@ -57,6 +59,12 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }); return; } + if ($scope.actDetail.active_date) { + $scope.actDetail.active_date = $filter('date')($scope.actDetail.active_date, 'yyyy-MM-dd'); + } + if ($scope.actDetail.expire_date) { + $scope.actDetail.expire_date = $filter('date')($scope.actDetail.expire_date, 'yyyy-MM-dd'); + } $http.put('/manager/app/act/new', $scope.actDetail).then(function (resp) { commonDialog.alert({title: 'Success', content: '新增成功', type: 'success'}); $state.go('^.detail',{act_id:resp.data.act_id},{reload:true}); @@ -65,9 +73,18 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }) } }]); - app.controller('appActDetailCtrl', ['$rootScope', '$scope', '$http', 'commonDialog', 'actDetail','$state', function ($rootScope, $scope, $http, commonDialog,actDetail,$state) { + app.controller('appActDetailCtrl', ['$rootScope', '$scope', '$http', 'commonDialog', 'actDetail','$state','$filter', function ($rootScope, $scope, $http, commonDialog,actDetail,$state,$filter) { $scope.actDetail = actDetail.data; + $scope.ctrl = {dateInput: false}; + $scope.actDetail.active_date = new Date($scope.actDetail.active_date); + $scope.actDetail.expire_date = new Date($scope.actDetail.expire_date); $scope.submit = function () { + if ($scope.actDetail.active_date) { + $scope.actDetail.active_date = $filter('date')($scope.actDetail.active_date, 'yyyy-MM-dd'); + } + if ($scope.actDetail.expire_date) { + $scope.actDetail.expire_date = $filter('date')($scope.actDetail.expire_date, 'yyyy-MM-dd'); + } $http.put('/manager/app/act/' + $scope.actDetail.act_id, $scope.actDetail).then(function (resp) { commonDialog.alert({title: 'Success', content: '修改成功', type: 'success'}); $state.reload(); diff --git a/src/main/ui/static/actapp/templates/act_app_detail.html b/src/main/ui/static/actapp/templates/act_app_detail.html index 9ab3fa610..7255fa031 100644 --- a/src/main/ui/static/actapp/templates/act_app_detail.html +++ b/src/main/ui/static/actapp/templates/act_app_detail.html @@ -44,11 +44,37 @@
    -
    +
    +
    - +
    diff --git a/src/main/ui/static/actapp/templates/act_app_list.html b/src/main/ui/static/actapp/templates/act_app_list.html index 2c20099ed..1ae65dbf7 100644 --- a/src/main/ui/static/actapp/templates/act_app_list.html +++ b/src/main/ui/static/actapp/templates/act_app_list.html @@ -37,9 +37,10 @@ - + + @@ -48,6 +49,8 @@ + +
    Title Add TimeActive DateExpire Date Published Operation