Browse Source

菜品分类,url配置

he.dujuan 3 years ago
parent
commit
7015f7ce46

+ 7 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodCate/domain/DmFoodCate.java

@@ -41,10 +41,16 @@ import java.util.Objects;
 public class DmFoodCate extends BaseEntity implements Serializable {
 
     @Id
-    @Column(name = "cate_id")
+    @Column(name = "id")
     @ApiModelProperty(value = "id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Integer id;
 
+
+    @Column(name = "cate_id")
+    @ApiModelProperty(value = "分类id")
+    private Integer cateId;
+
     @Column(name = "pid")
     @ApiModelProperty(value = "上级菜单ID")
     private Integer pid;

+ 6 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodCate/repository/DmFoodCateRepository.java

@@ -62,6 +62,12 @@ public interface DmFoodCateRepository extends JpaRepository<DmFoodCate, Integer>
      */
     List<DmFoodCate> findByPid(Integer pid);
 
+    @Query(value = "SELECT * FROM dm_food_cate WHERE pid = ?1",nativeQuery = true)//(SELECT cate_id FROM dm_food_cate WHERE id = ?1)
+    List<DmFoodCate> findByPidUpdate(Integer cateId);
+
+    @Query(value = "SELECT * FROM dm_food_cate WHERE cate_id = ?",nativeQuery = true)
+    DmFoodCate findByCateId(Integer id);
+
     /**
      * 查询顶级菜单
      * @return /

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodCate/service/DmFoodCateService.java

@@ -22,6 +22,7 @@ import me.zhengjie.modules.system.domain.Menu;
 import me.zhengjie.modules.system.service.dto.MenuDto;
 import me.zhengjie.modules.system.service.dto.MenuQueryCriteria;
 import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.Query;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;

+ 2 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodCate/service/dto/DmFoodCateDto.java

@@ -39,6 +39,8 @@ public class DmFoodCateDto extends BaseDTO implements Serializable {
     @JSONField(serializeUsing = ToStringSerializer.class)
     private Integer id;
 
+    private Integer cateId;
+
     private Integer pid;
 
     private String cateName;

+ 30 - 19
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodCate/service/impl/DmFoodCateServiceImpl.java

@@ -93,8 +93,9 @@ public class DmFoodCateServiceImpl implements DmFoodCateService {
     @Override
     @Transactional
     public DmFoodCateDto findById(Integer id) {
-        DmFoodCate dmFood = dmFoodCateRepository.findById(id).orElseGet(DmFoodCate::new);
-        ValidationUtil.isNull(dmFood.getId(),"DmFood","id",id);
+//        DmFoodCate dmFood = dmFoodCateRepository.findById(id).orElseGet(DmFoodCate::new);
+        DmFoodCate dmFood = dmFoodCateRepository.findByCateId(id);
+        ValidationUtil.isNull(dmFood.getCateId(),"DmFoodCate","cateId",id);
         return dmFoodCateMapper.toDto(dmFood);
     }
 
@@ -117,17 +118,17 @@ public class DmFoodCateServiceImpl implements DmFoodCateService {
                 trees.add(menuDTO);
             }
             for (DmFoodCateDto it : menuDtos) {
-                if (menuDTO.getId().equals(it.getPid())) {
+                if (menuDTO.getCateId().equals(it.getPid())) {
                     if (menuDTO.getChildren() == null) {
                         menuDTO.setChildren(new ArrayList<>());
                     }
                     menuDTO.getChildren().add(it);
-                    ids.add(it.getId());
+                    ids.add(it.getCateId());
                 }
             }
         }
         if(trees.size() == 0){
-            trees = menuDtos.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList());
+            trees = menuDtos.stream().filter(s -> !ids.contains(s.getCateId())).collect(Collectors.toList());
         }
         return trees;
     }
@@ -135,11 +136,12 @@ public class DmFoodCateServiceImpl implements DmFoodCateService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void create(DmFoodCate resources) {
-//        Snowflake snowflake = IdUtil.createSnowflake(1, 1);
-//        resources.setId((int) snowflake.nextId());
         if(resources.getPid().equals(0)){
             resources.setPid(null);
         }
+        if (resources.getUrl().getId() == null){
+            resources.setUrl(null);
+        }
         dmFoodCateRepository.save(resources);
         // 计算子节点数目
         resources.setSubCount(0);
@@ -150,25 +152,34 @@ public class DmFoodCateServiceImpl implements DmFoodCateService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void update(DmFoodCate resources) {
-        if(resources.getId().equals(resources.getPid())) {
+        if(resources.getCateId().equals(resources.getPid())) {
             throw new BadRequestException("上级不能为自己");
         }
-        DmFoodCate dmFood = dmFoodCateRepository.findById(resources.getId()).orElseGet(DmFoodCate::new);
-        ValidationUtil.isNull( dmFood.getId(),"DmFood","id",resources.getId());
+        DmFoodCate dmFoodCate = dmFoodCateRepository.findById(resources.getId()).orElseGet(DmFoodCate::new);
+        ValidationUtil.isNull( dmFoodCate.getId(),"DmFoodCate","id",resources.getId());
+
+        List<DmFoodCate> dmFoodCateList = dmFoodCateRepository.findByPidUpdate(dmFoodCate.getCateId());
 
         if(resources.getPid().equals(0)){
             resources.setPid(null);
         }
-
+        if (resources.getUrl().getId() == null){
+            resources.setUrl(null);
+        }
         // 记录的父节点ID
-        Integer oldPid = dmFood.getPid();
+        Integer oldPid = dmFoodCate.getPid();
         Integer newPid = resources.getPid();
 
-        dmFood.copy(resources);
-        dmFoodCateRepository.save(dmFood);
+        dmFoodCate.copy(resources);
+        dmFoodCateRepository.save(resources);
         // 计算父级菜单节点数目
         updateSubCnt(oldPid);
         updateSubCnt(newPid);
+
+        for (DmFoodCate foodCate : dmFoodCateList){
+            foodCate.setPid(resources.getCateId());
+            dmFoodCateRepository.save(foodCate);
+        }
     }
 
 
@@ -197,16 +208,16 @@ public class DmFoodCateServiceImpl implements DmFoodCateService {
 
     @Override
     public DmFoodCate findOne(Integer id) {
-        DmFoodCate menu = dmFoodCateRepository.findById(id).orElseGet(DmFoodCate::new);
-        ValidationUtil.isNull(menu.getId(),"DmFoodCate","id",id);
-        return menu;
+        DmFoodCate dmFoodCate = dmFoodCateRepository.findById(id).orElseGet(DmFoodCate::new);
+        ValidationUtil.isNull(dmFoodCate.getId(),"DmFoodCate","id",id);
+        return dmFoodCate;
     }
 
     @Override
     public Set<DmFoodCate> getChildMenus(List<DmFoodCate> menuList, Set<DmFoodCate> menuSet) {
         for (DmFoodCate menu : menuList) {
             menuSet.add(menu);
-            List<DmFoodCate> menus = dmFoodCateRepository.findByPid(menu.getId());
+            List<DmFoodCate> menus = dmFoodCateRepository.findByPid(menu.getCateId());
             if(menus!=null && menus.size()!=0){
                 getChildMenus(menus, menuSet);
             }
@@ -219,7 +230,7 @@ public class DmFoodCateServiceImpl implements DmFoodCateService {
         List<Map<String, Object>> list = new ArrayList<>();
         for (DmFoodCateDto dmFood : all) {
             Map<String,Object> map = new LinkedHashMap<>();
-            map.put("编号", dmFood.getId());
+            map.put("编号", dmFood.getCateId());
             map.put("名称", dmFood.getCateName());
             map.put("上级编号", dmFood.getPid());
             map.put("图片", dmFood.getPicture());

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/domain/DmOrderItem.java

@@ -58,10 +58,10 @@ public class DmOrderItem implements Serializable {
     @ApiModelProperty(value = "评价类型")
     private String pjType;
 
-    @OneToOne
-    @JoinColumn(name = "pid")
+//    @OneToOne
+    @Column(name = "pid")
     @ApiModelProperty(value = "商品编号")
-    private DmFood food;
+    private Long food;
 
 //    @Column(name = "pid")
 //    @ApiModelProperty(value = "商品编号")

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderItemDto.java

@@ -47,7 +47,7 @@ public class DmOrderItemDto implements Serializable {
 //    private List<DmOrderItem> orderItems;
 
     /** 商品编号 */
-    private DmFood food;
+    private Long food;
 //    private Long pid;
 
     private String tel;

+ 31 - 17
eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/CardRecordTask.java

@@ -1,10 +1,10 @@
 package me.zhengjie.modules.quartz.task;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.domain.Log;
 import me.zhengjie.modules.dm.food.domain.DmFood;
 import me.zhengjie.modules.dm.order.domain.DmOrderItem;
 import me.zhengjie.modules.dm.order.domain.DmOrderPayment;
@@ -13,9 +13,10 @@ import me.zhengjie.modules.dm.order.repository.DmOrderRecordRepository;
 import me.zhengjie.modules.dm.order.service.DmOrderItemService;
 import me.zhengjie.modules.dm.order.service.DmOrderPaymentService;
 import me.zhengjie.modules.dm.order.service.DmOrderRecordService;
+import me.zhengjie.repository.LogRepository;
 import me.zhengjie.utils.BeanMapUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
-import org.springframework.util.ObjectUtils;
 
 import java.io.IOException;
 import java.text.ParseException;
@@ -27,10 +28,12 @@ import java.util.*;
 @RequiredArgsConstructor
 public class CardRecordTask {
 
+    @Value("${cardUrl}")
+    private String url;
     private final DmOrderRecordService dmOrderRecordService;
     private final DmOrderItemService dmOrderItemService;
     private final DmOrderPaymentService dmOrderPaymentService;
-
+    private final LogRepository logRepository;
     private final DmOrderRecordRepository dmOrderRecordRepository;
 //    private final DmExpenseCalendarService dmExpenseCalendarService;
 
@@ -59,13 +62,24 @@ public class CardRecordTask {
     }
 
     public JSONObject getData(String url , JSONObject param) throws IOException {
-//        Map<String,String> formDataParam = new HashMap<>();
-//        System.out.println("formDataParam:"+param.toJSONString());
-//        formDataParam.put("date",param.toJSONString());
         log.info("param:"+param);
-        String data = BeanMapUtils.sendPost(url, param.toString());
-        System.out.println("historyRecord:"+data);
-        JSONObject dataJSON = JSONObject.parseObject(data);
+        String data = "";
+        JSONObject dataJSON = null;
+        try {
+            data = BeanMapUtils.sendPost(url, param.toString());
+            System.out.println("historyRecord:"+data);
+            dataJSON = JSONObject.parseObject(data);
+        } catch (Exception ex){
+            ex.printStackTrace();
+            Log log = new Log();
+            log.setDescription(ex.toString());
+            log.setLogType("ERROR");
+            log.setMethod(url);
+            log.setParams(data);
+            log.setUsername("同步永天消费数据问题");
+            System.out.println("日志"+log);
+            logRepository.save(log);
+        }
         return dataJSON;
     }
 
@@ -169,7 +183,7 @@ public class CardRecordTask {
 //    }
 
     public void asyncExpense() throws IOException, ParseException {
-        String url = "https://smartpark.caih.com/dxapi/dxtop/dish/page";
+//        String url = ;
 
         JSONObject data = new JSONObject();
         int limit = 100;//页数
@@ -232,10 +246,10 @@ public class CardRecordTask {
                     for (int m = 0; m < item.size(); m++) {
                         JSONObject userData = item.getJSONObject(m);
                         DmOrderItem dmOrderItem = new DmOrderItem();
-                        DmFood dmFood = new DmFood();
-                        dmFood.setId(userData.getLong("pid"));
+//                        DmFood dmFood = new DmFood();
+//                        dmFood.setId(userData.getLong("pid"));
                         dmOrderItem.setSeq(attendance.getLong("seq"));
-                        dmOrderItem.setFood(dmFood);
+                        dmOrderItem.setFood(userData.getLong("pid"));
                         dmOrderItem.setBh(bh);
                         dmOrderItem.setName(userData.getString("name"));
                         dmOrderItem.setPrice(userData.getString("price"));
@@ -264,7 +278,7 @@ public class CardRecordTask {
     }
 
     public void asyncExpenseAll() throws IOException, ParseException {
-        String url = "https://smartpark.caih.com/dxapi/dxtop/dish/page";
+//        String url = "https://smartpark.caih.com/dxapi/dxtop/dish/page";
 
         JSONObject data = new JSONObject();
         int limit = 100;//页数
@@ -320,10 +334,10 @@ public class CardRecordTask {
                     for (int m = 0; m < item.size(); m++) {
                         JSONObject userData = item.getJSONObject(m);
                         DmOrderItem dmOrderItem = new DmOrderItem();
-                        DmFood dmFood = new DmFood();
-                        dmFood.setId(userData.getLong("pid"));
+//                        DmFood dmFood = new DmFood();
+//                        dmFood.setId(userData.getLong("pid"));
                         dmOrderItem.setSeq(attendance.getLong("seq"));
-                        dmOrderItem.setFood(dmFood);
+                        dmOrderItem.setFood(userData.getLong("pid"));
                         dmOrderItem.setBh(bh);
                         dmOrderItem.setName(userData.getString("name"));
                         dmOrderItem.setPrice(userData.getString("price"));

+ 53 - 35
eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/ZkDataSyncTask.java

@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.domain.Log;
 import me.zhengjie.modules.dm.user.domain.DmUser;
 import me.zhengjie.modules.dm.user.repository.DmUserRepository;
 import me.zhengjie.modules.system.domain.Dept;
@@ -29,7 +30,9 @@ import me.zhengjie.modules.system.domain.User;
 import me.zhengjie.modules.system.repository.DeptRepository;
 import me.zhengjie.modules.system.repository.UserRepository;
 import me.zhengjie.modules.system.service.DeptService;
+import me.zhengjie.repository.LogRepository;
 import me.zhengjie.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Component;
 import org.springframework.util.ObjectUtils;
@@ -47,14 +50,22 @@ import java.util.*;
 @Component
 public class ZkDataSyncTask {
 
-    private final String key = "DMERPYT!@#$QWER2021+{:>";
-    private final String zkApiUrl = "https://smartpark.caih.com/zkxt";//http://192.168.1.14:6112
-    private final String header_key = "XYTACCESSTOKEN";//X_YT_ACCESS_TOKEN
+    @Value("${key}")
+    private String key;
+    @Value("${zkApiUrl}")
+    private String zkApiUrl;
+    @Value("${headerKey}")
+    private String header_key;
+    @Value("${deptApi}")
+    private String deptApi;
+    @Value("${userApi}")
+    private String userApi;
 
     private final UserRepository userRepository;
     private final DmUserRepository dmUserRepository;
     private final DeptRepository deptRepository;
     private final PasswordEncoder passwordEncoder;
+    private final LogRepository logRepository;
 
     public void run(){
         log.info("deptsync 执行开始");
@@ -79,21 +90,34 @@ public class ZkDataSyncTask {
     }
 
     private JSONObject getDatas(String api,JSONArray time, int pageNum, int pageSize,int type) {
-        Map<String,Object> tokenData = SecurityUtils.getToken(key);
-        JSONObject body = new JSONObject();
-        body.put("timestamp",tokenData.get("timestamp"));
-        body.put("nonce",tokenData.get("nonce"));
-        JSONObject query = new JSONObject();
-        if(type == 1){
-            query.put("updateTime",time);
+        String res = "";
+        JSONObject json = null;
+        try {
+            Map<String,Object> tokenData = SecurityUtils.getToken(key);
+            JSONObject body = new JSONObject();
+            body.put("timestamp",tokenData.get("timestamp"));
+            body.put("nonce",tokenData.get("nonce"));
+            JSONObject query = new JSONObject();
+            if(type == 1){
+                query.put("updateTime",time);
+            }
+            body.put("query",query);
+
+            res = HttpRequest.get(zkApiUrl + api+"?page="+pageNum+"&size="+pageSize)
+                    .header(header_key, tokenData.get("token").toString())
+                    .body(body.toString()).execute().body();
+            json = JSONObject.parseObject(res);
+            log.info("json:"+json);
+        }catch (Exception ex){
+            ex.printStackTrace();
+            Log log = new Log();
+            log.setDescription(ex.toString());
+            log.setLogType("ERROR");
+            log.setMethod(zkApiUrl + api);
+            log.setParams(res);
+            log.setUsername("同步中控数据问题");
+            logRepository.save(log);
         }
-        body.put("query",query);
-
-        String res = HttpRequest.get(zkApiUrl + api+"?page="+pageNum+"&size="+pageSize)
-                .header(header_key, tokenData.get("token").toString())
-                .body(body.toString()).execute().body();
-        JSONObject json = JSONObject.parseObject(res);
-        log.info("json:"+json);
         return json;
     }
 
@@ -101,7 +125,7 @@ public class ZkDataSyncTask {
      * 部门数据同步
      */
     private void deptSync() {
-        String api = "/api/thirdparty/v1/user/getzkdeps";
+//        String api = "/api/thirdparty/v1/user/getzkdeps";
 
         JSONArray createTme = new JSONArray();
         DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -115,7 +139,7 @@ public class ZkDataSyncTask {
         createTme.add(todayDate);
 
         //计算总页数
-        int total = getDatas(api,createTme,0,100,1).getJSONObject("data").getInteger("totalElements");
+        int total = getDatas(deptApi,createTme,0,100,1).getJSONObject("data").getInteger("totalElements");
         int pageSize = 100;
         int pageTotal = (total / pageSize);
         if (total % pageSize != 0) {
@@ -125,18 +149,12 @@ public class ZkDataSyncTask {
 
         //按页获取
         for (int k = 0; k < pageTotal; k++) {
-            JSONObject json = getDatas(api, createTme,k,pageSize,1);
+            JSONObject json = getDatas(deptApi, createTme,k,pageSize,1);
             JSONObject data = json.getJSONObject("data");
             JSONArray content = data.getJSONArray("content");
             for (int i = 0; i < content.size(); i++) {
                 Dept dept = JSONObject.parseObject(content.getString(i), Dept.class);
                 deptRepository.save(dept);
-//                DeptDto deptDto = deptService.findById(dept.getId());
-//                if (deptDto != null) {
-//                    deptService.update(dept);
-//                } else {
-//                    deptService.create(dept);
-//                }
             }
         }
     }
@@ -145,10 +163,10 @@ public class ZkDataSyncTask {
      * 部门数据同步(全量)
      */
     private void deptSyncAll() {
-        String api = "/api/thirdparty/v1/user/getzkdeps";
+//        String api = "/api/thirdparty/v1/user/getzkdeps";
 
         //计算总页数
-        int total = getDatas(api,null,0,100,2).getJSONObject("data").getInteger("totalElements");
+        int total = getDatas(deptApi,null,0,100,2).getJSONObject("data").getInteger("totalElements");
         int pageSize = 100;
         int pageTotal = (total / pageSize);
         if (total % pageSize != 0) {
@@ -158,7 +176,7 @@ public class ZkDataSyncTask {
 
         //按页获取
         for (int k = 0; k < pageTotal; k++) {
-            JSONObject json = getDatas(api,null,k,pageSize,2);
+            JSONObject json = getDatas(deptApi,null,k,pageSize,2);
             JSONObject data = json.getJSONObject("data");
             JSONArray content = data.getJSONArray("content");
             for (int i = 0; i < content.size(); i++) {
@@ -172,7 +190,7 @@ public class ZkDataSyncTask {
      * 人员数据同步
      */
     private void userSync() {
-        String api = "/api/thirdparty/v1/user/getZkSysUsers";
+//        String api = "/api/thirdparty/v1/user/getZkSysUsers";
 
         JSONArray createTme = new JSONArray();
         DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -186,7 +204,7 @@ public class ZkDataSyncTask {
         createTme.add(todayDate);
 
         //计算总页数
-        int total = getDatas(api,createTme,0,1,1).getJSONObject("data").getInteger("totalElements");
+        int total = getDatas(userApi,createTme,0,1,1).getJSONObject("data").getInteger("totalElements");
         int pageSize = 10;
         int pageTotal = (total / pageSize);
         if (total % pageSize != 0) {
@@ -196,7 +214,7 @@ public class ZkDataSyncTask {
 
         //按页获取
         for (int k = 0; k < pageTotal; k++) {
-            JSONObject json = getDatas(api, createTme,k,pageSize,1);
+            JSONObject json = getDatas(userApi, createTme,k,pageSize,1);
             JSONObject data = json.getJSONObject("data");
             JSONArray content = data.getJSONArray("content");
             for (int i = 0; i < content.size(); i++) {
@@ -274,10 +292,10 @@ public class ZkDataSyncTask {
      */
     private void userSyncAll() {
 
-        String api = "/api/thirdparty/v1/user/getZkSysUsers";
+//        String api = "/api/thirdparty/v1/user/getZkSysUsers";
 
         //计算总页数
-        int total = getDatas(api,null,0,10,2).getJSONObject("data").getInteger("totalElements");
+        int total = getDatas(userApi,null,0,10,2).getJSONObject("data").getInteger("totalElements");
         int pageSize = 10;
         int pageTotal = (total / pageSize);
         if (total % pageSize != 0) {
@@ -287,7 +305,7 @@ public class ZkDataSyncTask {
 
         //按页获取
         for (int k = 0; k < pageTotal; k++) {
-            JSONObject json = getDatas(api, null,k,pageSize,1);
+            JSONObject json = getDatas(userApi, null,k,pageSize,1);
             JSONObject data = json.getJSONObject("data");
             JSONArray content = data.getJSONArray("content");
             for (int i = 0; i < content.size(); i++) {

+ 11 - 0
eladmin-system/src/main/resources/application.properties

@@ -0,0 +1,11 @@
+#CardRecordTask
+cardUrl=https://smartpark.caih.com/dxapi/dxtop/dish/page
+#ZkDataSyncTask
+zkApiUrl=https://smartpark.caih.com/zkxt
+key=DMERPYT!@#$QWER2021+{:>
+headerKey=XYTACCESSTOKEN
+deptApi=/api/thirdparty/v1/user/getzkdeps
+userApi=/api/thirdparty/v1/user/getZkSysUsers
+#LocalStorageServiceImpl
+localUrl=https://smartpark.caih.com/static/zhcyres/
+

+ 4 - 1
eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java

@@ -26,6 +26,7 @@ import me.zhengjie.exception.BadRequestException;
 import me.zhengjie.utils.*;
 import me.zhengjie.repository.LocalStorageRepository;
 import me.zhengjie.service.LocalStorageService;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import java.io.File;
@@ -47,6 +48,8 @@ import javax.servlet.http.HttpServletResponse;
 @RequiredArgsConstructor
 public class LocalStorageServiceImpl implements LocalStorageService {
 
+    @Value("${localUrl}")
+    private String localUrl;
     private final LocalStorageRepository localStorageRepository;
     private final LocalStorageMapper localStorageMapper;
     private final FileProperties properties;
@@ -79,7 +82,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
         if(ObjectUtil.isNull(file)){
             throw new BadRequestException("上传失败");
         }
-        String url = "https://smartpark.caih.com/static/zhcyres/"+file.getName();
+        String url = localUrl + file.getName();
         try {
             name = StringUtils.isBlank(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name;
             LocalStorage localStorage = new LocalStorage(