|
|
@@ -0,0 +1,84 @@
|
|
|
+package org.dromara.server.base.service.yktOperation;
|
|
|
+
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
+import org.dromara.backstage.api.RemotePtAreaService;
|
|
|
+import org.dromara.backstage.api.RemoteXfDiscountService;
|
|
|
+import org.dromara.backstage.api.domain.bo.RemotePtAreaBo;
|
|
|
+import org.dromara.backstage.api.domain.bo.RemoteXfDiscountBo;
|
|
|
+import org.dromara.backstage.api.domain.bo.RemoteXfDiscountTermBo;
|
|
|
+import org.dromara.common.core.exception.ServiceException;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 消费折扣同步
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class SyncRemoteXfDiscountService {
|
|
|
+
|
|
|
+ @DubboReference
|
|
|
+ private final RemoteXfDiscountService xfDiscountService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 远程调用消费折扣新增
|
|
|
+ * @param msg
|
|
|
+ */
|
|
|
+ public void addXfDiscount(Object msg) throws Exception{
|
|
|
+ boolean flag = xfDiscountService.insertByBo(JSONUtil.parseObj(msg).toBean(RemoteXfDiscountBo.class));
|
|
|
+ if (!flag){
|
|
|
+ throw new ServiceException("消费折扣新增失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 远程调用消费折扣修改
|
|
|
+ * @param msg
|
|
|
+ */
|
|
|
+ public void editXfDiscount(Object msg) throws Exception{
|
|
|
+ boolean flag = xfDiscountService.updateByBo(JSONUtil.parseObj(msg).toBean(RemoteXfDiscountBo.class));
|
|
|
+ if (!flag){
|
|
|
+ throw new ServiceException("消费折扣修改失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 远程调用消费折扣删除
|
|
|
+ * @param msg
|
|
|
+ */
|
|
|
+ public void delXfDiscount(Object msg) throws Exception{
|
|
|
+ Collection<Long> ids = JSONUtil.parseArray(msg).toBean(Collection.class);
|
|
|
+ boolean flag = xfDiscountService.deleteWithValidByIds(ids,false);
|
|
|
+ if (!flag){
|
|
|
+ throw new ServiceException("消费折扣删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 远程调用消费折扣设备新增
|
|
|
+ * @param msg
|
|
|
+ * @throws ServiceException
|
|
|
+ */
|
|
|
+ public void addDiscountTerm(Object msg) throws ServiceException{
|
|
|
+ boolean flag = xfDiscountService.addDiscountTerm(JSONUtil.parseArray(msg).toList(Long.class));
|
|
|
+ if (!flag){
|
|
|
+ throw new ServiceException("新增折扣设备失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 远程调用消费折扣设备删除
|
|
|
+ * @param msg
|
|
|
+ * @throws ServiceException
|
|
|
+ */
|
|
|
+ public void deleteDiscountTerm(Object msg) throws ServiceException{
|
|
|
+ boolean flag = xfDiscountService.deleteDiscountTerm(JSONUtil.parseArray(msg).toList(Long.class));
|
|
|
+ if (!flag){
|
|
|
+ throw new ServiceException("删除折扣设备失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|