Procházet zdrojové kódy

机器设备修改

pangjl před 5 roky
rodič
revize
6641048aa2

+ 134 - 6
src/main/java/com/minpay/mt/machine/action/MachineManageAction.java

@@ -10,14 +10,14 @@ import com.minpay.common.service.IPropertiesService;
 import com.minpay.common.service.IPublicService;
 import com.minpay.common.util.DateUtil;
 import com.minpay.common.util.UpLoadFile;
+import com.minpay.db.table.mapper.ImBranchMapper;
 import com.minpay.db.table.mapper.VmEquipmentInfMapper;
+import com.minpay.db.table.mapper.VmHlAccountMapper;
 import com.minpay.db.table.mapper.VmProEquRelMapper;
-import com.minpay.db.table.model.VmEquipmentInf;
-import com.minpay.db.table.model.VmEquipmentInfExample;
-import com.minpay.db.table.model.VmProEquRel;
-import com.minpay.db.table.model.VmProEquRelExample;
+import com.minpay.db.table.model.*;
 import com.minpay.db.table.own.mapper.MachineManageMapper;
 import com.minpay.huicai.util.EquCodeCreateUtil;
+import com.mysql.jdbc.StringUtils;
 import com.startup.minpay.frame.business.IMINAction;
 import com.startup.minpay.frame.business.res.MINActionResult;
 import com.startup.minpay.frame.constant.IMINBusinessConstant;
