diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java index 6f5954e6..1812b394 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java @@ -10,6 +10,7 @@ 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.entity.SecUser; import com.hai.model.HighAgentModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; @@ -19,6 +20,7 @@ import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -126,4 +128,34 @@ public class OutRechargePriceController { } } + @RequestMapping(value = "/findById", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询详情") + public ResponseData findById(@RequestParam(value = "id", required = true) Long id) { + try { + + OutRechargePrice outRechargePrice = outRechargePriceService.findById(id); + return ResponseMsgUtil.success(outRechargePrice); + + } catch (Exception e) { + log.error("HighUserController --> findByUserId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/deletePrice", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "删除") + public ResponseData deletePrice(@RequestParam(value = "id", required = true) Long id) { + try { + + outRechargePriceService.deletePrice(id); + return ResponseMsgUtil.success("删除成功"); + + } catch (Exception e) { + log.error("HighUserController --> findByUserId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java index c36d2c70..7df53c1a 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java @@ -73,7 +73,7 @@ public class OutRechargeOrderController { // 判断充值模式:1 话费充值 2. 中石化 3. 中石油 if (outRechargeOrder.getRechargeModel() == 1) { JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent()); - if (telObject.get("status") == "0") { + if (telObject.get("status").equals(0)) { JSONObject o = telObject.getObject("result",JSONObject.class); // 拼接内容 remarks = o.get("province").toString() + o.get("company").toString() + "充值" + outRechargeOrder.getOrderPrice() + "元"; @@ -81,6 +81,8 @@ public class OutRechargeOrderController { log.error("orderToPay error!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR); } + } else if (outRechargeOrder.getRechargeModel() == 2) { + remarks = "中石化充值" + outRechargeOrder.getOrderPrice() + "元"; } else if (outRechargeOrder.getRechargeModel() == 3 ) { // 中石油需要姓名和身份证号 if (StringUtils.isBlank(outRechargeOrder.getRechargeName()) || @@ -89,8 +91,6 @@ public class OutRechargeOrderController { log.error("orderToPay error!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - remarks = "中石化充值" + outRechargeOrder.getOrderPrice() + "元"; - } else if (outRechargeOrder.getRechargeModel() == 2) { remarks = "中石油充值" + outRechargeOrder.getOrderPrice() + "元"; } else { log.error("orderToPay error!"); @@ -145,8 +145,6 @@ public class OutRechargeOrderController { throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); } - - return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { @@ -161,6 +159,7 @@ public class OutRechargeOrderController { public ResponseData getUserOrderList( @RequestParam(name = "status", required = false) Integer status, @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "rechargeModel", required = false) String rechargeModel, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { @@ -179,6 +178,9 @@ public class OutRechargeOrderController { if (StringUtils.isNotBlank(orderNo)) { map.put("orderNo", orderNo); } + if (StringUtils.isNotBlank(rechargeModel)) { + map.put("rechargeModel", rechargeModel); + } PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getListRechargeOrder(map))); diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java index a0a79cc7..d38e268a 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java @@ -69,7 +69,7 @@ public class OutRechargeOrder implements Serializable { private String paySerialNo; /** - * 订单状态 : 1.待支付 2.已支付 3.已完成 4.已退款 5.已取消 + * 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 */ private Integer status; diff --git a/hai-service/src/main/java/com/hai/service/OutRechargePriceService.java b/hai-service/src/main/java/com/hai/service/OutRechargePriceService.java index ed93faf0..e5730496 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargePriceService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargePriceService.java @@ -42,4 +42,13 @@ public interface OutRechargePriceService { * @return void **/ void updateRechargePrice(OutRechargePrice outRechargePrice); + + /** + * @Author Sum1Dream + * @Description //删除 Administrator + * @Date 17:31 2021/6/13 + * @Param [id] + * @return void + **/ + void deletePrice(Long id); } diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index fd6872cf..5c1fd3f1 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -41,6 +41,10 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { criteria.andUserPhoneEqualTo(MapUtils.getString(map, "phone")); } + if (MapUtils.getString(map, "rechargeModel") != null) { + criteria.andRechargeModelEqualTo(Integer.valueOf(MapUtils.getString(map, "rechargeModel"))); + } + example.setOrderByClause("create_timed desc"); return outRechargeOrderMapper.selectByExample(example); } @@ -74,7 +78,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { public void cancelOrder(Long orderId) { OutRechargeOrder order = findByOrderId(orderId); if (order != null) { - order.setStatus(5); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 + order.setStatus(4); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 order.setCancelTime(new Date()); updateOrder(order); } diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java index 1ea3d56d..b1fd906d 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java @@ -26,12 +26,13 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService { criteria.andTypeEqualTo(Integer.valueOf(map.get("type"))); } + example.setOrderByClause("create_time desc"); return outRechargePriceMapper.selectByExample(example); } @Override public OutRechargePrice findById(Long id) { - return null; + return outRechargePriceMapper.selectByPrimaryKey(id); } @Override @@ -43,4 +44,9 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService { public void updateRechargePrice(OutRechargePrice outRechargePrice) { outRechargePriceMapper.updateByPrimaryKey(outRechargePrice); } + + @Override + public void deletePrice(Long id) { + outRechargePriceMapper.deleteByPrimaryKey(id); + } }