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

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

375
     /** 是否文旅商办 */
375
     /** 是否文旅商办 */
376
     private Integer isCommerce ;
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
 package com.yunzhi.marketing.xlk.controller;
1
 package com.yunzhi.marketing.xlk.controller;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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
 import com.yunzhi.marketing.base.BaseController;
4
 import com.yunzhi.marketing.base.BaseController;
8
 import com.yunzhi.marketing.base.ResponseBean;
5
 import com.yunzhi.marketing.base.ResponseBean;
9
 import com.yunzhi.marketing.xlk.dto.BuildingChannelDTO;
6
 import com.yunzhi.marketing.xlk.dto.BuildingChannelDTO;
21
 import java.time.LocalDateTime;
18
 import java.time.LocalDateTime;
22
 import java.util.ArrayList;
19
 import java.util.ArrayList;
23
 import java.util.List;
20
 import java.util.List;
21
+import java.util.stream.Collectors;
24
 
22
 
25
 /**
23
 /**
26
  * <p>
24
  * <p>
40
     @Autowired
38
     @Autowired
41
     public IBuildingChannelService iBuildingChannelService;
39
     public IBuildingChannelService iBuildingChannelService;
42
 
40
 
43
-
44
     /**
41
     /**
45
      * 保存对象
42
      * 保存对象
46
      * @param buildingChannelDTO 实体对象
43
      * @param buildingChannelDTO 实体对象
53
                                            HttpServletRequest request){
50
                                            HttpServletRequest request){
54
         ResponseBean responseBean = new ResponseBean();
51
         ResponseBean responseBean = new ResponseBean();
55
         try {
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
                 responseBean.addSuccess("添加成功");
54
                 responseBean.addSuccess("添加成功");
69
             }else {
55
             }else {
70
                 responseBean.addError("fail");
56
                 responseBean.addError("fail");
93
             iBuildingChannelService.remove(new LambdaQueryWrapper<BuildingChannel>().eq(BuildingChannel::getBuildingId,buildingChannelDTO.getBuildingId()));
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
                 responseBean.addSuccess("修改成功");
83
                 responseBean.addSuccess("修改成功");
109
             }else {
84
             }else {
110
                 responseBean.addError("fail");
85
                 responseBean.addError("fail");
117
         return responseBean;
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
      * 根据id查询对象
114
      * 根据id查询对象
122
      * @param
115
      * @param
129
             LambdaQueryWrapper<BuildingChannel> queryWrapper = new LambdaQueryWrapper<>();
122
             LambdaQueryWrapper<BuildingChannel> queryWrapper = new LambdaQueryWrapper<>();
130
             queryWrapper.eq(BuildingChannel::getBuildingId,buildingId);
123
             queryWrapper.eq(BuildingChannel::getBuildingId,buildingId);
131
             List<BuildingChannel> list = iBuildingChannelService.list(queryWrapper);
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
         }catch (Exception e){
136
         }catch (Exception e){
134
             e.printStackTrace();
137
             e.printStackTrace();
135
             logger.error("buildingChannelDelete -=- {}",e.toString());
138
             logger.error("buildingChannelDelete -=- {}",e.toString());

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

4
   application:
4
   application:
5
     name: zhiyun
5
     name: zhiyun
6
   datasource:
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
     driver-class-name: com.mysql.cj.jdbc.Driver
13
     driver-class-name: com.mysql.cj.jdbc.Driver
11
     initial-size: 10 # 初始化连接数
14
     initial-size: 10 # 初始化连接数
12
     max-active: 20 # 最大连接数
15
     max-active: 20 # 最大连接数

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

2
 <configuration debug="false">
2
 <configuration debug="false">
3
     <springProfile name="prod">
3
     <springProfile name="prod">
4
         <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
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
         <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
8
         <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
8
             <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
9
             <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">