@@ -130,6 +130,12 @@ public class MachineManageAction implements IMINAction {
     public final static String	QUERY_FUNCTION		= "queryFunction";
     /**清空累计金额*/
     public final static String	EMPTY_PROEQUREL		= "emptyProEquRel";
+    /** 收款商户号信息查询 */
+    public final static String TENCENTMANAGE_QUERY = "businessNumManageQuery";
+    /** 商户号信息查询 */
+    public final static String QUERY_BRANCH = "queryBranch";
+    /** 绑定商户号 */
+    public final static String BIND_BRANCH = "bindBranch";
 
 
     private boolean contains;
@@ -301,7 +307,7 @@ public class MachineManageAction implements IMINAction {
         pro.setLines(temLine);
         pro.setUrlCode(url);
         pro.setEquType("00"); //默认支付盒子售货机
-        pro.setBranchid(user.getBranchid());
+        pro.setBranchid(Constant.DEFAULT_INSTITUTIONS);
         Service.lookup(IMINDataBaseService.class)
                 .getMybatisMapper(VmEquipmentInfMapper.class)
                 .insertSelective(pro);
@@ -336,7 +342,7 @@ public class MachineManageAction implements IMINAction {
             pros.setRows(temRow);
             pros.setLines(temLine);
             pros.setUrlCode(url);
-            pros.setBranchid(user.getBranchid());
+            pros.setBranchid(Constant.DEFAULT_INSTITUTIONS);
             Service.lookup(IMINDataBaseService.class)
                     .getMybatisMapper(VmEquipmentInfMapper.class)
                     .insertSelective(pros);
@@ -1625,4 +1631,126 @@ public class MachineManageAction implements IMINAction {
         Service.lookup(ILogService.class).logging(session, logInfo);
         return res;
     }
+    /**
+     * 收款商户号信息查询
+     * @param session
+     * @param accountName			商户名称
+     * @param accountId				商户号
+     * @param type					商户类型
+     * @param page
+     * @param limit
+     * @return
+     * @throws MINBusinessException
+     */
+    @MINAction(value = TENCENTMANAGE_QUERY)
+    public MINActionResult businessNumManageQuery(MINSession session,
+          @MINParam(key = "branchId") String branchId,
+          @MINParam(key = "accountName") String accountName,
+          @MINParam(key = "accountId") String accountId,
+          @MINParam(key = "type") String type,
+          @MINParam(key = "page", defaultValue = "1") int page,
+          @MINParam(key = "limit", defaultValue = "10") int limit) throws MINBusinessException {
+        MINActionResult res = new MINActionResult();
+        // 查询当前角色编号
+        User u = session.getUser();
+        MINRowBounds rows = new MINRowBounds(page, limit);
+        VmHlAccountExample vmHlAccountExample = new VmHlAccountExample();
+        VmHlAccountExample.Criteria createCriteria = vmHlAccountExample.createCriteria();
+        if(!StringUtils.isNullOrEmpty(accountName)){
+            createCriteria.andNameLike("%"+accountName+"%");
+        }
+        if(!StringUtils.isNullOrEmpty(accountId)){
+            createCriteria.andUsridEqualTo(accountId);
+        }
+        if(!StringUtils.isNullOrEmpty(type)){
+            createCriteria.andTypeEqualTo(type);
+        }
+        if(!StringUtils.isNullOrEmpty(branchId)){
+            createCriteria.andUsridEqualTo(branchId);
+        }
+        List<VmHlAccount> businessNumList = Service.lookup(IMINDataBaseService.class)
+                .getMybatisMapper(VmHlAccountMapper.class).selectByExample(vmHlAccountExample,rows);
+
+        businessNumList = new MINCopyFormat("{type:'typeDesc'}").format(businessNumList);
+        businessNumList = Service.lookup(IFormatService.class).formatEnum(businessNumList, "{typeDesc:'BUSINESSNUM_TYPE'}");
+        businessNumList = Service.lookup(IFormatService.class).formatDateTime(businessNumList, "createTime");
+
+        res.set(IMINBusinessConstant.F_PAGING_LAY, businessNumList);
+        res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getMaxRows());
+
+        return res;
+    }
+    /**
+     * 商户号信息查询
+     * @param session
+     * @param accountName			商户名称
+     * @param accountId				商户号
+     * @param page
+     * @param limit
+     * @return
+     * @throws MINBusinessException
+     */
+    @MINAction(value = QUERY_BRANCH)
+    public MINActionResult queryBranch(MINSession session,
+      @MINParam(key = "accountName") String accountName,
+      @MINParam(key = "accountId") String accountId,
+      @MINParam(key = "type") String type,
+      @MINParam(key = "page", defaultValue = "1") int page,
+      @MINParam(key = "limit", defaultValue = "10") int limit) throws MINBusinessException {
+        MINActionResult res = new MINActionResult();
+        // 查询当前角色编号
+        User u = session.getUser();
+        MINRowBounds rows = new MINRowBounds(page, limit);
+        ImBranchExample imBranchExample = new ImBranchExample();
+        ImBranchExample.Criteria createCriteria = imBranchExample.createCriteria();
+        if(!StringUtils.isNullOrEmpty(accountName)){
+            createCriteria.andNameLike("%"+accountName+"%");
+        }
+        if(!StringUtils.isNullOrEmpty(accountId)){
+            createCriteria.andIdEqualTo(accountId);
+        }
+        List<ImBranch> branchList = Service.lookup(IMINDataBaseService.class)
+                .getMybatisMapper(ImBranchMapper.class).selectByExample(imBranchExample,rows);
+
+        branchList = Service.lookup(IFormatService.class).formatDateTime(branchList, "createTime");
+
+        res.set(IMINBusinessConstant.F_PAGING_LAY, branchList);
+        res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getMaxRows());
+
+        return res;
+    }
+    /**
+     * 添加设备
+     *
+     * @param session
+     * @return
+     * @throws MINBusinessException
+     */
+    @MINAction(value = BIND_BRANCH, transaction = IMINTransactionEnum.CMT)
+    public MINActionResult bindBranch(
+            @MINParam(key = "equId") String equId,
+            @MINParam(key = "branchId") String branchId,
+            MINSession session) throws MINBusinessException, IOException {
+
+        MINActionResult res = new MINActionResult();
+        //获取当前时间
+        String nowTime = DateUtil.getCurrentDateTimeString();
+        // 获取操作员信息
+        User user = session.getUser();
+        VmEquipmentInf vmEquipmentInf = Service.lookup(IMINDataBaseService.class)
+                .getMybatisMapper(VmEquipmentInfMapper.class)
+                .selectByPrimaryKey(equId);
+        if (null == vmEquipmentInf) {
+            throw new MINBusinessException("机器不存在");
+        }
+        vmEquipmentInf.setBranchid(branchId);
+        Service.lookup(IMINDataBaseService.class)
+                .getMybatisMapper(VmEquipmentInfMapper.class)
+                .updateByPrimaryKeySelective(vmEquipmentInf);
+
+		/*// 记录操作日志
+		String logInfo = "操作员:" + user.getName() + "添加商品,商品编号:" + id;
+		Service.lookup(ILogService.class).logging(session, logInfo);*/
+        return res;
+    }
 }

+ 3 - 2
src/main/webapp/admin/machineManage/chooseBusinessNum.html

@@ -45,6 +45,7 @@
 		<a class="layui-btn layui-btn-xs" lay-event="choose">选择</a>
 	</script>
     <script>
