123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- package com.minpay.rechargeManage;
- import com.min.sha1.SHA1;
- import com.minpay.common.bean.User;
- import com.minpay.common.constant.Constant;
- import com.minpay.common.constant.ServConstant;
- import com.minpay.common.exception.BusinessCodeException;
- 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.ImLogonCtrlMapper;
- import com.minpay.db.table.mapper.ImUserMapper;
- import com.minpay.db.table.mapper.ImUserRoleRelMapper;
- import com.minpay.db.table.mapper.VmRechargeRuleMapper;
- import com.minpay.db.table.model.*;
- import com.minpay.db.table.own.mapper.UserMapper;
- 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.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * 操作员管理
- * @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;
- }
-
- }
|