Преглед изворни кода

增加 卡信息 数据权限

shilinxiao пре 4 година
родитељ
комит
b77e9789b7

+ 1 - 1
src/main/java/cn/com/ota/task/ShortMsgRecvTask.java

@@ -30,7 +30,7 @@ public class ShortMsgRecvTask {
     /**
      * 定时接收短信
      **/
-    @Scheduled(cron = "0 * * * * ?") //每分钟执行一次
+    @Scheduled(cron = "*/15 * * * * ?") //每15秒执行一次
     public void recvMsg() {
         try {
             taskInit();

+ 33 - 2
src/main/java/cn/com/ota/web/controller/AgentCardInfoController.java

@@ -1,5 +1,6 @@
 package cn.com.ota.web.controller;
 
+import cn.com.manage.domain.entity.Account;
 import cn.com.ota.domain.entity.AgentCardInfo;
 import cn.com.ota.domain.vo.AgentCardInfoVo;
 import cn.com.ota.service.AgentCardInfoService;
@@ -9,7 +10,9 @@ import com.frameworks.core.web.page.Pager;
 import com.frameworks.core.web.result.DataResult;
 import com.frameworks.core.web.result.MsgResult;
 import com.frameworks.core.web.search.DynamicSpecifications;
+import com.frameworks.core.web.search.SearchFilter;
 import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.dozer.Mapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.DecimalFormat;
 import java.util.List;
 
 @Controller
@@ -50,11 +54,19 @@ public class AgentCardInfoController extends BaseController {
     public DataResult list(HttpServletRequest request, Pager webPage) {
         DataResult dataRet = new DataResult();
         try {
-            Specification<AgentCardInfo> specification = DynamicSpecifications.bySearchFilter(request, AgentCardInfo.class, null);
+            List<SearchFilter> searchFilters = Lists.newArrayList();
+            searchFilters.add(new SearchFilter("modifyBy", SearchFilter.Operator.EQ, getLoginUser().getId()));
+            Specification<AgentCardInfo> specification = DynamicSpecifications.bySearchFilter(request, AgentCardInfo.class, null, searchFilters);
             List<AgentCardInfo> dictDatas = getService().findByCondition(specification, webPage);
             List<AgentCardInfoVo> lstVo = Lists.newArrayList();
+            DecimalFormat df = new DecimalFormat("0.00");//设置保留位数
             for (AgentCardInfo entity : dictDatas) {
                 AgentCardInfoVo vo = mapper.map(entity, AgentCardInfoVo.class);
+                String balanceStr = vo.getBalance();
+                if (StringUtils.isNotBlank(balanceStr)) {
+                    String balance = df.format(Float.valueOf(balanceStr) / 100);
+                    vo.setBalance(balance);
+                }
                 lstVo.add(vo);
             }
             dataRet.pushOk("获取数据列表成功!");
@@ -68,7 +80,6 @@ public class AgentCardInfoController extends BaseController {
     }
 
 
-
     @RequiresPermissions(value = {"Card:CardInfo:show"})
     @RequestMapping(value = "/add", method = {RequestMethod.GET})
     public ModelAndView add(HttpServletRequest request) {
@@ -83,6 +94,13 @@ public class AgentCardInfoController extends BaseController {
     public MsgResult store(AgentCardInfo entity) {
         MsgResult msgRet = new MsgResult();
         try {
+            Account account = getLoginUser();
+            entity.setModifyBy(account.getId());
+            String balanceStr = entity.getBalance();
+            if (StringUtils.isNotBlank(balanceStr)) {
+                int balance = (int) (Float.valueOf(balanceStr) * 100);
+                entity.setBalance(String.valueOf(balance));
+            }
             getService().save(entity);
             msgRet.pushOk("添加成功!");
         } catch (Exception e) {
@@ -95,8 +113,14 @@ public class AgentCardInfoController extends BaseController {
     @RequiresPermissions(value = {"Card:CardInfo:show"})
     @RequestMapping(value = "/edit/{id}", method = {RequestMethod.GET})
     public ModelAndView edit(@PathVariable("id") String id) {
+        DecimalFormat df = new DecimalFormat("0.00");//设置保留位数
         ModelAndView mav = new ModelAndView(FORM_PAGE);
         AgentCardInfo entity = getService().findById(id);
+        String balanceStr = entity.getBalance();
+        if (StringUtils.isNotBlank(balanceStr)) {
+            String balance = df.format(Float.valueOf(balanceStr) / 100);
+            entity.setBalance(balance);
+        }
         mav.addObject("entity", entity);
         return mav;
     }
@@ -108,6 +132,13 @@ public class AgentCardInfoController extends BaseController {
     public MsgResult modify(AgentCardInfo entity) {
         MsgResult msgRet = new MsgResult();
         try {
+            Account account = getLoginUser();
+            entity.setModifyBy(account.getId());
+            String balanceStr = entity.getBalance();
+            if (StringUtils.isNotBlank(balanceStr)) {
+                int balance = (int) (Float.valueOf(balanceStr) * 100);
+                entity.setBalance(String.valueOf(balance));
+            }
             getService().update(entity);
             msgRet.pushOk("修改成功!");
         } catch (Exception e) {

+ 75 - 39
src/main/webapp/WEB-INF/views/ota/card/cardInfo/form.jsp

@@ -61,36 +61,36 @@
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">上次开卡日期:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">上次开卡日期:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="lastActivityDate" name="lastActivityDate" placeholder="请选择" value="${entity.lastActivityDate}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">开卡日期:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">开卡日期:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="activityDate" name="activityDate" placeholder="请选择" value="${entity.activityDate}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">开卡手机号:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">开卡手机号:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="activityPhoneNo" name="activityPhoneNo" value="${entity.activityPhoneNo}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">到期时间:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">到期时间:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="expireDate" name="expireDate" placeholder="请选择" value="${entity.expireDate}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">余额:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">余额:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="balance" name="balance" value="${entity.balance}"/>
 					</div>
@@ -130,78 +130,78 @@
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">验证问题:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">验证问题:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="testQuestion" name="testQuestion" value="${entity.testQuestion}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">答案:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">答案:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="answer" name="answer" value="${entity.answer}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">邮箱:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">邮箱:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="emailAddr" name="emailAddr" value="${entity.emailAddr}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">常旅客号:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">常旅客号:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="passengerNo" name="passengerNo" value="${entity.passengerNo}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">地址:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">地址:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="addr" name="addr" value="${entity.addr}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">发票类型:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">发票类型:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="billType" name="billType" value="${entity.billType}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">发票抬头:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">发票抬头:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="billTitle" name="billTitle" value="${entity.billTitle}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">联系人姓名:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">联系人姓名:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="billContactName" name="billContactName" value="${entity.billContactName}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">联系人手机:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">联系人手机:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="billContactPhone" name="billContactPhone" value="${entity.billContactPhone}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">寄送地址:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">寄送地址:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="billAddr" name="billAddr" value="${entity.billAddr}"/>
 					</div>
 				</div>
 				<div class="form-group">
-					<label class="col-lg-3 control-label">地址邮编:</label><span
-						class="text-danger">*</span>
+					<label class="col-lg-3 control-label">地址邮编:</label>
+					<%--<span class="text-danger">*</span>--%>
 					<div class="col-lg-8">
 						<input type="text" class="form-control" id="postCode" name="postCode" value="${entity.postCode}"/>
 					</div>
@@ -235,8 +235,8 @@
 		});
 		$("#expireDate").jeDate({
 			isTime:true,
-			format: "YYYY-MM-DD hh:mm:ss",
-			minDate:"2000-01-01 00:00:00"
+			format: "YYYY-MM-DD",
+			minDate:"2000-01-01"
 		});
 
 
@@ -249,16 +249,52 @@
 					focusInvalid : false,
 					onsubmit : false,
 					rules : {
-						/*"name" : {
+						"cardName" : {
+							required : true
+						},
+						"cardType" : {
+							required : true
+						},
+						"cardNo" : {
+							required : true
+						},
+						"initPaswd" : {
+							required : true
+						},
+						"resetPaswd" : {
+							required : true
+						},
+						"buyDate" : {
+							required : true
+						},
+						"buyPhoneNo" : {
+							required : true
+						},
+						"buyCardUserName" : {
+							required : true
+						},
+						"certificateType" : {
+							required : true
+						},
+						"certificateNo" : {
 							required : true
 						},
-						"code" : {
+						"cardStatus" : {
 							required : true
-						}*/
+						}
 					},
 					messages : {
-						/*"name" : '请输入分类名称',
-						"code" : '请输入分类编码',*/
+						"cardName" : '请输入卡名',
+						"cardType" : '请输入卡类型',
+						"cardNo" : '请输入卡号',
+						"initPaswd" : '请输入初始密码',
+						"resetPaswd" : '请输入重置密码',
+						"buyDate" : '请输入购买日期',
+						"buyPhoneNo" : '请输入购买手机号',
+						"buyCardUserName" : '请输入购卡人姓名',
+						"certificateType" : '请输入证件类型',
+						"certificateNo" : '请输入证件号码',
+						"cardStatus" : '请输入卡状态'
 					},
 					highlight : function(e) {
 						$(e).closest('.form-group').removeClass('has-info')

+ 8 - 0
src/main/webapp/WEB-INF/views/ota/card/cardInfo/view.jsp

@@ -100,6 +100,14 @@
                 sortable: false,
                 title: "初始密码"
             }, {
+                field: 'buyPhoneNo',
+                sortable: false,
+                title: "购买手机号"
+            }, {
+                field: 'buyCardUserName',
+                sortable: false,
+                title: "购卡人姓名"
+            }, {
                 field: 'activityDate',
                 sortable: false,
                 title: "开卡日期"