+		var branchId = getQueryString("branchId");
 	    $("#toggle").click(function() {
 			$(this).html($("#content").is(":hidden") ? "收起" + "<i class='iconfont up iconSelect_drop-down'/></i>" : "展开" +
 				"<i class='iconfont up iconSelect_drop-down'/></i>");
@@ -60,9 +61,9 @@
 			id: 'tableTest'
 		    ,elem: '#tableTest'
 		    ,limit:10
-		    ,url: '../../BusinessNumManageAction/businessNumManageQuery' //数据接口
+		    ,url: '../../MachineManageAction/businessNumManageQuery' //数据接口
 		    ,method: 'post'
-		    ,where:{MINView:"JSON"}
+		    ,where:{MINView:"JSON","branchId":branchId}
 		    ,page: true //开启分页
 		    ,cols: [[ //表头
 			  {field: 'operate', title: '选择', width:'10%', toolbar: '#barDemo1'}

+ 3 - 1
src/main/webapp/admin/machineManage/editmachine.html

@@ -73,9 +73,11 @@
     </form>
       <script src="../../js/min-loader-next.js"></script>
     <script>
+        var branchId;
 	    layui.use('form', function(){
 	    	  var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
 	     	 var rowData = layui.sessionData("ROW_DATA").NOW_ROW;
+            branchId = rowData.branchid;
             $.request({
                 action : '../../MachineManageAction/queryFunction',
                 data : { branchId: rowData.branchid},
@@ -309,7 +311,7 @@
                 shadeClose: true,
                 shade: 0.8,
                 area: ['95%', '95%'],
-                content: 'chooseBusinessNum.html'
+                content: 'chooseBusinessNum.html?branchId='+branchId
             });
         }
         function chooseWeChat(){

+ 1 - 1
src/main/webapp/admin/machineManage/machineDetail.html

@@ -121,7 +121,7 @@
 		   	      shade: 0.8,
 		   	      //maxmin: true, //开启最大化最小化按钮
 		   	      area: ['100%', '100%'],
-		   	      content: 'addEquproductAll.html?&equId='+rowData.id
+		   	      content: 'addEquproductAll.html?equId='+rowData.id
 			});
   	        return false;
   	    });

+ 9 - 2
src/main/webapp/admin/machineManage/machineManage.html

@@ -74,6 +74,9 @@
 	{{#  if(d.songStatus == '01'){ }}
 	<a class="layui-btn layui-btn-xs" lay-event="open">开启音乐</a>
 	{{#  } }}
+	{{#  if(d.branchid == '88888888'){ }}
+	<a class="layui-btn layui-btn-xs" lay-event="bangding">绑定商户</a>
+	{{#  } }}
 </script>
 <script type="text/html" id="switchTwo">
 	<div style="width:90px;height:70px">
@@ -123,7 +126,6 @@
 						}
 					}
 				}
-				form.render();
 			}
 		});
 	});
@@ -150,7 +152,7 @@
 				,{field: 'equTypeDesc', title: '机器类型', width:"5%"}
 				,{field: 'ioiCardNumber', title: '物联卡号', width:"5%"}
 				,{field: 'createTime', title: '创建时间', width:"10%"}
-				,{field: 'operate', title: '操作', width: "25%", toolbar: '#barDemo',fixed: 'right'}
+				,{field: 'operate', title: '操作', width: "30%", toolbar: '#barDemo',fixed: 'right'}
 			]]
 			,done: function(res, curr, count){
 				//如果是异步请求数据方式,res即为你接口返回的信息。
@@ -240,6 +242,8 @@
 				layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
 				openMainTabPage('201001-05', '游戏购', 'gameFreightwayManage/gameFreightwayManage.html', '', '201001', reload);
 
+			}else if(layEvent == 'bangding'){ //编辑
+				checkmchnt(data);
 			}
 
 		});
@@ -413,6 +417,9 @@
 		layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
 		openMainTabPage('201001-03', ' 查看货道', 'machineManage/machineDetail.html', '', '201001', reload);
 	}
+	function checkmchnt(data){
+		openMainTabPage('201001-06', '绑定商户', 'machineManage/chooseBranch.html?equId='+data.id, '', '201001', reload);
+	}
 	initSelect('equType', "EQUIPMENT_TYPE", "equType", ' ', true);
 	initSelect('state', "EQUIPMENT_STATE", "state", ' ', true);
 </script>