diff --git a/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/shstorehouse/ShStorehouseDto.java b/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/shstorehouse/ShStorehouseDto.java index 2f3f53d6..a21fa854 100644 --- a/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/shstorehouse/ShStorehouseDto.java +++ b/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/shstorehouse/ShStorehouseDto.java @@ -74,14 +74,14 @@ public class ShStorehouseDto implements Dto { private String countyCode; // 所属区县编码 @ApiModelProperty("所属区县名称") private String countyName; // 所属区县名称 - @ApiModelProperty("区域名称,不同级用逗号(,)分隔,如河北省,石家庄市,长安区") - private String regionName; // 区域名称,不同级用逗号(,)分隔,如河北省,石家庄市,长安区 +// @ApiModelProperty("区域名称,不同级用逗号(,)分隔,如河北省,石家庄市,长安区") +// private String regionName; // 区域名称,不同级用逗号(,)分隔,如河北省,石家庄市,长安区 @ApiModelProperty("详细地址") private String address; // 详细地址 @ApiModelProperty("库房面积") private String acreage; // 库房面积 - @ApiModelProperty("库房面积") - private String storeyHeight; // 库房面积 + @ApiModelProperty("库房高度") + private String storeyHeight; // 库房高度 @ApiModelProperty("月租金") private String monthlyPrice; // 月租金 @ApiModelProperty("库房性质编码组,多个性质以逗号(,)分隔") diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/WarehouseApplication.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/WarehouseApplication.java index 3d6cfe43..6066784d 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/WarehouseApplication.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/WarehouseApplication.java @@ -7,9 +7,13 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; @EnableDiscoveryClient -@SpringBootApplication -@EnableFeignClients +@EnableFeignClients(basePackages = {"com.wh.*"}) @MapperScan("com.wh.mapper") +@SpringBootApplication(scanBasePackages = { + "com.yxt.common.base.config", + "com.wh", + "com.wh.*" +}) public class WarehouseApplication { public static void main(String[] args) { SpringApplication.run(WarehouseApplication.class,args); diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/config/MybatisPlusConfig.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/config/MybatisPlusConfig.java index 03539bb3..116d0050 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/config/MybatisPlusConfig.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/config/MybatisPlusConfig.java @@ -43,7 +43,7 @@ import org.springframework.context.annotation.Configuration; * @version 1.0 * @since 1.0 */ -@Configuration +//@Configuration public class MybatisPlusConfig { /* * 分页插件,自动识别数据库类型 多租户,请参考官网【插件扩展】 diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/config/WebMvcConfig.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/config/WebMvcConfig.java new file mode 100644 index 00000000..4d50c786 --- /dev/null +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/config/WebMvcConfig.java @@ -0,0 +1,19 @@ +package com.wh.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + @Value("${yuan.file.root.path}") + public String fileRootPath; + + /** + * 资源映射:把请求的/archive/** 映射到该文件根路径 + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/archive/**").addResourceLocations("file:" + fileRootPath); + } +} diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/entinfo/EntInfoRest.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/entinfo/EntInfoRest.java index de8a46dd..6709a9bc 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/entinfo/EntInfoRest.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/entinfo/EntInfoRest.java @@ -25,6 +25,8 @@ *********************************************************/ package com.wh.controller.entinfo; +import com.wh.feign.enterpriseinformation.WhEnterpriseInformation; +import com.wh.feign.enterpriseinformation.WhEnterpriseInformationVo; import com.wh.pojo.entinfo.EntInfoDetailsVo; import com.wh.pojo.entinfo.EntInfoDto; import com.wh.pojo.entinfo.EntInfoQuery; @@ -68,6 +70,13 @@ public class EntInfoRest { PagerVo pv = entInfoService.listPageVo(pq); return rb.success().setData(pv); } + @ApiOperation("查询所有的企业信息") + @GetMapping("/listAll") + public ResultBean> listAll(){ + ResultBean rb = ResultBean.fireFail(); + List pv = entInfoService.listAll(); + return rb.success().setData(pv); + } @ApiOperation("新增或修改") @PostMapping("/save") diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/shstorehouse/ShStorehouseRest.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/shstorehouse/ShStorehouseRest.java index 55855fb6..69069a49 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/shstorehouse/ShStorehouseRest.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/shstorehouse/ShStorehouseRest.java @@ -25,10 +25,8 @@ *********************************************************/ package com.wh.controller.shstorehouse; -import com.wh.pojo.shstorehouse.ShStorehouseDetailsVo; -import com.wh.pojo.shstorehouse.ShStorehouseDto; -import com.wh.pojo.shstorehouse.ShStorehouseQuery; -import com.wh.pojo.shstorehouse.ShStorehouseVo; +import cn.hutool.core.lang.Assert; +import com.wh.pojo.shstorehouse.*; import com.wh.service.shstorehouse.ShStorehouseService; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; @@ -36,8 +34,12 @@ import com.yxt.common.core.vo.PagerVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; +import java.io.File; import java.util.List; /** @@ -88,7 +90,10 @@ public class ShStorehouseRest { @PostMapping("/delBySids") public ResultBean delBySids(@RequestBody String[] sids){ ResultBean rb = ResultBean.fireFail(); - shStorehouseService.delBySids(sids); + int i = shStorehouseService.delBySids(sids); + if(i==0){ + return rb; + } return rb.success(); } @@ -97,6 +102,45 @@ public class ShStorehouseRest { public ResultBean fetchDetailsBySid(@PathVariable("sid") String sid){ ResultBean rb = ResultBean.fireFail(); ShStorehouseDetailsVo vo = shStorehouseService.fetchDetailsVoBySid(sid); + if(vo==null) + return rb.setMsg("没有查询到数据"); return rb.success().setData(vo); } +// @ApiOperation(value = "上传附件") +// @ResponseBody +// @PostMapping("/uploadFile") +// public ResultBean updateHeadImage(@RequestParam("file")MultipartFile multipartFile) { +// if (multipartFile.isEmpty()) { +// return new ResultBean().fail().setMsg("上传附件不能为空"); +// } +// +// return shStorehouseService.updateFile(multipartFile); +// +// } + @Value("${yuan.file.root.path}") + public String fileRootPath; + @ApiOperation("文件上传") + @PostMapping("/upload") + public ResultBean upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) { + String filePath = ""; // 文件保存的位置 + String urlPath = "";// 文件web浏览路径 + Assert.isTrue(!file.isEmpty(), "文件为空"); + // 原始名 以 a.jpg为例 + String originalFilename = file.getOriginalFilename(); + // 获取后缀并拼接'/'用于分类,也可以用日期 例: suffix = "jpg/" + String suffix = originalFilename.substring(originalFilename.lastIndexOf(".") + 1) + "/"; + // 加上时间戳生成新的文件名,防止重复 newFileName = "1595511980146a.jpg" + String newFileName = System.currentTimeMillis() + originalFilename; + filePath = fileRootPath+ suffix + newFileName; + System.out.println(filePath); + try { + File file1 = new File(filePath); + if (!file1.exists()) file1.mkdirs(); // 要是目录不存在,创建一个 + file.transferTo(file1); // 保存起来 + urlPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/archive/" + suffix + newFileName; + } catch (Exception e) { + e.printStackTrace(); + } + return ResultBean.fireSuccess().setData(urlPath); + } } diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/shstorehouse/ShStorehouseMapper.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/shstorehouse/ShStorehouseMapper.java index 1f11aeec..d77bfb47 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/shstorehouse/ShStorehouseMapper.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/mapper/shstorehouse/ShStorehouseMapper.java @@ -34,6 +34,7 @@ import com.wh.pojo.shstorehouse.ShStorehouseVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; import java.util.List; @@ -62,4 +63,7 @@ public interface ShStorehouseMapper extends BaseMapper { @Select("select * from sh_storehouse") List selectListVo(); + + @Update("update sh_storehouse set picurl=#{url} where sid=#{sid} ") + int updatePicUrl(@Param("sid")String sid,@Param("url") String url); } \ No newline at end of file diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/entinfo/EntInfoService.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/entinfo/EntInfoService.java index f56f4fd6..0fc85d76 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/entinfo/EntInfoService.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/entinfo/EntInfoService.java @@ -28,16 +28,23 @@ package com.wh.service.entinfo; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.wh.feign.enterpriseinformation.WhEnterpriseInformation; +import com.wh.feign.enterpriseinformation.WhEnterpriseInformationFeign; +import com.wh.feign.enterpriseinformation.WhEnterpriseInformationQuery; +import com.wh.feign.enterpriseinformation.WhEnterpriseInformationVo; import com.wh.mapper.entinfo.EntInfoMapper; import com.wh.pojo.entinfo.*; import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; import org.apache.commons.lang3.StringUtils; import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.utils.PagerUtil; +import org.springframework.cloud.openfeign.FeignClient; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.List; /** @@ -55,6 +62,9 @@ import java.util.List; */ @Service public class EntInfoService extends MybatisBaseService { + @Resource + private WhEnterpriseInformationFeign enterpriseInformationFeign; + private QueryWrapper createQueryWrapper(EntInfoQuery query) { // todo: 这里根据具体业务调整查询条件 // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); @@ -102,4 +112,12 @@ public class EntInfoService extends MybatisBaseService { BeanUtil.copyProperties(entity, vo); return vo; } + + public List listAll() { + PagerQuery pq=new PagerQuery<>(); + pq.setSize(10000); + ResultBean> pagerVoResultBean = + enterpriseInformationFeign.listPage(pq); + return pagerVoResultBean.getData().getRecords(); + } } \ No newline at end of file diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/shstorehouse/ShStorehouseService.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/shstorehouse/ShStorehouseService.java index 4c94d058..15e0cba8 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/shstorehouse/ShStorehouseService.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/shstorehouse/ShStorehouseService.java @@ -30,6 +30,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.wh.mapper.shstorehouse.ShStorehouseMapper; import com.wh.pojo.shstorehouse.*; +import com.yxt.common.base.config.component.FileUploadComponent; +import com.yxt.common.base.config.component.ImageUploadUtil; +import com.yxt.common.core.result.FileUploadResult; import org.apache.commons.lang3.StringUtils; import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.utils.PagerUtil; @@ -37,9 +40,14 @@ import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import java.io.File; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * Project: yxt_supervise(宇信通监管)
@@ -56,6 +64,8 @@ import java.util.List; */ @Service public class ShStorehouseService extends MybatisBaseService { + @Autowired + private FileUploadComponent fileUploadComponent; private QueryWrapper createQueryWrapper(ShStorehouseQuery query) { // todo: 这里根据具体业务调整查询条件 // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); @@ -97,6 +107,11 @@ public class ShStorehouseService extends MybatisBaseService fub = fileUploadComponent.uploadFile(file, "shstorehouse"); + if(!fub.getSuccess()){ + return fub; + } + return new ResultBean().success().setData(fub); + } } \ No newline at end of file diff --git a/warehousing-system/project/wh-manage/src/main/resources/application-devv.yml b/warehousing-system/project/wh-manage/src/main/resources/application-devv.yml index 4129ae05..4a4292aa 100644 --- a/warehousing-system/project/wh-manage/src/main/resources/application-devv.yml +++ b/warehousing-system/project/wh-manage/src/main/resources/application-devv.yml @@ -5,6 +5,11 @@ spring: nacos: discovery: server-addr: 127.0.0.1:8848 + datasource: + url: jdbc:mysql://127.0.0.1:3306/warehouse2?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true + username: root + #password: 1LAiGz$t1*Iw + password: root redis: database: 3 # Redis数据库索引(默认为0) host: 127.0.0.1 @@ -14,6 +19,6 @@ spring: max-idle: 8 #连接池中的最大空闲连接 max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) min-idle: 0 # 连接池中的最小空闲连接 - password: + password: 123456 port: 6379 - timeout: 0 # 连接超时时间(毫秒) \ No newline at end of file + timeout: 0 # 连接超时时间(毫秒) \ No newline at end of file diff --git a/warehousing-system/project/wh-manage/src/main/resources/application-pro.yml b/warehousing-system/project/wh-manage/src/main/resources/application-pro.yml index 062731af..6c9039d5 100644 --- a/warehousing-system/project/wh-manage/src/main/resources/application-pro.yml +++ b/warehousing-system/project/wh-manage/src/main/resources/application-pro.yml @@ -5,6 +5,12 @@ spring: nacos: discovery: server-addr: 127.0.0.1:8848 + datasource: + url: jdbc:mysql://127.0.0.1:3306/warehouse2?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true + username: root + password: 1LAiGz$t1*Iw + #password: root + redis: database: 3 # Redis数据库索引(默认为0) host: 127.0.0.1 diff --git a/warehousing-system/project/wh-manage/src/main/resources/application.yml b/warehousing-system/project/wh-manage/src/main/resources/application.yml index e12c1933..d464ae3d 100644 --- a/warehousing-system/project/wh-manage/src/main/resources/application.yml +++ b/warehousing-system/project/wh-manage/src/main/resources/application.yml @@ -6,24 +6,48 @@ spring: application: name: supervise-wm profiles: - # active: dev + #active: devv active: pro - datasource: - url: jdbc:mysql://127.0.0.1:3306/warehouse2?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true - username: root - password: 1LAiGz$t1*Iw - #password: root + messages: + basename: i18n/messages #mybatis-plush配置 mybatis-plus: type-aliases-package: com.wh.pojo mapper-locations: classpath:/mappers/*.xml - configuration: - map-underscore-to-camel-case: true global-config: + refresh: true db-config: - id-type: auto - + id-type: 0 + db-type: mysql + configuration: + map-underscore-to-camel-case: false + cache-enabled: true + call-setters-on-nulls: true + mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #mybatis-plus配置控制台打印完整带参数SQL语句log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #mybatis-plus配置控制台打印完整带参数SQL语句 + mybatis: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +yuan: + file: + root: + path: D:\image\ logging: level: - com.jt.mapper: debug + main: + blog: + mapper: debug + com: + baomidou: + mybatisplus: DEBUG + #项目mapper目录 + dragonsoft: + demojar: + mapper: DEBUG + org: + springframework: + boot: + autoconfigure: + logging: info \ No newline at end of file diff --git a/warehousing-system/project/wh-manage/src/main/resources/logback-spring.xml b/warehousing-system/project/wh-manage/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..eccab97c --- /dev/null +++ b/warehousing-system/project/wh-manage/src/main/resources/logback-spring.xml @@ -0,0 +1,37 @@ + + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + ${log.base}.log + + ${log.base}.%d{yyyyMMdd}.%i.log.zip + + + + 1MB + + + + %date [%thread] %-5level %logger{35} - %msg%n + + + + + + + + + + \ No newline at end of file