diff --git a/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java b/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java index b287ed2f..3d17648c 100644 --- a/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java +++ b/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java @@ -1,16 +1,31 @@ package cn.iocoder.yudao.server; +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.system.ApplicationHome; + +import java.io.File; @SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package} @SpringBootApplication(scanBasePackages = { "${yudao.info.base-package}.server", "${yudao.info.base-package}.module", "co.yixiang", "com.zsw.erp" }) +@EnableDubbo public class YudaoServerApplication { public static void main(String[] args) { + + ApplicationHome home = new ApplicationHome(YudaoServerApplication.class); + File jarFile = home.getSource(); + String dirPath = jarFile.getParentFile().toString(); + String filePath = dirPath + File.separator + ".dubbo"; + System.out.println(filePath); + + System.setProperty("dubbo.meta.cache.filePath", filePath); + System.setProperty("dubbo.mapping.cache.filePath",filePath); + SpringApplication.run(YudaoServerApplication.class, args); } diff --git a/yudao-server/src/main/resources/application-dev.yaml b/yudao-server/src/main/resources/application-dev.yaml index 38c8214a..c9e7009d 100644 --- a/yudao-server/src/main/resources/application-dev.yaml +++ b/yudao-server/src/main/resources/application-dev.yaml @@ -203,3 +203,15 @@ justauth: type: REDIS prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 + +dubbo: + registry: + id: zsw-farm + address: 192.168.10.250:8848 + protocol: nacos + username: nacos + password: nacos + + application: + name: zsw-farm + diff --git a/zsw-farm/zsw-farm-api/src/main/java/dubbo/dto/BasMaterial.java b/zsw-farm/zsw-farm-api/src/main/java/dubbo/dto/BasMaterial.java new file mode 100644 index 00000000..404805cc --- /dev/null +++ b/zsw-farm/zsw-farm-api/src/main/java/dubbo/dto/BasMaterial.java @@ -0,0 +1,70 @@ +package dubbo.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @Description: 物料 + * @Author: jeecg-boot + * @Date: 2020-05-29 + * @Version: V1.0 + */ +@Data +@TableName("bas_material") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class BasMaterial implements Serializable { + private static final long serialVersionUID = 1L; + + /**ID*/ + @TableId(type = IdType.ASSIGN_ID) + private String id; + /**编码*/ + private String code; + /**名称*/ + private String name; + /**分类*/ + private String categoryId; + /**是否启用*/ + private Integer isEnabled; + /**规格型号*/ + private String model; + /**计量单位*/ + private String unitId; + + private BigDecimal stockAlarm; + + private Integer validity; + + /**销售价格*/ + private BigDecimal salePrice; + /**税控编码*/ + private String taxCode; + /**备注*/ + private String remark; + /**创建人*/ + private String createBy; + /**创建时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + private Date createTime; + /**修改人*/ + private String updateBy; + /**修改时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + private Date updateTime; + /**版本*/ + private Integer version; + + +} diff --git a/zsw-farm/zsw-farm-api/src/main/java/dubbo/service/OpenErpService.java b/zsw-farm/zsw-farm-api/src/main/java/dubbo/service/OpenErpService.java new file mode 100644 index 00000000..eb864bb1 --- /dev/null +++ b/zsw-farm/zsw-farm-api/src/main/java/dubbo/service/OpenErpService.java @@ -0,0 +1,13 @@ +package dubbo.service; + +import dubbo.dto.BasMaterial; + +import java.util.List; + +public interface OpenErpService { + + // 把实现方法写在这里 + String hello(); + + List list(); +} diff --git a/zsw-farm/zsw-farm-impl/pom.xml b/zsw-farm/zsw-farm-impl/pom.xml index 86dddb78..7014bc76 100644 --- a/zsw-farm/zsw-farm-impl/pom.xml +++ b/zsw-farm/zsw-farm-impl/pom.xml @@ -66,6 +66,20 @@ compile + + + org.apache.dubbo + dubbo-spring-boot-starter + 3.0.9 + + + + + com.alibaba.nacos + nacos-client + 2.1.0 + + \ No newline at end of file diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java index 810b39b2..7945927a 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java @@ -38,6 +38,9 @@ import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; import cn.iocoder.yudao.module.system.service.CpUser.CpUserService; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.zsw.base.R; +import dubbo.service.OpenErpService; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboReference; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -55,6 +58,7 @@ import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*; */ @Service @Validated +@Slf4j public class DiscussServiceImpl implements DiscussService { @Resource @@ -78,6 +82,9 @@ public class DiscussServiceImpl implements DiscussService { @Resource private TaskCateMapper taskCateMapper; + @DubboReference + private OpenErpService openErpService; + @Override public Long createDiscuss(DiscussCreateReqVO createReqVO) { //只有所属任务进行中才可以添加活动 @@ -279,6 +286,8 @@ public class DiscussServiceImpl implements DiscussService { cropRecordMapper.insert(cropRecordDO); //todo 调用ERP出入库接口 + String hello = openErpService.hello(); + log.error("hello:{}",hello); } }