소스 검색

充值规则

xubh 5 년 전
부모
커밋
fce1a81037
2개의 변경된 파일403개의 추가작업 그리고 0개의 파일을 삭제
  1. 196 0
      src/main/java/com/minpay/shouhuo/GameSetupManageAction.java
  2. 207 0
      src/main/java/com/minpay/shouhuo/RechargeManageAction.java

+ 196 - 0
src/main/java/com/minpay/shouhuo/GameSetupManageAction.java

@@ -0,0 +1,196 @@
+package com.minpay.shouhuo;
+
+import com.minpay.common.bean.User;
+import com.minpay.common.constant.Constant;
+import com.minpay.common.format.IFormatService;
+import com.minpay.common.service.ILogService;
+import com.minpay.common.service.IPublicService;
+import com.minpay.common.util.RegexUtil;
+import com.minpay.db.table.mapper.VmGameRuleMapper;
+import com.minpay.db.table.model.VmGameRule;
+import com.minpay.db.table.model.VmGameRuleExample;
+import com.mysql.jdbc.StringUtils;
+import com.startup.minpay.frame.business.IMINAction;
+import com.startup.minpay.frame.business.MINHttpServletRequestContext;
+import com.startup.minpay.frame.business.res.MINActionResult;
+import com.startup.minpay.frame.constant.IMINBusinessConstant;
+import com.startup.minpay.frame.constant.IMINTransactionEnum;
+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 com.startup.minpay.frame.target.MINValidator;
+import com.startup.minpay.util.DateTime;
+
+import java.util.List;
+
+/**
+ * 充值规则管理
+ * @author xbh
+ *
+ */
+@MINComponent
+public class GameSetupManageAction implements IMINAction {
+	public final static String	QUERY_GAME_SETUP				= "queryGameSetup";
+
+	public final static String	ADD_GAME_SETUP				= "addGameSetup";
+
+	public final static String	MODIFY_GAME_SETUP				= "modifyGameSetup";
+
+	public final static String	DELETE_GAME_SETUP			= "deleteGameSetup";
+
+	/**
+	 * 查询充值规则
+	 * @param session
+	 * @param page
+	 * @param limit
+	 * @param name
+	 * @param fapRequest
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = QUERY_GAME_SETUP)
+	public MINActionResult queryGameSetup(
+			MINSession session,
+			@MINParam(key = "page", defaultValue = "1") int page,
+			@MINParam(key = "limit", defaultValue = "3") int limit,
+			@MINParam(key = "name") String name,
+			MINHttpServletRequestContext fapRequest
+			) throws MINBusinessException {
+
+		MINActionResult res = new MINActionResult();
+		VmGameRuleExample vmGameRuleExample = new VmGameRuleExample();
+		VmGameRuleExample.Criteria createCriteria = vmGameRuleExample.createCriteria();
+		if(!StringUtils.isNullOrEmpty(name)){
+			createCriteria.andNameEqualTo(name);
+		}
+		MINRowBounds rows = new MINRowBounds(page, limit);
+		// 查询
+		List<VmGameRule> ls = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmGameRuleMapper.class).selectByExample(vmGameRuleExample, rows);
+		
+		// 格式化
+		ls = Service.lookup(IFormatService.class).formatDateTime(ls, "createTime");
+		// 设置返回值
+		res.set(IMINBusinessConstant.F_PAGING_LAY, ls);
+		res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
+		return res;
+	}
+
+	/**
+	 * 添加充值规则
+	 * @param desc
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = ADD_GAME_SETUP, transaction = IMINTransactionEnum.CMT)
+	public MINActionResult addGameSetup(
+			@MINParam(key = "name") String name,
+			@MINParam(key = "desc") String desc,
+			@MINParam(key = "alipayId") String alipayId,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		if(!Constant.ADMINISTRATION_SYSTEM_NUMBER.equals(user.getBranchId())){
+			throw new MINBusinessException("此用户没有权限,此操作");
+		}
+
+		String id = Service.lookup(IPublicService.class).getSequence("GAME_RULE_NO");
+		String time = new DateTime().toDateTimeString();
+		id = time.concat(id);
+		VmGameRule vmGameRule = new VmGameRule();
+		vmGameRule.setId(id);
+		vmGameRule.setName(name);
+		vmGameRule.setDesc(desc);
+		vmGameRule.setCreateTime(time);
+		vmGameRule.setAlipayid(alipayId);
+		vmGameRule.setCreateUser(user.getId());
+		Service.lookup(IMINDataBaseService.class).insertSelective(VmGameRuleMapper.class, vmGameRule);
+		String logInfo = user.getName()+"-添加游戏规则:" + id;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+	@MINValidator(value = ADD_GAME_SETUP)
+	public MINActionResult addGameSetupValidator(
+			@MINParam(key = "name",regex = RegexUtil.NULL, error = "名称不能为空") String name,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		return res;
+	}
+
+	/**
+	 * 编辑游戏规则
+	 * @param id
+	 * @param name
+	 * @param desc
+	 * @param alipayId
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = MODIFY_GAME_SETUP, transaction = IMINTransactionEnum.CMT)
+	public MINActionResult modifyGameSetup(
+			@MINParam(key = "id") String id,
+			@MINParam(key = "name") String name,
+			@MINParam(key = "desc") String desc,
+			@MINParam(key = "alipayId") String alipayId,
+			MINSession session
+			) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		VmGameRule vmGameRule = new VmGameRule();
+		vmGameRule.setId(id);
+		vmGameRule.setName(name);
+		vmGameRule.setDesc(desc);
+		vmGameRule.setAlipayid(alipayId);
+		Service.lookup(IMINDataBaseService.class).updateByPrimaryKeySelective(VmGameRuleMapper.class, vmGameRule);
+		String logInfo = user.getName()+"-编辑游戏规则:" + id;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+	@MINValidator(value = MODIFY_GAME_SETUP)
+	public MINActionResult modifyGameSetupValidator(
+			@MINParam(key = "id",regex = RegexUtil.NOT_NULL, error = "数据异常") String id,
+			@MINParam(key = "name",regex = RegexUtil.AMOUNT_NOTNULL, error = "名称不能为空") String name,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		return res;
+	}
+
+
+	/**
+	 * 删除规则
+	 * @param id
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = DELETE_GAME_SETUP, transaction = IMINTransactionEnum.CMT)
+	public MINActionResult deleteGameSetup(
+			@MINParam(key = "id") String id,
+			MINSession session
+			) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		VmGameRule vmGameRule = new VmGameRule();
+		vmGameRule.setId(id);
+		vmGameRule.setState("1");
+		Service.lookup(IMINDataBaseService.class).updateByPrimaryKeySelective(VmGameRuleMapper.class, vmGameRule);
+		String logInfo = user.getName()+"-删除游戏规则:" + id;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+	@MINValidator(value = DELETE_GAME_SETUP)
+	public MINActionResult deleteGameSetupValidator(
+			@MINParam(key = "id",regex = RegexUtil.NOT_NULL, error = "数据异常") String id,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		return res;
+	}
+	
+
+}

+ 207 - 0
src/main/java/com/minpay/shouhuo/RechargeManageAction.java

@@ -0,0 +1,207 @@
+package com.minpay.shouhuo;
+
+import com.minpay.common.bean.User;
+import com.minpay.common.constant.Constant;
+import com.minpay.common.format.IFormatService;
+import com.minpay.common.service.ILogService;
+import com.minpay.common.service.IPublicService;
+import com.minpay.common.util.RegexUtil;
+import com.minpay.db.table.mapper.VmRechargeRuleMapper;
+import com.minpay.db.table.model.VmRechargeRule;
+import com.minpay.db.table.model.VmRechargeRuleExample;
+import com.mysql.jdbc.StringUtils;
+import com.startup.minpay.frame.business.IMINAction;
+import com.startup.minpay.frame.business.MINHttpServletRequestContext;
+import com.startup.minpay.frame.business.res.MINActionResult;
+import com.startup.minpay.frame.constant.IMINBusinessConstant;
+import com.startup.minpay.frame.constant.IMINTransactionEnum;
+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 com.startup.minpay.frame.target.MINValidator;
+import com.startup.minpay.util.DateTime;
+
+import java.util.List;
+
+/**
+ * 充值规则管理
+ * @author xbh
+ *
+ */
+@MINComponent
+public class RechargeManageAction implements IMINAction {
+	public final static String	QUERY_RECHARGE_RULE				= "queryRechargeRule";
+
+	public final static String	ADD_RECHARGE_RULE				= "addRechargeRule";
+
+	public final static String	MODIFY_RECHARGE_RULE				= "modifyRechargeRule";
+
+	public final static String	DELETE_RECHARGE_RULE			= "deleteRechargeRule";
+
+	/**
+	 * 查询充值规则
+	 * @param session
+	 * @param page
+	 * @param limit
+	 * @param dates
+	 * @param rechargeAmt
+	 * @param fapRequest
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = QUERY_RECHARGE_RULE)
+	public MINActionResult queryRechargeRule(
+			MINSession session,
+			@MINParam(key = "page", defaultValue = "1") int page,
+			@MINParam(key = "limit", defaultValue = "3") int limit,
+			@MINParam(key = "dates") String dates,
+			@MINParam(key = "rechargeAmt") String rechargeAmt,
+			@MINParam(key = "desc") String desc,
+			MINHttpServletRequestContext fapRequest
+			) throws MINBusinessException {
+
+		MINActionResult res = new MINActionResult();
+		VmRechargeRuleExample vmRechargeRuleExample = new VmRechargeRuleExample();
+		VmRechargeRuleExample.Criteria createCriteria = vmRechargeRuleExample.createCriteria();
+		if(!StringUtils.isNullOrEmpty(rechargeAmt)){
+			createCriteria.andRechargeAmtEqualTo(rechargeAmt);
+		}
+		if(!StringUtils.isNullOrEmpty(dates)){
+			dates = dates.replaceAll("-", "").replaceAll(" ", "");
+			createCriteria.andCreateTimeBetween(dates.substring(0, 8),dates.substring(8, 16));
+		}
+		createCriteria.andStateEqualTo("0");
+		MINRowBounds rows = new MINRowBounds(page, limit);
+		
+		// 查询
+		List<VmRechargeRule> ls = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmRechargeRuleMapper.class).selectByExample(vmRechargeRuleExample, rows);
+		
+		// 格式化
+		ls = Service.lookup(IFormatService.class).formatDateTime(ls, "createTime");
+		// 设置返回值
+		res.set(IMINBusinessConstant.F_PAGING_LAY, ls);
+		res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
+		return res;
+	}
+
+	/**
+	 * 添加充值规则
+	 * @param rechargeAmt
+	 * @param giveAmt
+	 * @param desc
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = ADD_RECHARGE_RULE, transaction = IMINTransactionEnum.CMT)
+	public MINActionResult addRechargeRule(
+			@MINParam(key = "rechargeAmt") String rechargeAmt,
+			@MINParam(key = "giveAmt") String giveAmt,
+			@MINParam(key = "desc") String desc,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		if(!Constant.ADMINISTRATION_SYSTEM_NUMBER.equals(user.getBranchId())){
+			throw new MINBusinessException("此用户没有权限,此操作");
+		}
+		String id = Service.lookup(IPublicService.class).getSequence("RECHARGE_RULE_NO");
+
+		String time = new DateTime().toDateTimeString();
+		id = time.concat(id);
+		VmRechargeRule vmRechargeRule = new VmRechargeRule();
+		vmRechargeRule.setId(id);
+		vmRechargeRule.setRechargeAmt(rechargeAmt);
+		vmRechargeRule.setGiveAmt(giveAmt);
+		vmRechargeRule.setDesc(desc);
+		vmRechargeRule.setCreateTime(time);
+		vmRechargeRule.setCreateUser(user.getId());
+		Service.lookup(IMINDataBaseService.class).insertSelective(VmRechargeRuleMapper.class, vmRechargeRule);
+		String logInfo = "添加充值规则:" + id;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+	@MINValidator(value = ADD_RECHARGE_RULE)
+	public MINActionResult addRechargeRuleValidator(
+			@MINParam(key = "rechargeAmt",regex = RegexUtil.AMOUNT_NOTNULL, error = "请正确的金额") String rechargeAmt,
+			@MINParam(key = "giveAmt",regex = RegexUtil.AMOUNT_NOTNULL, error = "请正确的金额") String giveAmt,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		return res;
+	}
+
+	/**
+	 * 编辑充值规则
+	 * @param id
+	 * @param rechargeAmt
+	 * @param giveAmt
+	 * @param desc
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = MODIFY_RECHARGE_RULE, transaction = IMINTransactionEnum.CMT)
+	public MINActionResult modifyRechargeRule(
+			@MINParam(key = "id") String id,
+			@MINParam(key = "rechargeAmt") String rechargeAmt,
+			@MINParam(key = "giveAmt") String giveAmt,
+			@MINParam(key = "desc") String desc,
+			MINSession session
+			) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		VmRechargeRule vmRechargeRule = new VmRechargeRule();
+		vmRechargeRule.setId(id);
+		vmRechargeRule.setRechargeAmt(rechargeAmt);
+		vmRechargeRule.setGiveAmt(giveAmt);
+		vmRechargeRule.setDesc(desc);
+		Service.lookup(IMINDataBaseService.class).updateByPrimaryKeySelective(VmRechargeRuleMapper.class, vmRechargeRule);
+		String logInfo = "编辑充值规则:" + id;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+	@MINValidator(value = MODIFY_RECHARGE_RULE)
+	public MINActionResult modifyRechargeRuleValidator(
+			@MINParam(key = "id",regex = RegexUtil.NOT_NULL, error = "数据异常") String id,
+			@MINParam(key = "rechargeAmt",regex = RegexUtil.AMOUNT_NOTNULL, error = "请正确的金额") String rechargeAmt,
+			@MINParam(key = "giveAmt",regex = RegexUtil.AMOUNT_NOTNULL, error = "请正确的金额") String giveAmt,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		return res;
+	}
+
+
+	/**
+	 * 删除规则
+	 * @param id
+	 * @param session
+	 * @return
+	 * @throws MINBusinessException
+	 */
+	@MINAction(value = DELETE_RECHARGE_RULE, transaction = IMINTransactionEnum.CMT)
+	public MINActionResult deleteRechargeRule(
+			@MINParam(key = "id") String id,
+			MINSession session
+			) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		VmRechargeRule vmRechargeRule = new VmRechargeRule();
+		vmRechargeRule.setId(id);
+		vmRechargeRule.setState("1");
+		Service.lookup(IMINDataBaseService.class).updateByPrimaryKeySelective(VmRechargeRuleMapper.class, vmRechargeRule);
+		String logInfo = "删除充值规则:" + id;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+	@MINValidator(value = DELETE_RECHARGE_RULE)
+	public MINActionResult deleteRechargeRuleValidator(
+			@MINParam(key = "id",regex = RegexUtil.NOT_NULL, error = "数据异常") String id,
+			MINSession session) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		return res;
+	}
+	
+
+}