parent
0d8ff0755e
commit
18078fb0e4
@ -0,0 +1,178 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hai.common.exception.ErrorCode; |
||||
import com.hai.common.exception.ErrorHelp; |
||||
import com.hai.common.exception.SysCode; |
||||
import com.hai.common.security.SessionObject; |
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.entity.HighRefundAudit; |
||||
import com.hai.entity.OutRechargeOrder; |
||||
import com.hai.model.HighAgentModel; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.HighRefundAuditService; |
||||
import com.hai.service.OutRechargeOrderService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @Auther: 袁野 |
||||
* @Description: |
||||
* @Date: 2021/3/26 23:08 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping(value = "/highRefundAudit") |
||||
@Api(value = "退款审核接口") |
||||
public class HighRefundAuditController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); |
||||
|
||||
@Resource |
||||
private HighRefundAuditService highRefundAuditService; |
||||
|
||||
@Resource |
||||
private OutRechargeOrderService outRechargeOrderService; |
||||
|
||||
@Autowired |
||||
private UserCenter userCenter; |
||||
|
||||
|
||||
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "获取审核") |
||||
public ResponseData getOrderList( |
||||
@RequestParam(name = "status", required = false) Integer status, |
||||
@RequestParam(name = "orderNo", required = false) String orderNo, |
||||
@RequestParam(name = "payType", required = false) Integer payType, |
||||
@RequestParam(name = "payTimeS", required = false) Long payTimeS, |
||||
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize, |
||||
HttpServletRequest request) { |
||||
try { |
||||
|
||||
Map<String,String> map = new HashMap<>(); |
||||
|
||||
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
||||
|
||||
if (userInfoModel.getBsCompany() == null) { |
||||
log.error("HighCouponController -> getCouponList() error!","权限不足"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
|
||||
map.put("companyId", String.valueOf(userInfoModel.getBsCompany().getId())); |
||||
|
||||
if (status != null) { |
||||
map.put("status", status.toString()); |
||||
} |
||||
if (StringUtils.isNotBlank(orderNo)) { |
||||
map.put("orderNo", orderNo); |
||||
} |
||||
|
||||
if (payType != null) { |
||||
map.put("payType" , payType.toString()); |
||||
} |
||||
|
||||
if (payTimeS != null) { |
||||
map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS)); |
||||
} |
||||
if (payTimeE != null) { |
||||
map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE)); |
||||
} |
||||
|
||||
|
||||
PageHelper.startPage(pageNum,pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(highRefundAuditService.getListRefundAudit(map))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOrderController --> getUserOrderList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/insertRefundAudit", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "新增退款审核") |
||||
public ResponseData insertRefundAudit(@RequestBody HighRefundAudit highRefundAudit, HttpServletRequest request) { |
||||
try { |
||||
//发布人员
|
||||
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
||||
if (userInfoModel.getBsCompany() == null) { |
||||
log.error("HighAgentController -> insertAgent() error!","该主角色没有权限"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
||||
} |
||||
|
||||
if (StringUtils.isBlank(highRefundAudit.getSourceOrderNo()) || |
||||
highRefundAudit.getRefundSource() == null |
||||
) { |
||||
log.error("HighAgentController -> insertAgent() error!","参数错误"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
highRefundAuditService.insertRefundAudit(highRefundAudit , userInfoModel); |
||||
|
||||
return ResponseMsgUtil.success("新增成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighAgentController --> insertAgent() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getRefundReject", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "拒绝退款") |
||||
public ResponseData getRefundReject(@RequestParam(name = "id", required = true) Integer id) { |
||||
try { |
||||
|
||||
HighRefundAudit highRefundAudit = highRefundAuditService.getRefundAuditById(id); |
||||
|
||||
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); |
||||
|
||||
highRefundAudit.setStatus(2); |
||||
outRechargeOrder.setStatus(2); |
||||
|
||||
highRefundAuditService.updateRefundAudit(highRefundAudit); |
||||
outRechargeOrderService.updateOrder(outRechargeOrder); |
||||
|
||||
return ResponseMsgUtil.success(highRefundAuditService.getRefundAuditById(id)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOrderController --> getOrderById() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getRefundAuditById", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "根据id查询详情") |
||||
public ResponseData getRefundAuditById(@RequestParam(name = "id", required = true) Integer id) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(highRefundAuditService.getRefundAuditById(id)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOrderController --> getOrderById() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,58 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.HighRefundAudit; |
||||
import com.hai.entity.OutRechargeOrder; |
||||
import com.hai.model.UserInfoModel; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface HighRefundAuditService { |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Description // 查询充值订单
|
||||
* @Date 15:18 2021/6/11 |
||||
* @Param [map] |
||||
* @return java.util.List<com.hai.entity.HighRefundAudit> |
||||
**/ |
||||
List<HighRefundAudit> getListRefundAudit(Map<String , String> map); |
||||
|
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Description // 根据订单ID查询订单
|
||||
* @Date 15:19 2021/6/11 |
||||
* @Param [orderId] |
||||
* @return com.hai.entity.HighRefundAudit |
||||
**/ |
||||
HighRefundAudit getRefundAuditById(Integer id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Description // 根据订单号查询订单
|
||||
* @Date 15:20 2021/6/11 |
||||
* @Param [orderNo] |
||||
* @return com.hai.entity.OutRechargeOrder |
||||
**/ |
||||
HighRefundAudit findByOrderNo(String orderNo); |
||||
|
||||
/*** |
||||
* @Author Sum1Dream |
||||
* @Description // 新增
|
||||
* @Date 15:25 2021/6/11 |
||||
* @Param [HighRefundAudit] |
||||
* @return void |
||||
**/ |
||||
void insertRefundAudit(HighRefundAudit highRefundAudit , UserInfoModel userInfoModel); |
||||
|
||||
/*** |
||||
* @Author Sum1Dream |
||||
* @Description // 修改
|
||||
* @Date 15:26 2021/6/11 |
||||
* @Param [HighRefundAudit] |
||||
* @return void |
||||
**/ |
||||
void updateRefundAudit(HighRefundAudit highRefundAudit); |
||||
|
||||
} |
@ -0,0 +1,110 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
import com.hai.common.utils.DateUtil; |
||||
import com.hai.dao.HighRefundAuditMapper; |
||||
import com.hai.entity.HighRefundAudit; |
||||
import com.hai.entity.HighRefundAuditExample; |
||||
import com.hai.entity.OutRechargeOrder; |
||||
import com.hai.entity.OutRechargeOrderExample; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.HighRefundAuditService; |
||||
import com.hai.service.OutRechargeOrderService; |
||||
import io.swagger.models.auth.In; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Propagation; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("highRefundAuditService") |
||||
public class HighRefundAuditServiceImpl implements HighRefundAuditService { |
||||
|
||||
|
||||
@Resource |
||||
private HighRefundAuditMapper highRefundAuditMapper; |
||||
|
||||
@Resource |
||||
private OutRechargeOrderService outRechargeOrderService; |
||||
|
||||
@Override |
||||
public List<HighRefundAudit> getListRefundAudit(Map<String, String> map) { |
||||
|
||||
HighRefundAuditExample example = new HighRefundAuditExample(); |
||||
HighRefundAuditExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getInteger(map, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||
} |
||||
if (MapUtils.getInteger(map, "payType") != null) { |
||||
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType")); |
||||
} |
||||
|
||||
if (MapUtils.getInteger(map, "companyId") != null) { |
||||
criteria.andCompanIdEqualTo(MapUtils.getInteger(map, "companyId")); |
||||
} |
||||
|
||||
if (MapUtils.getString(map, "orderNo") != null) { |
||||
criteria.andSourceOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%"); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(map.get("payTimeS")) && StringUtils.isNotBlank(map.get("payTimeE"))) { |
||||
criteria.andPayTimeBetween( |
||||
DateUtil.format(map.get("payTimeS") , "yyyy-MM-dd HH:mm:ss") , |
||||
DateUtil.format(map.get("payTimeE") , "yyyy-MM-dd HH:mm:ss")); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(map.get("createTimeS")) && StringUtils.isNotBlank(map.get("createTimeE"))) { |
||||
criteria.andCreatedTimeBetween( |
||||
DateUtil.format(map.get("createTimeS") , "yyyy-MM-dd HH:mm:ss") , |
||||
DateUtil.format(map.get("createTimeE") , "yyyy-MM-dd HH:mm:ss")); |
||||
} |
||||
|
||||
return highRefundAuditMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public HighRefundAudit getRefundAuditById(Integer id) { |
||||
return highRefundAuditMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public HighRefundAudit findByOrderNo(String orderNo) { |
||||
HighRefundAuditExample example = new HighRefundAuditExample(); |
||||
example.createCriteria().andSourceOrderNoEqualTo(orderNo); |
||||
return highRefundAuditMapper.selectByExample(example).get(0); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(propagation= Propagation.REQUIRES_NEW) |
||||
public void insertRefundAudit(HighRefundAudit highRefundAudit , UserInfoModel userInfoModel) { |
||||
|
||||
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); |
||||
|
||||
highRefundAudit.setCompanId(userInfoModel.getBsCompany().getId().intValue()); |
||||
highRefundAudit.setStatus(0); |
||||
highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice()); |
||||
highRefundAudit.setCreatedTime(new Date()); |
||||
highRefundAudit.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); |
||||
highRefundAudit.setCreatedUserName(userInfoModel.getSecUser().getUserName()); |
||||
highRefundAudit.setPayType(outRechargeOrder.getPayType()); |
||||
highRefundAudit.setPayTime(outRechargeOrder.getPayTime()); |
||||
highRefundAudit.setExt1(String.valueOf(outRechargeOrder.getId())); |
||||
|
||||
outRechargeOrder.setStatus(6); |
||||
outRechargeOrderService.updateOrder(outRechargeOrder); |
||||
|
||||
highRefundAuditMapper.insert(highRefundAudit); |
||||
} |
||||
|
||||
@Override |
||||
public void updateRefundAudit(HighRefundAudit highRefundAudit) { |
||||
highRefundAuditMapper.updateByPrimaryKey(highRefundAudit); |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue