wanglm před 5 roky
rodič
revize
d3f0b9f0ef

+ 234 - 0
src/main/java/com/minpay/common/action/DeviceManageAction.java

@@ -0,0 +1,234 @@
+package com.minpay.common.action;
+
+import com.min.util.DateUtil;
+import com.minpay.common.service.ILogService;
+import com.minpay.common.service.IPublicService;
+import com.minpay.db.table.mapper.VmEquipmentInfMapper;
+import com.minpay.db.table.model.VmEquipmentInf;
+import com.minpay.db.table.model.VmEquipmentInfExample;
+import com.minpay.db.table.own.mapper.DeviceMapper;
+import com.minpay.db.table.own.mapper.GoodsWayMapper;
+import com.startup.minpay.frame.business.IMINAction;
+import com.startup.minpay.frame.business.res.MINActionResult;
+import com.startup.minpay.frame.constant.IMINBusinessConstant;
+import com.startup.minpay.frame.exception.MINBusinessException;
+import com.startup.minpay.frame.jdbc.MINRowBounds;
+import com.startup.minpay.frame.service.base.IMINDataBaseService;
+import com.startup.minpay.frame.service.base.Service;
+import com.startup.minpay.frame.session.MINSession;
+import com.startup.minpay.frame.target.MINAction;
+import com.startup.minpay.frame.target.MINComponent;
+import com.startup.minpay.frame.target.MINParam;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 设备管理
+ * @author WANGLM
+ */
+@MINComponent
+public class DeviceManageAction implements IMINAction {
+
+	//新增设备
+	public final static String	ADD_DEVICE_INFO = "addDeviceInfo";
+
+	//查询设备数据
+	public final static String	SELECT_DEVICE_INFO = "selectDeviceInfo";
+	//查询设备详情
+	public final static String	SELECT_DEVICE_DETAIL = "selectDeviceDetail";
+
+	//修改设备数据
+	public final static String	MODIFY_DEVICE_INFO = "modifyDeviceInfo";
+
+	/**
+	 * 修改设备状态
+	 * @param id
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = "MODIFY_DEVICE_INFO")
+	public MINActionResult modifyDeviceInfo(
+			@MINParam(key = "id") String id,
+			@MINParam(key = "state") String state,
+			@MINParam(key = "userId") String userId,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+
+		VmEquipmentInf vi = new VmEquipmentInf();
+		vi.setId(id);
+		vi.setState(state);
+		vi.setModifyUser(userId);
+		vi.setModifyTime(DateUtil.getCurrentDateTimeString());
+		Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(VmEquipmentInfMapper.class)
+				.updateByPrimaryKeySelective(vi);
+		// 记录操作日志
+		String logInfo = "用户:" + userId + "修改设备,设备状态:" + state;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+
+
+	/**
+	 * 查询设备数据
+	 * @param branchid
+	 * @param page
+	 * @param limit
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = "SELECT_DEVICE_INFO")
+	public MINActionResult selectDeviceInfo(
+			@MINParam(key = "branchid") String branchid,
+			@MINParam(key = "page", defaultValue = "1") int page,
+			@MINParam(key = "limit", defaultValue = "10") int limit,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		MINRowBounds rows = new MINRowBounds(page, limit);
+
+		VmEquipmentInfExample ve = new VmEquipmentInfExample();
+		//本机构 未销毁的
+		ve.createCriteria().andBranchidEqualTo(branchid)
+				.andStateNotEqualTo("03");
+		ve.setOrderByClause("VEQ_MODIFY_TIME desc");
+		List<VmEquipmentInf> list = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(VmEquipmentInfMapper.class).selectByExample(ve,rows);
+
+		// 设置返回值
+		res.set(IMINBusinessConstant.F_PAGING_LAY, list);
+		res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
+		return res;
+	}
+
+	/**
+	 * 查询设备数据 详情
+	 * @param id
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = "SELECT_DEVICE_DETAIL")
+	public MINActionResult selectDeviceDetail(
+			@MINParam(key = "id") String id,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		Map<String, String> p = new HashMap<String, String>();
+		p.put("id",id);
+		//查详情
+		List<Map<String, String>> list = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(DeviceMapper.class).queryDeviceInfo(p);
+		// 设置返回值
+		res.set(IMINBusinessConstant.F_PAGING_LAY, list);
+		return res;
+	}
+
+	/**
+	 *	新增设备
+	 * @param name		设备名
+	 * @param iotServiceProvider
+	 * @param iotCardNumber
+	 * @param versionType
+	 * @param address
+	 * @param equType
+	 * @param equImg
+	 * @param wcAccount
+	 * @param zfbAccount
+	 * @param charge
+	 * @param creditChannel
+	 * @param payeeNo
+	 * @param payment
+	 * @param paymentType
+	 * @param backgroundOne
+	 * @param backgroundTwo
+	 * @param exchangeRate
+	 * @param supportBalance
+	 * @param remarks
+	 * @param state
+	 * @param machineNo
+	 * @param branchid
+	 * @param rows
+	 * @param lines
+	 * @param createUser
+	 * @param songStatus
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = "ADD_DEVICE_INFO")
+	public MINActionResult addDeviceInfo(
+			@MINParam(key = "name") String name,
+			@MINParam(key = "iotServiceProvider") String iotServiceProvider,
+			@MINParam(key = "iotCardNumber") String iotCardNumber,
+			@MINParam(key = "versionType") String versionType,
+			@MINParam(key = "address") String address,
+			@MINParam(key = "equType") String equType,
+			@MINParam(key = "equImg") String equImg,
+			@MINParam(key = "wcAccount") String wcAccount,
+			@MINParam(key = "zfbAccount") String zfbAccount,
+			@MINParam(key = "charge") String charge,
+			@MINParam(key = "creditChannel") String creditChannel,
+			@MINParam(key = "payeeNo") String payeeNo,
+			@MINParam(key = "payment") String payment,
+			@MINParam(key = "paymentType") String paymentType,
+			@MINParam(key = "backgroundOne") String backgroundOne,
+			@MINParam(key = "backgroundTwo") String backgroundTwo,
+			@MINParam(key = "exchangeRate") String exchangeRate,
+			@MINParam(key = "supportBalance") String supportBalance,
+			@MINParam(key = "remarks") String remarks,
+			@MINParam(key = "state") String state,
+			@MINParam(key = "machineNo") String machineNo,
+			@MINParam(key = "branchid") String branchid,
+			@MINParam(key = "createUser") String rows,
+			@MINParam(key = "createUser") String lines,
+			@MINParam(key = "createUser") String createUser,
+			@MINParam(key = "createUser") String songStatus,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		//获取设备主键
+		String id = Service.lookup(IPublicService.class).
+				getSequence("VM_EQUIPMENT_ID");
+		VmEquipmentInf vi = new VmEquipmentInf();
+		vi.setId(id);
+		vi.setChannel("01");
+		vi.setIotServiceProvider(iotServiceProvider);
+		vi.setIotCardNumber(iotCardNumber);
+		vi.setVersionType(versionType);
+		vi.setState(state);
+		vi.setAddress(address);
+		vi.setEquType(equType);
+		vi.setEquImg(equImg);
+		vi.setWcAccount(wcAccount);
+		vi.setZfbAccount(zfbAccount);
+		vi.setCharge(charge);
+		vi.setCreditChannel(creditChannel);
+		vi.setPayment(payment);
+		vi.setPaymentType(paymentType);
+		vi.setPayeeNo(payeeNo);
+		vi.setBackgroundOne(backgroundOne);
+		vi.setBackgroundTwo(backgroundTwo);
+		vi.setExchangeRate(exchangeRate);
+		vi.setSupportBalance(supportBalance);
+		vi.setRemarks(remarks);
+		vi.setMachineNo(machineNo);
+		vi.setRows(rows);
+		vi.setLines(lines);
+		vi.setSongStatus(songStatus);
+		vi.setBranchid(branchid);
+		vi.setCreateUser(createUser);
+		vi.setCreateTime(DateUtil.getCurrentDateTimeString());
+		vi.setModifyUser(createUser);
+		vi.setModifyTime(DateUtil.getCurrentDateTimeString());
+		// 执行新增货到数据
+		Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(VmEquipmentInfMapper.class).insert(vi);
+		// 记录操作日志
+		String logInfo = "用户:" + createUser + "新增设备,设备编号:" + id;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+}

+ 15 - 0
src/main/java/com/minpay/db/table/own/mapper/DeviceMapper.java

@@ -0,0 +1,15 @@
+package com.minpay.db.table.own.mapper;
+
+import com.startup.minpay.frame.jdbc.IMINMybatisEntityMapper;
+import com.startup.minpay.frame.jdbc.MINRowBounds;
+
+import java.util.List;
+import java.util.Map;
+
+
+public interface DeviceMapper extends IMINMybatisEntityMapper {
+	
+	/**查询订单*/
+	List<Map<String, String>> queryDeviceInfo(Map<String, String> map);
+	
+}

+ 22 - 0
src/main/resources/com/minpay/db/table/own/mapper/DeviceMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.minpay.db.table.own.mapper.OrderMapper">
+	<select id="queryDeviceInfo" resultType="hashmap" parameterType="java.util.Map">
+		select
+			pe.VCI_ID,
+			pe.VCI_AISLE,
+			pe.VCI_CARGO_WAY_ROW,
+			pe.VCI_CARGO_WAY_LINE,
+			pe.VCI_PRODUCT_NUMS,
+			pp.PRT_NAME,
+			ei.VEQ_NAME,
+			ei.VEQ_ADDRESS
+		froM vm_pro_equ_rel pe, vm_product_inf pp, vm_equipment_inf ei
+		where pe.VCI_PRODUCT_ID = pp.PRT_ID
+		and pe.VCI_EQUIPMENT_ID = ei.VEQ_ID
+		AND pp.PRT_STATE != '2'
+		and pe.VCI_EXEIT_STATE = '00'
+		and ei.VEQ_ID = #{vciId,jdbcType=VARCHAR}
+		ORDER BY pp.PRT_MODIFY_TIME DESC
+	</select>
+</mapper>