src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -325,34 +325,54 @@ } else { licences = ""; } if (information.getEstablishtime() != null && !"".equals(information.getEstablishtime())) { format = new SimpleDateFormat("yyyy-MM-dd").format(information.getEstablishtime()); //内网同步 String s1 = "update sys_information set creditCode = " + "'" + information.getCreditcode() + "'" + ",enterpriseName = " + "'" + information.getEnterprisename() + "'" + ",representative = " + "'" + information.getRepresentative() + "'" + ",establishTime = " + "'" + format + "'" + ",registeredCapital = " + "'" + information.getRegisteredcapital() + "'" + ",jurisdiction = " + "'" + information.getJurisdiction() + "'" + ",enterprises = " + "'" + information.getEnterprises() + "'" + ",address = " + "'" + information.getAddress() + "'" + ",business = " + "'" + information.getBusiness() + "'" + ",region = " + "'" + information.getRegion() + "'" + ",registration = " + "'" + information.getRegistration() + "'" + ",industry = " + "'" + information.getIndustry() + "'" + ",departmentid = " + "'" + information.getDepartmentid() + "'" + ",stats = " + "'" + information.getStats() + "'" + ",representativecell = " + "'" + information.getRepresentativecell() + "'" + ",contacts = " + "'" + information.getContacts() + "'" + ",contactscell = " + "'" + information.getContactscell() + "'" + ",business_License = " + "'" + businessLicenses + "'" + ",licence = " + "'" + licences + "'" + " " + "where id = " + "'" + information.getId() + "'"; }else { //内网同步 String s1 = "update sys_information set creditCode = " + "'" + information.getCreditcode() + "'" + ",enterpriseName = " + "'" + information.getEnterprisename() + "'" + ",representative = " + "'" + information.getRepresentative() + "'" + ",registeredCapital = " + "'" + information.getRegisteredcapital() + "'" + ",jurisdiction = " + "'" + information.getJurisdiction() + "'" + ",enterprises = " + "'" + information.getEnterprises() + "'" + ",address = " + "'" + information.getAddress() + "'" + ",business = " + "'" + information.getBusiness() + "'" + ",region = " + "'" + information.getRegion() + "'" + ",registration = " + "'" + information.getRegistration() + "'" + ",industry = " + "'" + information.getIndustry() + "'" + ",departmentid = " + "'" + information.getDepartmentid() + "'" + ",stats = " + "'" + information.getStats() + "'" + ",representativecell = " + "'" + information.getRepresentativecell() + "'" + ",contacts = " + "'" + information.getContacts() + "'" + ",contactscell = " + "'" + information.getContactscell() + "'" + ",business_License = " + "'" + businessLicenses + "'" + ",licence = " + "'" + licences + "'" + " " + "where id = " + "'" + information.getId() + "'"; //FtpUtil.sqlFileUpload(s1); myAsyncService.FTP(s1); } //内网同步 String s1 = "update sys_information set creditCode = " + "'" + information.getCreditcode() + "'" + ",enterpriseName = " + "'" + information.getEnterprisename() + "'" + ",representative = " + "'" + information.getRepresentative() + "'" + ",establishTime = " + "'" + format + "'" + ",registeredCapital = " + "'" + information.getRegisteredcapital() + "'" + ",jurisdiction = " + "'" + information.getJurisdiction() + "'" + ",enterprises = " + "'" + information.getEnterprises() + "'" + ",address = " + "'" + information.getAddress() + "'" + ",business = " + "'" + information.getBusiness() + "'" + ",region = " + "'" + information.getRegion() + "'" + ",registration = " + "'" + information.getRegistration() + "'" + ",industry = " + "'" + information.getIndustry() + "'" + ",departmentid = " + "'" + information.getDepartmentid() + "'" + ",stats = " + "'" + information.getStats() + "'" + ",representativecell = " + "'" + information.getRepresentativecell() + "'" + ",contacts = " + "'" + information.getContacts() + "'" + ",contactscell = " + "'" + information.getContactscell() + "'" + ",business_License = " + "'" + businessLicenses + "'" + ",licence = " + "'" + licences + "'" + " " + "where id = " + "'" + information.getId() + "'"; //FtpUtil.sqlFileUpload(s1); myAsyncService.FTP(s1); } return R.success("修改成功"); } src/main/java/org/springblade/modules/permit/controller/PermitController.java
@@ -200,7 +200,6 @@ "'" + permit.getRepresentativecell() + "'" + "," + "'" + permit.getContacts() + "'" + "," + "'" + permit.getContactscell() + "'" + "," + "'" + permit.getJurisdiction() + "'" + "," + "'" + permit.getCardid() + "'" + "," + "'" + overtime + "'" + ")"; //FtpUtil.sqlFileUpload(s); myAsyncService.FTP(s); return R.success("许可提交成功"); } src/main/java/org/springblade/modules/rabbitmq/config/MQConfig.java
@@ -1,64 +1,64 @@ package org.springblade.modules.rabbitmq.config; import org.springframework.amqp.core.*; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * rabbitmq 配置文件 * @author zhongrj * @since 2022-04-08 */ @Configuration public class MQConfig { public static final String QUEUE = "queue"; public static final String TOPIC_QUEUE1= "topic.queue1"; public static final String TOPIC_QUEUE2 = "topic.queue2"; public static final String TOPIC_EXCHANGE = "topicExchange"; public static final String FANOUT_EXCHANGE = "fanoutxchage"; public static final String TASK_QUEUE = "task_queue"; @Bean public Queue taskQueue(){ return new Queue(TASK_QUEUE,true); } //Direct模式 @Bean public Queue queue(){ return new Queue(QUEUE,true); } //topic交换机模式 @Bean public Queue topicQueue1(){ return new Queue(TOPIC_QUEUE1,true); } @Bean public Queue topicQueue2(){ return new Queue(TOPIC_QUEUE2,true); } @Bean public TopicExchange topicExchange(){ return new TopicExchange(TOPIC_EXCHANGE); } @Bean public Binding topicBinding1(){ return BindingBuilder.bind(topicQueue1()).to(topicExchange()).with("topic.key1"); } @Bean public Binding topicBinding2(){ return BindingBuilder.bind(topicQueue2()).to(topicExchange()).with("topic.#"); } //Fanout模式,广播模式 @Bean public FanoutExchange fanoutExchange(){ return new FanoutExchange(FANOUT_EXCHANGE); } } //package org.springblade.modules.rabbitmq.config; // //import org.springframework.amqp.core.*; //import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Configuration; // ///** // * rabbitmq 配置文件 // * @author zhongrj // * @since 2022-04-08 // */ //@Configuration //public class MQConfig { // public static final String QUEUE = "queue"; // public static final String TOPIC_QUEUE1= "topic.queue1"; // public static final String TOPIC_QUEUE2 = "topic.queue2"; // public static final String TOPIC_EXCHANGE = "topicExchange"; // public static final String FANOUT_EXCHANGE = "fanoutxchage"; // public static final String TASK_QUEUE = "task_queue"; // // @Bean // public Queue taskQueue(){ // return new Queue(TASK_QUEUE,true); // } // // //Direct模式 // @Bean // public Queue queue(){ // return new Queue(QUEUE,true); // } // // //topic交换机模式 // @Bean // public Queue topicQueue1(){ // return new Queue(TOPIC_QUEUE1,true); // } // // @Bean // public Queue topicQueue2(){ // return new Queue(TOPIC_QUEUE2,true); // } // // @Bean // public TopicExchange topicExchange(){ // return new TopicExchange(TOPIC_EXCHANGE); // } // // @Bean // public Binding topicBinding1(){ // return BindingBuilder.bind(topicQueue1()).to(topicExchange()).with("topic.key1"); // } // // @Bean // public Binding topicBinding2(){ // return BindingBuilder.bind(topicQueue2()).to(topicExchange()).with("topic.#"); // } // // //Fanout模式,广播模式 // // @Bean // public FanoutExchange fanoutExchange(){ // return new FanoutExchange(FANOUT_EXCHANGE); // } //} src/main/java/org/springblade/modules/rabbitmq/config/MQreceiver.java
@@ -1,34 +1,34 @@ package org.springblade.modules.rabbitmq.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.modules.rabbitmq.redis.RedisService; import org.springblade.modules.rabbitmq.vo.TaskMessage; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.data.redis.core.script.RedisScript; import org.springframework.stereotype.Service; /** * 队列消息接收 * @author zhongrj * @since 2022-04-12 */ @Service public class MQreceiver { private static Logger log = LoggerFactory.getLogger(MQreceiver.class); @RabbitListener(queues = MQConfig.TASK_QUEUE) public void receive(String message){ log.info("receive message:"+message); TaskMessage taskMessage = RedisService.stringToBean(message, TaskMessage.class); System.out.println("用户" + taskMessage.getManId() + "抢到了任务:"+ taskMessage.getTaskId()); } } //package org.springblade.modules.rabbitmq.config; // //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; //import org.springblade.modules.rabbitmq.redis.RedisService; //import org.springblade.modules.rabbitmq.vo.TaskMessage; //import org.springframework.amqp.rabbit.annotation.RabbitListener; //import org.springframework.data.redis.core.script.RedisScript; //import org.springframework.stereotype.Service; // ///** // * 队列消息接收 // * @author zhongrj // * @since 2022-04-12 // */ //@Service //public class MQreceiver { // // // private static Logger log = LoggerFactory.getLogger(MQreceiver.class); // // // @RabbitListener(queues = MQConfig.TASK_QUEUE) // public void receive(String message){ // // log.info("receive message:"+message); // // // TaskMessage taskMessage = RedisService.stringToBean(message, TaskMessage.class); // // System.out.println("用户" + taskMessage.getManId() + "抢到了任务:"+ taskMessage.getTaskId()); // // } //} src/main/java/org/springblade/modules/rabbitmq/config/MQsender.java
@@ -1,37 +1,37 @@ package org.springblade.modules.rabbitmq.config; import org.springblade.modules.rabbitmq.redis.RedisService; import org.springblade.modules.rabbitmq.vo.TaskMessage; import org.springframework.amqp.core.AmqpTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * 消息发送 * @author zhongrj * @since 2022-04-12 * */ @Service public class MQsender { @Autowired AmqpTemplate amqpTemplate; public void send(Object message){ String msg = RedisService.beanToString(message); amqpTemplate.convertAndSend(MQConfig.QUEUE,msg); } public void sendTaskMessage(TaskMessage message){ String msg = RedisService.beanToString(message); amqpTemplate.convertAndSend(MQConfig.TASK_QUEUE,msg); } public void sendTopic(Object message){ String msg = RedisService.beanToString(message); amqpTemplate.convertAndSend(MQConfig.TOPIC_EXCHANGE,"topic.key1",msg+"1"); } } //package org.springblade.modules.rabbitmq.config; // //import org.springblade.modules.rabbitmq.redis.RedisService; //import org.springblade.modules.rabbitmq.vo.TaskMessage; //import org.springframework.amqp.core.AmqpTemplate; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.stereotype.Service; // ///** // * 消息发送 // * @author zhongrj // * @since 2022-04-12 // * // */ //@Service //public class MQsender { // // @Autowired // AmqpTemplate amqpTemplate; // // // public void send(Object message){ // String msg = RedisService.beanToString(message); // amqpTemplate.convertAndSend(MQConfig.QUEUE,msg); // } // // public void sendTaskMessage(TaskMessage message){ // String msg = RedisService.beanToString(message); // amqpTemplate.convertAndSend(MQConfig.TASK_QUEUE,msg); // } // // public void sendTopic(Object message){ // String msg = RedisService.beanToString(message); // amqpTemplate.convertAndSend(MQConfig.TOPIC_EXCHANGE,"topic.key1",msg+"1"); // } // //} src/main/java/org/springblade/modules/rabbitmq/controller/SendMessageController.java
@@ -1,81 +1,81 @@ package org.springblade.modules.rabbitmq.controller; import lombok.AllArgsConstructor; import org.springblade.modules.rabbitmq.config.MQsender; import org.springblade.modules.rabbitmq.redis.TaskKey; import org.springblade.modules.rabbitmq.redis.RedisService; import org.springblade.modules.rabbitmq.vo.Man; import org.springblade.modules.rabbitmq.vo.Task; import org.springblade.modules.rabbitmq.vo.TaskMessage; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Random; /** * 消息发送 * @author zhongrj */ @RestController @AllArgsConstructor @RequestMapping("/rabbitmq") public class SendMessageController { private static int count = 0; private final MQsender mQsender; private final RedisService redisService; @GetMapping("/sendDirectMessage") public String sendDirectMessage() { String messageData = "test message, hello!"; mQsender.send(messageData); return "ok"; } /** * 模拟抢单 * @return */ @GetMapping("/createTask") public String createTask(Long id ,Integer num) { //创建任务 Task task = new Task(); task.setId(id); task.setNum(num); task.setTaskName("测试"); //将任务数量和对应的id 存入redis redisService.set(TaskKey.getTaskStock,""+task.getId(),task.getNum()); //返回 return "ok"; } /** * 模拟抢单(不同人员同时抢) * @return */ @GetMapping("/testSend") public String testSend(Long id) { //模拟创建人员 Man man = new Man(); man.setId(System.currentTimeMillis() + new Random().nextInt(1000000)); man.setUsername("task"+ count); // 预减库存 long stack = redisService.decr(TaskKey.getTaskStock,""+id); if (stack<0){ return "已结束"; } //入队列 TaskMessage taskMessage = new TaskMessage(); taskMessage.setTaskId(id); taskMessage.setManId(man.getId()); //发送消息 mQsender.sendTaskMessage(taskMessage); //返回 return "ok"; } } //package org.springblade.modules.rabbitmq.controller; // //import lombok.AllArgsConstructor; //import org.springblade.modules.rabbitmq.config.MQsender; //import org.springblade.modules.rabbitmq.redis.TaskKey; //import org.springblade.modules.rabbitmq.redis.RedisService; //import org.springblade.modules.rabbitmq.vo.Man; //import org.springblade.modules.rabbitmq.vo.Task; //import org.springblade.modules.rabbitmq.vo.TaskMessage; //import org.springframework.web.bind.annotation.GetMapping; //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RestController; // //import java.util.Random; // ///** // * 消息发送 // * @author zhongrj // */ //@RestController //@AllArgsConstructor //@RequestMapping("/rabbitmq") //public class SendMessageController { // // private static int count = 0; // // private final MQsender mQsender; // // private final RedisService redisService; // // // @GetMapping("/sendDirectMessage") // public String sendDirectMessage() { // String messageData = "test message, hello!"; // mQsender.send(messageData); // return "ok"; // } // // /** // * 模拟抢单 // * @return // */ // @GetMapping("/createTask") // public String createTask(Long id ,Integer num) { // //创建任务 // Task task = new Task(); // task.setId(id); // task.setNum(num); // task.setTaskName("测试"); // //将任务数量和对应的id 存入redis // redisService.set(TaskKey.getTaskStock,""+task.getId(),task.getNum()); // //返回 // return "ok"; // } // // // /** // * 模拟抢单(不同人员同时抢) // * @return // */ // @GetMapping("/testSend") // public String testSend(Long id) { // //模拟创建人员 // Man man = new Man(); // man.setId(System.currentTimeMillis() + new Random().nextInt(1000000)); // man.setUsername("task"+ count); // // 预减库存 // long stack = redisService.decr(TaskKey.getTaskStock,""+id); // if (stack<0){ // return "已结束"; // } // //入队列 // TaskMessage taskMessage = new TaskMessage(); // taskMessage.setTaskId(id); // taskMessage.setManId(man.getId()); // //发送消息 // mQsender.sendTaskMessage(taskMessage); // //返回 // return "ok"; // } //}