张延森 3 年前
父节点
当前提交
ef1b8cf913

+ 3
- 0
src/main/java/com/yunzhi/marketing/entity/TaBuilding.java 查看文件

@@ -375,6 +375,9 @@ public class TaBuilding implements Serializable {
375 375
     /** 是否文旅商办 */
376 376
     private Integer isCommerce ;
377 377
 
378
+    /** 是否文旅商办 */
379
+    private Integer isRecentOpening ;
380
+
378 381
     /**
379 382
      * 项目亮点封面
380 383
      */

+ 32
- 29
src/main/java/com/yunzhi/marketing/xlk/controller/BuildingChannelController.java 查看文件

@@ -1,9 +1,6 @@
1 1
 package com.yunzhi.marketing.xlk.controller;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
-import com.baomidou.mybatisplus.core.metadata.IPage;
6
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 4
 import com.yunzhi.marketing.base.BaseController;
8 5
 import com.yunzhi.marketing.base.ResponseBean;
9 6
 import com.yunzhi.marketing.xlk.dto.BuildingChannelDTO;
@@ -21,6 +18,7 @@ import javax.servlet.http.HttpServletRequest;
21 18
 import java.time.LocalDateTime;
22 19
 import java.util.ArrayList;
23 20
 import java.util.List;
21
+import java.util.stream.Collectors;
24 22
 
25 23
 /**
26 24
  * <p>
@@ -40,7 +38,6 @@ public class BuildingChannelController extends BaseController {
40 38
     @Autowired
41 39
     public IBuildingChannelService iBuildingChannelService;
42 40
 
43
-
44 41
     /**
45 42
      * 保存对象
46 43
      * @param buildingChannelDTO 实体对象
@@ -53,18 +50,7 @@ public class BuildingChannelController extends BaseController {
53 50
                                            HttpServletRequest request){
54 51
         ResponseBean responseBean = new ResponseBean();
55 52
         try {
56
-            Integer orgId = getOrgId(request);
57
-            List<BuildingChannel> buildingChannelList = new ArrayList<>();
58
-            List<String> channelIdList = buildingChannelDTO.getChannelIdList();
59
-            channelIdList.forEach(e -> {
60
-                BuildingChannel buildingChannel = new BuildingChannel();
61
-                BeanUtils.copyProperties(e,buildingChannel);
62
-                buildingChannel.setChannelId(e);
63
-                buildingChannel.setCreateDate(LocalDateTime.now());
64
-                buildingChannel.setOrgId(orgId);
65
-                buildingChannelList.add(buildingChannel);
66
-            });
67
-            if (iBuildingChannelService.saveBatch(buildingChannelList)){
53
+            if (saveData(buildingChannelDTO, getOrgId(request))){
68 54
                 responseBean.addSuccess("添加成功");
69 55
             }else {
70 56
                 responseBean.addError("fail");
@@ -93,18 +79,7 @@ public class BuildingChannelController extends BaseController {
93 79
             iBuildingChannelService.remove(new LambdaQueryWrapper<BuildingChannel>().eq(BuildingChannel::getBuildingId,buildingChannelDTO.getBuildingId()));
94 80
 
95 81
             // 重新添加
96
-            Integer orgId = getOrgId(request);
97
-            List<BuildingChannel> buildingChannelList = new ArrayList<>();
98
-            List<String> channelIdList = buildingChannelDTO.getChannelIdList();
99
-            channelIdList.forEach(e -> {
100
-                BuildingChannel buildingChannel = new BuildingChannel();
101
-                BeanUtils.copyProperties(e,buildingChannel);
102
-                buildingChannel.setChannelId(e);
103
-                buildingChannel.setCreateDate(LocalDateTime.now());
104
-                buildingChannel.setOrgId(orgId);
105
-                buildingChannelList.add(buildingChannel);
106
-            });
107
-            if (iBuildingChannelService.saveBatch(buildingChannelList)){
82
+            if (saveData(buildingChannelDTO, getOrgId(request))){
108 83
                 responseBean.addSuccess("修改成功");
109 84
             }else {
110 85
                 responseBean.addError("fail");
@@ -117,6 +92,24 @@ public class BuildingChannelController extends BaseController {
117 92
         return responseBean;
118 93
     }
119 94
 
95
+    private boolean saveData(BuildingChannelDTO buildingChannelDTO, Integer orgId) {
96
+        List<BuildingChannel> buildingChannelList = new ArrayList<>();
97
+        List<String> channelIdList = buildingChannelDTO.getChannelIdList();
98
+        channelIdList.forEach(e -> {
99
+            BuildingChannel buildingChannel = new BuildingChannel();
100
+            BeanUtils.copyProperties(e,buildingChannel);
101
+            buildingChannel.setChannelId(e);
102
+            buildingChannel.setBuildingId(buildingChannelDTO.getBuildingId());
103
+            buildingChannel.setExpirationDate(buildingChannelDTO.getExpirationDate());
104
+            buildingChannel.setRemark(buildingChannelDTO.getRemark());
105
+            buildingChannel.setCreateDate(LocalDateTime.now());
106
+            buildingChannel.setOrgId(orgId);
107
+            buildingChannelList.add(buildingChannel);
108
+        });
109
+
110
+        return iBuildingChannelService.saveBatch(buildingChannelList);
111
+    }
112
+
120 113
     /**
121 114
      * 根据id查询对象
122 115
      * @param
@@ -129,7 +122,17 @@ public class BuildingChannelController extends BaseController {
129 122
             LambdaQueryWrapper<BuildingChannel> queryWrapper = new LambdaQueryWrapper<>();
130 123
             queryWrapper.eq(BuildingChannel::getBuildingId,buildingId);
131 124
             List<BuildingChannel> list = iBuildingChannelService.list(queryWrapper);
132
-            responseBean.addSuccess(list);
125
+
126
+            BuildingChannelDTO buildingChannelDTO = null;
127
+            if (list != null && list.size() > 0) {
128
+                buildingChannelDTO = new BuildingChannelDTO();
129
+                buildingChannelDTO.setChannelIdList(list.stream().map(x -> x.getChannelId()).collect(Collectors.toList()));
130
+                buildingChannelDTO.setBuildingId(buildingId);
131
+                buildingChannelDTO.setExpirationDate(list.get(0).getExpirationDate());
132
+                buildingChannelDTO.setRemark(list.get(0).getRemark());
133
+            }
134
+
135
+            responseBean.addSuccess(buildingChannelDTO);
133 136
         }catch (Exception e){
134 137
             e.printStackTrace();
135 138
             logger.error("buildingChannelDelete -=- {}",e.toString());

+ 6
- 3
src/main/resources/application-prod.yml 查看文件

@@ -4,9 +4,12 @@ spring:
4 4
   application:
5 5
     name: zhiyun
6 6
   datasource:
7
-    username: marketing
8
-    password: u@cSFJ5*kS9hGP7a
9
-    url: jdbc:mysql://localhost:3306/marketing-cloud?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
7
+    username: marketing-cloud
8
+    password: uVV0kEQLFGqx4#mV
9
+    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/marketing-cloud?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
+#    username: marketing
11
+#    password: u@cSFJ5*kS9hGP7a
12
+#    url: jdbc:mysql://localhost:3306/marketing-cloud?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10 13
     driver-class-name: com.mysql.cj.jdbc.Driver
11 14
     initial-size: 10 # 初始化连接数
12 15
     max-active: 20 # 最大连接数

+ 2
- 1
src/main/resources/log/logback-spring.xml 查看文件

@@ -2,7 +2,8 @@
2 2
 <configuration debug="false">
3 3
     <springProfile name="prod">
4 4
         <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
5
-        <property name="LOG_HOME" value="/home/xlk/marketing-cloud/service/logs" />
5
+<!--        <property name="LOG_HOME" value="/home/xlk/marketing-cloud/service/logs" />-->
6
+        <property name="LOG_HOME" value="/yunpan/dev/logs" />
6 7
         <!-- 控制台输出 -->
7 8
         <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
8 9
             <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">