master
袁野 6 months ago
parent b8d1a6f5bf
commit 9fc5199113
  1. 5
      bweb/src/main/java/com/bweb/controller/cms/CmsContentController.java
  2. 129
      bweb/src/main/java/com/bweb/controller/mer/BsMerController.java
  3. 79
      service/src/main/java/com/hfkj/mer/BsMerPayConfigService.java
  4. 90
      service/src/main/java/com/hfkj/mer/impl/BsMerPayConfigServiceImpl.java
  5. 1
      service/src/main/java/com/hfkj/service/BsMerService.java
  6. 5
      service/src/main/java/com/hfkj/service/impl/BsMerServiceImpl.java
  7. 29
      service/src/main/java/com/hfkj/sysenum/mer/PayPlatformEnum.java

@ -1,12 +1,7 @@
package com.bweb.controller.cms; package com.bweb.controller.cms;
import com.bweb.controller.BsMerController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.BsMerService;
import com.hfkj.service.cms.CmsContentService; import com.hfkj.service.cms.CmsContentService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

@ -1,4 +1,4 @@
package com.bweb.controller; package com.bweb.controller.mer;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -6,12 +6,20 @@ import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsMer;
import com.hfkj.entity.BsMerPayConfig;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsType;
import com.hfkj.mer.BsMerPayConfigService;
import com.hfkj.model.BsMerModel; import com.hfkj.model.BsMerModel;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.BsMerService; import com.hfkj.service.BsMerService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.mer.PayPlatformEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -21,7 +29,10 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -33,12 +44,16 @@ import java.util.Map;
@RequestMapping(value="/mer") @RequestMapping(value="/mer")
@Api(value="商户业务") @Api(value="商户业务")
public class BsMerController { public class BsMerController {
Logger log = LoggerFactory.getLogger(BsMerController.class); Logger log = LoggerFactory.getLogger(BsMerController.class);
@Resource @Resource
private UserCenter userCenter; private UserCenter userCenter;
@Resource @Resource
private BsMerService merService; private BsMerService merService;
@Resource
private BsMerPayConfigService bsMerPayConfigService;
@RequestMapping(value="/create",method = RequestMethod.POST) @RequestMapping(value="/create",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "创建商户") @ApiOperation(value = "创建商户")
@ -170,4 +185,116 @@ public class BsMerController {
} }
@RequestMapping(value="/editPayConfig",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建商户支付内容")
public ResponseData editPayConfig(@RequestBody BsMerPayConfig body, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (userModel.getAccount().getObjectType() != SecUserObjectTypeEnum.type2.getCode()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
if (body == null
|| body.getMerId() == null
|| body.getPayPlatform() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
if (body.getPayPlatform() == PayPlatformEnum.type1.getCode()) {
if ( body.getPayMerNo() == null
|| body.getPayMerKey() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
} else if (body.getPayPlatform() == PayPlatformEnum.type2.getCode()) {
if ( body.getHltMerNo() == null
|| body.getHltInstCode() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
}
BsMerPayConfig merPayConfig;
if (body.getId() != null) {
merPayConfig = bsMerPayConfigService.queryDetail(body.getId());
if (merPayConfig == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.CONTENT_NOT_FOUND, "");
}
} else {
merPayConfig = new BsMerPayConfig();
merPayConfig.setCreateTime(new Date());
}
BsMer bsMer = merService.getDetailById(body.getMerId());
merPayConfig.setUpdateTime(new Date());
merPayConfig.setMerId(body.getMerId());
merPayConfig.setMerNo(bsMer.getMerNo());
merPayConfig.setPayPlatform(body.getPayPlatform());
merPayConfig.setPayMerNo(body.getPayMerNo());
merPayConfig.setPayMerKey(body.getPayMerKey());
merPayConfig.setHltMerNo(body.getHltMerNo());
merPayConfig.setHltInstCode(body.getHltInstCode());
merPayConfig.setStatus(1);
if (body.getId() != null) {
bsMerPayConfigService.update(merPayConfig);
} else {
bsMerPayConfigService.create(merPayConfig);
}
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/queryMerPayConfig",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商户支付参数")
public ResponseData queryMerPayConfig(@RequestParam(value = "merNo" , required = true) String merNo) {
try {
Map<String,Object> param = new HashMap<>();
param.put("merNo", merNo);
return ResponseMsgUtil.success(bsMerPayConfigService.getList(param));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/delete",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除")
public ResponseData delete(@RequestParam(value = "id" , required = false) Long id) {
try {
bsMerPayConfigService.delete(id , false);
return ResponseMsgUtil.success("删除成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -0,0 +1,79 @@
package com.hfkj.mer;
import com.hfkj.entity.BsMerPayConfig;
import java.util.List;
import java.util.Map;
public interface BsMerPayConfigService {
/**
* @Author Sum1Dream
* @Name create
* @Description // 创建
* @Date 15:11 2024/4/19
* @Param GoodsBrand
* @return void
*/
void create(BsMerPayConfig merPayConfig);
/**
* @Author Sum1Dream
* @Name update
* @Description // 修改
* @Date 15:12 2024/4/19
* @Param GoodsBrand
* @return void
*/
void update(BsMerPayConfig merPayConfig);
/**
* @Author Sum1Dream
* @Name delete
* @Description // 修改
* @Date 15:12 2024/4/19
* @Param id
* @return void
*/
void delete(Long id , Boolean fullDelete);
/**
* @Author Sum1Dream
* @Name queryDetail
* @Description // 根据ID查询产品类型详情
* @Date 15:12 2024/4/19
* @Param id
* @return com.hfkj.entity.GoodsBrand
*/
BsMerPayConfig queryDetail(Long id);
/**
* @Author Sum1Dream
* @Name findGoodsOrder
* @Description // 查询详情
* @Date 15:44 2023/4/20
* @Param [orderNo]
* @Return com.hai.entity.GoodsOrder
*/
BsMerPayConfig findGoodsOrder(Long merId);
/**
* @Author Sum1Dream
* @Name queryDetailByMap
* @Description // 根据多条件查询产品类型
* @Date 15:12 2024/4/19
* @Param map
* @return com.hfkj.entity.GoodsBrand
*/
BsMerPayConfig queryDetailByMap(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name getList
* @Description // 根据多条件查询列表
* @Date 15:13 2024/4/19
* @Param map
* @return java.util.List<com.hfkj.entity.GoodsBrand>
*/
List<BsMerPayConfig> getList(Map<String , Object> map);
}

@ -0,0 +1,90 @@
package com.hfkj.mer.impl;
import com.hfkj.dao.BsMerPayConfigMapper;
import com.hfkj.entity.BsMerPayConfig;
import com.hfkj.entity.BsMerPayConfigExample;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.mer.BsMerPayConfigService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("BsMerPayConfigService")
public class BsMerPayConfigServiceImpl implements BsMerPayConfigService {
@Resource
private BsMerPayConfigMapper bsMerPayConfigMapper;
@Override
public void create(BsMerPayConfig merPayConfig) {
bsMerPayConfigMapper.insert(merPayConfig);
}
@Override
public void update(BsMerPayConfig merPayConfig) {
bsMerPayConfigMapper.updateByPrimaryKeySelective(merPayConfig);
}
@Override
public void delete(Long id, Boolean fullDelete) {
if (fullDelete) {
bsMerPayConfigMapper.deleteByPrimaryKey(id);
} else {
BsMerPayConfig merPayConfig = queryDetail(id);
merPayConfig.setStatus(0);
merPayConfig.setUpdateTime(new Date());
update(merPayConfig);
}
}
@Override
public BsMerPayConfig queryDetail(Long id) {
return bsMerPayConfigMapper.selectByPrimaryKey(id);
}
@Override
public BsMerPayConfig findGoodsOrder(Long merId) {
BsMerPayConfigExample example = new BsMerPayConfigExample();
BsMerPayConfigExample.Criteria criteria = example.createCriteria();
criteria.andMerIdEqualTo(merId);
List<BsMerPayConfig> list = bsMerPayConfigMapper.selectByExample(example);
if (list != null && !list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public BsMerPayConfig queryDetailByMap(Map<String, Object> map) {
BsMerPayConfigExample example = new BsMerPayConfigExample();
BsMerPayConfigExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId"));
}
if (MapUtils.getLong(map, "payPlatform") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(map, "payPlatform"));
}
criteria.andStatusEqualTo(1);
List<BsMerPayConfig> list = bsMerPayConfigMapper.selectByExample(example);
if (list != null && !list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public List<BsMerPayConfig> getList(Map<String, Object> map) {
return Collections.emptyList();
}
}

@ -44,6 +44,7 @@ public interface BsMerService {
* @return * @return
*/ */
BsMerModel getDetail(String merNo); BsMerModel getDetail(String merNo);
BsMer getDetailById(Long id);
/** /**
* 查询商户列表 * 查询商户列表

@ -174,6 +174,11 @@ public class BsMerServiceImpl implements BsMerService {
return null; return null;
} }
@Override
public BsMer getDetailById(Long id) {
return merMapper.selectByPrimaryKey(id);
}
@Override @Override
public List<BsMer> getList(Map<String, Object> param) { public List<BsMer> getList(Map<String, Object> param) {
BsMerExample example = new BsMerExample(); BsMerExample example = new BsMerExample();

@ -0,0 +1,29 @@
package com.hfkj.sysenum.mer;
import lombok.Getter;
@Getter
public enum PayPlatformEnum {
/**
* 菜单
*/
type1(1, "惠支付"),
/**
* 按钮
*/
type2(2, "工会卡"),
;
private int code;
private String name;
PayPlatformEnum(int code, String name) {
this.code = code;
this.name = name;
}
}
Loading…
Cancel
Save