提交修改

dev-discount
袁野 4 years ago
parent 34a1ee123a
commit 5f040ccedd
  1. 3
      hai-bweb/src/main/java/com/bweb/controller/LoginController.java
  2. 129
      hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  4. 52
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  5. 9
      hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java
  6. 4
      hai-cweb/src/main/resources/dev/application.yml
  7. 4
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  8. 13
      hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java

@ -173,6 +173,9 @@ public class LoginController {
} }
userInfoModel.setHighAgent(highAgent); userInfoModel.setHighAgent(highAgent);
} else if (secUser.getObjectType() == 5) {
// 查询管理人员
} else { } else {
log.error("login error!","用户信息错误"); log.error("login error!","用户信息错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");

@ -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);
}
}
}

@ -109,6 +109,8 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/order/orderToH5Pay") .excludePathPatterns("/order/orderToH5Pay")
.excludePathPatterns("/order/orderToPay") .excludePathPatterns("/order/orderToPay")
.excludePathPatterns("/wechat/*") .excludePathPatterns("/wechat/*")
.excludePathPatterns("/outRechargeOrder/*")
.excludePathPatterns("/outRechargePrice/*")
; ;
} }

@ -54,9 +54,12 @@ public class OutRechargeOrderController {
try { try {
// 用户 // 用户
SessionObject sessionObject = userCenter.getSessionObject(request); // SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); // HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
// if(sessionObject == null){
// log.error("SecOrganizationController --> addOrganization() error!", "");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
// }
if (StringUtils.isBlank(outRechargeOrder.getRechargeContent()) || if (StringUtils.isBlank(outRechargeOrder.getRechargeContent()) ||
outRechargeOrder.getPayPrice() == null || outRechargeOrder.getPayPrice() == null ||
outRechargeOrder.getOrderPrice() == null outRechargeOrder.getOrderPrice() == null
@ -70,10 +73,15 @@ public class OutRechargeOrderController {
// 判断充值模式:1 话费充值 2. 中石化 3. 中石油 // 判断充值模式:1 话费充值 2. 中石化 3. 中石油
if (outRechargeOrder.getRechargeModel() == 1) { if (outRechargeOrder.getRechargeModel() == 1) {
JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent()); JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent());
if (telObject.get("status") == "0") {
JSONObject o = telObject.getObject("result",JSONObject.class); JSONObject o = telObject.getObject("result",JSONObject.class);
// 拼接内容 // 拼接内容
remarks = o.get("province").toString() + o.get("company").toString() + "充值" + outRechargeOrder.getOrderPrice() + "元"; remarks = o.get("province").toString() + o.get("company").toString() + "充值" + outRechargeOrder.getOrderPrice() + "元";
} else if (outRechargeOrder.getRechargeModel() == 2) { } else {
log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR);
}
} else if (outRechargeOrder.getRechargeModel() == 3 ) {
// 中石油需要姓名和身份证号 // 中石油需要姓名和身份证号
if (StringUtils.isBlank(outRechargeOrder.getRechargeName()) || if (StringUtils.isBlank(outRechargeOrder.getRechargeName()) ||
StringUtils.isBlank(outRechargeOrder.getIdCard()) StringUtils.isBlank(outRechargeOrder.getIdCard())
@ -82,18 +90,24 @@ public class OutRechargeOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
remarks = "中石化充值" + outRechargeOrder.getOrderPrice() + "元"; remarks = "中石化充值" + outRechargeOrder.getOrderPrice() + "元";
} else if (outRechargeOrder.getRechargeModel() == 3) { } else if (outRechargeOrder.getRechargeModel() == 2) {
remarks = "中石油充值" + outRechargeOrder.getOrderPrice() + "元"; remarks = "中石油充值" + outRechargeOrder.getOrderPrice() + "元";
} else {
log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
outRechargeOrder.setRemarks(remarks); outRechargeOrder.setRemarks(remarks);
outRechargeOrder.setOrderNo("CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5)); outRechargeOrder.setOrderNo("CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5));
outRechargeOrder.setUserId(userInfoModel.getHighUser().getId()); // outRechargeOrder.setUserId(userInfoModel.getHighUser().getId());
outRechargeOrder.setUserName(userInfoModel.getHighUser().getName()); // outRechargeOrder.setUserName(userInfoModel.getHighUser().getName());
outRechargeOrder.setUserPhone(userInfoModel.getHighUser().getPhone()); // outRechargeOrder.setUserPhone(userInfoModel.getHighUser().getPhone());
outRechargeOrder.setUserId(2L);
outRechargeOrder.setUserName("袁野");
outRechargeOrder.setUserPhone("18090580471");
outRechargeOrder.setCreateTimed(new Date()); outRechargeOrder.setCreateTimed(new Date());
outRechargeOrder.setStatus(1); outRechargeOrder.setStatus(1);
outRechargeOrderService.insertOrder(outRechargeOrder); outRechargeOrderService.insertOrder(outRechargeOrder);
return ResponseMsgUtil.success(outRechargeOrder.getId()); return ResponseMsgUtil.success(outRechargeOrder);
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController -> addOrder() error!",e); log.error("HighOrderController -> addOrder() error!",e);
@ -122,7 +136,16 @@ public class OutRechargeOrderController {
public ResponseData cancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) { public ResponseData cancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) {
try { try {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId);
if (outRechargeOrder.getStatus() == 1) {
outRechargeOrderService.cancelOrder(orderId); outRechargeOrderService.cancelOrder(orderId);
} else {
log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
}
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
@ -144,13 +167,18 @@ public class OutRechargeOrderController {
try { try {
// 用户 // 用户
SessionObject sessionObject = userCenter.getSessionObject(request); // SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); // HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
map.put("userId", userInfoModel.getHighUser().getId().toString()); // map.put("userId", userInfoModel.getHighUser().getId().toString());
map.put("userId", "2");
if (status != null) {
map.put("status", status.toString()); map.put("status", status.toString());
}
if (StringUtils.isNotBlank(orderNo)) {
map.put("orderNo", orderNo); map.put("orderNo", orderNo);
}
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getListRechargeOrder(map))); return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getListRechargeOrder(map)));

@ -48,19 +48,18 @@ public class OutRechargePriceController {
@ResponseBody @ResponseBody
@ApiOperation(value = "查询充值金额列表") @ApiOperation(value = "查询充值金额列表")
public ResponseData getListOutRechargePrice( public ResponseData getListOutRechargePrice(
@RequestParam(value = "type", required = false) String type @RequestParam(value = "type", required = false) Integer type
) { ) {
try { try {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
if (StringUtils.isNotBlank(type)) { if (type != null ) {
map.put("type", type); map.put("type", String.valueOf(type));
} }
return ResponseMsgUtil.success( outRechargePriceService.getListRechargePrice(map)); return ResponseMsgUtil.success( outRechargePriceService.getListRechargePrice(map));
} catch (Exception e) { } catch (Exception e) {
log.error("HighAgentController --> getListUser() error!", e); log.error("OutRechargePriceController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }

@ -9,8 +9,8 @@ debug: false
#datasource数据源设置 #datasource数据源设置
spring: spring:
datasource: datasource:
url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: hfkj username: root
password: HF123456. password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver

@ -26,7 +26,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
OutRechargeOrderExample.Criteria criteria = example.createCriteria(); OutRechargeOrderExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "userId") != null) { if (MapUtils.getLong(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "memId")); criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
} }
if (MapUtils.getInteger(map, "status") != null) { if (MapUtils.getInteger(map, "status") != null) {
@ -41,7 +41,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
criteria.andUserPhoneEqualTo(MapUtils.getString(map, "phone")); criteria.andUserPhoneEqualTo(MapUtils.getString(map, "phone"));
} }
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_timed desc");
return outRechargeOrderMapper.selectByExample(example); return outRechargeOrderMapper.selectByExample(example);
} }

@ -1,11 +1,9 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.hai.dao.OutRechargePriceMapper; import com.hai.dao.OutRechargePriceMapper;
import com.hai.entity.OutRechargePrice; import com.hai.entity.*;
import com.hai.entity.OutRechargePriceExample;
import com.hai.entity.OutRechargeUser;
import com.hai.entity.OutRechargeUserExample;
import com.hai.service.OutRechargePriceService; import com.hai.service.OutRechargePriceService;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -22,7 +20,12 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
@Override @Override
public List<OutRechargePrice> getListRechargePrice(Map<String , String> map) { public List<OutRechargePrice> getListRechargePrice(Map<String , String> map) {
OutRechargePriceExample example = new OutRechargePriceExample(); OutRechargePriceExample example = new OutRechargePriceExample();
example.createCriteria().andTypeEqualTo(Integer.valueOf(map.get("Type"))); OutRechargePriceExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(map.get("type"))) {
criteria.andTypeEqualTo(Integer.valueOf(map.get("type")));
}
return outRechargePriceMapper.selectByExample(example); return outRechargePriceMapper.selectByExample(example);
} }

Loading…
Cancel
Save