From 7bb5caaf5d41e0794e274af4ceb5fd18fb71ed11 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 14 Jun 2023 16:57:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9F=A5=E8=AF=A2=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E5=92=8C=E7=A7=AF=E5=88=86=E8=BF=94=E5=88=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/BsStoreCidController.java | 92 ++++++++++++++++++ .../com/cweb/controller/TestController.java | 14 +-- cweb/src/main/resources/dev/logback.xml | 24 +++++ service/pom.xml | 5 - .../com/hfkj/service/BsStoreCidService.java | 55 +++++++++++ .../service/impl/BsStoreCidServiceImpl.java | 96 +++++++++++++++++++ .../java/com/hfkj/tts/HWYunSisService.java | 38 ++++++-- .../java/com/hfkj/unipush/UniPushService.java | 12 ++- .../resources/dev/commonConfig.properties | 3 +- 9 files changed, 315 insertions(+), 24 deletions(-) create mode 100644 cweb/src/main/java/com/cweb/controller/BsStoreCidController.java create mode 100644 service/src/main/java/com/hfkj/service/BsStoreCidService.java create mode 100644 service/src/main/java/com/hfkj/service/impl/BsStoreCidServiceImpl.java diff --git a/cweb/src/main/java/com/cweb/controller/BsStoreCidController.java b/cweb/src/main/java/com/cweb/controller/BsStoreCidController.java new file mode 100644 index 0000000..48fe2af --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/BsStoreCidController.java @@ -0,0 +1,92 @@ +package com.cweb.controller; + +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.entity.BsStore; +import com.hfkj.entity.BsStoreCid; +import com.hfkj.model.ResponseData; +import com.hfkj.service.BsStoreCidService; +import com.hfkj.service.BsStoreService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * @author sum1dream + */ +@Controller +@RequestMapping(value = "/storeCid") +@Api(value = "门店CID") +public class BsStoreCidController { + + private static Logger log = LoggerFactory.getLogger(BsStoreCidController.class); + + @Resource + private BsStoreCidService bsStoreCidService; + + @Resource + private BsStoreService bsStoreService; + + @RequestMapping(value="/connectStoreCid",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "连接门店和CID") + public ResponseData connectStoreCid(@RequestBody BsStoreCid storeCid) { + try { + + if (storeCid == null + || storeCid.getCid() == null + || storeCid.getStoreId() == null + ) { + log.error("configStore error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + + BsStore store = bsStoreService.getStoreById(storeCid.getStoreId()); + + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前门店不存在!"); + } + + Map map = new HashMap<>(); + map.put("storeId" , storeCid.getStoreId()); + + BsStoreCid bsStoreCid = bsStoreCidService.findByMap(map); + + if (bsStoreCid == null) { + bsStoreCid = new BsStoreCid(); + bsStoreCid.setCid(storeCid.getCid()); + bsStoreCid.setStoreId(store.getId()); + bsStoreCid.setStoreNo(store.getStoreNo()); + bsStoreCid.setStoreName(store.getName()); + bsStoreCid.setCreateTime(new Date()); + bsStoreCid.setUpdateTime(new Date()); + bsStoreCidService.insertStoreCid(bsStoreCid); + } else { + bsStoreCid.setCid(storeCid.getCid()); + bsStoreCid.setUpdateTime(new Date()); + bsStoreCidService.editStoreCid(bsStoreCid); + } + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/cweb/src/main/java/com/cweb/controller/TestController.java b/cweb/src/main/java/com/cweb/controller/TestController.java index ac5c6b3..88136e3 100644 --- a/cweb/src/main/java/com/cweb/controller/TestController.java +++ b/cweb/src/main/java/com/cweb/controller/TestController.java @@ -28,7 +28,6 @@ import com.hfkj.sysenum.PlatformTypeEnum; import com.hfkj.sysenum.StoreCreateTypeEnum; import com.hfkj.sysenum.StoreStatusEnum; import com.hfkj.tts.HWYunSisService; -import com.hfkj.unipush.UniPushService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; @@ -96,6 +95,9 @@ public class TestController { @Resource private LaKaLaWalletService laKaLaWalletService; + @Resource + private BsStoreCidService bsStoreCidService; + @RequestMapping(value="/refreshMerStatus",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "refreshMerStatus") @@ -640,7 +642,6 @@ public class TestController { try { JSONObject object = new JSONObject(); - object.put("storeName" , "YCY酒吧"); object.put("price" , "374.87"); return ResponseMsgUtil.success(HWYunSisService.ttsCustomDemo(object)); @@ -661,12 +662,11 @@ public class TestController { JSONObject object = new JSONObject(); - object.put("cid" , cid); - object.put("title" , "测试测试"); - object.put("body" , "惠支付收款88.8元"); - + object.put("storeId" , 136); + object.put("price" , "283.82"); + bsStoreCidService.storePush(object); - return ResponseMsgUtil.success(UniPushService.pushToSingleByCid(object)); + return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error(e.getMessage(), e); diff --git a/cweb/src/main/resources/dev/logback.xml b/cweb/src/main/resources/dev/logback.xml index 6011524..1e005b3 100644 --- a/cweb/src/main/resources/dev/logback.xml +++ b/cweb/src/main/resources/dev/logback.xml @@ -112,4 +112,28 @@ + + log/PushLog.log + + log/PushLog/PushLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + + + diff --git a/service/pom.xml b/service/pom.xml index da8a506..395fc6e 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -383,11 +383,6 @@ restful-sdk 1.0.0.13 - - cn.jpush.api - jpush-client - 3.2.17 -