Merge branch 'dev' of http://139.159.177.244:3000/hurui/hai-server into dev
commit
a9368a6404
@ -0,0 +1,129 @@ |
||||
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.HighAgent; |
||||
import com.hai.entity.OutRechargePrice; |
||||
import com.hai.model.HighAgentModel; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.OutRechargePriceService; |
||||
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.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value = "/outRechargePrice") |
||||
@Api(value = "查询充值金额接口") |
||||
public class OutRechargePriceController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); |
||||
|
||||
@Autowired |
||||
private UserCenter userCenter; |
||||
|
||||
@Resource |
||||
private OutRechargePriceService outRechargePriceService; |
||||
|
||||
@RequestMapping(value = "/getListOutRechargePrice", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询充值金额列表") |
||||
public ResponseData getListOutRechargePrice( |
||||
@RequestParam(value = "type", required = false) Integer type , |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request |
||||
) { |
||||
try { |
||||
Map<String, String> map = new HashMap<>(); |
||||
|
||||
if (type != null ) { |
||||
map.put("type", String.valueOf(type)); |
||||
} |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
|
||||
List<OutRechargePrice> outRechargePrices = outRechargePriceService.getListRechargePrice(map); |
||||
|
||||
return ResponseMsgUtil.success(new PageInfo<>(outRechargePrices)); |
||||
} catch (Exception e) { |
||||
log.error("OutRechargePriceController --> getListUser() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/insertPrice", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "新增金额") |
||||
public ResponseData insertAgent(@RequestBody OutRechargePrice outRechargePrice, HttpServletRequest request) { |
||||
try { |
||||
if (outRechargePrice.getType() == null |
||||
|| outRechargePrice.getPrice() == null |
||||
|| outRechargePrice.getRealPrice() == null |
||||
) { |
||||
log.error("SecOrganizationController -> insertPrice() error!"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
|
||||
outRechargePrice.setCreateTime(new Date()); |
||||
|
||||
outRechargePriceService.insertRechargePrice(outRechargePrice); |
||||
|
||||
return ResponseMsgUtil.success("新增成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("OutRechargePriceController --> insertPrice() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/updatePrice", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "修改金额") |
||||
public ResponseData updatePrice(@RequestBody OutRechargePrice outRechargePrice) { |
||||
try { |
||||
if (outRechargePrice.getType() == null |
||||
|| outRechargePrice.getId() == null |
||||
|| outRechargePrice.getPrice() == null |
||||
|| outRechargePrice.getRealPrice() == null |
||||
) { |
||||
log.error("SecOrganizationController -> updatePrice() error!"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
OutRechargePrice outRechargePrice1 = outRechargePriceService.findById(outRechargePrice.getId()); |
||||
|
||||
if (outRechargePrice1 == null ) { |
||||
log.error("SecOrganizationController -> updatePrice() error!"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.UPDATE_DATA_ERROR, ""); |
||||
} |
||||
|
||||
outRechargePriceService.updateRechargePrice(outRechargePrice); |
||||
|
||||
return ResponseMsgUtil.success("修改成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("OutRechargePriceController --> insertPrice() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue