Commit f71c1844 authored by 赵啸非's avatar 赵啸非

添加产品升级功能

parent 03013975
...@@ -14,7 +14,7 @@ import javax.annotation.PreDestroy; ...@@ -14,7 +14,7 @@ import javax.annotation.PreDestroy;
import java.util.List; import java.util.List;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
@Service //@Service
@Slf4j @Slf4j
public class DefaultTbCoreConsumerService extends AbstractConsumerService<TbQueueMsg> implements TbCoreConsumerService { public class DefaultTbCoreConsumerService extends AbstractConsumerService<TbQueueMsg> implements TbCoreConsumerService {
......
...@@ -32,7 +32,6 @@ public class DefaultTbQueueMsg implements TbQueueMsg { ...@@ -32,7 +32,6 @@ public class DefaultTbQueueMsg implements TbQueueMsg {
*/ */
private String data; private String data;
/** /**
* 消息头信息 * 消息头信息
*/ */
...@@ -61,7 +60,10 @@ public class DefaultTbQueueMsg implements TbQueueMsg { ...@@ -61,7 +60,10 @@ public class DefaultTbQueueMsg implements TbQueueMsg {
String ret = JSON.toJSONString(queueMsg); String ret = JSON.toJSONString(queueMsg);
System.out.println("pro:"+ret); System.out.println("pro:"+ret);
// //
// DefaultTbQueueMsg qu = JSON.parseObject(ret, DefaultTbQueueMsg.class); DefaultTbQueueMsg qu = JSON.parseObject(ret, DefaultTbQueueMsg.class);
System.out.println("header:"+qu.getHeaders().get(MessageHeader.MESSAGETYPE));
System.out.println("data:"+qu.getData());
} }
......
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component //@Component
@ConditionalOnExpression("'${queue.type:null}'=='rabbitmq'") @ConditionalOnExpression("'${queue.type:null}'=='rabbitmq'")
public class RabbitMqTbCoreQueueFactory implements TbCoreQueueFactory { public class RabbitMqTbCoreQueueFactory implements TbCoreQueueFactory {
......
...@@ -13,7 +13,7 @@ import javax.annotation.PostConstruct; ...@@ -13,7 +13,7 @@ import javax.annotation.PostConstruct;
* 初始化消息生产者服务 * 初始化消息生产者服务
*/ */
@CommonsLog @CommonsLog
@Service //@Service
public class TbCoreQueueProducerProvider implements TbQueueProducerProvider { public class TbCoreQueueProducerProvider implements TbQueueProducerProvider {
/** /**
...@@ -27,7 +27,7 @@ public class TbCoreQueueProducerProvider implements TbQueueProducerProvider { ...@@ -27,7 +27,7 @@ public class TbCoreQueueProducerProvider implements TbQueueProducerProvider {
*/ */
private TbQueueProducer<TbQueueMsg> queueProducer; private TbQueueProducer<TbQueueMsg> queueProducer;
@PostConstruct //@PostConstruct
public void init() { public void init() {
log.info("消息队列生产服务开始..."); log.info("消息队列生产服务开始...");
this.queueProducer = tbQueueProvider.createMsgProducer(); this.queueProducer = tbQueueProvider.createMsgProducer();
......
...@@ -13,7 +13,7 @@ import javax.annotation.PostConstruct; ...@@ -13,7 +13,7 @@ import javax.annotation.PostConstruct;
@Slf4j @Slf4j
@ConditionalOnExpression("'${queue.type:null}'=='rabbitmq'") @ConditionalOnExpression("'${queue.type:null}'=='rabbitmq'")
@Component //@Component
@Data @Data
public class TbRabbitMqSettings { public class TbRabbitMqSettings {
@Value("${queue.rabbitmq.exchange_name:}") @Value("${queue.rabbitmq.exchange_name:}")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
NODE_ENV = development NODE_ENV = development
# 地址 # 地址
VUE_APP_BASE_API =http://plm.testnew.com:8082/m VUE_APP_BASE_API =http://plm.testnew.com:8084/m
# websocket地址 # websocket地址
VUE_APP_WEBSOCKET_API =127.0.0.1:18222/m VUE_APP_WEBSOCKET_API =127.0.0.1:18222/m
...@@ -10,3 +10,6 @@ VUE_APP_WEBSOCKET_API =127.0.0.1:18222/m ...@@ -10,3 +10,6 @@ VUE_APP_WEBSOCKET_API =127.0.0.1:18222/m
# 门户登录地址 # 门户登录地址
VUE_APP_PORTAL_URL = http://192.168.0.98:11072 VUE_APP_PORTAL_URL = http://192.168.0.98:11072
# 站点请求地址
VUE_APP_SITETREE_URL = http://127.0.0.1:18222/m/site/siteTree
...@@ -10,3 +10,6 @@ VUE_APP_WEBSOCKET_API =192.168.0.98:18222/m ...@@ -10,3 +10,6 @@ VUE_APP_WEBSOCKET_API =192.168.0.98:18222/m
# 门户登录地址 # 门户登录地址
VUE_APP_PORTAL_URL = http://192.168.0.98:11072 VUE_APP_PORTAL_URL = http://192.168.0.98:11072
# 站点请求地址
VUE_APP_SITETREE_URL = http://192.168.0.98:18222/m/site/siteTree
\ No newline at end of file
...@@ -10,3 +10,6 @@ VUE_APP_WEBSOCKET_API =192.168.0.98:18222/m ...@@ -10,3 +10,6 @@ VUE_APP_WEBSOCKET_API =192.168.0.98:18222/m
# 门户登录地址 # 门户登录地址
VUE_APP_PORTAL_URL = http://192.168.0.98:11072 VUE_APP_PORTAL_URL = http://192.168.0.98:11072
# 站点请求地址
VUE_APP_SITETREE_URL = http://192.168.0.98:18222/m/site/siteTree
\ No newline at end of file
...@@ -51,10 +51,9 @@ ...@@ -51,10 +51,9 @@
"less": "^3.0.4", "less": "^3.0.4",
"less-loader": "^4.1.0", "less-loader": "^4.1.0",
"lint-staged": "10.5.3", "lint-staged": "10.5.3",
"node-sass": "^5.0.0",
"runjs": "4.4.2", "runjs": "4.4.2",
"sass": "1.32.0", "sass": "1.32.0",
"sass-loader": "^10.1.0", "sass-loader": "^7.1.0",
"script-ext-html-webpack-plugin": "2.1.5", "script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1", "svg-sprite-loader": "5.1.1",
"vue-formatter": "^0.0.8", "vue-formatter": "^0.0.8",
......
...@@ -107,7 +107,14 @@ export default { ...@@ -107,7 +107,14 @@ export default {
// this.getwaitedListdata(id); // this.getwaitedListdata(id);
}, },
getwaitedListdata() { getwaitedListdata() {
this.$get("http://192.168.0.98:11078/base/site/siteTree").then((res) => {
let url=process.env.VUE_APP_SITETREE_URL=='undefined'?'http://192.168.0.98:11078/base/site/siteTree':process.env.VUE_APP_SITETREE_URL
console.log("url:"+url)
console.log("url:"+process.env.VUE_APP_SITETREE_URL)
this.$get(url).then((res) => {
console.log(res.data); console.log(res.data);
const { siteTree } = res.data; const { siteTree } = res.data;
this.sitelist = siteTree; this.sitelist = siteTree;
......
...@@ -471,6 +471,7 @@ export default { ...@@ -471,6 +471,7 @@ export default {
created() { created() {
// this.siteId = window.sessionStorage.getItem("siteid") || null // this.siteId = window.sessionStorage.getItem("siteid") || null
this.siteId = session.getSession("siteid") || null; this.siteId = session.getSession("siteid") || null;
console.log("cur siteId"+this.siteId)
let today = new Date(); let today = new Date();
let query = { let query = {
year: today.getFullYear(), year: today.getFullYear(),
...@@ -509,7 +510,9 @@ export default { ...@@ -509,7 +510,9 @@ export default {
this.pushChart.resize(); this.pushChart.resize();
}, },
syncDeviceStat() { syncDeviceStat() {
this.$post("/device/stat/syncDeviceStat", {})
this.$post("/device/stat/syncDeviceStat", {siteId:this.siteId})
.then((res) => { .then((res) => {
if (res.code == 1) { if (res.code == 1) {
this.statData = res.data.data[0]; this.statData = res.data.data[0];
......
...@@ -21,63 +21,6 @@ ...@@ -21,63 +21,6 @@
登陆 &copy; <a href="">信宏翔网络科技有限公司</a> 出品 登陆 &copy; <a href="">信宏翔网络科技有限公司</a> 出品
</div> </div>
<!-- <Map ref="map1" :markersData="originData" @choose="getDetailData" /> -->
<!-- <el-card :body-style="{ padding: '5px' }" style="width: 300px">
<el-row type="flex" class="row-bg" justify="space-around">
<span style="font-size: 18px"><b>高新区政务服务中心</b></span>
<el-button type="text" size="mini" class="button">查看详情</el-button>
</el-row>
<el-divider></el-divider>
<el-row type="flex" justify="space-around">
<el-col :span="4">
<span style="font-size: 13px"><b>100</b></span
><br />
<span style="font-size: 12px">设备总数</span>
</el-col>
<el-col :span="4">
<span style="font-size: 13px"><b>100</b></span
><br />
<span style="font-size: 12px">在线</span>
</el-col>
<el-col :span="4">
<span style="font-size: 13px"><b>100</b></span
><br />
<span style="font-size: 12px">离线</span>
</el-col>
<el-col :span="4">
<span style="font-size: 13px"><b>100</b></span
><br />
<span style="font-size: 12px">停用</span>
</el-col>
<el-col :span="4">
<span style="font-size: 13px"><b>100</b></span
><br />
<span style="font-size: 12px">待激活</span>
</el-col>
</el-row>
<el-divider></el-divider>
<el-descriptions :column="1" size="small">
<el-descriptions-item label="站点编码"
>kooriookami</el-descriptions-item
>
<el-descriptions-item label="站点地址"
>18100000000</el-descriptions-item
>
<el-descriptions-item
label="联系人"
:labelStyle="{ 'text-align': 'right', width: '50px' }"
>苏州市</el-descriptions-item
>
<el-descriptions-item label="联系电话">
<el-tag size="small">学校</el-tag>
</el-descriptions-item>
<el-descriptions-item label="创建时间"
>江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item
>
</el-descriptions>
</el-card> -->
</div> </div>
</template> </template>
......
...@@ -17,7 +17,8 @@ module.exports = { ...@@ -17,7 +17,8 @@ module.exports = {
hot: true,//自动保存 hot: true,//自动保存
proxy: { proxy: {
'/m': { '/m': {
target: 'http://192.168.0.98:11078', // target: 'http://192.168.0.98:11078',
target: 'http://127.0.0.1:18222',
changeOrigin: true, changeOrigin: true,
secure: false, secure: false,
cookieDomainRewrite: 'plm.testnew.com', cookieDomainRewrite: 'plm.testnew.com',
......
...@@ -23,31 +23,34 @@ ...@@ -23,31 +23,34 @@
<properties> <properties>
<profiles.active>develop</profiles.active> <profiles.active>develop</profiles.active>
<profiles.server.port>18222</profiles.server.port> <profiles.server.port>18222</profiles.server.port>
<profiles.queue.type>rabbitmq</profiles.queue.type> <profiles.queue.type></profiles.queue.type>
<profiles.datasource.uri> <profiles.datasource.uri>
<![CDATA[jdbc:mysql://localhost:3306/device-new-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri> <![CDATA[jdbc:mysql://localhost:3306/device-new-platform?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username> <profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>12345678</profiles.datasource.password> <profiles.datasource.password>12345678</profiles.datasource.password>
<profiles.redis.uri>192.168.0.252</profiles.redis.uri> <profiles.redis.uri>127.0.0.1</profiles.redis.uri>
<profiles.redis.port>6379</profiles.redis.port> <profiles.redis.port>6379</profiles.redis.port>
<profiles.redis.username></profiles.redis.username> <profiles.redis.username></profiles.redis.username>
<profiles.redis.password>hotel@2020</profiles.redis.password> <profiles.redis.password></profiles.redis.password>
<profiles.redis.database>7</profiles.redis.database> <profiles.redis.database>7</profiles.redis.database>
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers> <profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.queue.type>rabbitmq</profiles.queue.type> <profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.rabbitmq.host>192.168.0.98</profiles.rabbitmq.host> <profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username> <profiles.rabbitmq.username>guest</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password> <profiles.rabbitmq.password>guest</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/test</profiles.rabbitmq.virtualhost> <profiles.rabbitmq.virtualhost>/test</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.virtualhost1>/</profiles.rabbitmq.virtualhost1> <profiles.rabbitmq.virtualhost1>/</profiles.rabbitmq.virtualhost1>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange> <profiles.rabbitmq.exchange>amp.direct</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl>
<profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId>
<profiles.sms.type>3</profiles.sms.type>
<profiles.filepath>/mortals/app/data</profiles.filepath> <profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.log.level>DEBUG</profiles.log.level> <profiles.log.level>DEBUG</profiles.log.level>
<profiles.log.path>/logs</profiles.log.path> <profiles.log.path>/logs</profiles.log.path>
<profiles.data.path>/data</profiles.data.path> <profiles.data.path>/data</profiles.data.path>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr> <profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace> <profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
</properties> </properties>
...@@ -75,7 +78,10 @@ ...@@ -75,7 +78,10 @@
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password> <profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/test</profiles.rabbitmq.virtualhost> <profiles.rabbitmq.virtualhost>/test</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.virtualhost1>/</profiles.rabbitmq.virtualhost1> <profiles.rabbitmq.virtualhost1>/</profiles.rabbitmq.virtualhost1>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange> <profiles.rabbitmq.exchange>amp.direct</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl>
<profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId>
<profiles.sms.type>3</profiles.sms.type>
<profiles.filepath>/mortals/app/data</profiles.filepath> <profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.log.level>INFO</profiles.log.level> <profiles.log.level>INFO</profiles.log.level>
<profiles.data.path>/data</profiles.data.path> <profiles.data.path>/data</profiles.data.path>
......
...@@ -19,6 +19,7 @@ public class ManagerApplication extends BaseWebApplication { ...@@ -19,6 +19,7 @@ public class ManagerApplication extends BaseWebApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(ManagerApplication.class, args); SpringApplication.run(ManagerApplication.class, args);
} }
......
package com.mortals.xhx.base.framework.config; package com.mortals.xhx.base.framework.config;
import com.mortals.xhx.base.framework.listener.DirectDynamicListener;
import com.mortals.xhx.base.framework.listener.RabbitLoggingErrorHandler;
import com.mortals.xhx.base.framework.listener.SimpleDynamicListener; import com.mortals.xhx.base.framework.listener.SimpleDynamicListener;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.message.impl.MessageServiceImpl;
import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.AsyncRabbitTemplate; import org.springframework.amqp.rabbit.AsyncRabbitTemplate;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter; import org.springframework.amqp.support.converter.MessageConverter;
...@@ -15,11 +22,19 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,11 +22,19 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer; import org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
@Configuration @Configuration
@Order(1)
public class RabbitConfig { public class RabbitConfig {
@Autowired @Autowired
private SimpleDynamicListener simpleDynamicListener; private SimpleDynamicListener simpleDynamicListener;
@Autowired
private DirectDynamicListener directDynamicListener;
@Autowired
private RabbitLoggingErrorHandler rabbitLoggingErrorHandler;
@Autowired
private MessageProducer messageProducer;
//@Bean("simpleMessageListenerContainer") //@Bean("simpleMessageListenerContainer")
public SimpleMessageListenerContainer simpleMessageListenerContainer(CachingConnectionFactory cachingConnectionFactory) { public SimpleMessageListenerContainer simpleMessageListenerContainer(CachingConnectionFactory cachingConnectionFactory) {
...@@ -32,8 +47,41 @@ public class RabbitConfig { ...@@ -32,8 +47,41 @@ public class RabbitConfig {
return container; return container;
} }
@Bean
public DirectMessageListenerContainer messageListenerContainer(ConnectionFactory connectionFactory) {
DirectMessageListenerContainer container = new DirectMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
//后置处理器,接收到的消息都添加头信息
container.setAfterReceivePostProcessors(message -> {
message.getMessageProperties().setContentType("application/json");
return message;
});
//设置异常处理
container.setErrorHandler(rabbitLoggingErrorHandler);
// 并发消费,不使用
// container.setConsumersPerQueue(3);
// container.setMaxConcurrentConsumers(10);
// container.setMessageListener(directDynamicListener);
return container;
}
@Bean(name = "consumerBatchContainerFactory") @Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setReturnCallback(messageProducer);
rabbitTemplate.setConfirmCallback(messageProducer);
return rabbitTemplate;
}
@Bean
public RabbitAdmin rabbitAdmin(ConnectionFactory connectionFactory) {
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
return rabbitAdmin;
}
//@Bean(name = "consumerBatchContainerFactory")
public SimpleRabbitListenerContainerFactory consumerBatchContainerFactory( public SimpleRabbitListenerContainerFactory consumerBatchContainerFactory(
SimpleRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) { SimpleRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) {
// 创建 SimpleRabbitListenerContainerFactory 对象 // 创建 SimpleRabbitListenerContainerFactory 对象
...@@ -54,7 +102,7 @@ public class RabbitConfig { ...@@ -54,7 +102,7 @@ public class RabbitConfig {
} }
@Bean //@Bean
public AsyncRabbitTemplate asyncRabbitTemplate(RabbitTemplate rabbitTemplate) { public AsyncRabbitTemplate asyncRabbitTemplate(RabbitTemplate rabbitTemplate) {
AsyncRabbitTemplate asyncRabbitTemplate = new AsyncRabbitTemplate(rabbitTemplate); AsyncRabbitTemplate asyncRabbitTemplate = new AsyncRabbitTemplate(rabbitTemplate);
asyncRabbitTemplate.setReceiveTimeout(10000); asyncRabbitTemplate.setReceiveTimeout(10000);
......
...@@ -8,6 +8,7 @@ import com.mortals.framework.service.IUser; ...@@ -8,6 +8,7 @@ import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.common.code.PlatformTypeEnum;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
...@@ -54,6 +55,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -54,6 +55,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Value("${token.database:0}") @Value("${token.database:0}")
private Integer portalDb; private Integer portalDb;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
protected static final Long SECOND = 1l; protected static final Long SECOND = 1l;
protected static final Long SECOND_MINUTE = 60 * SECOND; protected static final Long SECOND_MINUTE = 60 * SECOND;
...@@ -86,10 +90,15 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -86,10 +90,15 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
String userKey = getTokenKey(uuid); String userKey = getTokenKey(uuid);
// Rest<String> rest = userFeign.getToken(userKey); // Rest<String> rest = userFeign.getToken(userKey);
// String userStr = rest.getData(); // String userStr = rest.getData();
cacheService.select(portalDb); String userStr = "";
String userStr = cacheService.get(userKey); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
cacheService.select(portalDb);
userStr = cacheService.get(userKey);
cacheService.select(db);
} else {
userStr = cacheService.get(userKey);
}
cacheService.select(db);
if (StringUtils.isNotEmpty(userStr)) { if (StringUtils.isNotEmpty(userStr)) {
UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class); UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class);
userEntity.setToken(token); userEntity.setToken(token);
......
...@@ -3,6 +3,7 @@ package com.mortals.xhx.base.framework.listener; ...@@ -3,6 +3,7 @@ package com.mortals.xhx.base.framework.listener;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.util.UuidUtil; import com.mortals.framework.util.UuidUtil;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
...@@ -32,7 +33,9 @@ import org.springframework.stereotype.Component; ...@@ -32,7 +33,9 @@ import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 离线通知 * 离线通知
...@@ -60,7 +63,6 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -60,7 +63,6 @@ public class CustomerKeyExpirationListener implements MessageListener {
@Autowired @Autowired
private ISmsSetFeign smsSetFeign; private ISmsSetFeign smsSetFeign;
@Override @Override
public void onMessage(Message message, byte[] bytes) { public void onMessage(Message message, byte[] bytes) {
String key = message.toString(); String key = message.toString();
...@@ -81,13 +83,11 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -81,13 +83,11 @@ public class CustomerKeyExpirationListener implements MessageListener {
} }
//保存离线告警消息 //保存离线告警消息
DeviceAlarmInfoEntity alarmInfoEntity = new DeviceAlarmInfoEntity(); DeviceAlarmInfoEntity alarmInfoEntity = new DeviceAlarmInfoEntity();
alarmInfoEntity.initAttrValue(); alarmInfoEntity.initAttrValue();
alarmInfoEntity.setAlarmDevice(deviceEntity.getId()); alarmInfoEntity.setAlarmDevice(deviceEntity.getId());
alarmInfoEntity.setSiteId(deviceEntity.getSiteId()); alarmInfoEntity.setSiteId(deviceEntity.getSiteId());
alarmInfoEntity.setAlarmContent(deviceEntity.getDeviceName() + "已离线!"); alarmInfoEntity.setAlarmContent(String.format("设备告警:%s设备:%s已离线,请注意检查!",productEntity.getProductName(),deviceEntity.getDeviceName()+":"+deviceEntity.getDeviceName() ));
alarmInfoEntity.setAlarmType(AlarmTypeEnum.离线.getValue()); alarmInfoEntity.setAlarmType(AlarmTypeEnum.离线.getValue());
alarmInfoEntity.setAlarmLevel(AlarmLevelEnum.一般.getValue()); alarmInfoEntity.setAlarmLevel(AlarmLevelEnum.一般.getValue());
alarmInfoEntity.setAlarmStatus(AlarmStatusEnum.未清除.getValue()); alarmInfoEntity.setAlarmStatus(AlarmStatusEnum.未清除.getValue());
...@@ -96,14 +96,11 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -96,14 +96,11 @@ public class CustomerKeyExpirationListener implements MessageListener {
alarmInfoEntity.setCreateTime(new Date()); alarmInfoEntity.setCreateTime(new Date());
alarmInfoEntity.setCreateUserId(1L); alarmInfoEntity.setCreateUserId(1L);
deviceAlarmInfoService.save(alarmInfoEntity); deviceAlarmInfoService.save(alarmInfoEntity);
// TODO: 2022/6/23 告警信息保存与发送 // TODO: 2022/6/23 告警信息保存与发送
AlarmConfigEntity alarmConfigEntity = alarmConfigService.selectOne(new AlarmConfigQuery().productId(productEntity.getId())); AlarmConfigEntity alarmConfigEntity = alarmConfigService.selectOne(new AlarmConfigQuery().productId(productEntity.getId()));
if (!ObjectUtils.isEmpty(alarmConfigEntity)) { if (!ObjectUtils.isEmpty(alarmConfigEntity)) {
if (alarmConfigEntity.getAlarmPusW1ay() == AlarmPusW1ayEnum.短信.getValue()) { if (alarmConfigEntity.getAlarmPusW1ay() == AlarmPusW1ayEnum.短信.getValue()) {
// TODO: 2022/7/4 发送短信 // TODO: 2022/7/4 发送短信
Rest<RespData<List<SmsSetPdu>>> respDataRest = smsSetFeign.list(new SmsSetPdu().siteId(deviceEntity.getSiteId())); Rest<RespData<List<SmsSetPdu>>> respDataRest = smsSetFeign.list(new SmsSetPdu().siteId(deviceEntity.getSiteId()));
if (respDataRest.getCode() == YesNoEnum.YES.getValue()) { if (respDataRest.getCode() == YesNoEnum.YES.getValue()) {
List<SmsSetPdu> data = respDataRest.getData().getData(); List<SmsSetPdu> data = respDataRest.getData().getData();
...@@ -111,7 +108,7 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -111,7 +108,7 @@ public class CustomerKeyExpirationListener implements MessageListener {
Integer messageoff = data.get(0).getMessageoff(); Integer messageoff = data.get(0).getMessageoff();
if (messageoff == YesNoEnum.YES.getValue()) { if (messageoff == YesNoEnum.YES.getValue()) {
// todo 发送短信 // todo 发送短信
//短信使用模板,如 设备告警:{产品}设备:{设备名称加编码}已离线,请注意检查!
DeviceAlarmInfoEntity deviceAlarmInfoEntity = deviceAlarmInfoService.selectOne(new DeviceAlarmInfoQuery().alarmDevice(deviceEntity.getId())); DeviceAlarmInfoEntity deviceAlarmInfoEntity = deviceAlarmInfoService.selectOne(new DeviceAlarmInfoQuery().alarmDevice(deviceEntity.getId()));
if (!ObjectUtils.isEmpty(deviceAlarmInfoEntity)) { if (!ObjectUtils.isEmpty(deviceAlarmInfoEntity)) {
AlarmSmsSendEntity alarmSmsSendEntity = new AlarmSmsSendEntity(); AlarmSmsSendEntity alarmSmsSendEntity = new AlarmSmsSendEntity();
...@@ -120,7 +117,10 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -120,7 +117,10 @@ public class CustomerKeyExpirationListener implements MessageListener {
alarmSmsSendEntity.setSiteId(deviceAlarmInfoEntity.getSiteId()); alarmSmsSendEntity.setSiteId(deviceAlarmInfoEntity.getSiteId());
alarmSmsSendEntity.setMobile(deviceAlarmInfoEntity.getReceivePersonnelTelephone()); alarmSmsSendEntity.setMobile(deviceAlarmInfoEntity.getReceivePersonnelTelephone());
alarmSmsSendEntity.setReceiver(deviceAlarmInfoEntity.getAlarmReceivePersonnel()); alarmSmsSendEntity.setReceiver(deviceAlarmInfoEntity.getAlarmReceivePersonnel());
alarmSmsSendEntity.setSendMess(deviceAlarmInfoEntity.getAlarmContent()); Map<String, String> map = new HashMap<>();
map.put("1",productEntity.getProductName());
map.put("2",deviceEntity.getDeviceName()+":"+deviceEntity.getDeviceName());
alarmSmsSendEntity.setSendMess(JSON.toJSONString(map));
alarmSmsSendEntity.setSendStatus(SendStatusEnum.未发送.getValue()); alarmSmsSendEntity.setSendStatus(SendStatusEnum.未发送.getValue());
alarmSmsSendService.save(alarmSmsSendEntity, null); alarmSmsSendService.save(alarmSmsSendEntity, null);
} }
......
package com.mortals.xhx.base.framework.listener;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.DefaultQueueMsg;
import com.mortals.xhx.common.utils.SendTask;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceLogEntity;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.queue.DefaultTbQueueMsg;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import static com.mortals.xhx.common.model.MessageHeader.DEVICECODE;
import static com.mortals.xhx.common.model.MessageHeader.MESSAGETYPE;
/**
* 设备上行消息处理
*
* @author: zxfei
* @date: 2022/8/23 0:32
* @description:
**/
@Slf4j
@Service
public class DirectDynamicListener implements MessageListener {
@Autowired
private DeviceLogService deviceLogService;
@Autowired
private DeviceService deviceService;
@Autowired
private ProductService productService;
@Autowired
private PlatformService platformService;
@Autowired
private SendTaskThreadPool sendTaskThreadPool;
@Autowired
private ICacheService cacheService;
@Override
public void onMessage(Message message) {
String queue = message.getMessageProperties().getConsumerQueue();
byte[] body = message.getBody();
String data = new String(body);
log.info("接收到:{} ,\n消息内容为:{}", queue, data);
DefaultQueueMsg queueMsg = JSON.parseObject(data, DefaultQueueMsg.class);
//做相应业务,做日志操作
String deviceCode = queueMsg.getHeaders().getData().get(DEVICECODE);
String messageType = queueMsg.getHeaders().getData().get(MESSAGETYPE);
try {
DeviceEntity deviceEntity = deviceService.getExtCache(deviceCode);
if (!ObjectUtils.isEmpty(deviceEntity)) {
cacheService.set(RedisKey.KEY_DEVICE_ONLINE_CACHE + deviceEntity.getDeviceCode(), "", GlobalSysInfo.getParamIntValue(Constant.HEARTBEAT_TIMEOUT, 120));
if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.离线.getValue()) {
deviceEntity.setOnlineTime(new Date());
deviceEntity.setDeviceStatus(DeviceStatusEnum.在线.getValue());
deviceService.update(deviceEntity);
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台
deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ONLINE);
}
}
if (!Constant.MESSAGETYPE_HEARTBEAT.equalsIgnoreCase(messageType)) {
DeviceLogEntity deviceLogEntity = new DeviceLogEntity();
deviceLogEntity.initAttrValue();
deviceLogEntity.setTraceID(IdUtil.fastSimpleUUID());
deviceLogEntity.setSiteId(deviceEntity.getSiteId());
deviceLogEntity.setDeviceId(deviceEntity.getId());
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode());
deviceLogEntity.setMessageHead(messageType);
deviceLogEntity.setContent(queueMsg.getData());
deviceLogEntity.setLogType(LogTypeEnum.上报事件.getValue());
deviceLogEntity.setCreateUserId(1L);
deviceLogEntity.setCreateTime(new Date());
deviceLogService.save(deviceLogEntity);
}
//获取exchange,
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
if (!Constant.MESSAGETYPE_HEARTBEAT.equalsIgnoreCase(messageType)
&& !ObjectUtils.isEmpty(platformEntity)
&& platformEntity.getSendSwitch() == YesNoEnum.YES.getValue()) {
if (platformEntity.getSendMsgType() == SendMsgTypeEnum.http.getValue() && !ObjectUtils.isEmpty(platformEntity.getSendUrl())) {
SendTask sendTask = new SendTask(platformEntity.getSendUrl(), queueMsg.getData());
sendTaskThreadPool.execute(sendTask);
}
}
}
} catch (Exception e) {
log.error("消费消息异常", e);
}
// log.info("接收到:" + queue + ",消息内容为:" + new String(body));
// //channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
// log.info(queue + "队列消息消费成功");
}
}
package com.mortals.xhx.base.framework.listener;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.ErrorHandler;
@Component
@Slf4j
public class RabbitLoggingErrorHandler implements ErrorHandler {
public RabbitLoggingErrorHandler(SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory) {
rabbitListenerContainerFactory.setErrorHandler(this);
}
@Override
public void handleError(Throwable t) {
log.error("[handleError][发生异常]]", t);
}
}
package com.mortals.xhx.base.login.web; package com.mortals.xhx.base.login.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.CookieService; import com.mortals.framework.ap.CookieService;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
...@@ -10,7 +9,6 @@ import com.mortals.framework.service.IAuthTokenService; ...@@ -10,7 +9,6 @@ import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil; import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.HttpUtil; import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
...@@ -24,9 +22,9 @@ import com.mortals.xhx.common.key.RedisKey; ...@@ -24,9 +22,9 @@ import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.user.UserPdu; import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.feign.user.IUserFeign; import com.mortals.xhx.feign.user.IUserFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log; import org.springframework.beans.factory.InitializingBean;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -43,7 +41,8 @@ import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT; ...@@ -43,7 +41,8 @@ import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
@RestController @RestController
@Slf4j @Slf4j
@RequestMapping("login") @RequestMapping("login")
public class LoginController extends BaseCRUDJsonBodyMappingController<UserService, UserEntity, Long> { @ConditionalOnExpression("'${platform.type:null}'=='cloud'")
public class LoginController extends BaseCRUDJsonBodyMappingController<UserService, UserEntity, Long> implements InitializingBean {
@Autowired @Autowired
private UserService userService; private UserService userService;
...@@ -280,4 +279,9 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -280,4 +279,9 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
} }
return null; return null;
} }
@Override
public void afterPropertiesSet() throws Exception {
log.info("初始化加载云服务版登录。。。");
}
} }
package com.mortals.xhx.base.login.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.CookieService;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.menu.service.MenuService;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.feign.user.IUserFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Set;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
@RestController
@Slf4j
@RequestMapping("login")
@ConditionalOnExpression("'${platform.type}'=='standalone'")
public class StandaloneLoginController extends BaseCRUDJsonBodyMappingController<UserService, UserEntity, Long> implements InitializingBean {
@Autowired
private UserService userService;
@Autowired
private ValidCodeService validCodeService;
@Autowired
private ResourceService resourceService;
@Autowired
private MenuService menuService;
// @Autowired
// private ITokenService tokenService;
@Autowired
private ICacheService cacheService;
@Autowired
private IAuthTokenService authTokenService;
@Autowired
private IUserFeign userFeign;
@RequestMapping("login")
public String login(@RequestBody LoginForm loginForm) throws Exception {
JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
//
// UserPdu userPdu = new UserPdu();
// userPdu.setLoginName(loginName);
// userPdu.setPassword(password);
// String resp = userFeign.portalLogin(userPdu);
//
// return resp;
String securityCode = loginForm.getSecurityCode();
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString();
}
UserEntity userEntity = null;
try {
loginForm.validate();
// boolean result = validCodeService.doCheckImageValidCode(request.getSession().getId(), ip, securityCode);
// if ("8888".equals(securityCode)) {
// result = true;
// }
// if (!result) {
// recordSysLog(request, userEntity, "登录验证码不正确或已过期!");
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// ret.put(KEY_RESULT_MSG, "登录验证码不正确或已过期!");
// return ret.toJSONString();
// }
userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip);
recordSysLog(request, userEntity, "用户登录系统成功!");
// 返回拥有的菜单数据
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
String currUserName = userEntity.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员";
}
JSONObject data = new JSONObject();
data.put("currUserName", currUserName);
data.put("barList", outlookBarList);
data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType());
userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
userEntity.setMenuUrl(generateMenuUrlCode(urls));
String token = authTokenService.createToken(userEntity);
data.put("token", token);
//设置token 和过期时间
//data.put("expiresTime", DateUtils.addCurrDate(7).getTime());
generateMenuUrlCode(urls);
//this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
return ret.toJSONString();
} catch (Exception e) {
log.error("login error ", e);
if (userEntity == null) {
userEntity = new UserEntity();
userEntity.setLoginName(loginName);
}
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
@RequestMapping("logout")
public void logout(HttpServletRequest request, HttpServletResponse response) throws Exception {
recordSysLog(request, "退出登录");
super.removeCurrUser(request);
this.deleteBlackCookie(request, response);
}
@RequestMapping("index")
public String index() throws Exception {
JSONObject ret = new JSONObject();
IUser user = this.getCurUser();
if (user == null) {
return JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT));
}
Set<String> urls = resourceService.findUrlSetByUserId(user.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(user, urls);
String currUserName = user.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员";
}
JSONObject data = new JSONObject();
String token = authTokenService.getToken(request);
data.put("token", token);
data.put("currUserName", currUserName);
data.put("barList", outlookBarList);
data.put("id", user.getId());
data.put("userType", user.getUserType());
ret.put(KEY_RESULT_DATA, data);
//this.generateBlackCookie(request, response, user.getLoginName(), urls);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
return ret.toJSONString();
}
private void generateBlackCookie(HttpServletRequest request, HttpServletResponse response, String loginName, Set<String> urls) {
try {
String cacheKey = RedisKey.KEY_MENU_CACHE + loginName;
String securityKey = GlobalSysInfo.getPropertyValue(SysConstains.PROP_COOKIE_SECURITY_KEY);
//应为Cookie会超长,所以改为仅存储key将值放入redis
//CookieService.setCookieForAuth(request, response, securityKey, null);
StringBuilder sb = new StringBuilder();
if (urls != null && urls.size() > 0) {
for (String url : urls) {
int index = url.hashCode() & (Integer.MAX_VALUE - 1);
sb.append(index).append(",");
}
}
String menuUrl = sb.toString();
menuUrl = AESUtil.encrypt(menuUrl, securityKey);
cacheService.set(cacheKey, menuUrl, 604800);
HttpUtil.setCookieValue(request, response, SysConstains.COOKIE_MENU, cacheKey, -1);
} catch (Throwable e) {
}
}
private String generateMenuUrlCode(Set<String> urls) {
try {
String securityKey = GlobalSysInfo.getPropertyValue(SysConstains.PROP_COOKIE_SECURITY_KEY);
StringBuilder sb = new StringBuilder();
if (urls != null && urls.size() > 0) {
for (String url : urls) {
int index = url.hashCode() & (Integer.MAX_VALUE - 1);
sb.append(index).append(",");
}
}
String menuUrl = sb.toString();
return AESUtil.encrypt(menuUrl, securityKey);
} catch (Throwable e) {
log.error("编码异常", e);
return null;
}
}
@RequestMapping("validcode")
public String validCode(HttpServletRequest request, HttpServletResponse response, LoginForm loginForm) {
JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "登录名或密码为空");
}
UserEntity user = null;
try {
user = userService.doCheckUser(loginName, password);
if (user == null) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "用户名或密码不正确");
} else if (StringUtils.isEmpty(user.getMobile())) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "用户无正确的手机号");
} else {
String mobile = StringUtils.trim(user.getMobile());
String sessionId = request.getSession().getId();
String ip = super.getRequestIP(request);
boolean result = validCodeService.createSmsValidCode(sessionId, ip, mobile);
if (result) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} else {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "验证码发送失败,请稍后在试!");
}
}
} catch (Exception e) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "验证码发送失败:" + super.convertException(e));
} finally {
if (user == null) {
user = new UserEntity();
user.setLoginName(loginName);
}
recordSysLog(request, user, "用户获取短信验证码");
}
return ret.toJSONString();
}
protected void deleteBlackCookie(HttpServletRequest request, HttpServletResponse response) {
try {
CookieService.deleteCookieForAuth(request, response);
} catch (Throwable e) {
}
}
@RequestMapping("parseToken")
public IUser parseToken() throws Exception {
IUser userEntity = authTokenService.getLoginUser(request);
if (!ObjectUtils.isEmpty(userEntity)) {
authTokenService.verifyToken(userEntity);
return userEntity;
}
return null;
}
@Override
public void afterPropertiesSet() throws Exception {
log.info("初始化加载单机版登录。。。");
}
}
/**
* 文件:AreaDao.java<br/>
* 版本:1.0.0<br/>
* 日期:2019-03-14<br/>
* Copyright &reg; www.sccoopskj.com<br/>
* All right reserved.
*/
package com.mortals.xhx.base.system.area.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.base.system.area.model.AreaEntity;
/**
* Title: 区域信息 <br/>
* Description: AreaDao DAO接口 <br/>
* Copyright: Copyright &reg; www.sccoopskj.com <br/>
* Company: www.sccoopskj.com
*
* @author
* @version 1.0.0
*/
public interface AreaDao extends ICRUDDao<AreaEntity,Long>{
}
\ No newline at end of file
/**
* 文件:AreaEntity.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.area.model;
import java.util.Date;
import com.mortals.framework.model.BaseEntityLong;
/**
* <p>Title: 区域信息</p>
* <p>Description: AreaEntity </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public class AreaEntity extends BaseEntityLong{
private static final long serialVersionUID = 1556594630661L;
/** 上级区域ID */
private Long parentId;
/** 区域名称 */
private String name;
/** 区域级别,按所处树的节点层次 */
private Integer level;
/** 区域编码,按全国省市编码 */
private String code;
/** 区域负责人 */
private String contactsPeople;
/** 区域负责人电话 */
private String contactsMobile;
/** 子区域数量,默认0 */
private Integer childSize;
/** 子区域的最大ID,默认0 */
private Integer maxChildId;
/** 状态,0停用,1启用,默认1 */
private Integer status;
/** 描述 */
private String remark;
/** 创建时间 */
private Date createTime;
/** 更新时间 */
private Date updateTime;
/** 创建用户ID */
private Long createUserId;
/** 创建用户名称 */
private String createUserName;
public AreaEntity(){
}
/**
* 获取 上级区域ID
* @return parentId
*/
public Long getParentId(){
return this.parentId;
}
/**
* 设置 上级区域ID
* @param parentId
*/
public void setParentId(Long parentId){
this.parentId = parentId;
}
/**
* 获取 区域名称
* @return name
*/
public String getName(){
return this.name;
}
/**
* 设置 区域名称
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 区域级别,按所处树的节点层次
* @return level
*/
public Integer getLevel(){
return this.level;
}
/**
* 设置 区域级别,按所处树的节点层次
* @param level
*/
public void setLevel(Integer level){
this.level = level;
}
/**
* 获取 区域编码,按全国省市编码
* @return code
*/
public String getCode(){
return this.code;
}
/**
* 设置 区域编码,按全国省市编码
* @param code
*/
public void setCode(String code){
this.code = code;
}
/**
* 获取 区域负责人
* @return contactsPeople
*/
public String getContactsPeople(){
return this.contactsPeople;
}
/**
* 设置 区域负责人
* @param contactsPeople
*/
public void setContactsPeople(String contactsPeople){
this.contactsPeople = contactsPeople;
}
/**
* 获取 区域负责人电话
* @return contactsMobile
*/
public String getContactsMobile(){
return this.contactsMobile;
}
/**
* 设置 区域负责人电话
* @param contactsMobile
*/
public void setContactsMobile(String contactsMobile){
this.contactsMobile = contactsMobile;
}
/**
* 获取 子区域数量,默认0
* @return childSize
*/
public Integer getChildSize(){
return this.childSize;
}
/**
* 设置 子区域数量,默认0
* @param childSize
*/
public void setChildSize(Integer childSize){
this.childSize = childSize;
}
/**
* 获取 子区域的最大ID,默认0
* @return maxChildId
*/
public Integer getMaxChildId(){
return this.maxChildId;
}
/**
* 设置 子区域的最大ID,默认0
* @param maxChildId
*/
public void setMaxChildId(Integer maxChildId){
this.maxChildId = maxChildId;
}
/**
* 获取 状态,0停用,1启用,默认1
* @return status
*/
public Integer getStatus(){
return this.status;
}
/**
* 设置 状态,0停用,1启用,默认1
* @param status
*/
public void setStatus(Integer status){
this.status = status;
}
/**
* 获取 描述
* @return remark
*/
public String getRemark(){
return this.remark;
}
/**
* 设置 描述
* @param remark
*/
public void setRemark(String remark){
this.remark = remark;
}
/**
* 获取 创建时间
* @return createTime
*/
public Date getCreateTime(){
return this.createTime;
}
/**
* 设置 创建时间
* @param createTime
*/
public void setCreateTime(Date createTime){
this.createTime = createTime;
}
/**
* 获取 更新时间
* @return updateTime
*/
public Date getUpdateTime(){
return this.updateTime;
}
/**
* 设置 更新时间
* @param updateTime
*/
public void setUpdateTime(Date updateTime){
this.updateTime = updateTime;
}
/**
* 获取 创建用户ID
* @return createUserId
*/
public Long getCreateUserId(){
return this.createUserId;
}
/**
* 设置 创建用户ID
* @param createUserId
*/
public void setCreateUserId(Long createUserId){
this.createUserId = createUserId;
}
/**
* 获取 创建用户名称
* @return createUserName
*/
public String getCreateUserName(){
return this.createUserName;
}
/**
* 设置 创建用户名称
* @param createUserName
*/
public void setCreateUserName(String createUserName){
this.createUserName = createUserName;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj instanceof AreaEntity) {
AreaEntity tmp = (AreaEntity) obj;
if (this.getId().longValue() == tmp.getId().longValue()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append("id:").append(getId())
.append(",parentId:").append(getParentId())
.append(",name:").append(getName())
.append(",level:").append(getLevel())
.append(",code:").append(getCode())
.append(",contactsPeople:").append(getContactsPeople())
.append(",contactsMobile:").append(getContactsMobile())
.append(",childSize:").append(getChildSize())
.append(",maxChildId:").append(getMaxChildId())
.append(",status:").append(getStatus())
.append(",remark:").append(getRemark())
.append(",createTime:").append(getCreateTime())
.append(",updateTime:").append(getUpdateTime())
.append(",createUserId:").append(getCreateUserId())
.append(",createUserName:").append(getCreateUserName());
return sb.toString();
}
public void initAttrValue(){
this.parentId = null;
this.name = null;
this.level = null;
this.code = null;
this.contactsPeople = null;
this.contactsMobile = null;
this.childSize = 0;
this.maxChildId = 0;
this.status = 1;
this.remark = null;
this.createTime = null;
this.updateTime = null;
this.createUserId = null;
this.createUserName = null;
}
}
\ No newline at end of file
/**
* 文件:AreaQuery.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.area.model;
import java.util.List;
/**
* <p>Title: 区域信息</p>
* <p>Description: AreaQuery </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public class AreaQuery extends AreaEntity{
private static final long serialVersionUID = 1556594630661L;
/** 开始 区域ID,主键,自增长 */
private Long idStart;
/** 结束 区域ID,主键,自增长 */
private Long idEnd;
/** 增加 区域ID,主键,自增长 */
private Long idIncrement;
/** 区域ID,主键,自增长 */
private List<Long> idList;
/** 开始 上级区域ID */
private Long parentIdStart;
/** 结束 上级区域ID */
private Long parentIdEnd;
/** 增加 上级区域ID */
private Long parentIdIncrement;
/** 上级区域ID */
private List<Long> parentIdList;
/** 区域名称 */
private List<String> nameList;
/** 开始 区域级别,按所处树的节点层次 */
private Integer levelStart;
/** 结束 区域级别,按所处树的节点层次 */
private Integer levelEnd;
/** 增加 区域级别,按所处树的节点层次 */
private Integer levelIncrement;
/** 区域级别,按所处树的节点层次 */
private List<Integer> levelList;
/** 区域编码,按全国省市编码 */
private List<String> codeList;
/** 区域负责人 */
private List<String> contactsPeopleList;
/** 区域负责人电话 */
private List<String> contactsMobileList;
/** 开始 子区域数量,默认0 */
private Integer childSizeStart;
/** 结束 子区域数量,默认0 */
private Integer childSizeEnd;
/** 增加 子区域数量,默认0 */
private Integer childSizeIncrement;
/** 子区域数量,默认0 */
private List<Integer> childSizeList;
/** 开始 子区域的最大ID,默认0 */
private Integer maxChildIdStart;
/** 结束 子区域的最大ID,默认0 */
private Integer maxChildIdEnd;
/** 增加 子区域的最大ID,默认0 */
private Integer maxChildIdIncrement;
/** 子区域的最大ID,默认0 */
private List<Integer> maxChildIdList;
/** 开始 状态,0停用,1启用,默认1 */
private Integer statusStart;
/** 结束 状态,0停用,1启用,默认1 */
private Integer statusEnd;
/** 增加 状态,0停用,1启用,默认1 */
private Integer statusIncrement;
/** 状态,0停用,1启用,默认1 */
private List<Integer> statusList;
/** 描述 */
private List<String> remarkList;
/** 开始 创建时间 */
private String createTimeStart;
/** 结束 创建时间 */
private String createTimeEnd;
/** 开始 更新时间 */
private String updateTimeStart;
/** 结束 更新时间 */
private String updateTimeEnd;
/** 开始 创建用户ID */
private Long createUserIdStart;
/** 结束 创建用户ID */
private Long createUserIdEnd;
/** 增加 创建用户ID */
private Long createUserIdIncrement;
/** 创建用户ID */
private List<Long> createUserIdList;
/** 创建用户名称 */
private List<String> createUserNameList;
public AreaQuery(){
}
/**
* 获取 开始 区域ID,主键,自增长
* @return idStart
*/
public Long getIdStart(){
return this.idStart;
}
/**
* 设置 开始 区域ID,主键,自增长
* @param idStart
*/
public void setIdStart(Long idStart){
this.idStart = idStart;
}
/**
* 获取 结束 区域ID,主键,自增长
* @return idEnd
*/
public Long getIdEnd(){
return this.idEnd;
}
/**
* 设置 结束 区域ID,主键,自增长
* @param idEnd
*/
public void setIdEnd(Long idEnd){
this.idEnd = idEnd;
}
/**
* 获取 增加 区域ID,主键,自增长
* @return idIncrement
*/
public Long getIdIncrement(){
return this.idIncrement;
}
/**
* 设置 增加 区域ID,主键,自增长
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement){
this.idIncrement = idIncrement;
}
/**
* 获取 区域ID,主键,自增长
* @return idList
*/
public List<Long> getIdList(){
return this.idList;
}
/**
* 设置 区域ID,主键,自增长
* @param idList
*/
public void setIdList(List<Long> idList){
this.idList = idList;
}
/**
* 获取 开始 上级区域ID
* @return parentIdStart
*/
public Long getParentIdStart(){
return this.parentIdStart;
}
/**
* 设置 开始 上级区域ID
* @param parentIdStart
*/
public void setParentIdStart(Long parentIdStart){
this.parentIdStart = parentIdStart;
}
/**
* 获取 结束 上级区域ID
* @return parentIdEnd
*/
public Long getParentIdEnd(){
return this.parentIdEnd;
}
/**
* 设置 结束 上级区域ID
* @param parentIdEnd
*/
public void setParentIdEnd(Long parentIdEnd){
this.parentIdEnd = parentIdEnd;
}
/**
* 获取 增加 上级区域ID
* @return parentIdIncrement
*/
public Long getParentIdIncrement(){
return this.parentIdIncrement;
}
/**
* 设置 增加 上级区域ID
* @param parentIdIncrement
*/
public void setParentIdIncrement(Long parentIdIncrement){
this.parentIdIncrement = parentIdIncrement;
}
/**
* 获取 上级区域ID
* @return parentIdList
*/
public List<Long> getParentIdList(){
return this.parentIdList;
}
/**
* 设置 上级区域ID
* @param parentIdList
*/
public void setParentIdList(List<Long> parentIdList){
this.parentIdList = parentIdList;
}
/**
* 获取 区域名称
* @return nameList
*/
public List<String> getNameList(){
return this.nameList;
}
/**
* 设置 区域名称
* @param nameList
*/
public void setNameList(List<String> nameList){
this.nameList = nameList;
}
/**
* 获取 开始 区域级别,按所处树的节点层次
* @return levelStart
*/
public Integer getLevelStart(){
return this.levelStart;
}
/**
* 设置 开始 区域级别,按所处树的节点层次
* @param levelStart
*/
public void setLevelStart(Integer levelStart){
this.levelStart = levelStart;
}
/**
* 获取 结束 区域级别,按所处树的节点层次
* @return levelEnd
*/
public Integer getLevelEnd(){
return this.levelEnd;
}
/**
* 设置 结束 区域级别,按所处树的节点层次
* @param levelEnd
*/
public void setLevelEnd(Integer levelEnd){
this.levelEnd = levelEnd;
}
/**
* 获取 增加 区域级别,按所处树的节点层次
* @return levelIncrement
*/
public Integer getLevelIncrement(){
return this.levelIncrement;
}
/**
* 设置 增加 区域级别,按所处树的节点层次
* @param levelIncrement
*/
public void setLevelIncrement(Integer levelIncrement){
this.levelIncrement = levelIncrement;
}
/**
* 获取 区域级别,按所处树的节点层次
* @return levelList
*/
public List<Integer> getLevelList(){
return this.levelList;
}
/**
* 设置 区域级别,按所处树的节点层次
* @param levelList
*/
public void setLevelList(List<Integer> levelList){
this.levelList = levelList;
}
/**
* 获取 区域编码,按全国省市编码
* @return codeList
*/
public List<String> getCodeList(){
return this.codeList;
}
/**
* 设置 区域编码,按全国省市编码
* @param codeList
*/
public void setCodeList(List<String> codeList){
this.codeList = codeList;
}
/**
* 获取 区域负责人
* @return contactsPeopleList
*/
public List<String> getContactsPeopleList(){
return this.contactsPeopleList;
}
/**
* 设置 区域负责人
* @param contactsPeopleList
*/
public void setContactsPeopleList(List<String> contactsPeopleList){
this.contactsPeopleList = contactsPeopleList;
}
/**
* 获取 区域负责人电话
* @return contactsMobileList
*/
public List<String> getContactsMobileList(){
return this.contactsMobileList;
}
/**
* 设置 区域负责人电话
* @param contactsMobileList
*/
public void setContactsMobileList(List<String> contactsMobileList){
this.contactsMobileList = contactsMobileList;
}
/**
* 获取 开始 子区域数量,默认0
* @return childSizeStart
*/
public Integer getChildSizeStart(){
return this.childSizeStart;
}
/**
* 设置 开始 子区域数量,默认0
* @param childSizeStart
*/
public void setChildSizeStart(Integer childSizeStart){
this.childSizeStart = childSizeStart;
}
/**
* 获取 结束 子区域数量,默认0
* @return childSizeEnd
*/
public Integer getChildSizeEnd(){
return this.childSizeEnd;
}
/**
* 设置 结束 子区域数量,默认0
* @param childSizeEnd
*/
public void setChildSizeEnd(Integer childSizeEnd){
this.childSizeEnd = childSizeEnd;
}
/**
* 获取 增加 子区域数量,默认0
* @return childSizeIncrement
*/
public Integer getChildSizeIncrement(){
return this.childSizeIncrement;
}
/**
* 设置 增加 子区域数量,默认0
* @param childSizeIncrement
*/
public void setChildSizeIncrement(Integer childSizeIncrement){
this.childSizeIncrement = childSizeIncrement;
}
/**
* 获取 子区域数量,默认0
* @return childSizeList
*/
public List<Integer> getChildSizeList(){
return this.childSizeList;
}
/**
* 设置 子区域数量,默认0
* @param childSizeList
*/
public void setChildSizeList(List<Integer> childSizeList){
this.childSizeList = childSizeList;
}
/**
* 获取 开始 子区域的最大ID,默认0
* @return maxChildIdStart
*/
public Integer getMaxChildIdStart(){
return this.maxChildIdStart;
}
/**
* 设置 开始 子区域的最大ID,默认0
* @param maxChildIdStart
*/
public void setMaxChildIdStart(Integer maxChildIdStart){
this.maxChildIdStart = maxChildIdStart;
}
/**
* 获取 结束 子区域的最大ID,默认0
* @return maxChildIdEnd
*/
public Integer getMaxChildIdEnd(){
return this.maxChildIdEnd;
}
/**
* 设置 结束 子区域的最大ID,默认0
* @param maxChildIdEnd
*/
public void setMaxChildIdEnd(Integer maxChildIdEnd){
this.maxChildIdEnd = maxChildIdEnd;
}
/**
* 获取 增加 子区域的最大ID,默认0
* @return maxChildIdIncrement
*/
public Integer getMaxChildIdIncrement(){
return this.maxChildIdIncrement;
}
/**
* 设置 增加 子区域的最大ID,默认0
* @param maxChildIdIncrement
*/
public void setMaxChildIdIncrement(Integer maxChildIdIncrement){
this.maxChildIdIncrement = maxChildIdIncrement;
}
/**
* 获取 子区域的最大ID,默认0
* @return maxChildIdList
*/
public List<Integer> getMaxChildIdList(){
return this.maxChildIdList;
}
/**
* 设置 子区域的最大ID,默认0
* @param maxChildIdList
*/
public void setMaxChildIdList(List<Integer> maxChildIdList){
this.maxChildIdList = maxChildIdList;
}
/**
* 获取 开始 状态,0停用,1启用,默认1
* @return statusStart
*/
public Integer getStatusStart(){
return this.statusStart;
}
/**
* 设置 开始 状态,0停用,1启用,默认1
* @param statusStart
*/
public void setStatusStart(Integer statusStart){
this.statusStart = statusStart;
}
/**
* 获取 结束 状态,0停用,1启用,默认1
* @return statusEnd
*/
public Integer getStatusEnd(){
return this.statusEnd;
}
/**
* 设置 结束 状态,0停用,1启用,默认1
* @param statusEnd
*/
public void setStatusEnd(Integer statusEnd){
this.statusEnd = statusEnd;
}
/**
* 获取 增加 状态,0停用,1启用,默认1
* @return statusIncrement
*/
public Integer getStatusIncrement(){
return this.statusIncrement;
}
/**
* 设置 增加 状态,0停用,1启用,默认1
* @param statusIncrement
*/
public void setStatusIncrement(Integer statusIncrement){
this.statusIncrement = statusIncrement;
}
/**
* 获取 状态,0停用,1启用,默认1
* @return statusList
*/
public List<Integer> getStatusList(){
return this.statusList;
}
/**
* 设置 状态,0停用,1启用,默认1
* @param statusList
*/
public void setStatusList(List<Integer> statusList){
this.statusList = statusList;
}
/**
* 获取 描述
* @return remarkList
*/
public List<String> getRemarkList(){
return this.remarkList;
}
/**
* 设置 描述
* @param remarkList
*/
public void setRemarkList(List<String> remarkList){
this.remarkList = remarkList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
*/
public String getCreateTimeStart(){
return this.createTimeStart;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public void setCreateTimeStart(String createTimeStart){
this.createTimeStart = createTimeStart;
}
/**
* 获取 结束 创建时间
* @return createTimeEnd
*/
public String getCreateTimeEnd(){
return this.createTimeEnd;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public void setCreateTimeEnd(String createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
/**
* 获取 开始 更新时间
* @return updateTimeStart
*/
public String getUpdateTimeStart(){
return this.updateTimeStart;
}
/**
* 设置 开始 更新时间
* @param updateTimeStart
*/
public void setUpdateTimeStart(String updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
/**
* 获取 结束 更新时间
* @return updateTimeEnd
*/
public String getUpdateTimeEnd(){
return this.updateTimeEnd;
}
/**
* 设置 结束 更新时间
* @param updateTimeEnd
*/
public void setUpdateTimeEnd(String updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 开始 创建用户ID
* @return createUserIdStart
*/
public Long getCreateUserIdStart(){
return this.createUserIdStart;
}
/**
* 设置 开始 创建用户ID
* @param createUserIdStart
*/
public void setCreateUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
}
/**
* 获取 结束 创建用户ID
* @return createUserIdEnd
*/
public Long getCreateUserIdEnd(){
return this.createUserIdEnd;
}
/**
* 设置 结束 创建用户ID
* @param createUserIdEnd
*/
public void setCreateUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
}
/**
* 获取 增加 创建用户ID
* @return createUserIdIncrement
*/
public Long getCreateUserIdIncrement(){
return this.createUserIdIncrement;
}
/**
* 设置 增加 创建用户ID
* @param createUserIdIncrement
*/
public void setCreateUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
}
/**
* 获取 创建用户ID
* @return createUserIdList
*/
public List<Long> getCreateUserIdList(){
return this.createUserIdList;
}
/**
* 设置 创建用户ID
* @param createUserIdList
*/
public void setCreateUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
}
/**
* 获取 创建用户名称
* @return createUserNameList
*/
public List<String> getCreateUserNameList(){
return this.createUserNameList;
}
/**
* 设置 创建用户名称
* @param createUserNameList
*/
public void setCreateUserNameList(List<String> createUserNameList){
this.createUserNameList = createUserNameList;
}
}
\ No newline at end of file
/**
* 文件:AreaService.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.area.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.base.system.area.model.AreaEntity;
/**
* <p>Title: 区域信息</p>
* <p>Description: AreaService service接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public interface AreaService extends ICRUDService<AreaEntity,Long>{
/**
* 格式化areaId
* @param areaId
* @return
*/
Long formatAreaId(Long areaId);
}
\ No newline at end of file
/**
* 文件:AreaServiceImpl.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.area.service.impl;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.area.dao.AreaDao;
import com.mortals.xhx.base.system.area.model.AreaEntity;
import com.mortals.xhx.base.system.area.service.AreaService;
/**
* <p>Title: 区域信息</p>
* <p>Description: AreaServiceImpl service接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
@Service("areaService")
public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao,AreaEntity,Long> implements AreaService {
/**
* 格式化区域ID
* @param areaId
* @return
*/
@Override
public Long formatAreaId(Long areaId) {
Long id = areaId;
if(id != null){
String area = String.valueOf(id);
if(area.endsWith("00")){
area = area.substring(0, 4);
}
if(area.endsWith("00")){
area = area.substring(0, 2);
}
id = (Long.valueOf(area));
}
return id;
}
}
\ No newline at end of file
/**
* 文件:AreaController.java 版本:1.0.0 日期: Copyright &reg; All right reserved.
*/
package com.mortals.xhx.base.system.area.web;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.code.YesNo;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.area.model.AreaEntity;
import com.mortals.xhx.base.system.area.service.AreaService;
import com.mortals.xhx.common.code.AreaLevelEnum;
/**
* <p>
* Title: 区域信息
* </p>
* <p>
* Description: AreaController
* </p>
* <p>
* Copyright: Copyright &reg;
* </p>
* <p>
* Company:
* </p>
* @author
* @version 1.0.0
*/
@RestController
@RequestMapping("area")
public class AreaController extends BaseCRUDJsonMappingController<AreaService, AreaForm, AreaEntity, Long> {
public AreaController() {
super.setFormClass(AreaForm.class);
super.setModuleDesc("区域信息");
}
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, AreaForm form,
Map<String, Object> model, Context context) {
this.addDict(model, "level", IBaseEnum.getEnumMap(AreaLevelEnum.class));
this.addDict(model, "status", IBaseEnum.getEnumMap(YesNo.class));
super.init(request, response, form, model, context);
}
@Override
protected void doListBefore(HttpServletRequest request, HttpServletResponse response, AreaForm form, Map<String, Object> model, Context context) throws AppException {
if (form.getQuery().getStatus() == null) {
form.getQuery().setStatus(YesNo.YES.getValue());
}
if(StringUtils.isEmpty(form.getQuery().getName())){
form.getQuery().setLevel(AreaLevelEnum.PROVINCE.getValue());
}
}
/**
* 根据parentId查询区域信息
*/
@PostMapping(value="getAreaByParentId")
public String getAreaByParentId(HttpServletRequest request, HttpServletResponse response, AreaForm form) {
JSONObject ret = new JSONObject();
Context context = getContext();
try{
List<JSONObject> list = new ArrayList<>();
PageInfo pageInfo = form.getPageInfo();
Result<AreaEntity> result = service.find(form.getQuery(), form.getPageInfo(), context);
pageInfo = result.getPageInfo();
List<AreaEntity> areaList = result.getList();
for(AreaEntity area : areaList){
JSONObject json = new JSONObject();
json.put("id", area.getId());
json.put("parentId", area.getParentId());
json.put("name", area.getName());
json.put("level", area.getLevel());
json.put("code", area.getCode());
json.put("contactsPeople", area.getContactsPeople());
json.put("contactsMobile", area.getContactsMobile());
json.put("remark", area.getRemark());
list.add(json);
}
JSONObject data = new JSONObject();
data.put(SysConstains.RESULT_KEY, list);
data.put(SysConstains.PAGEINFO_KEY, pageInfo);
init(request, response, form, data, context);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_DATA, data);
}catch(Exception e){
log.error("根据parentId查询区域信息错误", e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, e.getMessage());
}
return ret.toJSONString();
}
@PostMapping(value = "getAllAreaList")
public String getAllAreaList(HttpServletRequest request, HttpServletResponse response, AreaForm form) {
try{
return super.list(form);
}catch(Exception e){
log.error("查询所有区域信息列表错误",e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
}
\ No newline at end of file
/**
* 文件:AreaForm.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.area.web;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.base.system.area.model.AreaEntity;
import com.mortals.xhx.base.system.area.model.AreaQuery;
/**
* <p>Title: 区域信息</p>
* <p>Description: AreaForm </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public class AreaForm extends BaseCRUDFormLong<AreaEntity> {
private AreaEntity entity = new AreaEntity();
private AreaQuery query = new AreaQuery();
public AreaForm(){
}
@Override
public AreaEntity getEntity() {
return entity;
}
public void setEntity(AreaEntity entity) {
this.entity = entity;
}
@Override
public AreaQuery getQuery() {
return query;
}
public void setQuery(AreaQuery query) {
this.query = query;
}
}
\ No newline at end of file
...@@ -23,6 +23,7 @@ public interface MessageService { ...@@ -23,6 +23,7 @@ public interface MessageService {
/** /**
* 请求队列 * 请求队列
*
* @param info * @param info
* @param callback * @param callback
*/ */
...@@ -32,22 +33,23 @@ public interface MessageService { ...@@ -32,22 +33,23 @@ public interface MessageService {
/** /**
* 删除队列 * 删除队列
*/ */
void delQueue(String queue,TbQueueCallback callback); void delQueue(String queue, TbQueueCallback callback);
/** /**
* 获取鉴权token * 获取鉴权token
*
*/ */
String getBasePlatformToken(); String getBasePlatformToken();
/** /**
* 获取站点树 * 获取站点树
*
* @return * @return
*/ */
String siteTree(); String siteTree();
/** /**
* 发送第三方平台crud消息 * 发送第三方平台crud消息
*
* @param sendUrl * @param sendUrl
* @param deviceReq * @param deviceReq
* @return * @return
...@@ -57,6 +59,7 @@ public interface MessageService { ...@@ -57,6 +59,7 @@ public interface MessageService {
/** /**
* 发送第三方平台四二班透传消息 * 发送第三方平台四二班透传消息
*
* @param sendUrl * @param sendUrl
* @param content * @param content
* @return * @return
......
package com.mortals.xhx.base.system.message;
import com.mortals.xhx.busiz.req.DeviceReq;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.queue.TbQueueCallback;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
public interface RabbitMessageService extends RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback {
/**
* 发送消息
*
* @author: zxfei
* @date: 2022/9/2 11:31
*/
void sendMsg(String exchange, String routingKey, String message);
/**
* 新增队列并绑定交换机与路由
*
* @param exchange
* @param routingKey
* @param queue
*/
void queueAddAndBinds(String exchange, String routingKey, String queue);
/**
* 删除队列
*
* @param queue
*/
Boolean queueDelete(String queue);
}
\ No newline at end of file
package com.mortals.xhx.base.system.message; package com.mortals.xhx.base.system.message.impl;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.AccessLogPdu; import com.mortals.framework.model.AccessLogPdu;
import com.mortals.framework.model.BizLogPdu; import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.ErrorLogPdu; import com.mortals.framework.model.ErrorLogPdu;
import com.mortals.framework.model.OperateLogPdu; import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.IMessageProduceService; import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.base.system.message.RabbitMessageService;
import com.mortals.xhx.common.key.QueueKey; import com.mortals.xhx.common.key.QueueKey;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component @Component
@Primary
@Slf4j @Slf4j
public class MessageProducer implements IMessageProduceService { public class MessageProducer implements IMessageProduceService, RabbitMessageService, InitializingBean {
@Autowired @Autowired
private RabbitTemplate rabbitTemplate; private RabbitTemplate rabbitTemplate;
@Autowired
private RabbitAdmin rabbitAdmin;
public void syncAccessSend(AccessLogPdu accessLogPdu) { public void syncAccessSend(AccessLogPdu accessLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu)); rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu));
...@@ -33,14 +46,56 @@ public class MessageProducer implements IMessageProduceService { ...@@ -33,14 +46,56 @@ public class MessageProducer implements IMessageProduceService {
@Override @Override
public void syncErrorSend(ErrorLogPdu errorLogPdu) { public void syncErrorSend(ErrorLogPdu errorLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu)); rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu));
} }
@Override @Override
public void syncOperSend(OperateLogPdu operLogPdu) { public void syncOperSend(OperateLogPdu operLogPdu) {
log.info("operLogInfo==>{}",JSON.toJSONString(operLogPdu));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu)); rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu));
}
@Override
public void sendMsg(String exchange, String routingKey, String message) {
CorrelationData correlationData = new CorrelationData(IdUtil.fastSimpleUUID());
rabbitTemplate.convertAndSend(exchange, routingKey, message, correlationData);
// rabbitTemplate.send(exchange,routingKey,);
} }
@Override
public void queueAddAndBinds(String exchange, String routingKey, String queue) {
Map<String, Object> args = new HashMap<>();
args.put("x-message-ttl", 86400000);
Queue rabbitQueue = new Queue(queue, true, false, false, args);
DirectExchange directExchange = new DirectExchange(exchange);
rabbitAdmin.declareQueue(rabbitQueue);
rabbitAdmin.declareBinding(
BindingBuilder.bind(rabbitQueue)
.to(directExchange)
.with(routingKey)
);
log.debug("队列创建绑定成功,queue:{}", queue);
}
@Override
public Boolean queueDelete(String queue) {
return rabbitAdmin.deleteQueue(queue);
}
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
}
@Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
}
@Override
public void afterPropertiesSet() throws Exception {
System.out.println(111);
}
} }
...@@ -6,8 +6,9 @@ import com.alibaba.fastjson.JSON; ...@@ -6,8 +6,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.*;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.HttpUtil; import com.mortals.framework.util.HttpUtil;
...@@ -22,6 +23,7 @@ import com.mortals.xhx.common.code.DeviceMethodEnum; ...@@ -22,6 +23,7 @@ import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.MessageTypeEnum; import com.mortals.xhx.common.code.MessageTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders; import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader; import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.utils.SendTask; import com.mortals.xhx.common.utils.SendTask;
...@@ -31,11 +33,22 @@ import com.mortals.xhx.module.device.model.DeviceEntity; ...@@ -31,11 +33,22 @@ import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.service.DeviceService; import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.queue.*; import com.mortals.xhx.queue.*;
import com.mortals.xhx.queue.provider.TbCoreQueueProducerProvider; import com.mortals.xhx.queue.provider.TbCoreQueueProducerProvider;
import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -56,7 +69,7 @@ import static com.mortals.xhx.common.key.Constant.PATH_SITETREE; ...@@ -56,7 +69,7 @@ import static com.mortals.xhx.common.key.Constant.PATH_SITETREE;
*/ */
@Service("messageService") @Service("messageService")
@Slf4j @Slf4j
public class MessageServiceImpl implements MessageService { public class MessageServiceImpl implements MessageService{
@Value("${baseplatform.httpUrl:''}") @Value("${baseplatform.httpUrl:''}")
private String httpUrl; private String httpUrl;
...@@ -69,8 +82,7 @@ public class MessageServiceImpl implements MessageService { ...@@ -69,8 +82,7 @@ public class MessageServiceImpl implements MessageService {
@Autowired @Autowired
private SendTaskThreadPool sendTaskThreadPool; private SendTaskThreadPool sendTaskThreadPool;
//@Autowired
@Autowired
private TbCoreQueueProducerProvider producerProvider; private TbCoreQueueProducerProvider producerProvider;
@Override @Override
...@@ -79,6 +91,10 @@ public class MessageServiceImpl implements MessageService { ...@@ -79,6 +91,10 @@ public class MessageServiceImpl implements MessageService {
TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastSimpleUUID(), message == null ? "" : message, header); TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastSimpleUUID(), message == null ? "" : message, header);
producer.send(info, queueMsg, callback); producer.send(info, queueMsg, callback);
//rabbitTemplate.send();
} }
@Override @Override
...@@ -180,6 +196,7 @@ public class MessageServiceImpl implements MessageService { ...@@ -180,6 +196,7 @@ public class MessageServiceImpl implements MessageService {
sendTaskThreadPool.execute(sendTask); sendTaskThreadPool.execute(sendTask);
} }
public static void main(String[] args) { public static void main(String[] args) {
try { try {
...@@ -192,13 +209,12 @@ public class MessageServiceImpl implements MessageService { ...@@ -192,13 +209,12 @@ public class MessageServiceImpl implements MessageService {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("stacktrace",stacktrace); jsonObject.put("stacktrace", stacktrace);
System.out.println(JSON.toJSONString(jsonObject)); System.out.println(JSON.toJSONString(jsonObject));
} }
} }
} }
\ No newline at end of file
package com.mortals.xhx.base.system.site.dao;
import com.mortals.xhx.base.system.site.model.SiteEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @author: zxfei
* @date: 2021/9/1 9:08
*/
@Mapper
@Repository
public interface ISiteCustomDao {
/**
* 查询子站点
*
* @param map 参数
* @return
*/
List<SiteEntity> selectChildrenSiteById(Map<String,String> map);
}
package com.mortals.xhx.base.system.site.model;
import java.util.Date;
/**
*
* Description:Site
* date: 2021-9-27 10:26:34
*/
public class SiteEntity extends SiteEntityExt{
private static final long serialVersionUID = 1632709594625L;
/**
* 站点名
*/
private String siteName;
/**
* 父级id
*/
private Long parentId;
/**
* 祖级列表,逗号分隔
*/
private String ancestors;
/**
* 地址
*/
private String address;
/**
* 电话
*/
private String mobile;
/**
* 单位介绍
*/
private String introduce;
/**
* 周一 1上班 0不上
*/
private Integer workday1;
/**
* 周二 1上班 0不上
*/
private Integer workday2;
/**
* 周三 1上班 0不上
*/
private Integer workday3;
/**
* 周四 1上班 0不上
*/
private Integer workday4;
/**
* 周五 1上班 0不上
*/
private Integer workday5;
/**
* 周六 1上班 0不上
*/
private Integer workday6;
/**
* 周日 1上班 0不上
*/
private Integer workday7;
/**
* 站点编号
*/
private String number;
/**
* 中心介绍
*/
private String summary;
/**
* 排序字段
*/
private Integer orderNum;
/**
* 站点状态 ,0,停用,1,正常 默认1
*/
private Integer status;
/**
* 变更时间
*/
private Date updateTime;
/**
* 变更用户loginName
*/
private String updateUser;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建用户loginName
*/
private String createUser;
public SiteEntity(){
}
/**
* 获取 站点名
* @return siteName
*/
public String getSiteName() {
return this.siteName;
}
/**
* 设置 站点名
* @param siteName
*/
public void setSiteName(String siteName) {
this.siteName = siteName;
}
/**
* 获取 父级id
* @return parentId
*/
public Long getParentId() {
return this.parentId;
}
/**
* 设置 父级id
* @param parentId
*/
public void setParentId(Long parentId) {
this.parentId = parentId;
}
/**
* 获取 祖级列表,逗号分隔
* @return ancestors
*/
public String getAncestors() {
return this.ancestors;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestors
*/
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
/**
* 获取 地址
* @return address
*/
public String getAddress() {
return this.address;
}
/**
* 设置 地址
* @param address
*/
public void setAddress(String address) {
this.address = address;
}
/**
* 获取 电话
* @return mobile
*/
public String getMobile() {
return this.mobile;
}
/**
* 设置 电话
* @param mobile
*/
public void setMobile(String mobile) {
this.mobile = mobile;
}
/**
* 获取 单位介绍
* @return introduce
*/
public String getIntroduce() {
return this.introduce;
}
/**
* 设置 单位介绍
* @param introduce
*/
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
/**
* 获取 周一 1上班 0不上
* @return workday1
*/
public Integer getWorkday1() {
return this.workday1;
}
/**
* 设置 周一 1上班 0不上
* @param workday1
*/
public void setWorkday1(Integer workday1) {
this.workday1 = workday1;
}
/**
* 获取 周二 1上班 0不上
* @return workday2
*/
public Integer getWorkday2() {
return this.workday2;
}
/**
* 设置 周二 1上班 0不上
* @param workday2
*/
public void setWorkday2(Integer workday2) {
this.workday2 = workday2;
}
/**
* 获取 周三 1上班 0不上
* @return workday3
*/
public Integer getWorkday3() {
return this.workday3;
}
/**
* 设置 周三 1上班 0不上
* @param workday3
*/
public void setWorkday3(Integer workday3) {
this.workday3 = workday3;
}
/**
* 获取 周四 1上班 0不上
* @return workday4
*/
public Integer getWorkday4() {
return this.workday4;
}
/**
* 设置 周四 1上班 0不上
* @param workday4
*/
public void setWorkday4(Integer workday4) {
this.workday4 = workday4;
}
/**
* 获取 周五 1上班 0不上
* @return workday5
*/
public Integer getWorkday5() {
return this.workday5;
}
/**
* 设置 周五 1上班 0不上
* @param workday5
*/
public void setWorkday5(Integer workday5) {
this.workday5 = workday5;
}
/**
* 获取 周六 1上班 0不上
* @return workday6
*/
public Integer getWorkday6() {
return this.workday6;
}
/**
* 设置 周六 1上班 0不上
* @param workday6
*/
public void setWorkday6(Integer workday6) {
this.workday6 = workday6;
}
/**
* 获取 周日 1上班 0不上
* @return workday7
*/
public Integer getWorkday7() {
return this.workday7;
}
/**
* 设置 周日 1上班 0不上
* @param workday7
*/
public void setWorkday7(Integer workday7) {
this.workday7 = workday7;
}
/**
* 获取 站点编号
* @return number
*/
public String getNumber() {
return this.number;
}
/**
* 设置 站点编号
* @param number
*/
public void setNumber(String number) {
this.number = number;
}
/**
* 获取 中心介绍
* @return summary
*/
public String getSummary() {
return this.summary;
}
/**
* 设置 中心介绍
* @param summary
*/
public void setSummary(String summary) {
this.summary = summary;
}
/**
* 获取 排序字段
* @return orderNum
*/
public Integer getOrderNum() {
return this.orderNum;
}
/**
* 设置 排序字段
* @param orderNum
*/
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
/**
* 获取 站点状态 ,0,停用,1,正常 默认1
* @return status
*/
public Integer getStatus() {
return this.status;
}
/**
* 设置 站点状态 ,0,停用,1,正常 默认1
* @param status
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 获取 变更时间
* @return updateTime
*/
public Date getUpdateTime() {
return this.updateTime;
}
/**
* 设置 变更时间
* @param updateTime
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取 变更用户loginName
* @return updateUser
*/
public String getUpdateUser() {
return this.updateUser;
}
/**
* 设置 变更用户loginName
* @param updateUser
*/
public void setUpdateUser(String updateUser) {
this.updateUser = updateUser;
}
/**
* 获取 创建时间
* @return createTime
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置 创建时间
* @param createTime
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取 创建用户loginName
* @return createUser
*/
public String getCreateUser() {
return this.createUser;
}
/**
* 设置 创建用户loginName
* @param createUser
*/
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj instanceof SiteEntity) {
SiteEntity tmp = (SiteEntity) obj;
if (this.getId().longValue() == tmp.getId().longValue()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb
.append(",id:").append(getId())
.append(",siteName:").append(getSiteName())
.append(",parentId:").append(getParentId())
.append(",ancestors:").append(getAncestors())
.append(",address:").append(getAddress())
.append(",mobile:").append(getMobile())
.append(",introduce:").append(getIntroduce())
.append(",workday1:").append(getWorkday1())
.append(",workday2:").append(getWorkday2())
.append(",workday3:").append(getWorkday3())
.append(",workday4:").append(getWorkday4())
.append(",workday5:").append(getWorkday5())
.append(",workday6:").append(getWorkday6())
.append(",workday7:").append(getWorkday7())
.append(",number:").append(getNumber())
.append(",summary:").append(getSummary())
.append(",orderNum:").append(getOrderNum())
.append(",status:").append(getStatus())
.append(",updateTime:").append(getUpdateTime())
.append(",updateUser:").append(getUpdateUser())
.append(",createTime:").append(getCreateTime())
.append(",createUser:").append(getCreateUser())
;
return sb.toString();
}
public void initAttrValue(){
this.siteName = null;
this.parentId = null;
this.ancestors = null;
this.address = null;
this.mobile = null;
this.introduce = null;
this.workday1 = null;
this.workday2 = null;
this.workday3 = null;
this.workday4 = null;
this.workday5 = null;
this.workday6 = null;
this.workday7 = null;
this.number = null;
this.summary = null;
this.orderNum = null;
this.status = null;
this.updateTime = null;
this.updateUser = null;
this.createTime = null;
this.createUser = null;
}
}
\ No newline at end of file
package com.mortals.xhx.base.system.site.model;
import java.util.List;
/**
*
* Description:Site
* date: 2021-9-27 10:26:34
*/
public class SiteQuery extends SiteEntity{
private static final long serialVersionUID = 1632709594629L;
/** 开始 ID,主键,自增长 */
private Long idStart;
/** 结束 ID,主键,自增长 */
private Long idEnd;
/** 增加 ID,主键,自增长 */
private Long idIncrement;
/** ID,主键,自增长 */
private List <Long> idList;
/** 站点名 */
private List<String> siteNameList;
/** 开始 父级id */
private Long parentIdStart;
/** 结束 父级id */
private Long parentIdEnd;
/** 增加 父级id */
private Long parentIdIncrement;
/** 父级id */
private List <Long> parentIdList;
/** 祖级列表,逗号分隔 */
private List<String> ancestorsList;
/** 地址 */
private List<String> addressList;
/** 电话 */
private List<String> mobileList;
/** 单位介绍 */
private List<String> introduceList;
/** 开始 周一 1上班 0不上 */
private Integer workday1Start;
/** 结束 周一 1上班 0不上 */
private Integer workday1End;
/** 增加 周一 1上班 0不上 */
private Integer workday1Increment;
/** 周一 1上班 0不上 */
private List <Integer> workday1List;
/** 开始 周二 1上班 0不上 */
private Integer workday2Start;
/** 结束 周二 1上班 0不上 */
private Integer workday2End;
/** 增加 周二 1上班 0不上 */
private Integer workday2Increment;
/** 周二 1上班 0不上 */
private List <Integer> workday2List;
/** 开始 周三 1上班 0不上 */
private Integer workday3Start;
/** 结束 周三 1上班 0不上 */
private Integer workday3End;
/** 增加 周三 1上班 0不上 */
private Integer workday3Increment;
/** 周三 1上班 0不上 */
private List <Integer> workday3List;
/** 开始 周四 1上班 0不上 */
private Integer workday4Start;
/** 结束 周四 1上班 0不上 */
private Integer workday4End;
/** 增加 周四 1上班 0不上 */
private Integer workday4Increment;
/** 周四 1上班 0不上 */
private List <Integer> workday4List;
/** 开始 周五 1上班 0不上 */
private Integer workday5Start;
/** 结束 周五 1上班 0不上 */
private Integer workday5End;
/** 增加 周五 1上班 0不上 */
private Integer workday5Increment;
/** 周五 1上班 0不上 */
private List <Integer> workday5List;
/** 开始 周六 1上班 0不上 */
private Integer workday6Start;
/** 结束 周六 1上班 0不上 */
private Integer workday6End;
/** 增加 周六 1上班 0不上 */
private Integer workday6Increment;
/** 周六 1上班 0不上 */
private List <Integer> workday6List;
/** 开始 周日 1上班 0不上 */
private Integer workday7Start;
/** 结束 周日 1上班 0不上 */
private Integer workday7End;
/** 增加 周日 1上班 0不上 */
private Integer workday7Increment;
/** 周日 1上班 0不上 */
private List <Integer> workday7List;
/** 站点编号 */
private List<String> numberList;
/** 中心介绍 */
private List<String> summaryList;
/** 开始 排序字段 */
private Integer orderNumStart;
/** 结束 排序字段 */
private Integer orderNumEnd;
/** 增加 排序字段 */
private Integer orderNumIncrement;
/** 排序字段 */
private List <Integer> orderNumList;
/** 开始 站点状态 ,0,停用,1,正常 默认1 */
private Integer statusStart;
/** 结束 站点状态 ,0,停用,1,正常 默认1 */
private Integer statusEnd;
/** 增加 站点状态 ,0,停用,1,正常 默认1 */
private Integer statusIncrement;
/** 站点状态 ,0,停用,1,正常 默认1 */
private List <Integer> statusList;
/** 开始 变更时间 */
private String updateTimeStart;
/** 结束 变更时间 */
private String updateTimeEnd;
/** 变更用户loginName */
private List<String> updateUserList;
/** 开始 创建时间 */
private String createTimeStart;
/** 结束 创建时间 */
private String createTimeEnd;
/** 创建用户loginName */
private List<String> createUserList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<SiteQuery> orConditionList;
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private List<SiteQuery> andConditionList;
public SiteQuery(){
}
/**
* 获取 开始 ID,主键,自增长
* @return idStart
*/
public Long getIdStart(){
return this.idStart;
}
/**
* 设置 开始 ID,主键,自增长
* @param idStart
*/
public void setIdStart(Long idStart){
this.idStart = idStart;
}
/**
* 获取 结束 ID,主键,自增长
* @return idEnd
*/
public Long getIdEnd(){
return this.idEnd;
}
/**
* 设置 结束 ID,主键,自增长
* @param idEnd
*/
public void setIdEnd(Long idEnd){
this.idEnd = idEnd;
}
/**
* 获取 增加 ID,主键,自增长
* @return idIncrement
*/
public Long getIdIncrement(){
return this.idIncrement;
}
/**
* 设置 增加 ID,主键,自增长
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement){
this.idIncrement = idIncrement;
}
/**
* 获取 ID,主键,自增长
* @return idList
*/
public List<Long> getIdList(){
return this.idList;
}
/**
* 设置 ID,主键,自增长
* @param idList
*/
public void setIdList(List<Long> idList){
this.idList = idList;
}
/**
* 获取 站点名
* @return siteNameList
*/
public List<String> getSiteNameList(){
return this.siteNameList;
}
/**
* 设置 站点名
* @param siteNameList
*/
public void setSiteNameList(List<String> siteNameList){
this.siteNameList = siteNameList;
}
/**
* 获取 开始 父级id
* @return parentIdStart
*/
public Long getParentIdStart(){
return this.parentIdStart;
}
/**
* 设置 开始 父级id
* @param parentIdStart
*/
public void setParentIdStart(Long parentIdStart){
this.parentIdStart = parentIdStart;
}
/**
* 获取 结束 父级id
* @return parentIdEnd
*/
public Long getParentIdEnd(){
return this.parentIdEnd;
}
/**
* 设置 结束 父级id
* @param parentIdEnd
*/
public void setParentIdEnd(Long parentIdEnd){
this.parentIdEnd = parentIdEnd;
}
/**
* 获取 增加 父级id
* @return parentIdIncrement
*/
public Long getParentIdIncrement(){
return this.parentIdIncrement;
}
/**
* 设置 增加 父级id
* @param parentIdIncrement
*/
public void setParentIdIncrement(Long parentIdIncrement){
this.parentIdIncrement = parentIdIncrement;
}
/**
* 获取 父级id
* @return parentIdList
*/
public List<Long> getParentIdList(){
return this.parentIdList;
}
/**
* 设置 父级id
* @param parentIdList
*/
public void setParentIdList(List<Long> parentIdList){
this.parentIdList = parentIdList;
}
/**
* 获取 祖级列表,逗号分隔
* @return ancestorsList
*/
public List<String> getAncestorsList(){
return this.ancestorsList;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestorsList
*/
public void setAncestorsList(List<String> ancestorsList){
this.ancestorsList = ancestorsList;
}
/**
* 获取 地址
* @return addressList
*/
public List<String> getAddressList(){
return this.addressList;
}
/**
* 设置 地址
* @param addressList
*/
public void setAddressList(List<String> addressList){
this.addressList = addressList;
}
/**
* 获取 电话
* @return mobileList
*/
public List<String> getMobileList(){
return this.mobileList;
}
/**
* 设置 电话
* @param mobileList
*/
public void setMobileList(List<String> mobileList){
this.mobileList = mobileList;
}
/**
* 获取 单位介绍
* @return introduceList
*/
public List<String> getIntroduceList(){
return this.introduceList;
}
/**
* 设置 单位介绍
* @param introduceList
*/
public void setIntroduceList(List<String> introduceList){
this.introduceList = introduceList;
}
/**
* 获取 开始 周一 1上班 0不上
* @return workday1Start
*/
public Integer getWorkday1Start(){
return this.workday1Start;
}
/**
* 设置 开始 周一 1上班 0不上
* @param workday1Start
*/
public void setWorkday1Start(Integer workday1Start){
this.workday1Start = workday1Start;
}
/**
* 获取 结束 周一 1上班 0不上
* @return workday1End
*/
public Integer getWorkday1End(){
return this.workday1End;
}
/**
* 设置 结束 周一 1上班 0不上
* @param workday1End
*/
public void setWorkday1End(Integer workday1End){
this.workday1End = workday1End;
}
/**
* 获取 增加 周一 1上班 0不上
* @return workday1Increment
*/
public Integer getWorkday1Increment(){
return this.workday1Increment;
}
/**
* 设置 增加 周一 1上班 0不上
* @param workday1Increment
*/
public void setWorkday1Increment(Integer workday1Increment){
this.workday1Increment = workday1Increment;
}
/**
* 获取 周一 1上班 0不上
* @return workday1List
*/
public List<Integer> getWorkday1List(){
return this.workday1List;
}
/**
* 设置 周一 1上班 0不上
* @param workday1List
*/
public void setWorkday1List(List<Integer> workday1List){
this.workday1List = workday1List;
}
/**
* 获取 开始 周二 1上班 0不上
* @return workday2Start
*/
public Integer getWorkday2Start(){
return this.workday2Start;
}
/**
* 设置 开始 周二 1上班 0不上
* @param workday2Start
*/
public void setWorkday2Start(Integer workday2Start){
this.workday2Start = workday2Start;
}
/**
* 获取 结束 周二 1上班 0不上
* @return workday2End
*/
public Integer getWorkday2End(){
return this.workday2End;
}
/**
* 设置 结束 周二 1上班 0不上
* @param workday2End
*/
public void setWorkday2End(Integer workday2End){
this.workday2End = workday2End;
}
/**
* 获取 增加 周二 1上班 0不上
* @return workday2Increment
*/
public Integer getWorkday2Increment(){
return this.workday2Increment;
}
/**
* 设置 增加 周二 1上班 0不上
* @param workday2Increment
*/
public void setWorkday2Increment(Integer workday2Increment){
this.workday2Increment = workday2Increment;
}
/**
* 获取 周二 1上班 0不上
* @return workday2List
*/
public List<Integer> getWorkday2List(){
return this.workday2List;
}
/**
* 设置 周二 1上班 0不上
* @param workday2List
*/
public void setWorkday2List(List<Integer> workday2List){
this.workday2List = workday2List;
}
/**
* 获取 开始 周三 1上班 0不上
* @return workday3Start
*/
public Integer getWorkday3Start(){
return this.workday3Start;
}
/**
* 设置 开始 周三 1上班 0不上
* @param workday3Start
*/
public void setWorkday3Start(Integer workday3Start){
this.workday3Start = workday3Start;
}
/**
* 获取 结束 周三 1上班 0不上
* @return workday3End
*/
public Integer getWorkday3End(){
return this.workday3End;
}
/**
* 设置 结束 周三 1上班 0不上
* @param workday3End
*/
public void setWorkday3End(Integer workday3End){
this.workday3End = workday3End;
}
/**
* 获取 增加 周三 1上班 0不上
* @return workday3Increment
*/
public Integer getWorkday3Increment(){
return this.workday3Increment;
}
/**
* 设置 增加 周三 1上班 0不上
* @param workday3Increment
*/
public void setWorkday3Increment(Integer workday3Increment){
this.workday3Increment = workday3Increment;
}
/**
* 获取 周三 1上班 0不上
* @return workday3List
*/
public List<Integer> getWorkday3List(){
return this.workday3List;
}
/**
* 设置 周三 1上班 0不上
* @param workday3List
*/
public void setWorkday3List(List<Integer> workday3List){
this.workday3List = workday3List;
}
/**
* 获取 开始 周四 1上班 0不上
* @return workday4Start
*/
public Integer getWorkday4Start(){
return this.workday4Start;
}
/**
* 设置 开始 周四 1上班 0不上
* @param workday4Start
*/
public void setWorkday4Start(Integer workday4Start){
this.workday4Start = workday4Start;
}
/**
* 获取 结束 周四 1上班 0不上
* @return workday4End
*/
public Integer getWorkday4End(){
return this.workday4End;
}
/**
* 设置 结束 周四 1上班 0不上
* @param workday4End
*/
public void setWorkday4End(Integer workday4End){
this.workday4End = workday4End;
}
/**
* 获取 增加 周四 1上班 0不上
* @return workday4Increment
*/
public Integer getWorkday4Increment(){
return this.workday4Increment;
}
/**
* 设置 增加 周四 1上班 0不上
* @param workday4Increment
*/
public void setWorkday4Increment(Integer workday4Increment){
this.workday4Increment = workday4Increment;
}
/**
* 获取 周四 1上班 0不上
* @return workday4List
*/
public List<Integer> getWorkday4List(){
return this.workday4List;
}
/**
* 设置 周四 1上班 0不上
* @param workday4List
*/
public void setWorkday4List(List<Integer> workday4List){
this.workday4List = workday4List;
}
/**
* 获取 开始 周五 1上班 0不上
* @return workday5Start
*/
public Integer getWorkday5Start(){
return this.workday5Start;
}
/**
* 设置 开始 周五 1上班 0不上
* @param workday5Start
*/
public void setWorkday5Start(Integer workday5Start){
this.workday5Start = workday5Start;
}
/**
* 获取 结束 周五 1上班 0不上
* @return workday5End
*/
public Integer getWorkday5End(){
return this.workday5End;
}
/**
* 设置 结束 周五 1上班 0不上
* @param workday5End
*/
public void setWorkday5End(Integer workday5End){
this.workday5End = workday5End;
}
/**
* 获取 增加 周五 1上班 0不上
* @return workday5Increment
*/
public Integer getWorkday5Increment(){
return this.workday5Increment;
}
/**
* 设置 增加 周五 1上班 0不上
* @param workday5Increment
*/
public void setWorkday5Increment(Integer workday5Increment){
this.workday5Increment = workday5Increment;
}
/**
* 获取 周五 1上班 0不上
* @return workday5List
*/
public List<Integer> getWorkday5List(){
return this.workday5List;
}
/**
* 设置 周五 1上班 0不上
* @param workday5List
*/
public void setWorkday5List(List<Integer> workday5List){
this.workday5List = workday5List;
}
/**
* 获取 开始 周六 1上班 0不上
* @return workday6Start
*/
public Integer getWorkday6Start(){
return this.workday6Start;
}
/**
* 设置 开始 周六 1上班 0不上
* @param workday6Start
*/
public void setWorkday6Start(Integer workday6Start){
this.workday6Start = workday6Start;
}
/**
* 获取 结束 周六 1上班 0不上
* @return workday6End
*/
public Integer getWorkday6End(){
return this.workday6End;
}
/**
* 设置 结束 周六 1上班 0不上
* @param workday6End
*/
public void setWorkday6End(Integer workday6End){
this.workday6End = workday6End;
}
/**
* 获取 增加 周六 1上班 0不上
* @return workday6Increment
*/
public Integer getWorkday6Increment(){
return this.workday6Increment;
}
/**
* 设置 增加 周六 1上班 0不上
* @param workday6Increment
*/
public void setWorkday6Increment(Integer workday6Increment){
this.workday6Increment = workday6Increment;
}
/**
* 获取 周六 1上班 0不上
* @return workday6List
*/
public List<Integer> getWorkday6List(){
return this.workday6List;
}
/**
* 设置 周六 1上班 0不上
* @param workday6List
*/
public void setWorkday6List(List<Integer> workday6List){
this.workday6List = workday6List;
}
/**
* 获取 开始 周日 1上班 0不上
* @return workday7Start
*/
public Integer getWorkday7Start(){
return this.workday7Start;
}
/**
* 设置 开始 周日 1上班 0不上
* @param workday7Start
*/
public void setWorkday7Start(Integer workday7Start){
this.workday7Start = workday7Start;
}
/**
* 获取 结束 周日 1上班 0不上
* @return workday7End
*/
public Integer getWorkday7End(){
return this.workday7End;
}
/**
* 设置 结束 周日 1上班 0不上
* @param workday7End
*/
public void setWorkday7End(Integer workday7End){
this.workday7End = workday7End;
}
/**
* 获取 增加 周日 1上班 0不上
* @return workday7Increment
*/
public Integer getWorkday7Increment(){
return this.workday7Increment;
}
/**
* 设置 增加 周日 1上班 0不上
* @param workday7Increment
*/
public void setWorkday7Increment(Integer workday7Increment){
this.workday7Increment = workday7Increment;
}
/**
* 获取 周日 1上班 0不上
* @return workday7List
*/
public List<Integer> getWorkday7List(){
return this.workday7List;
}
/**
* 设置 周日 1上班 0不上
* @param workday7List
*/
public void setWorkday7List(List<Integer> workday7List){
this.workday7List = workday7List;
}
/**
* 获取 站点编号
* @return numberList
*/
public List<String> getNumberList(){
return this.numberList;
}
/**
* 设置 站点编号
* @param numberList
*/
public void setNumberList(List<String> numberList){
this.numberList = numberList;
}
/**
* 获取 中心介绍
* @return summaryList
*/
public List<String> getSummaryList(){
return this.summaryList;
}
/**
* 设置 中心介绍
* @param summaryList
*/
public void setSummaryList(List<String> summaryList){
this.summaryList = summaryList;
}
/**
* 获取 开始 排序字段
* @return orderNumStart
*/
public Integer getOrderNumStart(){
return this.orderNumStart;
}
/**
* 设置 开始 排序字段
* @param orderNumStart
*/
public void setOrderNumStart(Integer orderNumStart){
this.orderNumStart = orderNumStart;
}
/**
* 获取 结束 排序字段
* @return orderNumEnd
*/
public Integer getOrderNumEnd(){
return this.orderNumEnd;
}
/**
* 设置 结束 排序字段
* @param orderNumEnd
*/
public void setOrderNumEnd(Integer orderNumEnd){
this.orderNumEnd = orderNumEnd;
}
/**
* 获取 增加 排序字段
* @return orderNumIncrement
*/
public Integer getOrderNumIncrement(){
return this.orderNumIncrement;
}
/**
* 设置 增加 排序字段
* @param orderNumIncrement
*/
public void setOrderNumIncrement(Integer orderNumIncrement){
this.orderNumIncrement = orderNumIncrement;
}
/**
* 获取 排序字段
* @return orderNumList
*/
public List<Integer> getOrderNumList(){
return this.orderNumList;
}
/**
* 设置 排序字段
* @param orderNumList
*/
public void setOrderNumList(List<Integer> orderNumList){
this.orderNumList = orderNumList;
}
/**
* 获取 开始 站点状态 ,0,停用,1,正常 默认1
* @return statusStart
*/
public Integer getStatusStart(){
return this.statusStart;
}
/**
* 设置 开始 站点状态 ,0,停用,1,正常 默认1
* @param statusStart
*/
public void setStatusStart(Integer statusStart){
this.statusStart = statusStart;
}
/**
* 获取 结束 站点状态 ,0,停用,1,正常 默认1
* @return statusEnd
*/
public Integer getStatusEnd(){
return this.statusEnd;
}
/**
* 设置 结束 站点状态 ,0,停用,1,正常 默认1
* @param statusEnd
*/
public void setStatusEnd(Integer statusEnd){
this.statusEnd = statusEnd;
}
/**
* 获取 增加 站点状态 ,0,停用,1,正常 默认1
* @return statusIncrement
*/
public Integer getStatusIncrement(){
return this.statusIncrement;
}
/**
* 设置 增加 站点状态 ,0,停用,1,正常 默认1
* @param statusIncrement
*/
public void setStatusIncrement(Integer statusIncrement){
this.statusIncrement = statusIncrement;
}
/**
* 获取 站点状态 ,0,停用,1,正常 默认1
* @return statusList
*/
public List<Integer> getStatusList(){
return this.statusList;
}
/**
* 设置 站点状态 ,0,停用,1,正常 默认1
* @param statusList
*/
public void setStatusList(List<Integer> statusList){
this.statusList = statusList;
}
/**
* 获取 开始 变更时间
* @return updateTimeStart
*/
public String getUpdateTimeStart(){
return this.updateTimeStart;
}
/**
* 设置 开始 变更时间
* @param updateTimeStart
*/
public void setUpdateTimeStart(String updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
/**
* 获取 结束 变更时间
* @return updateTimeEnd
*/
public String getUpdateTimeEnd(){
return this.updateTimeEnd;
}
/**
* 设置 结束 变更时间
* @param updateTimeEnd
*/
public void setUpdateTimeEnd(String updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 变更用户loginName
* @return updateUserList
*/
public List<String> getUpdateUserList(){
return this.updateUserList;
}
/**
* 设置 变更用户loginName
* @param updateUserList
*/
public void setUpdateUserList(List<String> updateUserList){
this.updateUserList = updateUserList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
*/
public String getCreateTimeStart(){
return this.createTimeStart;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public void setCreateTimeStart(String createTimeStart){
this.createTimeStart = createTimeStart;
}
/**
* 获取 结束 创建时间
* @return createTimeEnd
*/
public String getCreateTimeEnd(){
return this.createTimeEnd;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public void setCreateTimeEnd(String createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
/**
* 获取 创建用户loginName
* @return createUserList
*/
public List<String> getCreateUserList(){
return this.createUserList;
}
/**
* 设置 创建用户loginName
* @param createUserList
*/
public void setCreateUserList(List<String> createUserList){
this.createUserList = createUserList;
}
/**
* 设置 ID,主键,自增长
* @param id
*/
public SiteQuery id(Long id){
setId(id);
return this;
}
/**
* 设置 开始 ID,主键,自增长
* @param idStart
*/
public SiteQuery idStart(Long idStart){
this.idStart = idStart;
return this;
}
/**
* 设置 结束 ID,主键,自增长
* @param idEnd
*/
public SiteQuery idEnd(Long idEnd){
this.idEnd = idEnd;
return this;
}
/**
* 设置 增加 ID,主键,自增长
* @param idIncrement
*/
public SiteQuery idIncrement(Long idIncrement){
this.idIncrement = idIncrement;
return this;
}
/**
* 设置 ID,主键,自增长
* @param idList
*/
public SiteQuery idList(List<Long> idList){
this.idList = idList;
return this;
}
/**
* 设置 站点名
* @param siteName
*/
public SiteQuery siteName(String siteName){
setSiteName(siteName);
return this;
}
/**
* 设置 站点名
* @param siteNameList
*/
public SiteQuery siteNameList(List<String> siteNameList){
this.siteNameList = siteNameList;
return this;
}
/**
* 设置 父级id
* @param parentId
*/
public SiteQuery parentId(Long parentId){
setParentId(parentId);
return this;
}
/**
* 设置 开始 父级id
* @param parentIdStart
*/
public SiteQuery parentIdStart(Long parentIdStart){
this.parentIdStart = parentIdStart;
return this;
}
/**
* 设置 结束 父级id
* @param parentIdEnd
*/
public SiteQuery parentIdEnd(Long parentIdEnd){
this.parentIdEnd = parentIdEnd;
return this;
}
/**
* 设置 增加 父级id
* @param parentIdIncrement
*/
public SiteQuery parentIdIncrement(Long parentIdIncrement){
this.parentIdIncrement = parentIdIncrement;
return this;
}
/**
* 设置 父级id
* @param parentIdList
*/
public SiteQuery parentIdList(List<Long> parentIdList){
this.parentIdList = parentIdList;
return this;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestors
*/
public SiteQuery ancestors(String ancestors){
setAncestors(ancestors);
return this;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestorsList
*/
public SiteQuery ancestorsList(List<String> ancestorsList){
this.ancestorsList = ancestorsList;
return this;
}
/**
* 设置 地址
* @param address
*/
public SiteQuery address(String address){
setAddress(address);
return this;
}
/**
* 设置 地址
* @param addressList
*/
public SiteQuery addressList(List<String> addressList){
this.addressList = addressList;
return this;
}
/**
* 设置 电话
* @param mobile
*/
public SiteQuery mobile(String mobile){
setMobile(mobile);
return this;
}
/**
* 设置 电话
* @param mobileList
*/
public SiteQuery mobileList(List<String> mobileList){
this.mobileList = mobileList;
return this;
}
/**
* 设置 单位介绍
* @param introduce
*/
public SiteQuery introduce(String introduce){
setIntroduce(introduce);
return this;
}
/**
* 设置 单位介绍
* @param introduceList
*/
public SiteQuery introduceList(List<String> introduceList){
this.introduceList = introduceList;
return this;
}
/**
* 设置 周一 1上班 0不上
* @param workday1
*/
public SiteQuery workday1(Integer workday1){
setWorkday1(workday1);
return this;
}
/**
* 设置 开始 周一 1上班 0不上
* @param workday1Start
*/
public SiteQuery workday1Start(Integer workday1Start){
this.workday1Start = workday1Start;
return this;
}
/**
* 设置 结束 周一 1上班 0不上
* @param workday1End
*/
public SiteQuery workday1End(Integer workday1End){
this.workday1End = workday1End;
return this;
}
/**
* 设置 增加 周一 1上班 0不上
* @param workday1Increment
*/
public SiteQuery workday1Increment(Integer workday1Increment){
this.workday1Increment = workday1Increment;
return this;
}
/**
* 设置 周一 1上班 0不上
* @param workday1List
*/
public SiteQuery workday1List(List<Integer> workday1List){
this.workday1List = workday1List;
return this;
}
/**
* 设置 周二 1上班 0不上
* @param workday2
*/
public SiteQuery workday2(Integer workday2){
setWorkday2(workday2);
return this;
}
/**
* 设置 开始 周二 1上班 0不上
* @param workday2Start
*/
public SiteQuery workday2Start(Integer workday2Start){
this.workday2Start = workday2Start;
return this;
}
/**
* 设置 结束 周二 1上班 0不上
* @param workday2End
*/
public SiteQuery workday2End(Integer workday2End){
this.workday2End = workday2End;
return this;
}
/**
* 设置 增加 周二 1上班 0不上
* @param workday2Increment
*/
public SiteQuery workday2Increment(Integer workday2Increment){
this.workday2Increment = workday2Increment;
return this;
}
/**
* 设置 周二 1上班 0不上
* @param workday2List
*/
public SiteQuery workday2List(List<Integer> workday2List){
this.workday2List = workday2List;
return this;
}
/**
* 设置 周三 1上班 0不上
* @param workday3
*/
public SiteQuery workday3(Integer workday3){
setWorkday3(workday3);
return this;
}
/**
* 设置 开始 周三 1上班 0不上
* @param workday3Start
*/
public SiteQuery workday3Start(Integer workday3Start){
this.workday3Start = workday3Start;
return this;
}
/**
* 设置 结束 周三 1上班 0不上
* @param workday3End
*/
public SiteQuery workday3End(Integer workday3End){
this.workday3End = workday3End;
return this;
}
/**
* 设置 增加 周三 1上班 0不上
* @param workday3Increment
*/
public SiteQuery workday3Increment(Integer workday3Increment){
this.workday3Increment = workday3Increment;
return this;
}
/**
* 设置 周三 1上班 0不上
* @param workday3List
*/
public SiteQuery workday3List(List<Integer> workday3List){
this.workday3List = workday3List;
return this;
}
/**
* 设置 周四 1上班 0不上
* @param workday4
*/
public SiteQuery workday4(Integer workday4){
setWorkday4(workday4);
return this;
}
/**
* 设置 开始 周四 1上班 0不上
* @param workday4Start
*/
public SiteQuery workday4Start(Integer workday4Start){
this.workday4Start = workday4Start;
return this;
}
/**
* 设置 结束 周四 1上班 0不上
* @param workday4End
*/
public SiteQuery workday4End(Integer workday4End){
this.workday4End = workday4End;
return this;
}
/**
* 设置 增加 周四 1上班 0不上
* @param workday4Increment
*/
public SiteQuery workday4Increment(Integer workday4Increment){
this.workday4Increment = workday4Increment;
return this;
}
/**
* 设置 周四 1上班 0不上
* @param workday4List
*/
public SiteQuery workday4List(List<Integer> workday4List){
this.workday4List = workday4List;
return this;
}
/**
* 设置 周五 1上班 0不上
* @param workday5
*/
public SiteQuery workday5(Integer workday5){
setWorkday5(workday5);
return this;
}
/**
* 设置 开始 周五 1上班 0不上
* @param workday5Start
*/
public SiteQuery workday5Start(Integer workday5Start){
this.workday5Start = workday5Start;
return this;
}
/**
* 设置 结束 周五 1上班 0不上
* @param workday5End
*/
public SiteQuery workday5End(Integer workday5End){
this.workday5End = workday5End;
return this;
}
/**
* 设置 增加 周五 1上班 0不上
* @param workday5Increment
*/
public SiteQuery workday5Increment(Integer workday5Increment){
this.workday5Increment = workday5Increment;
return this;
}
/**
* 设置 周五 1上班 0不上
* @param workday5List
*/
public SiteQuery workday5List(List<Integer> workday5List){
this.workday5List = workday5List;
return this;
}
/**
* 设置 周六 1上班 0不上
* @param workday6
*/
public SiteQuery workday6(Integer workday6){
setWorkday6(workday6);
return this;
}
/**
* 设置 开始 周六 1上班 0不上
* @param workday6Start
*/
public SiteQuery workday6Start(Integer workday6Start){
this.workday6Start = workday6Start;
return this;
}
/**
* 设置 结束 周六 1上班 0不上
* @param workday6End
*/
public SiteQuery workday6End(Integer workday6End){
this.workday6End = workday6End;
return this;
}
/**
* 设置 增加 周六 1上班 0不上
* @param workday6Increment
*/
public SiteQuery workday6Increment(Integer workday6Increment){
this.workday6Increment = workday6Increment;
return this;
}
/**
* 设置 周六 1上班 0不上
* @param workday6List
*/
public SiteQuery workday6List(List<Integer> workday6List){
this.workday6List = workday6List;
return this;
}
/**
* 设置 周日 1上班 0不上
* @param workday7
*/
public SiteQuery workday7(Integer workday7){
setWorkday7(workday7);
return this;
}
/**
* 设置 开始 周日 1上班 0不上
* @param workday7Start
*/
public SiteQuery workday7Start(Integer workday7Start){
this.workday7Start = workday7Start;
return this;
}
/**
* 设置 结束 周日 1上班 0不上
* @param workday7End
*/
public SiteQuery workday7End(Integer workday7End){
this.workday7End = workday7End;
return this;
}
/**
* 设置 增加 周日 1上班 0不上
* @param workday7Increment
*/
public SiteQuery workday7Increment(Integer workday7Increment){
this.workday7Increment = workday7Increment;
return this;
}
/**
* 设置 周日 1上班 0不上
* @param workday7List
*/
public SiteQuery workday7List(List<Integer> workday7List){
this.workday7List = workday7List;
return this;
}
/**
* 设置 站点编号
* @param number
*/
public SiteQuery number(String number){
setNumber(number);
return this;
}
/**
* 设置 站点编号
* @param numberList
*/
public SiteQuery numberList(List<String> numberList){
this.numberList = numberList;
return this;
}
/**
* 设置 中心介绍
* @param summary
*/
public SiteQuery summary(String summary){
setSummary(summary);
return this;
}
/**
* 设置 中心介绍
* @param summaryList
*/
public SiteQuery summaryList(List<String> summaryList){
this.summaryList = summaryList;
return this;
}
/**
* 设置 排序字段
* @param orderNum
*/
public SiteQuery orderNum(Integer orderNum){
setOrderNum(orderNum);
return this;
}
/**
* 设置 开始 排序字段
* @param orderNumStart
*/
public SiteQuery orderNumStart(Integer orderNumStart){
this.orderNumStart = orderNumStart;
return this;
}
/**
* 设置 结束 排序字段
* @param orderNumEnd
*/
public SiteQuery orderNumEnd(Integer orderNumEnd){
this.orderNumEnd = orderNumEnd;
return this;
}
/**
* 设置 增加 排序字段
* @param orderNumIncrement
*/
public SiteQuery orderNumIncrement(Integer orderNumIncrement){
this.orderNumIncrement = orderNumIncrement;
return this;
}
/**
* 设置 排序字段
* @param orderNumList
*/
public SiteQuery orderNumList(List<Integer> orderNumList){
this.orderNumList = orderNumList;
return this;
}
/**
* 设置 站点状态 ,0,停用,1,正常 默认1
* @param status
*/
public SiteQuery status(Integer status){
setStatus(status);
return this;
}
/**
* 设置 开始 站点状态 ,0,停用,1,正常 默认1
* @param statusStart
*/
public SiteQuery statusStart(Integer statusStart){
this.statusStart = statusStart;
return this;
}
/**
* 设置 结束 站点状态 ,0,停用,1,正常 默认1
* @param statusEnd
*/
public SiteQuery statusEnd(Integer statusEnd){
this.statusEnd = statusEnd;
return this;
}
/**
* 设置 增加 站点状态 ,0,停用,1,正常 默认1
* @param statusIncrement
*/
public SiteQuery statusIncrement(Integer statusIncrement){
this.statusIncrement = statusIncrement;
return this;
}
/**
* 设置 站点状态 ,0,停用,1,正常 默认1
* @param statusList
*/
public SiteQuery statusList(List<Integer> statusList){
this.statusList = statusList;
return this;
}
/**
* 设置 开始 变更时间
* @param updateTimeStart
*/
public SiteQuery updateTimeStart(String updateTimeStart){
this.updateTimeStart = updateTimeStart;
return this;
}
/**
* 设置 结束 变更时间
* @param updateTimeEnd
*/
public SiteQuery updateTimeEnd(String updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
return this;
}
/**
* 设置 变更用户loginName
* @param updateUser
*/
public SiteQuery updateUser(String updateUser){
setUpdateUser(updateUser);
return this;
}
/**
* 设置 变更用户loginName
* @param updateUserList
*/
public SiteQuery updateUserList(List<String> updateUserList){
this.updateUserList = updateUserList;
return this;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public SiteQuery createTimeStart(String createTimeStart){
this.createTimeStart = createTimeStart;
return this;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public SiteQuery createTimeEnd(String createTimeEnd){
this.createTimeEnd = createTimeEnd;
return this;
}
/**
* 设置 创建用户loginName
* @param createUser
*/
public SiteQuery createUser(String createUser){
setCreateUser(createUser);
return this;
}
/**
* 设置 创建用户loginName
* @param createUserList
*/
public SiteQuery createUserList(List<String> createUserList){
this.createUserList = createUserList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
*/
public List<SiteQuery> getOrConditionList(){
return this.orConditionList;
}
/**
* 设置 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @param orConditionList
*/
public void setOrConditionList(List<SiteQuery> orConditionList){
this.orConditionList = orConditionList;
}
/**
* 获取 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @return andConditionList
*/
public List<SiteQuery> getAndConditionList(){
return this.andConditionList;
}
/**
* 设置 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @param andConditionList
*/
public void setAndConditionList(List<SiteQuery> andConditionList){
this.andConditionList = andConditionList;
}
}
\ No newline at end of file
package com.mortals.xhx.base.system.site.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* Treeselect树结构实体类
*
* @author: zxfei
* @date: 2021/10/13 21:08
*/
public class TreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private Long id;
/**
* 节点名称
*/
private String label;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect() {
}
public TreeSelect(SiteEntity site) {
this.id = site.getId();
this.label = site.getSiteName();
this.children = site.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<TreeSelect> getChildren() {
return children;
}
public void setChildren(List<TreeSelect> children) {
this.children = children;
}
}
package com.mortals.xhx.base.system.site.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.base.system.site.model.SiteEntity;
import com.mortals.xhx.base.system.site.model.TreeSelect;
import java.util.List;
/**
* <p>Title: 站点信息表</p>
* <p>Description: SiteService service接口 </p>
* <p>Copyright: Copyright &reg; </p>
*
* @version 1.0.0
*/
public interface SiteService extends ICRUDService<SiteEntity, Long> {
/**
* 是否存在站点子节点
*
* @param siteId SiteID
* @return 结果
*/
boolean hasChildBySiteId(Long siteId);
/**
* 查询站点是否存在用户
*
* @param siteId 站点ID
* @return 结果 true 存在 false 不存在
*/
boolean checkSiteExistUser(Long siteId);
/**
* 查询站点管理数据
*
* @param site 站点信息
* @return 站点信息集合
*/
List<SiteEntity> selectSiteList(SiteEntity site);
/**
* 构建前端所需要下拉树结构
*
* @param sites 站点列表
* @return 下拉树结构列表
*/
public List<TreeSelect> buildSiteTreeSelect(List<SiteEntity> sites);
}
\ No newline at end of file
package com.mortals.xhx.base.system.site.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.SiteSatusEnum;
import com.mortals.xhx.base.system.site.dao.ISiteCustomDao;
import com.mortals.xhx.base.system.site.dao.SiteDao;
import com.mortals.xhx.base.system.site.model.SiteEntity;
import com.mortals.xhx.base.system.site.model.SiteQuery;
import com.mortals.xhx.base.system.site.model.TreeSelect;
import com.mortals.xhx.base.system.site.service.SiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>Title: 站点信息表</p>
* <p>Description: SiteService service接口 </p>
* <p>Copyright: Copyright &reg; </p>
*
* @version 1.0.0
*/
@Service("siteService")
public class SiteServiceImpl extends AbstractCRUDServiceImpl<SiteDao, SiteEntity, Long> implements SiteService {
@Autowired
private ISiteCustomDao siteCustomDao;
@Autowired
private UserService userService;
@Override
protected void validData(SiteEntity entity, Context context) throws AppException {
//校验站点名称是否存在 todo
super.validData(entity, context);
}
@Override
protected void saveBefore(SiteEntity entity, Context context) throws AppException {
SiteEntity parentSiteEntity = this.get(entity.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!ObjectUtils.isEmpty(parentSiteEntity) && SiteSatusEnum.DISENABLE.getValue() == parentSiteEntity.getStatus()) {
throw new AppException("站点停用,不允许新增");
}
if (!ObjectUtils.isEmpty(parentSiteEntity)) {
entity.setAncestors(parentSiteEntity.getAncestors() + "," + entity.getParentId());
}
super.saveBefore(entity, context);
}
@Override
protected void updateBefore(SiteEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
SiteEntity newParentDept = this.get(entity.getParentId());
SiteEntity oldDept = this.get(entity.getId());
if (!ObjectUtils.isEmpty(newParentDept) && !ObjectUtils.isEmpty(oldDept)) {
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getId();
String oldAncestors = oldDept.getAncestors();
entity.setAncestors(newAncestors);
updateDeptChildren(entity.getId(), newAncestors, oldAncestors, context);
}
}
@Override
protected void updateAfter(SiteEntity entity, Context context) throws AppException {
super.updateAfter(entity, context);
if (SiteSatusEnum.ENABLE.getValue() == entity.getStatus()) {
// 如果该部门是启用状态,则启用该部门的所有上级部门
updateParentDeptStatus(entity, context);
}
}
/**
* 修改该部门的父级部门状态
*
* @param dept 当前部门
*/
private void updateParentDeptStatus(SiteEntity dept, Context context) {
SiteEntity siteEntity = this.get(dept.getParentId());
siteEntity.setStatus(SiteSatusEnum.ENABLE.getValue());
siteEntity.setUpdateTime(new Date());
siteEntity.setUpdateUser(context.getUser().getLoginName());
SiteEntity condition = new SiteEntity();
condition.setId(siteEntity.getId());
this.updateBatch(siteEntity, condition, context);
}
/**
* 修改子元素关系
*
* @param deptId 被修改的部门ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors, Context context) {
HashMap<String, String> map = new HashMap<>();
map.put("siteId", deptId.toString());
List<SiteEntity> children = siteCustomDao.selectChildrenSiteById(map);
for (SiteEntity child : children) {
child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors));
}
if (children.size() > 0) {
this.updateAfter(children, context);
// deptMapper.updateDeptChildren(children);
}
}
@Override
protected void removeBefore(Long[] ids, Context context) throws AppException {
//有子节点 禁止删除
if (hasChildBySiteId(ids[0])) {
throw new AppException("存在下级站点,不允许删除");
}
if (checkSiteExistUser(ids[0])) {
throw new AppException("站点存在用户,不允许删除");
}
super.removeBefore(ids, context);
}
@Override
public boolean hasChildBySiteId(Long siteId) {
List<SiteEntity> siteEntities = this.find(new SiteQuery().parentId(siteId));
return siteEntities.size() > 0 ? true : false;
}
@Override
public boolean checkSiteExistUser(Long siteId) {
List<UserEntity> userEntities = userService.find(new UserQuery().siteIds(siteId.toString()));
return userEntities.size() > 0 ? true : false;
}
@Override
public List<SiteEntity> selectSiteList(SiteEntity site) {
return this.find(new SiteQuery());
}
@Override
public List<TreeSelect> buildSiteTreeSelect(List<SiteEntity> sites) {
List<SiteEntity> returnList = new ArrayList<>();
List<Long> tempList = new ArrayList<>();
for (SiteEntity dept : sites) {
tempList.add(dept.getId());
}
for (Iterator<SiteEntity> iterator = sites.iterator(); iterator.hasNext(); ) {
SiteEntity dept = iterator.next();
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(dept.getParentId())) {
recursionFn(sites, dept);
returnList.add(dept);
}
}
if (returnList.isEmpty()) {
returnList = sites;
}
return returnList.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 递归列表
*/
private void recursionFn(List<SiteEntity> list, SiteEntity t) {
// 得到子节点列表
List<SiteEntity> childList = getChildList(list, t);
t.setChildren(childList);
for (SiteEntity tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<SiteEntity> getChildList(List<SiteEntity> list, SiteEntity t) {
List<SiteEntity> tlist = new ArrayList<>();
Iterator<SiteEntity> it = list.iterator();
while (it.hasNext()) {
SiteEntity n = it.next();
if (!ObjectUtils.isEmpty(n.getParentId()) && n.getParentId() == t.getId()) {
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<SiteEntity> list, SiteEntity t) {
return getChildList(list, t).size() > 0 ? true : false;
}
}
\ No newline at end of file
package com.mortals.xhx.base.system.site.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.site.model.SiteEntity;
import com.mortals.xhx.base.system.site.model.SiteQuery;
import com.mortals.xhx.base.system.site.model.TreeSelect;
import com.mortals.xhx.base.system.site.service.SiteService;
import com.mortals.xhx.common.code.SiteSatusEnum;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>Title: 站点信息表</p>
* <p>Description: SiteController </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
*
* @author zxfei
* @version 1.0.0
*/
@RestController
@RequestMapping("site")
public class SiteController extends BaseCRUDJsonMappingController<SiteService, SiteForm, SiteEntity, Long> {
public SiteController() {
super.setFormClass(SiteForm.class);
super.setModuleDesc("站点信息表");
}
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, SiteForm form, Map<String, Object> model, Context context) {
this.addDict(model, "status", SiteSatusEnum.getEnumMap());
super.init(request, response, form, model, context);
}
@PostMapping("list/exclude")
public String excludeList(SiteForm form) {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
Long id = form.getId()[0];
int code=VALUE_RESULT_SUCCESS;
try {
List<SiteEntity> collect = this.service.find(new SiteQuery()).stream().map(item -> {
if (item.getId().intValue() == id || ArrayUtils.contains(StringUtils.split(item.getAncestors(), ","), id + "")) {
return null;
}
return item;
}).filter(f -> f != null).collect(Collectors.toList());
model.put("result", collect);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/**
* 获取站点下拉树列表
*/
@PostMapping("treeselect")
public String treeselect(SiteForm form) {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
int code=VALUE_RESULT_SUCCESS;
try {
List<SiteEntity> list = this.service.find(new SiteQuery());
List<TreeSelect> treeSelects = this.service.buildSiteTreeSelect(list);
model.put("result", treeSelects);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
}
\ No newline at end of file
package com.mortals.xhx.base.system.site.web;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.base.system.site.model.SiteEntity;
import com.mortals.xhx.base.system.site.model.SiteQuery;
/**
* <p>Title: 站点信息表</p>
* <p>Description: SiteForm </p>
* @author
* @version 1.0.0
*/
public class SiteForm extends BaseCRUDFormLong<SiteEntity> {
private SiteEntity entity = new SiteEntity();
private SiteQuery query = new SiteQuery();
public SiteForm(){
}
@Override
public SiteEntity getEntity() {
return entity;
}
public void setSite(SiteEntity entity) {
this.entity = entity;
}
@Override
public SiteQuery getQuery() {
return query;
}
public void setQuery(SiteQuery query) {
this.query = query;
}
}
\ No newline at end of file
package com.mortals.xhx.busiz.req;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
/**
* 短信发送类
*
* @author:
* @date: 2022/9/7 14:35
*/
@Data
public class SmsThirdPartyReq {
/**
*
*/
@JSONField(serialize=false)
private Long alarmSmsSendId;
/**
* appid
*/
private String appid;
/**
* 手机号码
*/
private String phone;
/**
* 模板号
*/
private String type;
/**
* 内容
*/
private String json;
public static void main(String[] args) {
SmsThirdPartyReq smsThirdPartyReq = new SmsThirdPartyReq();
smsThirdPartyReq.setAlarmSmsSendId(0L);
smsThirdPartyReq.setAppid("12");
smsThirdPartyReq.setPhone("31");
smsThirdPartyReq.setType("123");
smsThirdPartyReq.setJson("13213");
System.out.println(JSON.toJSONString(smsThirdPartyReq));
}
}
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class ApiSmsResp<T> {
/**
* 结果编码
*/
private int code;
/**
* 结果描述
*/
private String message;
/**
* 响应数据
*/
private T data;
}
...@@ -22,6 +22,7 @@ import com.mortals.framework.util.DateUtils; ...@@ -22,6 +22,7 @@ import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.framework.annotation.ApiUserAuth; import com.mortals.xhx.base.framework.annotation.ApiUserAuth;
import com.mortals.xhx.base.login.web.LoginForm; import com.mortals.xhx.base.login.web.LoginForm;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.req.DeviceMsgReq; import com.mortals.xhx.busiz.req.DeviceMsgReq;
...@@ -30,8 +31,11 @@ import com.mortals.xhx.busiz.req.UploadDeviceReq; ...@@ -30,8 +31,11 @@ import com.mortals.xhx.busiz.req.UploadDeviceReq;
import com.mortals.xhx.busiz.rsp.*; import com.mortals.xhx.busiz.rsp.*;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders; import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader; import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.pdu.DefaultQueueMsg;
import com.mortals.xhx.common.pdu.DefaultQueueMsgHeader;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
...@@ -53,6 +57,10 @@ import com.mortals.xhx.module.product.model.ProductVersionEntity; ...@@ -53,6 +57,10 @@ import com.mortals.xhx.module.product.model.ProductVersionEntity;
import com.mortals.xhx.module.product.model.ProductVersionQuery; import com.mortals.xhx.module.product.model.ProductVersionQuery;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.module.product.service.ProductVersionService; import com.mortals.xhx.module.product.service.ProductVersionService;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.queue.DefaultTbQueueMsg;
import com.mortals.xhx.queue.TbQueueMsg;
import com.mortals.xhx.queue.TbQueueMsgHeaders; import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo; import com.mortals.xhx.queue.TopicPartitionInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -113,12 +121,18 @@ public class DeviceApiController { ...@@ -113,12 +121,18 @@ public class DeviceApiController {
private SendTaskThreadPool sendTaskThreadPool; private SendTaskThreadPool sendTaskThreadPool;
@Autowired @Autowired
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private SiteService siteService;
@Autowired @Autowired
private FirmService firmService; private FirmService firmService;
@Autowired @Autowired
private DeviceLogService deviceLogService; private DeviceLogService deviceLogService;
@Autowired @Autowired
private ICacheService cacheService; private ICacheService cacheService;
@Autowired
private MessageProducer messageProducer;
@Autowired @Autowired
protected ILogService logService = FileLogServiceImpl.getInstance(); protected ILogService logService = FileLogServiceImpl.getInstance();
...@@ -163,7 +177,10 @@ public class DeviceApiController { ...@@ -163,7 +177,10 @@ public class DeviceApiController {
throw new AppException(DEVICE_UNACTIVE, DEVICE_UNACTIVE_CONTENT); throw new AppException(DEVICE_UNACTIVE, DEVICE_UNACTIVE_CONTENT);
} }
authInfo.setExchangeName(platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode()); // authInfo.setExchangeName(platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode());
//单一交换机
authInfo.setExchangeName(QueueKey.DEFAULT_EXCHANGE);
authInfo.setUploadTopicFilter(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode()); authInfo.setUploadTopicFilter(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode());
authInfo.setDownTopicFilter(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode()); authInfo.setDownTopicFilter(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode());
...@@ -210,7 +227,6 @@ public class DeviceApiController { ...@@ -210,7 +227,6 @@ public class DeviceApiController {
} }
/** /**
* 获取Token * 获取Token
* *
...@@ -223,14 +239,7 @@ public class DeviceApiController { ...@@ -223,14 +239,7 @@ public class DeviceApiController {
try { try {
UserEntity userEntity = userService.doLogin(loginForm.getLoginName(), loginForm.getPassword(), ""); UserEntity userEntity = userService.doLogin(loginForm.getLoginName(), loginForm.getPassword(), "");
if (!ObjectUtils.isEmpty(userEntity)) { if (!ObjectUtils.isEmpty(userEntity)) {
// this.authTokenService.setUser(userEntity);
// userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
// userEntity.setToken(IdUtil.fastSimpleUUID());
// String token = authTokenService.createToken(userEntity);
String token = IdUtil.fastSimpleUUID(); String token = IdUtil.fastSimpleUUID();
//long expireTime = DateUtil.between(DateUtil.beginOfWeek(new Date()), DateUtil.endOfWeek(new Date()), DateUnit.SECOND);
cacheService.setnx(KEY_TOKEN_API_CACHE + token, "", 604800); cacheService.setnx(KEY_TOKEN_API_CACHE + token, "", 604800);
rsp.setData(token); rsp.setData(token);
} }
...@@ -278,12 +287,9 @@ public class DeviceApiController { ...@@ -278,12 +287,9 @@ public class DeviceApiController {
deviceInitResp.setFirmList(firmList); deviceInitResp.setFirmList(firmList);
if (ObjectUtils.isEmpty(firmList)) deviceInitResp.setFirmList(new ArrayList<>()); if (ObjectUtils.isEmpty(firmList)) deviceInitResp.setFirmList(new ArrayList<>());
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu); List<SiteInfo> siteInfoList = siteService.find(new SiteQuery()).stream().map(site -> {
if (resp.getCode() == 1) {
List<SitePdu> sitePduList = resp.getData().getData();
List<SiteInfo> siteInfoList = sitePduList.stream().map(site -> {
SiteInfo siteInfo = new SiteInfo(); SiteInfo siteInfo = new SiteInfo();
siteInfo.setSiteId(site.getId()); siteInfo.setSiteId(site.getId());
siteInfo.setSiteName(site.getSiteName()); siteInfo.setSiteName(site.getSiteName());
...@@ -292,7 +298,22 @@ public class DeviceApiController { ...@@ -292,7 +298,22 @@ public class DeviceApiController {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
deviceInitResp.setSiteList(siteInfoList); deviceInitResp.setSiteList(siteInfoList);
} else { } else {
deviceInitResp.setSiteList(new ArrayList<>()); SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
if (resp.getCode() == 1) {
List<SitePdu> sitePduList = resp.getData().getData();
List<SiteInfo> siteInfoList = sitePduList.stream().map(site -> {
SiteInfo siteInfo = new SiteInfo();
siteInfo.setSiteId(site.getId());
siteInfo.setSiteName(site.getSiteName());
siteInfo.setSiteCode(site.getSiteCode());
return siteInfo;
}).collect(Collectors.toList());
deviceInitResp.setSiteList(siteInfoList);
} else {
deviceInitResp.setSiteList(new ArrayList<>());
}
} }
rsp.setData(deviceInitResp); rsp.setData(deviceInitResp);
} catch (AppException e) { } catch (AppException e) {
...@@ -373,7 +394,8 @@ public class DeviceApiController { ...@@ -373,7 +394,8 @@ public class DeviceApiController {
authInfo.setMessageTtl(messageTtl); authInfo.setMessageTtl(messageTtl);
authInfo.setVirtualHost(virtualHost); authInfo.setVirtualHost(virtualHost);
authInfo.setExchangeName(platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode()); // authInfo.setExchangeName(platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode());
authInfo.setExchangeName(QueueKey.DEFAULT_EXCHANGE);
authInfo.setUploadTopicFilter(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode()); authInfo.setUploadTopicFilter(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode());
authInfo.setDownTopicFilter(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode()); authInfo.setDownTopicFilter(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode());
...@@ -441,7 +463,7 @@ public class DeviceApiController { ...@@ -441,7 +463,7 @@ public class DeviceApiController {
BeanUtils.copyProperties(productVersionEntity, productVersionInfo, BeanUtil.getNullPropertyNames(productVersionEntity)); BeanUtils.copyProperties(productVersionEntity, productVersionInfo, BeanUtil.getNullPropertyNames(productVersionEntity));
buildDownloadUrl(productVersionEntity,productVersionInfo); buildDownloadUrl(productVersionEntity, productVersionInfo);
String content = EncryptUtil.myEnscrt(JSON.toJSONString(productVersionInfo), 9, DES_STR, ENCRYPT_STR); String content = EncryptUtil.myEnscrt(JSON.toJSONString(productVersionInfo), 9, DES_STR, ENCRYPT_STR);
deviceResp.setContent(content); deviceResp.setContent(content);
rsp.setData(deviceResp); rsp.setData(deviceResp);
...@@ -476,15 +498,11 @@ public class DeviceApiController { ...@@ -476,15 +498,11 @@ public class DeviceApiController {
deviceEntity.setDeviceMac(req.getDeviceCode()); deviceEntity.setDeviceMac(req.getDeviceCode());
deviceEntity.setDeviceCode(req.getDeviceCode()); deviceEntity.setDeviceCode(req.getDeviceCode());
deviceEntity.setEnabled(YesNoEnum.YES.getValue()); deviceEntity.setEnabled(YesNoEnum.YES.getValue());
if (!ObjectUtils.isEmpty(req.getActive())) { if (!ObjectUtils.isEmpty(req.getActive())) {
deviceEntity.setDeviceStatus(req.getActive() == YesNoEnum.YES.getValue() ? DeviceStatusEnum.离线.getValue() : DeviceStatusEnum.未激活.getValue()); deviceEntity.setDeviceStatus(req.getActive() == YesNoEnum.YES.getValue() ? DeviceStatusEnum.离线.getValue() : DeviceStatusEnum.未激活.getValue());
} }
// deviceEntity.setDeviceStatus(DeviceStatusEnum.未激活.getValue());
deviceEntity.setSource(req.getSource()); deviceEntity.setSource(req.getSource());
} }
...@@ -538,7 +556,6 @@ public class DeviceApiController { ...@@ -538,7 +556,6 @@ public class DeviceApiController {
DeviceEntity deviceEntity = deviceService.getExtCache(req.getDeviceCode()); DeviceEntity deviceEntity = deviceService.getExtCache(req.getDeviceCode());
if (!ObjectUtils.isEmpty(deviceEntity)) { if (!ObjectUtils.isEmpty(deviceEntity)) {
//将上报信息转发到mq中 //将上报信息转发到mq中
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
if (ObjectUtils.isEmpty(platformEntity)) { if (ObjectUtils.isEmpty(platformEntity)) {
throw new AppException("当前设备未配置所属系统平台,请在后台配置后再激活!"); throw new AppException("当前设备未配置所属系统平台,请在后台配置后再激活!");
...@@ -548,17 +565,23 @@ public class DeviceApiController { ...@@ -548,17 +565,23 @@ public class DeviceApiController {
if (ObjectUtils.isEmpty(productEntity)) { if (ObjectUtils.isEmpty(productEntity)) {
throw new AppException("当前设备未配置所属产品,请在后台配置后再激活!"); throw new AppException("当前设备未配置所属产品,请在后台配置后再激活!");
} }
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode()).build();
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders(); TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, Constant.MESSAGETYPE_HEARTBEAT); header.put(MessageHeader.MESSAGETYPE, MESSAGETYPE_HEARTBEAT);
header.put(MessageHeader.DEVICECODE, deviceEntity.getDeviceCode()); header.put(MessageHeader.DEVICECODE, req.getDeviceCode());
for (int i = 0; i < 100; i++) { header.put(MessageHeader.TIMESTAMP, DateUtils.getCurrStrDateTime());
header.put(MessageHeader.MESSAGESIGN, "abcd1234");
log.info("sendMesageTopic:{}", JSON.toJSONString(info)); TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), "==", header);
deviceService.sendDeviceMessage(deviceEntity, info, header, JSON.toJSONString(req), null, null); // String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
Thread.sleep(50); // TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode()).build();
// TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
// header.put(MessageHeader.MESSAGETYPE, Constant.MESSAGETYPE_HEARTBEAT);
// header.put(MessageHeader.DEVICECODE, deviceEntity.getDeviceCode());
for (int i = 0; i < 10; i++) {
messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE, Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode(), JSON.toJSONString(queueMsg));
//log.info("sendMesageTopic:{}", JSON.toJSONString(info));
//deviceService.sendDeviceMessage(deviceEntity, info, header, JSON.toJSONString(req), null, null);
//Thread.sleep(50);
} }
//log.info(String.format("sendMsgResp:%s", JSON.toJSONString(sendDeviceMessageResp))); //log.info(String.format("sendMsgResp:%s", JSON.toJSONString(sendDeviceMessageResp)));
} }
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
public enum PlatformTypeEnum {
STANDALONE("standalone", "单机版"),
CLOUD("cloud", "微服务版");
private String value;
private String desc;
PlatformTypeEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public static PlatformTypeEnum getByValue(String value) {
for (PlatformTypeEnum YesNoEnum : PlatformTypeEnum.values()) {
if (YesNoEnum.getValue() == value) {
return YesNoEnum;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(String... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (PlatformTypeEnum item : PlatformTypeEnum.values()) {
try{
boolean hasE = false;
for (String e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code; package com.mortals.xhx.common.code;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public enum BomStatusEnum implements IBaseEnum{ /**
* 站点状态
BOM_EDIT(401, "修订中"), * @author
BOM_AUDIT(402, "审核中"), *
BOM_PUBLISH(403, "已发布"); */
public enum SatusEnum {
DISENABLE(0, "禁用"),
ENABLE(1, "启用");
private int value; private int value;
private String desc; private String desc;
BomStatusEnum(int value, String desc) {
SatusEnum(int value, String desc) {
this.value = value; this.value = value;
this.desc = desc; this.desc = desc;
} }
@Override
public int getValue() { public int getValue() {
return this.value; return this.value;
} }
...@@ -28,10 +30,10 @@ public enum BomStatusEnum implements IBaseEnum{ ...@@ -28,10 +30,10 @@ public enum BomStatusEnum implements IBaseEnum{
return desc; return desc;
} }
public static BomStatusEnum getByValue(int value) { public static SatusEnum getByValue(int value) {
for (BomStatusEnum YesNoEnum : BomStatusEnum.values()) { for (SatusEnum examStatus : SatusEnum.values()) {
if (YesNoEnum.getValue() == value) { if (examStatus.getValue() == value) {
return YesNoEnum; return examStatus;
} }
} }
return null; return null;
...@@ -42,8 +44,9 @@ public enum BomStatusEnum implements IBaseEnum{ ...@@ -42,8 +44,9 @@ public enum BomStatusEnum implements IBaseEnum{
* @return * @return
*/ */
public static Map<String,String> getEnumMap(int... eItem) { public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>(); Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (BomStatusEnum item : BomStatusEnum.values()) { for (SatusEnum item : SatusEnum.values()) {
try{ try{
boolean hasE = false; boolean hasE = false;
for (int e : eItem){ for (int e : eItem){
...@@ -60,5 +63,4 @@ public enum BomStatusEnum implements IBaseEnum{ ...@@ -60,5 +63,4 @@ public enum BomStatusEnum implements IBaseEnum{
} }
return resultMap; return resultMap;
} }
} }
...@@ -12,7 +12,7 @@ public enum SendStatusEnum { ...@@ -12,7 +12,7 @@ public enum SendStatusEnum {
未发送(0, "未发送"), 未发送(0, "未发送"),
提交(1, "提交"), 提交(1, "提交"),
发送成功(2, "发送成功"), 发送成功(2, "发送成功"),
生失败(3, "发生失败"); 送失败(3, "发送失败");
private Integer value; private Integer value;
private String desc; private String desc;
......
...@@ -81,6 +81,11 @@ public final class Constant { ...@@ -81,6 +81,11 @@ public final class Constant {
*/ */
public final static String PARAM_SERVER_HTTP_URL = "server_http_url"; public final static String PARAM_SERVER_HTTP_URL = "server_http_url";
/**
* 短信平台url
*/
public final static String PARAM_SMS_HTTP_URL = "sms_http_url";
/** /**
* rabbmit exchange分隔符 * rabbmit exchange分隔符
*/ */
...@@ -114,4 +119,14 @@ public final class Constant { ...@@ -114,4 +119,14 @@ public final class Constant {
public static final String DISTRIBUTE_PATH = "distribute_path"; public static final String DISTRIBUTE_PATH = "distribute_path";
/**
* 站点编号分隔符
*/
public static final String SITE_SPLIT_MARK = "-";
/**
* 站点编号补零位数
*/
public static final Integer SITE_CODE_NUM = 4;
} }
...@@ -14,10 +14,10 @@ public class QueueKey { ...@@ -14,10 +14,10 @@ public class QueueKey {
public static final String OPERATION_LOG_QUEUE = "OPERATION_LOG_QUEUE"; public static final String OPERATION_LOG_QUEUE = "OPERATION_LOG_QUEUE";
public static final String EXCHANGE = "LOG"; public static final String EXCHANGE = "LOG";
public static final String DEFAULT_EXCHANGE = "amq.direct";
public static final String ROUTING_KEY = "LOG_ROUTING_KEY"; public static final String ROUTING_KEY = "LOG_ROUTING_KEY";
......
package com.mortals.xhx.common.pdu;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.queue.DefaultTbQueueMsg;
import com.mortals.xhx.queue.TbQueueMsg;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import lombok.Data;
/**
* @author: zxfei
* @date: 2022/9/2 10:27
* @description:
**/
@Data
public class DefaultQueueMsg {
/**
* 消息key
*/
private String key;
/**
* 消息体(base64编码)
*/
private String data;
private DefaultQueueMsgHeader headers;
public static void main(String[] args) {
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, "UPGREAD");
// header.put(MessageHeader.CLIENTID, "abcd1234");
// header.put(MessageHeader.TIMESTAMP, DateUtils.getCurrStrDateTime());
//header.put(MessageHeader.MESSAGESIGN,"ssdafasdfasdfasfd");
TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), "eyJmbG93bnVtIjoiQzEwMTEifQ==" , header);
String ret = JSON.toJSONString(queueMsg);
System.out.println("pro:"+ret);
//
DefaultQueueMsg qu = JSON.parseObject(ret, DefaultQueueMsg.class);
System.out.println("header:"+qu.getHeaders().getData().get(MessageHeader.MESSAGETYPE));
System.out.println("data:"+qu.getData());
}
}
package com.mortals.xhx.common.pdu;
import lombok.Data;
import java.util.Map;
/**
* @author: zxfei
* @date: 2022/9/2 10:30
* @description:
**/
@Data
public class DefaultQueueMsgHeader {
/**
* 消息头
*/
private Map<String, String> data;
}
package com.mortals.xhx.common.utils; package com.mortals.xhx.common.utils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.common.Rest;
import com.mortals.framework.util.HttpUtil; import com.mortals.framework.util.HttpUtil;
import com.mortals.xhx.busiz.req.ApiThirdPartyReq; import com.mortals.xhx.busiz.req.ApiThirdPartyReq;
import com.mortals.xhx.busiz.req.SmsThirdPartyReq;
import com.mortals.xhx.busiz.rsp.ApiSmsResp;
import com.mortals.xhx.common.code.MessageTypeEnum; import com.mortals.xhx.common.code.MessageTypeEnum;
import com.mortals.xhx.common.code.SendStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity; import com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity;
import jdk.nashorn.internal.runtime.regexp.joni.constants.RegexState;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -24,10 +31,11 @@ import static com.mortals.framework.util.HttpUtil.HEADER_CONTENT_TYPE; ...@@ -24,10 +31,11 @@ import static com.mortals.framework.util.HttpUtil.HEADER_CONTENT_TYPE;
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
public class SendSmsTask implements Runnable { public class SendSmsTask implements Runnable {
/** /**
* 短信消息 * 短信消息
*/ */
private AlarmSmsSendEntity alarmSmsSendEntity; private SmsThirdPartyReq smsThirdPartyReq;
/** /**
* 接口地址 * 接口地址
...@@ -36,19 +44,27 @@ public class SendSmsTask implements Runnable { ...@@ -36,19 +44,27 @@ public class SendSmsTask implements Runnable {
@Override @Override
public void run() { public void run() {
// TODO: 2022/7/5 短信发送
String resp = null; String resp = null;
AlarmSmsSendEntity alarmSmsSendEntityResp = new AlarmSmsSendEntity();
alarmSmsSendEntityResp.setId(smsThirdPartyReq.getAlarmSmsSendId());
try { try {
Map<String, String> header = new HashMap<>(); Map<String, String> header = new HashMap<>();
header.put(HEADER_CONTENT_TYPE, "application/json"); header.put(HEADER_CONTENT_TYPE, "application/json");
// resp = HttpUtil.doPost(sendUrl, header, JSON.toJSONString(deviceReqApiReq)); resp = HttpUtil.doPost(sendUrl, header, JSON.toJSONString(smsThirdPartyReq));
ApiSmsResp<Void> apiSmsResp = JSON.parseObject(resp, new TypeReference<ApiSmsResp<Void>>() {
});
if (apiSmsResp.getCode() == 1) {
alarmSmsSendEntityResp.setSendStatus(SendStatusEnum.发送成功.getValue());
} else {
alarmSmsSendEntityResp.setSendStatus(SendStatusEnum.发送失败.getValue());
log.info("短信提交失败,req:{}, resp:{}",JSON.toJSONString(smsThirdPartyReq), resp);
}
//发送成功添加到响应队列,由线程批量更新 //发送成功添加到响应队列,由线程批量更新
SmsQueueManager.offerRespQueue(alarmSmsSendEntityResp);
SmsQueueManager.offerRespQueue(alarmSmsSendEntity);
log.debug("resp:{}", resp); log.debug("resp:{}", resp);
} catch (Exception e) { } catch (Exception e) {
alarmSmsSendEntityResp.setSendStatus(SendStatusEnum.发送失败.getValue());
SmsQueueManager.offerRespQueue(alarmSmsSendEntityResp);
log.error("异常:", e); log.error("异常:", e);
} }
} }
......
package com.mortals.xhx.common.utils;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* @author: zxfei
* @date: 2022/4/13 13:34
* @description:
**/
@AllArgsConstructor
@Slf4j
public class SyncTreeSiteThread implements Runnable {
private SiteService siteService;
private Context context;
@Override
public void run() {
List<SiteTreeSelect> siteTreeSelects = siteService.siteTree(context);
siteService.setSiteTree(siteTreeSelects, context);
log.debug("刷新用户站点树=》userID:{} siteTree:{}",context.getUser().getId(), JSON.toJSONString(siteService.getSiteTree(context)));
}
}
...@@ -43,7 +43,7 @@ import java.util.Map; ...@@ -43,7 +43,7 @@ import java.util.Map;
@RequestMapping("/test/") @RequestMapping("/test/")
public class DemoApiController { public class DemoApiController {
@Autowired // @Autowired
private TbCoreQueueProducerProvider producerProvider; private TbCoreQueueProducerProvider producerProvider;
@Autowired @Autowired
private DeviceService deviceService; private DeviceService deviceService;
......
package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.xhx.base.framework.listener.DirectDynamicListener;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
/**
* 初始化设备消费者注册
*
* @author: zxfei
* @date: 2022/9/2 9:17
*/
@Component
@Slf4j
public class DeviceComsumersRegisterService implements IApplicationStartedService {
@Autowired
private DeviceService deviceService;
@Autowired
private ProductService productService;
@Autowired
private PlatformService platformService;
@Autowired
private DirectMessageListenerContainer container;
@Autowired
private MessageProducer messageProducer;
@Autowired
private DirectDynamicListener directDynamicListener;
@Override
public void start() {
log.info("服务端消息队列初始化服务开始..");
deviceService.find(new DeviceEntity())
.stream()
.filter(f -> !ObjectUtils.isEmpty(platformService.get(f.getPlatformId())))
.filter(f -> !ObjectUtils.isEmpty(productService.get(f.getProductId()))).forEach(item -> {
String uploadQueue = Constant.UPLOAD_TOPIC + item.getDeviceCode();
String downQueue = Constant.DOWN_TOPIC + item.getDeviceCode();
messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, uploadQueue, uploadQueue);
messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, downQueue, downQueue);
});
String[] queues = deviceService.find(new DeviceEntity())
.stream()
.filter(f -> !ObjectUtils.isEmpty(platformService.get(f.getPlatformId())))
.filter(f -> !ObjectUtils.isEmpty(productService.get(f.getProductId())))
.map(item -> Constant.UPLOAD_TOPIC + item.getDeviceCode())
.toArray(String[]::new);
log.info("服务端消费消息注册服务开始..");
container.addQueueNames(queues);
container.start();
container.setMessageListener(directDynamicListener);
}
@Override
public void stop() {
log.info("停止服务..");
container.stop();
}
@Override
public int getOrder() {
return 10;
}
}
...@@ -40,7 +40,7 @@ import java.util.stream.Collectors; ...@@ -40,7 +40,7 @@ import java.util.stream.Collectors;
import static com.mortals.xhx.common.model.MessageHeader.*; import static com.mortals.xhx.common.model.MessageHeader.*;
@Component //@Component
@Slf4j @Slf4j
public class DeviceMsgComsumerStartedService implements IApplicationStartedService { public class DeviceMsgComsumerStartedService implements IApplicationStartedService {
...@@ -59,8 +59,8 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi ...@@ -59,8 +59,8 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
@Autowired @Autowired
private ICacheService cacheService; private ICacheService cacheService;
@Autowired // @Autowired
private IMessageProduceService messageProduceService; // private IMessageProduceService messageProduceService;
protected volatile ExecutorService consumersExecutor; protected volatile ExecutorService consumersExecutor;
...@@ -74,9 +74,9 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi ...@@ -74,9 +74,9 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
if (!ObjectUtils.isEmpty(mainConsumer)) { if (!ObjectUtils.isEmpty(mainConsumer)) {
//订阅所有已激活设备 //订阅所有已激活设备
Set<TopicPartitionInfo> topicPartitionInfoSet = deviceService.find(new DeviceEntity() Set<TopicPartitionInfo> topicPartitionInfoSet = deviceService.find(new DeviceEntity()
//.active(ActiveEnum.已激活.getValue()) //.active(ActiveEnum.已激活.getValue())
//.status(StatusEnum.启用.getValue()) //.status(StatusEnum.启用.getValue())
) )
.stream() .stream()
.filter(f -> !ObjectUtils.isEmpty(platformService.get(f.getPlatformId()))) .filter(f -> !ObjectUtils.isEmpty(platformService.get(f.getPlatformId())))
.filter(f -> !ObjectUtils.isEmpty(productService.get(f.getProductId()))) .filter(f -> !ObjectUtils.isEmpty(productService.get(f.getProductId())))
...@@ -199,18 +199,16 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi ...@@ -199,18 +199,16 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
//获取exchange, //获取exchange,
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
if (!Constant.MESSAGETYPE_HEARTBEAT.equalsIgnoreCase(messageType) if (!Constant.MESSAGETYPE_HEARTBEAT.equalsIgnoreCase(messageType)
&&!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(platformEntity)
&& platformEntity.getSendSwitch() == YesNoEnum.YES.getValue()) { && platformEntity.getSendSwitch() == YesNoEnum.YES.getValue()) {
if (platformEntity.getSendMsgType() == SendMsgTypeEnum.http.getValue() && !ObjectUtils.isEmpty(platformEntity.getSendUrl())) { if (platformEntity.getSendMsgType() == SendMsgTypeEnum.http.getValue() && !ObjectUtils.isEmpty(platformEntity.getSendUrl())) {
//http方式 //http方式
//通过线程池进行发送消息 //通过线程池进行发送消息
SendTask sendTask = new SendTask(platformEntity.getSendUrl(),queueMsg.getData()); SendTask sendTask = new SendTask(platformEntity.getSendUrl(), queueMsg.getData());
sendTaskThreadPool.execute(sendTask); sendTaskThreadPool.execute(sendTask);
} }
} }
// if (bool) {
// WebSocketUtil.broadcast(SendToAllRequest.TYPE, new SendToAllRequest().setContent(JSON.toJSONString(deviceEntity)));
// }
} }
} }
......
...@@ -13,6 +13,7 @@ import com.mortals.xhx.common.utils.SendTaskThreadPool; ...@@ -13,6 +13,7 @@ import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.common.utils.SmsQueueManager; import com.mortals.xhx.common.utils.SmsQueueManager;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity; import com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity;
import com.mortals.xhx.module.alarm.service.AlarmSmsSendService;
import com.mortals.xhx.module.platform.model.PlatformQuery; import com.mortals.xhx.module.platform.model.PlatformQuery;
import com.mortals.xhx.module.platform.service.PlatformService; import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductQuery; import com.mortals.xhx.module.product.model.ProductQuery;
...@@ -33,7 +34,7 @@ import java.util.concurrent.TimeUnit; ...@@ -33,7 +34,7 @@ import java.util.concurrent.TimeUnit;
import static com.mortals.xhx.common.key.RedisKey.*; import static com.mortals.xhx.common.key.RedisKey.*;
@Component //@Component
@Slf4j @Slf4j
public class DeviceStartService implements IApplicationStartedService { public class DeviceStartService implements IApplicationStartedService {
...@@ -49,22 +50,23 @@ public class DeviceStartService implements IApplicationStartedService { ...@@ -49,22 +50,23 @@ public class DeviceStartService implements IApplicationStartedService {
private PlatformService platformService; private PlatformService platformService;
@Autowired @Autowired
private ProductService productService; private ProductService productService;
@Autowired
private AlarmSmsSendService alarmSmsSendService;
@Override @Override
public void start() { public void start() {
log.info("初始化发送线程数量"); log.info("初始化发送线程数量");
sendTaskThreadPool.init(20); sendTaskThreadPool.init(20);
//启动短信发送响应更新线程 //启动短信发送响应更新线程
sendTaskThreadPool.execute(() -> {
/* sendTaskThreadPool.execute(() -> {
int waitTime = 1000; int waitTime = 1000;
while (!stopped) { while (!stopped) {
try { try {
AlarmSmsSendEntity message = SmsQueueManager.pollRespQueue(); AlarmSmsSendEntity message = SmsQueueManager.pollRespQueue();
if (!ObjectUtils.isEmpty(message)) { if (!ObjectUtils.isEmpty(message)) {
// TODO: 2022/7/5 更新响应 alarmSmsSendService.update(message, null);
} }
} catch (Exception e) { } catch (Exception e) {
if (!stopped) { if (!stopped) {
try { try {
...@@ -74,7 +76,7 @@ public class DeviceStartService implements IApplicationStartedService { ...@@ -74,7 +76,7 @@ public class DeviceStartService implements IApplicationStartedService {
} }
} }
} }
});*/ });
//初始化站点缓存 //初始化站点缓存
...@@ -103,6 +105,7 @@ public class DeviceStartService implements IApplicationStartedService { ...@@ -103,6 +105,7 @@ public class DeviceStartService implements IApplicationStartedService {
@Override @Override
public void stop() { public void stop() {
log.info("停止服务.."); log.info("停止服务..");
this.stopped = true;
} }
@Override @Override
......
...@@ -3,6 +3,7 @@ package com.mortals.xhx.daemon.applicationservice; ...@@ -3,6 +3,7 @@ package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.springcloud.service.IApplicationStartedService; import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.xhx.daemon.netty.config.NettyServerConfig; import com.mortals.xhx.daemon.netty.config.NettyServerConfig;
import com.mortals.xhx.daemon.netty.server.controlserver.ControlServer; import com.mortals.xhx.daemon.netty.server.controlserver.ControlServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,10 +18,9 @@ import static com.mortals.xhx.common.key.Constant.SERVER_PORT; ...@@ -17,10 +18,9 @@ import static com.mortals.xhx.common.key.Constant.SERVER_PORT;
* @date: 2022/4/8 11:10 * @date: 2022/4/8 11:10
*/ */
@Component @Component
@Slf4j
public class NettyStartedService implements IApplicationStartedService { public class NettyStartedService implements IApplicationStartedService {
private static Log logger = LogFactory.getLog(NettyStartedService.class);
@Autowired @Autowired
private ControlServer controlServer; private ControlServer controlServer;
...@@ -29,7 +29,7 @@ public class NettyStartedService implements IApplicationStartedService { ...@@ -29,7 +29,7 @@ public class NettyStartedService implements IApplicationStartedService {
@Override @Override
public void start() { public void start() {
logger.info("开始netty服务...."); log.info("开始netty服务....");
thread = new Thread(() -> { thread = new Thread(() -> {
controlServer.run(SERVER_PORT); controlServer.run(SERVER_PORT);
}); });
...@@ -40,11 +40,15 @@ public class NettyStartedService implements IApplicationStartedService { ...@@ -40,11 +40,15 @@ public class NettyStartedService implements IApplicationStartedService {
@Override @Override
public void stop() { public void stop() {
logger.info("停止服务.."); log.info("停止服务..");
if (thread != null) { if (thread != null) {
thread.interrupt(); thread.interrupt();
} }
if (controlServer != null) {
controlServer.release();
}
} }
@Override @Override
......
package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.model.Context;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 应用级服务,在应用启动后、停止过程中调用
* 应用已经完成启动完成,才调用该服务
* 应用场景:
* 1、应用任务,应用启动后定时或间隔执行的任务
* 2、Socket服务端
*/
@Component
@Slf4j
public class SiteStartedService implements IApplicationStartedService {
@Autowired
private SiteService siteService;
@Autowired
private UserService userService;
@Override
public void start() {
log.info("开始服务..[初始化用户站点树]");
ThreadPool.getInstance().init(20);
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(0L);
Context contextTemp = new Context();
contextTemp.setUser(userEntity);
SyncTreeSiteThread syncTreeSiteThread = new SyncTreeSiteThread(siteService, contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
userService.find(new UserQuery()).forEach(user -> {
Context context = new Context();
context.setUser(user);
ThreadPool.getInstance().execute(new SyncTreeSiteThread(siteService, context));
});
}
@Override
public void stop() {
log.info("停止服务..");
ThreadPool.getInstance().close();
}
@Override
public int getOrder() {
return 10;
}
}
...@@ -47,11 +47,6 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService { ...@@ -47,11 +47,6 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService {
private DeviceLogService deviceLogService; private DeviceLogService deviceLogService;
@Autowired @Autowired
private DeviceModuleUseService deviceModuleUseService; private DeviceModuleUseService deviceModuleUseService;
@Autowired
private ProductService productService;
@Autowired
private PlatformService platformService;
@Autowired @Autowired
private DeviceModuleService moduleService; private DeviceModuleService moduleService;
...@@ -68,7 +63,6 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService { ...@@ -68,7 +63,6 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService {
private void doDeviceModuleUse() { private void doDeviceModuleUse() {
Map<String, DeviceModuleEntity> moduleMap = moduleService.find(new DeviceModuleQuery()).stream().collect(Collectors.toMap(x -> x.getModuleMsgCode(), y -> y, (o, n) -> n)); Map<String, DeviceModuleEntity> moduleMap = moduleService.find(new DeviceModuleQuery()).stream().collect(Collectors.toMap(x -> x.getModuleMsgCode(), y -> y, (o, n) -> n));
try { try {
// TODO: 2022/7/2 根据每个设备单独查询统计 计算数据量会减少 // TODO: 2022/7/2 根据每个设备单独查询统计 计算数据量会减少
List<DeviceModuleUseEntity> moduleUseEntityList = deviceService.getCacheList().stream().flatMap(device -> { List<DeviceModuleUseEntity> moduleUseEntityList = deviceService.getCacheList().stream().flatMap(device -> {
//查询当前设备日志 //查询当前设备日志
...@@ -93,7 +87,6 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService { ...@@ -93,7 +87,6 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService {
}).filter(f -> f != null); }).filter(f -> f != null);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(moduleUseEntityList)) { if (!ObjectUtils.isEmpty(moduleUseEntityList)) {
//遍历,更新统计数据表 标识 设备id与消息头 //遍历,更新统计数据表 标识 设备id与消息头
Map<String, DeviceModuleUseEntity> collect = deviceModuleUseService.find(new DeviceModuleUseQuery()).stream().collect(Collectors.toMap(x -> x.getDeviceId() + "#" + x.getModuleMsgCode(), y -> y, (o, n) -> n)); Map<String, DeviceModuleUseEntity> collect = deviceModuleUseService.find(new DeviceModuleUseQuery()).stream().collect(Collectors.toMap(x -> x.getDeviceId() + "#" + x.getModuleMsgCode(), y -> y, (o, n) -> n));
...@@ -109,74 +102,14 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService { ...@@ -109,74 +102,14 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService {
} else { } else {
//新增 //新增
deviceModuleUseService.save(mudule, null); deviceModuleUseService.save(mudule, null);
} }
}); });
} }
} catch (Exception e) { } catch (Exception e) {
log.error("更新任务异常,结束执行", e); log.error("更新任务异常,结束执行", e);
} }
} }
/**
* 统计更新设备状态
*/
private void doDeviceUpOrDown() {
int timeout = GlobalSysInfo.getParamIntValue(ParamKey.SYS_PARAM_HEADBEAT_TIMEOUT, 60) * 1000;
try {
//获取所有设备,针对每个设备查询最近指定秒的日志,如果没有则更新下线
deviceService.getCacheList().stream()
.filter(f -> f.getDeviceStatus() == DeviceStatusEnum.在线.getValue())
.peek(device -> {
DeviceLogQuery query = new DeviceLogQuery();
query.setCreateTimeStart(DateUtils.getStrDateTime(new Date(System.currentTimeMillis() - timeout)));
DeviceLogEntity deviceLogEntity = deviceLogService.selectOne(query);
if (ObjectUtils.isEmpty(deviceLogEntity)) {
//更新设备下线
device.setOfflineTime(new Date());
device.setDeviceStatus(DeviceStatusEnum.离线.getValue());
deviceService.update(device);
String msg = String.format("%s设备:%s ,离线!", device.getProductName(), device.getDeviceCode());
WebSocketUtil.broadcast(SendToAllRequest.TYPE, new SendToAllRequest().setContent(msg));
PlatformEntity platformEntity = platformService.get(device.getPlatformId());
ProductEntity productEntity = productService.get(device.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台
deviceService.sendThirdParty(device, productEntity, platformEntity, DeviceMethodEnum.OFFLINE);
}
}
}).count();
} catch (Exception e) {
log.error("更新设备状态任务异常,结束执行", e);
}
log.debug("更新设备状态任务,结束执行");
}
/**
* 定时清除设备日志
*/
private void doDeviceLogDel() {
//默认保存30天日志
int timeout = -GlobalSysInfo.getParamIntValue(ParamKey.SYS_PARAM_LOG_TIME, 30);
try {
DeviceLogQuery query = new DeviceLogQuery();
query.setCreateTimeEnd(DateUtils.getStrDateTime(DateUtils.addCurrDate(timeout)));
Long[] ids = deviceLogService.find(query).stream().map(DeviceLogEntity::getId).toArray(Long[]::new);
if (!ObjectUtils.isEmpty(ids)) {
deviceLogService.remove(ids, null);
}
} catch (Exception e) {
log.error("设备日志删除任务异常,结束执行", e);
}
log.debug("设备日志删除任务,结束执行");
}
@Override @Override
public void stopTask(ITask task) throws AppException { public void stopTask(ITask task) throws AppException {
......
...@@ -55,7 +55,6 @@ public class DeviceStatTaskImpl implements ITaskExcuteService { ...@@ -55,7 +55,6 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
if (!ObjectUtils.isEmpty(deviceOfflineList)) { if (!ObjectUtils.isEmpty(deviceOfflineList)) {
deviceService.update(deviceOfflineList); deviceService.update(deviceOfflineList);
deviceOfflineList.forEach(deviceEntity -> { deviceOfflineList.forEach(deviceEntity -> {
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.get(deviceEntity.getProductId());
...@@ -64,9 +63,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService { ...@@ -64,9 +63,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.OFFLINE); deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.OFFLINE);
} }
}); });
} }
} }
......
...@@ -19,8 +19,11 @@ import com.mortals.xhx.module.device.model.*; ...@@ -19,8 +19,11 @@ import com.mortals.xhx.module.device.model.*;
import com.mortals.xhx.module.device.service.*; import com.mortals.xhx.module.device.service.*;
import com.mortals.xhx.module.platform.service.PlatformService; import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -45,34 +48,36 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService { ...@@ -45,34 +48,36 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private DeviceService deviceService; private DeviceService deviceService;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private SiteService siteService;
@Autowired @Autowired
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
//统计所有站点
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
siteFeign.list(sitePdu).getData().getData().parallelStream().forEach(item -> {
deviceService.deviceStat(item.getId(), null);
});
}
@Override if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
public void stopTask(ITask task) throws AppException { //统计所有站点
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
siteFeign.list(sitePdu).getData().getData().parallelStream().forEach(item -> {
deviceService.deviceStat(item.getId(), null);
});
} else if(platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
siteService.find(new SiteQuery()).forEach(item -> {
deviceService.deviceStat(item.getId(), null);
});
}
} }
public static void main(String[] args) { @Override
public void stopTask(ITask task) throws AppException {
System.out.println(DateUtil.month(new Date()));
System.out.println(DateUtil.year(new Date()));
System.out.println(DateUtil.dayOfMonth(new Date()));
} }
} }
package com.mortals.xhx.daemon.task; package com.mortals.xhx.daemon.task;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DateUtils; import com.mortals.xhx.common.code.PlatformTypeEnum;
import com.mortals.xhx.base.framework.ws.message.SendToAllRequest;
import com.mortals.xhx.base.framework.ws.util.WebSocketUtil;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.device.model.DeviceLogEntity; import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.device.service.DeviceLogService; import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.module.sitestat.model.SitestatEntity; import com.mortals.xhx.module.sitestat.model.SitestatEntity;
import com.mortals.xhx.module.sitestat.service.SitestatService; import com.mortals.xhx.module.sitestat.service.SitestatService;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -40,7 +26,7 @@ import java.util.List; ...@@ -40,7 +26,7 @@ import java.util.List;
* @author: zxfei * @author: zxfei
* @date: 2022/3/9 15:19 * @date: 2022/3/9 15:19
*/ */
@CommonsLog @Slf4j
@Service("SiteStatTask") @Service("SiteStatTask")
public class SiteStatTaskImpl implements ITaskExcuteService { public class SiteStatTaskImpl implements ITaskExcuteService {
...@@ -48,16 +34,31 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -48,16 +34,31 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
private SitestatService sitestatService; private SitestatService sitestatService;
@Autowired @Autowired
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private SiteService siteService;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
SitePdu sitePdu = new SitePdu(); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
sitePdu.setSize(-1); SitePdu sitePdu = new SitePdu();
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu); sitePdu.setSize(-1);
if (resp.getCode() == 1) { Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
List<SitePdu> sitePduList = resp.getData().getData(); if (resp.getCode() == 1) {
sitePduList.stream().forEach(site -> { List<SitePdu> sitePduList = resp.getData().getData();
sitePduList.stream().forEach(site -> {
SitestatEntity sitestatEntity = new SitestatEntity();
sitestatEntity.initAttrValue();
sitestatEntity.setSiteId(site.getId());
sitestatEntity.setSiteName(site.getSiteName());
sitestatEntity.setSiteCode(site.getSiteCode());
sitestatService.updateSiteStat(sitestatEntity, null);
});
}
} else if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
siteService.find(new SiteQuery()).forEach(site -> {
SitestatEntity sitestatEntity = new SitestatEntity(); SitestatEntity sitestatEntity = new SitestatEntity();
sitestatEntity.initAttrValue(); sitestatEntity.initAttrValue();
sitestatEntity.setSiteId(site.getId()); sitestatEntity.setSiteId(site.getId());
......
package com.mortals.xhx.daemon.task; package com.mortals.xhx.daemon.task;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.busiz.req.SmsThirdPartyReq;
import com.mortals.xhx.common.code.SendStatusEnum; import com.mortals.xhx.common.code.SendStatusEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.utils.SendSmsTask; import com.mortals.xhx.common.utils.SendSmsTask;
import com.mortals.xhx.common.utils.SendTaskThreadPool; import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity; import com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity;
...@@ -11,9 +14,11 @@ import com.mortals.xhx.module.alarm.model.AlarmSmsSendQuery; ...@@ -11,9 +14,11 @@ import com.mortals.xhx.module.alarm.model.AlarmSmsSendQuery;
import com.mortals.xhx.module.alarm.service.AlarmSmsSendService; import com.mortals.xhx.module.alarm.service.AlarmSmsSendService;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.security.DenyAll; import javax.annotation.security.DenyAll;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -32,13 +37,32 @@ public class SmsSendTaskImpl implements ITaskExcuteService { ...@@ -32,13 +37,32 @@ public class SmsSendTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private SendTaskThreadPool sendTaskThreadPool; private SendTaskThreadPool sendTaskThreadPool;
@Value("${sms.smsSendUrl:http://127.0.0.1:8089/api/index/index}")
private String smsSendUrl;
@Value("${sms.apiId:''}")
private String apiId;
@Value("${sms.type:''}")
private String type;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
String sendUrl = GlobalSysInfo.getParamValue(Constant.PARAM_SMS_HTTP_URL, smsSendUrl);
List<AlarmSmsSendEntity> sendList = alarmSmsSendService.find(new AlarmSmsSendQuery().sendStatus(SendStatusEnum.未发送.getValue())); List<AlarmSmsSendEntity> sendList = alarmSmsSendService.find(new AlarmSmsSendQuery().sendStatus(SendStatusEnum.未发送.getValue()));
sendList.stream().forEach(sms->{ sendList.stream().forEach(sms -> {
SendSmsTask sendSmsTask = new SendSmsTask(sms, "xxx"); SmsThirdPartyReq smsThirdPartyReq = new SmsThirdPartyReq();
smsThirdPartyReq.setAppid(apiId);
smsThirdPartyReq.setType(type);
smsThirdPartyReq.setAlarmSmsSendId(sms.getId());
smsThirdPartyReq.setPhone(sms.getMobile());
SendSmsTask sendSmsTask = new SendSmsTask(smsThirdPartyReq, sendUrl);
sendTaskThreadPool.execute(sendSmsTask); sendTaskThreadPool.execute(sendSmsTask);
sms.setSendStatus(SendStatusEnum.提交.getValue());
sms.setSendTime(new Date());
alarmSmsSendService.update(sms,null);
}); });
} }
......
...@@ -26,6 +26,7 @@ import lombok.extern.apachecommons.CommonsLog; ...@@ -26,6 +26,7 @@ import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -36,6 +37,7 @@ import java.util.List; ...@@ -36,6 +37,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Service("SyncUserTask") @Service("SyncUserTask")
@ConditionalOnExpression("'${platform.type:null}'=='cloud'")
public class SyncUserTaskImpl implements ITaskExcuteService { public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
...@@ -43,7 +45,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -43,7 +45,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
...@@ -58,7 +59,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -58,7 +59,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
UserEntity tempEntity = userService.selectOne(new UserQuery().loginName(user.getLoginName())); UserEntity tempEntity = userService.selectOne(new UserQuery().loginName(user.getLoginName()));
if (ObjectUtils.isEmpty(tempEntity)) { if (ObjectUtils.isEmpty(tempEntity)) {
UserEntity userEntity = new UserEntity(); UserEntity userEntity = new UserEntity();
BeanUtils.copyProperties(user, userEntity, new String[]{"lastLoginTime","lastLoginAddress"}); BeanUtils.copyProperties(user, userEntity, new String[]{"lastLoginTime", "lastLoginAddress"});
userService.getUserDao().insert(userEntity); userService.getUserDao().insert(userEntity);
} }
}); });
......
package com.mortals.xhx.module.area.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.area.model.AreaEntity;
import java.util.List;
/**
* 区域Dao
* 区域 DAO接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface AreaDao extends ICRUDDao<AreaEntity,Long>{
/**
* 查询子节点
*
* @param
* @return
*/
List<AreaEntity> selectChildrenAreaById(String areaId);
}
/** package com.mortals.xhx.module.area.dao.ibatis;
* 文件:AreaDaoImpl.java<br/>
* 版本:1.0.0<br/>
* 日期:2019-03-14<br/>
* Copyright &reg; www.sccoopskj.com<br/>
* All right reserved.
*/
package com.mortals.xhx.base.system.area.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.base.system.area.dao.AreaDao; import com.mortals.xhx.module.area.dao.AreaDao;
import com.mortals.xhx.base.system.area.model.AreaEntity; import com.mortals.xhx.module.area.model.AreaEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* Title: 区域信息 <br/> * 区域DaoImpl DAO接口
* Description: AreaDaoImpl DAO接口 <br/> *
* Copyright: Copyright &reg; www.sccoopskj.com <br/> * @author zxfei
* Company: www.sccoopskj.com * @date 2022-01-12
* */
* @author
* @version 1.0.0
*/
@Repository("areaDao") @Repository("areaDao")
public class AreaDaoImpl extends BaseCRUDDaoMybatis<AreaEntity,Long> implements AreaDao { public class AreaDaoImpl extends BaseCRUDDaoMybatis<AreaEntity,Long> implements AreaDao {
}
\ No newline at end of file
@Override
public List<AreaEntity> selectChildrenAreaById(String areaId) {
return getSqlSession().selectList(getSqlId("selectChildrenAreaById"), areaId);
}
}
package com.mortals.xhx.module.area.model;
import com.mortals.xhx.module.area.model.vo.AreaVo;
/**
* 区域实体对象
*
* @author zxfei
* @date 2022-01-12
*/
public class AreaEntity extends AreaVo {
private static final long serialVersionUID = 1L;
/**
* 祖级列表,逗号分隔
*/
private String ancestors;
/**
* 区域名称
*/
private String name;
/**
* 一体化的ID号
*/
private String iid;
/**
* 一体化的父id
*/
private String pid;
/**
* 是否有下级区域(True.是,False.否)
*/
private String haveSonArea;
/**
* 是否有下级部门(True.是,False.否)
*/
private String haveSonDept;
/**
* 是否获取部门(true.是,false.否)
*/
private String haveGetDept;
/**
* 是否获取事项列表(true.是,false.否)
*/
private String haveGetMatterList;
/**
* 区域编码
*/
private String areaCode;
/**
* 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
*/
private Integer areaLevel;
/**
* 名称简称
*/
private String shortName;
/**
* 访问地址
*/
private String domain;
/**
* 区域状态 (0.停用,1.正常)
*/
private Integer status;
public AreaEntity(){}
/**
* 获取 祖级列表,逗号分隔
* @return String
*/
public String getAncestors(){
return ancestors;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestors
*/
public void setAncestors(String ancestors){
this.ancestors = ancestors;
}
/**
* 获取 区域名称
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 区域名称
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 一体化的ID号
* @return String
*/
public String getIid(){
return iid;
}
/**
* 设置 一体化的ID号
* @param iid
*/
public void setIid(String iid){
this.iid = iid;
}
/**
* 获取 一体化的父id
* @return String
*/
public String getPid(){
return pid;
}
/**
* 设置 一体化的父id
* @param pid
*/
public void setPid(String pid){
this.pid = pid;
}
/**
* 获取 是否有下级区域(True.是,False.否)
* @return String
*/
public String getHaveSonArea(){
return haveSonArea;
}
/**
* 设置 是否有下级区域(True.是,False.否)
* @param haveSonArea
*/
public void setHaveSonArea(String haveSonArea){
this.haveSonArea = haveSonArea;
}
/**
* 获取 是否有下级部门(True.是,False.否)
* @return String
*/
public String getHaveSonDept(){
return haveSonDept;
}
/**
* 设置 是否有下级部门(True.是,False.否)
* @param haveSonDept
*/
public void setHaveSonDept(String haveSonDept){
this.haveSonDept = haveSonDept;
}
/**
* 获取 是否获取部门(true.是,false.否)
* @return String
*/
public String getHaveGetDept(){
return haveGetDept;
}
/**
* 设置 是否获取部门(true.是,false.否)
* @param haveGetDept
*/
public void setHaveGetDept(String haveGetDept){
this.haveGetDept = haveGetDept;
}
/**
* 获取 是否获取事项列表(true.是,false.否)
* @return String
*/
public String getHaveGetMatterList(){
return haveGetMatterList;
}
/**
* 设置 是否获取事项列表(true.是,false.否)
* @param haveGetMatterList
*/
public void setHaveGetMatterList(String haveGetMatterList){
this.haveGetMatterList = haveGetMatterList;
}
/**
* 获取 区域编码
* @return String
*/
public String getAreaCode(){
return areaCode;
}
/**
* 设置 区域编码
* @param areaCode
*/
public void setAreaCode(String areaCode){
this.areaCode = areaCode;
}
/**
* 获取 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return Integer
*/
public Integer getAreaLevel(){
return areaLevel;
}
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevel
*/
public void setAreaLevel(Integer areaLevel){
this.areaLevel = areaLevel;
}
/**
* 获取 名称简称
* @return String
*/
public String getShortName(){
return shortName;
}
/**
* 设置 名称简称
* @param shortName
*/
public void setShortName(String shortName){
this.shortName = shortName;
}
/**
* 获取 访问地址
* @return String
*/
public String getDomain(){
return domain;
}
/**
* 设置 访问地址
* @param domain
*/
public void setDomain(String domain){
this.domain = domain;
}
/**
* 获取 区域状态 (0.停用,1.正常)
* @return Integer
*/
public Integer getStatus(){
return status;
}
/**
* 设置 区域状态 (0.停用,1.正常)
* @param status
*/
public void setStatus(Integer status){
this.status = status;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof AreaEntity) {
AreaEntity tmp = (AreaEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",ancestors:").append(getAncestors());
sb.append(",name:").append(getName());
sb.append(",iid:").append(getIid());
sb.append(",pid:").append(getPid());
sb.append(",haveSonArea:").append(getHaveSonArea());
sb.append(",haveSonDept:").append(getHaveSonDept());
sb.append(",haveGetDept:").append(getHaveGetDept());
sb.append(",haveGetMatterList:").append(getHaveGetMatterList());
sb.append(",areaCode:").append(getAreaCode());
sb.append(",areaLevel:").append(getAreaLevel());
sb.append(",shortName:").append(getShortName());
sb.append(",domain:").append(getDomain());
sb.append(",status:").append(getStatus());
return sb.toString();
}
public void initAttrValue(){
this.ancestors = "";
this.name = null;
this.iid = null;
this.pid = null;
this.haveSonArea = null;
this.haveSonDept = null;
this.haveGetDept = null;
this.haveGetMatterList = null;
this.areaCode = null;
this.areaLevel = 1;
this.shortName = null;
this.domain = null;
this.status = 1;
}
}
\ No newline at end of file
package com.mortals.xhx.module.area.model;
import java.util.List;
/**
* 区域查询对象
*
* @author zxfei
* @date 2022-01-12
*/
public class AreaQuery extends AreaEntity {
/** 开始 序号,主键,自增长 */
private Long idStart;
/** 结束 序号,主键,自增长 */
private Long idEnd;
/** 增加 序号,主键,自增长 */
private Long idIncrement;
/** 序号,主键,自增长列表 */
private List <Long> idList;
/** 祖级列表,逗号分隔 */
private List<String> ancestorsList;
/** 区域名称 */
private List<String> nameList;
/** 一体化的ID号 */
private List<String> iidList;
/** 一体化的父id */
private List<String> pidList;
/** 是否有下级区域(True.是,False.否) */
private List<String> haveSonAreaList;
/** 是否有下级部门(True.是,False.否) */
private List<String> haveSonDeptList;
/** 是否获取部门(true.是,false.否) */
private List<String> haveGetDeptList;
/** 是否获取事项列表(true.是,false.否) */
private List<String> haveGetMatterListList;
/** 区域编码 */
private List<String> areaCodeList;
/** 开始 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区) */
private Integer areaLevelStart;
/** 结束 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区) */
private Integer areaLevelEnd;
/** 增加 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区) */
private Integer areaLevelIncrement;
/** 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)列表 */
private List <Integer> areaLevelList;
/** 名称简称 */
private List<String> shortNameList;
/** 访问地址 */
private List<String> domainList;
/** 开始 区域状态 (0.停用,1.正常) */
private Integer statusStart;
/** 结束 区域状态 (0.停用,1.正常) */
private Integer statusEnd;
/** 增加 区域状态 (0.停用,1.正常) */
private Integer statusIncrement;
/** 区域状态 (0.停用,1.正常)列表 */
private List <Integer> statusList;
/** 开始 创建时间 */
private String createTimeStart;
/** 结束 创建时间 */
private String createTimeEnd;
/** 开始 创建用户 */
private Long createUserIdStart;
/** 结束 创建用户 */
private Long createUserIdEnd;
/** 增加 创建用户 */
private Long createUserIdIncrement;
/** 创建用户列表 */
private List <Long> createUserIdList;
/** 开始 修改时间 */
private String updateTimeStart;
/** 结束 修改时间 */
private String updateTimeEnd;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<AreaQuery> orConditionList;
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private List<AreaQuery> andConditionList;
public AreaQuery(){}
/**
* 获取 开始 序号,主键,自增长
* @return idStart
*/
public Long getIdStart(){
return this.idStart;
}
/**
* 设置 开始 序号,主键,自增长
* @param idStart
*/
public void setIdStart(Long idStart){
this.idStart = idStart;
}
/**
* 获取 结束 序号,主键,自增长
* @return $idEnd
*/
public Long getIdEnd(){
return this.idEnd;
}
/**
* 设置 结束 序号,主键,自增长
* @param idEnd
*/
public void setIdEnd(Long idEnd){
this.idEnd = idEnd;
}
/**
* 获取 增加 序号,主键,自增长
* @return idIncrement
*/
public Long getIdIncrement(){
return this.idIncrement;
}
/**
* 设置 增加 序号,主键,自增长
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement){
this.idIncrement = idIncrement;
}
/**
* 获取 序号,主键,自增长
* @return idList
*/
public List<Long> getIdList(){
return this.idList;
}
/**
* 设置 序号,主键,自增长
* @param idList
*/
public void setIdList(List<Long> idList){
this.idList = idList;
}
/**
* 获取 祖级列表,逗号分隔
* @return ancestorsList
*/
public List<String> getAncestorsList(){
return this.ancestorsList;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestorsList
*/
public void setAncestorsList(List<String> ancestorsList){
this.ancestorsList = ancestorsList;
}
/**
* 获取 区域名称
* @return nameList
*/
public List<String> getNameList(){
return this.nameList;
}
/**
* 设置 区域名称
* @param nameList
*/
public void setNameList(List<String> nameList){
this.nameList = nameList;
}
/**
* 获取 一体化的ID号
* @return iidList
*/
public List<String> getIidList(){
return this.iidList;
}
/**
* 设置 一体化的ID号
* @param iidList
*/
public void setIidList(List<String> iidList){
this.iidList = iidList;
}
/**
* 获取 一体化的父id
* @return pidList
*/
public List<String> getPidList(){
return this.pidList;
}
/**
* 设置 一体化的父id
* @param pidList
*/
public void setPidList(List<String> pidList){
this.pidList = pidList;
}
/**
* 获取 是否有下级区域(True.是,False.否)
* @return haveSonAreaList
*/
public List<String> getHaveSonAreaList(){
return this.haveSonAreaList;
}
/**
* 设置 是否有下级区域(True.是,False.否)
* @param haveSonAreaList
*/
public void setHaveSonAreaList(List<String> haveSonAreaList){
this.haveSonAreaList = haveSonAreaList;
}
/**
* 获取 是否有下级部门(True.是,False.否)
* @return haveSonDeptList
*/
public List<String> getHaveSonDeptList(){
return this.haveSonDeptList;
}
/**
* 设置 是否有下级部门(True.是,False.否)
* @param haveSonDeptList
*/
public void setHaveSonDeptList(List<String> haveSonDeptList){
this.haveSonDeptList = haveSonDeptList;
}
/**
* 获取 是否获取部门(true.是,false.否)
* @return haveGetDeptList
*/
public List<String> getHaveGetDeptList(){
return this.haveGetDeptList;
}
/**
* 设置 是否获取部门(true.是,false.否)
* @param haveGetDeptList
*/
public void setHaveGetDeptList(List<String> haveGetDeptList){
this.haveGetDeptList = haveGetDeptList;
}
/**
* 获取 是否获取事项列表(true.是,false.否)
* @return haveGetMatterListList
*/
public List<String> getHaveGetMatterListList(){
return this.haveGetMatterListList;
}
/**
* 设置 是否获取事项列表(true.是,false.否)
* @param haveGetMatterListList
*/
public void setHaveGetMatterListList(List<String> haveGetMatterListList){
this.haveGetMatterListList = haveGetMatterListList;
}
/**
* 获取 区域编码
* @return areaCodeList
*/
public List<String> getAreaCodeList(){
return this.areaCodeList;
}
/**
* 设置 区域编码
* @param areaCodeList
*/
public void setAreaCodeList(List<String> areaCodeList){
this.areaCodeList = areaCodeList;
}
/**
* 获取 开始 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return areaLevelStart
*/
public Integer getAreaLevelStart(){
return this.areaLevelStart;
}
/**
* 设置 开始 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelStart
*/
public void setAreaLevelStart(Integer areaLevelStart){
this.areaLevelStart = areaLevelStart;
}
/**
* 获取 结束 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return $areaLevelEnd
*/
public Integer getAreaLevelEnd(){
return this.areaLevelEnd;
}
/**
* 设置 结束 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelEnd
*/
public void setAreaLevelEnd(Integer areaLevelEnd){
this.areaLevelEnd = areaLevelEnd;
}
/**
* 获取 增加 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return areaLevelIncrement
*/
public Integer getAreaLevelIncrement(){
return this.areaLevelIncrement;
}
/**
* 设置 增加 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelIncrement
*/
public void setAreaLevelIncrement(Integer areaLevelIncrement){
this.areaLevelIncrement = areaLevelIncrement;
}
/**
* 获取 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return areaLevelList
*/
public List<Integer> getAreaLevelList(){
return this.areaLevelList;
}
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelList
*/
public void setAreaLevelList(List<Integer> areaLevelList){
this.areaLevelList = areaLevelList;
}
/**
* 获取 名称简称
* @return shortNameList
*/
public List<String> getShortNameList(){
return this.shortNameList;
}
/**
* 设置 名称简称
* @param shortNameList
*/
public void setShortNameList(List<String> shortNameList){
this.shortNameList = shortNameList;
}
/**
* 获取 访问地址
* @return domainList
*/
public List<String> getDomainList(){
return this.domainList;
}
/**
* 设置 访问地址
* @param domainList
*/
public void setDomainList(List<String> domainList){
this.domainList = domainList;
}
/**
* 获取 开始 区域状态 (0.停用,1.正常)
* @return statusStart
*/
public Integer getStatusStart(){
return this.statusStart;
}
/**
* 设置 开始 区域状态 (0.停用,1.正常)
* @param statusStart
*/
public void setStatusStart(Integer statusStart){
this.statusStart = statusStart;
}
/**
* 获取 结束 区域状态 (0.停用,1.正常)
* @return $statusEnd
*/
public Integer getStatusEnd(){
return this.statusEnd;
}
/**
* 设置 结束 区域状态 (0.停用,1.正常)
* @param statusEnd
*/
public void setStatusEnd(Integer statusEnd){
this.statusEnd = statusEnd;
}
/**
* 获取 增加 区域状态 (0.停用,1.正常)
* @return statusIncrement
*/
public Integer getStatusIncrement(){
return this.statusIncrement;
}
/**
* 设置 增加 区域状态 (0.停用,1.正常)
* @param statusIncrement
*/
public void setStatusIncrement(Integer statusIncrement){
this.statusIncrement = statusIncrement;
}
/**
* 获取 区域状态 (0.停用,1.正常)
* @return statusList
*/
public List<Integer> getStatusList(){
return this.statusList;
}
/**
* 设置 区域状态 (0.停用,1.正常)
* @param statusList
*/
public void setStatusList(List<Integer> statusList){
this.statusList = statusList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
*/
public String getCreateTimeStart(){
return this.createTimeStart;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public void setCreateTimeStart(String createTimeStart){
this.createTimeStart = createTimeStart;
}
/**
* 获取 结束 创建时间
* @return createTimeEnd
*/
public String getCreateTimeEnd(){
return this.createTimeEnd;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public void setCreateTimeEnd(String createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
/**
* 获取 开始 创建用户
* @return createUserIdStart
*/
public Long getCreateUserIdStart(){
return this.createUserIdStart;
}
/**
* 设置 开始 创建用户
* @param createUserIdStart
*/
public void setCreateUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
}
/**
* 获取 结束 创建用户
* @return $createUserIdEnd
*/
public Long getCreateUserIdEnd(){
return this.createUserIdEnd;
}
/**
* 设置 结束 创建用户
* @param createUserIdEnd
*/
public void setCreateUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
}
/**
* 获取 增加 创建用户
* @return createUserIdIncrement
*/
public Long getCreateUserIdIncrement(){
return this.createUserIdIncrement;
}
/**
* 设置 增加 创建用户
* @param createUserIdIncrement
*/
public void setCreateUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
}
/**
* 获取 创建用户
* @return createUserIdList
*/
public List<Long> getCreateUserIdList(){
return this.createUserIdList;
}
/**
* 设置 创建用户
* @param createUserIdList
*/
public void setCreateUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
}
/**
* 获取 开始 修改时间
* @return updateTimeStart
*/
public String getUpdateTimeStart(){
return this.updateTimeStart;
}
/**
* 设置 开始 修改时间
* @param updateTimeStart
*/
public void setUpdateTimeStart(String updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
/**
* 获取 结束 修改时间
* @return updateTimeEnd
*/
public String getUpdateTimeEnd(){
return this.updateTimeEnd;
}
/**
* 设置 结束 修改时间
* @param updateTimeEnd
*/
public void setUpdateTimeEnd(String updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
/**
* 设置 序号,主键,自增长
* @param id
*/
public AreaQuery id(Long id){
setId(id);
return this;
}
/**
* 设置 开始 序号,主键,自增长
* @param idStart
*/
public AreaQuery idStart(Long idStart){
this.idStart = idStart;
return this;
}
/**
* 设置 结束 序号,主键,自增长
* @param idEnd
*/
public AreaQuery idEnd(Long idEnd){
this.idEnd = idEnd;
return this;
}
/**
* 设置 增加 序号,主键,自增长
* @param idIncrement
*/
public AreaQuery idIncrement(Long idIncrement){
this.idIncrement = idIncrement;
return this;
}
/**
* 设置 序号,主键,自增长
* @param idList
*/
public AreaQuery idList(List<Long> idList){
this.idList = idList;
return this;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestors
*/
public AreaQuery ancestors(String ancestors){
setAncestors(ancestors);
return this;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestorsList
*/
public AreaQuery ancestorsList(List<String> ancestorsList){
this.ancestorsList = ancestorsList;
return this;
}
/**
* 设置 区域名称
* @param name
*/
public AreaQuery name(String name){
setName(name);
return this;
}
/**
* 设置 区域名称
* @param nameList
*/
public AreaQuery nameList(List<String> nameList){
this.nameList = nameList;
return this;
}
/**
* 设置 一体化的ID号
* @param iid
*/
public AreaQuery iid(String iid){
setIid(iid);
return this;
}
/**
* 设置 一体化的ID号
* @param iidList
*/
public AreaQuery iidList(List<String> iidList){
this.iidList = iidList;
return this;
}
/**
* 设置 一体化的父id
* @param pid
*/
public AreaQuery pid(String pid){
setPid(pid);
return this;
}
/**
* 设置 一体化的父id
* @param pidList
*/
public AreaQuery pidList(List<String> pidList){
this.pidList = pidList;
return this;
}
/**
* 设置 是否有下级区域(True.是,False.否)
* @param haveSonArea
*/
public AreaQuery haveSonArea(String haveSonArea){
setHaveSonArea(haveSonArea);
return this;
}
/**
* 设置 是否有下级区域(True.是,False.否)
* @param haveSonAreaList
*/
public AreaQuery haveSonAreaList(List<String> haveSonAreaList){
this.haveSonAreaList = haveSonAreaList;
return this;
}
/**
* 设置 是否有下级部门(True.是,False.否)
* @param haveSonDept
*/
public AreaQuery haveSonDept(String haveSonDept){
setHaveSonDept(haveSonDept);
return this;
}
/**
* 设置 是否有下级部门(True.是,False.否)
* @param haveSonDeptList
*/
public AreaQuery haveSonDeptList(List<String> haveSonDeptList){
this.haveSonDeptList = haveSonDeptList;
return this;
}
/**
* 设置 是否获取部门(true.是,false.否)
* @param haveGetDept
*/
public AreaQuery haveGetDept(String haveGetDept){
setHaveGetDept(haveGetDept);
return this;
}
/**
* 设置 是否获取部门(true.是,false.否)
* @param haveGetDeptList
*/
public AreaQuery haveGetDeptList(List<String> haveGetDeptList){
this.haveGetDeptList = haveGetDeptList;
return this;
}
/**
* 设置 是否获取事项列表(true.是,false.否)
* @param haveGetMatterList
*/
public AreaQuery haveGetMatterList(String haveGetMatterList){
setHaveGetMatterList(haveGetMatterList);
return this;
}
/**
* 设置 是否获取事项列表(true.是,false.否)
* @param haveGetMatterListList
*/
public AreaQuery haveGetMatterListList(List<String> haveGetMatterListList){
this.haveGetMatterListList = haveGetMatterListList;
return this;
}
/**
* 设置 区域编码
* @param areaCode
*/
public AreaQuery areaCode(String areaCode){
setAreaCode(areaCode);
return this;
}
/**
* 设置 区域编码
* @param areaCodeList
*/
public AreaQuery areaCodeList(List<String> areaCodeList){
this.areaCodeList = areaCodeList;
return this;
}
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevel
*/
public AreaQuery areaLevel(Integer areaLevel){
setAreaLevel(areaLevel);
return this;
}
/**
* 设置 开始 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelStart
*/
public AreaQuery areaLevelStart(Integer areaLevelStart){
this.areaLevelStart = areaLevelStart;
return this;
}
/**
* 设置 结束 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelEnd
*/
public AreaQuery areaLevelEnd(Integer areaLevelEnd){
this.areaLevelEnd = areaLevelEnd;
return this;
}
/**
* 设置 增加 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelIncrement
*/
public AreaQuery areaLevelIncrement(Integer areaLevelIncrement){
this.areaLevelIncrement = areaLevelIncrement;
return this;
}
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelList
*/
public AreaQuery areaLevelList(List<Integer> areaLevelList){
this.areaLevelList = areaLevelList;
return this;
}
/**
* 设置 名称简称
* @param shortName
*/
public AreaQuery shortName(String shortName){
setShortName(shortName);
return this;
}
/**
* 设置 名称简称
* @param shortNameList
*/
public AreaQuery shortNameList(List<String> shortNameList){
this.shortNameList = shortNameList;
return this;
}
/**
* 设置 访问地址
* @param domain
*/
public AreaQuery domain(String domain){
setDomain(domain);
return this;
}
/**
* 设置 访问地址
* @param domainList
*/
public AreaQuery domainList(List<String> domainList){
this.domainList = domainList;
return this;
}
/**
* 设置 区域状态 (0.停用,1.正常)
* @param status
*/
public AreaQuery status(Integer status){
setStatus(status);
return this;
}
/**
* 设置 开始 区域状态 (0.停用,1.正常)
* @param statusStart
*/
public AreaQuery statusStart(Integer statusStart){
this.statusStart = statusStart;
return this;
}
/**
* 设置 结束 区域状态 (0.停用,1.正常)
* @param statusEnd
*/
public AreaQuery statusEnd(Integer statusEnd){
this.statusEnd = statusEnd;
return this;
}
/**
* 设置 增加 区域状态 (0.停用,1.正常)
* @param statusIncrement
*/
public AreaQuery statusIncrement(Integer statusIncrement){
this.statusIncrement = statusIncrement;
return this;
}
/**
* 设置 区域状态 (0.停用,1.正常)
* @param statusList
*/
public AreaQuery statusList(List<Integer> statusList){
this.statusList = statusList;
return this;
}
/**
* 设置 创建用户
* @param createUserId
*/
public AreaQuery createUserId(Long createUserId){
setCreateUserId(createUserId);
return this;
}
/**
* 设置 开始 创建用户
* @param createUserIdStart
*/
public AreaQuery createUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
return this;
}
/**
* 设置 结束 创建用户
* @param createUserIdEnd
*/
public AreaQuery createUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
return this;
}
/**
* 设置 增加 创建用户
* @param createUserIdIncrement
*/
public AreaQuery createUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
return this;
}
/**
* 设置 创建用户
* @param createUserIdList
*/
public AreaQuery createUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
*/
public List<AreaQuery> getOrConditionList(){
return this.orConditionList;
}
/**
* 设置 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @param orConditionList
*/
public void setOrConditionList(List<AreaQuery> orConditionList){
this.orConditionList = orConditionList;
}
/**
* 获取 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @return andConditionList
*/
public List<AreaQuery> getAndConditionList(){
return this.andConditionList;
}
/**
* 设置 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @param andConditionList
*/
public void setAndConditionList(List<AreaQuery> andConditionList){
this.andConditionList = andConditionList;
}
}
\ No newline at end of file
package com.mortals.xhx.module.area.model;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 区域前端映射树结构实体类
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class AreaTreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private String id;
/**
* 节点名称
*/
private String label;
/**
* 区域编码
*/
private String areaCode;
/**
* 是否叶子节点
*/
private Boolean isLeaf;
/**
* 节点类型
*/
private String type;
/**
* 图标
*/
private String icon;
/**
* 子节点
*/
private List<AreaTreeSelect> children;
public AreaTreeSelect(AreaEntity entity) {
this.id = entity.getIid();
this.label = entity.getName();
if ("False".equalsIgnoreCase(entity.getHaveSonArea())) {
this.isLeaf = true;
this.children = new ArrayList();
} else {
this.isLeaf = false;
}
this.areaCode=entity.getAreaCode();
this.type = "area";
this.icon = "el-icon-folder";
}
}
\ No newline at end of file
package com.mortals.xhx.base.system.site.model; package com.mortals.xhx.module.area.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.area.model.AreaEntity;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* * @author: zxfei
* Description:Site * @date: 2022/6/6 14:58
* date: 2021-9-27 10:26:34 * @description:
*/ **/
@Data @Data
public class SiteEntityExt extends BaseEntityLong{ public class AreaVo extends BaseEntityLong {
/** 子站点 */
private List<SiteEntity> children = new ArrayList<>(); private List<AreaEntity> children = new ArrayList<>();
} }
\ No newline at end of file
package com.mortals.xhx.module.area.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import java.util.List;
/**
* AreaService
*
* 区域 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface AreaService extends ICRUDCacheService<AreaEntity,Long> {
/**
* 是否存在区域节点
*
* @param areaId 区域ID
* @return 结果
*/
boolean hasChildByAreaId(String areaId);
/**
* 查询区域数据
*
* @param area 区域
* @return 区域集合
*/
List<AreaEntity> selectAreaList(AreaEntity area);
/**
* 构建前端所需要下拉树结构
*
* @param areaList 区域列表
* @return 下拉树结构列表
*/
List<AreaTreeSelect> buildAreaTreeSelect(List<AreaEntity> areaList);
/**
* 根据父id查询子节点
* @param parentId
* @param context
* @return
*/
List<AreaTreeSelect> getListByParentId(String parentId, Context context);
/**
* 获取当前节点所有子节点
* @param rootId
* @param context
* @return
*/
List<AreaTreeSelect> getListByRootId(String rootId, Context context);
}
\ No newline at end of file
package com.mortals.xhx.module.area.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.common.code.SatusEnum;
import com.mortals.xhx.module.area.dao.AreaDao;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.site.service.SiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* AreaService
* 区域 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("areaService")
public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaEntity, Long> implements AreaService {
@Autowired
private SiteService siteService;
/* @Override
public void putCache(String key, AreaEntity data) {
super.putCache(key, data);
//加载孩子关系
if ("True".equalsIgnoreCase(data.getHaveSonArea())) {
String childKey = super.getCacheName() + ":" + data.getIid();
//cacheService.del(childKey);
this.find(new AreaQuery().pid(data.getIid())).stream().forEach(item -> {
cacheService.lpush(childKey, item);
});
}
}*/
@Override
protected String getExtKey(AreaEntity data) {
return data.getAreaCode();
}
@Override
protected void saveBefore(AreaEntity entity, Context context) throws AppException {
AreaEntity parentAreaEntity = this.selectOne(new AreaQuery().pid(entity.getPid()));
if (!ObjectUtils.isEmpty(parentAreaEntity) && SatusEnum.DISENABLE.getValue() == parentAreaEntity.getStatus()) {
throw new AppException("区域停用,不允许新增");
}
if (!ObjectUtils.isEmpty(parentAreaEntity)) {
entity.setAncestors(parentAreaEntity.getAncestors() + "," + entity.getPid());
}
super.saveBefore(entity, context);
}
@Override
protected void updateBefore(AreaEntity entity, Context context) throws AppException {
AreaEntity newParentEntity = this.selectOne(new AreaQuery().pid(entity.getPid()));
AreaEntity oldEntity = this.get(entity.getId());
if (!ObjectUtils.isEmpty(newParentEntity) && !ObjectUtils.isEmpty(oldEntity)) {
String newAncestors = newParentEntity.getAncestors() + "," + newParentEntity.getId();
String oldAncestors = oldEntity.getAncestors();
entity.setAncestors(newAncestors);
updateAreaChildren(entity.getId(), newAncestors, oldAncestors, context);
}
super.updateBefore(entity, context);
}
@Override
protected void updateAfter(AreaEntity entity, Context context) throws AppException {
if (SatusEnum.ENABLE.getValue() == entity.getStatus()) {
updateParentAreaStatus(entity, context);
}
super.updateAfter(entity, context);
}
/**
* 修改该区域的父级区域状态
*
* @param area 当前区域
*/
private void updateParentAreaStatus(AreaEntity area, Context context) {
AreaEntity areaEntity = this.selectOne(new AreaQuery().pid(area.getPid()));
areaEntity.setStatus(SatusEnum.ENABLE.getValue());
areaEntity.setUpdateTime(new Date());
areaEntity.setUpdateUser(context.getUser().getLoginName());
AreaEntity condition = new AreaEntity();
condition.setId(areaEntity.getId());
this.updateBatch(areaEntity, condition, context);
}
/**
* 修改子元素关系
*
* @param areaId 被修改的区域ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public void updateAreaChildren(Long areaId, String newAncestors, String oldAncestors, Context context) {
List<AreaEntity> children = getDao().selectChildrenAreaById(areaId.toString());
for (AreaEntity child : children) {
child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors));
}
if (children.size() > 0) {
this.updateAfter(children, context);
}
}
@Override
protected void removeBefore(Long[] ids, Context context) throws AppException {
//有子节点 禁止删除 todo
// if (hasChildByAreaId(ids[0])) {
// throw new AppException("存在下级区域,不允许删除");
// }
super.removeBefore(ids, context);
}
@Override
public boolean hasChildByAreaId(String areaId) {
List<AreaEntity> list = this.find(new AreaQuery().pid(areaId));
return list.size() > 0 ? true : false;
}
@Override
public List<AreaEntity> selectAreaList(AreaEntity area) {
return this.find(new AreaQuery());
}
@Override
public List<AreaTreeSelect> buildAreaTreeSelect(List<AreaEntity> list) {
List<AreaEntity> returnList = new ArrayList<>();
List<Long> tempList = list.stream().map(AreaEntity::getId).collect(Collectors.toList());
for (AreaEntity areaEntity : list) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(areaEntity.getPid())) {
recursionFn(list, areaEntity);
returnList.add(areaEntity);
}
}
if (returnList.isEmpty()) {
returnList = list;
}
return returnList.stream().map(AreaTreeSelect::new).collect(Collectors.toList());
}
@Override
public List<AreaTreeSelect> getListByParentId(String parentId, Context context) {
if (ObjectUtils.isEmpty(parentId)) {
parentId = "0";
}
//只做一层
List<AreaTreeSelect> collect = this.find(new AreaQuery().pid(parentId), context).stream().map(item -> new AreaTreeSelect(item)
).collect(Collectors.toList());
if ("0".equals(parentId)) {
return collect;
}
// AreaEntity areaEntity = this.selectOne(new AreaQuery().iid(parentId));
// if (!ObjectUtils.isEmpty(areaEntity)) {
// //查询当前区域是否有站点。
// List<AreaTreeSelect> collect1 = siteService.find(new SiteQuery().areaCode(areaEntity.getAreaCode()))
// .stream().map(site -> new AreaTreeSelect(site)).collect(Collectors.toList());
// collect.addAll(collect1);
//
// }
return collect;
}
@Override
public List<AreaTreeSelect> getListByRootId(String rootId, Context context) {
if (ObjectUtils.isEmpty(rootId)) {
rootId = "0";
}
AreaEntity areaEntity = this.selectOne(new AreaQuery().pid(rootId));
AreaTreeSelect areaTreeSelect = new AreaTreeSelect(areaEntity);
rebuildList(areaTreeSelect);
List<AreaTreeSelect> areaTreeSelectList = new ArrayList<>();
areaTreeSelectList.add(areaTreeSelect);
return areaTreeSelectList;
}
private void rebuildList(AreaTreeSelect areaTreeSelect) {
List<AreaTreeSelect> list = this.cacheService.lrange(super.getCacheName() + ":" + areaTreeSelect.getId(), AreaEntity.class).stream().map(item -> new AreaTreeSelect(item)).collect(Collectors.toList());
list.stream().forEach(item -> {
rebuildList(item);
});
areaTreeSelect.setChildren(list);
}
/**
* 递归列表
*/
private void recursionFn(List<AreaEntity> list, AreaEntity t) {
// 得到子节点列表
List<AreaEntity> childList = getChildList(list, t);
t.setChildren(childList);
for (AreaEntity tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<AreaEntity> getChildList(List<AreaEntity> list, AreaEntity t) {
return list.stream().map(item -> {
if (!ObjectUtils.isEmpty(item.getPid()) && item.getPid() == t.getIid()) {
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<AreaEntity> list, AreaEntity t) {
return getChildList(list, t).size() > 0 ? true : false;
}
}
\ No newline at end of file
package com.mortals.xhx.module.area.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import com.mortals.xhx.module.area.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 区域
*
* @author zxfei
* @date 2022-01-19
*/
@RestController
@RequestMapping("area")
public class AreaController extends BaseCRUDJsonBodyMappingController<AreaService, AreaEntity, Long> {
@Autowired
private ParamService paramService;
public AreaController() {
super.setModuleDesc("区域");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "haveSonArea", paramService.getParamBySecondOrganize("Area", "haveSonArea"));
this.addDict(model, "haveSonDept", paramService.getParamBySecondOrganize("Area", "haveSonDept"));
this.addDict(model, "haveGetDept", paramService.getParamBySecondOrganize("Area", "haveGetDept"));
this.addDict(model, "haveGetMatterList", paramService.getParamBySecondOrganize("Area", "haveGetMatterList"));
this.addDict(model, "areaLevel", paramService.getParamBySecondOrganize("Area", "areaLevel"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Area", "status"));
super.init(model, context);
}
/**
* 获取站点下拉树列表
*/
@PostMapping("treeselect")
@UnAuth
public String treeselect() {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
int code = VALUE_RESULT_SUCCESS;
try {
List<AreaEntity> list = this.service.find(new AreaQuery());
List<AreaTreeSelect> treeSelects = this.service.buildAreaTreeSelect(list);
model.put(KEY_RESULT_DATA, treeSelects);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/**
* 根据parentId查询子信息
*/
@GetMapping(value = "getListByParentId")
@UnAuth
public String getListByParentId(String parentId) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询" + this.getModuleDesc() + "子节点";
try {
List<AreaTreeSelect> treeList = this.service.getListByParentId(parentId, getContext());
model.put(KEY_RESULT_DATA, treeList);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_DATA, model);
recordSysLog(request, busiDesc + "【成功】");
} catch (Exception e) {
log.error("根据parentId查询子信息错误", e);
this.doException(request, busiDesc, model, e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, e.getMessage());
}
return ret.toJSONString();
}
/**
* 根据parentId查询子信息
*/
@GetMapping(value = "getListByRootId")
@UnAuth
public String getListByRootId(String rootId) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询" + this.getModuleDesc() + "子节点";
try {
List<AreaTreeSelect> treeList = this.service.getListByRootId(rootId, getContext());
model.put(KEY_RESULT_DATA, treeList);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_DATA, model);
recordSysLog(request, busiDesc + "【成功】");
} catch (Exception e) {
log.error("根据rootId查询子信息错误", e);
this.doException(request, busiDesc, model, e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, e.getMessage());
}
return ret.toJSONString();
}
}
\ No newline at end of file
...@@ -6,9 +6,8 @@ import com.mortals.framework.exception.AppException; ...@@ -6,9 +6,8 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.BizLogPdu; import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.message.MessageProducer; import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.common.code.LogTypeEnum; import com.mortals.xhx.common.code.LogTypeEnum;
import com.mortals.xhx.module.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -34,7 +33,7 @@ public class DeviceLogServiceImpl extends AbstractCRUDServiceImpl<DeviceLogDao, ...@@ -34,7 +33,7 @@ public class DeviceLogServiceImpl extends AbstractCRUDServiceImpl<DeviceLogDao,
private String appName; private String appName;
@Autowired @Autowired
private MessageProducer messageProducer; private IMessageProduceService messageProducer;
@Override @Override
protected void findAfter(DeviceLogEntity params, PageInfo pageInfo, Context context, List<DeviceLogEntity> list) throws AppException { protected void findAfter(DeviceLogEntity params, PageInfo pageInfo, Context context, List<DeviceLogEntity> list) throws AppException {
......
...@@ -16,10 +16,13 @@ import com.mortals.framework.service.ICacheService; ...@@ -16,10 +16,13 @@ import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.base.system.message.MessageService; import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.base.system.message.RabbitMessageService;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.busiz.req.DeviceReq; import com.mortals.xhx.busiz.req.DeviceReq;
import com.mortals.xhx.busiz.rsp.ApiResp; import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
...@@ -39,15 +42,22 @@ import com.mortals.xhx.module.platform.service.PlatformService; ...@@ -39,15 +42,22 @@ import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.model.ProductQuery; import com.mortals.xhx.module.product.model.ProductQuery;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.queue.*; import com.mortals.xhx.queue.*;
import com.sun.javafx.fxml.builder.URLBuilder; import com.sun.javafx.fxml.builder.URLBuilder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.nio.charset.Charset; import java.nio.charset.Charset;
...@@ -72,7 +82,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -72,7 +82,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
private ProductService productService; private ProductService productService;
@Autowired @Autowired
private PlatformService platformService; private PlatformService platformService;
@Autowired // @Autowired
private DefaultTbCoreConsumerService consumerService; private DefaultTbCoreConsumerService consumerService;
@Autowired @Autowired
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
...@@ -84,19 +94,27 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -84,19 +94,27 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
private DeviceAlarmInfoService deviceAlarmInfoService; private DeviceAlarmInfoService deviceAlarmInfoService;
@Autowired @Autowired
private AlarmSmsSendService alarmSmsSendService; private AlarmSmsSendService alarmSmsSendService;
@Autowired
private MessageProducer messageProducer;
@Override @Autowired
protected String getExtKey(DeviceEntity data) { private DirectMessageListenerContainer container;
return data.getDeviceCode();
}
@Autowired @Autowired
private MessageService messageService; private MessageService messageService;
@Autowired
private ICacheService cacheService;
@Value("${thirdPartyPath:/inter/device/deviceIn}") @Value("${thirdPartyPath:/inter/device/deviceIn}")
private String thirdPartyPath; private String thirdPartyPath;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private SiteService siteService;
@Override
protected String getExtKey(DeviceEntity data) {
return data.getDeviceCode();
}
@Override @Override
protected void validData(DeviceEntity entity, Context context) throws AppException { protected void validData(DeviceEntity entity, Context context) throws AppException {
...@@ -182,7 +200,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -182,7 +200,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
public void active(String deviceCode, Context context) { public void active(String deviceCode, Context context) {
DeviceEntity deviceEntity = this.selectOne(new DeviceQuery().deviceCode(deviceCode)); DeviceEntity deviceEntity = this.selectOne(new DeviceQuery().deviceCode(deviceCode));
if (ObjectUtils.isEmpty(deviceEntity)) throw new AppException("当前设备不存在!"); if (ObjectUtils.isEmpty(deviceEntity)) throw new AppException("当前设备不存在!");
if (deviceEntity.getDeviceStatus() != DeviceStatusEnum.未激活.getValue()) throw new AppException("当前设备已激活!"); if (deviceEntity.getDeviceStatus() != DeviceStatusEnum.未激活.getValue())
throw new AppException("当前设备已激活!");
deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue()); deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue());
deviceEntity.setEnabled(EnabledEnum.启用.getValue()); deviceEntity.setEnabled(EnabledEnum.启用.getValue());
this.update(deviceEntity); this.update(deviceEntity);
...@@ -190,14 +209,18 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -190,14 +209,18 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.get(deviceEntity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//注册rabbmit相关队列与绑定 //注册rabbmit相关队列与绑定
registerRabbitQueue(deviceEntity, platformEntity, productEntity); messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, Constant.UPLOAD_TOPIC + deviceCode, Constant.UPLOAD_TOPIC + deviceCode);
messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, Constant.DOWN_TOPIC + deviceCode, Constant.DOWN_TOPIC + deviceCode);
TbQueueConsumer<TbQueueMsg> mainConsumer = consumerService.getMainConsumer(); //订阅上行队列
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode(); container.addQueueNames(Constant.UPLOAD_TOPIC + deviceCode);
TopicPartitionInfo topicPartitionInfo = new TopicPartitionInfo(Constant.UPLOAD_TOPIC + deviceCode, null, exchangeName); // registerRabbitQueue(deviceEntity, platformEntity, productEntity);
Set<TopicPartitionInfo> topicPartitionInfos = new HashSet<>(); //
topicPartitionInfos.add(topicPartitionInfo); // TbQueueConsumer<TbQueueMsg> mainConsumer = consumerService.getMainConsumer();
mainConsumer.subscribe(topicPartitionInfos); // String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
// TopicPartitionInfo topicPartitionInfo = new TopicPartitionInfo(Constant.UPLOAD_TOPIC + deviceCode, null, exchangeName);
// Set<TopicPartitionInfo> topicPartitionInfos = new HashSet<>();
// topicPartitionInfos.add(topicPartitionInfo);
// mainConsumer.subscribe(topicPartitionInfos);
//新增设备通知第三方平台,先新增后激活 //新增设备通知第三方平台,先新增后激活
sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ADD); sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ADD);
sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ACTIVE); sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ACTIVE);
...@@ -257,7 +280,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -257,7 +280,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
super.saveAfter(entity, context); super.saveAfter(entity, context);
} }
private void registerRabbitQueue(DeviceEntity entity, PlatformEntity platformEntity, ProductEntity productEntity) { /* private void registerRabbitQueue(DeviceEntity entity, PlatformEntity platformEntity, ProductEntity productEntity) {
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode(); String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + entity.getDeviceCode()).build(); TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + entity.getDeviceCode()).build();
TbQueueCallback callback = new TbQueueCallback() { TbQueueCallback callback = new TbQueueCallback() {
...@@ -281,7 +304,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -281,7 +304,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
//创建下行队列 //创建下行队列
info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.DOWN_TOPIC + entity.getDeviceCode()).build(); info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.DOWN_TOPIC + entity.getDeviceCode()).build();
messageService.queueDeclare(info, callback); messageService.queueDeclare(info, callback);
} }*/
@Override @Override
...@@ -293,7 +316,10 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -293,7 +316,10 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
//新增设备通知第三方平台 激活后的设备才通知和更新 //新增设备通知第三方平台 激活后的设备才通知和更新
if (entity.getDeviceStatus() > 0) { if (entity.getDeviceStatus() > 0) {
//注册rabbmit相关队列与绑定 //注册rabbmit相关队列与绑定
registerRabbitQueue(entity, platformEntity, productEntity); messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, Constant.UPLOAD_TOPIC + entity.getDeviceCode(), Constant.UPLOAD_TOPIC + entity.getDeviceCode());
messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, Constant.DOWN_TOPIC + entity.getDeviceCode(), Constant.DOWN_TOPIC + entity.getDeviceCode());
//registerRabbitQueue(entity, platformEntity, productEntity);
sendThirdParty(entity, productEntity, platformEntity, DeviceMethodEnum.UPDATE); sendThirdParty(entity, productEntity, platformEntity, DeviceMethodEnum.UPDATE);
} }
} }
...@@ -384,15 +410,17 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -384,15 +410,17 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceStatEntity.setDeviceAddCount(deviceTotalCount - yesterdayDeviceStat.getDeviceTotalCount()); deviceStatEntity.setDeviceAddCount(deviceTotalCount - yesterdayDeviceStat.getDeviceTotalCount());
///统计按当前站点归集 // TODO: 2022/8/22 ///统计按当前站点归集 // TODO: 2022/8/22
Rest<List<SitePdu>> resp = siteFeign.getFlatSitesBySiteId(new SitePdu().id(siteId)); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
// SitePdu sitePdu = new SitePdu(); List<SiteEntity> list = siteService.getFlatSitesBySiteId(siteId, context);
// sitePdu.setSize(-1); deviceStatEntity.setSiteTotalCount(list.size());
// Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu); deviceStatEntity.setSiteAddCount(list.size() - yesterdayDeviceStat.getSiteTotalCount());
// } else {
if (resp.getCode() == 1) { Rest<List<SitePdu>> resp = siteFeign.getFlatSitesBySiteId(new SitePdu().id(siteId));
List<SitePdu> sitePduList = resp.getData(); if (resp.getCode() == 1) {
deviceStatEntity.setSiteTotalCount(sitePduList.size()); List<SitePdu> sitePduList = resp.getData();
deviceStatEntity.setSiteAddCount(sitePduList.size() - yesterdayDeviceStat.getSiteTotalCount()); deviceStatEntity.setSiteTotalCount(sitePduList.size());
deviceStatEntity.setSiteAddCount(sitePduList.size() - yesterdayDeviceStat.getSiteTotalCount());
}
} }
//在线数量 //在线数量
...@@ -478,59 +506,68 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -478,59 +506,68 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override @Override
public List<DeviceMapEntity> deviceMap(DeviceEntity query, Context context) { public List<DeviceMapEntity> deviceMap(DeviceEntity query, Context context) {
Rest<SitePdu> info = siteFeign.info(query.getSiteId()); String longitude = "0.00";
if (info.getCode() == YesNoEnum.YES.getValue()) { String latitude = "0.00";
if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
SiteEntity siteEntity = siteService.get(query.getSiteId());
if (ObjectUtils.isEmpty(siteEntity)) throw new AppException("未找到指定站点!");
longitude = siteEntity.getLongitude();
latitude = siteEntity.getLatitude();
} else {
Rest<SitePdu> info = siteFeign.info(query.getSiteId());
if (info.getCode() != YesNoEnum.YES.getValue()) throw new AppException("获取站点信息失败!");
SitePdu sitePdu = info.getData(); SitePdu sitePdu = info.getData();
longitude = sitePdu.getLongitude();
latitude = sitePdu.getLatitude();
}
List<DeviceMapEntity> collect = this.find(query, context) List<DeviceMapEntity> collect = this.find(query, context)
.stream().collect(Collectors.groupingBy(x -> x.getProductId())) .stream().collect(Collectors.groupingBy(x -> x.getProductId()))
.entrySet() .entrySet()
.stream().map(item -> { .stream().map(item -> {
DeviceMapEntity deviceMapEntity = new DeviceMapEntity(); DeviceMapEntity deviceMapEntity = new DeviceMapEntity();
deviceMapEntity.setProductId(item.getKey()); deviceMapEntity.setProductId(item.getKey());
ProductEntity productEntity = productService.get(item.getKey()); ProductEntity productEntity = productService.get(item.getKey());
deviceMapEntity.setProductCode(productEntity == null ? "" : productEntity.getProductCode()); deviceMapEntity.setProductCode(productEntity == null ? "" : productEntity.getProductCode());
if (ObjectUtils.isEmpty(item.getValue())) { if (ObjectUtils.isEmpty(item.getValue())) {
deviceMapEntity.setDeviceList(Collections.EMPTY_LIST); deviceMapEntity.setDeviceList(Collections.EMPTY_LIST);
} else {
deviceMapEntity.setDeviceList(item.getValue());
}
return deviceMapEntity;
}).collect(Collectors.toList());
//更新坐标点 轴步进 0.0001~~11米
BigDecimal lngStep = new BigDecimal(0.00005);
BigDecimal latiStep = new BigDecimal(0.00005);
String longitude = sitePdu.getLongitude();
String latitude = sitePdu.getLatitude();
BigDecimal centerLng = new BigDecimal(longitude);
BigDecimal centerlati = new BigDecimal(latitude);
for (int i = 1; i <= collect.size(); i++) {
BigDecimal curLati = new BigDecimal(latitude);
if (i % 2 == 1) {
curLati = centerlati.subtract(latiStep.multiply(new BigDecimal(i)));
} else {
curLati = centerlati.add(latiStep.multiply(new BigDecimal(i)));
}
for (int j = 1; j <= collect.get(i - 1).getDeviceList().size(); j++) {
//偶数加,奇数减
BigDecimal curLng = new BigDecimal(longitude);
if (j % 2 == 1) {
curLng = centerLng.subtract(lngStep.multiply(new BigDecimal(j)));
} else { } else {
curLng = centerLng.add(lngStep.multiply(new BigDecimal(j))); deviceMapEntity.setDeviceList(item.getValue());
} }
DeviceEntity deviceEntity = collect.get(i - 1).getDeviceList().get(j - 1); return deviceMapEntity;
deviceEntity.setLon(curLng.setScale(6, RoundingMode.HALF_UP).toString()); }).collect(Collectors.toList());
deviceEntity.setLati(curLati.setScale(6, RoundingMode.HALF_UP).toString()); //更新坐标点 轴步进 0.0001~~11米
BigDecimal lngStep = new BigDecimal(0.00005);
BigDecimal latiStep = new BigDecimal(0.00005);
BigDecimal centerLng = new BigDecimal(longitude);
BigDecimal centerlati = new BigDecimal(latitude);
for (int i = 1; i <= collect.size(); i++) {
BigDecimal curLati = new BigDecimal(latitude);
if (i % 2 == 1) {
curLati = centerlati.subtract(latiStep.multiply(new BigDecimal(i)));
} else {
curLati = centerlati.add(latiStep.multiply(new BigDecimal(i)));
}
for (int j = 1; j <= collect.get(i - 1).getDeviceList().size(); j++) {
//偶数加,奇数减
BigDecimal curLng = new BigDecimal(longitude);
if (j % 2 == 1) {
curLng = centerLng.subtract(lngStep.multiply(new BigDecimal(j)));
} else {
curLng = centerLng.add(lngStep.multiply(new BigDecimal(j)));
} }
DeviceEntity deviceEntity = collect.get(i - 1).getDeviceList().get(j - 1);
deviceEntity.setLon(curLng.setScale(6, RoundingMode.HALF_UP).toString());
deviceEntity.setLati(curLati.setScale(6, RoundingMode.HALF_UP).toString());
} }
return collect;
} }
throw new AppException("获取站点信息失败!"); return collect;
} }
@Override @Override
...@@ -550,13 +587,16 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -550,13 +587,16 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
} }
}; };
messageService.delQueue(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode(), callback);
messageService.delQueue(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), callback); messageProducer.queueDelete(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode());
messageProducer.queueDelete(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode());
//messageService.delQueue(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode(), callback);
//messageService.delQueue(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), callback);
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.get(deviceEntity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台
sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.DEL); sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.DEL);
} }
//删除扩展extKey //删除扩展extKey
...@@ -584,7 +624,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -584,7 +624,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if (ObjectUtils.isEmpty(entity.getDeviceCode())) { if (ObjectUtils.isEmpty(entity.getDeviceCode())) {
throw new AppException("设备编码不能为空!"); throw new AppException("设备编码不能为空!");
} }
entity.setDeviceCode(StrUtil.replace(entity.getDeviceCode(), ":", "-")); entity.setDeviceCode(StrUtil.replace(entity.getDeviceCode(), ":", "-"));
if (ObjectUtils.isEmpty(entity.getDeviceMac())) { if (ObjectUtils.isEmpty(entity.getDeviceMac())) {
entity.setDeviceMac(entity.getDeviceCode()); entity.setDeviceMac(entity.getDeviceCode());
...@@ -644,13 +683,16 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -644,13 +683,16 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
} }
//如果负责人与电话为空,查询站点关联 //如果负责人与电话为空,查询站点关联
if (ObjectUtils.isEmpty(entity.getLeadingOfficial()) || ObjectUtils.isEmpty(entity.getSiteCode())) { if (ObjectUtils.isEmpty(entity.getLeadingOfficial()) || ObjectUtils.isEmpty(entity.getSiteCode())) {
Rest<SitePdu> info = siteFeign.info(entity.getSiteId()); updateDeviceEntityBySite(entity);
if (info.getCode() == YesNoEnum.YES.getValue()) { }
entity.setLeadingOfficial(info.getData().getLeadingOfficial());
entity.setLeadingOfficialTelephone(info.getData().getLeadingOfficialTelephone()); if (!ObjectUtils.isEmpty(entity.getDeviceStatus()) && entity.getDeviceStatus() > DeviceStatusEnum.未激活.getValue()) {
entity.setSiteCode(info.getData().getSiteCode()); //激活设备,添加队列订阅
entity.setSiteName(info.getData().getSiteName()); container.addQueueNames(Constant.UPLOAD_TOPIC + entity.getDeviceCode());
} PlatformEntity platformEntity = platformService.get(entity.getPlatformId());
ProductEntity productEntity = productService.get(entity.getProductId());
sendThirdParty(entity, productEntity, platformEntity, DeviceMethodEnum.ADD);
sendThirdParty(entity, productEntity, platformEntity, DeviceMethodEnum.ACTIVE);
} }
updateDeviceHomeUrl(entity); updateDeviceHomeUrl(entity);
super.saveBefore(entity, context); super.saveBefore(entity, context);
...@@ -672,32 +714,39 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -672,32 +714,39 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
.toString(); .toString();
entity.setHomeUrl(path); entity.setHomeUrl(path);
} }
//判断当前站点与修改的站点不一致时候 更新设备站点关联信息 //判断当前站点与修改的站点不一致时候 更新设备站点关联信息
if (!ObjectUtils.isEmpty(entity.getId())) { if (!ObjectUtils.isEmpty(entity.getId())) {
DeviceEntity temp = this.get(entity.getId(), null); DeviceEntity temp = this.get(entity.getId(), null);
if (!entity.getSiteId().equals(temp.getSiteId())) { if (!entity.getSiteId().equals(temp.getSiteId())) {
Rest<SitePdu> info = siteFeign.info(entity.getSiteId()); updateDeviceEntityBySite(entity);
if (info.getCode() == YesNoEnum.YES.getValue()) {
entity.setLeadingOfficial(info.getData().getLeadingOfficial());
entity.setLeadingOfficialTelephone(info.getData().getLeadingOfficialTelephone());
entity.setSiteCode(info.getData().getSiteCode());
entity.setSiteName(info.getData().getSiteName());
}
} else { } else {
if (ObjectUtils.isEmpty(entity.getSiteCode()) || ObjectUtils.isEmpty(entity.getSiteName())) { if (ObjectUtils.isEmpty(entity.getSiteCode()) || ObjectUtils.isEmpty(entity.getSiteName())) {
Rest<SitePdu> info = siteFeign.info(entity.getSiteId()); updateDeviceEntityBySite(entity);
if (info.getCode() == YesNoEnum.YES.getValue()) {
entity.setLeadingOfficial(info.getData().getLeadingOfficial());
entity.setLeadingOfficialTelephone(info.getData().getLeadingOfficialTelephone());
entity.setSiteCode(info.getData().getSiteCode());
entity.setSiteName(info.getData().getSiteName());
}
} }
} }
} }
} }
private void updateDeviceEntityBySite(DeviceEntity entity) {
if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
SiteEntity siteEntity = siteService.get(entity.getSiteId());
if (!ObjectUtils.isEmpty(siteEntity)) {
entity.setLeadingOfficial(siteEntity.getLeadingOfficial());
entity.setLeadingOfficialTelephone(siteEntity.getLeadingOfficialTelephone());
entity.setSiteCode(siteEntity.getSiteCode());
entity.setSiteName(siteEntity.getSiteName());
}
} else {
Rest<SitePdu> info = siteFeign.info(entity.getSiteId());
if (info.getCode() == YesNoEnum.YES.getValue()) {
entity.setLeadingOfficial(info.getData().getLeadingOfficial());
entity.setLeadingOfficialTelephone(info.getData().getLeadingOfficialTelephone());
entity.setSiteCode(info.getData().getSiteCode());
entity.setSiteName(info.getData().getSiteName());
}
}
}
public static void main(String[] args) { public static void main(String[] args) {
BigDecimal bigDecimal = new BigDecimal("104.22241"); BigDecimal bigDecimal = new BigDecimal("104.22241");
BigDecimal add = bigDecimal.add(new BigDecimal("0.01")); BigDecimal add = bigDecimal.add(new BigDecimal("0.01"));
......
package com.mortals.xhx.module.device.web; package com.mortals.xhx.module.device.web;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.FileUtil; import com.mortals.framework.util.FileUtil;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService; import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.pdu.skin.SkinBasePdu; import com.mortals.xhx.common.pdu.skin.SkinBasePdu;
...@@ -40,25 +27,20 @@ import com.mortals.xhx.module.platform.model.PlatformEntity; ...@@ -40,25 +27,20 @@ import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService; import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.module.sitestat.model.SitestatEntity; import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.sitestat.model.SitestatQuery; import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import static com.mortals.framework.ap.SysConstains.MESSAGE_INFO;
import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY;
/** /**
* 设备 * 设备
...@@ -80,13 +62,16 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -80,13 +62,16 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
@Autowired @Autowired
private PlatformService platformService; private PlatformService platformService;
@Autowired @Autowired
private MessageService messageService;
@Autowired
private UploadService uploadService; private UploadService uploadService;
@Autowired @Autowired
private ISkinBaseFeign skinBaseFeign; private ISkinBaseFeign skinBaseFeign;
@Autowired @Autowired
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private SiteService siteService;
public DeviceController() { public DeviceController() {
super.setModuleDesc("设备"); super.setModuleDesc("设备");
...@@ -97,24 +82,21 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -97,24 +82,21 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
this.addDict(model, "platformId", platformService.find(new PlatformEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getPlatformName()))); this.addDict(model, "platformId", platformService.find(new PlatformEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getPlatformName())));
this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName()))); this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())));
this.addDict(model, "productCode", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductCode()))); this.addDict(model, "productCode", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductCode())));
this.addDict(model, "deviceFirmId", firmService.find(new FirmEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getFirmName()))); this.addDict(model, "deviceFirmId", firmService.find(new FirmEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getFirmName())));
this.addDict(model, "deviceSrc", paramService.getParamBySecondOrganize("Device", "deviceSrc")); this.addDict(model, "deviceSrc", paramService.getParamBySecondOrganize("Device", "deviceSrc"));
this.addDict(model, "deviceDataSourceWay", paramService.getParamBySecondOrganize("Device", "deviceDataSourceWay")); this.addDict(model, "deviceDataSourceWay", paramService.getParamBySecondOrganize("Device", "deviceDataSourceWay"));
this.addDict(model, "isReceiveMess", paramService.getParamBySecondOrganize("Device", "isReceiveMess")); this.addDict(model, "isReceiveMess", paramService.getParamBySecondOrganize("Device", "isReceiveMess"));
this.addDict(model, "deviceStatus", DeviceStatusEnum.getEnumMap()); this.addDict(model, "deviceStatus", DeviceStatusEnum.getEnumMap());
this.addDict(model, "enabled", paramService.getParamBySecondOrganize("Device", "enabled")); this.addDict(model, "enabled", paramService.getParamBySecondOrganize("Device", "enabled"));
this.addDict(model, "source", DeviceSourceEnum.getEnumMap()); this.addDict(model, "source", DeviceSourceEnum.getEnumMap());
//返回产品列表及其样式 //返回产品列表及其样式
//productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())). //productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())).
Rest<RespData<List<SkinBasePdu>>> resp = skinBaseFeign.list(new SkinBasePdu()); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
log.info("skinBaseFeignResp:{}",JSON.toJSONString(resp)); Rest<RespData<List<SkinBasePdu>>> resp = skinBaseFeign.list(new SkinBasePdu());
if (resp.getCode() == YesNoEnum.YES.getValue()) { if (resp.getCode() == YesNoEnum.YES.getValue()) {
Map<String, Map<String, String>> skinProductCodeMap = resp.getData().getData().stream().collect(Collectors.groupingBy(x -> x.getProductCode(), Collectors.toMap(a -> a.getImageResolution()==null?"":a.getImageResolution(), b -> b.getImageResolutionValue()==null?"":b.getImageResolutionValue(),(o,n)->n))); Map<String, Map<String, String>> skinProductCodeMap = resp.getData().getData().stream().collect(Collectors.groupingBy(x -> x.getProductCode(), Collectors.toMap(a -> a.getImageResolution() == null ? "" : a.getImageResolution(), b -> b.getImageResolutionValue() == null ? "" : b.getImageResolutionValue(), (o, n) -> n)));
this.addDict(model, "skinProductCodeMap", skinProductCodeMap); this.addDict(model, "skinProductCodeMap", skinProductCodeMap);
}
} }
super.init(model, context); super.init(model, context);
} }
...@@ -129,11 +111,19 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -129,11 +111,19 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
@Override @Override
protected int viewAfter(Long id, Map<String, Object> model, DeviceEntity entity, Context context) throws AppException { protected int viewAfter(Long id, Map<String, Object> model, DeviceEntity entity, Context context) throws AppException {
if(ObjectUtils.isEmpty(entity.getLon())){ if (ObjectUtils.isEmpty(entity.getLon())) {
Rest<SitePdu> resp = siteFeign.info(entity.getSiteId()); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
if(resp.getCode()==YesNoEnum.YES.getValue()){ SiteEntity siteEntity = siteService.get(entity.getSiteId(), getContext());
entity.setLon(entity.getLon()); if (!ObjectUtils.isEmpty(siteEntity)) {
entity.setLati(entity.getLati()); entity.setLon(siteEntity.getLongitude());
entity.setLati(siteEntity.getLatitude());
}
} else {
Rest<SitePdu> resp = siteFeign.info(entity.getSiteId());
if (resp.getCode() == YesNoEnum.YES.getValue()) {
entity.setLon(resp.getData().getLongitude());
entity.setLati(resp.getData().getLatitude());
}
} }
} }
return super.viewAfter(id, model, entity, context); return super.viewAfter(id, model, entity, context);
...@@ -167,8 +157,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -167,8 +157,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
String busiDesc = this.getModuleDesc() + "设备"; String busiDesc = this.getModuleDesc() + "设备";
try { try {
this.service.deviceEnabled(deviceEntity.getId(), deviceEntity.getEnabled(), getContext()); this.service.deviceEnabled(deviceEntity.getId(), deviceEntity.getEnabled(), getContext());
//this.init(request, response, null, model, getContext()); recordSysLog(request, busiDesc + EnabledEnum.getByValue(deviceEntity.getEnabled()).getDesc() + " 【成功】");
recordSysLog(request, busiDesc+ EnabledEnum.getByValue(deviceEntity.getEnabled()).getDesc() + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, model); jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} catch (Exception e) { } catch (Exception e) {
...@@ -180,7 +169,6 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -180,7 +169,6 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
} }
/** /**
* 停止或启动消息队列中的消息 * 停止或启动消息队列中的消息
*/ */
...@@ -191,7 +179,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -191,7 +179,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
String busiDesc = this.getModuleDesc() + "设备消费队列"; String busiDesc = this.getModuleDesc() + "设备消费队列";
try { try {
this.service.stopOrStartComsumeQueue(deviceEntity.getId(), deviceEntity.getEnabled(), getContext()); this.service.stopOrStartComsumeQueue(deviceEntity.getId(), deviceEntity.getEnabled(), getContext());
recordSysLog(request, busiDesc+EnabledEnum.getByValue(deviceEntity.getEnabled()).getDesc() + " 【成功】"); recordSysLog(request, busiDesc + EnabledEnum.getByValue(deviceEntity.getEnabled()).getDesc() + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, model); jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} catch (Exception e) { } catch (Exception e) {
...@@ -292,7 +280,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -292,7 +280,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
@Override @Override
protected int editAfter(Long id, Map<String, Object> model, DeviceEntity entity, Context context) throws AppException { protected int editAfter(Long id, Map<String, Object> model, DeviceEntity entity, Context context) throws AppException {
if(!ObjectUtils.isEmpty(entity.getProductId())){ if (!ObjectUtils.isEmpty(entity.getProductId())) {
ProductEntity productEntity = productService.get(entity.getProductId()); ProductEntity productEntity = productService.get(entity.getProductId());
entity.setProductCode(productEntity.getProductCode()); entity.setProductCode(productEntity.getProductCode());
} }
......
...@@ -9,10 +9,13 @@ import com.mortals.framework.ap.GlobalSysInfo; ...@@ -9,10 +9,13 @@ import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.base.system.message.MessageService; import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.busiz.rsp.ProductVersionInfo; import com.mortals.xhx.busiz.rsp.ProductVersionInfo;
import com.mortals.xhx.common.code.LogTypeEnum; import com.mortals.xhx.common.code.LogTypeEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders; import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader; import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
...@@ -27,12 +30,10 @@ import com.mortals.xhx.module.product.model.ProductQuery; ...@@ -27,12 +30,10 @@ import com.mortals.xhx.module.product.model.ProductQuery;
import com.mortals.xhx.module.product.model.ProductVersionEntity; import com.mortals.xhx.module.product.model.ProductVersionEntity;
import com.mortals.xhx.module.product.model.ProductVersionQuery; import com.mortals.xhx.module.product.model.ProductVersionQuery;
import com.mortals.xhx.module.product.service.ProductVersionService; import com.mortals.xhx.module.product.service.ProductVersionService;
import com.mortals.xhx.queue.TbQueueCallback; import com.mortals.xhx.queue.*;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TbQueueMsgMetadata;
import com.mortals.xhx.queue.TopicPartitionInfo;
import com.sun.jndi.toolkit.url.UrlUtil; import com.sun.jndi.toolkit.url.UrlUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -48,7 +49,7 @@ import java.util.Base64; ...@@ -48,7 +49,7 @@ import java.util.Base64;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_HTTP_URL; import static com.mortals.xhx.common.key.Constant.*;
import static com.mortals.xhx.common.key.ErrorCode.DEVICE_VERSION_UNEXIST; import static com.mortals.xhx.common.key.ErrorCode.DEVICE_VERSION_UNEXIST;
import static com.mortals.xhx.common.key.ErrorCode.DEVICE_VERSION_UNEXIST_CONTENT; import static com.mortals.xhx.common.key.ErrorCode.DEVICE_VERSION_UNEXIST_CONTENT;
...@@ -68,11 +69,11 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod ...@@ -68,11 +69,11 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
@Autowired @Autowired
private DeviceService deviceService; private DeviceService deviceService;
@Autowired @Autowired
private MessageService messageService;
@Autowired
private PlatformService platformService; private PlatformService platformService;
@Autowired @Autowired
private DeviceLogService deviceLogService; private DeviceLogService deviceLogService;
@Autowired
private MessageProducer messageProducer;
@Override @Override
protected void saveBefore(ProductEntity entity, Context context) throws AppException { protected void saveBefore(ProductEntity entity, Context context) throws AppException {
...@@ -126,22 +127,43 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod ...@@ -126,22 +127,43 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
if (ObjectUtils.isEmpty(platformEntity)) { if (ObjectUtils.isEmpty(platformEntity)) {
throw new AppException("当前设备未配置所属系统平台,请在后台配置后再激活!"); throw new AppException("当前设备未配置所属系统平台,请在后台配置后再激活!");
} }
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode(); String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().productId(productId)); List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().productId(productId));
deviceList.forEach(deviceEntity -> { deviceList.forEach(deviceEntity -> {
TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode()).build(); //TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode()).build();
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, Constant.MESSAGETYPE_UPGREAD);
header.put(MessageHeader.DEVICECODE, deviceEntity.getDeviceCode());
ProductVersionInfo productVersionInfo = new ProductVersionInfo(); ProductVersionInfo productVersionInfo = new ProductVersionInfo();
BeanUtils.copyProperties(productVersionEntity, productVersionInfo, BeanUtil.getNullPropertyNames(productVersionEntity)); BeanUtils.copyProperties(productVersionEntity, productVersionInfo, BeanUtil.getNullPropertyNames(productVersionEntity));
buildDownloadUrl(productVersionEntity, productVersionInfo); buildDownloadUrl(productVersionEntity, productVersionInfo);
TbQueueCallback callback = new TbQueueCallback() {
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, MESSAGETYPE_UPGREAD);
header.put(MessageHeader.DEVICECODE, deviceEntity.getDeviceCode());
header.put(MessageHeader.TIMESTAMP, DateUtils.getCurrStrDateTime());
header.put(MessageHeader.MESSAGESIGN, "abcd1234");
TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes()), header);
messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE,Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(),JSON.toJSONString(queueMsg));
DeviceLogEntity deviceLogEntity = new DeviceLogEntity();
deviceLogEntity.initAttrValue();
deviceLogEntity.setTraceID(IdUtil.fastSimpleUUID());
deviceLogEntity.setSiteId(deviceEntity.getSiteId());
deviceLogEntity.setDeviceId(deviceEntity.getId());
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode());
deviceLogEntity.setMessageHead(MESSAGETYPE_UPGREAD);
deviceLogEntity.setContent(Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes()));
deviceLogEntity.setLogType(LogTypeEnum.下发服务.getValue());
deviceLogEntity.setCreateUserId(1L);
deviceLogEntity.setCreateTime(new Date());
deviceLogService.save(deviceLogEntity,context);
/* TbQueueCallback callback = new TbQueueCallback() {
@Override @Override
public void onSuccess(TbQueueMsgMetadata metadata) { public void onSuccess(TbQueueMsgMetadata metadata) {
log.info("【成功】发送升级版本信息,设备编码:{}",deviceEntity.getDeviceCode()); log.info("【成功】发送升级版本信息,设备编码:{}",deviceEntity.getDeviceCode());
DeviceLogEntity deviceLogEntity = new DeviceLogEntity(); DeviceLogEntity deviceLogEntity = new DeviceLogEntity();
deviceLogEntity.initAttrValue(); deviceLogEntity.initAttrValue();
deviceLogEntity.setTraceID(metadata.getMessageId()); deviceLogEntity.setTraceID(metadata.getMessageId());
...@@ -149,7 +171,7 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod ...@@ -149,7 +171,7 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
deviceLogEntity.setDeviceId(deviceEntity.getId()); deviceLogEntity.setDeviceId(deviceEntity.getId());
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName()); deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode()); deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode());
deviceLogEntity.setMessageHead(Constant.MESSAGETYPE_UPGREAD); deviceLogEntity.setMessageHead(MESSAGETYPE_UPGREAD);
deviceLogEntity.setContent(Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes())); deviceLogEntity.setContent(Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes()));
deviceLogEntity.setLogType(LogTypeEnum.下发服务.getValue()); deviceLogEntity.setLogType(LogTypeEnum.下发服务.getValue());
deviceLogEntity.setCreateUserId(1L); deviceLogEntity.setCreateUserId(1L);
...@@ -167,29 +189,27 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod ...@@ -167,29 +189,27 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
deviceLogEntity.setSiteId(deviceEntity.getSiteId()); deviceLogEntity.setSiteId(deviceEntity.getSiteId());
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName()); deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode()); deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode());
deviceLogEntity.setMessageHead(Constant.MESSAGETYPE_UPGREAD); deviceLogEntity.setMessageHead(MESSAGETYPE_UPGREAD);
deviceLogEntity.setContent(Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes())); deviceLogEntity.setContent(Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes()));
deviceLogEntity.setLogType(LogTypeEnum.消息异常.getValue()); deviceLogEntity.setLogType(LogTypeEnum.消息异常.getValue());
deviceLogEntity.setCreateUserId(1L); deviceLogEntity.setCreateUserId(1L);
deviceLogEntity.setCreateTime(new Date()); deviceLogEntity.setCreateTime(new Date());
deviceLogService.save(deviceLogEntity,context); deviceLogService.save(deviceLogEntity,context);
} }
}; };*/
log.info("【发送中】发送升级版本信息,设备编码:{}",deviceEntity.getDeviceCode()); log.info("【发送中】发送升级版本信息,设备编码:{}",deviceEntity.getDeviceCode());
deviceService.sendDeviceMessage(deviceEntity, info, header, Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes()), callback, null); // deviceService.sendDeviceMessage(deviceEntity, info, header, Base64.getEncoder().encodeToString(JSON.toJSONString(productVersionInfo).getBytes()), callback, null);
}); });
} }
private void buildDownloadUrl(ProductVersionEntity productVersionEntity, ProductVersionInfo productVersionInfo) { private void buildDownloadUrl(ProductVersionEntity productVersionEntity, ProductVersionInfo productVersionInfo) {
String download = ""; String download = "";
if (!ObjectUtils.isEmpty(productVersionEntity.getFilePath())) { if (!ObjectUtils.isEmpty(productVersionEntity.getFilePath())) {
download = productVersionEntity.getFilePath(); download = productVersionEntity.getFilePath();
} }
String domain = GlobalSysInfo.getParamValue(PARAM_SERVER_HTTP_URL, "http://192.168.0.98:11091"); String domain = GlobalSysInfo.getParamValue(PARAM_SERVER_HTTP_URL, "http://192.168.0.98:11091");
productVersionInfo.setDownloadUrl(UrlBuilder.of(domain).addPath(download).toString()); productVersionInfo.setDownloadUrl(UrlBuilder.of(domain).addPath(download).toString());
} }
} }
\ No newline at end of file
package com.mortals.xhx.base.system.site.dao; package com.mortals.xhx.module.site.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.base.system.site.model.SiteEntity; import com.mortals.xhx.module.site.model.SiteEntity;
/** /**
* <p>Title: 站点信息表</p> * 站点Dao
* <p>Description: SiteDao DAO接口 </p> * 站点 DAO接口
* @author *
* @version 1.0.0 * @author zxfei
* @date 2022-01-12
*/ */
public interface SiteDao extends ICRUDDao<SiteEntity,Long>{ public interface SiteDao extends ICRUDDao<SiteEntity,Long>{
} }
package com.mortals.xhx.base.system.site.dao.ibatis; package com.mortals.xhx.module.site.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.base.system.site.dao.SiteDao; import com.mortals.xhx.module.site.dao.SiteDao;
import com.mortals.xhx.base.system.site.model.SiteEntity; import com.mortals.xhx.module.site.model.SiteEntity;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
* <p>Title: 站点信息表</p> * 站点DaoImpl DAO接口
* <p>Description: SiteDaoImpl DAO接口 </p> *
* @author * @author zxfei
* @version 1.0.0 * @date 2022-01-12
*/ */
@Repository("siteDao") @Repository("siteDao")
public class SiteDaoImpl extends BaseCRUDDaoMybatis<SiteEntity,Long> implements SiteDao { public class SiteDaoImpl extends BaseCRUDDaoMybatis<SiteEntity,Long> implements SiteDao {
} }
package com.mortals.xhx.module.site.model;
import com.mortals.xhx.module.site.model.vo.SiteVo;
import java.util.Date;
/**
* 站点实体对象
*
* @author zxfei
* @date 2022-07-14
*/
public class SiteEntity extends SiteVo {
private static final long serialVersionUID = 1L;
/**
* 站点名称
*/
private String siteName;
/**
* 站点编号
*/
private String siteCode;
/**
* 区域Id
*/
private String areaID;
/**
* 区域编号
*/
private String areaCode;
/**
* 区域名称
*/
private String areaName;
/**
* 省编码
*/
private String proCode;
/**
* 市编码
*/
private String cityCode;
/**
* 区编码
*/
private String districtCode;
/**
* 站点服务器ip
*/
private String siteIp;
/**
* 站点服务器端口
*/
private String sitePort;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 中心联系电话
*/
private String siteTel;
/**
* 中心详细地址
*/
private String detailAddress;
/**
* 中心介绍
*/
private String siteRemark;
/**
* 上午上班开始时间
*/
private Date amWorkStartTime;
/**
* 上午上班结束时间
*/
private Date amWorkEndTime;
/**
* 下午上班开始时间
*/
private Date pmWorkStartTime;
/**
* 下午上班结束时间
*/
private Date pmWorkEndTime;
/**
* 周一 (1.上班,0.不上)
*/
private Integer workday1;
/**
* 周二 (1.上班,0.不上)
*/
private Integer workday2;
/**
* 周三 (1.上班,0.不上)
*/
private Integer workday3;
/**
* 周四 (1.上班,0.不上)
*/
private Integer workday4;
/**
* 周五 (1.上班,0.不上)
*/
private Integer workday5;
/**
* 周六 (1.上班,0.不上)
*/
private Integer workday6;
/**
* 周日 (1.上班,0.不上)
*/
private Integer workday7;
/**
* 楼层
*/
private Integer level;
/**
* 楼栋
*/
private Integer building;
/**
* logo图片地址
*/
private String logoPath;
/**
* 英文名称
*/
private String englishName;
/**
* 负责人
*/
private String leadingOfficial;
/**
* 联系电话
*/
private String leadingOfficialTelephone;
/**
* 部署模块,逗号分隔
*/
private String modelIds;
public SiteEntity(){}
/**
* 获取 站点名称
* @return String
*/
public String getSiteName(){
return siteName;
}
/**
* 设置 站点名称
* @param siteName
*/
public void setSiteName(String siteName){
this.siteName = siteName;
}
/**
* 获取 站点编号
* @return String
*/
public String getSiteCode(){
return siteCode;
}
/**
* 设置 站点编号
* @param siteCode
*/
public void setSiteCode(String siteCode){
this.siteCode = siteCode;
}
/**
* 获取 区域Id
* @return String
*/
public String getAreaID(){
return areaID;
}
/**
* 设置 区域Id
* @param areaID
*/
public void setAreaID(String areaID){
this.areaID = areaID;
}
/**
* 获取 区域编号
* @return String
*/
public String getAreaCode(){
return areaCode;
}
/**
* 设置 区域编号
* @param areaCode
*/
public void setAreaCode(String areaCode){
this.areaCode = areaCode;
}
/**
* 获取 区域名称
* @return String
*/
public String getAreaName(){
return areaName;
}
/**
* 设置 区域名称
* @param areaName
*/
public void setAreaName(String areaName){
this.areaName = areaName;
}
/**
* 获取 省编码
* @return String
*/
public String getProCode(){
return proCode;
}
/**
* 设置 省编码
* @param proCode
*/
public void setProCode(String proCode){
this.proCode = proCode;
}
/**
* 获取 市编码
* @return String
*/
public String getCityCode(){
return cityCode;
}
/**
* 设置 市编码
* @param cityCode
*/
public void setCityCode(String cityCode){
this.cityCode = cityCode;
}
/**
* 获取 区编码
* @return String
*/
public String getDistrictCode(){
return districtCode;
}
/**
* 设置 区编码
* @param districtCode
*/
public void setDistrictCode(String districtCode){
this.districtCode = districtCode;
}
/**
* 获取 站点服务器ip
* @return String
*/
public String getSiteIp(){
return siteIp;
}
/**
* 设置 站点服务器ip
* @param siteIp
*/
public void setSiteIp(String siteIp){
this.siteIp = siteIp;
}
/**
* 获取 站点服务器端口
* @return String
*/
public String getSitePort(){
return sitePort;
}
/**
* 设置 站点服务器端口
* @param sitePort
*/
public void setSitePort(String sitePort){
this.sitePort = sitePort;
}
/**
* 获取 经度
* @return String
*/
public String getLongitude(){
return longitude;
}
/**
* 设置 经度
* @param longitude
*/
public void setLongitude(String longitude){
this.longitude = longitude;
}
/**
* 获取 纬度
* @return String
*/
public String getLatitude(){
return latitude;
}
/**
* 设置 纬度
* @param latitude
*/
public void setLatitude(String latitude){
this.latitude = latitude;
}
/**
* 获取 中心联系电话
* @return String
*/
public String getSiteTel(){
return siteTel;
}
/**
* 设置 中心联系电话
* @param siteTel
*/
public void setSiteTel(String siteTel){
this.siteTel = siteTel;
}
/**
* 获取 中心详细地址
* @return String
*/
public String getDetailAddress(){
return detailAddress;
}
/**
* 设置 中心详细地址
* @param detailAddress
*/
public void setDetailAddress(String detailAddress){
this.detailAddress = detailAddress;
}
/**
* 获取 中心介绍
* @return String
*/
public String getSiteRemark(){
return siteRemark;
}
/**
* 设置 中心介绍
* @param siteRemark
*/
public void setSiteRemark(String siteRemark){
this.siteRemark = siteRemark;
}
/**
* 获取 上午上班开始时间
* @return Date
*/
public Date getAmWorkStartTime(){
return amWorkStartTime;
}
/**
* 设置 上午上班开始时间
* @param amWorkStartTime
*/
public void setAmWorkStartTime(Date amWorkStartTime){
this.amWorkStartTime = amWorkStartTime;
}
/**
* 获取 上午上班结束时间
* @return Date
*/
public Date getAmWorkEndTime(){
return amWorkEndTime;
}
/**
* 设置 上午上班结束时间
* @param amWorkEndTime
*/
public void setAmWorkEndTime(Date amWorkEndTime){
this.amWorkEndTime = amWorkEndTime;
}
/**
* 获取 下午上班开始时间
* @return Date
*/
public Date getPmWorkStartTime(){
return pmWorkStartTime;
}
/**
* 设置 下午上班开始时间
* @param pmWorkStartTime
*/
public void setPmWorkStartTime(Date pmWorkStartTime){
this.pmWorkStartTime = pmWorkStartTime;
}
/**
* 获取 下午上班结束时间
* @return Date
*/
public Date getPmWorkEndTime(){
return pmWorkEndTime;
}
/**
* 设置 下午上班结束时间
* @param pmWorkEndTime
*/
public void setPmWorkEndTime(Date pmWorkEndTime){
this.pmWorkEndTime = pmWorkEndTime;
}
/**
* 获取 周一 (1.上班,0.不上)
* @return Integer
*/
public Integer getWorkday1(){
return workday1;
}
/**
* 设置 周一 (1.上班,0.不上)
* @param workday1
*/
public void setWorkday1(Integer workday1){
this.workday1 = workday1;
}
/**
* 获取 周二 (1.上班,0.不上)
* @return Integer
*/
public Integer getWorkday2(){
return workday2;
}
/**
* 设置 周二 (1.上班,0.不上)
* @param workday2
*/
public void setWorkday2(Integer workday2){
this.workday2 = workday2;
}
/**
* 获取 周三 (1.上班,0.不上)
* @return Integer
*/
public Integer getWorkday3(){
return workday3;
}
/**
* 设置 周三 (1.上班,0.不上)
* @param workday3
*/
public void setWorkday3(Integer workday3){
this.workday3 = workday3;
}
/**
* 获取 周四 (1.上班,0.不上)
* @return Integer
*/
public Integer getWorkday4(){
return workday4;
}
/**
* 设置 周四 (1.上班,0.不上)
* @param workday4
*/
public void setWorkday4(Integer workday4){
this.workday4 = workday4;
}
/**
* 获取 周五 (1.上班,0.不上)
* @return Integer
*/
public Integer getWorkday5(){
return workday5;
}
/**
* 设置 周五 (1.上班,0.不上)
* @param workday5
*/
public void setWorkday5(Integer workday5){
this.workday5 = workday5;
}
/**
* 获取 周六 (1.上班,0.不上)
* @return Integer
*/
public Integer getWorkday6(){
return workday6;
}
/**
* 设置 周六 (1.上班,0.不上)
* @param workday6
*/
public void setWorkday6(Integer workday6){
this.workday6 = workday6;
}
/**
* 获取 周日 (1.上班,0.不上)
* @return Integer
*/
public Integer getWorkday7(){
return workday7;
}
/**
* 设置 周日 (1.上班,0.不上)
* @param workday7
*/
public void setWorkday7(Integer workday7){
this.workday7 = workday7;
}
/**
* 获取 楼层
* @return Integer
*/
public Integer getLevel(){
return level;
}
/**
* 设置 楼层
* @param level
*/
public void setLevel(Integer level){
this.level = level;
}
/**
* 获取 楼栋
* @return Integer
*/
public Integer getBuilding(){
return building;
}
/**
* 设置 楼栋
* @param building
*/
public void setBuilding(Integer building){
this.building = building;
}
/**
* 获取 logo图片地址
* @return String
*/
public String getLogoPath(){
return logoPath;
}
/**
* 设置 logo图片地址
* @param logoPath
*/
public void setLogoPath(String logoPath){
this.logoPath = logoPath;
}
/**
* 获取 英文名称
* @return String
*/
public String getEnglishName(){
return englishName;
}
/**
* 设置 英文名称
* @param englishName
*/
public void setEnglishName(String englishName){
this.englishName = englishName;
}
/**
* 获取 负责人
* @return String
*/
public String getLeadingOfficial(){
return leadingOfficial;
}
/**
* 设置 负责人
* @param leadingOfficial
*/
public void setLeadingOfficial(String leadingOfficial){
this.leadingOfficial = leadingOfficial;
}
/**
* 获取 联系电话
* @return String
*/
public String getLeadingOfficialTelephone(){
return leadingOfficialTelephone;
}
/**
* 设置 联系电话
* @param leadingOfficialTelephone
*/
public void setLeadingOfficialTelephone(String leadingOfficialTelephone){
this.leadingOfficialTelephone = leadingOfficialTelephone;
}
/**
* 获取 部署模块,逗号分隔
* @return String
*/
public String getModelIds(){
return modelIds;
}
/**
* 设置 部署模块,逗号分隔
* @param modelIds
*/
public void setModelIds(String modelIds){
this.modelIds = modelIds;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof SiteEntity) {
SiteEntity tmp = (SiteEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteName:").append(getSiteName());
sb.append(",siteCode:").append(getSiteCode());
sb.append(",areaID:").append(getAreaID());
sb.append(",areaCode:").append(getAreaCode());
sb.append(",areaName:").append(getAreaName());
sb.append(",proCode:").append(getProCode());
sb.append(",cityCode:").append(getCityCode());
sb.append(",districtCode:").append(getDistrictCode());
sb.append(",siteIp:").append(getSiteIp());
sb.append(",sitePort:").append(getSitePort());
sb.append(",longitude:").append(getLongitude());
sb.append(",latitude:").append(getLatitude());
sb.append(",siteTel:").append(getSiteTel());
sb.append(",detailAddress:").append(getDetailAddress());
sb.append(",siteRemark:").append(getSiteRemark());
sb.append(",amWorkStartTime:").append(getAmWorkStartTime());
sb.append(",amWorkEndTime:").append(getAmWorkEndTime());
sb.append(",pmWorkStartTime:").append(getPmWorkStartTime());
sb.append(",pmWorkEndTime:").append(getPmWorkEndTime());
sb.append(",workday1:").append(getWorkday1());
sb.append(",workday2:").append(getWorkday2());
sb.append(",workday3:").append(getWorkday3());
sb.append(",workday4:").append(getWorkday4());
sb.append(",workday5:").append(getWorkday5());
sb.append(",workday6:").append(getWorkday6());
sb.append(",workday7:").append(getWorkday7());
sb.append(",level:").append(getLevel());
sb.append(",building:").append(getBuilding());
sb.append(",logoPath:").append(getLogoPath());
sb.append(",englishName:").append(getEnglishName());
sb.append(",leadingOfficial:").append(getLeadingOfficial());
sb.append(",leadingOfficialTelephone:").append(getLeadingOfficialTelephone());
sb.append(",modelIds:").append(getModelIds());
return sb.toString();
}
public void initAttrValue(){
this.siteName = null;
this.siteCode = null;
this.areaID = null;
this.areaCode = null;
this.areaName = null;
this.proCode = null;
this.cityCode = null;
this.districtCode = null;
this.siteIp = null;
this.sitePort = null;
this.longitude = null;
this.latitude = null;
this.siteTel = null;
this.detailAddress = null;
this.siteRemark = null;
this.amWorkStartTime = null;
this.amWorkEndTime = null;
this.pmWorkStartTime = null;
this.pmWorkEndTime = null;
this.workday1 = 1;
this.workday2 = 1;
this.workday3 = 1;
this.workday4 = 1;
this.workday5 = 1;
this.workday6 = 0;
this.workday7 = 0;
this.level = 1;
this.building = 1;
this.logoPath = "";
this.englishName = "";
this.leadingOfficial = "";
this.leadingOfficialTelephone = "";
this.modelIds = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.model;
import java.util.List;
/**
* 站点查询对象
*
* @author zxfei
* @date 2022-07-14
*/
public class SiteQuery extends SiteEntity {
/** 开始 序号,主键,自增长 */
private Long idStart;
/** 结束 序号,主键,自增长 */
private Long idEnd;
/** 增加 序号,主键,自增长 */
private Long idIncrement;
/** 序号,主键,自增长列表 */
private List <Long> idList;
/** 站点名称 */
private List<String> siteNameList;
/** 站点编号 */
private List<String> siteCodeList;
/** 区域Id */
private List<String> areaIDList;
/** 区域编号 */
private List<String> areaCodeList;
/** 区域名称 */
private List<String> areaNameList;
/** 省编码 */
private List<String> proCodeList;
/** 市编码 */
private List<String> cityCodeList;
/** 区编码 */
private List<String> districtCodeList;
/** 站点服务器ip */
private List<String> siteIpList;
/** 站点服务器端口 */
private List<String> sitePortList;
/** 经度 */
private List<String> longitudeList;
/** 纬度 */
private List<String> latitudeList;
/** 中心联系电话 */
private List<String> siteTelList;
/** 中心详细地址 */
private List<String> detailAddressList;
/** 中心介绍 */
private List<String> siteRemarkList;
/** 开始 上午上班开始时间 */
private String amWorkStartTimeStart;
/** 结束 上午上班开始时间 */
private String amWorkStartTimeEnd;
/** 开始 上午上班结束时间 */
private String amWorkEndTimeStart;
/** 结束 上午上班结束时间 */
private String amWorkEndTimeEnd;
/** 开始 下午上班开始时间 */
private String pmWorkStartTimeStart;
/** 结束 下午上班开始时间 */
private String pmWorkStartTimeEnd;
/** 开始 下午上班结束时间 */
private String pmWorkEndTimeStart;
/** 结束 下午上班结束时间 */
private String pmWorkEndTimeEnd;
/** 开始 周一 (1.上班,0.不上) */
private Integer workday1Start;
/** 结束 周一 (1.上班,0.不上) */
private Integer workday1End;
/** 增加 周一 (1.上班,0.不上) */
private Integer workday1Increment;
/** 周一 (1.上班,0.不上)列表 */
private List <Integer> workday1List;
/** 开始 周二 (1.上班,0.不上) */
private Integer workday2Start;
/** 结束 周二 (1.上班,0.不上) */
private Integer workday2End;
/** 增加 周二 (1.上班,0.不上) */
private Integer workday2Increment;
/** 周二 (1.上班,0.不上)列表 */
private List <Integer> workday2List;
/** 开始 周三 (1.上班,0.不上) */
private Integer workday3Start;
/** 结束 周三 (1.上班,0.不上) */
private Integer workday3End;
/** 增加 周三 (1.上班,0.不上) */
private Integer workday3Increment;
/** 周三 (1.上班,0.不上)列表 */
private List <Integer> workday3List;
/** 开始 周四 (1.上班,0.不上) */
private Integer workday4Start;
/** 结束 周四 (1.上班,0.不上) */
private Integer workday4End;
/** 增加 周四 (1.上班,0.不上) */
private Integer workday4Increment;
/** 周四 (1.上班,0.不上)列表 */
private List <Integer> workday4List;
/** 开始 周五 (1.上班,0.不上) */
private Integer workday5Start;
/** 结束 周五 (1.上班,0.不上) */
private Integer workday5End;
/** 增加 周五 (1.上班,0.不上) */
private Integer workday5Increment;
/** 周五 (1.上班,0.不上)列表 */
private List <Integer> workday5List;
/** 开始 周六 (1.上班,0.不上) */
private Integer workday6Start;
/** 结束 周六 (1.上班,0.不上) */
private Integer workday6End;
/** 增加 周六 (1.上班,0.不上) */
private Integer workday6Increment;
/** 周六 (1.上班,0.不上)列表 */
private List <Integer> workday6List;
/** 开始 周日 (1.上班,0.不上) */
private Integer workday7Start;
/** 结束 周日 (1.上班,0.不上) */
private Integer workday7End;
/** 增加 周日 (1.上班,0.不上) */
private Integer workday7Increment;
/** 周日 (1.上班,0.不上)列表 */
private List <Integer> workday7List;
/** 开始 楼层 */
private Integer levelStart;
/** 结束 楼层 */
private Integer levelEnd;
/** 增加 楼层 */
private Integer levelIncrement;
/** 楼层列表 */
private List <Integer> levelList;
/** 开始 楼栋 */
private Integer buildingStart;
/** 结束 楼栋 */
private Integer buildingEnd;
/** 增加 楼栋 */
private Integer buildingIncrement;
/** 楼栋列表 */
private List <Integer> buildingList;
/** logo图片地址 */
private List<String> logoPathList;
/** 英文名称 */
private List<String> englishNameList;
/** 负责人 */
private List<String> leadingOfficialList;
/** 联系电话 */
private List<String> leadingOfficialTelephoneList;
/** 部署模块,逗号分隔 */
private List<String> modelIdsList;
/** 开始 创建时间 */
private String createTimeStart;
/** 结束 创建时间 */
private String createTimeEnd;
/** 开始 创建用户 */
private Long createUserIdStart;
/** 结束 创建用户 */
private Long createUserIdEnd;
/** 增加 创建用户 */
private Long createUserIdIncrement;
/** 创建用户列表 */
private List <Long> createUserIdList;
/** 开始 修改时间 */
private String updateTimeStart;
/** 结束 修改时间 */
private String updateTimeEnd;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<SiteQuery> orConditionList;
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private List<SiteQuery> andConditionList;
public SiteQuery(){}
/**
* 获取 开始 序号,主键,自增长
* @return idStart
*/
public Long getIdStart(){
return this.idStart;
}
/**
* 设置 开始 序号,主键,自增长
* @param idStart
*/
public void setIdStart(Long idStart){
this.idStart = idStart;
}
/**
* 获取 结束 序号,主键,自增长
* @return $idEnd
*/
public Long getIdEnd(){
return this.idEnd;
}
/**
* 设置 结束 序号,主键,自增长
* @param idEnd
*/
public void setIdEnd(Long idEnd){
this.idEnd = idEnd;
}
/**
* 获取 增加 序号,主键,自增长
* @return idIncrement
*/
public Long getIdIncrement(){
return this.idIncrement;
}
/**
* 设置 增加 序号,主键,自增长
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement){
this.idIncrement = idIncrement;
}
/**
* 获取 序号,主键,自增长
* @return idList
*/
public List<Long> getIdList(){
return this.idList;
}
/**
* 设置 序号,主键,自增长
* @param idList
*/
public void setIdList(List<Long> idList){
this.idList = idList;
}
/**
* 获取 站点名称
* @return siteNameList
*/
public List<String> getSiteNameList(){
return this.siteNameList;
}
/**
* 设置 站点名称
* @param siteNameList
*/
public void setSiteNameList(List<String> siteNameList){
this.siteNameList = siteNameList;
}
/**
* 获取 站点编号
* @return siteCodeList
*/
public List<String> getSiteCodeList(){
return this.siteCodeList;
}
/**
* 设置 站点编号
* @param siteCodeList
*/
public void setSiteCodeList(List<String> siteCodeList){
this.siteCodeList = siteCodeList;
}
/**
* 获取 区域Id
* @return areaIDList
*/
public List<String> getAreaIDList(){
return this.areaIDList;
}
/**
* 设置 区域Id
* @param areaIDList
*/
public void setAreaIDList(List<String> areaIDList){
this.areaIDList = areaIDList;
}
/**
* 获取 区域编号
* @return areaCodeList
*/
public List<String> getAreaCodeList(){
return this.areaCodeList;
}
/**
* 设置 区域编号
* @param areaCodeList
*/
public void setAreaCodeList(List<String> areaCodeList){
this.areaCodeList = areaCodeList;
}
/**
* 获取 区域名称
* @return areaNameList
*/
public List<String> getAreaNameList(){
return this.areaNameList;
}
/**
* 设置 区域名称
* @param areaNameList
*/
public void setAreaNameList(List<String> areaNameList){
this.areaNameList = areaNameList;
}
/**
* 获取 省编码
* @return proCodeList
*/
public List<String> getProCodeList(){
return this.proCodeList;
}
/**
* 设置 省编码
* @param proCodeList
*/
public void setProCodeList(List<String> proCodeList){
this.proCodeList = proCodeList;
}
/**
* 获取 市编码
* @return cityCodeList
*/
public List<String> getCityCodeList(){
return this.cityCodeList;
}
/**
* 设置 市编码
* @param cityCodeList
*/
public void setCityCodeList(List<String> cityCodeList){
this.cityCodeList = cityCodeList;
}
/**
* 获取 区编码
* @return districtCodeList
*/
public List<String> getDistrictCodeList(){
return this.districtCodeList;
}
/**
* 设置 区编码
* @param districtCodeList
*/
public void setDistrictCodeList(List<String> districtCodeList){
this.districtCodeList = districtCodeList;
}
/**
* 获取 站点服务器ip
* @return siteIpList
*/
public List<String> getSiteIpList(){
return this.siteIpList;
}
/**
* 设置 站点服务器ip
* @param siteIpList
*/
public void setSiteIpList(List<String> siteIpList){
this.siteIpList = siteIpList;
}
/**
* 获取 站点服务器端口
* @return sitePortList
*/
public List<String> getSitePortList(){
return this.sitePortList;
}
/**
* 设置 站点服务器端口
* @param sitePortList
*/
public void setSitePortList(List<String> sitePortList){
this.sitePortList = sitePortList;
}
/**
* 获取 经度
* @return longitudeList
*/
public List<String> getLongitudeList(){
return this.longitudeList;
}
/**
* 设置 经度
* @param longitudeList
*/
public void setLongitudeList(List<String> longitudeList){
this.longitudeList = longitudeList;
}
/**
* 获取 纬度
* @return latitudeList
*/
public List<String> getLatitudeList(){
return this.latitudeList;
}
/**
* 设置 纬度
* @param latitudeList
*/
public void setLatitudeList(List<String> latitudeList){
this.latitudeList = latitudeList;
}
/**
* 获取 中心联系电话
* @return siteTelList
*/
public List<String> getSiteTelList(){
return this.siteTelList;
}
/**
* 设置 中心联系电话
* @param siteTelList
*/
public void setSiteTelList(List<String> siteTelList){
this.siteTelList = siteTelList;
}
/**
* 获取 中心详细地址
* @return detailAddressList
*/
public List<String> getDetailAddressList(){
return this.detailAddressList;
}
/**
* 设置 中心详细地址
* @param detailAddressList
*/
public void setDetailAddressList(List<String> detailAddressList){
this.detailAddressList = detailAddressList;
}
/**
* 获取 中心介绍
* @return siteRemarkList
*/
public List<String> getSiteRemarkList(){
return this.siteRemarkList;
}
/**
* 设置 中心介绍
* @param siteRemarkList
*/
public void setSiteRemarkList(List<String> siteRemarkList){
this.siteRemarkList = siteRemarkList;
}
/**
* 获取 开始 上午上班开始时间
* @return amWorkStartTimeStart
*/
public String getAmWorkStartTimeStart(){
return this.amWorkStartTimeStart;
}
/**
* 设置 开始 上午上班开始时间
* @param amWorkStartTimeStart
*/
public void setAmWorkStartTimeStart(String amWorkStartTimeStart){
this.amWorkStartTimeStart = amWorkStartTimeStart;
}
/**
* 获取 结束 上午上班开始时间
* @return amWorkStartTimeEnd
*/
public String getAmWorkStartTimeEnd(){
return this.amWorkStartTimeEnd;
}
/**
* 设置 结束 上午上班开始时间
* @param amWorkStartTimeEnd
*/
public void setAmWorkStartTimeEnd(String amWorkStartTimeEnd){
this.amWorkStartTimeEnd = amWorkStartTimeEnd;
}
/**
* 获取 开始 上午上班结束时间
* @return amWorkEndTimeStart
*/
public String getAmWorkEndTimeStart(){
return this.amWorkEndTimeStart;
}
/**
* 设置 开始 上午上班结束时间
* @param amWorkEndTimeStart
*/
public void setAmWorkEndTimeStart(String amWorkEndTimeStart){
this.amWorkEndTimeStart = amWorkEndTimeStart;
}
/**
* 获取 结束 上午上班结束时间
* @return amWorkEndTimeEnd
*/
public String getAmWorkEndTimeEnd(){
return this.amWorkEndTimeEnd;
}
/**
* 设置 结束 上午上班结束时间
* @param amWorkEndTimeEnd
*/
public void setAmWorkEndTimeEnd(String amWorkEndTimeEnd){
this.amWorkEndTimeEnd = amWorkEndTimeEnd;
}
/**
* 获取 开始 下午上班开始时间
* @return pmWorkStartTimeStart
*/
public String getPmWorkStartTimeStart(){
return this.pmWorkStartTimeStart;
}
/**
* 设置 开始 下午上班开始时间
* @param pmWorkStartTimeStart
*/
public void setPmWorkStartTimeStart(String pmWorkStartTimeStart){
this.pmWorkStartTimeStart = pmWorkStartTimeStart;
}
/**
* 获取 结束 下午上班开始时间
* @return pmWorkStartTimeEnd
*/
public String getPmWorkStartTimeEnd(){
return this.pmWorkStartTimeEnd;
}
/**
* 设置 结束 下午上班开始时间
* @param pmWorkStartTimeEnd
*/
public void setPmWorkStartTimeEnd(String pmWorkStartTimeEnd){
this.pmWorkStartTimeEnd = pmWorkStartTimeEnd;
}
/**
* 获取 开始 下午上班结束时间
* @return pmWorkEndTimeStart
*/
public String getPmWorkEndTimeStart(){
return this.pmWorkEndTimeStart;
}
/**
* 设置 开始 下午上班结束时间
* @param pmWorkEndTimeStart
*/
public void setPmWorkEndTimeStart(String pmWorkEndTimeStart){
this.pmWorkEndTimeStart = pmWorkEndTimeStart;
}
/**
* 获取 结束 下午上班结束时间
* @return pmWorkEndTimeEnd
*/
public String getPmWorkEndTimeEnd(){
return this.pmWorkEndTimeEnd;
}
/**
* 设置 结束 下午上班结束时间
* @param pmWorkEndTimeEnd
*/
public void setPmWorkEndTimeEnd(String pmWorkEndTimeEnd){
this.pmWorkEndTimeEnd = pmWorkEndTimeEnd;
}
/**
* 获取 开始 周一 (1.上班,0.不上)
* @return workday1Start
*/
public Integer getWorkday1Start(){
return this.workday1Start;
}
/**
* 设置 开始 周一 (1.上班,0.不上)
* @param workday1Start
*/
public void setWorkday1Start(Integer workday1Start){
this.workday1Start = workday1Start;
}
/**
* 获取 结束 周一 (1.上班,0.不上)
* @return $workday1End
*/
public Integer getWorkday1End(){
return this.workday1End;
}
/**
* 设置 结束 周一 (1.上班,0.不上)
* @param workday1End
*/
public void setWorkday1End(Integer workday1End){
this.workday1End = workday1End;
}
/**
* 获取 增加 周一 (1.上班,0.不上)
* @return workday1Increment
*/
public Integer getWorkday1Increment(){
return this.workday1Increment;
}
/**
* 设置 增加 周一 (1.上班,0.不上)
* @param workday1Increment
*/
public void setWorkday1Increment(Integer workday1Increment){
this.workday1Increment = workday1Increment;
}
/**
* 获取 周一 (1.上班,0.不上)
* @return workday1List
*/
public List<Integer> getWorkday1List(){
return this.workday1List;
}
/**
* 设置 周一 (1.上班,0.不上)
* @param workday1List
*/
public void setWorkday1List(List<Integer> workday1List){
this.workday1List = workday1List;
}
/**
* 获取 开始 周二 (1.上班,0.不上)
* @return workday2Start
*/
public Integer getWorkday2Start(){
return this.workday2Start;
}
/**
* 设置 开始 周二 (1.上班,0.不上)
* @param workday2Start
*/
public void setWorkday2Start(Integer workday2Start){
this.workday2Start = workday2Start;
}
/**
* 获取 结束 周二 (1.上班,0.不上)
* @return $workday2End
*/
public Integer getWorkday2End(){
return this.workday2End;
}
/**
* 设置 结束 周二 (1.上班,0.不上)
* @param workday2End
*/
public void setWorkday2End(Integer workday2End){
this.workday2End = workday2End;
}
/**
* 获取 增加 周二 (1.上班,0.不上)
* @return workday2Increment
*/
public Integer getWorkday2Increment(){
return this.workday2Increment;
}
/**
* 设置 增加 周二 (1.上班,0.不上)
* @param workday2Increment
*/
public void setWorkday2Increment(Integer workday2Increment){
this.workday2Increment = workday2Increment;
}
/**
* 获取 周二 (1.上班,0.不上)
* @return workday2List
*/
public List<Integer> getWorkday2List(){
return this.workday2List;
}
/**
* 设置 周二 (1.上班,0.不上)
* @param workday2List
*/
public void setWorkday2List(List<Integer> workday2List){
this.workday2List = workday2List;
}
/**
* 获取 开始 周三 (1.上班,0.不上)
* @return workday3Start
*/
public Integer getWorkday3Start(){
return this.workday3Start;
}
/**
* 设置 开始 周三 (1.上班,0.不上)
* @param workday3Start
*/
public void setWorkday3Start(Integer workday3Start){
this.workday3Start = workday3Start;
}
/**
* 获取 结束 周三 (1.上班,0.不上)
* @return $workday3End
*/
public Integer getWorkday3End(){
return this.workday3End;
}
/**
* 设置 结束 周三 (1.上班,0.不上)
* @param workday3End
*/
public void setWorkday3End(Integer workday3End){
this.workday3End = workday3End;
}
/**
* 获取 增加 周三 (1.上班,0.不上)
* @return workday3Increment
*/
public Integer getWorkday3Increment(){
return this.workday3Increment;
}
/**
* 设置 增加 周三 (1.上班,0.不上)
* @param workday3Increment
*/
public void setWorkday3Increment(Integer workday3Increment){
this.workday3Increment = workday3Increment;
}
/**
* 获取 周三 (1.上班,0.不上)
* @return workday3List
*/
public List<Integer> getWorkday3List(){
return this.workday3List;
}
/**
* 设置 周三 (1.上班,0.不上)
* @param workday3List
*/
public void setWorkday3List(List<Integer> workday3List){
this.workday3List = workday3List;
}
/**
* 获取 开始 周四 (1.上班,0.不上)
* @return workday4Start
*/
public Integer getWorkday4Start(){
return this.workday4Start;
}
/**
* 设置 开始 周四 (1.上班,0.不上)
* @param workday4Start
*/
public void setWorkday4Start(Integer workday4Start){
this.workday4Start = workday4Start;
}
/**
* 获取 结束 周四 (1.上班,0.不上)
* @return $workday4End
*/
public Integer getWorkday4End(){
return this.workday4End;
}
/**
* 设置 结束 周四 (1.上班,0.不上)
* @param workday4End
*/
public void setWorkday4End(Integer workday4End){
this.workday4End = workday4End;
}
/**
* 获取 增加 周四 (1.上班,0.不上)
* @return workday4Increment
*/
public Integer getWorkday4Increment(){
return this.workday4Increment;
}
/**
* 设置 增加 周四 (1.上班,0.不上)
* @param workday4Increment
*/
public void setWorkday4Increment(Integer workday4Increment){
this.workday4Increment = workday4Increment;
}
/**
* 获取 周四 (1.上班,0.不上)
* @return workday4List
*/
public List<Integer> getWorkday4List(){
return this.workday4List;
}
/**
* 设置 周四 (1.上班,0.不上)
* @param workday4List
*/
public void setWorkday4List(List<Integer> workday4List){
this.workday4List = workday4List;
}
/**
* 获取 开始 周五 (1.上班,0.不上)
* @return workday5Start
*/
public Integer getWorkday5Start(){
return this.workday5Start;
}
/**
* 设置 开始 周五 (1.上班,0.不上)
* @param workday5Start
*/
public void setWorkday5Start(Integer workday5Start){
this.workday5Start = workday5Start;
}
/**
* 获取 结束 周五 (1.上班,0.不上)
* @return $workday5End
*/
public Integer getWorkday5End(){
return this.workday5End;
}
/**
* 设置 结束 周五 (1.上班,0.不上)
* @param workday5End
*/
public void setWorkday5End(Integer workday5End){
this.workday5End = workday5End;
}
/**
* 获取 增加 周五 (1.上班,0.不上)
* @return workday5Increment
*/
public Integer getWorkday5Increment(){
return this.workday5Increment;
}
/**
* 设置 增加 周五 (1.上班,0.不上)
* @param workday5Increment
*/
public void setWorkday5Increment(Integer workday5Increment){
this.workday5Increment = workday5Increment;
}
/**
* 获取 周五 (1.上班,0.不上)
* @return workday5List
*/
public List<Integer> getWorkday5List(){
return this.workday5List;
}
/**
* 设置 周五 (1.上班,0.不上)
* @param workday5List
*/
public void setWorkday5List(List<Integer> workday5List){
this.workday5List = workday5List;
}
/**
* 获取 开始 周六 (1.上班,0.不上)
* @return workday6Start
*/
public Integer getWorkday6Start(){
return this.workday6Start;
}
/**
* 设置 开始 周六 (1.上班,0.不上)
* @param workday6Start
*/
public void setWorkday6Start(Integer workday6Start){
this.workday6Start = workday6Start;
}
/**
* 获取 结束 周六 (1.上班,0.不上)
* @return $workday6End
*/
public Integer getWorkday6End(){
return this.workday6End;
}
/**
* 设置 结束 周六 (1.上班,0.不上)
* @param workday6End
*/
public void setWorkday6End(Integer workday6End){
this.workday6End = workday6End;
}
/**
* 获取 增加 周六 (1.上班,0.不上)
* @return workday6Increment
*/
public Integer getWorkday6Increment(){
return this.workday6Increment;
}
/**
* 设置 增加 周六 (1.上班,0.不上)
* @param workday6Increment
*/
public void setWorkday6Increment(Integer workday6Increment){
this.workday6Increment = workday6Increment;
}
/**
* 获取 周六 (1.上班,0.不上)
* @return workday6List
*/
public List<Integer> getWorkday6List(){
return this.workday6List;
}
/**
* 设置 周六 (1.上班,0.不上)
* @param workday6List
*/
public void setWorkday6List(List<Integer> workday6List){
this.workday6List = workday6List;
}
/**
* 获取 开始 周日 (1.上班,0.不上)
* @return workday7Start
*/
public Integer getWorkday7Start(){
return this.workday7Start;
}
/**
* 设置 开始 周日 (1.上班,0.不上)
* @param workday7Start
*/
public void setWorkday7Start(Integer workday7Start){
this.workday7Start = workday7Start;
}
/**
* 获取 结束 周日 (1.上班,0.不上)
* @return $workday7End
*/
public Integer getWorkday7End(){
return this.workday7End;
}
/**
* 设置 结束 周日 (1.上班,0.不上)
* @param workday7End
*/
public void setWorkday7End(Integer workday7End){
this.workday7End = workday7End;
}
/**
* 获取 增加 周日 (1.上班,0.不上)
* @return workday7Increment
*/
public Integer getWorkday7Increment(){
return this.workday7Increment;
}
/**
* 设置 增加 周日 (1.上班,0.不上)
* @param workday7Increment
*/
public void setWorkday7Increment(Integer workday7Increment){
this.workday7Increment = workday7Increment;
}
/**
* 获取 周日 (1.上班,0.不上)
* @return workday7List
*/
public List<Integer> getWorkday7List(){
return this.workday7List;
}
/**
* 设置 周日 (1.上班,0.不上)
* @param workday7List
*/
public void setWorkday7List(List<Integer> workday7List){
this.workday7List = workday7List;
}
/**
* 获取 开始 楼层
* @return levelStart
*/
public Integer getLevelStart(){
return this.levelStart;
}
/**
* 设置 开始 楼层
* @param levelStart
*/
public void setLevelStart(Integer levelStart){
this.levelStart = levelStart;
}
/**
* 获取 结束 楼层
* @return $levelEnd
*/
public Integer getLevelEnd(){
return this.levelEnd;
}
/**
* 设置 结束 楼层
* @param levelEnd
*/
public void setLevelEnd(Integer levelEnd){
this.levelEnd = levelEnd;
}
/**
* 获取 增加 楼层
* @return levelIncrement
*/
public Integer getLevelIncrement(){
return this.levelIncrement;
}
/**
* 设置 增加 楼层
* @param levelIncrement
*/
public void setLevelIncrement(Integer levelIncrement){
this.levelIncrement = levelIncrement;
}
/**
* 获取 楼层
* @return levelList
*/
public List<Integer> getLevelList(){
return this.levelList;
}
/**
* 设置 楼层
* @param levelList
*/
public void setLevelList(List<Integer> levelList){
this.levelList = levelList;
}
/**
* 获取 开始 楼栋
* @return buildingStart
*/
public Integer getBuildingStart(){
return this.buildingStart;
}
/**
* 设置 开始 楼栋
* @param buildingStart
*/
public void setBuildingStart(Integer buildingStart){
this.buildingStart = buildingStart;
}
/**
* 获取 结束 楼栋
* @return $buildingEnd
*/
public Integer getBuildingEnd(){
return this.buildingEnd;
}
/**
* 设置 结束 楼栋
* @param buildingEnd
*/
public void setBuildingEnd(Integer buildingEnd){
this.buildingEnd = buildingEnd;
}
/**
* 获取 增加 楼栋
* @return buildingIncrement
*/
public Integer getBuildingIncrement(){
return this.buildingIncrement;
}
/**
* 设置 增加 楼栋
* @param buildingIncrement
*/
public void setBuildingIncrement(Integer buildingIncrement){
this.buildingIncrement = buildingIncrement;
}
/**
* 获取 楼栋
* @return buildingList
*/
public List<Integer> getBuildingList(){
return this.buildingList;
}
/**
* 设置 楼栋
* @param buildingList
*/
public void setBuildingList(List<Integer> buildingList){
this.buildingList = buildingList;
}
/**
* 获取 logo图片地址
* @return logoPathList
*/
public List<String> getLogoPathList(){
return this.logoPathList;
}
/**
* 设置 logo图片地址
* @param logoPathList
*/
public void setLogoPathList(List<String> logoPathList){
this.logoPathList = logoPathList;
}
/**
* 获取 英文名称
* @return englishNameList
*/
public List<String> getEnglishNameList(){
return this.englishNameList;
}
/**
* 设置 英文名称
* @param englishNameList
*/
public void setEnglishNameList(List<String> englishNameList){
this.englishNameList = englishNameList;
}
/**
* 获取 负责人
* @return leadingOfficialList
*/
public List<String> getLeadingOfficialList(){
return this.leadingOfficialList;
}
/**
* 设置 负责人
* @param leadingOfficialList
*/
public void setLeadingOfficialList(List<String> leadingOfficialList){
this.leadingOfficialList = leadingOfficialList;
}
/**
* 获取 联系电话
* @return leadingOfficialTelephoneList
*/
public List<String> getLeadingOfficialTelephoneList(){
return this.leadingOfficialTelephoneList;
}
/**
* 设置 联系电话
* @param leadingOfficialTelephoneList
*/
public void setLeadingOfficialTelephoneList(List<String> leadingOfficialTelephoneList){
this.leadingOfficialTelephoneList = leadingOfficialTelephoneList;
}
/**
* 获取 部署模块,逗号分隔
* @return modelIdsList
*/
public List<String> getModelIdsList(){
return this.modelIdsList;
}
/**
* 设置 部署模块,逗号分隔
* @param modelIdsList
*/
public void setModelIdsList(List<String> modelIdsList){
this.modelIdsList = modelIdsList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
*/
public String getCreateTimeStart(){
return this.createTimeStart;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public void setCreateTimeStart(String createTimeStart){
this.createTimeStart = createTimeStart;
}
/**
* 获取 结束 创建时间
* @return createTimeEnd
*/
public String getCreateTimeEnd(){
return this.createTimeEnd;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public void setCreateTimeEnd(String createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
/**
* 获取 开始 创建用户
* @return createUserIdStart
*/
public Long getCreateUserIdStart(){
return this.createUserIdStart;
}
/**
* 设置 开始 创建用户
* @param createUserIdStart
*/
public void setCreateUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
}
/**
* 获取 结束 创建用户
* @return $createUserIdEnd
*/
public Long getCreateUserIdEnd(){
return this.createUserIdEnd;
}
/**
* 设置 结束 创建用户
* @param createUserIdEnd
*/
public void setCreateUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
}
/**
* 获取 增加 创建用户
* @return createUserIdIncrement
*/
public Long getCreateUserIdIncrement(){
return this.createUserIdIncrement;
}
/**
* 设置 增加 创建用户
* @param createUserIdIncrement
*/
public void setCreateUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
}
/**
* 获取 创建用户
* @return createUserIdList
*/
public List<Long> getCreateUserIdList(){
return this.createUserIdList;
}
/**
* 设置 创建用户
* @param createUserIdList
*/
public void setCreateUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
}
/**
* 获取 开始 修改时间
* @return updateTimeStart
*/
public String getUpdateTimeStart(){
return this.updateTimeStart;
}
/**
* 设置 开始 修改时间
* @param updateTimeStart
*/
public void setUpdateTimeStart(String updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
/**
* 获取 结束 修改时间
* @return updateTimeEnd
*/
public String getUpdateTimeEnd(){
return this.updateTimeEnd;
}
/**
* 设置 结束 修改时间
* @param updateTimeEnd
*/
public void setUpdateTimeEnd(String updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
/**
* 设置 序号,主键,自增长
* @param id
*/
public SiteQuery id(Long id){
setId(id);
return this;
}
/**
* 设置 开始 序号,主键,自增长
* @param idStart
*/
public SiteQuery idStart(Long idStart){
this.idStart = idStart;
return this;
}
/**
* 设置 结束 序号,主键,自增长
* @param idEnd
*/
public SiteQuery idEnd(Long idEnd){
this.idEnd = idEnd;
return this;
}
/**
* 设置 增加 序号,主键,自增长
* @param idIncrement
*/
public SiteQuery idIncrement(Long idIncrement){
this.idIncrement = idIncrement;
return this;
}
/**
* 设置 序号,主键,自增长
* @param idList
*/
public SiteQuery idList(List<Long> idList){
this.idList = idList;
return this;
}
/**
* 设置 站点名称
* @param siteName
*/
public SiteQuery siteName(String siteName){
setSiteName(siteName);
return this;
}
/**
* 设置 站点名称
* @param siteNameList
*/
public SiteQuery siteNameList(List<String> siteNameList){
this.siteNameList = siteNameList;
return this;
}
/**
* 设置 站点编号
* @param siteCode
*/
public SiteQuery siteCode(String siteCode){
setSiteCode(siteCode);
return this;
}
/**
* 设置 站点编号
* @param siteCodeList
*/
public SiteQuery siteCodeList(List<String> siteCodeList){
this.siteCodeList = siteCodeList;
return this;
}
/**
* 设置 区域Id
* @param areaID
*/
public SiteQuery areaID(String areaID){
setAreaID(areaID);
return this;
}
/**
* 设置 区域Id
* @param areaIDList
*/
public SiteQuery areaIDList(List<String> areaIDList){
this.areaIDList = areaIDList;
return this;
}
/**
* 设置 区域编号
* @param areaCode
*/
public SiteQuery areaCode(String areaCode){
setAreaCode(areaCode);
return this;
}
/**
* 设置 区域编号
* @param areaCodeList
*/
public SiteQuery areaCodeList(List<String> areaCodeList){
this.areaCodeList = areaCodeList;
return this;
}
/**
* 设置 区域名称
* @param areaName
*/
public SiteQuery areaName(String areaName){
setAreaName(areaName);
return this;
}
/**
* 设置 区域名称
* @param areaNameList
*/
public SiteQuery areaNameList(List<String> areaNameList){
this.areaNameList = areaNameList;
return this;
}
/**
* 设置 省编码
* @param proCode
*/
public SiteQuery proCode(String proCode){
setProCode(proCode);
return this;
}
/**
* 设置 省编码
* @param proCodeList
*/
public SiteQuery proCodeList(List<String> proCodeList){
this.proCodeList = proCodeList;
return this;
}
/**
* 设置 市编码
* @param cityCode
*/
public SiteQuery cityCode(String cityCode){
setCityCode(cityCode);
return this;
}
/**
* 设置 市编码
* @param cityCodeList
*/
public SiteQuery cityCodeList(List<String> cityCodeList){
this.cityCodeList = cityCodeList;
return this;
}
/**
* 设置 区编码
* @param districtCode
*/
public SiteQuery districtCode(String districtCode){
setDistrictCode(districtCode);
return this;
}
/**
* 设置 区编码
* @param districtCodeList
*/
public SiteQuery districtCodeList(List<String> districtCodeList){
this.districtCodeList = districtCodeList;
return this;
}
/**
* 设置 站点服务器ip
* @param siteIp
*/
public SiteQuery siteIp(String siteIp){
setSiteIp(siteIp);
return this;
}
/**
* 设置 站点服务器ip
* @param siteIpList
*/
public SiteQuery siteIpList(List<String> siteIpList){
this.siteIpList = siteIpList;
return this;
}
/**
* 设置 站点服务器端口
* @param sitePort
*/
public SiteQuery sitePort(String sitePort){
setSitePort(sitePort);
return this;
}
/**
* 设置 站点服务器端口
* @param sitePortList
*/
public SiteQuery sitePortList(List<String> sitePortList){
this.sitePortList = sitePortList;
return this;
}
/**
* 设置 经度
* @param longitude
*/
public SiteQuery longitude(String longitude){
setLongitude(longitude);
return this;
}
/**
* 设置 经度
* @param longitudeList
*/
public SiteQuery longitudeList(List<String> longitudeList){
this.longitudeList = longitudeList;
return this;
}
/**
* 设置 纬度
* @param latitude
*/
public SiteQuery latitude(String latitude){
setLatitude(latitude);
return this;
}
/**
* 设置 纬度
* @param latitudeList
*/
public SiteQuery latitudeList(List<String> latitudeList){
this.latitudeList = latitudeList;
return this;
}
/**
* 设置 中心联系电话
* @param siteTel
*/
public SiteQuery siteTel(String siteTel){
setSiteTel(siteTel);
return this;
}
/**
* 设置 中心联系电话
* @param siteTelList
*/
public SiteQuery siteTelList(List<String> siteTelList){
this.siteTelList = siteTelList;
return this;
}
/**
* 设置 中心详细地址
* @param detailAddress
*/
public SiteQuery detailAddress(String detailAddress){
setDetailAddress(detailAddress);
return this;
}
/**
* 设置 中心详细地址
* @param detailAddressList
*/
public SiteQuery detailAddressList(List<String> detailAddressList){
this.detailAddressList = detailAddressList;
return this;
}
/**
* 设置 中心介绍
* @param siteRemark
*/
public SiteQuery siteRemark(String siteRemark){
setSiteRemark(siteRemark);
return this;
}
/**
* 设置 中心介绍
* @param siteRemarkList
*/
public SiteQuery siteRemarkList(List<String> siteRemarkList){
this.siteRemarkList = siteRemarkList;
return this;
}
/**
* 设置 周一 (1.上班,0.不上)
* @param workday1
*/
public SiteQuery workday1(Integer workday1){
setWorkday1(workday1);
return this;
}
/**
* 设置 开始 周一 (1.上班,0.不上)
* @param workday1Start
*/
public SiteQuery workday1Start(Integer workday1Start){
this.workday1Start = workday1Start;
return this;
}
/**
* 设置 结束 周一 (1.上班,0.不上)
* @param workday1End
*/
public SiteQuery workday1End(Integer workday1End){
this.workday1End = workday1End;
return this;
}
/**
* 设置 增加 周一 (1.上班,0.不上)
* @param workday1Increment
*/
public SiteQuery workday1Increment(Integer workday1Increment){
this.workday1Increment = workday1Increment;
return this;
}
/**
* 设置 周一 (1.上班,0.不上)
* @param workday1List
*/
public SiteQuery workday1List(List<Integer> workday1List){
this.workday1List = workday1List;
return this;
}
/**
* 设置 周二 (1.上班,0.不上)
* @param workday2
*/
public SiteQuery workday2(Integer workday2){
setWorkday2(workday2);
return this;
}
/**
* 设置 开始 周二 (1.上班,0.不上)
* @param workday2Start
*/
public SiteQuery workday2Start(Integer workday2Start){
this.workday2Start = workday2Start;
return this;
}
/**
* 设置 结束 周二 (1.上班,0.不上)
* @param workday2End
*/
public SiteQuery workday2End(Integer workday2End){
this.workday2End = workday2End;
return this;
}
/**
* 设置 增加 周二 (1.上班,0.不上)
* @param workday2Increment
*/
public SiteQuery workday2Increment(Integer workday2Increment){
this.workday2Increment = workday2Increment;
return this;
}
/**
* 设置 周二 (1.上班,0.不上)
* @param workday2List
*/
public SiteQuery workday2List(List<Integer> workday2List){
this.workday2List = workday2List;
return this;
}
/**
* 设置 周三 (1.上班,0.不上)
* @param workday3
*/
public SiteQuery workday3(Integer workday3){
setWorkday3(workday3);
return this;
}
/**
* 设置 开始 周三 (1.上班,0.不上)
* @param workday3Start
*/
public SiteQuery workday3Start(Integer workday3Start){
this.workday3Start = workday3Start;
return this;
}
/**
* 设置 结束 周三 (1.上班,0.不上)
* @param workday3End
*/
public SiteQuery workday3End(Integer workday3End){
this.workday3End = workday3End;
return this;
}
/**
* 设置 增加 周三 (1.上班,0.不上)
* @param workday3Increment
*/
public SiteQuery workday3Increment(Integer workday3Increment){
this.workday3Increment = workday3Increment;
return this;
}
/**
* 设置 周三 (1.上班,0.不上)
* @param workday3List
*/
public SiteQuery workday3List(List<Integer> workday3List){
this.workday3List = workday3List;
return this;
}
/**
* 设置 周四 (1.上班,0.不上)
* @param workday4
*/
public SiteQuery workday4(Integer workday4){
setWorkday4(workday4);
return this;
}
/**
* 设置 开始 周四 (1.上班,0.不上)
* @param workday4Start
*/
public SiteQuery workday4Start(Integer workday4Start){
this.workday4Start = workday4Start;
return this;
}
/**
* 设置 结束 周四 (1.上班,0.不上)
* @param workday4End
*/
public SiteQuery workday4End(Integer workday4End){
this.workday4End = workday4End;
return this;
}
/**
* 设置 增加 周四 (1.上班,0.不上)
* @param workday4Increment
*/
public SiteQuery workday4Increment(Integer workday4Increment){
this.workday4Increment = workday4Increment;
return this;
}
/**
* 设置 周四 (1.上班,0.不上)
* @param workday4List
*/
public SiteQuery workday4List(List<Integer> workday4List){
this.workday4List = workday4List;
return this;
}
/**
* 设置 周五 (1.上班,0.不上)
* @param workday5
*/
public SiteQuery workday5(Integer workday5){
setWorkday5(workday5);
return this;
}
/**
* 设置 开始 周五 (1.上班,0.不上)
* @param workday5Start
*/
public SiteQuery workday5Start(Integer workday5Start){
this.workday5Start = workday5Start;
return this;
}
/**
* 设置 结束 周五 (1.上班,0.不上)
* @param workday5End
*/
public SiteQuery workday5End(Integer workday5End){
this.workday5End = workday5End;
return this;
}
/**
* 设置 增加 周五 (1.上班,0.不上)
* @param workday5Increment
*/
public SiteQuery workday5Increment(Integer workday5Increment){
this.workday5Increment = workday5Increment;
return this;
}
/**
* 设置 周五 (1.上班,0.不上)
* @param workday5List
*/
public SiteQuery workday5List(List<Integer> workday5List){
this.workday5List = workday5List;
return this;
}
/**
* 设置 周六 (1.上班,0.不上)
* @param workday6
*/
public SiteQuery workday6(Integer workday6){
setWorkday6(workday6);
return this;
}
/**
* 设置 开始 周六 (1.上班,0.不上)
* @param workday6Start
*/
public SiteQuery workday6Start(Integer workday6Start){
this.workday6Start = workday6Start;
return this;
}
/**
* 设置 结束 周六 (1.上班,0.不上)
* @param workday6End
*/
public SiteQuery workday6End(Integer workday6End){
this.workday6End = workday6End;
return this;
}
/**
* 设置 增加 周六 (1.上班,0.不上)
* @param workday6Increment
*/
public SiteQuery workday6Increment(Integer workday6Increment){
this.workday6Increment = workday6Increment;
return this;
}
/**
* 设置 周六 (1.上班,0.不上)
* @param workday6List
*/
public SiteQuery workday6List(List<Integer> workday6List){
this.workday6List = workday6List;
return this;
}
/**
* 设置 周日 (1.上班,0.不上)
* @param workday7
*/
public SiteQuery workday7(Integer workday7){
setWorkday7(workday7);
return this;
}
/**
* 设置 开始 周日 (1.上班,0.不上)
* @param workday7Start
*/
public SiteQuery workday7Start(Integer workday7Start){
this.workday7Start = workday7Start;
return this;
}
/**
* 设置 结束 周日 (1.上班,0.不上)
* @param workday7End
*/
public SiteQuery workday7End(Integer workday7End){
this.workday7End = workday7End;
return this;
}
/**
* 设置 增加 周日 (1.上班,0.不上)
* @param workday7Increment
*/
public SiteQuery workday7Increment(Integer workday7Increment){
this.workday7Increment = workday7Increment;
return this;
}
/**
* 设置 周日 (1.上班,0.不上)
* @param workday7List
*/
public SiteQuery workday7List(List<Integer> workday7List){
this.workday7List = workday7List;
return this;
}
/**
* 设置 楼层
* @param level
*/
public SiteQuery level(Integer level){
setLevel(level);
return this;
}
/**
* 设置 开始 楼层
* @param levelStart
*/
public SiteQuery levelStart(Integer levelStart){
this.levelStart = levelStart;
return this;
}
/**
* 设置 结束 楼层
* @param levelEnd
*/
public SiteQuery levelEnd(Integer levelEnd){
this.levelEnd = levelEnd;
return this;
}
/**
* 设置 增加 楼层
* @param levelIncrement
*/
public SiteQuery levelIncrement(Integer levelIncrement){
this.levelIncrement = levelIncrement;
return this;
}
/**
* 设置 楼层
* @param levelList
*/
public SiteQuery levelList(List<Integer> levelList){
this.levelList = levelList;
return this;
}
/**
* 设置 楼栋
* @param building
*/
public SiteQuery building(Integer building){
setBuilding(building);
return this;
}
/**
* 设置 开始 楼栋
* @param buildingStart
*/
public SiteQuery buildingStart(Integer buildingStart){
this.buildingStart = buildingStart;
return this;
}
/**
* 设置 结束 楼栋
* @param buildingEnd
*/
public SiteQuery buildingEnd(Integer buildingEnd){
this.buildingEnd = buildingEnd;
return this;
}
/**
* 设置 增加 楼栋
* @param buildingIncrement
*/
public SiteQuery buildingIncrement(Integer buildingIncrement){
this.buildingIncrement = buildingIncrement;
return this;
}
/**
* 设置 楼栋
* @param buildingList
*/
public SiteQuery buildingList(List<Integer> buildingList){
this.buildingList = buildingList;
return this;
}
/**
* 设置 logo图片地址
* @param logoPath
*/
public SiteQuery logoPath(String logoPath){
setLogoPath(logoPath);
return this;
}
/**
* 设置 logo图片地址
* @param logoPathList
*/
public SiteQuery logoPathList(List<String> logoPathList){
this.logoPathList = logoPathList;
return this;
}
/**
* 设置 英文名称
* @param englishName
*/
public SiteQuery englishName(String englishName){
setEnglishName(englishName);
return this;
}
/**
* 设置 英文名称
* @param englishNameList
*/
public SiteQuery englishNameList(List<String> englishNameList){
this.englishNameList = englishNameList;
return this;
}
/**
* 设置 负责人
* @param leadingOfficial
*/
public SiteQuery leadingOfficial(String leadingOfficial){
setLeadingOfficial(leadingOfficial);
return this;
}
/**
* 设置 负责人
* @param leadingOfficialList
*/
public SiteQuery leadingOfficialList(List<String> leadingOfficialList){
this.leadingOfficialList = leadingOfficialList;
return this;
}
/**
* 设置 联系电话
* @param leadingOfficialTelephone
*/
public SiteQuery leadingOfficialTelephone(String leadingOfficialTelephone){
setLeadingOfficialTelephone(leadingOfficialTelephone);
return this;
}
/**
* 设置 联系电话
* @param leadingOfficialTelephoneList
*/
public SiteQuery leadingOfficialTelephoneList(List<String> leadingOfficialTelephoneList){
this.leadingOfficialTelephoneList = leadingOfficialTelephoneList;
return this;
}
/**
* 设置 部署模块,逗号分隔
* @param modelIds
*/
public SiteQuery modelIds(String modelIds){
setModelIds(modelIds);
return this;
}
/**
* 设置 部署模块,逗号分隔
* @param modelIdsList
*/
public SiteQuery modelIdsList(List<String> modelIdsList){
this.modelIdsList = modelIdsList;
return this;
}
/**
* 设置 创建用户
* @param createUserId
*/
public SiteQuery createUserId(Long createUserId){
setCreateUserId(createUserId);
return this;
}
/**
* 设置 开始 创建用户
* @param createUserIdStart
*/
public SiteQuery createUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
return this;
}
/**
* 设置 结束 创建用户
* @param createUserIdEnd
*/
public SiteQuery createUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
return this;
}
/**
* 设置 增加 创建用户
* @param createUserIdIncrement
*/
public SiteQuery createUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
return this;
}
/**
* 设置 创建用户
* @param createUserIdList
*/
public SiteQuery createUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
*/
public List<SiteQuery> getOrConditionList(){
return this.orConditionList;
}
/**
* 设置 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @param orConditionList
*/
public void setOrConditionList(List<SiteQuery> orConditionList){
this.orConditionList = orConditionList;
}
/**
* 获取 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @return andConditionList
*/
public List<SiteQuery> getAndConditionList(){
return this.andConditionList;
}
/**
* 设置 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @param andConditionList
*/
public void setAndConditionList(List<SiteQuery> andConditionList){
this.andConditionList = andConditionList;
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.model;
import com.mortals.xhx.module.area.model.AreaEntity;
import lombok.Data;
import org.springframework.util.ObjectUtils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 区域前端映射树结构实体类
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class SiteTreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private String id;
/**
* 站点编码
*/
private String siteCode;
/**
* 节点名称
*/
private String label;
/**
* 区域编码
*/
private String areaCode;
/**
* 是否叶子节点
*/
private Boolean isLeaf;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 节点类型
*/
private String type;
/**
* 图标
*/
private String icon;
/**
* 子节点
*/
private List<SiteTreeSelect> children;
public SiteTreeSelect(AreaEntity entity) {
//如果是站点,则替换名称和id
this.id = entity.getIid();
this.label = entity.getName();
if ("False".equalsIgnoreCase(entity.getHaveSonArea())) {
this.isLeaf = true;
this.children = new ArrayList();
} else {
this.isLeaf = false;
}
this.areaCode = entity.getAreaCode();
this.type = "area";
this.icon = "el-icon-folder";
}
public SiteTreeSelect(AreaEntity entity, Map<String, SiteEntity> siteMap) {
List<SiteEntity> collect = siteMap.entrySet().stream().filter(f -> f.getKey().startsWith(entity.getAreaCode()))
.map(m -> m.getValue())
.collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
this.id = collect.stream().map(item -> item.getId().toString()).collect(Collectors.joining(","));
this.label = collect.stream().map(item -> item.getSiteName()).collect(Collectors.joining(","));
this.siteCode = collect.stream().map(item -> item.getSiteCode()).collect(Collectors.joining(","));
this.type = "site";
this.icon = "el-icon-wind-power";
this.longitude = collect.stream().findFirst().map(item -> item.getLongitude()).orElseGet(() -> "");
this.latitude = collect.stream().findFirst().map(item -> item.getLatitude()).orElseGet(() -> "");
} else {
this.id = entity.getIid();
this.label = entity.getName();
this.type = "area";
this.icon = "el-icon-place";
}
if ("False".equalsIgnoreCase(entity.getHaveSonArea())) {
this.isLeaf = true;
//this.children = new ArrayList();
} else {
this.isLeaf = false;
this.children = entity.getChildren().stream().map(item -> new SiteTreeSelect(item, siteMap)).collect(Collectors.toList());
}
this.areaCode = entity.getAreaCode();
}
public SiteTreeSelect(SiteEntity entity) {
this.id = entity.getId().toString();
this.label = entity.getSiteName();
this.isLeaf = true;
this.type = "site";
this.icon = "el-icon-document";
this.longitude = entity.getLongitude();
this.latitude = entity.getLatitude();
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.model.vo;
import com.mortals.xhx.module.site.model.SiteEntity;
import lombok.Data;
/**
* 站点完整信息
*/
@Data
public class SitAllInfoVO extends SiteEntity {
}
package com.mortals.xhx.module.site.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
import java.util.List;
/**
* 站点视图对象
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class SiteVo extends BaseEntityLong {
private List<Long> idList;
private String logoFullPath;
}
\ No newline at end of file
package com.mortals.xhx.module.site.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import java.util.List;
/**
* SiteService
* <p>
* 站点 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
/**
* 区域站点树
*
* @param context
* @return
*/
List<SiteTreeSelect> siteTree(Context context);
/**
* 根据站点列表获取区域站点树
*
* @param context
* @return
*/
List<SiteTreeSelect> getSiteTree(Context context);
/**
* 根据区域code获取子站点
*
* @param context
* @return
*/
List<SiteEntity> getFlatSitesByAreaCode(String areaCode,Context context);
/**
* 根据Site获取子站点
*
* @param context
* @return
*/
List<SiteEntity> getFlatSitesBySiteId(Long siteId,Context context);
void setSiteTree(List<SiteTreeSelect> list, Context context);
void removeSiteTree(List<SiteTreeSelect> list, Context context);
List<SiteEntity> getListAllInfoByQuery(SiteQuery query,Context context) throws AppException;
void changeUrlPath(SiteEntity siteEntity);
}
\ No newline at end of file
package com.mortals.xhx.module.site.service.impl;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.site.dao.SiteDao;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* SiteService
* 站点 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("siteService")
@Slf4j
public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteEntity, Long> implements SiteService {
// private List<SiteTreeSelect> siteTreeList;
/**
* 根据用户id 暂存对应站点树 默认0为全站点树
*/
private Map<Long, List<SiteTreeSelect>> siteTreeMap = new HashMap<>();
@Autowired
private AreaService areaService;
@Autowired
private IUserFeign userFeign;
@Override
protected void validData(SiteEntity entity, Context context) throws AppException {
if (ObjectUtils.isEmpty(entity.getAreaCode())) {
throw new AppException("区域编码不能为空!");
}
AreaEntity areaEntity = areaService.getCache(entity.getAreaCode());
if (ObjectUtils.isEmpty(areaEntity)) {
throw new AppException(String.format("区域不存在!区域编码:%s", entity.getAreaCode()));
}
super.validData(entity, context);
}
@Override
protected void saveBefore(SiteEntity entity, Context context) throws AppException {
List<SiteEntity> siteEntities = this.find(new SiteQuery().areaCode(entity.getAreaCode()));
entity.setSiteCode(entity.getAreaCode() + Constant.SITE_SPLIT_MARK + StringUtils.lpad(siteEntities.size() + 1, Constant.SITE_CODE_NUM));
super.saveBefore(entity, context);
}
@Override
public List<SiteTreeSelect> siteTree(Context context) {
Map<String, AreaEntity> areaMap = new HashMap<>();
SiteQuery siteQuery = new SiteQuery();
Set<String> siteSet = Arrays.stream(context.getUser().getSiteIds().split(",")).filter(f -> !f.equals("")).collect(Collectors.toSet());
log.info("initSiteIds==>{}", JSON.toJSONString(siteSet));
if (!ObjectUtils.isEmpty(siteSet)) {
List<Long> siteIdList = siteSet.stream().map(Long::parseLong).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(siteIdList)) {
siteQuery.idList(siteIdList);
}
}
//查詢指定的站點ids
log.info("siteQuery==>{}", JSON.toJSONString(siteQuery));
List<SiteEntity> siteList = this.find(siteQuery);
//turn to sitemap
Map<String, SiteEntity> siteMap = siteList.parallelStream().collect(Collectors.toMap(x -> x.getSiteCode(), y -> y, (o, n) -> n));
//遍历过滤站点树
for (SiteEntity siteEntity : siteList) {
AreaEntity areaEntity = areaService.getExtCache(siteEntity.getAreaCode());
//根据区域添加父节点
if (!ObjectUtils.isEmpty(areaEntity)
&& !ObjectUtils.isEmpty(areaEntity.getPid())) {
//递归查找父节点并添加
areaMap.put(areaEntity.getAreaCode(), areaEntity);
//递归
recursionFn(areaMap, areaEntity);
}
}
log.debug("rebuildAreaMap==>{}", JSON.toJSONString(areaMap));
//areaMap 为当前站点相关区域树结构 已经剔除不必要的分支结构
return buildSiteTreeSelect(areaMap, siteMap);
}
public List<SiteTreeSelect> buildSiteTreeSelect(Map<String, AreaEntity> areaMap, Map<String, SiteEntity> siteMap) {
List<AreaEntity> areaList = areaMap.values().stream().collect(Collectors.toList());
List<AreaEntity> returnList = new ArrayList<>();
//区域id
List<String> tempList = areaList.stream().map(AreaEntity::getIid).collect(Collectors.toList());
for (AreaEntity areaEntity : areaList) {
//查询当前区域列表中最顶级的节点 并构建树
if (!tempList.contains(areaEntity.getPid())) {
recursion(areaList, areaEntity);
returnList.add(areaEntity);
}
}
//区域树
if (returnList.isEmpty()) {
returnList = areaList;
}
//构建站点树
List<SiteTreeSelect> collect = returnList.parallelStream().map(item ->
new SiteTreeSelect(item, siteMap)
).collect(Collectors.toList());
//this.siteTreeList = collect;
return collect;
}
private void recursion(List<AreaEntity> list, AreaEntity entity) {
// 得到子节点列表
List<AreaEntity> childList = getChildList(list, entity);
entity.setChildren(childList);
for (AreaEntity tChild : childList) {
if (hasChild(list, tChild)) {
recursion(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<AreaEntity> getChildList(List<AreaEntity> list, AreaEntity entity) {
return list.stream()
.filter(item -> item.getPid().equals(entity.getIid()))
.collect(Collectors.toList());
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<AreaEntity> list, AreaEntity t) {
return getChildList(list, t).size() > 0 ? true : false;
}
/**
* 递归列表
*/
private void recursionFn(Map<String, AreaEntity> areaMap, AreaEntity t) {
// 得到父节点并加入
AreaEntity areaEntity = areaService.selectOne(new AreaQuery().iid(t.getPid()));
if (!ObjectUtils.isEmpty(areaEntity)) {
areaMap.put(areaEntity.getAreaCode(), areaEntity);
recursionFn(areaMap, areaEntity);
}
}
@Override
protected void updateAfter(SiteEntity entity, Context context) throws AppException {
//刷新站点树
new Thread(new SyncTreeSiteThread(this, context)).start();
super.updateAfter(entity, context);
}
@Override
protected void saveAfter(SiteEntity entity, Context context) throws AppException {
//刷新站点树
new Thread(new SyncTreeSiteThread(this, context)).start();
super.saveAfter(entity, context);
}
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
new Thread(new SyncTreeSiteThread(this, context)).start();
super.removeAfter(ids, context, result);
}
@Override
public List<SiteTreeSelect> getSiteTree(Context context) {
List<SiteTreeSelect> siteTreeSelects = siteTreeMap.get(context.getUser().getId());
//如果所属站点为空返回全节点树
if (!ObjectUtils.isEmpty(siteTreeSelects)) {
return siteTreeSelects;
} else {
return siteTreeMap.get(0);
}
}
@Override
public List<SiteEntity> getFlatSitesByAreaCode(String areaCode, Context context) {
if (ObjectUtils.isEmpty(areaCode)) {
throw new AppException("区域编码不能为空!");
}
AreaEntity areaEntity = areaService.getExtCache(areaCode);
if (ObjectUtils.isEmpty(areaEntity)) {
throw new AppException(String.format("区域不存在!区域编码:%s", areaCode));
}
String matchCode = areaCode.replaceAll("(0)+$", "");
SiteQuery siteQuery = new SiteQuery();
siteQuery.setAreaCode(matchCode+"%");
List<SiteEntity> siteEntities = this.find(siteQuery);
//List<SiteEntity> siteEntities = this.find(new SiteQuery()).stream().peek(site -> changeUrlPath(site)).collect(Collectors.toList());
// for (SiteEntity siteEntity : siteEntities) {
// boolean bool = getSite(areaCode, siteEntity.getAreaCode(), siteList, siteEntity);
// if (bool) continue;
// }
return siteEntities;
}
@Override
public List<SiteEntity> getFlatSitesBySiteId(Long siteId, Context context) {
List<SiteEntity> siteList = new ArrayList<>();
if (ObjectUtils.isEmpty(siteId)) {
throw new AppException("站点Id不能为空!");
}
SiteEntity siteCache = this.getCache(siteId.toString());
if (ObjectUtils.isEmpty(siteCache)) {
throw new AppException("站点不存在,siteId:" + siteId);
}
AreaEntity areaEntity = areaService.getExtCache(siteCache.getAreaCode());
if (ObjectUtils.isEmpty(areaEntity)) {
throw new AppException(String.format("区域不存在!区域编码:%s", siteCache.getAreaCode()));
}
String matchCode = siteCache.getAreaCode().replaceAll("(0)+$", "");
SiteQuery siteQuery = new SiteQuery();
siteQuery.setAreaCode(matchCode+"%");
List<SiteEntity> siteEntities = this.find(siteQuery);
//
// List<SiteEntity> siteEntities = this.find(new SiteQuery()).stream().peek(site -> changeUrlPath(site)).collect(Collectors.toList());
// ;
// for (SiteEntity siteEntity : siteEntities) {
// boolean bool = getSite(siteCache.getAreaCode(), siteEntity.getAreaCode(), siteList, siteEntity);
// if (bool) continue;
//
// }
return siteEntities;
}
private boolean getSite(String rootAreaCode, String areaCode, List<SiteEntity> siteList, SiteEntity siteEntity) {
// AreaEntity areaTemp = areaService.getExtCache(siteEntity.getAreaCode());
if (rootAreaCode.equals(areaCode)) {
siteList.add(siteEntity);
//log.info("add site:{}", siteEntity.getSiteCode());
return true;
} else {
AreaEntity areaTemp = areaService.getExtCache(areaCode);
if (!ObjectUtils.isEmpty(areaTemp) && !ObjectUtils.isEmpty(areaTemp.getPid())) {
//根据子节点查找父节点
AreaEntity areaEntity = areaService.selectOne(new AreaQuery().iid(areaTemp.getPid()));
if (!ObjectUtils.isEmpty(areaEntity)) {
return getSite(rootAreaCode, areaEntity.getAreaCode(), siteList, siteEntity);
}
}
return false;
}
}
@Override
public void setSiteTree(List<SiteTreeSelect> list, Context context) {
siteTreeMap.put(context.getUser().getId(), list);
}
@Override
public void removeSiteTree(List<SiteTreeSelect> list, Context context) {
siteTreeMap.remove(context.getUser().getId());
}
@Override
public List<SiteEntity> getListAllInfoByQuery(SiteQuery query, Context context) throws AppException {
List<SiteEntity> list = this.find(query, context);
// if (CollectionUtils.isNotEmpty(list)) {
// list.stream().forEach(item -> {
// ModelQuery modelQuery = new ModelQuery();
// List<String> modelIds = StringUtils.converStr2List(item.getModelIds());
// List<Long> ids = modelIds.stream().map(s -> DataUtil.converStr2Long(s.trim(), 0)).collect(Collectors.toList());
// if (ids.isEmpty()) {
// ids.add(0l);
// }
// modelQuery.setIdList(ids);
// List<ModelEntity> modelEntityList = modelService.find(modelQuery);
// item.setModelList(modelEntityList);
// });
// }
return list;
}
@Override
protected void findAfter(SiteEntity params, PageInfo pageInfo, Context context, List<SiteEntity> list) throws AppException {
list.stream().forEach(site -> changeUrlPath(site));
super.findAfter(params, pageInfo, context, list);
}
@Override
public void changeUrlPath(SiteEntity siteEntity) {
// if (!ObjectUtils.isEmpty(siteEntity) && !ObjectUtils.isEmpty(siteEntity.getLogoPath())) {
// String domain = GlobalSysInfo.getParamValue(PARAM_SERVER_HTTP_IMAGE_URL, "http://192.168.0.98:11091");
// String fullPath = URLUtil.completeUrl(domain, siteEntity.getLogoPath());
// siteEntity.setLogoFullPath(fullPath);
// }
// if (!ObjectUtils.isEmpty(siteEntity) && !ObjectUtils.isEmpty(siteEntity.getModelIds())) {
// List<Long> modelIdlist = StrUtil.split(siteEntity.getModelIds(), ",".charAt(0), -1, true, (String str) -> Long.parseLong(str));
// List<ModelEntity> collect =modelService.find(new ModelQuery().idList(modelIdlist));
// siteEntity.setModelList(collect);
// }
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 站点
*
* @author zxfei
* @date 2022-01-20
*/
@RestController
@RequestMapping("site")
@Slf4j
public class SiteController extends BaseCRUDJsonBodyMappingController<SiteService, SiteEntity, Long> {
@Autowired
private ParamService paramService;
public SiteController() {
super.setModuleDesc("站点");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "haveSonArea", paramService.getParamBySecondOrganize("Site", "haveSonArea"));
this.addDict(model, "workday1", paramService.getParamBySecondOrganize("Site", "workday1"));
this.addDict(model, "workday2", paramService.getParamBySecondOrganize("Site", "workday2"));
this.addDict(model, "workday3", paramService.getParamBySecondOrganize("Site", "workday3"));
this.addDict(model, "workday4", paramService.getParamBySecondOrganize("Site", "workday4"));
this.addDict(model, "workday5", paramService.getParamBySecondOrganize("Site", "workday5"));
this.addDict(model, "workday6", paramService.getParamBySecondOrganize("Site", "workday6"));
this.addDict(model, "workday7", paramService.getParamBySecondOrganize("Site", "workday7"));
this.addDict(model, "level", paramService.getParamBySecondOrganize("Site", "level"));
this.addDict(model, "building", paramService.getParamBySecondOrganize("Site", "building"));
this.addDict(model, "isSite", paramService.getParamBySecondOrganize("Site", "isSite"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Site", "status"));
super.init(model, context);
}
/**
* 构建站点树
*/
@GetMapping(value = "siteTree")
public String siteTree() {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = this.getModuleDesc() + "构建站点树";
try {
List<SiteTreeSelect> siteTree = this.service.getSiteTree(getContext());
if (ObjectUtils.isEmpty(siteTree)) {
log.info("为初始化站点树,重新构建!");
siteTree = this.service.siteTree(getContext());
}
model.put("siteTree", siteTree);
this.init(model, getContext());
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} catch (Exception e) {
log.error("构建站点树异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
/**
* 根据区域编码查询站点列表
*/
@PostMapping(value = "getFlatSitesByAreaCode")
@UnAuth
public String getFlatSitesByAreaCode(@RequestBody SiteQuery site) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "根据区域编码查询站点列表" + this.getModuleDesc();
try {
List<SiteEntity> siteEntityList = this.service.getFlatSitesByAreaCode(site.getAreaCode(), getContext());
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, siteEntityList);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询站点列表成功!");
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
/**
* 根据区域id查询站点列表ids
*/
@PostMapping(value = "getFlatSitesByAreaIds")
@UnAuth
public String getFlatSitesByAreaIds(@RequestBody SiteQuery site) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "根据区域编码查询站点列表" + this.getModuleDesc();
try {
String siteIds = site.getAreaCodeList().stream().flatMap(areaId ->
this.service.getFlatSitesByAreaCode(areaId, getContext()).stream()
).map(item -> item.getId().toString()).distinct().collect(Collectors.joining(","));
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, siteIds);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询站点列表成功!");
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
/**
* 根据站点id查询站点列表子集,包含当前站点
*/
@PostMapping(value = "getFlatSitesBySiteId")
@UnAuth
public String getFlatSitesBySiteId(@RequestBody SiteQuery site) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "根据站点id查询站点列表子集" + this.getModuleDesc();
try {
List<SiteEntity> siteEntityList = this.service.getFlatSitesBySiteId(site.getId(), getContext());
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, siteEntityList);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, busiDesc+"成功!");
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
@Override
protected int infoAfter(Long id, Map<String, Object> model, SiteEntity entity, Context context) throws AppException {
this.service.changeUrlPath(entity);
return super.infoAfter(id, model, entity, context);
}
/**
* 条件查询,无分页信息
* @param query
* @return
*/
@PostMapping({"list/noPage"})
@UnAuth
public Rest<Object> getList(@RequestBody SiteQuery query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code=1;
try {
if(CollectionUtils.isNotEmpty(query.getAreaCodeList())){
List<SiteEntity> siteEntityList= query.getAreaCodeList().parallelStream().flatMap(areaId ->
this.service.getFlatSitesByAreaCode(areaId, getContext()).stream()
).distinct().collect(Collectors.toList());
model.put("data", siteEntityList);
}else {
List<SiteEntity> result = this.getService().find(query, context);
model.put("data", result);
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
//this.init(model, context);
ret.setCode(code);
ret.setData(model);
//ret.setDict(model.remove("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
/**
* 包含站点下面的模块以及模块下面的数据统计
* @param query
* @return
*/
@PostMapping({"list/allInfo"})
@UnAuth
public Rest<Object> list(@RequestBody SiteQuery query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code=1;
try {
List<SiteEntity> result = this.getService().getListAllInfoByQuery(query, context);
model.put("data", result);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model);
ret.setDict(model.remove("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.mortals.framework.model.PageInfo; ...@@ -9,6 +9,7 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.IAuthTokenService; import com.mortals.framework.service.IAuthTokenService;
import com.mortals.xhx.common.code.DeviceStatusEnum; import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.code.PlatformTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.ErrorCode; import com.mortals.xhx.common.key.ErrorCode;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
...@@ -19,9 +20,12 @@ import com.mortals.xhx.feign.user.IUserFeign; ...@@ -19,9 +20,12 @@ import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery; import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService; import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.module.sitestat.model.SitestatQuery; import com.mortals.xhx.module.sitestat.model.SitestatQuery;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.sitestat.dao.SitestatDao; import com.mortals.xhx.module.sitestat.dao.SitestatDao;
...@@ -50,9 +54,9 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si ...@@ -50,9 +54,9 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
@Autowired @Autowired
private DeviceService deviceService; private DeviceService deviceService;
@Autowired @Autowired
private IUserFeign userFeign; private SiteService siteService;
@Autowired @Value("${platform.type:cloud}")
private IAuthTokenService authTokenService; private String platFormType;//版本,默认云服务版本
/** /**
* 重写带分页的方法 * 重写带分页的方法
...@@ -67,10 +71,55 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si ...@@ -67,10 +71,55 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
public Result<SitestatEntity> find(SitestatEntity entity, PageInfo pageInfo, Context context) throws AppException { public Result<SitestatEntity> find(SitestatEntity entity, PageInfo pageInfo, Context context) throws AppException {
Result<SitestatEntity> res = new Result<>(); Result<SitestatEntity> res = new Result<>();
//根据站点查询所以站点子集列表 //根据站点查询所以站点子集列表
Result<SitestatEntity> sitestatsResult = getSitestatsResult(entity, pageInfo, res);
if (sitestatsResult != null) return sitestatsResult;
Result<SitestatEntity> sitestatResult = getSitestatEntityResult(entity, pageInfo, context, res);
if (sitestatResult != null) return sitestatResult;
return new Result<>();
}
private Result<SitestatEntity> getSitestatEntityResult(SitestatEntity entity, PageInfo pageInfo, Context context, Result<SitestatEntity> res) {
if (ObjectUtils.isEmpty(entity.getSiteId())) return null;
if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
//根据返回的id 筛选列表
Map<Long, SitestatEntity> collectMap = this.findToMap(new SitestatEntity(), context);
List<SitestatEntity> list = this.siteService.find(new SiteQuery().id(entity.getSiteId())).stream().filter(f -> collectMap.containsKey(f.getId())).map(m -> collectMap.get(m.getId())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(entity.getSiteName())) {
list = MemoryPagination.search(entity.getSiteName(), list);
}
pageInfo.setTotalResult(list.size());
List<SitestatEntity> siteStatList = MemoryPagination.pagination(list, pageInfo.getCurrPage(), pageInfo.getPrePageResult());
res.setList(siteStatList);
res.setPageInfo(pageInfo);
} else {
SitePdu sitePdu = new SitePdu();
sitePdu.setId(entity.getSiteId());
Rest<List<SitePdu>> result = siteFeign.getFlatSitesBySiteId(sitePdu);
if (result.getCode() == YesNoEnum.YES.getValue()) {
//根据返回的id 筛选列表
Map<Long, SitestatEntity> collectMap = this.findToMap(new SitestatEntity(), context);
List<SitestatEntity> list = result.getData().stream().filter(f -> collectMap.containsKey(f.getId())).map(m -> collectMap.get(m.getId())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(entity.getSiteName())) {
list = MemoryPagination.search(entity.getSiteName(), list);
}
pageInfo.setTotalResult(list.size());
List<SitestatEntity> siteStatList = MemoryPagination.pagination(list, pageInfo.getCurrPage(), pageInfo.getPrePageResult());
res.setList(siteStatList);
res.setPageInfo(pageInfo);
} else {
log.info("error resp:{}", JSON.toJSONString(result));
}
}
if (!ObjectUtils.isEmpty(entity.getSiteIdList())) { return null;
// TODO: 2022/7/1 站点为多站点时候合并 }
List<SitestatEntity> collect = entity.getSiteIdList().stream().flatMap(siteId -> {
private Result<SitestatEntity> getSitestatsResult(SitestatEntity entity, PageInfo pageInfo, Result<SitestatEntity> res) {
List<SitestatEntity> collect = null;
if (ObjectUtils.isEmpty(entity.getSiteIdList())) return null;
if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
collect = entity.getSiteIdList().stream().flatMap(siteId -> {
SitePdu sitePdu = new SitePdu(); SitePdu sitePdu = new SitePdu();
sitePdu.setId(siteId); sitePdu.setId(siteId);
Rest<List<SitePdu>> result = siteFeign.getFlatSitesBySiteId(sitePdu); Rest<List<SitePdu>> result = siteFeign.getFlatSitesBySiteId(sitePdu);
...@@ -88,55 +137,55 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si ...@@ -88,55 +137,55 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
sitestatEntity.setLeadingOfficialTelephone(m.getLeadingOfficialTelephone()); sitestatEntity.setLeadingOfficialTelephone(m.getLeadingOfficialTelephone());
return sitestatEntity; return sitestatEntity;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return list.stream(); if (!ObjectUtils.isEmpty(list)) {
return list.stream();
}
} }
return new ArrayList<SitestatEntity>().stream(); return new ArrayList<SitestatEntity>().stream();
}).collect(Collectors.toList()); }).distinct().collect(Collectors.toList());
//列表去重
collect = collect.stream().filter(MemoryPagination.distinctByKey(SitestatEntity::getId)).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(entity.getSiteName())) {
collect = MemoryPagination.search(entity.getSiteName(), collect);
}
pageInfo.setTotalResult(collect.size());
List<SitestatEntity> siteStatList = MemoryPagination.pagination(collect, pageInfo.getCurrPage(), pageInfo.getPrePageResult());
res.setList(siteStatList);
res.setPageInfo(pageInfo);
return res;
}
if (ObjectUtils.isEmpty(entity.getSiteId())) {
return res;
//throw new AppException("当前站点ID不能为空!");
}
SitePdu sitePdu = new SitePdu();
sitePdu.setId(entity.getSiteId());
Rest<List<SitePdu>> result = siteFeign.getFlatSitesBySiteId(sitePdu);
if (result.getCode() == YesNoEnum.YES.getValue()) {
//根据返回的id 筛选列表
Map<Long, SitestatEntity> collectMap = this.find(new SitestatEntity()).stream().collect(Collectors.toMap(x -> x.getSiteId(), y -> y, (o, n) -> n));
List<SitestatEntity> list = result.getData().stream().filter(f -> collectMap.containsKey(f.getId())).map(m -> collectMap.get(m.getId())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(entity.getSiteName())) {
list = MemoryPagination.search(entity.getSiteName(), list);
}
pageInfo.setTotalResult(list.size());
List<SitestatEntity> siteStatList = MemoryPagination.pagination(list, pageInfo.getCurrPage(), pageInfo.getPrePageResult());
res.setList(siteStatList);
res.setPageInfo(pageInfo);
} else { } else {
log.info("error resp:{}", JSON.toJSONString(result)); collect = entity.getSiteIdList().stream().flatMap(siteId -> {
//根据返回的id 筛选列表
Map<Long, SitestatEntity> collectMap = this.find(new SitestatEntity()).stream().collect(Collectors.toMap(x -> x.getSiteId(), y -> y, (o, n) -> n));
List<SitestatEntity> list = siteService.find(new SiteQuery().id(siteId)).stream()
.filter(f -> collectMap.containsKey(f.getId()))
.map(m -> {
SitestatEntity sitestatEntity = collectMap.get(m.getId());
sitestatEntity.setLng(m.getLongitude());
sitestatEntity.setLat(m.getLatitude());
sitestatEntity.setAddress(m.getDetailAddress());
sitestatEntity.setLeadingOfficial(m.getLeadingOfficial());
sitestatEntity.setLeadingOfficialTelephone(m.getLeadingOfficialTelephone());
return sitestatEntity;
}).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(list)) {
return list.stream();
}
return new ArrayList<SitestatEntity>().stream();
}).distinct().collect(Collectors.toList());
}
if (!ObjectUtils.isEmpty(entity.getSiteName())) {
collect = MemoryPagination.search(entity.getSiteName(), collect);
} }
pageInfo.setTotalResult(collect.size());
List<SitestatEntity> siteStatList = MemoryPagination.pagination(collect, pageInfo.getCurrPage(), pageInfo.getPrePageResult());
res.setList(siteStatList);
res.setPageInfo(pageInfo);
return res; return res;
} }
@Override @Override
public String getSiteTree(Context context) { public String getSiteTree(Context context) {
String token = context.getUser().getToken(); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
if (!ObjectUtils.isEmpty(token)) { String token = context.getUser().getToken();
String resp = siteFeign.siteTree(token); if (!ObjectUtils.isEmpty(token)) {
return resp; String resp = siteFeign.siteTree(token);
return resp;
}
} else {
return JSON.toJSONString(siteService.siteTree(context));
} }
return JSON.toJSONString(Rest.fail(ErrorCode.ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT)); return JSON.toJSONString(Rest.fail(ErrorCode.ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT));
} }
......
...@@ -9,6 +9,7 @@ import com.mortals.framework.exception.AppException; ...@@ -9,6 +9,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.IAuthTokenService; import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.PlatformTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
...@@ -16,11 +17,15 @@ import com.mortals.xhx.common.pdu.user.UserPdu; ...@@ -16,11 +17,15 @@ import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.feign.user.IUserFeign; import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.device.service.DeviceService; import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.module.sitestat.model.SitestatEntity; import com.mortals.xhx.module.sitestat.model.SitestatEntity;
import com.mortals.xhx.module.sitestat.model.SitestatQuery; import com.mortals.xhx.module.sitestat.model.SitestatQuery;
import com.mortals.xhx.module.sitestat.service.SitestatService; import com.mortals.xhx.module.sitestat.service.SitestatService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -46,6 +51,12 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest ...@@ -46,6 +51,12 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
@Autowired @Autowired
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private SiteService siteService;
public SitestatController() { public SitestatController() {
super.setModuleDesc("站点统计"); super.setModuleDesc("站点统计");
} }
...@@ -59,14 +70,25 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest ...@@ -59,14 +70,25 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
@Override @Override
protected int infoAfter(Long id, Map<String, Object> model, SitestatEntity entity, Context context) throws AppException { protected int infoAfter(Long id, Map<String, Object> model, SitestatEntity entity, Context context) throws AppException {
Rest<SitePdu> resp = siteFeign.info(entity.getSiteId()); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
if(resp.getCode()==YesNoEnum.YES.getValue()){ SiteEntity siteEntity = siteService.get(entity.getSiteId());
if (!ObjectUtils.isEmpty(siteEntity)) {
entity.setLng(resp.getData().getLongitude()); entity.setLng(siteEntity.getLongitude());
entity.setLat(resp.getData().getLatitude()); entity.setLat(siteEntity.getLatitude());
entity.setAddress(resp.getData().getDetailAddress()); entity.setAddress(siteEntity.getDetailAddress());
entity.setLeadingOfficial(resp.getData().getLeadingOfficial()); entity.setLeadingOfficial(siteEntity.getLeadingOfficial());
entity.setLeadingOfficialTelephone(resp.getData().getLeadingOfficialTelephone()); entity.setLeadingOfficialTelephone(siteEntity.getLeadingOfficialTelephone());
}
} else {
Rest<SitePdu> resp = siteFeign.info(entity.getSiteId());
if (resp.getCode() == YesNoEnum.YES.getValue()) {
entity.setLng(resp.getData().getLongitude());
entity.setLat(resp.getData().getLatitude());
entity.setAddress(resp.getData().getDetailAddress());
entity.setLeadingOfficial(resp.getData().getLeadingOfficial());
entity.setLeadingOfficialTelephone(resp.getData().getLeadingOfficialTelephone());
}
} }
return super.infoAfter(id, model, entity, context); return super.infoAfter(id, model, entity, context);
} }
...@@ -94,34 +116,57 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest ...@@ -94,34 +116,57 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
*/ */
@GetMapping(value = "maplist") @GetMapping(value = "maplist")
public Rest<List<SitestatEntity>> maplist() { public Rest<List<SitestatEntity>> maplist() {
JSONObject jsonObject = new JSONObject();
try { try {
SitePdu sitePdu = new SitePdu(); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
sitePdu.setPage(1); SiteQuery siteQuery = new SiteQuery();
sitePdu.setSize(-1); if (!getContext().getUser().isAdmin()) {
if (!getContext().getUser().isAdmin()) { List<Long> siteIdList = StrUtil.split(getContext().getUser().getSiteIds(), ",".charAt(0), -1, true, e -> Long.parseLong(e));
List<Long> siteIdList = StrUtil.split(getContext().getUser().getSiteIds(), ",".charAt(0), -1, true, e -> Long.parseLong(e)); siteQuery.setIdList(siteIdList);
sitePdu.setIdList(siteIdList);
}
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
//根据站点id 获取统计信息
List<SitestatEntity> collect = resp.getData().getData().stream().map(item -> {
SitestatEntity sitestatEntity = this.service.selectOne(new SitestatQuery().siteId(item.getId()));
if (!ObjectUtils.isEmpty(sitestatEntity)) {
sitestatEntity.setSiteId(item.getId());
sitestatEntity.setSiteCode(item.getSiteCode());
sitestatEntity.setSiteName(item.getSiteName());
sitestatEntity.setLng(item.getLongitude());
sitestatEntity.setLat(item.getLatitude());
sitestatEntity.setAddress(item.getDetailAddress());
sitestatEntity.setLeadingOfficial(item.getLeadingOfficial());
sitestatEntity.setLeadingOfficialTelephone(item.getLeadingOfficialTelephone());
return sitestatEntity;
} }
return null;
}).filter(f -> f != null).collect(Collectors.toList()); List<SitestatEntity> collect = siteService.find(siteQuery).stream().map(item -> {
return Rest.ok("获取成功",collect); SitestatEntity sitestatEntity = this.service.selectOne(new SitestatQuery().siteId(item.getId()));
if (!ObjectUtils.isEmpty(sitestatEntity)) {
sitestatEntity.setSiteId(item.getId());
sitestatEntity.setSiteCode(item.getSiteCode());
sitestatEntity.setSiteName(item.getSiteName());
sitestatEntity.setLng(item.getLongitude());
sitestatEntity.setLat(item.getLatitude());
sitestatEntity.setAddress(item.getDetailAddress());
sitestatEntity.setLeadingOfficial(item.getLeadingOfficial());
sitestatEntity.setLeadingOfficialTelephone(item.getLeadingOfficialTelephone());
return sitestatEntity;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
return Rest.ok("获取成功", collect);
} else {
SitePdu sitePdu = new SitePdu();
sitePdu.setPage(1);
sitePdu.setSize(-1);
if (!getContext().getUser().isAdmin()) {
List<Long> siteIdList = StrUtil.split(getContext().getUser().getSiteIds(), ",".charAt(0), -1, true, e -> Long.parseLong(e));
sitePdu.setIdList(siteIdList);
}
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
//根据站点id 获取统计信息
List<SitestatEntity> collect = resp.getData().getData().stream().map(item -> {
SitestatEntity sitestatEntity = this.service.selectOne(new SitestatQuery().siteId(item.getId()));
if (!ObjectUtils.isEmpty(sitestatEntity)) {
sitestatEntity.setSiteId(item.getId());
sitestatEntity.setSiteCode(item.getSiteCode());
sitestatEntity.setSiteName(item.getSiteName());
sitestatEntity.setLng(item.getLongitude());
sitestatEntity.setLat(item.getLatitude());
sitestatEntity.setAddress(item.getDetailAddress());
sitestatEntity.setLeadingOfficial(item.getLeadingOfficial());
sitestatEntity.setLeadingOfficialTelephone(item.getLeadingOfficialTelephone());
return sitestatEntity;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
return Rest.ok("获取成功", collect);
}
} catch (Exception e) { } catch (Exception e) {
log.error("获取异常", e); log.error("获取异常", e);
return Rest.fail("获取异常!"); return Rest.fail("获取异常!");
...@@ -136,15 +181,24 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest ...@@ -136,15 +181,24 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
@GetMapping(value = "siteInfo") @GetMapping(value = "siteInfo")
public String siteInfo(Long siteId) { public String siteInfo(Long siteId) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = this.getModuleDesc() + "获取站点"; String busiDesc = this.getModuleDesc() + "获取站点";
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
try { try {
Rest<SitePdu> resp = siteFeign.info(siteId); if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
if (resp.getCode() == YesNoEnum.YES.getValue()) { SiteEntity siteEntity = siteService.get(siteId, getContext());
jsonObject.put(KEY_RESULT_DATA, resp.getData()); if (!ObjectUtils.isEmpty(siteEntity)) {
jsonObject.put(KEY_RESULT_DATA, siteEntity);
jsonObject.put(KEY_RESULT_MSG, busiDesc + "成功!");
}
} else {
Rest<SitePdu> resp = siteFeign.info(siteId);
if (resp.getCode() == YesNoEnum.YES.getValue()) {
jsonObject.put(KEY_RESULT_DATA, resp.getData());
}
jsonObject.put(KEY_RESULT_MSG, busiDesc + "成功!");
} }
jsonObject.put(KEY_RESULT_MSG, busiDesc + "成功!");
} catch (Exception e) { } catch (Exception e) {
log.error("获取站点异常", e); log.error("获取站点异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
......
platform:
type: standalone
server: server:
port: @profiles.server.port@ port: @profiles.server.port@
servlet: servlet:
...@@ -26,7 +28,7 @@ spring: ...@@ -26,7 +28,7 @@ spring:
host: @profiles.redis.uri@ host: @profiles.redis.uri@
port: @profiles.redis.port@ port: @profiles.redis.port@
username: @profiles.redis.username@ username: @profiles.redis.username@
password: @profiles.redis.password@ # password: @profiles.redis.password@
database: @profiles.redis.database@ database: @profiles.redis.database@
timeout: 30000 timeout: 30000
pool: pool:
...@@ -54,7 +56,10 @@ spring: ...@@ -54,7 +56,10 @@ spring:
port: @profiles.rabbitmq.port@ port: @profiles.rabbitmq.port@
username: @profiles.rabbitmq.username@ username: @profiles.rabbitmq.username@
password: @profiles.rabbitmq.password@ password: @profiles.rabbitmq.password@
exchange-name: @profiles.rabbitmq.exchange@
virtual-host: @profiles.rabbitmq.virtualhost1@ virtual-host: @profiles.rabbitmq.virtualhost1@
publisher-returns: true
publisher-confirm-type: correlated
dao: dao:
exceptiontranslation: exceptiontranslation:
enabled: false enabled: false
...@@ -87,6 +92,10 @@ upload: ...@@ -87,6 +92,10 @@ upload:
#feign: #feign:
# hystrix: # hystrix:
# enabled: false # enabled: false
sms:
smsSendUrl: @profiles.sms.smsSendUrl@
apiId: @profiles.sms.apiId@
type: @profiles.sms.type@
queue: queue:
type: @profiles.queue.type@ # memory or kafka (Apache Kafka) or rabbitmq (RabbitMQ) type: @profiles.queue.type@ # memory or kafka (Apache Kafka) or rabbitmq (RabbitMQ)
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.base.system.area.dao.ibatis.AreaDaoImpl">
<!-- 字段和属性映射 -->
<resultMap type="AreaEntity" id="AreaEntity-Map">
<result property="id" column="id" />
<result property="parentId" column="parentId" />
<result property="name" column="name" />
<result property="level" column="level" />
<result property="code" column="code" />
<result property="contactsPeople" column="contactsPeople" />
<result property="contactsMobile" column="contactsMobile" />
<result property="childSize" column="childSize" />
<result property="maxChildId" column="maxChildId" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="createTime" column="createTime" />
<result property="updateTime" column="updateTime" />
<result property="createUserId" column="createUserId" />
<result property="createUserName" column="createUserName" />
</resultMap>
<!-- 表所有列 -->
<sql id="_columns">
<trim suffixOverrides="," suffix="">
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
a.id as id,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('parentId') or colPickMode == 1 and data.containsKey('parentId')))">
a.parentId as parentId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('name') or colPickMode == 1 and data.containsKey('name')))">
a.name as name,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('level') or colPickMode == 1 and data.containsKey('level')))">
a.level as level,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('code') or colPickMode == 1 and data.containsKey('code')))">
a.code as code,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('contactsPeople') or colPickMode == 1 and data.containsKey('contactsPeople')))">
a.contactsPeople as contactsPeople,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('contactsMobile') or colPickMode == 1 and data.containsKey('contactsMobile')))">
a.contactsMobile as contactsMobile,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('childSize') or colPickMode == 1 and data.containsKey('childSize')))">
a.childSize as childSize,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('maxChildId') or colPickMode == 1 and data.containsKey('maxChildId')))">
a.maxChildId as maxChildId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))">
a.status as status,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
a.remark as remark,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
a.createTime as createTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime as updateTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
a.createUserId as createUserId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserName') or colPickMode == 1 and data.containsKey('createUserName')))">
a.createUserName as createUserName,
</if>
</trim>
</sql>
<!-- 新增 -->
<insert id="insert" parameterType="AreaEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_area
(parentId,name,level,code,contactsPeople,
contactsMobile,childSize,maxChildId,status,remark,
createTime,updateTime,createUserId,createUserName
)VALUES(#{parentId},#{name},#{level},#{code},#{contactsPeople},
#{contactsMobile},#{childSize},#{maxChildId},#{status},#{remark},
#{createTime},#{updateTime},#{createUserId},#{createUserName})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_area
(parentId,name,level,code,contactsPeople,
contactsMobile,childSize,maxChildId,status,remark,
createTime,updateTime,createUserId,createUserName
)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.parentId},#{item.name},#{item.level},#{item.code},#{item.contactsPeople},
#{item.contactsMobile},#{item.childSize},#{item.maxChildId},#{item.status},#{item.remark},
#{item.createTime},#{item.updateTime},#{item.createUserId},#{item.createUserName})
</foreach>
</insert>
<!-- 根据ParamDto更新 -->
<update id="update" parameterType="paramDto">
update mortals_xhx_area as a
set
<trim suffixOverrides="," suffix="">
<if test="(colPickMode==0 and data.containsKey('parentId')) or (colPickMode==1 and !data.containsKey('parentId'))">
a.parentId=#{data.parentId},
</if>
<if test="(colPickMode==0 and data.containsKey('parentIdIncrement')) or (colPickMode==1 and !data.containsKey('parentIdIncrement'))">
a.parentId=ifnull(a.parentId,0) + #{data.parentIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('name')) or (colPickMode==1 and !data.containsKey('name'))">
a.name=#{data.name},
</if>
<if test="(colPickMode==0 and data.containsKey('level')) or (colPickMode==1 and !data.containsKey('level'))">
a.level=#{data.level},
</if>
<if test="(colPickMode==0 and data.containsKey('levelIncrement')) or (colPickMode==1 and !data.containsKey('levelIncrement'))">
a.level=ifnull(a.level,0) + #{data.levelIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('code')) or (colPickMode==1 and !data.containsKey('code'))">
a.code=#{data.code},
</if>
<if test="(colPickMode==0 and data.containsKey('contactsPeople')) or (colPickMode==1 and !data.containsKey('contactsPeople'))">
a.contactsPeople=#{data.contactsPeople},
</if>
<if test="(colPickMode==0 and data.containsKey('contactsMobile')) or (colPickMode==1 and !data.containsKey('contactsMobile'))">
a.contactsMobile=#{data.contactsMobile},
</if>
<if test="(colPickMode==0 and data.containsKey('childSize')) or (colPickMode==1 and !data.containsKey('childSize'))">
a.childSize=#{data.childSize},
</if>
<if test="(colPickMode==0 and data.containsKey('childSizeIncrement')) or (colPickMode==1 and !data.containsKey('childSizeIncrement'))">
a.childSize=ifnull(a.childSize,0) + #{data.childSizeIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('maxChildId')) or (colPickMode==1 and !data.containsKey('maxChildId'))">
a.maxChildId=#{data.maxChildId},
</if>
<if test="(colPickMode==0 and data.containsKey('maxChildIdIncrement')) or (colPickMode==1 and !data.containsKey('maxChildIdIncrement'))">
a.maxChildId=ifnull(a.maxChildId,0) + #{data.maxChildIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))">
a.status=#{data.status},
</if>
<if test="(colPickMode==0 and data.containsKey('statusIncrement')) or (colPickMode==1 and !data.containsKey('statusIncrement'))">
a.status=ifnull(a.status,0) + #{data.statusIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
a.remark=#{data.remark},
</if>
<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
a.createTime=#{data.createTime},
</if>
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
a.createUserId=#{data.createUserId},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserName')) or (colPickMode==1 and !data.containsKey('createUserName'))">
a.createUserName=#{data.createUserName},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</update>
<!-- 根据主健查询 -->
<select id="getByKey" parameterType="paramDto" resultMap="AreaEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_area as a
where a.id=#{condition.id}
</select>
<!-- 根据主健删除 -->
<delete id="deleteByKey" parameterType="paramDto">
delete a.* from mortals_xhx_area as a where a.id=#{condition.id}
</delete>
<!-- 根据主健删除一批,针对单一主健有效 -->
<delete id="deleteByKeys">
delete from mortals_xhx_area where id in
<foreach collection="array" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据paramDto删除一批 -->
<delete id="deleteByMap" parameterType="paramDto">
delete a.* from mortals_xhx_area as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</delete>
<!-- 获取列表 -->
<select id="getList" parameterType="paramDto" resultMap="AreaEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_area as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int">
select count(1)
from mortals_xhx_area as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</select>
<!-- 条件映射 -->
<sql id="_condition_">
<if test="condition != null and !condition.isEmpty()">
<if test="condition.containsKey('id')">
<if test="condition.id != null">
and a.id=#{condition.id}
</if>
</if>
<if test="condition.containsKey('id')">
<if test="condition.id != null ">
and a.id = #{condition.id}
</if>
<if test="condition.id == null">
and a.id is null
</if>
</if>
<if test="condition.containsKey('idList')">
and a.id in
<foreach collection="condition.idList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('idStart') and condition.idStart != null">
<![CDATA[ and a.id >= #{condition.idStart} ]]>
</if>
<if test="condition.containsKey('idEnd') and condition.idEnd != null">
<![CDATA[ and a.id <= #{condition.idEnd} ]]>
</if>
<if test="condition.containsKey('parentId')">
<if test="condition.parentId != null ">
and a.parentId = #{condition.parentId}
</if>
<if test="condition.parentId == null">
and a.parentId is null
</if>
</if>
<if test="condition.containsKey('parentIdList')">
and a.parentId in
<foreach collection="condition.parentIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('parentIdStart') and condition.parentIdStart != null">
<![CDATA[ and a.parentId >= #{condition.parentIdStart} ]]>
</if>
<if test="condition.containsKey('parentIdEnd') and condition.parentIdEnd != null">
<![CDATA[ and a.parentId <= #{condition.parentIdEnd} ]]>
</if>
<if test="condition.containsKey('name')">
<if test="condition.name != null and condition.name != ''">
and a.name like #{condition.name}
</if>
<if test="condition.name == null">
and a.name is null
</if>
</if>
<if test="condition.containsKey('nameList')">
and a.name in
<foreach collection="condition.nameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('level')">
<if test="condition.level != null ">
and a.level = #{condition.level}
</if>
<if test="condition.level == null">
and a.level is null
</if>
</if>
<if test="condition.containsKey('levelList')">
and a.level in
<foreach collection="condition.levelList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('levelStart') and condition.levelStart != null">
<![CDATA[ and a.level >= #{condition.levelStart} ]]>
</if>
<if test="condition.containsKey('levelEnd') and condition.levelEnd != null">
<![CDATA[ and a.level <= #{condition.levelEnd} ]]>
</if>
<if test="condition.containsKey('code')">
<if test="condition.code != null and condition.code != ''">
and a.code like #{condition.code}
</if>
<if test="condition.code == null">
and a.code is null
</if>
</if>
<if test="condition.containsKey('codeList')">
and a.code in
<foreach collection="condition.codeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('contactsPeople')">
<if test="condition.contactsPeople != null and condition.contactsPeople != ''">
and a.contactsPeople like #{condition.contactsPeople}
</if>
<if test="condition.contactsPeople == null">
and a.contactsPeople is null
</if>
</if>
<if test="condition.containsKey('contactsPeopleList')">
and a.contactsPeople in
<foreach collection="condition.contactsPeopleList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('contactsMobile')">
<if test="condition.contactsMobile != null and condition.contactsMobile != ''">
and a.contactsMobile like #{condition.contactsMobile}
</if>
<if test="condition.contactsMobile == null">
and a.contactsMobile is null
</if>
</if>
<if test="condition.containsKey('contactsMobileList')">
and a.contactsMobile in
<foreach collection="condition.contactsMobileList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('childSize')">
<if test="condition.childSize != null ">
and a.childSize = #{condition.childSize}
</if>
<if test="condition.childSize == null">
and a.childSize is null
</if>
</if>
<if test="condition.containsKey('childSizeList')">
and a.childSize in
<foreach collection="condition.childSizeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('childSizeStart') and condition.childSizeStart != null">
<![CDATA[ and a.childSize >= #{condition.childSizeStart} ]]>
</if>
<if test="condition.containsKey('childSizeEnd') and condition.childSizeEnd != null">
<![CDATA[ and a.childSize <= #{condition.childSizeEnd} ]]>
</if>
<if test="condition.containsKey('maxChildId')">
<if test="condition.maxChildId != null ">
and a.maxChildId = #{condition.maxChildId}
</if>
<if test="condition.maxChildId == null">
and a.maxChildId is null
</if>
</if>
<if test="condition.containsKey('maxChildIdList')">
and a.maxChildId in
<foreach collection="condition.maxChildIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('maxChildIdStart') and condition.maxChildIdStart != null">
<![CDATA[ and a.maxChildId >= #{condition.maxChildIdStart} ]]>
</if>
<if test="condition.containsKey('maxChildIdEnd') and condition.maxChildIdEnd != null">
<![CDATA[ and a.maxChildId <= #{condition.maxChildIdEnd} ]]>
</if>
<if test="condition.containsKey('status')">
<if test="condition.status != null ">
and a.status = #{condition.status}
</if>
<if test="condition.status == null">
and a.status is null
</if>
</if>
<if test="condition.containsKey('statusList')">
and a.status in
<foreach collection="condition.statusList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('statusStart') and condition.statusStart != null">
<![CDATA[ and a.status >= #{condition.statusStart} ]]>
</if>
<if test="condition.containsKey('statusEnd') and condition.statusEnd != null">
<![CDATA[ and a.status <= #{condition.statusEnd} ]]>
</if>
<if test="condition.containsKey('remark')">
<if test="condition.remark != null and condition.remark != ''">
and a.remark like #{condition.remark}
</if>
<if test="condition.remark == null">
and a.remark is null
</if>
</if>
<if test="condition.containsKey('remarkList')">
and a.remark in
<foreach collection="condition.remarkList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('createTime')">
<if test="condition.createTime != null ">
and a.createTime = #{condition.createTime}
</if>
<if test="condition.createTime == null">
and a.createTime is null
</if>
</if>
<if test="condition.containsKey('createTimeStart') and condition.createTimeStart != null and condition.createTimeStart!=''">
<![CDATA[ and a.createTime >= STR_TO_DATE(left(concat(#{condition.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') ]]>
</if>
<if test="condition.containsKey('createTimeEnd') and condition.createTimeEnd != null and condition.createTimeEnd!=''">
<![CDATA[ and a.createTime <= STR_TO_DATE(left(concat(#{condition.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ]]>
</if>
<if test="condition.containsKey('updateTime')">
<if test="condition.updateTime != null ">
and a.updateTime = #{condition.updateTime}
</if>
<if test="condition.updateTime == null">
and a.updateTime is null
</if>
</if>
<if test="condition.containsKey('updateTimeStart') and condition.updateTimeStart != null and condition.updateTimeStart!=''">
<![CDATA[ and a.updateTime >= STR_TO_DATE(left(concat(#{condition.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') ]]>
</if>
<if test="condition.containsKey('updateTimeEnd') and condition.updateTimeEnd != null and condition.updateTimeEnd!=''">
<![CDATA[ and a.updateTime <= STR_TO_DATE(left(concat(#{condition.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ]]>
</if>
<if test="condition.containsKey('createUserId')">
<if test="condition.createUserId != null ">
and a.createUserId = #{condition.createUserId}
</if>
<if test="condition.createUserId == null">
and a.createUserId is null
</if>
</if>
<if test="condition.containsKey('createUserIdList')">
and a.createUserId in
<foreach collection="condition.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="condition.containsKey('createUserIdStart') and condition.createUserIdStart != null">
<![CDATA[ and a.createUserId >= #{condition.createUserIdStart} ]]>
</if>
<if test="condition.containsKey('createUserIdEnd') and condition.createUserIdEnd != null">
<![CDATA[ and a.createUserId <= #{condition.createUserIdEnd} ]]>
</if>
<if test="condition.containsKey('createUserName')">
<if test="condition.createUserName != null and condition.createUserName != ''">
and a.createUserName like #{condition.createUserName}
</if>
<if test="condition.createUserName == null">
and a.createUserName is null
</if>
</if>
<if test="condition.containsKey('createUserNameList')">
and a.createUserName in
<foreach collection="condition.createUserNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
order by
<trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
${item.colName} ${item.sortKind}
</foreach>
</trim>
</if>
<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
order by
<trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')">
a.id
<if test="orderCol.id!= null">
${orderCol.id}
</if>
,
</if>
<if test="orderCol.containsKey('parentId')">
a.parentId
<if test="orderCol.parentId!= null">
${orderCol.parentId}
</if>
,
</if>
<if test="orderCol.containsKey('name')">
a.name
<if test="orderCol.name!= null">
${orderCol.name}
</if>
,
</if>
<if test="orderCol.containsKey('level')">
a.level
<if test="orderCol.level!= null">
${orderCol.level}
</if>
,
</if>
<if test="orderCol.containsKey('code')">
a.code
<if test="orderCol.code!= null">
${orderCol.code}
</if>
,
</if>
<if test="orderCol.containsKey('contactsPeople')">
a.contactsPeople
<if test="orderCol.contactsPeople!= null">
${orderCol.contactsPeople}
</if>
,
</if>
<if test="orderCol.containsKey('contactsMobile')">
a.contactsMobile
<if test="orderCol.contactsMobile!= null">
${orderCol.contactsMobile}
</if>
,
</if>
<if test="orderCol.containsKey('childSize')">
a.childSize
<if test="orderCol.childSize!= null">
${orderCol.childSize}
</if>
,
</if>
<if test="orderCol.containsKey('maxChildId')">
a.maxChildId
<if test="orderCol.maxChildId!= null">
${orderCol.maxChildId}
</if>
,
</if>
<if test="orderCol.containsKey('status')">
a.status
<if test="orderCol.status!= null">
${orderCol.status}
</if>
,
</if>
<if test="orderCol.containsKey('remark')">
a.remark
<if test="orderCol.remark!= null">
${orderCol.remark}
</if>
,
</if>
<if test="orderCol.containsKey('createTime')">
a.createTime
<if test="orderCol.createTime!= null">
${orderCol.createTime}
</if>
,
</if>
<if test="orderCol.containsKey('updateTime')">
a.updateTime
<if test="orderCol.updateTime!= null">
${orderCol.updateTime}
</if>
,
</if>
<if test="orderCol.containsKey('createUserId')">
a.createUserId
<if test="orderCol.createUserId!= null">
${orderCol.createUserId}
</if>
,
</if>
<if test="orderCol.containsKey('createUserName')">
a.createUserName
<if test="orderCol.createUserName!= null">
${orderCol.createUserName}
</if>
,
</if>
</trim>
</if>
</sql>
<sql id="_group_by_">
<if test="groupList != null and !groupList.isEmpty()">
GROUP BY
<trim suffixOverrides="," suffix="">
<foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
${item}
</foreach>
</trim>
</if>
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd"> "mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.base.system.site.dao.ibatis.SiteDaoImpl"> <mapper namespace="com.mortals.xhx.module.area.dao.ibatis.AreaDaoImpl">
<!-- 字段和属性映射 --> <!-- 字段和属性映射 -->
<resultMap type="SiteEntity" id="SiteEntity-Map"> <resultMap type="AreaEntity" id="AreaEntity-Map">
<result property="id" column="id" /> <id property="id" column="id" />
<result property="siteName" column="siteName" /> <result property="ancestors" column="ancestors" />
<result property="parentId" column="parentId" /> <result property="name" column="name" />
<result property="ancestors" column="ancestors" /> <result property="iid" column="iid" />
<result property="address" column="address" /> <result property="pid" column="pid" />
<result property="mobile" column="mobile" /> <result property="haveSonArea" column="haveSonArea" />
<result property="introduce" column="introduce" /> <result property="haveSonDept" column="haveSonDept" />
<result property="workday1" column="workday1" /> <result property="haveGetDept" column="haveGetDept" />
<result property="workday2" column="workday2" /> <result property="haveGetMatterList" column="haveGetMatterList" />
<result property="workday3" column="workday3" /> <result property="areaCode" column="areaCode" />
<result property="workday4" column="workday4" /> <result property="areaLevel" column="areaLevel" />
<result property="workday5" column="workday5" /> <result property="shortName" column="shortName" />
<result property="workday6" column="workday6" /> <result property="domain" column="domain" />
<result property="workday7" column="workday7" /> <result property="status" column="status" />
<result property="number" column="number" /> <result property="createTime" column="createTime" />
<result property="summary" column="summary" /> <result property="createUserId" column="createUserId" />
<result property="orderNum" column="orderNum" /> <result property="updateTime" column="updateTime" />
<result property="status" column="status" />
<result property="updateTime" column="updateTime" />
<result property="updateUser" column="updateUser" />
<result property="createTime" column="createTime" />
<result property="createUser" column="createUser" />
</resultMap> </resultMap>
<!-- 表所有列 --> <!-- 表所有列 -->
<sql id="_columns"> <sql id="_columns">
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
a.id as id, a.id as id,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteName') or colPickMode == 1 and data.containsKey('siteName')))">
a.siteName as siteName,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('parentId') or colPickMode == 1 and data.containsKey('parentId')))">
a.parentId as parentId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('ancestors') or colPickMode == 1 and data.containsKey('ancestors')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('ancestors') or colPickMode == 1 and data.containsKey('ancestors')))">
a.ancestors as ancestors, a.ancestors as ancestors,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('address') or colPickMode == 1 and data.containsKey('address')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('name') or colPickMode == 1 and data.containsKey('name')))">
a.address as address, a.name as name,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('mobile') or colPickMode == 1 and data.containsKey('mobile')))">
a.mobile as mobile,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('introduce') or colPickMode == 1 and data.containsKey('introduce')))">
a.introduce as introduce,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday1') or colPickMode == 1 and data.containsKey('workday1')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('iid') or colPickMode == 1 and data.containsKey('iid')))">
a.workday1 as workday1, a.iid as iid,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday2') or colPickMode == 1 and data.containsKey('workday2')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('pid') or colPickMode == 1 and data.containsKey('pid')))">
a.workday2 as workday2, a.pid as pid,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday3') or colPickMode == 1 and data.containsKey('workday3')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('haveSonArea') or colPickMode == 1 and data.containsKey('haveSonArea')))">
a.workday3 as workday3, a.haveSonArea as haveSonArea,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday4') or colPickMode == 1 and data.containsKey('workday4')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('haveSonDept') or colPickMode == 1 and data.containsKey('haveSonDept')))">
a.workday4 as workday4, a.haveSonDept as haveSonDept,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday5') or colPickMode == 1 and data.containsKey('workday5')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('haveGetDept') or colPickMode == 1 and data.containsKey('haveGetDept')))">
a.workday5 as workday5, a.haveGetDept as haveGetDept,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday6') or colPickMode == 1 and data.containsKey('workday6')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('haveGetMatterList') or colPickMode == 1 and data.containsKey('haveGetMatterList')))">
a.workday6 as workday6, a.haveGetMatterList as haveGetMatterList,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday7') or colPickMode == 1 and data.containsKey('workday7')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('areaCode') or colPickMode == 1 and data.containsKey('areaCode')))">
a.workday7 as workday7, a.areaCode as areaCode,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('number') or colPickMode == 1 and data.containsKey('number')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('areaLevel') or colPickMode == 1 and data.containsKey('areaLevel')))">
a.number as number, a.areaLevel as areaLevel,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('summary') or colPickMode == 1 and data.containsKey('summary')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('shortName') or colPickMode == 1 and data.containsKey('shortName')))">
a.summary as summary, a.shortName as shortName,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('orderNum') or colPickMode == 1 and data.containsKey('orderNum')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('domain') or colPickMode == 1 and data.containsKey('domain')))">
a.orderNum as orderNum, a.domain as domain,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))">
a.status as status, a.status as status,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime as updateTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUser') or colPickMode == 1 and data.containsKey('updateUser')))">
a.updateUser as updateUser,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
a.createTime as createTime, a.createTime as createTime,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUser') or colPickMode == 1 and data.containsKey('createUser')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
a.createUser as createUser, a.createUserId as createUserId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime as updateTime,
</if> </if>
</trim> </trim>
</sql> </sql>
<!-- 新增 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="SiteEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="AreaEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_site insert into mortals_sys_area
(siteName,parentId,ancestors,address,mobile,introduce,workday1,workday2,workday3,workday4,workday5,workday6,workday7,number,summary,orderNum,status,updateTime,updateUser,createTime,createUser) (ancestors,name,iid,pid,haveSonArea,haveSonDept,haveGetDept,haveGetMatterList,areaCode,areaLevel,shortName,domain,status,createTime,createUserId,updateTime)
VALUES VALUES
(#{siteName},#{parentId},#{ancestors},#{address},#{mobile},#{introduce},#{workday1},#{workday2},#{workday3},#{workday4},#{workday5},#{workday6},#{workday7},#{number},#{summary},#{orderNum},#{status},#{updateTime},#{updateUser},#{createTime},#{createUser}) (#{ancestors},#{name},#{iid},#{pid},#{haveSonArea},#{haveSonDept},#{haveGetDept},#{haveGetMatterList},#{areaCode},#{areaLevel},#{shortName},#{domain},#{status},#{createTime},#{createUserId},#{updateTime})
</insert> </insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_sys_area
(ancestors,name,iid,pid,haveSonArea,haveSonDept,haveGetDept,haveGetMatterList,areaCode,areaLevel,shortName,domain,status,createTime,createUserId,updateTime)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.ancestors},#{item.name},#{item.iid},#{item.pid},#{item.haveSonArea},#{item.haveSonDept},#{item.haveGetDept},#{item.haveGetMatterList},#{item.areaCode},#{item.areaLevel},#{item.shortName},#{item.domain},#{item.status},#{item.createTime},#{item.createUserId},#{item.updateTime})
</foreach>
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_site
(siteName,parentId,ancestors,address,mobile,introduce,workday1,workday2,workday3,workday4,workday5,workday6,workday7,number,summary,orderNum,status,updateTime,updateUser,createTime,createUser)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.siteName},#{item.parentId},#{item.ancestors},#{item.address},#{item.mobile},#{item.introduce},#{item.workday1},#{item.workday2},#{item.workday3},#{item.workday4},#{item.workday5},#{item.workday6},#{item.workday7},#{item.number},#{item.summary},#{item.orderNum},#{item.status},#{item.updateTime},#{item.updateUser},#{item.createTime},#{item.createUser})
</foreach>
</insert>
<!-- 根据ParamDto更新 --> <!-- 根据ParamDto更新 -->
<update id="update" parameterType="paramDto"> <update id="update" parameterType="paramDto">
update mortals_xhx_site as a update mortals_sys_area as a
set set
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
<if test="(colPickMode==0 and data.containsKey('siteName')) or (colPickMode==1 and !data.containsKey('siteName'))">
a.siteName=#{data.siteName},
</if>
<if test="(colPickMode==0 and data.containsKey('parentId')) or (colPickMode==1 and !data.containsKey('parentId'))">
a.parentId=#{data.parentId},
</if>
<if test="(colPickMode==0 and data.containsKey('parentIdIncrement')) or (colPickMode==1 and !data.containsKey('parentIdIncrement'))">
a.parentId=ifnull(a.parentId,0) + #{data.parentIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('ancestors')) or (colPickMode==1 and !data.containsKey('ancestors'))"> <if test="(colPickMode==0 and data.containsKey('ancestors')) or (colPickMode==1 and !data.containsKey('ancestors'))">
a.ancestors=#{data.ancestors}, a.ancestors=#{data.ancestors},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('address')) or (colPickMode==1 and !data.containsKey('address'))"> <if test="(colPickMode==0 and data.containsKey('name')) or (colPickMode==1 and !data.containsKey('name'))">
a.address=#{data.address}, a.name=#{data.name},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('mobile')) or (colPickMode==1 and !data.containsKey('mobile'))"> <if test="(colPickMode==0 and data.containsKey('iid')) or (colPickMode==1 and !data.containsKey('iid'))">
a.mobile=#{data.mobile}, a.iid=#{data.iid},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('introduce')) or (colPickMode==1 and !data.containsKey('introduce'))"> <if test="(colPickMode==0 and data.containsKey('pid')) or (colPickMode==1 and !data.containsKey('pid'))">
a.introduce=#{data.introduce}, a.pid=#{data.pid},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday1')) or (colPickMode==1 and !data.containsKey('workday1'))"> <if test="(colPickMode==0 and data.containsKey('haveSonArea')) or (colPickMode==1 and !data.containsKey('haveSonArea'))">
a.workday1=#{data.workday1}, a.haveSonArea=#{data.haveSonArea},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday1Increment')) or (colPickMode==1 and !data.containsKey('workday1Increment'))"> <if test="(colPickMode==0 and data.containsKey('haveSonDept')) or (colPickMode==1 and !data.containsKey('haveSonDept'))">
a.workday1=ifnull(a.workday1,0) + #{data.workday1Increment}, a.haveSonDept=#{data.haveSonDept},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday2')) or (colPickMode==1 and !data.containsKey('workday2'))"> <if test="(colPickMode==0 and data.containsKey('haveGetDept')) or (colPickMode==1 and !data.containsKey('haveGetDept'))">
a.workday2=#{data.workday2}, a.haveGetDept=#{data.haveGetDept},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday2Increment')) or (colPickMode==1 and !data.containsKey('workday2Increment'))"> <if test="(colPickMode==0 and data.containsKey('haveGetMatterList')) or (colPickMode==1 and !data.containsKey('haveGetMatterList'))">
a.workday2=ifnull(a.workday2,0) + #{data.workday2Increment}, a.haveGetMatterList=#{data.haveGetMatterList},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday3')) or (colPickMode==1 and !data.containsKey('workday3'))"> <if test="(colPickMode==0 and data.containsKey('areaCode')) or (colPickMode==1 and !data.containsKey('areaCode'))">
a.workday3=#{data.workday3}, a.areaCode=#{data.areaCode},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday3Increment')) or (colPickMode==1 and !data.containsKey('workday3Increment'))"> <if test="(colPickMode==0 and data.containsKey('areaLevel')) or (colPickMode==1 and !data.containsKey('areaLevel'))">
a.workday3=ifnull(a.workday3,0) + #{data.workday3Increment}, a.areaLevel=#{data.areaLevel},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday4')) or (colPickMode==1 and !data.containsKey('workday4'))"> <if test="(colPickMode==0 and data.containsKey('areaLevelIncrement')) or (colPickMode==1 and !data.containsKey('areaLevelIncrement'))">
a.workday4=#{data.workday4}, a.areaLevel=ifnull(a.areaLevel,0) + #{data.areaLevelIncrement},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday4Increment')) or (colPickMode==1 and !data.containsKey('workday4Increment'))"> <if test="(colPickMode==0 and data.containsKey('shortName')) or (colPickMode==1 and !data.containsKey('shortName'))">
a.workday4=ifnull(a.workday4,0) + #{data.workday4Increment}, a.shortName=#{data.shortName},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('workday5')) or (colPickMode==1 and !data.containsKey('workday5'))"> <if test="(colPickMode==0 and data.containsKey('domain')) or (colPickMode==1 and !data.containsKey('domain'))">
a.workday5=#{data.workday5}, a.domain=#{data.domain},
</if>
<if test="(colPickMode==0 and data.containsKey('workday5Increment')) or (colPickMode==1 and !data.containsKey('workday5Increment'))">
a.workday5=ifnull(a.workday5,0) + #{data.workday5Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('workday6')) or (colPickMode==1 and !data.containsKey('workday6'))">
a.workday6=#{data.workday6},
</if>
<if test="(colPickMode==0 and data.containsKey('workday6Increment')) or (colPickMode==1 and !data.containsKey('workday6Increment'))">
a.workday6=ifnull(a.workday6,0) + #{data.workday6Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('workday7')) or (colPickMode==1 and !data.containsKey('workday7'))">
a.workday7=#{data.workday7},
</if>
<if test="(colPickMode==0 and data.containsKey('workday7Increment')) or (colPickMode==1 and !data.containsKey('workday7Increment'))">
a.workday7=ifnull(a.workday7,0) + #{data.workday7Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('number')) or (colPickMode==1 and !data.containsKey('number'))">
a.number=#{data.number},
</if>
<if test="(colPickMode==0 and data.containsKey('summary')) or (colPickMode==1 and !data.containsKey('summary'))">
a.summary=#{data.summary},
</if>
<if test="(colPickMode==0 and data.containsKey('orderNum')) or (colPickMode==1 and !data.containsKey('orderNum'))">
a.orderNum=#{data.orderNum},
</if>
<if test="(colPickMode==0 and data.containsKey('orderNumIncrement')) or (colPickMode==1 and !data.containsKey('orderNumIncrement'))">
a.orderNum=ifnull(a.orderNum,0) + #{data.orderNumIncrement},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))"> <if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))">
a.status=#{data.status}, a.status=#{data.status},
...@@ -203,17 +151,17 @@ ...@@ -203,17 +151,17 @@
<if test="(colPickMode==0 and data.containsKey('statusIncrement')) or (colPickMode==1 and !data.containsKey('statusIncrement'))"> <if test="(colPickMode==0 and data.containsKey('statusIncrement')) or (colPickMode==1 and !data.containsKey('statusIncrement'))">
a.status=ifnull(a.status,0) + #{data.statusIncrement}, a.status=ifnull(a.status,0) + #{data.statusIncrement},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
<if test="(colPickMode==0 and data.containsKey('updateUser')) or (colPickMode==1 and !data.containsKey('updateUser'))">
a.updateUser=#{data.updateUser},
</if>
<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))"> <if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
a.createTime=#{data.createTime}, a.createTime=#{data.createTime},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('createUser')) or (colPickMode==1 and !data.containsKey('createUser'))"> <if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
a.createUser=#{data.createUser}, a.createUserId=#{data.createUserId},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if> </if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
...@@ -225,183 +173,97 @@ ...@@ -225,183 +173,97 @@
</update> </update>
<!-- 批量更新 --> <!-- 批量更新 -->
<update id="updateBatch" parameterType="paramDto"> <update id="updateBatch" parameterType="paramDto">
update mortals_xhx_site as a update mortals_sys_area as a
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="ancestors=(case" suffix="ELSE ancestors end),">
<trim prefix="siteName=(case" suffix="ELSE siteName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('siteName')) or (colPickMode==1 and !item.containsKey('siteName'))"> <if test="(colPickMode==0 and item.containsKey('ancestors')) or (colPickMode==1 and !item.containsKey('ancestors'))">
when a.id=#{item.id} then #{item.siteName} when a.id=#{item.id} then #{item.ancestors}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="name=(case" suffix="ELSE name end),">
<trim prefix="parentId=(case" suffix="ELSE parentId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('parentId')) or (colPickMode==1 and !item.containsKey('parentId'))">
when a.id=#{item.id} then #{item.parentId}
</when>
<when test="(colPickMode==0 and item.containsKey('parentIdIncrement')) or (colPickMode==1 and !item.containsKey('parentIdIncrement'))">
when a.id=#{item.id} then ifnull(a.parentId,0) + #{item.parentIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="ancestors=(case" suffix="ELSE ancestors end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('ancestors')) or (colPickMode==1 and !item.containsKey('ancestors'))"> <if test="(colPickMode==0 and item.containsKey('name')) or (colPickMode==1 and !item.containsKey('name'))">
when a.id=#{item.id} then #{item.ancestors} when a.id=#{item.id} then #{item.name}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="iid=(case" suffix="ELSE iid end),">
<trim prefix="address=(case" suffix="ELSE address end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('address')) or (colPickMode==1 and !item.containsKey('address'))"> <if test="(colPickMode==0 and item.containsKey('iid')) or (colPickMode==1 and !item.containsKey('iid'))">
when a.id=#{item.id} then #{item.address} when a.id=#{item.id} then #{item.iid}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="pid=(case" suffix="ELSE pid end),">
<trim prefix="mobile=(case" suffix="ELSE mobile end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('mobile')) or (colPickMode==1 and !item.containsKey('mobile'))"> <if test="(colPickMode==0 and item.containsKey('pid')) or (colPickMode==1 and !item.containsKey('pid'))">
when a.id=#{item.id} then #{item.mobile} when a.id=#{item.id} then #{item.pid}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="haveSonArea=(case" suffix="ELSE haveSonArea end),">
<trim prefix="introduce=(case" suffix="ELSE introduce end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('introduce')) or (colPickMode==1 and !item.containsKey('introduce'))"> <if test="(colPickMode==0 and item.containsKey('haveSonArea')) or (colPickMode==1 and !item.containsKey('haveSonArea'))">
when a.id=#{item.id} then #{item.introduce} when a.id=#{item.id} then #{item.haveSonArea}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="haveSonDept=(case" suffix="ELSE haveSonDept end),">
<trim prefix="workday1=(case" suffix="ELSE workday1 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday1')) or (colPickMode==1 and !item.containsKey('workday1'))">
when a.id=#{item.id} then #{item.workday1}
</when>
<when test="(colPickMode==0 and item.containsKey('workday1Increment')) or (colPickMode==1 and !item.containsKey('workday1Increment'))">
when a.id=#{item.id} then ifnull(a.workday1,0) + #{item.workday1Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday2=(case" suffix="ELSE workday2 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday2')) or (colPickMode==1 and !item.containsKey('workday2'))">
when a.id=#{item.id} then #{item.workday2}
</when>
<when test="(colPickMode==0 and item.containsKey('workday2Increment')) or (colPickMode==1 and !item.containsKey('workday2Increment'))">
when a.id=#{item.id} then ifnull(a.workday2,0) + #{item.workday2Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday3=(case" suffix="ELSE workday3 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday3')) or (colPickMode==1 and !item.containsKey('workday3'))">
when a.id=#{item.id} then #{item.workday3}
</when>
<when test="(colPickMode==0 and item.containsKey('workday3Increment')) or (colPickMode==1 and !item.containsKey('workday3Increment'))">
when a.id=#{item.id} then ifnull(a.workday3,0) + #{item.workday3Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday4=(case" suffix="ELSE workday4 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday4')) or (colPickMode==1 and !item.containsKey('workday4'))">
when a.id=#{item.id} then #{item.workday4}
</when>
<when test="(colPickMode==0 and item.containsKey('workday4Increment')) or (colPickMode==1 and !item.containsKey('workday4Increment'))">
when a.id=#{item.id} then ifnull(a.workday4,0) + #{item.workday4Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday5=(case" suffix="ELSE workday5 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday5')) or (colPickMode==1 and !item.containsKey('workday5'))">
when a.id=#{item.id} then #{item.workday5}
</when>
<when test="(colPickMode==0 and item.containsKey('workday5Increment')) or (colPickMode==1 and !item.containsKey('workday5Increment'))">
when a.id=#{item.id} then ifnull(a.workday5,0) + #{item.workday5Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday6=(case" suffix="ELSE workday6 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday6')) or (colPickMode==1 and !item.containsKey('workday6'))">
when a.id=#{item.id} then #{item.workday6}
</when>
<when test="(colPickMode==0 and item.containsKey('workday6Increment')) or (colPickMode==1 and !item.containsKey('workday6Increment'))">
when a.id=#{item.id} then ifnull(a.workday6,0) + #{item.workday6Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday7=(case" suffix="ELSE workday7 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday7')) or (colPickMode==1 and !item.containsKey('workday7'))">
when a.id=#{item.id} then #{item.workday7}
</when>
<when test="(colPickMode==0 and item.containsKey('workday7Increment')) or (colPickMode==1 and !item.containsKey('workday7Increment'))">
when a.id=#{item.id} then ifnull(a.workday7,0) + #{item.workday7Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="number=(case" suffix="ELSE number end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('number')) or (colPickMode==1 and !item.containsKey('number'))"> <if test="(colPickMode==0 and item.containsKey('haveSonDept')) or (colPickMode==1 and !item.containsKey('haveSonDept'))">
when a.id=#{item.id} then #{item.number} when a.id=#{item.id} then #{item.haveSonDept}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="haveGetDept=(case" suffix="ELSE haveGetDept end),">
<trim prefix="summary=(case" suffix="ELSE summary end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('summary')) or (colPickMode==1 and !item.containsKey('summary'))"> <if test="(colPickMode==0 and item.containsKey('haveGetDept')) or (colPickMode==1 and !item.containsKey('haveGetDept'))">
when a.id=#{item.id} then #{item.summary} when a.id=#{item.id} then #{item.haveGetDept}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="haveGetMatterList=(case" suffix="ELSE haveGetMatterList end),">
<trim prefix="orderNum=(case" suffix="ELSE orderNum end),"> <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('haveGetMatterList')) or (colPickMode==1 and !item.containsKey('haveGetMatterList'))">
when a.id=#{item.id} then #{item.haveGetMatterList}
</if>
</foreach>
</trim>
<trim prefix="areaCode=(case" suffix="ELSE areaCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('areaCode')) or (colPickMode==1 and !item.containsKey('areaCode'))">
when a.id=#{item.id} then #{item.areaCode}
</if>
</foreach>
</trim>
<trim prefix="areaLevel=(case" suffix="ELSE areaLevel end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<choose> <choose>
<when test="(colPickMode==0 and item.containsKey('orderNum')) or (colPickMode==1 and !item.containsKey('orderNum'))"> <when test="(colPickMode==0 and item.containsKey('areaLevel')) or (colPickMode==1 and !item.containsKey('areaLevel'))">
when a.id=#{item.id} then #{item.orderNum} when a.id=#{item.id} then #{item.areaLevel}
</when> </when>
<when test="(colPickMode==0 and item.containsKey('orderNumIncrement')) or (colPickMode==1 and !item.containsKey('orderNumIncrement'))"> <when test="(colPickMode==0 and item.containsKey('areaLevelIncrement')) or (colPickMode==1 and !item.containsKey('areaLevelIncrement'))">
when a.id=#{item.id} then ifnull(a.orderNum,0) + #{item.orderNumIncrement} when a.id=#{item.id} then ifnull(a.areaLevel,0) + #{item.areaLevelIncrement}
</when> </when>
</choose> </choose>
</foreach> </foreach>
</trim> </trim>
<trim prefix="shortName=(case" suffix="ELSE shortName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('shortName')) or (colPickMode==1 and !item.containsKey('shortName'))">
when a.id=#{item.id} then #{item.shortName}
</if>
</foreach>
</trim>
<trim prefix="domain=(case" suffix="ELSE domain end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('domain')) or (colPickMode==1 and !item.containsKey('domain'))">
when a.id=#{item.id} then #{item.domain}
</if>
</foreach>
</trim>
<trim prefix="status=(case" suffix="ELSE status end),"> <trim prefix="status=(case" suffix="ELSE status end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<choose> <choose>
...@@ -414,23 +276,6 @@ ...@@ -414,23 +276,6 @@
</choose> </choose>
</foreach> </foreach>
</trim> </trim>
<trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
when a.id=#{item.id} then #{item.updateTime}
</if>
</foreach>
</trim>
<trim prefix="updateUser=(case" suffix="ELSE updateUser end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('updateUser')) or (colPickMode==1 and !item.containsKey('updateUser'))">
when a.id=#{item.id} then #{item.updateUser}
</if>
</foreach>
</trim>
<trim prefix="createTime=(case" suffix="ELSE createTime end),"> <trim prefix="createTime=(case" suffix="ELSE createTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))"> <if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
...@@ -438,11 +283,22 @@ ...@@ -438,11 +283,22 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="createUserId=(case" suffix="ELSE createUserId end),">
<trim prefix="createUser=(case" suffix="ELSE createUser end),"> <foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('createUserId')) or (colPickMode==1 and !item.containsKey('createUserId'))">
when a.id=#{item.id} then #{item.createUserId}
</when>
<when test="(colPickMode==0 and item.containsKey('createUserIdIncrement')) or (colPickMode==1 and !item.containsKey('createUserIdIncrement'))">
when a.id=#{item.id} then ifnull(a.createUserId,0) + #{item.createUserIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('createUser')) or (colPickMode==1 and !item.containsKey('createUser'))"> <if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
when a.id=#{item.id} then #{item.createUser} when a.id=#{item.id} then #{item.updateTime}
</if> </if>
</foreach> </foreach>
</trim> </trim>
...@@ -453,25 +309,25 @@ ...@@ -453,25 +309,25 @@
</foreach> </foreach>
</update> </update>
<!-- 根据主健查询 --> <!-- 根据主健查询 -->
<select id="getByKey" parameterType="paramDto" resultMap="SiteEntity-Map"> <select id="getByKey" parameterType="paramDto" resultMap="AreaEntity-Map">
select <include refid="_columns"/> select <include refid="_columns"/>
from mortals_xhx_site as a from mortals_sys_area as a
where a.id=#{condition.id} where a.id=#{condition.id}
</select> </select>
<!-- 根据主健删除 --> <!-- 根据主健删除 -->
<delete id="deleteByKey" parameterType="paramDto"> <delete id="deleteByKey" parameterType="paramDto">
delete a.* from mortals_xhx_site as a where a.id=#{condition.id} delete a.* from mortals_sys_area as a where a.id=#{condition.id}
</delete> </delete>
<!-- 根据主健删除一批,针对单一主健有效 --> <!-- 根据主健删除一批,针对单一主健有效 -->
<delete id="deleteByKeys"> <delete id="deleteByKeys">
delete from mortals_xhx_site where id in delete from mortals_sys_area where id in
<foreach collection="array" item="item" index="index" open="(" separator="," close=")"> <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</delete> </delete>
<!-- 根据paramDto删除一批 --> <!-- 根据paramDto删除一批 -->
<delete id="deleteByMap" parameterType="paramDto"> <delete id="deleteByMap" parameterType="paramDto">
delete a.* from mortals_xhx_site as a delete a.* from mortals_sys_area as a
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
<trim prefixOverrides="and" prefix=""> <trim prefixOverrides="and" prefix="">
...@@ -480,9 +336,9 @@ ...@@ -480,9 +336,9 @@
</trim> </trim>
</delete> </delete>
<!-- 获取列表 --> <!-- 获取列表 -->
<select id="getList" parameterType="paramDto" resultMap="SiteEntity-Map"> <select id="getList" parameterType="paramDto" resultMap="AreaEntity-Map">
select <include refid="_columns"/> select <include refid="_columns"/>
from mortals_xhx_site as a from mortals_sys_area as a
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
<trim prefixOverrides="and" prefix=""> <trim prefixOverrides="and" prefix="">
...@@ -491,10 +347,17 @@ ...@@ -491,10 +347,17 @@
</trim> </trim>
<include refid="_orderCols_"/> <include refid="_orderCols_"/>
</select> </select>
<!-- 获取子节点 -->
<select id="selectChildrenAreaById" parameterType="String" resultMap="AreaEntity-Map">
select * from mortals_sys_area as a where find_in_set(#{areaId}, ancestors)
</select>
<!-- 获取 --> <!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int"> <select id="getListCount" parameterType="paramDto" resultType="int">
select count(1) select count(1)
from mortals_xhx_site as a from mortals_sys_area as a
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
<trim prefixOverrides="and" prefix=""> <trim prefixOverrides="and" prefix="">
...@@ -539,7 +402,6 @@ ...@@ -539,7 +402,6 @@
<!-- 条件映射-代参数 --> <!-- 条件映射-代参数 -->
<sql id="_condition_param_"> <sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/> <bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="conditionParamRef.containsKey('id')"> <if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null"> <if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id} ${_conditionType_} a.id=#{${_conditionParam_}.id}
...@@ -567,42 +429,6 @@ ...@@ -567,42 +429,6 @@
</if> </if>
<if test="conditionParamRef.containsKey('siteName')">
<if test="conditionParamRef.siteName != null and conditionParamRef.siteName != ''">
${_conditionType_} a.siteName like #{${_conditionParam_}.siteName}
</if>
<if test="conditionParamRef.siteName == null">
${_conditionType_} a.siteName is null
</if>
</if>
<if test="conditionParamRef.containsKey('siteNameList')">
${_conditionType_} a.siteName in
<foreach collection="conditionParamRef.siteNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('parentId')">
<if test="conditionParamRef.parentId != null ">
${_conditionType_} a.parentId = #{${_conditionParam_}.parentId}
</if>
<if test="conditionParamRef.parentId == null">
${_conditionType_} a.parentId is null
</if>
</if>
<if test="conditionParamRef.containsKey('parentIdList')">
${_conditionType_} a.parentId in
<foreach collection="conditionParamRef.parentIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('parentIdStart') and conditionParamRef.parentIdStart != null">
${_conditionType_} a.parentId <![CDATA[ >= ]]> #{${_conditionParam_}.parentIdStart}
</if>
<if test="conditionParamRef.containsKey('parentIdEnd') and conditionParamRef.parentIdEnd != null">
${_conditionType_} a.parentId <![CDATA[ <= ]]> #{${_conditionParam_}.parentIdEnd}
</if>
<if test="conditionParamRef.containsKey('ancestors')"> <if test="conditionParamRef.containsKey('ancestors')">
<if test="conditionParamRef.ancestors != null and conditionParamRef.ancestors != ''"> <if test="conditionParamRef.ancestors != null and conditionParamRef.ancestors != ''">
${_conditionType_} a.ancestors like #{${_conditionParam_}.ancestors} ${_conditionType_} a.ancestors like #{${_conditionParam_}.ancestors}
...@@ -618,248 +444,176 @@ ...@@ -618,248 +444,176 @@
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('address')"> <if test="conditionParamRef.containsKey('name')">
<if test="conditionParamRef.address != null and conditionParamRef.address != ''"> <if test="conditionParamRef.name != null and conditionParamRef.name != ''">
${_conditionType_} a.address like #{${_conditionParam_}.address} ${_conditionType_} a.name like #{${_conditionParam_}.name}
</if> </if>
<if test="conditionParamRef.address == null"> <if test="conditionParamRef.name == null">
${_conditionType_} a.address is null ${_conditionType_} a.name is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('addressList')"> <if test="conditionParamRef.containsKey('nameList')">
${_conditionType_} a.address in ${_conditionType_} a.name in
<foreach collection="conditionParamRef.addressList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.nameList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('mobile')"> <if test="conditionParamRef.containsKey('iid')">
<if test="conditionParamRef.mobile != null and conditionParamRef.mobile != ''"> <if test="conditionParamRef.iid != null and conditionParamRef.iid != ''">
${_conditionType_} a.mobile like #{${_conditionParam_}.mobile} ${_conditionType_} a.iid like #{${_conditionParam_}.iid}
</if> </if>
<if test="conditionParamRef.mobile == null"> <if test="conditionParamRef.iid == null">
${_conditionType_} a.mobile is null ${_conditionType_} a.iid is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('mobileList')"> <if test="conditionParamRef.containsKey('iidList')">
${_conditionType_} a.mobile in ${_conditionType_} a.iid in
<foreach collection="conditionParamRef.mobileList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.iidList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('introduce')"> <if test="conditionParamRef.containsKey('pid')">
<if test="conditionParamRef.introduce != null and conditionParamRef.introduce != ''"> <if test="conditionParamRef.pid != null and conditionParamRef.pid != ''">
${_conditionType_} a.introduce like #{${_conditionParam_}.introduce} ${_conditionType_} a.pid like #{${_conditionParam_}.pid}
</if>
<if test="conditionParamRef.introduce == null">
${_conditionType_} a.introduce is null
</if>
</if>
<if test="conditionParamRef.containsKey('introduceList')">
${_conditionType_} a.introduce in
<foreach collection="conditionParamRef.introduceList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('workday1')">
<if test="conditionParamRef.workday1 != null ">
${_conditionType_} a.workday1 = #{${_conditionParam_}.workday1}
</if> </if>
<if test="conditionParamRef.workday1 == null"> <if test="conditionParamRef.pid == null">
${_conditionType_} a.workday1 is null ${_conditionType_} a.pid is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('workday1List')"> <if test="conditionParamRef.containsKey('pidList')">
${_conditionType_} a.workday1 in ${_conditionType_} a.pid in
<foreach collection="conditionParamRef.workday1List" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.pidList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('workday1Start') and conditionParamRef.workday1Start != null">
${_conditionType_} a.workday1 <![CDATA[ >= ]]> #{${_conditionParam_}.workday1Start}
</if>
<if test="conditionParamRef.containsKey('workday1End') and conditionParamRef.workday1End != null">
${_conditionType_} a.workday1 <![CDATA[ <= ]]> #{${_conditionParam_}.workday1End}
</if>
<if test="conditionParamRef.containsKey('workday2')"> <if test="conditionParamRef.containsKey('haveSonArea')">
<if test="conditionParamRef.workday2 != null "> <if test="conditionParamRef.haveSonArea != null and conditionParamRef.haveSonArea != ''">
${_conditionType_} a.workday2 = #{${_conditionParam_}.workday2} ${_conditionType_} a.haveSonArea like #{${_conditionParam_}.haveSonArea}
</if> </if>
<if test="conditionParamRef.workday2 == null"> <if test="conditionParamRef.haveSonArea == null">
${_conditionType_} a.workday2 is null ${_conditionType_} a.haveSonArea is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('workday2List')"> <if test="conditionParamRef.containsKey('haveSonAreaList')">
${_conditionType_} a.workday2 in ${_conditionType_} a.haveSonArea in
<foreach collection="conditionParamRef.workday2List" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.haveSonAreaList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('workday2Start') and conditionParamRef.workday2Start != null">
${_conditionType_} a.workday2 <![CDATA[ >= ]]> #{${_conditionParam_}.workday2Start}
</if>
<if test="conditionParamRef.containsKey('workday2End') and conditionParamRef.workday2End != null">
${_conditionType_} a.workday2 <![CDATA[ <= ]]> #{${_conditionParam_}.workday2End}
</if>
<if test="conditionParamRef.containsKey('workday3')"> <if test="conditionParamRef.containsKey('haveSonDept')">
<if test="conditionParamRef.workday3 != null "> <if test="conditionParamRef.haveSonDept != null and conditionParamRef.haveSonDept != ''">
${_conditionType_} a.workday3 = #{${_conditionParam_}.workday3} ${_conditionType_} a.haveSonDept like #{${_conditionParam_}.haveSonDept}
</if> </if>
<if test="conditionParamRef.workday3 == null"> <if test="conditionParamRef.haveSonDept == null">
${_conditionType_} a.workday3 is null ${_conditionType_} a.haveSonDept is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('workday3List')"> <if test="conditionParamRef.containsKey('haveSonDeptList')">
${_conditionType_} a.workday3 in ${_conditionType_} a.haveSonDept in
<foreach collection="conditionParamRef.workday3List" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.haveSonDeptList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('workday3Start') and conditionParamRef.workday3Start != null">
${_conditionType_} a.workday3 <![CDATA[ >= ]]> #{${_conditionParam_}.workday3Start}
</if>
<if test="conditionParamRef.containsKey('workday3End') and conditionParamRef.workday3End != null">
${_conditionType_} a.workday3 <![CDATA[ <= ]]> #{${_conditionParam_}.workday3End}
</if>
<if test="conditionParamRef.containsKey('workday4')"> <if test="conditionParamRef.containsKey('haveGetDept')">
<if test="conditionParamRef.workday4 != null "> <if test="conditionParamRef.haveGetDept != null and conditionParamRef.haveGetDept != ''">
${_conditionType_} a.workday4 = #{${_conditionParam_}.workday4} ${_conditionType_} a.haveGetDept like #{${_conditionParam_}.haveGetDept}
</if> </if>
<if test="conditionParamRef.workday4 == null"> <if test="conditionParamRef.haveGetDept == null">
${_conditionType_} a.workday4 is null ${_conditionType_} a.haveGetDept is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('workday4List')"> <if test="conditionParamRef.containsKey('haveGetDeptList')">
${_conditionType_} a.workday4 in ${_conditionType_} a.haveGetDept in
<foreach collection="conditionParamRef.workday4List" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.haveGetDeptList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('workday4Start') and conditionParamRef.workday4Start != null">
${_conditionType_} a.workday4 <![CDATA[ >= ]]> #{${_conditionParam_}.workday4Start}
</if>
<if test="conditionParamRef.containsKey('workday4End') and conditionParamRef.workday4End != null">
${_conditionType_} a.workday4 <![CDATA[ <= ]]> #{${_conditionParam_}.workday4End}
</if>
<if test="conditionParamRef.containsKey('workday5')"> <if test="conditionParamRef.containsKey('haveGetMatterList')">
<if test="conditionParamRef.workday5 != null "> <if test="conditionParamRef.haveGetMatterList != null and conditionParamRef.haveGetMatterList != ''">
${_conditionType_} a.workday5 = #{${_conditionParam_}.workday5} ${_conditionType_} a.haveGetMatterList like #{${_conditionParam_}.haveGetMatterList}
</if> </if>
<if test="conditionParamRef.workday5 == null"> <if test="conditionParamRef.haveGetMatterList == null">
${_conditionType_} a.workday5 is null ${_conditionType_} a.haveGetMatterList is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('workday5List')"> <if test="conditionParamRef.containsKey('haveGetMatterListList')">
${_conditionType_} a.workday5 in ${_conditionType_} a.haveGetMatterList in
<foreach collection="conditionParamRef.workday5List" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.haveGetMatterListList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('workday5Start') and conditionParamRef.workday5Start != null">
${_conditionType_} a.workday5 <![CDATA[ >= ]]> #{${_conditionParam_}.workday5Start}
</if>
<if test="conditionParamRef.containsKey('workday5End') and conditionParamRef.workday5End != null">
${_conditionType_} a.workday5 <![CDATA[ <= ]]> #{${_conditionParam_}.workday5End}
</if>
<if test="conditionParamRef.containsKey('workday6')"> <if test="conditionParamRef.containsKey('areaCode')">
<if test="conditionParamRef.workday6 != null "> <if test="conditionParamRef.areaCode != null and conditionParamRef.areaCode != ''">
${_conditionType_} a.workday6 = #{${_conditionParam_}.workday6} ${_conditionType_} a.areaCode like #{${_conditionParam_}.areaCode}
</if> </if>
<if test="conditionParamRef.workday6 == null"> <if test="conditionParamRef.areaCode == null">
${_conditionType_} a.workday6 is null ${_conditionType_} a.areaCode is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('workday6List')"> <if test="conditionParamRef.containsKey('areaCodeList')">
${_conditionType_} a.workday6 in ${_conditionType_} a.areaCode in
<foreach collection="conditionParamRef.workday6List" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.areaCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('workday6Start') and conditionParamRef.workday6Start != null"> <if test="conditionParamRef.containsKey('areaLevel')">
${_conditionType_} a.workday6 <![CDATA[ >= ]]> #{${_conditionParam_}.workday6Start} <if test="conditionParamRef.areaLevel != null ">
</if> ${_conditionType_} a.areaLevel = #{${_conditionParam_}.areaLevel}
<if test="conditionParamRef.containsKey('workday6End') and conditionParamRef.workday6End != null">
${_conditionType_} a.workday6 <![CDATA[ <= ]]> #{${_conditionParam_}.workday6End}
</if>
<if test="conditionParamRef.containsKey('workday7')">
<if test="conditionParamRef.workday7 != null ">
${_conditionType_} a.workday7 = #{${_conditionParam_}.workday7}
</if> </if>
<if test="conditionParamRef.workday7 == null"> <if test="conditionParamRef.areaLevel == null">
${_conditionType_} a.workday7 is null ${_conditionType_} a.areaLevel is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('workday7List')"> <if test="conditionParamRef.containsKey('areaLevelList')">
${_conditionType_} a.workday7 in ${_conditionType_} a.areaLevel in
<foreach collection="conditionParamRef.workday7List" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.areaLevelList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('workday7Start') and conditionParamRef.workday7Start != null"> <if test="conditionParamRef.containsKey('areaLevelStart') and conditionParamRef.areaLevelStart != null">
${_conditionType_} a.workday7 <![CDATA[ >= ]]> #{${_conditionParam_}.workday7Start} ${_conditionType_} a.areaLevel <![CDATA[ >= ]]> #{${_conditionParam_}.areaLevelStart}
</if> </if>
<if test="conditionParamRef.containsKey('workday7End') and conditionParamRef.workday7End != null"> <if test="conditionParamRef.containsKey('areaLevelEnd') and conditionParamRef.areaLevelEnd != null">
${_conditionType_} a.workday7 <![CDATA[ <= ]]> #{${_conditionParam_}.workday7End} ${_conditionType_} a.areaLevel <![CDATA[ <= ]]> #{${_conditionParam_}.areaLevelEnd}
</if> </if>
<if test="conditionParamRef.containsKey('number')"> <if test="conditionParamRef.containsKey('shortName')">
<if test="conditionParamRef.number != null and conditionParamRef.number != ''"> <if test="conditionParamRef.shortName != null and conditionParamRef.shortName != ''">
${_conditionType_} a.number like #{${_conditionParam_}.number} ${_conditionType_} a.shortName like #{${_conditionParam_}.shortName}
</if> </if>
<if test="conditionParamRef.number == null"> <if test="conditionParamRef.shortName == null">
${_conditionType_} a.number is null ${_conditionType_} a.shortName is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('numberList')"> <if test="conditionParamRef.containsKey('shortNameList')">
${_conditionType_} a.number in ${_conditionType_} a.shortName in
<foreach collection="conditionParamRef.numberList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.shortNameList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('summary')"> <if test="conditionParamRef.containsKey('domain')">
<if test="conditionParamRef.summary != null and conditionParamRef.summary != ''"> <if test="conditionParamRef.domain != null and conditionParamRef.domain != ''">
${_conditionType_} a.summary like #{${_conditionParam_}.summary} ${_conditionType_} a.domain like #{${_conditionParam_}.domain}
</if>
<if test="conditionParamRef.summary == null">
${_conditionType_} a.summary is null
</if>
</if>
<if test="conditionParamRef.containsKey('summaryList')">
${_conditionType_} a.summary in
<foreach collection="conditionParamRef.summaryList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('orderNum')">
<if test="conditionParamRef.orderNum != null ">
${_conditionType_} a.orderNum = #{${_conditionParam_}.orderNum}
</if> </if>
<if test="conditionParamRef.orderNum == null"> <if test="conditionParamRef.domain == null">
${_conditionType_} a.orderNum is null ${_conditionType_} a.domain is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('orderNumList')"> <if test="conditionParamRef.containsKey('domainList')">
${_conditionType_} a.orderNum in ${_conditionType_} a.domain in
<foreach collection="conditionParamRef.orderNumList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('orderNumStart') and conditionParamRef.orderNumStart != null">
${_conditionType_} a.orderNum <![CDATA[ >= ]]> #{${_conditionParam_}.orderNumStart}
</if>
<if test="conditionParamRef.containsKey('orderNumEnd') and conditionParamRef.orderNumEnd != null">
${_conditionType_} a.orderNum <![CDATA[ <= ]]> #{${_conditionParam_}.orderNumEnd}
</if>
<if test="conditionParamRef.containsKey('status')"> <if test="conditionParamRef.containsKey('status')">
<if test="conditionParamRef.status != null "> <if test="conditionParamRef.status != null ">
${_conditionType_} a.status = #{${_conditionParam_}.status} ${_conditionType_} a.status = #{${_conditionParam_}.status}
...@@ -882,36 +636,6 @@ ...@@ -882,36 +636,6 @@
</if> </if>
<if test="conditionParamRef.containsKey('updateTime')">
<if test="conditionParamRef.updateTime != null ">
${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
</if>
<if test="conditionParamRef.updateTime == null">
${_conditionType_} a.updateTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateUser')">
<if test="conditionParamRef.updateUser != null and conditionParamRef.updateUser != ''">
${_conditionType_} a.updateUser like #{${_conditionParam_}.updateUser}
</if>
<if test="conditionParamRef.updateUser == null">
${_conditionType_} a.updateUser is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateUserList')">
${_conditionType_} a.updateUser in
<foreach collection="conditionParamRef.updateUserList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createTime')"> <if test="conditionParamRef.containsKey('createTime')">
<if test="conditionParamRef.createTime != null "> <if test="conditionParamRef.createTime != null ">
${_conditionType_} a.createTime = #{${_conditionParam_}.createTime} ${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
...@@ -926,21 +650,42 @@ ...@@ -926,21 +650,42 @@
<if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''"> <if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if> </if>
<if test="conditionParamRef.containsKey('createUserId')">
<if test="conditionParamRef.containsKey('createUser')"> <if test="conditionParamRef.createUserId != null ">
<if test="conditionParamRef.createUser != null and conditionParamRef.createUser != ''"> ${_conditionType_} a.createUserId = #{${_conditionParam_}.createUserId}
${_conditionType_} a.createUser like #{${_conditionParam_}.createUser}
</if> </if>
<if test="conditionParamRef.createUser == null"> <if test="conditionParamRef.createUserId == null">
${_conditionType_} a.createUser is null ${_conditionType_} a.createUserId is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('createUserList')"> <if test="conditionParamRef.containsKey('createUserIdList')">
${_conditionType_} a.createUser in ${_conditionType_} a.createUserId in
<foreach collection="conditionParamRef.createUserList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('createUserIdStart') and conditionParamRef.createUserIdStart != null">
${_conditionType_} a.createUserId <![CDATA[ >= ]]> #{${_conditionParam_}.createUserIdStart}
</if>
<if test="conditionParamRef.containsKey('createUserIdEnd') and conditionParamRef.createUserIdEnd != null">
${_conditionType_} a.createUserId <![CDATA[ <= ]]> #{${_conditionParam_}.createUserIdEnd}
</if>
<if test="conditionParamRef.containsKey('updateTime')">
<if test="conditionParamRef.updateTime != null ">
${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
</if>
<if test="conditionParamRef.updateTime == null">
${_conditionType_} a.updateTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
</sql> </sql>
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
...@@ -959,84 +704,64 @@ ...@@ -959,84 +704,64 @@
<if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if> <if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('siteName')">
a.siteName
<if test='orderCol.siteName != null and "DESC".equalsIgnoreCase(orderCol.siteName)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('parentId')">
a.parentId
<if test='orderCol.parentId != null and "DESC".equalsIgnoreCase(orderCol.parentId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('ancestors')"> <if test="orderCol.containsKey('ancestors')">
a.ancestors a.ancestors
<if test='orderCol.ancestors != null and "DESC".equalsIgnoreCase(orderCol.ancestors)'>DESC</if> <if test='orderCol.ancestors != null and "DESC".equalsIgnoreCase(orderCol.ancestors)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('address')"> <if test="orderCol.containsKey('name')">
a.address a.name
<if test='orderCol.address != null and "DESC".equalsIgnoreCase(orderCol.address)'>DESC</if> <if test='orderCol.name != null and "DESC".equalsIgnoreCase(orderCol.name)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('mobile')"> <if test="orderCol.containsKey('iid')">
a.mobile a.iid
<if test='orderCol.mobile != null and "DESC".equalsIgnoreCase(orderCol.mobile)'>DESC</if> <if test='orderCol.iid != null and "DESC".equalsIgnoreCase(orderCol.iid)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('introduce')"> <if test="orderCol.containsKey('pid')">
a.introduce a.pid
<if test='orderCol.introduce != null and "DESC".equalsIgnoreCase(orderCol.introduce)'>DESC</if> <if test='orderCol.pid != null and "DESC".equalsIgnoreCase(orderCol.pid)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('workday1')"> <if test="orderCol.containsKey('haveSonArea')">
a.workday1 a.haveSonArea
<if test='orderCol.workday1 != null and "DESC".equalsIgnoreCase(orderCol.workday1)'>DESC</if> <if test='orderCol.haveSonArea != null and "DESC".equalsIgnoreCase(orderCol.haveSonArea)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('workday2')"> <if test="orderCol.containsKey('haveSonDept')">
a.workday2 a.haveSonDept
<if test='orderCol.workday2 != null and "DESC".equalsIgnoreCase(orderCol.workday2)'>DESC</if> <if test='orderCol.haveSonDept != null and "DESC".equalsIgnoreCase(orderCol.haveSonDept)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('workday3')"> <if test="orderCol.containsKey('haveGetDept')">
a.workday3 a.haveGetDept
<if test='orderCol.workday3 != null and "DESC".equalsIgnoreCase(orderCol.workday3)'>DESC</if> <if test='orderCol.haveGetDept != null and "DESC".equalsIgnoreCase(orderCol.haveGetDept)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('workday4')"> <if test="orderCol.containsKey('haveGetMatterList')">
a.workday4 a.haveGetMatterList
<if test='orderCol.workday4 != null and "DESC".equalsIgnoreCase(orderCol.workday4)'>DESC</if> <if test='orderCol.haveGetMatterList != null and "DESC".equalsIgnoreCase(orderCol.haveGetMatterList)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('workday5')"> <if test="orderCol.containsKey('areaCode')">
a.workday5 a.areaCode
<if test='orderCol.workday5 != null and "DESC".equalsIgnoreCase(orderCol.workday5)'>DESC</if> <if test='orderCol.areaCode != null and "DESC".equalsIgnoreCase(orderCol.areaCode)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('workday6')"> <if test="orderCol.containsKey('areaLevel')">
a.workday6 a.areaLevel
<if test='orderCol.workday6 != null and "DESC".equalsIgnoreCase(orderCol.workday6)'>DESC</if> <if test='orderCol.areaLevel != null and "DESC".equalsIgnoreCase(orderCol.areaLevel)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('workday7')"> <if test="orderCol.containsKey('shortName')">
a.workday7 a.shortName
<if test='orderCol.workday7 != null and "DESC".equalsIgnoreCase(orderCol.workday7)'>DESC</if> <if test='orderCol.shortName != null and "DESC".equalsIgnoreCase(orderCol.shortName)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('number')"> <if test="orderCol.containsKey('domain')">
a.number a.domain
<if test='orderCol.number != null and "DESC".equalsIgnoreCase(orderCol.number)'>DESC</if> <if test='orderCol.domain != null and "DESC".equalsIgnoreCase(orderCol.domain)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('summary')">
a.summary
<if test='orderCol.summary != null and "DESC".equalsIgnoreCase(orderCol.summary)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('orderNum')">
a.orderNum
<if test='orderCol.orderNum != null and "DESC".equalsIgnoreCase(orderCol.orderNum)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('status')"> <if test="orderCol.containsKey('status')">
...@@ -1044,24 +769,19 @@ ...@@ -1044,24 +769,19 @@
<if test='orderCol.status != null and "DESC".equalsIgnoreCase(orderCol.status)'>DESC</if> <if test='orderCol.status != null and "DESC".equalsIgnoreCase(orderCol.status)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('updateTime')">
a.updateTime
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('updateUser')">
a.updateUser
<if test='orderCol.updateUser != null and "DESC".equalsIgnoreCase(orderCol.updateUser)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createTime')"> <if test="orderCol.containsKey('createTime')">
a.createTime a.createTime
<if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if> <if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('createUser')"> <if test="orderCol.containsKey('createUserId')">
a.createUser a.createUserId
<if test='orderCol.createUser != null and "DESC".equalsIgnoreCase(orderCol.createUser)'>DESC</if> <if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('updateTime')">
a.updateTime
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
, ,
</if> </if>
</trim> </trim>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.site.dao.ibatis.SiteDaoImpl">
<!-- 字段和属性映射 -->
<resultMap type="SiteEntity" id="SiteEntity-Map">
<id property="id" column="id" />
<result property="siteName" column="siteName" />
<result property="siteCode" column="siteCode" />
<result property="areaID" column="areaID" />
<result property="areaCode" column="areaCode" />
<result property="areaName" column="areaName" />
<result property="proCode" column="proCode" />
<result property="cityCode" column="cityCode" />
<result property="districtCode" column="districtCode" />
<result property="siteIp" column="siteIp" />
<result property="sitePort" column="sitePort" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="siteTel" column="siteTel" />
<result property="detailAddress" column="detailAddress" />
<result property="siteRemark" column="siteRemark" />
<result property="amWorkStartTime" column="amWorkStartTime" />
<result property="amWorkEndTime" column="amWorkEndTime" />
<result property="pmWorkStartTime" column="pmWorkStartTime" />
<result property="pmWorkEndTime" column="pmWorkEndTime" />
<result property="workday1" column="workday1" />
<result property="workday2" column="workday2" />
<result property="workday3" column="workday3" />
<result property="workday4" column="workday4" />
<result property="workday5" column="workday5" />
<result property="workday6" column="workday6" />
<result property="workday7" column="workday7" />
<result property="level" column="level" />
<result property="building" column="building" />
<result property="logoPath" column="logoPath" />
<result property="englishName" column="englishName" />
<result property="leadingOfficial" column="leadingOfficial" />
<result property="leadingOfficialTelephone" column="leadingOfficialTelephone" />
<result property="modelIds" column="modelIds" />
<result property="createTime" column="createTime" />
<result property="createUserId" column="createUserId" />
<result property="updateTime" column="updateTime" />
</resultMap>
<!-- 表所有列 -->
<sql id="_columns">
<trim suffixOverrides="," suffix="">
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
a.id,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteName') or colPickMode == 1 and data.containsKey('siteName')))">
a.siteName,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteCode') or colPickMode == 1 and data.containsKey('siteCode')))">
a.siteCode,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('areaID') or colPickMode == 1 and data.containsKey('areaID')))">
a.areaID,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('areaCode') or colPickMode == 1 and data.containsKey('areaCode')))">
a.areaCode,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('areaName') or colPickMode == 1 and data.containsKey('areaName')))">
a.areaName,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('proCode') or colPickMode == 1 and data.containsKey('proCode')))">
a.proCode,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('cityCode') or colPickMode == 1 and data.containsKey('cityCode')))">
a.cityCode,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('districtCode') or colPickMode == 1 and data.containsKey('districtCode')))">
a.districtCode,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteIp') or colPickMode == 1 and data.containsKey('siteIp')))">
a.siteIp,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('sitePort') or colPickMode == 1 and data.containsKey('sitePort')))">
a.sitePort,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('longitude') or colPickMode == 1 and data.containsKey('longitude')))">
a.longitude,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('latitude') or colPickMode == 1 and data.containsKey('latitude')))">
a.latitude,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteTel') or colPickMode == 1 and data.containsKey('siteTel')))">
a.siteTel,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('detailAddress') or colPickMode == 1 and data.containsKey('detailAddress')))">
a.detailAddress,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteRemark') or colPickMode == 1 and data.containsKey('siteRemark')))">
a.siteRemark,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('amWorkStartTime') or colPickMode == 1 and data.containsKey('amWorkStartTime')))">
a.amWorkStartTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('amWorkEndTime') or colPickMode == 1 and data.containsKey('amWorkEndTime')))">
a.amWorkEndTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('pmWorkStartTime') or colPickMode == 1 and data.containsKey('pmWorkStartTime')))">
a.pmWorkStartTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('pmWorkEndTime') or colPickMode == 1 and data.containsKey('pmWorkEndTime')))">
a.pmWorkEndTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday1') or colPickMode == 1 and data.containsKey('workday1')))">
a.workday1,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday2') or colPickMode == 1 and data.containsKey('workday2')))">
a.workday2,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday3') or colPickMode == 1 and data.containsKey('workday3')))">
a.workday3,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday4') or colPickMode == 1 and data.containsKey('workday4')))">
a.workday4,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday5') or colPickMode == 1 and data.containsKey('workday5')))">
a.workday5,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday6') or colPickMode == 1 and data.containsKey('workday6')))">
a.workday6,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workday7') or colPickMode == 1 and data.containsKey('workday7')))">
a.workday7,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('level') or colPickMode == 1 and data.containsKey('level')))">
a.level,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('building') or colPickMode == 1 and data.containsKey('building')))">
a.building,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('logoPath') or colPickMode == 1 and data.containsKey('logoPath')))">
a.logoPath,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('englishName') or colPickMode == 1 and data.containsKey('englishName')))">
a.englishName,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('leadingOfficial') or colPickMode == 1 and data.containsKey('leadingOfficial')))">
a.leadingOfficial,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('leadingOfficialTelephone') or colPickMode == 1 and data.containsKey('leadingOfficialTelephone')))">
a.leadingOfficialTelephone,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('modelIds') or colPickMode == 1 and data.containsKey('modelIds')))">
a.modelIds,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
a.createTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
a.createUserId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="SiteEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_sys_site
(siteName,siteCode,areaID,areaCode,areaName,proCode,cityCode,districtCode,siteIp,sitePort,longitude,latitude,siteTel,detailAddress,siteRemark,amWorkStartTime,amWorkEndTime,pmWorkStartTime,pmWorkEndTime,workday1,workday2,workday3,workday4,workday5,workday6,workday7,level,building,logoPath,englishName,leadingOfficial,leadingOfficialTelephone,modelIds,createTime,createUserId,updateTime)
VALUES
(#{siteName},#{siteCode},#{areaID},#{areaCode},#{areaName},#{proCode},#{cityCode},#{districtCode},#{siteIp},#{sitePort},#{longitude},#{latitude},#{siteTel},#{detailAddress},#{siteRemark},#{amWorkStartTime},#{amWorkEndTime},#{pmWorkStartTime},#{pmWorkEndTime},#{workday1},#{workday2},#{workday3},#{workday4},#{workday5},#{workday6},#{workday7},#{level},#{building},#{logoPath},#{englishName},#{leadingOfficial},#{leadingOfficialTelephone},#{modelIds},#{createTime},#{createUserId},#{updateTime})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_sys_site
(siteName,siteCode,areaID,areaCode,areaName,proCode,cityCode,districtCode,siteIp,sitePort,longitude,latitude,siteTel,detailAddress,siteRemark,amWorkStartTime,amWorkEndTime,pmWorkStartTime,pmWorkEndTime,workday1,workday2,workday3,workday4,workday5,workday6,workday7,level,building,logoPath,englishName,leadingOfficial,leadingOfficialTelephone,modelIds,createTime,createUserId,updateTime)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.siteName},#{item.siteCode},#{item.areaID},#{item.areaCode},#{item.areaName},#{item.proCode},#{item.cityCode},#{item.districtCode},#{item.siteIp},#{item.sitePort},#{item.longitude},#{item.latitude},#{item.siteTel},#{item.detailAddress},#{item.siteRemark},#{item.amWorkStartTime},#{item.amWorkEndTime},#{item.pmWorkStartTime},#{item.pmWorkEndTime},#{item.workday1},#{item.workday2},#{item.workday3},#{item.workday4},#{item.workday5},#{item.workday6},#{item.workday7},#{item.level},#{item.building},#{item.logoPath},#{item.englishName},#{item.leadingOfficial},#{item.leadingOfficialTelephone},#{item.modelIds},#{item.createTime},#{item.createUserId},#{item.updateTime})
</foreach>
</insert>
<!-- 根据ParamDto更新 -->
<update id="update" parameterType="paramDto">
update mortals_sys_site as a
set
<trim suffixOverrides="," suffix="">
<if test="(colPickMode==0 and data.containsKey('siteName')) or (colPickMode==1 and !data.containsKey('siteName'))">
a.siteName=#{data.siteName},
</if>
<if test="(colPickMode==0 and data.containsKey('siteCode')) or (colPickMode==1 and !data.containsKey('siteCode'))">
a.siteCode=#{data.siteCode},
</if>
<if test="(colPickMode==0 and data.containsKey('areaID')) or (colPickMode==1 and !data.containsKey('areaID'))">
a.areaID=#{data.areaID},
</if>
<if test="(colPickMode==0 and data.containsKey('areaCode')) or (colPickMode==1 and !data.containsKey('areaCode'))">
a.areaCode=#{data.areaCode},
</if>
<if test="(colPickMode==0 and data.containsKey('areaName')) or (colPickMode==1 and !data.containsKey('areaName'))">
a.areaName=#{data.areaName},
</if>
<if test="(colPickMode==0 and data.containsKey('proCode')) or (colPickMode==1 and !data.containsKey('proCode'))">
a.proCode=#{data.proCode},
</if>
<if test="(colPickMode==0 and data.containsKey('cityCode')) or (colPickMode==1 and !data.containsKey('cityCode'))">
a.cityCode=#{data.cityCode},
</if>
<if test="(colPickMode==0 and data.containsKey('districtCode')) or (colPickMode==1 and !data.containsKey('districtCode'))">
a.districtCode=#{data.districtCode},
</if>
<if test="(colPickMode==0 and data.containsKey('siteIp')) or (colPickMode==1 and !data.containsKey('siteIp'))">
a.siteIp=#{data.siteIp},
</if>
<if test="(colPickMode==0 and data.containsKey('sitePort')) or (colPickMode==1 and !data.containsKey('sitePort'))">
a.sitePort=#{data.sitePort},
</if>
<if test="(colPickMode==0 and data.containsKey('longitude')) or (colPickMode==1 and !data.containsKey('longitude'))">
a.longitude=#{data.longitude},
</if>
<if test="(colPickMode==0 and data.containsKey('latitude')) or (colPickMode==1 and !data.containsKey('latitude'))">
a.latitude=#{data.latitude},
</if>
<if test="(colPickMode==0 and data.containsKey('siteTel')) or (colPickMode==1 and !data.containsKey('siteTel'))">
a.siteTel=#{data.siteTel},
</if>
<if test="(colPickMode==0 and data.containsKey('detailAddress')) or (colPickMode==1 and !data.containsKey('detailAddress'))">
a.detailAddress=#{data.detailAddress},
</if>
<if test="(colPickMode==0 and data.containsKey('siteRemark')) or (colPickMode==1 and !data.containsKey('siteRemark'))">
a.siteRemark=#{data.siteRemark},
</if>
<if test="(colPickMode==0 and data.containsKey('amWorkStartTime')) or (colPickMode==1 and !data.containsKey('amWorkStartTime'))">
a.amWorkStartTime=#{data.amWorkStartTime},
</if>
<if test="(colPickMode==0 and data.containsKey('amWorkEndTime')) or (colPickMode==1 and !data.containsKey('amWorkEndTime'))">
a.amWorkEndTime=#{data.amWorkEndTime},
</if>
<if test="(colPickMode==0 and data.containsKey('pmWorkStartTime')) or (colPickMode==1 and !data.containsKey('pmWorkStartTime'))">
a.pmWorkStartTime=#{data.pmWorkStartTime},
</if>
<if test="(colPickMode==0 and data.containsKey('pmWorkEndTime')) or (colPickMode==1 and !data.containsKey('pmWorkEndTime'))">
a.pmWorkEndTime=#{data.pmWorkEndTime},
</if>
<if test="(colPickMode==0 and data.containsKey('workday1')) or (colPickMode==1 and !data.containsKey('workday1'))">
a.workday1=#{data.workday1},
</if>
<if test="(colPickMode==0 and data.containsKey('workday1Increment')) or (colPickMode==1 and !data.containsKey('workday1Increment'))">
a.workday1=ifnull(a.workday1,0) + #{data.workday1Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('workday2')) or (colPickMode==1 and !data.containsKey('workday2'))">
a.workday2=#{data.workday2},
</if>
<if test="(colPickMode==0 and data.containsKey('workday2Increment')) or (colPickMode==1 and !data.containsKey('workday2Increment'))">
a.workday2=ifnull(a.workday2,0) + #{data.workday2Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('workday3')) or (colPickMode==1 and !data.containsKey('workday3'))">
a.workday3=#{data.workday3},
</if>
<if test="(colPickMode==0 and data.containsKey('workday3Increment')) or (colPickMode==1 and !data.containsKey('workday3Increment'))">
a.workday3=ifnull(a.workday3,0) + #{data.workday3Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('workday4')) or (colPickMode==1 and !data.containsKey('workday4'))">
a.workday4=#{data.workday4},
</if>
<if test="(colPickMode==0 and data.containsKey('workday4Increment')) or (colPickMode==1 and !data.containsKey('workday4Increment'))">
a.workday4=ifnull(a.workday4,0) + #{data.workday4Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('workday5')) or (colPickMode==1 and !data.containsKey('workday5'))">
a.workday5=#{data.workday5},
</if>
<if test="(colPickMode==0 and data.containsKey('workday5Increment')) or (colPickMode==1 and !data.containsKey('workday5Increment'))">
a.workday5=ifnull(a.workday5,0) + #{data.workday5Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('workday6')) or (colPickMode==1 and !data.containsKey('workday6'))">
a.workday6=#{data.workday6},
</if>
<if test="(colPickMode==0 and data.containsKey('workday6Increment')) or (colPickMode==1 and !data.containsKey('workday6Increment'))">
a.workday6=ifnull(a.workday6,0) + #{data.workday6Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('workday7')) or (colPickMode==1 and !data.containsKey('workday7'))">
a.workday7=#{data.workday7},
</if>
<if test="(colPickMode==0 and data.containsKey('workday7Increment')) or (colPickMode==1 and !data.containsKey('workday7Increment'))">
a.workday7=ifnull(a.workday7,0) + #{data.workday7Increment},
</if>
<if test="(colPickMode==0 and data.containsKey('level')) or (colPickMode==1 and !data.containsKey('level'))">
a.level=#{data.level},
</if>
<if test="(colPickMode==0 and data.containsKey('levelIncrement')) or (colPickMode==1 and !data.containsKey('levelIncrement'))">
a.level=ifnull(a.level,0) + #{data.levelIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('building')) or (colPickMode==1 and !data.containsKey('building'))">
a.building=#{data.building},
</if>
<if test="(colPickMode==0 and data.containsKey('buildingIncrement')) or (colPickMode==1 and !data.containsKey('buildingIncrement'))">
a.building=ifnull(a.building,0) + #{data.buildingIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('logoPath')) or (colPickMode==1 and !data.containsKey('logoPath'))">
a.logoPath=#{data.logoPath},
</if>
<if test="(colPickMode==0 and data.containsKey('englishName')) or (colPickMode==1 and !data.containsKey('englishName'))">
a.englishName=#{data.englishName},
</if>
<if test="(colPickMode==0 and data.containsKey('leadingOfficial')) or (colPickMode==1 and !data.containsKey('leadingOfficial'))">
a.leadingOfficial=#{data.leadingOfficial},
</if>
<if test="(colPickMode==0 and data.containsKey('leadingOfficialTelephone')) or (colPickMode==1 and !data.containsKey('leadingOfficialTelephone'))">
a.leadingOfficialTelephone=#{data.leadingOfficialTelephone},
</if>
<if test="(colPickMode==0 and data.containsKey('modelIds')) or (colPickMode==1 and !data.containsKey('modelIds'))">
a.modelIds=#{data.modelIds},
</if>
<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
a.createTime=#{data.createTime},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
a.createUserId=#{data.createUserId},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</update>
<!-- 批量更新 -->
<update id="updateBatch" parameterType="paramDto">
update mortals_sys_site as a
<trim prefix="set" suffixOverrides=",">
<trim prefix="siteName=(case" suffix="ELSE siteName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('siteName')) or (colPickMode==1 and !item.containsKey('siteName'))">
when a.id=#{item.id} then #{item.siteName}
</if>
</foreach>
</trim>
<trim prefix="siteCode=(case" suffix="ELSE siteCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('siteCode')) or (colPickMode==1 and !item.containsKey('siteCode'))">
when a.id=#{item.id} then #{item.siteCode}
</if>
</foreach>
</trim>
<trim prefix="areaID=(case" suffix="ELSE areaID end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('areaID')) or (colPickMode==1 and !item.containsKey('areaID'))">
when a.id=#{item.id} then #{item.areaID}
</if>
</foreach>
</trim>
<trim prefix="areaCode=(case" suffix="ELSE areaCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('areaCode')) or (colPickMode==1 and !item.containsKey('areaCode'))">
when a.id=#{item.id} then #{item.areaCode}
</if>
</foreach>
</trim>
<trim prefix="areaName=(case" suffix="ELSE areaName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('areaName')) or (colPickMode==1 and !item.containsKey('areaName'))">
when a.id=#{item.id} then #{item.areaName}
</if>
</foreach>
</trim>
<trim prefix="proCode=(case" suffix="ELSE proCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('proCode')) or (colPickMode==1 and !item.containsKey('proCode'))">
when a.id=#{item.id} then #{item.proCode}
</if>
</foreach>
</trim>
<trim prefix="cityCode=(case" suffix="ELSE cityCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('cityCode')) or (colPickMode==1 and !item.containsKey('cityCode'))">
when a.id=#{item.id} then #{item.cityCode}
</if>
</foreach>
</trim>
<trim prefix="districtCode=(case" suffix="ELSE districtCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('districtCode')) or (colPickMode==1 and !item.containsKey('districtCode'))">
when a.id=#{item.id} then #{item.districtCode}
</if>
</foreach>
</trim>
<trim prefix="siteIp=(case" suffix="ELSE siteIp end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('siteIp')) or (colPickMode==1 and !item.containsKey('siteIp'))">
when a.id=#{item.id} then #{item.siteIp}
</if>
</foreach>
</trim>
<trim prefix="sitePort=(case" suffix="ELSE sitePort end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('sitePort')) or (colPickMode==1 and !item.containsKey('sitePort'))">
when a.id=#{item.id} then #{item.sitePort}
</if>
</foreach>
</trim>
<trim prefix="longitude=(case" suffix="ELSE longitude end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('longitude')) or (colPickMode==1 and !item.containsKey('longitude'))">
when a.id=#{item.id} then #{item.longitude}
</if>
</foreach>
</trim>
<trim prefix="latitude=(case" suffix="ELSE latitude end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('latitude')) or (colPickMode==1 and !item.containsKey('latitude'))">
when a.id=#{item.id} then #{item.latitude}
</if>
</foreach>
</trim>
<trim prefix="siteTel=(case" suffix="ELSE siteTel end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('siteTel')) or (colPickMode==1 and !item.containsKey('siteTel'))">
when a.id=#{item.id} then #{item.siteTel}
</if>
</foreach>
</trim>
<trim prefix="detailAddress=(case" suffix="ELSE detailAddress end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('detailAddress')) or (colPickMode==1 and !item.containsKey('detailAddress'))">
when a.id=#{item.id} then #{item.detailAddress}
</if>
</foreach>
</trim>
<trim prefix="siteRemark=(case" suffix="ELSE siteRemark end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('siteRemark')) or (colPickMode==1 and !item.containsKey('siteRemark'))">
when a.id=#{item.id} then #{item.siteRemark}
</if>
</foreach>
</trim>
<trim prefix="amWorkStartTime=(case" suffix="ELSE amWorkStartTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('amWorkStartTime')) or (colPickMode==1 and !item.containsKey('amWorkStartTime'))">
when a.id=#{item.id} then #{item.amWorkStartTime}
</if>
</foreach>
</trim>
<trim prefix="amWorkEndTime=(case" suffix="ELSE amWorkEndTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('amWorkEndTime')) or (colPickMode==1 and !item.containsKey('amWorkEndTime'))">
when a.id=#{item.id} then #{item.amWorkEndTime}
</if>
</foreach>
</trim>
<trim prefix="pmWorkStartTime=(case" suffix="ELSE pmWorkStartTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('pmWorkStartTime')) or (colPickMode==1 and !item.containsKey('pmWorkStartTime'))">
when a.id=#{item.id} then #{item.pmWorkStartTime}
</if>
</foreach>
</trim>
<trim prefix="pmWorkEndTime=(case" suffix="ELSE pmWorkEndTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('pmWorkEndTime')) or (colPickMode==1 and !item.containsKey('pmWorkEndTime'))">
when a.id=#{item.id} then #{item.pmWorkEndTime}
</if>
</foreach>
</trim>
<trim prefix="workday1=(case" suffix="ELSE workday1 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday1')) or (colPickMode==1 and !item.containsKey('workday1'))">
when a.id=#{item.id} then #{item.workday1}
</when>
<when test="(colPickMode==0 and item.containsKey('workday1Increment')) or (colPickMode==1 and !item.containsKey('workday1Increment'))">
when a.id=#{item.id} then ifnull(a.workday1,0) + #{item.workday1Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday2=(case" suffix="ELSE workday2 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday2')) or (colPickMode==1 and !item.containsKey('workday2'))">
when a.id=#{item.id} then #{item.workday2}
</when>
<when test="(colPickMode==0 and item.containsKey('workday2Increment')) or (colPickMode==1 and !item.containsKey('workday2Increment'))">
when a.id=#{item.id} then ifnull(a.workday2,0) + #{item.workday2Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday3=(case" suffix="ELSE workday3 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday3')) or (colPickMode==1 and !item.containsKey('workday3'))">
when a.id=#{item.id} then #{item.workday3}
</when>
<when test="(colPickMode==0 and item.containsKey('workday3Increment')) or (colPickMode==1 and !item.containsKey('workday3Increment'))">
when a.id=#{item.id} then ifnull(a.workday3,0) + #{item.workday3Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday4=(case" suffix="ELSE workday4 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday4')) or (colPickMode==1 and !item.containsKey('workday4'))">
when a.id=#{item.id} then #{item.workday4}
</when>
<when test="(colPickMode==0 and item.containsKey('workday4Increment')) or (colPickMode==1 and !item.containsKey('workday4Increment'))">
when a.id=#{item.id} then ifnull(a.workday4,0) + #{item.workday4Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday5=(case" suffix="ELSE workday5 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday5')) or (colPickMode==1 and !item.containsKey('workday5'))">
when a.id=#{item.id} then #{item.workday5}
</when>
<when test="(colPickMode==0 and item.containsKey('workday5Increment')) or (colPickMode==1 and !item.containsKey('workday5Increment'))">
when a.id=#{item.id} then ifnull(a.workday5,0) + #{item.workday5Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday6=(case" suffix="ELSE workday6 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday6')) or (colPickMode==1 and !item.containsKey('workday6'))">
when a.id=#{item.id} then #{item.workday6}
</when>
<when test="(colPickMode==0 and item.containsKey('workday6Increment')) or (colPickMode==1 and !item.containsKey('workday6Increment'))">
when a.id=#{item.id} then ifnull(a.workday6,0) + #{item.workday6Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="workday7=(case" suffix="ELSE workday7 end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('workday7')) or (colPickMode==1 and !item.containsKey('workday7'))">
when a.id=#{item.id} then #{item.workday7}
</when>
<when test="(colPickMode==0 and item.containsKey('workday7Increment')) or (colPickMode==1 and !item.containsKey('workday7Increment'))">
when a.id=#{item.id} then ifnull(a.workday7,0) + #{item.workday7Increment}
</when>
</choose>
</foreach>
</trim>
<trim prefix="level=(case" suffix="ELSE level end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('level')) or (colPickMode==1 and !item.containsKey('level'))">
when a.id=#{item.id} then #{item.level}
</when>
<when test="(colPickMode==0 and item.containsKey('levelIncrement')) or (colPickMode==1 and !item.containsKey('levelIncrement'))">
when a.id=#{item.id} then ifnull(a.level,0) + #{item.levelIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="building=(case" suffix="ELSE building end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('building')) or (colPickMode==1 and !item.containsKey('building'))">
when a.id=#{item.id} then #{item.building}
</when>
<when test="(colPickMode==0 and item.containsKey('buildingIncrement')) or (colPickMode==1 and !item.containsKey('buildingIncrement'))">
when a.id=#{item.id} then ifnull(a.building,0) + #{item.buildingIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="logoPath=(case" suffix="ELSE logoPath end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('logoPath')) or (colPickMode==1 and !item.containsKey('logoPath'))">
when a.id=#{item.id} then #{item.logoPath}
</if>
</foreach>
</trim>
<trim prefix="englishName=(case" suffix="ELSE englishName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('englishName')) or (colPickMode==1 and !item.containsKey('englishName'))">
when a.id=#{item.id} then #{item.englishName}
</if>
</foreach>
</trim>
<trim prefix="leadingOfficial=(case" suffix="ELSE leadingOfficial end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('leadingOfficial')) or (colPickMode==1 and !item.containsKey('leadingOfficial'))">
when a.id=#{item.id} then #{item.leadingOfficial}
</if>
</foreach>
</trim>
<trim prefix="leadingOfficialTelephone=(case" suffix="ELSE leadingOfficialTelephone end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('leadingOfficialTelephone')) or (colPickMode==1 and !item.containsKey('leadingOfficialTelephone'))">
when a.id=#{item.id} then #{item.leadingOfficialTelephone}
</if>
</foreach>
</trim>
<trim prefix="modelIds=(case" suffix="ELSE modelIds end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('modelIds')) or (colPickMode==1 and !item.containsKey('modelIds'))">
when a.id=#{item.id} then #{item.modelIds}
</if>
</foreach>
</trim>
<trim prefix="createTime=(case" suffix="ELSE createTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
when a.id=#{item.id} then #{item.createTime}
</if>
</foreach>
</trim>
<trim prefix="createUserId=(case" suffix="ELSE createUserId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('createUserId')) or (colPickMode==1 and !item.containsKey('createUserId'))">
when a.id=#{item.id} then #{item.createUserId}
</when>
<when test="(colPickMode==0 and item.containsKey('createUserIdIncrement')) or (colPickMode==1 and !item.containsKey('createUserIdIncrement'))">
when a.id=#{item.id} then ifnull(a.createUserId,0) + #{item.createUserIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
when a.id=#{item.id} then #{item.updateTime}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
#{item.id}
</foreach>
</update>
<!-- 根据主健查询 -->
<select id="getByKey" parameterType="paramDto" resultMap="SiteEntity-Map">
select <include refid="_columns"/>
from mortals_sys_site as a
where a.id=#{condition.id}
</select>
<!-- 根据主健删除 -->
<delete id="deleteByKey" parameterType="paramDto">
delete a.* from mortals_sys_site as a where a.id=#{condition.id}
</delete>
<!-- 根据主健删除一批,针对单一主健有效 -->
<delete id="deleteByKeys">
delete from mortals_sys_site where id in
<foreach collection="array" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据paramDto删除一批 -->
<delete id="deleteByMap" parameterType="paramDto">
delete a.* from mortals_sys_site as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</delete>
<!-- 获取列表 -->
<select id="getList" parameterType="paramDto" resultMap="SiteEntity-Map">
select <include refid="_columns"/>
from mortals_sys_site as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int">
select count(1)
from mortals_sys_site as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</select>
<!-- 条件映射 -->
<sql id="_condition_">
<if test="condition != null and !condition.isEmpty()">
<!-- 条件映射-普通条件 -->
<include refid="_condition_param_">
<property name="_conditionParam_" value="condition"/>
<property name="_conditionType_" value="and"/>
</include>
<!-- 条件映射-集合之间使用AND,集合中元素使用OR-(list[0].1 or list[0].2) and (list[1].3 or list[1].4) -->
<if test="condition.containsKey('andConditionList') and !condition.andConditionList.isEmpty()">
and
<foreach collection="condition.andConditionList" open="(" close=")" index="index" item="andCondition" separator=" and ">
<trim prefixOverrides="or" prefix="(" suffix=")">
<include refid="_condition_param_">
<property name="_conditionParam_" value="andCondition"/>
<property name="_conditionType_" value="or"/>
</include>
</trim>
</foreach>
</if>
<!-- 条件映射-集合之间使用OR,集合中元素使用AND-(list[0].1 and list[0].2) or (list[1].3 and list[1].4) -->
<if test="condition.containsKey('orConditionList') and !condition.orConditionList.isEmpty()">
and
<foreach collection="condition.orConditionList" open="(" close=")" index="index" item="orCondition" separator=" or ">
<trim prefixOverrides="and" prefix="(" suffix=")">
<include refid="_condition_param_">
<property name="_conditionParam_" value="orCondition"/>
<property name="_conditionType_" value="and"/>
</include>
</trim>
</foreach>
</if>
</if>
</sql>
<!-- 条件映射-代参数 -->
<sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id}
</if>
</if>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null ">
${_conditionType_} a.id = #{${_conditionParam_}.id}
</if>
<if test="conditionParamRef.id == null">
${_conditionType_} a.id is null
</if>
</if>
<if test="conditionParamRef.containsKey('idList')">
${_conditionType_} a.id in
<foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null">
${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart}
</if>
<if test="conditionParamRef.containsKey('idEnd') and conditionParamRef.idEnd != null">
${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd}
</if>
<if test="conditionParamRef.containsKey('siteName')">
<if test="conditionParamRef.siteName != null and conditionParamRef.siteName != ''">
${_conditionType_} a.siteName like #{${_conditionParam_}.siteName}
</if>
<if test="conditionParamRef.siteName == null">
${_conditionType_} a.siteName is null
</if>
</if>
<if test="conditionParamRef.containsKey('siteNameList')">
${_conditionType_} a.siteName in
<foreach collection="conditionParamRef.siteNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('siteCode')">
<if test="conditionParamRef.siteCode != null and conditionParamRef.siteCode != ''">
${_conditionType_} a.siteCode like #{${_conditionParam_}.siteCode}
</if>
<if test="conditionParamRef.siteCode == null">
${_conditionType_} a.siteCode is null
</if>
</if>
<if test="conditionParamRef.containsKey('siteCodeList')">
${_conditionType_} a.siteCode in
<foreach collection="conditionParamRef.siteCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('areaID')">
<if test="conditionParamRef.areaID != null and conditionParamRef.areaID != ''">
${_conditionType_} a.areaID like #{${_conditionParam_}.areaID}
</if>
<if test="conditionParamRef.areaID == null">
${_conditionType_} a.areaID is null
</if>
</if>
<if test="conditionParamRef.containsKey('areaIDList')">
${_conditionType_} a.areaID in
<foreach collection="conditionParamRef.areaIDList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('areaCode')">
<if test="conditionParamRef.areaCode != null and conditionParamRef.areaCode != ''">
${_conditionType_} a.areaCode like #{${_conditionParam_}.areaCode}
</if>
<if test="conditionParamRef.areaCode == null">
${_conditionType_} a.areaCode is null
</if>
</if>
<if test="conditionParamRef.containsKey('areaCodeList')">
${_conditionType_} a.areaCode in
<foreach collection="conditionParamRef.areaCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('areaName')">
<if test="conditionParamRef.areaName != null and conditionParamRef.areaName != ''">
${_conditionType_} a.areaName like #{${_conditionParam_}.areaName}
</if>
<if test="conditionParamRef.areaName == null">
${_conditionType_} a.areaName is null
</if>
</if>
<if test="conditionParamRef.containsKey('areaNameList')">
${_conditionType_} a.areaName in
<foreach collection="conditionParamRef.areaNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('proCode')">
<if test="conditionParamRef.proCode != null and conditionParamRef.proCode != ''">
${_conditionType_} a.proCode like #{${_conditionParam_}.proCode}
</if>
<if test="conditionParamRef.proCode == null">
${_conditionType_} a.proCode is null
</if>
</if>
<if test="conditionParamRef.containsKey('proCodeList')">
${_conditionType_} a.proCode in
<foreach collection="conditionParamRef.proCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('cityCode')">
<if test="conditionParamRef.cityCode != null and conditionParamRef.cityCode != ''">
${_conditionType_} a.cityCode like #{${_conditionParam_}.cityCode}
</if>
<if test="conditionParamRef.cityCode == null">
${_conditionType_} a.cityCode is null
</if>
</if>
<if test="conditionParamRef.containsKey('cityCodeList')">
${_conditionType_} a.cityCode in
<foreach collection="conditionParamRef.cityCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('districtCode')">
<if test="conditionParamRef.districtCode != null and conditionParamRef.districtCode != ''">
${_conditionType_} a.districtCode like #{${_conditionParam_}.districtCode}
</if>
<if test="conditionParamRef.districtCode == null">
${_conditionType_} a.districtCode is null
</if>
</if>
<if test="conditionParamRef.containsKey('districtCodeList')">
${_conditionType_} a.districtCode in
<foreach collection="conditionParamRef.districtCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('siteIp')">
<if test="conditionParamRef.siteIp != null and conditionParamRef.siteIp != ''">
${_conditionType_} a.siteIp like #{${_conditionParam_}.siteIp}
</if>
<if test="conditionParamRef.siteIp == null">
${_conditionType_} a.siteIp is null
</if>
</if>
<if test="conditionParamRef.containsKey('siteIpList')">
${_conditionType_} a.siteIp in
<foreach collection="conditionParamRef.siteIpList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('sitePort')">
<if test="conditionParamRef.sitePort != null and conditionParamRef.sitePort != ''">
${_conditionType_} a.sitePort like #{${_conditionParam_}.sitePort}
</if>
<if test="conditionParamRef.sitePort == null">
${_conditionType_} a.sitePort is null
</if>
</if>
<if test="conditionParamRef.containsKey('sitePortList')">
${_conditionType_} a.sitePort in
<foreach collection="conditionParamRef.sitePortList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('longitude')">
<if test="conditionParamRef.longitude != null and conditionParamRef.longitude != ''">
${_conditionType_} a.longitude like #{${_conditionParam_}.longitude}
</if>
<if test="conditionParamRef.longitude == null">
${_conditionType_} a.longitude is null
</if>
</if>
<if test="conditionParamRef.containsKey('longitudeList')">
${_conditionType_} a.longitude in
<foreach collection="conditionParamRef.longitudeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('latitude')">
<if test="conditionParamRef.latitude != null and conditionParamRef.latitude != ''">
${_conditionType_} a.latitude like #{${_conditionParam_}.latitude}
</if>
<if test="conditionParamRef.latitude == null">
${_conditionType_} a.latitude is null
</if>
</if>
<if test="conditionParamRef.containsKey('latitudeList')">
${_conditionType_} a.latitude in
<foreach collection="conditionParamRef.latitudeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('siteTel')">
<if test="conditionParamRef.siteTel != null and conditionParamRef.siteTel != ''">
${_conditionType_} a.siteTel like #{${_conditionParam_}.siteTel}
</if>
<if test="conditionParamRef.siteTel == null">
${_conditionType_} a.siteTel is null
</if>
</if>
<if test="conditionParamRef.containsKey('siteTelList')">
${_conditionType_} a.siteTel in
<foreach collection="conditionParamRef.siteTelList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('detailAddress')">
<if test="conditionParamRef.detailAddress != null and conditionParamRef.detailAddress != ''">
${_conditionType_} a.detailAddress like #{${_conditionParam_}.detailAddress}
</if>
<if test="conditionParamRef.detailAddress == null">
${_conditionType_} a.detailAddress is null
</if>
</if>
<if test="conditionParamRef.containsKey('detailAddressList')">
${_conditionType_} a.detailAddress in
<foreach collection="conditionParamRef.detailAddressList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('siteRemark')">
<if test="conditionParamRef.siteRemark != null and conditionParamRef.siteRemark != ''">
${_conditionType_} a.siteRemark like #{${_conditionParam_}.siteRemark}
</if>
<if test="conditionParamRef.siteRemark == null">
${_conditionType_} a.siteRemark is null
</if>
</if>
<if test="conditionParamRef.containsKey('siteRemarkList')">
${_conditionType_} a.siteRemark in
<foreach collection="conditionParamRef.siteRemarkList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('amWorkStartTime')">
<if test="conditionParamRef.amWorkStartTime != null ">
${_conditionType_} a.amWorkStartTime = #{${_conditionParam_}.amWorkStartTime}
</if>
<if test="conditionParamRef.amWorkStartTime == null">
${_conditionType_} a.amWorkStartTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('amWorkStartTimeStart') and conditionParamRef.amWorkStartTimeStart != null and conditionParamRef.amWorkStartTimeStart!=''">
${_conditionType_} a.amWorkStartTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.amWorkStartTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('amWorkStartTimeEnd') and conditionParamRef.amWorkStartTimeEnd != null and conditionParamRef.amWorkStartTimeEnd!=''">
${_conditionType_} a.amWorkStartTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.amWorkStartTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('amWorkEndTime')">
<if test="conditionParamRef.amWorkEndTime != null ">
${_conditionType_} a.amWorkEndTime = #{${_conditionParam_}.amWorkEndTime}
</if>
<if test="conditionParamRef.amWorkEndTime == null">
${_conditionType_} a.amWorkEndTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('amWorkEndTimeStart') and conditionParamRef.amWorkEndTimeStart != null and conditionParamRef.amWorkEndTimeStart!=''">
${_conditionType_} a.amWorkEndTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.amWorkEndTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('amWorkEndTimeEnd') and conditionParamRef.amWorkEndTimeEnd != null and conditionParamRef.amWorkEndTimeEnd!=''">
${_conditionType_} a.amWorkEndTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.amWorkEndTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('pmWorkStartTime')">
<if test="conditionParamRef.pmWorkStartTime != null ">
${_conditionType_} a.pmWorkStartTime = #{${_conditionParam_}.pmWorkStartTime}
</if>
<if test="conditionParamRef.pmWorkStartTime == null">
${_conditionType_} a.pmWorkStartTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('pmWorkStartTimeStart') and conditionParamRef.pmWorkStartTimeStart != null and conditionParamRef.pmWorkStartTimeStart!=''">
${_conditionType_} a.pmWorkStartTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.pmWorkStartTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('pmWorkStartTimeEnd') and conditionParamRef.pmWorkStartTimeEnd != null and conditionParamRef.pmWorkStartTimeEnd!=''">
${_conditionType_} a.pmWorkStartTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.pmWorkStartTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('pmWorkEndTime')">
<if test="conditionParamRef.pmWorkEndTime != null ">
${_conditionType_} a.pmWorkEndTime = #{${_conditionParam_}.pmWorkEndTime}
</if>
<if test="conditionParamRef.pmWorkEndTime == null">
${_conditionType_} a.pmWorkEndTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('pmWorkEndTimeStart') and conditionParamRef.pmWorkEndTimeStart != null and conditionParamRef.pmWorkEndTimeStart!=''">
${_conditionType_} a.pmWorkEndTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.pmWorkEndTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('pmWorkEndTimeEnd') and conditionParamRef.pmWorkEndTimeEnd != null and conditionParamRef.pmWorkEndTimeEnd!=''">
${_conditionType_} a.pmWorkEndTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.pmWorkEndTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('workday1')">
<if test="conditionParamRef.workday1 != null ">
${_conditionType_} a.workday1 = #{${_conditionParam_}.workday1}
</if>
<if test="conditionParamRef.workday1 == null">
${_conditionType_} a.workday1 is null
</if>
</if>
<if test="conditionParamRef.containsKey('workday1List')">
${_conditionType_} a.workday1 in
<foreach collection="conditionParamRef.workday1List" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('workday1Start') and conditionParamRef.workday1Start != null">
${_conditionType_} a.workday1 <![CDATA[ >= ]]> #{${_conditionParam_}.workday1Start}
</if>
<if test="conditionParamRef.containsKey('workday1End') and conditionParamRef.workday1End != null">
${_conditionType_} a.workday1 <![CDATA[ <= ]]> #{${_conditionParam_}.workday1End}
</if>
<if test="conditionParamRef.containsKey('workday2')">
<if test="conditionParamRef.workday2 != null ">
${_conditionType_} a.workday2 = #{${_conditionParam_}.workday2}
</if>
<if test="conditionParamRef.workday2 == null">
${_conditionType_} a.workday2 is null
</if>
</if>
<if test="conditionParamRef.containsKey('workday2List')">
${_conditionType_} a.workday2 in
<foreach collection="conditionParamRef.workday2List" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('workday2Start') and conditionParamRef.workday2Start != null">
${_conditionType_} a.workday2 <![CDATA[ >= ]]> #{${_conditionParam_}.workday2Start}
</if>
<if test="conditionParamRef.containsKey('workday2End') and conditionParamRef.workday2End != null">
${_conditionType_} a.workday2 <![CDATA[ <= ]]> #{${_conditionParam_}.workday2End}
</if>
<if test="conditionParamRef.containsKey('workday3')">
<if test="conditionParamRef.workday3 != null ">
${_conditionType_} a.workday3 = #{${_conditionParam_}.workday3}
</if>
<if test="conditionParamRef.workday3 == null">
${_conditionType_} a.workday3 is null
</if>
</if>
<if test="conditionParamRef.containsKey('workday3List')">
${_conditionType_} a.workday3 in
<foreach collection="conditionParamRef.workday3List" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('workday3Start') and conditionParamRef.workday3Start != null">
${_conditionType_} a.workday3 <![CDATA[ >= ]]> #{${_conditionParam_}.workday3Start}
</if>
<if test="conditionParamRef.containsKey('workday3End') and conditionParamRef.workday3End != null">
${_conditionType_} a.workday3 <![CDATA[ <= ]]> #{${_conditionParam_}.workday3End}
</if>
<if test="conditionParamRef.containsKey('workday4')">
<if test="conditionParamRef.workday4 != null ">
${_conditionType_} a.workday4 = #{${_conditionParam_}.workday4}
</if>
<if test="conditionParamRef.workday4 == null">
${_conditionType_} a.workday4 is null
</if>
</if>
<if test="conditionParamRef.containsKey('workday4List')">
${_conditionType_} a.workday4 in
<foreach collection="conditionParamRef.workday4List" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('workday4Start') and conditionParamRef.workday4Start != null">
${_conditionType_} a.workday4 <![CDATA[ >= ]]> #{${_conditionParam_}.workday4Start}
</if>
<if test="conditionParamRef.containsKey('workday4End') and conditionParamRef.workday4End != null">
${_conditionType_} a.workday4 <![CDATA[ <= ]]> #{${_conditionParam_}.workday4End}
</if>
<if test="conditionParamRef.containsKey('workday5')">
<if test="conditionParamRef.workday5 != null ">
${_conditionType_} a.workday5 = #{${_conditionParam_}.workday5}
</if>
<if test="conditionParamRef.workday5 == null">
${_conditionType_} a.workday5 is null
</if>
</if>
<if test="conditionParamRef.containsKey('workday5List')">
${_conditionType_} a.workday5 in
<foreach collection="conditionParamRef.workday5List" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('workday5Start') and conditionParamRef.workday5Start != null">
${_conditionType_} a.workday5 <![CDATA[ >= ]]> #{${_conditionParam_}.workday5Start}
</if>
<if test="conditionParamRef.containsKey('workday5End') and conditionParamRef.workday5End != null">
${_conditionType_} a.workday5 <![CDATA[ <= ]]> #{${_conditionParam_}.workday5End}
</if>
<if test="conditionParamRef.containsKey('workday6')">
<if test="conditionParamRef.workday6 != null ">
${_conditionType_} a.workday6 = #{${_conditionParam_}.workday6}
</if>
<if test="conditionParamRef.workday6 == null">
${_conditionType_} a.workday6 is null
</if>
</if>
<if test="conditionParamRef.containsKey('workday6List')">
${_conditionType_} a.workday6 in
<foreach collection="conditionParamRef.workday6List" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('workday6Start') and conditionParamRef.workday6Start != null">
${_conditionType_} a.workday6 <![CDATA[ >= ]]> #{${_conditionParam_}.workday6Start}
</if>
<if test="conditionParamRef.containsKey('workday6End') and conditionParamRef.workday6End != null">
${_conditionType_} a.workday6 <![CDATA[ <= ]]> #{${_conditionParam_}.workday6End}
</if>
<if test="conditionParamRef.containsKey('workday7')">
<if test="conditionParamRef.workday7 != null ">
${_conditionType_} a.workday7 = #{${_conditionParam_}.workday7}
</if>
<if test="conditionParamRef.workday7 == null">
${_conditionType_} a.workday7 is null
</if>
</if>
<if test="conditionParamRef.containsKey('workday7List')">
${_conditionType_} a.workday7 in
<foreach collection="conditionParamRef.workday7List" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('workday7Start') and conditionParamRef.workday7Start != null">
${_conditionType_} a.workday7 <![CDATA[ >= ]]> #{${_conditionParam_}.workday7Start}
</if>
<if test="conditionParamRef.containsKey('workday7End') and conditionParamRef.workday7End != null">
${_conditionType_} a.workday7 <![CDATA[ <= ]]> #{${_conditionParam_}.workday7End}
</if>
<if test="conditionParamRef.containsKey('level')">
<if test="conditionParamRef.level != null ">
${_conditionType_} a.level = #{${_conditionParam_}.level}
</if>
<if test="conditionParamRef.level == null">
${_conditionType_} a.level is null
</if>
</if>
<if test="conditionParamRef.containsKey('levelList')">
${_conditionType_} a.level in
<foreach collection="conditionParamRef.levelList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('levelStart') and conditionParamRef.levelStart != null">
${_conditionType_} a.level <![CDATA[ >= ]]> #{${_conditionParam_}.levelStart}
</if>
<if test="conditionParamRef.containsKey('levelEnd') and conditionParamRef.levelEnd != null">
${_conditionType_} a.level <![CDATA[ <= ]]> #{${_conditionParam_}.levelEnd}
</if>
<if test="conditionParamRef.containsKey('building')">
<if test="conditionParamRef.building != null ">
${_conditionType_} a.building = #{${_conditionParam_}.building}
</if>
<if test="conditionParamRef.building == null">
${_conditionType_} a.building is null
</if>
</if>
<if test="conditionParamRef.containsKey('buildingList')">
${_conditionType_} a.building in
<foreach collection="conditionParamRef.buildingList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('buildingStart') and conditionParamRef.buildingStart != null">
${_conditionType_} a.building <![CDATA[ >= ]]> #{${_conditionParam_}.buildingStart}
</if>
<if test="conditionParamRef.containsKey('buildingEnd') and conditionParamRef.buildingEnd != null">
${_conditionType_} a.building <![CDATA[ <= ]]> #{${_conditionParam_}.buildingEnd}
</if>
<if test="conditionParamRef.containsKey('logoPath')">
<if test="conditionParamRef.logoPath != null and conditionParamRef.logoPath != ''">
${_conditionType_} a.logoPath like #{${_conditionParam_}.logoPath}
</if>
<if test="conditionParamRef.logoPath == null">
${_conditionType_} a.logoPath is null
</if>
</if>
<if test="conditionParamRef.containsKey('logoPathList')">
${_conditionType_} a.logoPath in
<foreach collection="conditionParamRef.logoPathList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('englishName')">
<if test="conditionParamRef.englishName != null and conditionParamRef.englishName != ''">
${_conditionType_} a.englishName like #{${_conditionParam_}.englishName}
</if>
<if test="conditionParamRef.englishName == null">
${_conditionType_} a.englishName is null
</if>
</if>
<if test="conditionParamRef.containsKey('englishNameList')">
${_conditionType_} a.englishName in
<foreach collection="conditionParamRef.englishNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('leadingOfficial')">
<if test="conditionParamRef.leadingOfficial != null and conditionParamRef.leadingOfficial != ''">
${_conditionType_} a.leadingOfficial like #{${_conditionParam_}.leadingOfficial}
</if>
<if test="conditionParamRef.leadingOfficial == null">
${_conditionType_} a.leadingOfficial is null
</if>
</if>
<if test="conditionParamRef.containsKey('leadingOfficialList')">
${_conditionType_} a.leadingOfficial in
<foreach collection="conditionParamRef.leadingOfficialList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('leadingOfficialTelephone')">
<if test="conditionParamRef.leadingOfficialTelephone != null and conditionParamRef.leadingOfficialTelephone != ''">
${_conditionType_} a.leadingOfficialTelephone like #{${_conditionParam_}.leadingOfficialTelephone}
</if>
<if test="conditionParamRef.leadingOfficialTelephone == null">
${_conditionType_} a.leadingOfficialTelephone is null
</if>
</if>
<if test="conditionParamRef.containsKey('leadingOfficialTelephoneList')">
${_conditionType_} a.leadingOfficialTelephone in
<foreach collection="conditionParamRef.leadingOfficialTelephoneList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('modelIds')">
<if test="conditionParamRef.modelIds != null and conditionParamRef.modelIds != ''">
${_conditionType_} a.modelIds like #{${_conditionParam_}.modelIds}
</if>
<if test="conditionParamRef.modelIds == null">
${_conditionType_} a.modelIds is null
</if>
</if>
<if test="conditionParamRef.containsKey('modelIdsList')">
${_conditionType_} a.modelIds in
<foreach collection="conditionParamRef.modelIdsList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createTime')">
<if test="conditionParamRef.createTime != null ">
${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
</if>
<if test="conditionParamRef.createTime == null">
${_conditionType_} a.createTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('createTimeStart') and conditionParamRef.createTimeStart != null and conditionParamRef.createTimeStart!=''">
${_conditionType_} a.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('createUserId')">
<if test="conditionParamRef.createUserId != null ">
${_conditionType_} a.createUserId = #{${_conditionParam_}.createUserId}
</if>
<if test="conditionParamRef.createUserId == null">
${_conditionType_} a.createUserId is null
</if>
</if>
<if test="conditionParamRef.containsKey('createUserIdList')">
${_conditionType_} a.createUserId in
<foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createUserIdStart') and conditionParamRef.createUserIdStart != null">
${_conditionType_} a.createUserId <![CDATA[ >= ]]> #{${_conditionParam_}.createUserIdStart}
</if>
<if test="conditionParamRef.containsKey('createUserIdEnd') and conditionParamRef.createUserIdEnd != null">
${_conditionType_} a.createUserId <![CDATA[ <= ]]> #{${_conditionParam_}.createUserIdEnd}
</if>
<if test="conditionParamRef.containsKey('updateTime')">
<if test="conditionParamRef.updateTime != null ">
${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
</if>
<if test="conditionParamRef.updateTime == null">
${_conditionType_} a.updateTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
order by
<trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
${item.colName} ${item.sortKind}
</foreach>
</trim>
</if>
<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
order by
<trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')">
a.id
<if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('siteName')">
a.siteName
<if test='orderCol.siteName != null and "DESC".equalsIgnoreCase(orderCol.siteName)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('siteCode')">
a.siteCode
<if test='orderCol.siteCode != null and "DESC".equalsIgnoreCase(orderCol.siteCode)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('areaID')">
a.areaID
<if test='orderCol.areaID != null and "DESC".equalsIgnoreCase(orderCol.areaID)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('areaCode')">
a.areaCode
<if test='orderCol.areaCode != null and "DESC".equalsIgnoreCase(orderCol.areaCode)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('areaName')">
a.areaName
<if test='orderCol.areaName != null and "DESC".equalsIgnoreCase(orderCol.areaName)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('proCode')">
a.proCode
<if test='orderCol.proCode != null and "DESC".equalsIgnoreCase(orderCol.proCode)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('cityCode')">
a.cityCode
<if test='orderCol.cityCode != null and "DESC".equalsIgnoreCase(orderCol.cityCode)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('districtCode')">
a.districtCode
<if test='orderCol.districtCode != null and "DESC".equalsIgnoreCase(orderCol.districtCode)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('siteIp')">
a.siteIp
<if test='orderCol.siteIp != null and "DESC".equalsIgnoreCase(orderCol.siteIp)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('sitePort')">
a.sitePort
<if test='orderCol.sitePort != null and "DESC".equalsIgnoreCase(orderCol.sitePort)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('longitude')">
a.longitude
<if test='orderCol.longitude != null and "DESC".equalsIgnoreCase(orderCol.longitude)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('latitude')">
a.latitude
<if test='orderCol.latitude != null and "DESC".equalsIgnoreCase(orderCol.latitude)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('siteTel')">
a.siteTel
<if test='orderCol.siteTel != null and "DESC".equalsIgnoreCase(orderCol.siteTel)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('detailAddress')">
a.detailAddress
<if test='orderCol.detailAddress != null and "DESC".equalsIgnoreCase(orderCol.detailAddress)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('siteRemark')">
a.siteRemark
<if test='orderCol.siteRemark != null and "DESC".equalsIgnoreCase(orderCol.siteRemark)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('amWorkStartTime')">
a.amWorkStartTime
<if test='orderCol.amWorkStartTime != null and "DESC".equalsIgnoreCase(orderCol.amWorkStartTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('amWorkEndTime')">
a.amWorkEndTime
<if test='orderCol.amWorkEndTime != null and "DESC".equalsIgnoreCase(orderCol.amWorkEndTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('pmWorkStartTime')">
a.pmWorkStartTime
<if test='orderCol.pmWorkStartTime != null and "DESC".equalsIgnoreCase(orderCol.pmWorkStartTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('pmWorkEndTime')">
a.pmWorkEndTime
<if test='orderCol.pmWorkEndTime != null and "DESC".equalsIgnoreCase(orderCol.pmWorkEndTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('workday1')">
a.workday1
<if test='orderCol.workday1 != null and "DESC".equalsIgnoreCase(orderCol.workday1)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('workday2')">
a.workday2
<if test='orderCol.workday2 != null and "DESC".equalsIgnoreCase(orderCol.workday2)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('workday3')">
a.workday3
<if test='orderCol.workday3 != null and "DESC".equalsIgnoreCase(orderCol.workday3)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('workday4')">
a.workday4
<if test='orderCol.workday4 != null and "DESC".equalsIgnoreCase(orderCol.workday4)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('workday5')">
a.workday5
<if test='orderCol.workday5 != null and "DESC".equalsIgnoreCase(orderCol.workday5)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('workday6')">
a.workday6
<if test='orderCol.workday6 != null and "DESC".equalsIgnoreCase(orderCol.workday6)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('workday7')">
a.workday7
<if test='orderCol.workday7 != null and "DESC".equalsIgnoreCase(orderCol.workday7)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('level')">
a.level
<if test='orderCol.level != null and "DESC".equalsIgnoreCase(orderCol.level)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('building')">
a.building
<if test='orderCol.building != null and "DESC".equalsIgnoreCase(orderCol.building)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('logoPath')">
a.logoPath
<if test='orderCol.logoPath != null and "DESC".equalsIgnoreCase(orderCol.logoPath)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('englishName')">
a.englishName
<if test='orderCol.englishName != null and "DESC".equalsIgnoreCase(orderCol.englishName)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('leadingOfficial')">
a.leadingOfficial
<if test='orderCol.leadingOfficial != null and "DESC".equalsIgnoreCase(orderCol.leadingOfficial)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('leadingOfficialTelephone')">
a.leadingOfficialTelephone
<if test='orderCol.leadingOfficialTelephone != null and "DESC".equalsIgnoreCase(orderCol.leadingOfficialTelephone)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('modelIds')">
a.modelIds
<if test='orderCol.modelIds != null and "DESC".equalsIgnoreCase(orderCol.modelIds)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createTime')">
a.createTime
<if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createUserId')">
a.createUserId
<if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('updateTime')">
a.updateTime
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
</trim>
</if>
</sql>
<sql id="_group_by_">
<if test="groupList != null and !groupList.isEmpty()">
GROUP BY
<trim suffixOverrides="," suffix="">
<foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
${item}
</foreach>
</trim>
</if>
</sql>
</mapper>
\ No newline at end of file
...@@ -119,7 +119,8 @@ Content-Type: application/json ...@@ -119,7 +119,8 @@ Content-Type: application/json
"defectsLiabilityPeriod": "2022-06-30 15:00:01", "defectsLiabilityPeriod": "2022-06-30 15:00:01",
"leadingOfficial": "张三", "leadingOfficial": "张三",
"leadingOfficialTelephone": "13281114856", "leadingOfficialTelephone": "13281114856",
"source": 1 "source": 1,
"active": 1
} }
###设备新增 ###设备新增
...@@ -158,7 +159,7 @@ Content-Type: application/json ...@@ -158,7 +159,7 @@ Content-Type: application/json
Authorization: {{authToken}} Authorization: {{authToken}}
{ {
"deviceCode": "70-4A-0E-BC-EE-8A", "deviceCode": "a109",
"action": "upload" "action": "upload"
} }
......
...@@ -24,7 +24,12 @@ Content-Type: application/json ...@@ -24,7 +24,12 @@ Content-Type: application/json
{} {}
###站点树
GET {{baseUrl}}/site/siteTree
Authorization: {{authToken}}
Content-Type: application/json
{}
###短信设置编辑 ###短信设置编辑
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment