123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- package com.minpay.payManage.action;
- 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.DateUtil;
- import com.minpay.db.table.mapper.VmAccountMapper;
- import com.minpay.db.table.mapper.VmHlAccountMapper;
- import com.minpay.db.table.model.VmAccount;
- import com.minpay.db.table.model.VmAccountExample;
- import com.minpay.db.table.model.VmHlAccount;
- import com.minpay.db.table.model.VmHlAccountExample;
- 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;
- import com.startup.minpay.frame.constant.IMINTransactionEnum;
- import com.startup.minpay.frame.data.format.MINCopyFormat;
- 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.List;
- /**
- * 收款商户号管理
- *
- * @author weijg
- * 2020-08-25 23:15
- */
- @MINComponent
- public class BusinessNumManageAction implements IMINAction {
- /** 收款商户号信息查询 */
- public final static String TENCENTMANAGE_QUERY = "businessNumManageQuery";
- /** 添加收款商户号 */
- public final static String ADD_TENCENT = "addbusinessNum";
- /** 删除收款商户号 */
- public final static String DELETE_TENCENT = "deleteBusinessNum";
- /** 修改收款商户号 */
- public final static String MODIFY_TENCENT = "modifybusinessNum";
- /** 查询所有收款商户号 */
- public final static String QUERY_TENCENT = "queryTencent";
- /**
- * 收款商户号信息查询
- * @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 = "userId") String userId,
- @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();
- String imUserId = u.getId();
- 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(type)){
- createCriteria.andTypeEqualTo(type);
- }
- if(Constant.ADMINISTRATION_SYSTEM_NUMBER.equals(u.getBranchId())){
- if(!StringUtils.isNullOrEmpty(accountId)){
- createCriteria.andUsridEqualTo(accountId);
- }
- }else{
- createCriteria.andUsridEqualTo(u.getBranchId());
- }
- createCriteria.andStateEqualTo("00");
- 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 name 账户名称
- * @param type 账户类型
- * @param session
- * @return
- * @throws MINBusinessException
- */
- @MINAction(value = ADD_TENCENT,transaction = IMINTransactionEnum.CMT)
- public MINActionResult addbusinessNum(
- @MINParam(key = "accountId") String accountId,
- @MINParam(key = "name") String name,
- @MINParam(key = "type") String type,
- @MINParam(key = "number") String number,
- MINSession session) throws MINBusinessException {
- MINActionResult res = new MINActionResult();
- //获取当前时间
- String nowTime = DateUtil.getCurrentDateTimeString();
- // 获取操作员信息
- User user = session.getUser();
- //查询收款商户号是否重复
- VmAccountExample accountExample = new VmAccountExample();
- accountExample.createCriteria().andIdEqualTo(accountId);
- List<VmAccount> list = Service.lookup(IMINDataBaseService.class)
- .getMybatisMapper(VmAccountMapper.class)
- .selectByExample(accountExample);
- if(list.size() > 0 ){
- throw new MINBusinessException("收款商户号重复");
- }
- // 获取商品主键
- String id = Service.lookup(IPublicService.class).getSequence("VM_ACT_ID");
- VmHlAccount vti = new VmHlAccount();
- vti.setId(id); // 账户ID
- vti.setName(name); // 账户名称
- vti.setUsrid(accountId); // 存储机构编号
- vti.setType(type); // 账户类型
- vti.setNumber(number); // 账号
- vti.setChannel(user.getChannel()); // 渠道(V01:自助售货机)
- vti.setCreateUser(user.getId()); // 创建人
- vti.setCreateTime(nowTime); // 创建时间
- vti.setModifyUser(user.getId()); // 修改人
- vti.setModifyTime(nowTime); // 修改时间
- // 新增收款商户号信息,执行插入数据
- Service.lookup(IMINDataBaseService.class)
- .getMybatisMapper(VmHlAccountMapper.class)
- .insertSelective(vti);
- // 记录操作日志
- String logInfo = "操作员:" + user.getName() + "添加收款商户号,收款商户号编号:" + accountId;
- Service.lookup(ILogService.class).logging(session, logInfo);
- return res;
- }
- /**
- *修改收款商户号
- * @param id 账户ID
- * @param accountName 账户名称
- * @param accountType 账户类型
- * @param number 三方账号
- * @param session
- * @return
- * @throws MINBusinessException
- */
- @MINAction(value = MODIFY_TENCENT, transaction = IMINTransactionEnum.CMT )
- public MINActionResult modifybusinessNum(
- @MINParam(key = "id") String id,
- @MINParam(key = "accountName") String accountName,
- @MINParam(key = "accountType") String accountType,
- @MINParam(key = "number") String number,
- MINSession session) throws MINBusinessException{
- MINActionResult res = new MINActionResult();
- //获取操作员信息
- User user = session.getUser();
- //获取当前时间
- String dateTime = com.min.util.DateUtil.getCurrentDateTimeString();
- VmHlAccount vti = new VmHlAccount();
- vti.setId(id); // 账户ID
- vti.setName(accountName); // 账户名称
- vti.setType(accountType); // 账户类型
- vti.setNumber(number); // 账号
- vti.setChannel(user.getChannel()); // 渠道(V01:自助售货机)
- vti.setModifyUser(user.getId()); // 修改人
- vti.setModifyTime(dateTime); // 修改时间
- //执行修改
- Service.lookup(IMINDataBaseService.class)
- .getMybatisMapper(VmHlAccountMapper.class)
- .updateByPrimaryKeySelective(vti);
- //记录日志信息
- String logInfo = "操作员:"+user.getName() +"修改收款商户号,名称:"+ accountName +",编号: "+ id;
- Service.lookup(ILogService.class).logging(session, logInfo);
- return res;
- }
- /**
- * 收款商户号删除
- * @param id
- * @param session
- * @return
- * @throws MINBusinessException
- */
- @MINAction(value = DELETE_TENCENT, session = true)
- public MINActionResult deleteBusinessNum(
- @MINParam(key = "id") String id,
- MINSession session
- ) throws MINBusinessException {
- MINActionResult res = new MINActionResult();
- VmHlAccount ta = new VmHlAccount();
- ta.setState("01"); //删除
- ta.setId(id);
- //更新数据
- Service.lookup(IMINDataBaseService.class).updateByPrimaryKeySelective(VmHlAccountMapper.class, ta);
- Service.lookup(ILogService.class).logging(session, "删除收款商户号id:" + id);
- return res;
- }
- /**
- * 查询所有商户号
- *
- * @param session
- * @return
- * @throws MINBusinessException
- */
- @MINAction(value = QUERY_TENCENT)
- public MINActionResult queryTencent(MINSession session) throws MINBusinessException {
- MINActionResult res = new MINActionResult();
- VmHlAccountExample example = new VmHlAccountExample();
- VmHlAccountExample.Criteria criteria = example.createCriteria();
- User user = session.getUser();
- criteria.andStateNotEqualTo("00");
- if(!user.getBranchId().equals(Constant.DEFAULT_INSTITUTIONS)){
- criteria.andIdEqualTo(user.getBranchId());
- }
- List<VmHlAccount> ls = Service.lookup(IMINDataBaseService.class).selectByExample(VmHlAccountMapper.class, example);
- res.set(IMINBusinessConstant.F_QUERY_RESULT, ls);
- return res;
- }
- }
|