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 -