From fbb87cea4990412371219d4edb0fed1f6bd39597 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 27 Oct 2021 20:37:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=9D=E8=B4=B9=E5=85=85?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OutRechargePriceController.java | 32 +++++++++++++++++-- .../bweb/controller/SecUserController.java | 4 +-- .../OutRechargeOrderController.java | 30 ++++------------- .../OutRechargePriceController.java | 2 +- .../java/com/hai/entity/OutRechargeOrder.java | 4 +-- .../hai/service/OutRechargePriceService.java | 9 ++++++ .../impl/OutRechargePriceServiceImpl.java | 15 ++++++++- .../pay/impl/RechargeOrderServiceImpl.java | 4 +-- 8 files changed, 66 insertions(+), 34 deletions(-) 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 2aa1cdfb..4ca13df9 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java @@ -72,7 +72,8 @@ public class OutRechargePriceController { if (outRechargePrice.getType() == null || outRechargePrice.getPrice() == null || outRechargePrice.getRealPrice() == null - || outRechargePrice.getGoodsId() == null +// || outRechargePrice.getGoodsId() == null + || outRechargePrice.getSort() == null ) { log.error("SecOrganizationController -> insertPrice() error!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -80,6 +81,7 @@ public class OutRechargePriceController { outRechargePrice.setCreateTime(new Date()); + outRechargePrice.setStatus(0); outRechargePriceService.insertRechargePrice(outRechargePrice); @@ -100,7 +102,8 @@ public class OutRechargePriceController { || outRechargePrice.getId() == null || outRechargePrice.getPrice() == null || outRechargePrice.getRealPrice() == null - || outRechargePrice.getGoodsId() == null +// || outRechargePrice.getGoodsId() == null + || outRechargePrice.getSort() == null ) { log.error("SecOrganizationController -> updatePrice() error!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -113,6 +116,7 @@ public class OutRechargePriceController { throw ErrorHelp.genException(SysCode.System, ErrorCode.UPDATE_DATA_ERROR, ""); } + outRechargePrice.setStatus(0); outRechargePrice.setCreateTime(outRechargePrice1.getCreateTime()); outRechargePriceService.updateRechargePrice(outRechargePrice); @@ -155,4 +159,28 @@ public class OutRechargePriceController { } } + @RequestMapping(value = "/onAndOffShelves", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "上下架") + public ResponseData onAndOffShelves(@RequestParam(value = "id", required = true) Long id) { + try { + + OutRechargePrice outRechargePrice = outRechargePriceService.findById(id); + + if (outRechargePrice.getStatus() == 1) { + outRechargePrice.setStatus(0); + } else { + outRechargePrice.setStatus(1); + } + + outRechargePriceService.updateRechargePrice(outRechargePrice); + + return ResponseMsgUtil.success("修改成功"); + + } catch (Exception e) { + log.error("HighUserController --> findByUserId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java b/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java index fdff6fe2..6ed33adb 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java @@ -123,7 +123,6 @@ public class SecUserController { || StringUtils.isBlank(secUser.getUserName()) || StringUtils.isBlank(secUser.getPassword()) || StringUtils.isBlank(secUser.getLoginName()) - || StringUtils.isBlank(secUser.getTelephone()) || secUser.getRoleId() == null ) { log.error("SecUserController --> addUser() error!", "参数错误"); @@ -164,8 +163,7 @@ public class SecUserController { || secUser.getOrganizationId() == null || StringUtils.isBlank(secUser.getUserName()) || StringUtils.isBlank(secUser.getPassword()) - || StringUtils.isBlank(secUser.getLoginName()) - || StringUtils.isBlank(secUser.getTelephone())) { + || StringUtils.isBlank(secUser.getLoginName())) { log.error("SecUserController --> editUser() error!", "参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } 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 4d57d4e5..d20c2b11 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java @@ -106,31 +106,15 @@ public class OutRechargeOrderController { String remarks = ""; // 支付类型 1.微信支付 outRechargeOrder.setPayType(1); - // 判断充值模式:1 话费充值 2. 中石化 3. 中石油 - if (outRechargeOrder.getRechargeModel() == 1) { - JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent()); - if (telObject.get("status").equals(0)) { - JSONObject o = telObject.getObject("result",JSONObject.class); - // 拼接内容 - remarks = o.get("province").toString() + o.get("company").toString() + "充值" + outRechargeOrder.getOrderPrice() + "元"; - } else { - 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()) || - StringUtils.isBlank(outRechargeOrder.getIdCard()) - ) { - log.error("orderToPay error!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - remarks = "中石油充值" + outRechargeOrder.getOrderPrice() + "元"; + // 判断充值模式:1 电信 2. 移动 3. 联通 + JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent()); + if (telObject.get("status").equals(0)) { + JSONObject o = telObject.getObject("result",JSONObject.class); + // 拼接内容 + remarks = o.get("province").toString() + o.get("company").toString() + "充值" + outRechargeOrder.getOrderPrice() + "元"; } else { log.error("orderToPay error!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR); } outRechargeOrder.setRemarks(remarks); outRechargeOrder.setOrderNo("CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5)); diff --git a/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java b/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java index 12bd0450..d4948efa 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java @@ -57,7 +57,7 @@ public class OutRechargePriceController { map.put("type", String.valueOf(type)); } - return ResponseMsgUtil.success( outRechargePriceService.getListRechargePrice(map)); + return ResponseMsgUtil.success( outRechargePriceService.getListRechargePriceC(map)); } catch (Exception e) { log.error("OutRechargePriceController --> getListUser() error!", e); return ResponseMsgUtil.exception(e); 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 a00939eb..b89fa2f8 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java @@ -40,7 +40,7 @@ public class OutRechargeOrder implements Serializable { private String userPhone; /** - * 充值模式:1 话费充值 2. 中石化 3. 中石油 + * 充值模式:1 电信 2. 移动 3. 联通 */ private Integer rechargeModel; @@ -463,4 +463,4 @@ public class OutRechargeOrder implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} 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 e5730496..447e211d 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargePriceService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargePriceService.java @@ -16,6 +16,15 @@ public interface OutRechargePriceService { **/ List getListRechargePrice(Map map); + /** + * @Author Sum1Dream + * @Description //c端查询列表 Administrator + * @Date 17:38 2021/6/12 + * @Param [map] + * @return java.util.List + **/ + List getListRechargePriceC(Map map); + /** * @Author Sum1Dream * @Description //查询详情 Administrator 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 b1fd906d..0eb45c6a 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,9 +26,22 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService { criteria.andTypeEqualTo(Integer.valueOf(map.get("type"))); } - example.setOrderByClause("create_time desc"); + example.setOrderByClause("type asc"); return outRechargePriceMapper.selectByExample(example); } + @Override + public List getListRechargePriceC(Map map) { + OutRechargePriceExample example = new OutRechargePriceExample(); + OutRechargePriceExample.Criteria criteria = example.createCriteria(); + + if (StringUtils.isNotBlank(map.get("type"))) { + criteria.andTypeEqualTo(Integer.valueOf(map.get("type"))); + } + + example.setOrderByClause("sort asc"); + return outRechargePriceMapper.selectByExample(example); + } + @Override public OutRechargePrice findById(Long id) { diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java index a21806c9..3df47705 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java @@ -83,8 +83,8 @@ public class RechargeOrderServiceImpl implements PayService { Map mapOrder = new HashMap<>(); mapOrder.put("cardPhone", order.getRechargeContent()); - mapOrder.put("channel", outRechargePrice.getChannel()); - mapOrder.put("goodsId", outRechargePrice.getGoodsId()); +// mapOrder.put("channel", outRechargePrice.getChannel()); +// mapOrder.put("goodsId", outRechargePrice.getGoodsId()); mapOrder.put("orderAmount", order.getOrderPrice()); mapOrder.put("orderNumber", order.getOrderNo()); mapOrder.put("callbackUrl", CommonSysConst.getSysConfig().getCzOrderNotify());