Commit e67c2b73 by 赵剑炜

Merge branch 'develop' into develop-zhaojw

parents 315aa30c 489beb47
...@@ -41,3 +41,7 @@ ehthumbs.db ...@@ -41,3 +41,7 @@ ehthumbs.db
Thumbs.db Thumbs.db
/*/target/* /*/target/*
/.idea/misc.xml /.idea/misc.xml
/.idea/jyzb_platformV2.iml
/.idea/artifacts/jyzb3.xml
/jyzb-mq/jyzb-mq-consumer/target/classes/application.yml
/jyzb-mq/jyzb-mq-producer/target/classes/application.yml
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="jyzb-common" /> <module name="jyzb-common" />
<module name="jyzb-process" /> <module name="jyzb-process" />
<module name="jyzb-api" /> <module name="jyzb-mq-consumer" />
<module name="jyzb-biz" /> <module name="jyzb-biz" />
<module name="jyzb-boot" /> <module name="jyzb-boot" />
<module name="jyzb-mq-producer" />
<module name="jyzb-api" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel target="9" /> <bytecodeTargetLevel target="9" />
...@@ -23,6 +25,9 @@ ...@@ -23,6 +25,9 @@
<module name="jyzb-biz" options="-parameters" /> <module name="jyzb-biz" options="-parameters" />
<module name="jyzb-boot" options="-parameters" /> <module name="jyzb-boot" options="-parameters" />
<module name="jyzb-common" options="-parameters" /> <module name="jyzb-common" options="-parameters" />
<module name="jyzb-mq" options="-parameters" />
<module name="jyzb-mq-consumer" options="-parameters" />
<module name="jyzb-mq-producer" options="-parameters" />
<module name="jyzb-process" options="-parameters" /> <module name="jyzb-process" options="-parameters" />
</option> </option>
</component> </component>
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
<file url="file://$PROJECT_DIR$/jyzb-boot/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jyzb-boot/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-common/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jyzb-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-common/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jyzb-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-producer/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-producer/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-mq/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-mq/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-process/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jyzb-process/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-process/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jyzb-process/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
......
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/jyzb-api/jyzb-api.iml" filepath="$PROJECT_DIR$/jyzb-api/jyzb-api.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-biz/jyzb-biz.iml" filepath="$PROJECT_DIR$/jyzb-biz/jyzb-biz.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-boot/jyzb-boot.iml" filepath="$PROJECT_DIR$/jyzb-boot/jyzb-boot.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml" filepath="$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-producer/jyzb-mq-producer.iml" filepath="$PROJECT_DIR$/jyzb-mq/jyzb-mq-producer/jyzb-mq-producer.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.junmp.jyzb</groupId> <groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-api</artifactId> <artifactId>jyzb-api</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
......
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>
\ No newline at end of file
package com.junmp.jyzb.config.mqtt;
/**
* MQTT 客户端连接的基本配置,配置信息见 application.yml
* Create By Spring-2022/10/29
*/
//@Configuration
//@ConfigurationProperties(prefix = "com.mqtt")
public class MqttConfiguration {
// private String url;
// private String clientId;
// private String topics;
// private String username;
// private String password;
// private String timeout;
// private String keepalive;
//
// public String getUrl() {
// return url;
// }
//
// public void setUrl(String url) {
// this.url = url;
// }
//
// public String getClientId() {
// return clientId;
// }
//
// public void setClientId(String clientId) {
// this.clientId = clientId;
// }
//
// public String getTopics() {
// return topics;
// }
//
// public void setTopics(String topics) {
// this.topics = topics;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public String getTimeout() {
// return timeout;
// }
//
// public void setTimeout(String timeout) {
// this.timeout = timeout;
// }
//
// public String getKeepalive() {
// return keepalive;
// }
//
// public void setKeepalive(String keepalive) {
// this.keepalive = keepalive;
// }
}
package com.junmp.jyzb.config.mqtt;
/**
* 实现了对 inboundtopic 中的主题监听,当有消息推送到 inboundtopic 主题上时可以接受
* MQTT 消费端
* Create By Spring-2022/10/29
*/
//@Configuration
//@IntegrationComponentScan
public class MqttInboundConfiguration {
// private static Logger LOGGER = LoggerFactory.getLogger(MqttInboundConfiguration.class);
//
// @Autowired
// private MqttConfiguration mqttProperties;
//
// @Bean
// public MessageChannel mqttInputChannel() {
// return new DirectChannel();
// }
//
// @Bean
// public MqttPahoClientFactory mqttInClient() {
// DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
// String[] mqttServerUrls = mqttProperties.getUrl().split(",");
// MqttConnectOptions options = new MqttConnectOptions();
// options.setServerURIs(mqttServerUrls);
//
// options.setUserName(mqttProperties.getUsername());
// options.setPassword(mqttProperties.getPassword().toCharArray());
// options.setKeepAliveInterval(2);
//
// //接受离线消息
// options.setCleanSession(false);
// factory.setConnectionOptions(options);
//
// return factory;
// }
//
// // 配置Client,监听Topic
// // 如果我要配置多个client,应该怎么处理呢?这个也简单, 模仿此方法,多写几个client
// @Bean
// public MessageProducer inbound() {
// String[] inboundTopics = mqttProperties.getTopics().split(",");
// MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter(mqttProperties.getClientId() + "_inbound",
// mqttInClient(), inboundTopics);
//// adapter.addTopic(); // 添加 TOPICS
// adapter.setCompletionTimeout(1000 * 5);
// adapter.setQos(0);
// adapter.setConverter(new DefaultPahoMessageConverter());
// adapter.setOutputChannel(mqttInputChannel());
// return adapter;
// }
//
// // 通过通道获取数据,即处理 MQTT 发送过来的消息,可以通过 MQTTX 工具发送数据测试
// @Bean
// @ServiceActivator(inputChannel = "mqttInputChannel") // 异步处理
// public MessageHandler handler() {
// return new MessageHandler() {
// @Override
// public void handleMessage(Message<?> message) throws MessagingException {
// Object payload = message.getPayload();
// MessageHeaders messageHeaders = message.getHeaders();
// UUID packetId = messageHeaders.getId();
// Object qos = messageHeaders.get(MqttHeaders.QOS);
// Object recvTopic = messageHeaders.get(MqttHeaders.RECEIVED_TOPIC);
// String handMessage = "MQTT Client " + "packetId ===>" + packetId
// + "\nReceive payLoad ===> " + payload
// + " \tQOS ===> " + qos
// + "\n Topics: " + recvTopic;
// LOGGER.debug(handMessage);
// System.out.println(handMessage);
// }
// };
// }
}
package com.junmp.jyzb.config.mqtt;
/**
* MQTT 生产端
* Create By Spring-2022/10/29
*/
//@Configuration
public class MqttOutboundConfiguration {
// @Autowired
// private MqttConfiguration mqttProperties;
//
// @Bean
// public MessageChannel mqttOutboundChannelIOT() {
// return new DirectChannel();
// }
//
// @Bean
// public MessageChannel mqttOutboundChannelHome() {
// return new DirectChannel();
// }
//
// /**
// * 建立MQTT连接,配置连接的参数选项
// *
// * @return
// */
// @Bean
// public MqttPahoClientFactory mqttOutClient() {
// DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
// String[] mqttServerUrls = mqttProperties.getUrl().split(",");
// MqttConnectOptions mqttConnectOptions = new MqttConnectOptions();
// mqttConnectOptions.setServerURIs(mqttServerUrls);
// mqttConnectOptions.setUserName(mqttConnectOptions.getUserName());
// mqttConnectOptions.setPassword(mqttProperties.getPassword().toCharArray());
// // 接收离线消息
// mqttConnectOptions.setCleanSession(false); //告诉代理客户端是否要建立持久会话 false为建立持久会话
// factory.setConnectionOptions(mqttConnectOptions);
//
// return factory;
// }
//
// @Bean
// @ServiceActivator(inputChannel = "mqttOutboundChannelIOT")
// public MessageHandler mqttOutboundIOT() {
// MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler(mqttProperties.getClientId() + "_outbound_iot",
// mqttOutClient());
// messageHandler.setDefaultTopic("iot/deviceId/+/sensorTag/+/#"); // 支持主题表达式
// messageHandler.setAsync(true);
// return messageHandler;
// }
//
// @Bean
// @ServiceActivator(inputChannel = "mqttOutboundChannelHome") //来自于上面的 @Bean对象
// public MessageHandler mqttOutboundHome() {
// MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler(mqttProperties.getClientId() + "_outbound_home",
// mqttOutClient());
// messageHandler.setDefaultTopic("home/#"); // 支持主题表达式
// messageHandler.setAsync(true);
// return messageHandler;
// }
}
...@@ -48,7 +48,7 @@ public class EquipmentSizeController { ...@@ -48,7 +48,7 @@ public class EquipmentSizeController {
} }
@PostMapping("/ShowSize") @PostMapping("/ShowSize")
@ApiOperation("查询号型列表") //根据组织机构id查询 @ApiOperation("根据装备类型查询号型")
public ResponseResult getAllSize(@RequestBody Map<String, Object> msg){ public ResponseResult getAllSize(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = equipmentSizeService.getAllSize(msg); ResponseResult returnMsg = equipmentSizeService.getAllSize(msg);
return returnMsg; return returnMsg;
...@@ -67,4 +67,11 @@ public class EquipmentSizeController { ...@@ -67,4 +67,11 @@ public class EquipmentSizeController {
ResponseResult returnMsg = equipmentSizeService.changeSizeState(msg); ResponseResult returnMsg = equipmentSizeService.changeSizeState(msg);
return returnMsg; return returnMsg;
} }
@PostMapping("/GetSizeDevelop")
@ApiOperation("获取号型表所有信息(非树表)")
public ResponseResult getSizeDevelop() {
ResponseResult returnMsg = equipmentSizeService.getSizeDevelop();
return returnMsg;
}
} }
...@@ -49,16 +49,22 @@ public class EquipmentTypeController { ...@@ -49,16 +49,22 @@ public class EquipmentTypeController {
} }
@PostMapping("/ShowEquipmentList") @PostMapping("/ShowEquipmentList")
@ApiOperation("查询物资列表") @ApiOperation("查询类别列表")
public ResponseResult ShowEquipmentList() { public ResponseResult ShowEquipmentList() {
List<Map<String, Object>> equipmentList = equipmentTypeService.getEquipmentList(); ResponseResult returnMsg = equipmentTypeService.getEquipmentList();
return returnMsg;
}
@PostMapping("/ShowAllEquipment")
@ApiOperation("查询整颗物资树")
public ResponseResult showAllEquipment() {
List<Map<String, Object>> equipmentList = equipmentTypeService.showAllEquipment();
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",equipmentList); return new ResponseResult(HttpStatus.SUCCESS,"操作成功",equipmentList);
} }
@PostMapping("/GetEquipmentDetail") @PostMapping("/GetEquipmentDetail")
@ApiOperation("查询单个物资信息") @ApiOperation("查询单个物资信息")
public ResponseResult getOneEquipment(@RequestBody Map<String, Object> msg) { public ResponseResult getOneEquipment(@RequestBody Map<String, Object> msg) {
//String warehouseId = msg.get("").toString();
ResponseResult returnMsg = equipmentTypeService.getOneEquipment(msg); ResponseResult returnMsg = equipmentTypeService.getOneEquipment(msg);
return returnMsg; return returnMsg;
} }
...@@ -69,4 +75,25 @@ public class EquipmentTypeController { ...@@ -69,4 +75,25 @@ public class EquipmentTypeController {
ResponseResult responseMsg = equipmentTypeService.updateEquipment(msg); ResponseResult responseMsg = equipmentTypeService.updateEquipment(msg);
return responseMsg; return responseMsg;
} }
@PostMapping("/ShowEquipmentChildren")
@ApiOperation("根据类别查询装备")
public ResponseResult showEquipmentChildren(@RequestBody Map<String,Object> msg) {
ResponseResult responseMsg = equipmentTypeService.showEquipmentChildren(msg);
return responseMsg;
}
@PostMapping("/SetTypeParentIds")
@ApiOperation("填充装备类型的parent_ids字段")
public ResponseResult setTypeParentIds() {
ResponseResult returnMsg = equipmentTypeService.setTypeParentIds();
return returnMsg;
}
@PostMapping("/GetEquipmentDevelop")
@ApiOperation("获取装备表所有信息(非树表)")
public ResponseResult getEquipmentDevelop() {
ResponseResult returnMsg = equipmentTypeService.getEquipmentDevelop();
return returnMsg;
}
} }
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.InventoryService;
import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/Inventory")
@Api(tags = "库存模块")
public class InventoryController {
@Resource
public InventoryService inventoryService;
@PostMapping("/GetEquipmentInfo")
@ApiOperation("根据组织机构或者仓库查询库存信息")
public ResponseResult getEquipmentInfo(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = inventoryService.getEquipmentInfo(msg);
return returnMsg;
}
@PostMapping("/SetInventoryMsg")
@ApiOperation("填充汇总表信息")
public ResponseResult setInventoryMsg() {
ResponseResult returnMsg = inventoryService.setInventoryMsg();
return returnMsg;
}
@PostMapping("/GetInventoryList")
@ApiOperation("查询库存详细信息")
public ResponseResult getInventoryList(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = inventoryService.getInventoryList(msg);
return returnMsg;
}
@PostMapping("/UpdateInventoryNum")
@ApiOperation("手动重置库存数量信息")
public ResponseResult updateInventoryNum(@RequestBody Map<String,Object> msg){
ResponseResult returnMsg = inventoryService.updateInventoryNum(msg);
return returnMsg;
}
@PostMapping("/GetInventoryByOrgId")
@ApiOperation("查询组织机构拥有装备")
public ResponseResult getInventoryByOrgId(@RequestBody Map<String,Object> msg){
ResponseResult returnMsg = inventoryService.getInventoryByOrgId(msg);
return returnMsg;
}
@PostMapping("/GetInventoryDevelop")
@ApiOperation("获取装备明细表所有信息")
public ResponseResult getInventoryDevelop() {
ResponseResult returnMsg = inventoryService.getInventoryDevelop();
return returnMsg;
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.MqttGateWayService;
import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Create By Spring-2022/10/29
*/
//@Controller
//@RequestMapping(value = "/mqtt")
//@Api(value = "MqttController", tags = {"MQTT 访问控制"})
public class MqttController {
//
// @Autowired
// private MqttGateWayService gateWay;
//
// @RequestMapping(value = "/sendMqttSimple", method = RequestMethod.POST)
// @ApiOperation("向指定主题中,发送消息")
// @ResponseBody
// public ResponseResult sendMqttSimple(@RequestParam(value = "topic", required = true) @ApiParam(value = "MQTT的主题") String topic, String data) {
// try {
// gateWay.sendMessageToMqtt(data, topic);
// return new ResponseResult(99200,"操作成功",data);
// } catch (Exception e) {
//
// }
// return new ResponseResult(99500,"操作失败");
// }
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.OrderService;
import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/Order")
@Api(tags = "业务模块")
public class OrderController {
@Resource
public OrderService orderService;
@PostMapping("/AddOrder")
@ApiOperation("新增任务单")
public ResponseResult addOrder(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = orderService.addOrder(msg);
return returnMsg;
}
@PostMapping("/ShowOrder")
@ApiOperation("查询任务列表")
public ResponseResult showOrder(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = orderService.showOrder(msg);
return returnMsg;
}
@PostMapping("/UpdateOrder")
@ApiOperation("修改任务单")
public ResponseResult updateOrder(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg =orderService.updateOrder(msg);
return returnMsg;
}
@PostMapping("/GetOrderDetail")
@ApiOperation("根据订单id查看业务明细")
public ResponseResult getOrderDetail(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = orderService.getOrderDetail(msg);
return returnMsg;
}
}
...@@ -101,8 +101,7 @@ public class PoliceController { ...@@ -101,8 +101,7 @@ public class PoliceController {
@PostMapping("/ChangePoliceOrg") @PostMapping("/ChangePoliceOrg")
@ApiOperation("警员调岗") @ApiOperation("警员调岗")
public ResponseResult changePoliceOrg(@RequestBody Map<String, Object> cabinetId){ public ResponseResult changePoliceOrg(@RequestBody Map<String, Object> cabinetId){
//获取该组织机构下所有警员的id
//ResponseResult returnMsg =policemanService.getPoliceData(cabinetId);
return null; return null;
} }
} }
package com.junmp.jyzb.controller; package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.PubOrgService; import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -21,21 +20,67 @@ import java.util.Map; ...@@ -21,21 +20,67 @@ import java.util.Map;
@Api(tags = "组织机构模块") @Api(tags = "组织机构模块")
public class PubOrgController { public class PubOrgController {
@Resource @Resource
public PubOrgService equipmentTypeService; public PubOrgService pubOrgService;
@PostMapping("/ShowPubOrgList") @PostMapping("/ShowPubOrgList")
@ApiOperation("查询物资列表_简化版") @ApiOperation("查询组织机构列表_简化版")
public ResponseResult ShowEquipmentList(@RequestBody Map<String, Object> orgId) { public ResponseResult ShowEquipmentList(@RequestBody Map<String, Object> orgId) {
//传入当前的组织机构id,展示所有本级及下级的 //传入当前的组织机构id,展示所有本级及下级的
ResponseResult returnMsg = equipmentTypeService.showPubOrgList(orgId); ResponseResult returnMsg = pubOrgService.showPubOrgList(orgId);
return returnMsg; return returnMsg;
} }
@PostMapping("/ShowPubOrgListOld") @PostMapping("/ChangeOrgState")
@ApiOperation("查询物资列表_完整版") @ApiOperation("改变组织机构状态信息")
public ResponseResult showPubOrgListOld(@RequestBody Map<String, Object> orgId) { public ResponseResult changeOrgState(@RequestBody Map<String, Object> msg) {
//传入当前的组织机构id,展示所有本级及下级的 //传入当前的组织机构id,展示所有本级及下级的
ResponseResult returnMsg = equipmentTypeService.showPubOrgListOld(orgId); ResponseResult returnMsg = pubOrgService.changeOrgState(msg);
return returnMsg; return returnMsg;
} }
// @PostMapping("/ShowAllPubOrgList")
// @ApiOperation("查询组织机构列表(含禁用)")
// public ResponseResult showAllPubOrgList(@RequestBody Map<String, Object> orgId) {
// //传入当前的组织机构id,展示所有本级及下级的
// ResponseResult returnMsg = pubOrgService.showAllPubOrgList(orgId);
// return returnMsg;
// }
// @PostMapping("/ShowPubOrgListOld")
// @ApiOperation("查询组织机构列表_完整版")
// public ResponseResult showPubOrgListOld(@RequestBody Map<String, Object> orgId) {
// //传入当前的组织机构id,展示所有本级及下级的
// ResponseResult returnMsg = pubOrgService.showPubOrgListOld(orgId);
// return returnMsg;
// }
@PostMapping("/SetOrgParentIds")
@ApiOperation("填充组织机构的parent_ids字段")
public ResponseResult setOrgParentIds() {
//传入当前的组织机构id,展示所有本级及下级的
ResponseResult returnMsg = pubOrgService.setOrgParentIds();
return returnMsg;
}
@PostMapping("/SetDName")
@ApiOperation("填充组织机构简称到数据库")
public ResponseResult setShortName(@RequestBody Map<String, Object> orgId) {
ResponseResult returnMsg = pubOrgService.setShortName(orgId);
return returnMsg;
}
@PostMapping("/GetOrgDetail")
@ApiOperation("查询组织机构详细信息")
public ResponseResult getOrgDetail(@RequestBody Map<String, Object> msg) {
ResponseResult returnMsg = pubOrgService.getOrgDetail(msg);
return returnMsg;
}
@PostMapping("/GetLowerOrg")
@ApiOperation("获取本级及下级的组织机构")
public ResponseResult getLowerOrg(@RequestBody Map<String, Object> msg) {
String orgId = msg.get("orgId").toString();
List<String> returnMsg = pubOrgService.getLowerOrg(orgId);
return new ResponseResult(99200,"操作成功",returnMsg);
}
} }
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.MsgService;
import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/User")
@Api(tags = "根据表明和组织机构id获取相关信息")
public class UserController {
@Resource
public MsgService msgService;
@PostMapping("/GetMsg")
@ApiOperation("获取相关信息")
public ResponseResult getMsg(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = msgService.getMsg(msg);
return returnMsg;
}
@PostMapping("/GetUserMsg")
@ApiOperation("根据组织机构获取用户信息")
public ResponseResult getUserMsg(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = msgService.getUserMsg(msg);
return returnMsg;
}
}
...@@ -79,5 +79,11 @@ public class EquipmentType implements Serializable { ...@@ -79,5 +79,11 @@ public class EquipmentType implements Serializable {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String note; private String note;
/**
* 类型,0类别,1装备
*/
@ApiModelProperty(value = "类型,0类别,1装备")
private Integer type;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@ApiModel(value="com-junmp-jyzb-domain-BussinessOrderMain")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderMain implements Serializable {
@ApiModelProperty(value="")
private Long id;
/**
* 单据类型:入库单/出库单
*/
@ApiModelProperty(value="单据类型:入库单/出库单")
private String orderType;
/**
* 工作流ID
*/
@ApiModelProperty(value="工作流ID")
private String processId;
/**
* 单据业务类型:purchase采购/gift赠予/other其他类型
*/
@ApiModelProperty(value="单据业务类型:purchase采购/gift赠予/other其他类型")
private String bussinessType;
/**
* 订单号
*/
@ApiModelProperty(value="订单号")
private String orderCode;
/**
* 目标单位
*/
@ApiModelProperty(value="目标单位")
private String orgId;
/**
* 审批状态:0未审批/1已审批/
*/
@ApiModelProperty(value="审批状态:0未审批/1已审批/")
private String approveType;
/**
* 发物单位
*/
@ApiModelProperty(value="发物单位")
private String sendOrgId;
/**
* 发物单位名称
*/
@ApiModelProperty(value="发物单位名称")
private String sendOrgName;
/**
* 应入库数量
*/
@ApiModelProperty(value="应入库数量")
private Integer inventoryQuantity;
/**
* 实际数量
*/
@ApiModelProperty(value="实际数量")
private Integer actualQuantity;
/**
* 是否已记账 0未记账/1已记账
*/
@ApiModelProperty(value="是否已记账 0未记账/1已记账")
private Integer manualState;
/**
* 单据状态 0待入库/1已入库/2入库中
*/
@ApiModelProperty(value="单据状态 0待入库/1已入库/2入库中")
private Integer orderState;
/**
* 附件地址
*/
@ApiModelProperty(value="附件地址")
private String attachmentLocation;
/**
* 单据包含的物资集合,内容以逗号进行分割
*/
@ApiModelProperty(value="单据包含的物资集合,内容以逗号进行分割")
private String invList;
/**
* 创建时间
*/
@ApiModelProperty(value="创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value="更新时间")
private Date updateTime;
/**
* 创建人员
*/
@ApiModelProperty(value="创建人员")
private String createUser;
/**
* 更新人员
*/
@ApiModelProperty(value="更新人员")
private String updateUser;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
...@@ -28,7 +28,7 @@ public class PoliceFinger implements Serializable { ...@@ -28,7 +28,7 @@ public class PoliceFinger implements Serializable {
/** /**
* 指纹名称 * 指纹名称
*/ */
@ApiModelProperty(value = "警员id") @ApiModelProperty(value = "指纹名称")
private String name; private String name;
/** /**
......
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* process_templates
*/
@ApiModel(value="com-junmp-jyzb-domain-ProcessTemplates")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProcessTemplates implements Serializable {
/**
* 审批摸板ID
*/
@ApiModelProperty(value="审批摸板ID")
private String templateId;
/**
* 摸板名称
*/
@ApiModelProperty(value="摸板名称")
private String templateName;
/**
* 基础设置
*/
@ApiModelProperty(value="基础设置")
private String settings;
/**
* 摸板表单
*/
@ApiModelProperty(value="摸板表单")
private String formJson;
/**
* process
*/
@ApiModelProperty(value="process")
private String processJson;
/**
* 图标
*/
@ApiModelProperty(value="图标")
private String icon;
/**
* 图标背景色
*/
@ApiModelProperty(value="图标背景色")
private String background;
/**
* notify
*/
@ApiModelProperty(value="notify")
private String notify;
/**
* 谁能提交
*/
@ApiModelProperty(value="谁能提交")
private String whoCommit;
/**
* 谁能编辑
*/
@ApiModelProperty(value="谁能编辑")
private String whoEdit;
/**
* 谁能导出数据
*/
@ApiModelProperty(value="谁能导出数据")
private String whoExport;
/**
* remark
*/
@ApiModelProperty(value="remark")
private String remark;
/**
* 冗余分组id
*/
@ApiModelProperty(value="冗余分组id")
private Integer groupId;
/**
* 是否已停用
*/
@ApiModelProperty(value="是否已停用")
private Byte isStop;
/**
* 创建时间
*/
@ApiModelProperty(value="创建时间")
private Date created;
/**
* 更新时间
*/
@ApiModelProperty(value="更新时间")
private Date updated;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
...@@ -9,123 +9,138 @@ import lombok.Data; ...@@ -9,123 +9,138 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* 组织机构信息 * 组织机构信息
*/ */
@ApiModel(value="com-junmp-jyzb-domain-PubOrg") @ApiModel(value="com-junmp-jyzb-domain-PubOrg")
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class PubOrg implements Serializable { public class PubOrg implements Serializable {
/** /**
* 主键 * 主键
*/ */
@ApiModelProperty(value="主键") @ApiModelProperty(value="主键")
private Long orgId; private Long orgId;
/** /**
* 父id,一级节点父id是0 * 父id,一级节点父id是0
*/ */
@ApiModelProperty(value="父id,一级节点父id是0") @ApiModelProperty(value="父id,一级节点父id是0")
private Long orgParentId; private Long orgParentId;
/** /**
* 父ids * 父ids
*/ */
@ApiModelProperty(value="父ids") @ApiModelProperty(value="父ids")
private String orgParentIds; private String orgParentIds;
/** /**
* 组织编码 * 组织编码
*/ */
@ApiModelProperty(value="组织编码") @ApiModelProperty(value="组织编码")
private String orgCode; private String orgCode;
/** /**
* 组织名称 * 组织名称
*/ */
@ApiModelProperty(value="组织名称") @ApiModelProperty(value="组织名称")
private String orgName; private String orgName;
/** /**
* 机构类型100企业,101:机构 *
*/ */
@ApiModelProperty(value="")
private String areaName;
/**
*
*/
@ApiModelProperty(value="")
private String dName;
/**
* 机构类型100企业,101:机构
*/
@ApiModelProperty(value="机构类型100企业,101:机构") @ApiModelProperty(value="机构类型100企业,101:机构")
private Short orgType; private Short orgType;
/** /**
* 排序 * 排序
*/ */
@ApiModelProperty(value="排序") @ApiModelProperty(value="排序")
private Byte sortVal; private Byte sortVal;
/** /**
* 状态:1-启用,2-禁用 * 状态:1-启用,0-禁用
*/ */
@ApiModelProperty(value="状态:1-启用,2-禁用") @ApiModelProperty(value="状态:1-启用,0-禁用")
private Byte statusFlag; private Integer statusFlag;
/** /**
* 描述 * 描述
*/ */
@ApiModelProperty(value="描述") @ApiModelProperty(value="描述")
private String remark; private String remark;
/** /**
* 删除标记:Y-已删除,N-未删除 * 删除标记:0-已删除,1-未删除
*/ */
@ApiModelProperty(value="删除标记:Y-已删除,N-未删除") @ApiModelProperty(value="删除标记:0-已删除,1-未删除")
private Short delFlag; private Short delFlag;
/** /**
* 机构全称 * 机构全称
*/ */
@ApiModelProperty(value="机构全称") @ApiModelProperty(value="机构全称")
private String orgFullName; private String orgFullName;
/** /**
* 地址 * 地址
*/ */
@ApiModelProperty(value="地址") @ApiModelProperty(value="地址")
private String address; private String address;
/** /**
* 联系人 * 联系人
*/ */
@ApiModelProperty(value="联系人") @ApiModelProperty(value="联系人")
private String contact; private String contact;
/** /**
* 电话 * 电话
*/ */
@ApiModelProperty(value="电话") @ApiModelProperty(value="电话")
private String phone; private String phone;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value="创建时间") @ApiModelProperty(value="创建时间")
private Date createTime; private Date createTime;
/** /**
* 创建人 * 创建人
*/ */
@ApiModelProperty(value="创建人") @ApiModelProperty(value="创建人")
private Long createUser; private Long createUser;
/** /**
* 更新时间 * 更新时间
*/ */
@ApiModelProperty(value="更新时间") @ApiModelProperty(value="更新时间")
private Date updateTime; private Date updateTime;
/** /**
* 更新人 * 更新人
*/ */
@ApiModelProperty(value="更新人") @ApiModelProperty(value="更新人")
private Long updateUser; private Long updateUser;
@ApiModelProperty(value="") @ApiModelProperty(value="")
private String guid; private String guid;
@ApiModelProperty(value="")
private String findCode;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -14,62 +14,62 @@ import lombok.NoArgsConstructor; ...@@ -14,62 +14,62 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
public class Shelf implements Serializable { public class Shelf implements Serializable {
/** /**
* 货架id * 货架id
*/ */
@ApiModelProperty(value="货架id") @ApiModelProperty(value="货架id")
private String shelfId; private String shelfId;
/** /**
* 货架名称 * 货架名称
*/ */
@ApiModelProperty(value="货架名称") @ApiModelProperty(value="货架名称")
private String shelfName; private String shelfName;
/** /**
* 编码 * 编码
*/ */
@ApiModelProperty(value="编码") @ApiModelProperty(value="编码")
private String code; private String code;
/** /**
* 货架类型Normal:普通货架Smart:智能货架 * 货架类型Normal:普通货架Smart:智能货架
*/ */
@ApiModelProperty(value="货架类型Normal:普通货架Smart:智能货架") @ApiModelProperty(value="货架类型Normal:普通货架Smart:智能货架")
private String type; private String type;
/** /**
* 仓库 * 仓库
*/ */
@ApiModelProperty(value="仓库") @ApiModelProperty(value="仓库")
private String warehouseId; private String warehouseId;
/** /**
* 货架层数 * 货架层数
*/ */
@ApiModelProperty(value="货架层数") @ApiModelProperty(value="货架层数")
private Integer shelfRows; private Integer shelfRows;
/** /**
* 单层货架列数 * 单层货架列数
*/ */
@ApiModelProperty(value="单层货架列数") @ApiModelProperty(value="单层货架列数")
private Integer shelfColumns; private Integer shelfColumns;
/** /**
* 货架排数(智能货架多货架拼接) * 货架排数(智能货架多货架拼接)
*/ */
@ApiModelProperty(value="货架排数(智能货架多货架拼接)") @ApiModelProperty(value="货架排数(智能货架多货架拼接)")
private Integer shelfRanges; private Integer shelfRanges;
/** /**
* 智能货架地址 * 智能货架地址
*/ */
@ApiModelProperty(value="智能货架地址") @ApiModelProperty(value="智能货架地址")
private String url; private String url;
/** /**
* 型号 * 型号
*/ */
@ApiModelProperty(value="型号") @ApiModelProperty(value="型号")
private String sizeInfo; private String sizeInfo;
......
...@@ -3,6 +3,7 @@ package com.junmp.jyzb.mapper; ...@@ -3,6 +3,7 @@ package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.Cabinet; import com.junmp.jyzb.domain.Cabinet;
import com.junmp.jyzb.domain.Policeman; import com.junmp.jyzb.domain.Policeman;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -31,4 +32,14 @@ public interface CabinetMapper { ...@@ -31,4 +32,14 @@ public interface CabinetMapper {
List<String> getAllCabinetIdByHighest(); List<String> getAllCabinetIdByHighest();
String getCabinetNumById(String id); String getCabinetNumById(String id);
List<Map<String, Object>> getAllCabinetByOrgList(List<String> allOrgId);
void setCabinetSumInventory(@Param("updateId") String id);
void setCabinetInSumInventory(@Param("updateId") String id);
void setCabinetOutSumInventory(@Param("updateId") String id);
void setCabinetPriceInventory(@Param("updateId") String id);
} }
\ No newline at end of file
...@@ -24,5 +24,7 @@ public interface EquipmentSizeMapper { ...@@ -24,5 +24,7 @@ public interface EquipmentSizeMapper {
List<String> getSizeByCode(String code); List<String> getSizeByCode(String code);
String getCodeById(String id); //String getCodeById(String id);
List<Map<String, Object>> getSizeDevelop();
} }
\ No newline at end of file
...@@ -45,4 +45,12 @@ public interface EquipmentTypeMapper { ...@@ -45,4 +45,12 @@ public interface EquipmentTypeMapper {
List<Map<String, Object>> getSupplierByTypeId(EquipmentType equipment); List<Map<String, Object>> getSupplierByTypeId(EquipmentType equipment);
List<String> getLowestTypeId(); List<String> getLowestTypeId();
List<Map<String, Object>> getChildByParentId(String equipmentId);
void wipeParentIdsData();
void setTypeParentIds();
List<Map<String, Object>> getEquipmentDevelop();
} }
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.Inventory;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface ExpireMapper {
@MapKey("id")
Map<String,Object> QueryTop1000ExpireInv();
@MapKey("id")
Map<String,Object> QueryExpireInv(@Param("currentNum")int currentNum,@Param("currentNum")int nextNum);
}
package com.junmp.jyzb.mapper; package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface InventoryMapper { public interface InventoryMapper {
Map<String, Object> getSum(String queryType, String typeId);
Map<String, Object> getOrgNum(String typeId);
List<Map<String, Object>> getLocationInventory(@Param("queryType")String queryType, @Param("idMsg")String idMsg);
void deleteAllMsg();
void setOrgInventory();
void setCabinetInventory();
void setWarehouseInventory();
List<Map<String, Object>> getInventoryList(@Param("queryType")String queryType,@Param("typeCode") String typeCode,@Param("typeId") String typeId,@Param("sizeId") String sizeId);
List<Map<String, Object>> getInventoryByOrgId(String orgId);
} }
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface MsgMapper {
List<Map<String, Object>> getMsg(@Param("orgId") String orgId,@Param("tableName") String tableName);
List<Map<String, Object>> getUserMsg(String orgId);
}
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.OrderMain;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface OrderMainMapper {
Long addOrder(OrderMain order);
List<Map<String, Object>> showOrder(String orgId);
Map<String, Object> getOrderDetail(String id);
void updateOrder(OrderMain order);
}
\ No newline at end of file
...@@ -39,4 +39,8 @@ public interface PolicemanMapper extends BaseMapper<Policeman> { ...@@ -39,4 +39,8 @@ public interface PolicemanMapper extends BaseMapper<Policeman> {
List<String> getAllPoliceIdByHighest(); List<String> getAllPoliceIdByHighest();
String getPoliceCodeById(String id); String getPoliceCodeById(String id);
List<Map<String, Object>> getAllPolicemanByOrg(String orgId);
List<Map<String, Object>> getAllPolicemanByOrgList(List<String> orgId);
} }
\ No newline at end of file
...@@ -2,12 +2,28 @@ package com.junmp.jyzb.mapper; ...@@ -2,12 +2,28 @@ package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.PubOrg; import com.junmp.jyzb.domain.PubOrg;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface PubOrgMapper { public interface PubOrgMapper {
List<PubOrg> selectAllOrg(); List<PubOrg> selectAllOrg();
Long getOnePubOrg(String orgId); Long getOnePubOrg(String orgId);
void setMsg(@Param("id") Long id,@Param("orgName") String orgName);
void setOrgParentIds();
void wipeParentIdsData();
Map<String, Object> getOrgDetail(String orgId);
String getParentOrgName(Long orgParentId);
List<PubOrg> showAllPubOrgList();
void changeOrgState(@Param("statusFlag") Integer statusFlag,List<String> orgIdList);
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ public interface SupplierMapper { ...@@ -15,7 +15,7 @@ public interface SupplierMapper {
// Map<String, Object> getOneSupplier(String id,Object SelectName,Object SelectCode); // Map<String, Object> getOneSupplier(String id,Object SelectName,Object SelectCode);
Map<String, Object> getOneSupplier(@Param("id") String id, @Param("SelectName") Object SelectName, @Param("SelectCode") Object SelectCode); Map<String, Object> getOneSupplier(@Param("code") String code, @Param("SelectName") Object SelectName, @Param("SelectCode") Object SelectCode);
//Map<String, Object> getOneSupplier(@Param("id") String id); //Map<String, Object> getOneSupplier(@Param("id") String id);
void deleteSupplier(String id); void deleteSupplier(String id);
...@@ -26,5 +26,5 @@ public interface SupplierMapper { ...@@ -26,5 +26,5 @@ public interface SupplierMapper {
void changeSupplierState(Supplier supplier); void changeSupplierState(Supplier supplier);
List<Map<String, Object>> getAllSupplier(); List<Map<String, Object>> getAllSupplier(@Param("name") String name, @Param("shortName") String shortName);
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.junmp.jyzb.mapper; ...@@ -3,6 +3,7 @@ package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.Policeman; import com.junmp.jyzb.domain.Policeman;
import com.junmp.jyzb.domain.Warehouse; import com.junmp.jyzb.domain.Warehouse;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -25,4 +26,14 @@ public interface WarehouseMapper { ...@@ -25,4 +26,14 @@ public interface WarehouseMapper {
List<String> getAllWarehouseIdByHighest(); List<String> getAllWarehouseIdByHighest();
List<Map<String, Object>> getAllWarehouse(); List<Map<String, Object>> getAllWarehouse();
List<Map<String, Object>> getAllWarehouseByOrgList(List<String> allOrgId);
void setWarehouseSumInventory(@Param("updateId") String id);
void setWarehouseInSumInventory(@Param("updateId") String id);
void setWarehouseOutSumInventory(@Param("updateId") String id);
void setWarehousePriceInventory(@Param("updateId") String id);
} }
\ No newline at end of file
...@@ -24,4 +24,6 @@ public interface CabinetService{ ...@@ -24,4 +24,6 @@ public interface CabinetService{
ResponseResult getAllCabinet(Map<String, Object> msg); ResponseResult getAllCabinet(Map<String, Object> msg);
ResponseResult getCabinetDetail(Map<String, Object> msg); ResponseResult getCabinetDetail(Map<String, Object> msg);
ResponseResult setCabinetInventory(Map<String, Object> msg);
} }
...@@ -19,4 +19,6 @@ public interface EquipmentSizeService{ ...@@ -19,4 +19,6 @@ public interface EquipmentSizeService{
ResponseResult changeSizeState(Map<String, Object> msg); ResponseResult changeSizeState(Map<String, Object> msg);
ResponseResult getAllSize(Map<String, Object> msg); ResponseResult getAllSize(Map<String, Object> msg);
ResponseResult getSizeDevelop();
} }
...@@ -17,7 +17,15 @@ public interface EquipmentTypeService{ ...@@ -17,7 +17,15 @@ public interface EquipmentTypeService{
ResponseResult changeEquipmentState(Map<String, Object> msg); ResponseResult changeEquipmentState(Map<String, Object> msg);
List<Map<String, Object>> getEquipmentList(); ResponseResult getEquipmentList();
ResponseResult getOneEquipment(Map<String, Object> msg); ResponseResult getOneEquipment(Map<String, Object> msg);
ResponseResult showEquipmentChildren(Map<String, Object> msg);
ResponseResult setTypeParentIds();
List<Map<String, Object>> showAllEquipment();
ResponseResult getEquipmentDevelop();
} }
package com.junmp.jyzb.service; package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.Map;
public interface InventoryService{ public interface InventoryService{
ResponseResult getEquipmentInfo(Map<String, Object> msg);
ResponseResult setInventoryMsg();
ResponseResult updateInventoryNum(Map<String, Object> msg);
ResponseResult getInventoryList(Map<String, Object> msg);
ResponseResult getInventoryByOrgId(Map<String, Object> msg);
ResponseResult getInventoryDevelop();
} }
package com.junmp.jyzb.service;
//import org.springframework.integration.annotation.MessagingGateway;
//import org.springframework.integration.mqtt.support.MqttHeaders;
//import org.springframework.messaging.handler.annotation.Header;
//import org.springframework.stereotype.Service;
/**
* Create By Spring-2022/10/29
*/
//@Service
//@MessagingGateway(defaultRequestChannel = "mqttOutboundChannelIOT")
public interface MqttGateWayService {
// void sendMessageToMqtt(String data);
//
// // The topic name MUST NOT contain any wildcard characters (#+)
// void sendMessageToMqtt(String data, @Header(MqttHeaders.TOPIC) String topic);
//
// void sendMessageToMqtt(String data, @Header(MqttHeaders.TOPIC) String topic, @Header(MqttHeaders.QOS) int qos);
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.Map;
public interface MsgService {
ResponseResult getMsg(Map<String, Object> msg);
ResponseResult getUserMsg(Map<String, Object> msg);
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.Map;
public interface OrderService {
ResponseResult addOrder(Map<String, Object> msg);
ResponseResult showOrder(Map<String, Object> msg);
ResponseResult updateOrder(Map<String, Object> msg);
ResponseResult getOrderDetail(Map<String, Object> msg);
}
...@@ -10,4 +10,14 @@ public interface PubOrgService{ ...@@ -10,4 +10,14 @@ public interface PubOrgService{
ResponseResult showPubOrgList(Map<String, Object> orgId); ResponseResult showPubOrgList(Map<String, Object> orgId);
ResponseResult showPubOrgListOld(Map<String, Object> orgId); ResponseResult showPubOrgListOld(Map<String, Object> orgId);
ResponseResult setShortName(Map<String, Object> orgId);
List<String> getLowerOrg(String orgId);
ResponseResult setOrgParentIds();
ResponseResult getOrgDetail(Map<String, Object> orgId);
ResponseResult changeOrgState(Map<String, Object> msg);
} }
...@@ -39,4 +39,6 @@ public interface WarehouseService{ ...@@ -39,4 +39,6 @@ public interface WarehouseService{
ResponseResult deleteShelf(Map<String, Object> msg); ResponseResult deleteShelf(Map<String, Object> msg);
ResponseResult getShelfList(Map<String, Object> msg); ResponseResult getShelfList(Map<String, Object> msg);
ResponseResult setWarehouseInventory(Map<String, Object> msg);
} }
...@@ -2,10 +2,12 @@ package com.junmp.jyzb.service.impl; ...@@ -2,10 +2,12 @@ package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.Cabinet; import com.junmp.jyzb.domain.Cabinet;
import com.junmp.jyzb.domain.CabinetBox; import com.junmp.jyzb.domain.CabinetBox;
import com.junmp.jyzb.domain.PubOrg;
import com.junmp.jyzb.mapper.CabinetBoxMapper; import com.junmp.jyzb.mapper.CabinetBoxMapper;
import com.junmp.jyzb.mapper.PolicemanMapper; import com.junmp.jyzb.mapper.PolicemanMapper;
import com.junmp.jyzb.mapper.PubOrgMapper; import com.junmp.jyzb.mapper.PubOrgMapper;
import com.junmp.jyzb.service.CabinetService; import com.junmp.jyzb.service.CabinetService;
import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.utils.*; import com.junmp.jyzb.utils.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -33,6 +35,9 @@ public class CabinetServiceImpl implements CabinetService { ...@@ -33,6 +35,9 @@ public class CabinetServiceImpl implements CabinetService {
@Resource @Resource
private PubOrgMapper pubOrgMapper; private PubOrgMapper pubOrgMapper;
@Resource
private PubOrgService pubOrgService;
private static final String REDIS_CABINET = "Cabinet_"; private static final String REDIS_CABINET = "Cabinet_";
@Override @Override
...@@ -236,42 +241,97 @@ public class CabinetServiceImpl implements CabinetService { ...@@ -236,42 +241,97 @@ public class CabinetServiceImpl implements CabinetService {
} }
List<Map<String, Object>> allCabinet=new ArrayList<>(); List<Map<String, Object>> allCabinet=new ArrayList<>();
// 构建 Redis 缓存键
String redisKey = REDIS_CABINET + msg.get("IncludeLowerLevel").toString() +'_'+ msg.get("orgId").toString(); // // 构建 Redis 缓存键
// 从 Redis 中获取数据 // String redisKey = REDIS_CABINET;
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey); // // 从 Redis 中获取数据
if (cachedData != null) { // List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
//将Long类型的数据转化为Date // List<Map<String, Object>> cabinetList = new ArrayList<>();
// for (Map<String,Object> one:cachedData){ // if (cachedData != null) {
// Long dataMsg = (Long) one.get("updateTime"); // cabinetList = cachedData;
// one.put("updateTime", redisUtils.getDate(dataMsg)); // }else {
// allCabinet.add(one); // cabinetList = cabinetMapper.getAllCabinet();
// } // redisUtils.set(redisKey, cabinetList);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cachedData); // }
}
// // 构建 Redis 缓存键
// String redisKey = REDIS_CABINET + msg.get("IncludeLowerLevel").toString() +'_'+ msg.get("orgId").toString();
// // 从 Redis 中获取数据
// List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
// if (cachedData != null) {
// //将Long类型的数据转化为Date
//// for (Map<String,Object> one:cachedData){
//// Long dataMsg = (Long) one.get("updateTime");
//// one.put("updateTime", redisUtils.getDate(dataMsg));
//// allCabinet.add(one);
//// }
// return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cachedData);
// }
//如果组织机构是浙江省公安厅 //如果组织机构是浙江省公安厅
if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){ if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){
allCabinet = cabinetMapper.getAllCabinet(); allCabinet = cabinetMapper.getAllCabinet();
//将查询结果存入 Redis 中 //将查询结果存入 Redis 中
redisUtils.set(redisKey, allCabinet); //redisUtils.set(redisKey, allCabinet);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allCabinet); return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allCabinet);
} }
//获取该组织机构下所有仓库的id //获取该组织机构下所有仓库的id
//String orgId = msg.get("orgId").toString(); List<String> allOrgId =getAllOrgId(msg);
List<String> allCabinetId =getAllCabinetId(msg); if (allOrgId.isEmpty()){
for (String cabinetId :allCabinetId){ return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"未查询到相关信息");
Map<String, Object> cabinetMsg = cabinetMapper.getOneCabinet(cabinetId);
if (!cabinetMsg.isEmpty()){
allCabinet.add(cabinetMsg);
}
} }
allCabinet = getAllCabinetByOrg(msg,allOrgId);
//List<Map<String, Object>> selectedCabinets = new ArrayList<>(); // 存放匹配到的柜子信息的列表
// 遍历allOrgId
// for (String orgId : allOrgId) {
// // 遍历allCabinet中的每个柜子信息
// for (Map<String, Object> cabinet : cabinetList) {
// // 检查柜子信息中的orgId是否与当前遍历的orgId匹配
// if (cabinet.containsKey("orgId") && cabinet.get("orgId").equals(orgId)) {
// // 匹配到了柜子信息,将其添加到selectedCabinets中
// selectedCabinets.add(cabinet);
// }
// }
// }
// String orgId = msg.get("orgId").toString();
// List<String> allCabinetId =getAllCabinetId(msg);
// for (String cabinetId :allCabinetId){
// Map<String, Object> cabinetMsg = cabinetMapper.getOneCabinet(cabinetId);
// if (cabinetMsg!=null){
// allCabinet.add(cabinetMsg);
// }
// }
//
//将查询结果存入 Redis 中 //将查询结果存入 Redis 中
redisUtils.set(redisKey, allCabinet); //redisUtils.set(redisKey, allCabinet);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allCabinet); return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allCabinet);
} }
private List<String> getAllOrgId(Map<String, Object> msg) {
List<String> allOrg = new ArrayList<>();
if (msg.get("IncludeLowerLevel").equals("false")){
allOrg.add((String) msg.get("orgId"));
}else if(msg.get("IncludeLowerLevel").equals("true")){
//查询某组织机构的本级及下级
allOrg = pubOrgService.getLowerOrg(msg.get("orgId").toString());
}
return allOrg;
}
private List<Map<String, Object>> getAllCabinetByOrg(Map<String, Object> msg, List<String> allOrgId) {
List<Map<String, Object>> allCabinet = new ArrayList<>();
allCabinet = cabinetMapper.getAllCabinetByOrgList(allOrgId);
return allCabinet;
}
@Override @Override
public List<String> getAllCabinetId(Map<String, Object> msg) { public List<String> getAllCabinetId(Map<String, Object> msg) {
//如果组织机构是最高级的,获取所有id //如果组织机构是最高级的,获取所有id
...@@ -330,4 +390,22 @@ public class CabinetServiceImpl implements CabinetService { ...@@ -330,4 +390,22 @@ public class CabinetServiceImpl implements CabinetService {
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cabinetMsg); return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cabinetMsg);
} }
public ResponseResult setCabinetInventory(Map<String, Object> msg) {
String id;
if (msg.containsKey("locationId") && msg.get("locationId")!=""){
id = msg.get("locationId").toString();
}else {
id = null;
}
//统计仓库 装备总数
cabinetMapper.setCabinetSumInventory(id);
//统计仓库 装备在库总数
cabinetMapper.setCabinetInSumInventory(id);
//统计仓库 装备出库总数
cabinetMapper.setCabinetOutSumInventory(id);
//统计仓库 装备出库总数
cabinetMapper.setCabinetPriceInventory(id);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
} }
...@@ -166,6 +166,12 @@ public class EquipmentSizeServiceImpl implements EquipmentSizeService { ...@@ -166,6 +166,12 @@ public class EquipmentSizeServiceImpl implements EquipmentSizeService {
@Override @Override
public ResponseResult getAllSize(Map<String, Object> msg) { public ResponseResult getAllSize(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("typeId"), "typeId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<Map<String, Object>> allSize=new ArrayList<>(); List<Map<String, Object>> allSize=new ArrayList<>();
List<String> allSizeId =getAllSizeId(msg); List<String> allSizeId =getAllSizeId(msg);
for (String sizeId :allSizeId){ for (String sizeId :allSizeId){
...@@ -174,4 +180,10 @@ public class EquipmentSizeServiceImpl implements EquipmentSizeService { ...@@ -174,4 +180,10 @@ public class EquipmentSizeServiceImpl implements EquipmentSizeService {
} }
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allSize); return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allSize);
} }
@Override
public ResponseResult getSizeDevelop() {
List<Map<String,Object>> returnMsg = equipmentSizeMapper.getSizeDevelop();
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}
} }
package com.junmp.jyzb.service.impl; package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.EquipmentType; import com.junmp.jyzb.domain.EquipmentType;
import com.junmp.jyzb.domain.PubOrg;
import com.junmp.jyzb.mapper.SupplierMapper; import com.junmp.jyzb.mapper.SupplierMapper;
import com.junmp.jyzb.service.EquipmentTypeService; import com.junmp.jyzb.service.EquipmentTypeService;
import com.junmp.jyzb.utils.*; import com.junmp.jyzb.utils.*;
...@@ -27,81 +28,142 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -27,81 +28,142 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
private static final String REDIS_TYPE = "Type_"; private static final String REDIS_TYPE = "Type_";
@Override @Override
public List<Map<String, Object>> getEquipmentList() { public ResponseResult getEquipmentList() {
/*
// 构建 Redis 缓存键
String redisKey = REDIS_TYPE;
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
// for (Map<String,Object> one:cachedData){
// Long dataMsg = (Long) one.get("updateTime");
// one.put("updateTime", redisUtils.getDate(dataMsg));
// dataMsg = (Long) one.get("createTime");
// one.put("createTime", redisUtils.getDate(dataMsg));
// cachedData.add(one);
// }
return cachedData;
}
*/
List<EquipmentType> menuList = equipmentTypeMapper.selectAllEquipment(); List<EquipmentType> menuList = equipmentTypeMapper.selectAllEquipment();
List<Map<String, Object>> topList = new ArrayList<>();
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, List<Map<String, Object>>> childrenMap = new HashMap<>();
// 构建子菜单映射表
for (EquipmentType menu : menuList) { for (EquipmentType menu : menuList) {
//System.out.println(menu.getIdByParentId()+" "+menu.getName()+" "+menu.getParentId()); Map<String, Object> map = new HashMap<>();
//00000000-0000-0000-0000-000000000000 map.put("id", menu.getId());
if (!menu.getName().equals("超级根") && menu.getParentId().equals("00000000-0000-0000-0000-000000000000")) { map.put("name", menu.getName());
Map<String, Object> map = new HashMap<>(); map.put("unit", menu.getUnit());
map.put("id", menu.getId()); map.put("unitType", menu.getUnitType());
map.put("name", menu.getName()); map.put("code", menu.getCode());
map.put("unit", menu.getUnit()); map.put("parentId", menu.getParentId());
map.put("unitType", menu.getUnitType()); map.put("state", menu.getState());
map.put("code", menu.getCode()); map.put("note", menu.getNote());
map.put("parentId", menu.getParentId()); map.put("createTime", menu.getCreateTime());
map.put("state", menu.getState()); map.put("updateTime", menu.getUpdateTime());
map.put("note", menu.getNote()); map.put("type",menu.getType());
map.put("createTime", menu.getCreateTime());
map.put("updateTime", menu.getUpdateTime()); //如果是id和parentId都为 00000 的超级根,就将它放在映射为-1的数据中
map.put("children", getChildMenus(menu.getId(),menuList)); if (menu.getId().equals("00000000-0000-0000-0000-000000000000") && menu.getParentId().equals("00000000-0000-0000-0000-000000000000")){
resultList.add(map); childrenMap.put("-1", new ArrayList<>());
childrenMap.get("-1").add(map);
continue;
}
if (!childrenMap.containsKey(menu.getParentId())) {
childrenMap.put(menu.getParentId(), new ArrayList<>());
} }
childrenMap.get(menu.getParentId()).add(map);
} }
/* // 获取顶级菜单(最高一级的parentId 为 -1)
//将查询结果存入 Redis 中 List<Map<String, Object>> topMenus = childrenMap.get("-1");
redisUtils.set(redisKey, resultList);
*/
return resultList; // 迭代构建菜单树
} if (topMenus != null) {
private List<Map<String, Object>> getChildMenus(String parentId, List<EquipmentType> menuList) { for (Map<String, Object> topMenu : topMenus) {
List<Map<String, Object>> childList = new ArrayList<>(); Stack<Map<String, Object>> stack = new Stack<>();
for (EquipmentType menu : menuList) { stack.push(topMenu);
//if (menu.getParentId() != null && menu.getParentId().equals(parentId)) {
if (menu.getParentId().equals(parentId)) { // 使用栈进行深度优先遍历
Map<String, Object> map = new HashMap<>(); while (!stack.isEmpty()) {
map.put("id", menu.getId()); Map<String, Object> currentMenu = stack.pop();
map.put("name", menu.getName()); String currentMenuId = currentMenu.get("id").toString();
map.put("unit", menu.getUnit());
map.put("unitType", menu.getUnitType()); if (childrenMap.containsKey(currentMenuId)) {
map.put("code", menu.getCode()); List<Map<String, Object>> children = childrenMap.get(currentMenuId);
map.put("parentId", menu.getParentId()); currentMenu.put("children", children);
map.put("state", menu.getState());
map.put("note", menu.getNote()); for (int i = children.size() - 1; i >= 0; i--) {
map.put("createTime", menu.getCreateTime()); stack.push(children.get(i));
map.put("updateTime", menu.getUpdateTime()); }
List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList); }
if (!children.isEmpty()) {
map.put("children", children);
} }
childList.add(map); resultList.add(topMenu);
} }
} }
return childList; // 返回结果
return new ResponseResult(HttpStatus.SUCCESS, "操作成功", resultList);
} }
// @Override
// public List<Map<String, Object>> getEquipmentList() {
// List<EquipmentType> menuList = equipmentTypeMapper.selectAllEquipment();
// List<Map<String, Object>> resultList = new ArrayList<>();
// for (EquipmentType menu : menuList) {
// //System.out.println(menu.getIdByParentId()+" "+menu.getName()+" "+menu.getParentId());
// //00000000-0000-0000-0000-000000000000
// //List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList);
// if (!menu.getName().equals("超级根") && menu.getParentId().equals("00000000-0000-0000-0000-000000000000")) {
// //List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList);
// Map<String, Object> map = new HashMap<>();
// map.put("id", menu.getId());
// map.put("name", menu.getName());
// map.put("unit", menu.getUnit());
// map.put("unitType", menu.getUnitType());
// map.put("code", menu.getCode());
// map.put("parentId", menu.getParentId());
// map.put("state", menu.getState());
// map.put("note", menu.getNote());
// map.put("createTime", menu.getCreateTime());
// map.put("updateTime", menu.getUpdateTime());
//
// //map.put("children", children);
// List<Map<String, Object>> children = getChildMenus(menu.getId(),menuList);
// if (!children.isEmpty()) {
// map.put("children", children);
// }
//
// resultList.add(map);
// }
// }
///*
// //将查询结果存入 Redis 中
// redisUtils.set(redisKey, resultList);
//*/
// return resultList;
// }
// private List<Map<String, Object>> getChildMenus(String parentId, List<EquipmentType> menuList) {
// List<Map<String, Object>> childList = new ArrayList<>();
// for (EquipmentType menu : menuList) {
// if (menu.getParentId().equals(parentId)) {
// Map<String, Object> map = new HashMap<>();
// map.put("id", menu.getId());
// map.put("name", menu.getName());
// map.put("unit", menu.getUnit());
// map.put("unitType", menu.getUnitType());
// map.put("code", menu.getCode());
// map.put("parentId", menu.getParentId());
// map.put("state", menu.getState());
// map.put("note", menu.getNote());
// map.put("createTime", menu.getCreateTime());
// map.put("updateTime", menu.getUpdateTime());
//
// List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList);
// if (!children.isEmpty()) {
// map.put("children", children);
// }
//
// childList.add(map);
// }
// }
// return childList;
// }
@Override @Override
public ResponseResult addEquipment(Map<String, Object> msg) { public ResponseResult addEquipment(Map<String, Object> msg) {
try { try {
...@@ -109,29 +171,29 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -109,29 +171,29 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
checkNotBlank(msg.get("parentId"), "parentId不能为空"); checkNotBlank(msg.get("parentId"), "parentId不能为空");
checkNotBlank(msg.get("supplierList"), "supplierList不能为空"); checkNotBlank(msg.get("supplierList"), "supplierList不能为空");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage()); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
} }
//parentId只能是倒数第二级,因为插入的装备只能是最后一级 //parentId只能是倒数第二级,因为插入的装备只能是最后一级
String resultId = equipmentTypeMapper.getIdByParentId((String) msg.get("parentId")); String resultId = equipmentTypeMapper.getIdByParentId((String) msg.get("parentId"));
if (resultId == null || resultId.equals("")){ if (resultId == null || resultId.equals("")) {
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"传入的parentId有误,新的装备类型只能加在最后一级"); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "传入的parentId有误,新的装备类型只能加在最后一级");
} }
//判断传入的组织机构是否存在 //判断传入的组织机构是否存在
List<String> supplierFlag = new ArrayList<>(); List<String> supplierFlag = new ArrayList<>();
List<String> supplierList = (List<String>) msg.get("supplierList"); List<String> supplierList = (List<String>) msg.get("supplierList");
for(String supplierId:supplierList){ for (String supplierId : supplierList) {
Map<String, Object> oneSupplier = supplierMapper.getOneSupplier(supplierId,null,null); Map<String, Object> oneSupplier = supplierMapper.getOneSupplier(supplierId, null, null);
if (oneSupplier==null || oneSupplier.isEmpty()){ if (oneSupplier == null || oneSupplier.isEmpty()) {
supplierFlag.add(supplierId); supplierFlag.add(supplierId);
} }
} }
if (!supplierFlag.isEmpty()){ if (!supplierFlag.isEmpty()) {
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"传入的部分供应商不存在:"+supplierFlag); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "传入的部分供应商不存在:" + supplierFlag);
} }
EquipmentType equipmentType =new EquipmentType(); EquipmentType equipmentType = new EquipmentType();
//生成加入supplier-type表的uuid //生成加入supplier-type表的uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", ""); String uuid = UUID.randomUUID().toString().replaceAll("-", "");
...@@ -154,15 +216,15 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -154,15 +216,15 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
//计算出id后,判断数据库中是否已存在该id //计算出id后,判断数据库中是否已存在该id
String oneEquipment = equipmentTypeMapper.getOneEquipmentId(numStr); String oneEquipment = equipmentTypeMapper.getOneEquipmentId(numStr);
if (!(oneEquipment == null)){ if (!(oneEquipment == null)) {
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"添加异常,装备id已存在"); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "添加异常,装备id已存在");
} }
//读取装备的供应商列表,将相关数据加入到supplier_type表 //读取装备的供应商列表,将相关数据加入到supplier_type表
equipmentTypeMapper.addSupplier(uuid,equipmentType,supplierList); equipmentTypeMapper.addSupplier(uuid, equipmentType, supplierList);
//更新base_equipment_id表 //更新base_equipment_id表
equipmentTypeMapper.setCalculationId(numStr,(String) msg.get("parentId")); equipmentTypeMapper.setCalculationId(numStr, (String) msg.get("parentId"));
equipmentTypeMapper.addEquipment(equipmentType); equipmentTypeMapper.addEquipment(equipmentType);
...@@ -184,12 +246,12 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -184,12 +246,12 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
// redisUtils.set(redisKey, cachedData); // redisUtils.set(redisKey, cachedData);
// //
// } // }
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,numStr); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, numStr);
} }
@Override @Override
public ResponseResult calculationEquipmentId() { public ResponseResult calculationEquipmentId() {
List<Map<String,Object>> inputList = equipmentTypeMapper.getAll(); List<Map<String, Object>> inputList = equipmentTypeMapper.getAll();
// 假设您已经有了填充数据的inputList // 假设您已经有了填充数据的inputList
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
for (int i = 0; i < inputList.size() - 1; i++) { for (int i = 0; i < inputList.size() - 1; i++) {
...@@ -202,7 +264,7 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -202,7 +264,7 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
} }
} }
equipmentTypeMapper.addData(resultList); equipmentTypeMapper.addData(resultList);
return new ResponseResult(99200,ReturnMsg.PASS,resultList); return new ResponseResult(99200, ReturnMsg.PASS, resultList);
} }
@Override @Override
...@@ -211,11 +273,11 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -211,11 +273,11 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
try { try {
checkNotBlank(msg.get("equipmentList"), "equipmentList不能为空"); checkNotBlank(msg.get("equipmentList"), "equipmentList不能为空");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage()); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
} }
List<Object> equipmentList = (List<Object>) msg.get("equipmentList"); List<Object> equipmentList = (List<Object>) msg.get("equipmentList");
for (Object equipmentId:equipmentList){ for (Object equipmentId : equipmentList) {
//判断装备id在数据库中是否存在 //判断装备id在数据库中是否存在
equipmentTypeMapper.deleteEquipment(equipmentId.toString()); equipmentTypeMapper.deleteEquipment(equipmentId.toString());
} }
...@@ -230,7 +292,7 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -230,7 +292,7 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
checkNotBlank(msg.get("parentId"), "parentId不能为空"); checkNotBlank(msg.get("parentId"), "parentId不能为空");
checkNotBlank(msg.get("supplierList"), "supplierList不能为空"); checkNotBlank(msg.get("supplierList"), "supplierList不能为空");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage()); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
} }
// //parentId只能是倒数第二级,因为插入的装备只能是最后一级 // //parentId只能是倒数第二级,因为插入的装备只能是最后一级
...@@ -242,23 +304,23 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -242,23 +304,23 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
//判断传入的供应商是否存在 //判断传入的供应商是否存在
List<String> supplierFlag = new ArrayList<>(); List<String> supplierFlag = new ArrayList<>();
List<String> supplierList = (List<String>) msg.get("supplierList"); List<String> supplierList = (List<String>) msg.get("supplierList");
for(String supplierId:supplierList){ for (String supplierId : supplierList) {
Map<String, Object> oneSupplier = supplierMapper.getOneSupplier(supplierId,null,null); Map<String, Object> oneSupplier = supplierMapper.getOneSupplier(supplierId, null, null);
if (oneSupplier==null || oneSupplier.isEmpty()){ if (oneSupplier == null || oneSupplier.isEmpty()) {
supplierFlag.add(supplierId); supplierFlag.add(supplierId);
} }
} }
if (!supplierFlag.isEmpty()){ if (supplierFlag != null) {
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"传入的部分供应商不存在:"+supplierFlag); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "传入的部分供应商不存在:" + supplierFlag);
} }
//计算出id后,判断数据库中是否已存在该id //计算出id后,判断数据库中是否已存在该id
String oneEquipment = equipmentTypeMapper.getOneEquipmentId(msg.get("id").toString()); String oneEquipment = equipmentTypeMapper.getOneEquipmentId(msg.get("id").toString());
if (oneEquipment == null || oneEquipment.equals("")){ if (oneEquipment == null || oneEquipment.equals("")) {
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"未查询到相应的装备类型"); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "未查询到相应的装备类型");
} }
EquipmentType equipmentType =new EquipmentType(); EquipmentType equipmentType = new EquipmentType();
//生成加入supplier-type表的uuid //生成加入supplier-type表的uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", ""); String uuid = UUID.randomUUID().toString().replaceAll("-", "");
...@@ -284,7 +346,7 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -284,7 +346,7 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
//删除装备的所有供应商信息,在将相关数据加入到supplier_type表 //删除装备的所有供应商信息,在将相关数据加入到supplier_type表
equipmentTypeMapper.deleteSupplier(equipmentType.getId()); equipmentTypeMapper.deleteSupplier(equipmentType.getId());
//读取装备的供应商列表,将相关数据加入到supplier_type表 //读取装备的供应商列表,将相关数据加入到supplier_type表
equipmentTypeMapper.addSupplier(uuid,equipmentType,supplierList); equipmentTypeMapper.addSupplier(uuid, equipmentType, supplierList);
equipmentTypeMapper.updateEquipment(equipmentType); equipmentTypeMapper.updateEquipment(equipmentType);
...@@ -297,10 +359,10 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -297,10 +359,10 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
checkNotBlank(msg.get("id"), "id不能为空"); checkNotBlank(msg.get("id"), "id不能为空");
Objects.requireNonNull(msg.get("state"), "state不能为空"); Objects.requireNonNull(msg.get("state"), "state不能为空");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage()); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
} }
EquipmentType equipment =new EquipmentType(); EquipmentType equipment = new EquipmentType();
equipment.setId(msg.get("id").toString()); equipment.setId(msg.get("id").toString());
equipment.setState((Integer) msg.get("state")); equipment.setState((Integer) msg.get("state"));
equipmentTypeMapper.changeEquipmentState(equipment); equipmentTypeMapper.changeEquipmentState(equipment);
...@@ -308,22 +370,113 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService { ...@@ -308,22 +370,113 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
} }
@Override @Override
public ResponseResult getOneEquipment(Map<String, Object> msg) { public ResponseResult getOneEquipment(Map<String, Object> msg) {
try { try {
checkNotBlank(msg.get("typeId"), "typeId不能为空"); checkNotBlank(msg.get("typeId"), "typeId不能为空");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage()); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
} }
EquipmentType equipment =new EquipmentType(); EquipmentType equipment = new EquipmentType();
equipment.setId(msg.get("typeId").toString()); equipment.setId(msg.get("typeId").toString());
Map<String, Object> oneEquipment = equipmentTypeMapper.getOneEquipment(equipment); Map<String, Object> oneEquipment = equipmentTypeMapper.getOneEquipment(equipment);
//返回对应的供应商信息 //返回对应的供应商信息
List<Map<String, Object>> supplierMsg = equipmentTypeMapper.getSupplierByTypeId(equipment); List<Map<String, Object>> supplierMsg = equipmentTypeMapper.getSupplierByTypeId(equipment);
oneEquipment.put("supplierList",supplierMsg); oneEquipment.put("supplierList", supplierMsg);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,oneEquipment); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, oneEquipment);
}
@Override
public ResponseResult showEquipmentChildren(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("equipmentId"), "equipmentId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
String equipmentId = msg.get("equipmentId").toString();
List<Map<String, Object>> equipmentMsg = equipmentTypeMapper.getChildByParentId(equipmentId);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, equipmentMsg);
}
@Override
public ResponseResult setTypeParentIds() {
//清空parent_ids字段
equipmentTypeMapper.wipeParentIdsData();
//更新parent_ids字段
equipmentTypeMapper.setTypeParentIds();
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public List<Map<String, Object>> showAllEquipment() {
List<EquipmentType> menuList = equipmentTypeMapper.selectAllEquipment();
List<Map<String, Object>> resultList = new ArrayList<>();
for (EquipmentType menu : menuList) {
//System.out.println(menu.getIdByParentId()+" "+menu.getName()+" "+menu.getParentId());
//00000000-0000-0000-0000-000000000000
//List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList);
if (!menu.getName().equals("超级根") && menu.getParentId().equals("00000000-0000-0000-0000-000000000000")) {
//List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList);
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getId());
map.put("name", menu.getName());
map.put("unit", menu.getUnit());
map.put("unitType", menu.getUnitType());
map.put("code", menu.getCode());
map.put("parentId", menu.getParentId());
map.put("state", menu.getState());
map.put("note", menu.getNote());
map.put("createTime", menu.getCreateTime());
map.put("updateTime", menu.getUpdateTime());
//去掉最后一级children只能加两次
//map.put("children", children);
List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList);
if (!children.isEmpty()) {
map.put("children", children);
}
resultList.add(map);
}
}
return resultList;
}
@Override
public ResponseResult getEquipmentDevelop() {
List<Map<String,Object>> returnMsg = equipmentTypeMapper.getEquipmentDevelop();
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}
private List<Map<String, Object>> getChildMenus(String parentId, List<EquipmentType> menuList) {
List<Map<String, Object>> childList = new ArrayList<>();
for (EquipmentType menu : menuList) {
if (menu.getParentId().equals(parentId)) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getId());
map.put("name", menu.getName());
map.put("unit", menu.getUnit());
map.put("unitType", menu.getUnitType());
map.put("code", menu.getCode());
map.put("parentId", menu.getParentId());
map.put("state", menu.getState());
map.put("note", menu.getNote());
map.put("createTime", menu.getCreateTime());
map.put("updateTime", menu.getUpdateTime());
List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList);
if (!children.isEmpty()) {
map.put("children", children);
}
childList.add(map);
}
}
return childList;
} }
} }
package com.junmp.jyzb.service.impl; package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.PubOrg;
import com.junmp.jyzb.service.CabinetService;
import com.junmp.jyzb.service.InventoryService; import com.junmp.jyzb.service.InventoryService;
import com.junmp.jyzb.service.WarehouseService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.junmp.jyzb.mapper.InventoryMapper; import com.junmp.jyzb.mapper.InventoryMapper;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service @Service
public class InventoryServiceImpl implements InventoryService { public class InventoryServiceImpl implements InventoryService {
@Resource @Resource
private InventoryMapper inventoryMapper; private InventoryMapper inventoryMapper;
@Resource
private WarehouseService warehouseService;
@Resource
private CabinetService cabinetService;
@Override
public ResponseResult getEquipmentInfo(Map<String, Object> inMsg) {
//参数校验
try {
checkNotBlank(inMsg.get("queryType"), "queryType不能为空");
checkNotBlank(inMsg.get("typeId"), "typeId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//解析json中的信息
String queryType = inMsg.get("queryType").toString();
String idMsg = inMsg.get("typeId").toString();
//根据传入的queryType来辨别要查询什么信息
if (queryType.equals("org") || queryType.equals("warehouse") || queryType.equals("cabinet")){
Map<String,Object> returnMsg = getLocationEquipmentInfo(queryType,idMsg);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}else {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"输入的queryType信息有误");
}
}
private Map<String, Object> getLocationEquipmentInfo(String queryType, String idMsg) {
List<Map<String, Object>> allMsg = inventoryMapper.getLocationInventory(queryType,idMsg);
Map<String, Object> resultMap = new HashMap<>();
for (Map<String, Object> msg : allMsg) {
String locationId = msg.get("locationId").toString();
String locationName = msg.get("locationName").toString();
String typeId = msg.get("typeId").toString();
String typeName = msg.get("typeName").toString();
String sizeId = msg.get("sizeId").toString();
String sizeName = msg.get("sizeName").toString();
int number = (int) msg.get("number");
BigDecimal priceBigDecimal = (BigDecimal) msg.get("price");
float price = priceBigDecimal.floatValue();
//检查resultMap中是否存在orgId
if (resultMap.containsKey(locationId)) {
// 获取现有组织级数据
Map<String, Object> orgData = (Map<String, Object>) resultMap.get(locationId);
List<Map<String, Object>> orgTypeList = (List<Map<String, Object>>) orgData.get("typeList");
// 检查组织类型列表中是否存在typeId
boolean typeExist = false;
for (Map<String, Object> typeData : orgTypeList) {
if (typeId.equals(typeData.get("typeId"))) {
// 获取现有的类型级别数据
List<Map<String, Object>> sizeList = (List<Map<String, Object>>) typeData.get("sizeList");
sizeList.add(createSizeData(sizeId,sizeName, number,price)); //向sizeList中记录number的信息
int typeNumber = (int) typeData.get("typeNum");
float typePrice = (float) typeData.get("typeTotalPrice");
typeData.put("typeNum", typeNumber + number); //计算装备数量
typeData.put("typeTotalPrice", typePrice + price);
typeExist = true;
break;
}
}
// 如果 orgTypeList 中不包含 typeId,则创建新的类型级别数据
if (!typeExist) {
Map<String, Object> typeData = new HashMap<>();
typeData.put("typeId", typeId);
typeData.put("typeName", typeName);
typeData.put("typeNum", number);
typeData.put("typeTotalPrice", price);
List<Map<String, Object>> sizeList = new ArrayList<>();
sizeList.add(createSizeData(sizeId,sizeName, number,price));
typeData.put("sizeList", sizeList);
orgTypeList.add(typeData);
}
// 更新组织级别数据
int orgNumber = (int) orgData.get("locationNum");
float orgPrice = (float) orgData.get("totalPrice");
orgData.put("locationNum", orgNumber + number);
orgData.put("totalPrice", orgPrice + price);
} else {
// 创建新的组织级别数据
Map<String, Object> orgData = new HashMap<>();
orgData.put("locationType", queryType);
orgData.put("locationId", locationId);
orgData.put("locationName", locationName);
orgData.put("locationNum", number);
orgData.put("totalPrice", price);
List<Map<String, Object>> orgTypeList = new ArrayList<>();
Map<String, Object> typeData = new HashMap<>();
typeData.put("typeId", typeId);
typeData.put("typeName", typeName);
typeData.put("typeNum", number);
typeData.put("typeTotalPrice", price);
List<Map<String, Object>> sizeList = new ArrayList<>();
sizeList.add(createSizeData(sizeId,sizeName, number,price));
typeData.put("sizeList", sizeList);
orgTypeList.add(typeData);
orgData.put("typeList", orgTypeList);
resultMap.put(locationId, orgData);
}
}
Map<String,Object> returnMsg = (Map<String, Object>) resultMap.get(idMsg);
return returnMsg;
}
private static Map<String, Object> createSizeData(String sizeId,String sizeName, int number,float price) {
Map<String, Object> sizeData = new HashMap<>();
sizeData.put("sizeId", sizeId);
sizeData.put("sizeName", sizeName);
sizeData.put("sizeNum", number);
sizeData.put("sizeTotalPrice", price);
return sizeData;
}
@Override
public ResponseResult setInventoryMsg(){
inventoryMapper.deleteAllMsg(); //清空数据库中已存在的信息
//inventoryMapper.setOrgInventory(); //放入组织机构信息汇总
inventoryMapper.setCabinetInventory(); //放入组织机构信息汇总
inventoryMapper.setWarehouseInventory(); //放入组织机构信息汇总
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult updateInventoryNum(Map<String, Object> msg) {
//参数校验
try {
checkNotBlank(msg.get("locationType"), "locationType不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String locationType = msg.get("locationType").toString();
if (!locationType.equals("warehouse") && !locationType.equals("cabinet")){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"输入的locationType值有误");
}else if(locationType.equals("warehouse")){
warehouseService.setWarehouseInventory(msg);
}else if(locationType.equals("cabinet")){
cabinetService.setCabinetInventory(msg);
}
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult getInventoryList(Map<String, Object> msg) {
//参数校验
try {
checkNotBlank(msg.get("queryType"), "queryType不能为空");
checkNotBlank(msg.get("typeCode"), "typeCode不能为空");
checkNotBlank(msg.get("typeId"), "typeId不能为空");
checkNotBlank(msg.get("sizeId"), "sizeId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//解析json中的信息
String queryType = msg.get("queryType").toString();
String typeCode = msg.get("typeCode").toString();
String typeId = msg.get("typeId").toString();
String sizeId = msg.get("sizeId").toString();
//根据传入的queryType来辨别要查询什么信息
if (queryType.equals("org") || queryType.equals("warehouse") || queryType.equals("cabinet")){
List<Map<String,Object>> returnMsg = inventoryMapper.getInventoryList(queryType,typeCode,typeId,sizeId);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}else {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"输入的queryType信息有误");
}
}
@Override
public ResponseResult getInventoryByOrgId(Map<String, Object> msg) {
//参数校验
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String orgId = msg.get("orgId").toString();
List<Map<String,Object>> returnMsg = inventoryMapper.getInventoryByOrgId(orgId);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}
@Override
public ResponseResult getInventoryDevelop() {
return null;
}
} }
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.MqttGateWayService;
import org.springframework.stereotype.Service;
//@Service
public class MqttGateWayServiceImpl implements MqttGateWayService {
// @Override
// public void sendMessageToMqtt(String data) {
//
// }
//
// @Override
// public void sendMessageToMqtt(String data, String topic) {
//
// }
//
// @Override
// public void sendMessageToMqtt(String data, String topic, int qos) {
//
// }
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.mapper.MsgMapper;
import com.junmp.jyzb.service.MsgService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class MsgServiceImpl implements MsgService {
@Resource
private MsgMapper msgMapper;
@Override
public ResponseResult getMsg(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("tableName"), "tableName不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String orgId = msg.get("orgId").toString();
String tableName = msg.get("tableName").toString();
List<Map<String,Object>> returnMsg = msgMapper.getMsg(orgId,tableName);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}
@Override
public ResponseResult getUserMsg(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String orgId = msg.get("orgId").toString();
List<Map<String,Object>> returnMsg = msgMapper.getUserMsg(orgId);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.OrderMain;
import com.junmp.jyzb.mapper.OrderMainMapper;
import com.junmp.jyzb.service.OrderService;
import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class OrderServiceImpl implements OrderService {
@Resource
private OrderMainMapper orderMapper;
@Override
public ResponseResult addOrder(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orderType"), "orderType不能为空");
checkNotBlank(msg.get("processId"), "processId不能为空");
checkNotBlank(msg.get("bussinessType"), "bussinessType不能为空");
checkNotBlank(msg.get("orderCode"), "orderCode不能为空");
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("inventoryQuantity"), "inventoryQuantity不能为空");
checkNotBlank(msg.get("manualState"), "manualState不能为空");
checkNotBlank(msg.get("orderState"), "orderState不能为空");
checkNotBlank(msg.get("attachmentLocation"), "attachmentLocation不能为空");
checkNotBlank(msg.get("invList"), "invList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
OrderMain order = new OrderMain();
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
order.setCreateTime(currentDate);
order.setUpdateTime(currentDate);
order.setOrderType((String) msg.get("orderType"));
order.setProcessId((String) msg.get("processId"));
order.setBussinessType((String) msg.get("bussinessType"));
order.setOrderCode((String) msg.get("orderCode"));
order.setOrgId((String) msg.get("orgId"));
order.setInventoryQuantity((Integer) msg.get("inventoryQuantity"));
order.setManualState((Integer) msg.get("manualState"));
order.setOrderState((Integer) msg.get("orderState"));
order.setAttachmentLocation((String) msg.get("attachmentLocation"));
order.setInvList((String) msg.get("invList"));
Long id = orderMapper.addOrder(order);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,id);
}
@Override
public ResponseResult showOrder(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String orgId = msg.get("orgId").toString();
List<Map<String,Object>> allMsg = orderMapper.showOrder(orgId);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,allMsg);
}
@Override
public ResponseResult updateOrder(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("id"), "id不能为空");
checkNotBlank(msg.get("orderType"), "orderType不能为空");
checkNotBlank(msg.get("processId"), "processId不能为空");
checkNotBlank(msg.get("bussinessType"), "bussinessType不能为空");
checkNotBlank(msg.get("orderCode"), "orderCode不能为空");
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("inventoryQuantity"), "inventoryQuantity不能为空");
checkNotBlank(msg.get("manualState"), "manualState不能为空");
checkNotBlank(msg.get("orderState"), "orderState不能为空");
checkNotBlank(msg.get("attachmentLocation"), "attachmentLocation不能为空");
checkNotBlank(msg.get("invList"), "invList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
OrderMain order = new OrderMain();
//生成当前时间
order.setId((Long) msg.get("id"));
Date currentDate = DateTimeUtil.getCurrentDateTime();
order.setUpdateTime(currentDate);
order.setOrderType((String) msg.get("orderType"));
order.setProcessId((String) msg.get("processId"));
order.setBussinessType((String) msg.get("bussinessType"));
order.setOrderCode((String) msg.get("orderCode"));
order.setOrgId((String) msg.get("orgId"));
order.setInventoryQuantity((Integer) msg.get("inventoryQuantity"));
order.setManualState((Integer) msg.get("manualState"));
order.setOrderState((Integer) msg.get("orderState"));
order.setAttachmentLocation((String) msg.get("attachmentLocation"));
order.setInvList((String) msg.get("invList"));
orderMapper.updateOrder(order);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult getOrderDetail(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("id"), "id不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String id = msg.get("id").toString();
Map<String,Object> oneMsg = orderMapper.getOrderDetail(id);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,oneMsg);
}
}
...@@ -4,21 +4,15 @@ import com.junmp.jyzb.domain.PoliceFinger; ...@@ -4,21 +4,15 @@ import com.junmp.jyzb.domain.PoliceFinger;
import com.junmp.jyzb.domain.PubOrg; import com.junmp.jyzb.domain.PubOrg;
import com.junmp.jyzb.mapper.*; import com.junmp.jyzb.mapper.*;
import com.junmp.jyzb.service.PolicemanService; import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.utils.*; import com.junmp.jyzb.utils.*;
import org.apache.tomcat.util.buf.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.junmp.jyzb.domain.Policeman; import com.junmp.jyzb.domain.Policeman;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank; import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
...@@ -43,6 +37,9 @@ public class PolicemanServiceImpl implements PolicemanService { ...@@ -43,6 +37,9 @@ public class PolicemanServiceImpl implements PolicemanService {
@Resource @Resource
private PubOrgMapper pubOrgMapper; private PubOrgMapper pubOrgMapper;
@Resource
private PubOrgService pubOrgService;
private static final String REDIS_POLICE = "Policeman_"; private static final String REDIS_POLICE = "Policeman_";
private static final String REDIS_ORG = "Organization_"; private static final String REDIS_ORG = "Organization_";
...@@ -76,8 +73,9 @@ public class PolicemanServiceImpl implements PolicemanService { ...@@ -76,8 +73,9 @@ public class PolicemanServiceImpl implements PolicemanService {
//todo cabinetBoxId能否重复 //todo cabinetBoxId能否重复
//查询单警柜箱号是否存在 //查询单警柜箱号是否存在
if (policeman.get("cabinetBoxId").toString()!=null){ if (policeman.containsKey("cabinetBoxId") && policeman.get("cabinetBoxId").toString()!=""){ //如果cabinetBoxId的存在且值不为空
String oneCabinetBox = cabinetBoxMapper.getOneCabinetBox(policeman.get("cabinetBoxId").toString()); String oneCabinetBox = cabinetBoxMapper.getOneCabinetBox(policeman.get("cabinetBoxId").toString());
if (oneCabinetBox == null || oneCabinetBox.equals("")){ if (oneCabinetBox == null || oneCabinetBox.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该单警柜箱号不存在"); return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该单警柜箱号不存在");
...@@ -105,33 +103,33 @@ public class PolicemanServiceImpl implements PolicemanService { ...@@ -105,33 +103,33 @@ public class PolicemanServiceImpl implements PolicemanService {
policemanMapper.addPoliceman(police); policemanMapper.addPoliceman(police);
// 将uuid、创建时间、更新时间加入到policeman中 // // 将uuid、创建时间、更新时间加入到policeman中
policeman.put("id",uuid); // policeman.put("id",uuid);
long timestamp = currentDate.getTime(); // 将Date对象转换为long类型的时间戳 // long timestamp = currentDate.getTime(); // 将Date对象转换为long类型的时间戳
policeman.put("updateTime",timestamp); // policeman.put("updateTime",timestamp);
//
/** // /**
* 更新缓存 // * 更新缓存
* */ // * */
//构建Redis缓存键 // //构建Redis缓存键
String redisKey = REDIS_ORG + "true" +'_'+ policeman.get("orgId").toString(); // String redisKey = REDIS_ORG + "true" +'_'+ policeman.get("orgId").toString();
// 从 Redis 中获取数据 // // 从 Redis 中获取数据
List<Map<String, Object>> cachedDataTrue = redisUtils.findCachedData(redisKey); // List<Map<String, Object>> cachedDataTrue = redisUtils.findCachedData(redisKey);
if (cachedDataTrue != null) { // if (cachedDataTrue != null) {
cachedDataTrue.add(0,policeman); // cachedDataTrue.add(0,policeman);
//将查询结果存入 Redis 中 // //将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataTrue); // redisUtils.set(redisKey, cachedDataTrue);
} // }
//
//构建Redis缓存键 // //构建Redis缓存键
redisKey = REDIS_ORG + "false" +'_'+ policeman.get("orgId").toString(); // redisKey = REDIS_ORG + "false" +'_'+ policeman.get("orgId").toString();
// 从 Redis 中获取数据 // // 从 Redis 中获取数据
List<Map<String, Object>> cachedDataFalse = redisUtils.findCachedData(redisKey); // List<Map<String, Object>> cachedDataFalse = redisUtils.findCachedData(redisKey);
if (cachedDataFalse != null) { // if (cachedDataFalse != null) {
cachedDataFalse.add(0,policeman); // cachedDataFalse.add(0,policeman);
//将查询结果存入 Redis 中 // //将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataFalse); // redisUtils.set(redisKey, cachedDataFalse);
} // }
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,uuid); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,uuid);
} }
...@@ -239,14 +237,14 @@ public class PolicemanServiceImpl implements PolicemanService { ...@@ -239,14 +237,14 @@ public class PolicemanServiceImpl implements PolicemanService {
List<String> policeCodeFlag = policemanMapper.getPoliceByPoliceCode(policeCode); List<String> policeCodeFlag = policemanMapper.getPoliceByPoliceCode(policeCode);
//判断policeCode是否有变动 //判断policeCode是否有变动
String oldPoliceCode = policemanMapper.getPoliceCodeById(policeman.get("id").toString()); String oldPoliceCode = policemanMapper.getPoliceCodeById(policeman.get("id").toString());
if (!oldPoliceCode.equals(policeCode)){ if (oldPoliceCode!=null && !oldPoliceCode.equals(policeCode)){
if (!policeCodeFlag.isEmpty()){ if (!policeCodeFlag.isEmpty()){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"警员编号已存在"); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"警员编号已存在");
} }
} }
//查询单警柜箱号是否存在 //查询单警柜箱号是否存在
if (policeman.containsKey("cabinetBoxId")){ if (policeman.containsKey("cabinetBoxId") && policeman.get("cabinetBoxId").toString()!=""){
String oneCabinetBox = cabinetBoxMapper.getOneCabinetBox(policeman.get("cabinetBoxId").toString()); String oneCabinetBox = cabinetBoxMapper.getOneCabinetBox(policeman.get("cabinetBoxId").toString());
if (oneCabinetBox == null || oneCabinetBox.equals("")){ if (oneCabinetBox == null || oneCabinetBox.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该单警柜箱号不存在"); return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该单警柜箱号不存在");
...@@ -482,7 +480,7 @@ public class PolicemanServiceImpl implements PolicemanService { ...@@ -482,7 +480,7 @@ public class PolicemanServiceImpl implements PolicemanService {
allPoliceman.add(one); allPoliceman.add(one);
} }
return cachedData; return cachedData;
} }
for (String policeId : allPoliceId) { for (String policeId : allPoliceId) {
Map<String, Object> policeMsg = policemanMapper.getOnePolice(policeId); Map<String, Object> policeMsg = policemanMapper.getOnePolice(policeId);
allPoliceman.add(policeMsg); allPoliceman.add(policeMsg);
...@@ -506,50 +504,88 @@ public class PolicemanServiceImpl implements PolicemanService { ...@@ -506,50 +504,88 @@ public class PolicemanServiceImpl implements PolicemanService {
List<Map<String, Object>> allPoliceman = new ArrayList<>(); List<Map<String, Object>> allPoliceman = new ArrayList<>();
// 构建 Redis 缓存键 // // 构建 Redis 缓存键
String redisKey = REDIS_ORG + msg.get("IncludeLowerLevel").toString() +'_'+ msg.get("orgId").toString(); // String redisKey = REDIS_ORG + msg.get("IncludeLowerLevel").toString() +'_'+ msg.get("orgId").toString();
// 从 Redis 中获取数据 // // 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey); // List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) { // if (cachedData != null) {
//将Long类型的数据转化为Date // //将Long类型的数据转化为Date
for (Map<String,Object> one:cachedData){ // for (Map<String,Object> one:cachedData){
//如果updateTime的类型为Long // //如果updateTime的类型为Long
Long dataMsg = (Long) one.get("updateTime"); // Long dataMsg = (Long) one.get("updateTime");
one.put("updateTime", redisUtils.getDate(dataMsg)); // one.put("updateTime", redisUtils.getDate(dataMsg));
allPoliceman.add(one); // allPoliceman.add(one);
} // }
//按照updateTime降序排序 // //按照updateTime降序排序
//DateTimeUtil.timeSort(allPoliceman); // //DateTimeUtil.timeSort(allPoliceman);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allPoliceman); // return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allPoliceman);
} // }
//如果组织机构是浙江省公安厅 //如果组织机构是浙江省公安厅
if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){ if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){
allPoliceman = policemanMapper.getAllPolice(); allPoliceman = policemanMapper.getAllPolice();
//将查询结果存入 Redis 中 //将查询结果存入 Redis 中
redisUtils.set(redisKey, allPoliceman); //redisUtils.set(redisKey, allPoliceman);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allPoliceman); return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allPoliceman);
} }
//获取该组织机构下所有警员的id //获取组织机构Id
List<String> allPoliceId =getAllPoliceId(msg); List<String> allOrgId =getAllOrgId(msg);
if (allOrgId.isEmpty()){
if (allPoliceId==null){ return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"未查询到相关信息");
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"未查询到相关数据或IncludeLowerLevel有误");
} }
//根据获取的警员id查询相关信息 //根据获取的组织机构查询警员信息
allPoliceman = getAllPolicemanMsg(msg,allPoliceId); allPoliceman = getAllPolicemanByOrg(msg,allOrgId);
// for (String policeId :allPoliceId){
// Map<String, Object> policeMsg = policemanService.getOnePolice(policeId); //将查询结果存入 Redis 中
// List<Map<String, Object>> fingerprints= fingerService.getFingersByUserId(policeId); //redisUtils.set(redisKey, allPoliceman);
// policeMsg.put("fingerMsg",fingerprints);
// allPoliceman.add(policeMsg);
// }
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",allPoliceman); return new ResponseResult(HttpStatus.SUCCESS,"操作成功",allPoliceman);
} }
private List<Map<String, Object>> getAllPolicemanByOrg(Map<String, Object> msg, List<String> allOrgId) {
List<Map<String, Object>> allPoliceman = new ArrayList<>();
// // 构建 Redis 缓存键
// String redisKey = REDIS_ORG + msg.get("IncludeLowerLevel").toString() +'_'+ msg.get("orgId").toString();
// // 从 Redis 中获取数据
// List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
// if (cachedData != null) {
// //将Long类型的数据转化为Date
// for (Map<String,Object> one:cachedData){
// Long dataMsg = (Long) one.get("updateTime");
// one.put("updateTime", redisUtils.getDate(dataMsg));
// allPoliceman.add(one);
// }
// return cachedData;
// }
// for (String orgId : allOrgId) {
// List<Map<String, Object>> policeMsg = policemanMapper.getAllPolicemanByOrg(orgId);
// allPoliceman.addAll(policeMsg);
// }
allPoliceman = policemanMapper.getAllPolicemanByOrgList(allOrgId);
//按照updateTime降序排序
//DateTimeUtil.timeSort(allPoliceman);
// //将查询结果存入 Redis 中
// redisUtils.set(redisKey, allPoliceman);
return allPoliceman;
}
private List<String> getAllOrgId(Map<String, Object> msg) {
List<String> allOrg = new ArrayList<>();
if (msg.get("IncludeLowerLevel").equals("false")){
allOrg.add((String) msg.get("orgId"));
}else if(msg.get("IncludeLowerLevel").equals("true")){
//查询某组织机构的本级及下级
allOrg = pubOrgService.getLowerOrg(msg.get("orgId").toString());
}
return allOrg;
}
@Override @Override
public ResponseResult getPoliceData(Map<String, Object> cabinetId) { public ResponseResult getPoliceData(Map<String, Object> cabinetId) {
try { try {
...@@ -596,7 +632,7 @@ public class PolicemanServiceImpl implements PolicemanService { ...@@ -596,7 +632,7 @@ public class PolicemanServiceImpl implements PolicemanService {
allMsg.put("policeList",policeMsg); allMsg.put("policeList",policeMsg);
//将查询结果存入 Redis 中 //将查询结果存入 Redis 中
redisUtils.set(redisKey, allMsg); redisUtils.set(redisKey, allMsg);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allMsg); return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allMsg);
} }
} }
...@@ -81,6 +81,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl ...@@ -81,6 +81,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
@Override @Override
public PageResult<Product> findPage(ProductReq req) { public PageResult<Product> findPage(ProductReq req) {
LambdaQueryWrapper<Product> wrapper = createWrapper(req); LambdaQueryWrapper<Product> wrapper = createWrapper(req);
Page<Product> page = this.page(PageFactory.getDefaultPage(), wrapper); Page<Product> page = this.page(PageFactory.getDefaultPage(), wrapper);
return PageResultFactory.createPageResult(page); return PageResultFactory.createPageResult(page);
} }
......
package com.junmp.jyzb.service.impl; package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.EquipmentType;
import com.junmp.jyzb.domain.PubOrg; import com.junmp.jyzb.domain.PubOrg;
import com.junmp.jyzb.utils.HttpStatus; import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.RedisUtils; import com.junmp.jyzb.utils.RedisUtils;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import com.sun.javafx.collections.MappingChange;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.junmp.jyzb.mapper.PubOrgMapper; import com.junmp.jyzb.mapper.PubOrgMapper;
import com.junmp.jyzb.service.PubOrgService; import com.junmp.jyzb.service.PubOrgService;
import java.math.BigInteger;
import java.util.*; import java.util.*;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service @Service
public class PubOrgServiceImpl implements PubOrgService{ public class PubOrgServiceImpl implements PubOrgService{
...@@ -22,21 +26,314 @@ public class PubOrgServiceImpl implements PubOrgService{ ...@@ -22,21 +26,314 @@ public class PubOrgServiceImpl implements PubOrgService{
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
//todo 当orgId不传入-1会出现bug
@Override
public ResponseResult showPubOrgList(Map<String, Object> orgId) { public ResponseResult showPubOrgList(Map<String, Object> orgId) {
// 构建 Redis 缓存键
String redisKey = "showPubOrgList";
Long orgInfo = Long.valueOf(orgId.get("orgId").toString());//获取输入的组织机构id信息
// 从 Redis 中获取数据
List<PubOrg> cachedData = redisUtils.findCachedData(redisKey);
List<PubOrg> menuList = new ArrayList<>();
if (cachedData != null) {
menuList = cachedData;
} else {
// 从数据库获取数据并将结果存入 Redis 缓存
menuList = pubOrgMapper.selectAllOrg();
redisUtils.set(redisKey, menuList);
}
List<Map<String, Object>> topList = new ArrayList<>();
List<Map<String, Object>> resultList = new ArrayList<>();
Map<Long, List<Map<String, Object>>> childrenMap = new HashMap<>();
// 构建子菜单映射表
for (PubOrg menu : menuList) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getOrgId());
map.put("parentId", menu.getOrgParentId());
map.put("findCode", menu.getFindCode());
map.put("orgName", menu.getDName());
map.put("statusFlag",menu.getStatusFlag());
if (!childrenMap.containsKey(menu.getOrgParentId())) {
childrenMap.put(menu.getOrgParentId(), new ArrayList<>());
}
childrenMap.get(menu.getOrgParentId()).add(map);
//构建最顶级的菜单
if (menu.getOrgId().equals(orgInfo)){
Map<String, Object> topMap = new HashMap<>();
topMap.put("id", menu.getOrgId());
topMap.put("parentId", menu.getOrgParentId());
topMap.put("findCode", menu.getFindCode());
topMap.put("orgName", menu.getDName());
topMap.put("statusFlag",menu.getStatusFlag());
topList.add(topMap);
}
}
// 获取顶级菜单
List<Map<String, Object>> topMenus = childrenMap.get(orgInfo);
// 迭代构建菜单树
if (topMenus != null) {
for (Map<String, Object> topMenu : topMenus) {
Stack<Map<String, Object>> stack = new Stack<>();
stack.push(topMenu);
// 使用栈进行深度优先遍历
while (!stack.isEmpty()) {
Map<String, Object> currentMenu = stack.pop();
Long currentMenuId = (Long) currentMenu.get("id");
if (childrenMap.containsKey(currentMenuId)) {
List<Map<String, Object>> children = childrenMap.get(currentMenuId);
currentMenu.put("children", children);
for (int i = children.size() - 1; i >= 0; i--) {
stack.push(children.get(i));
}
}
}
resultList.add(topMenu);
}
}
if (orgInfo == -1) {
modifyList(resultList);
// 如果输入的是浙江省公安厅,就将下级的组织机构进行排序
for (Map<String, Object> orgMsg : resultList) {
List<Map<String, Object>> children = (List<Map<String, Object>>) orgMsg.get("children");
// 根据findCode从小到大排序
children.sort(Comparator.comparing(m -> m.get("findCode").toString()));
}
return new ResponseResult(HttpStatus.SUCCESS, "操作成功", resultList);
}
//将resultList的内容放在顶级菜单的resultList中
for (Map<String,Object> oneMap:topList){
oneMap.put("children",resultList);
}
// 遍历并添加父类的相关信息到children的第一个位置
modifyList(topList);
if (orgInfo.equals(1369509498032808905L)) {
// 如果输入的是浙江省公安厅,就将下级的组织机构进行排序
for (Map<String, Object> orgMsg : topList) {
List<Map<String, Object>> children = (List<Map<String, Object>>) orgMsg.get("children");
// 根据findCode从小到大排序
children.sort(Comparator.comparing(m -> m.get("findCode").toString()));
}
return new ResponseResult(HttpStatus.SUCCESS, "操作成功", topList);
}
// 返回结果
return new ResponseResult(HttpStatus.SUCCESS, "操作成功", topList);
}
//将父类信息放在children的第一个位置
private static void modifyList(List<Map<String, Object>> list) {
for (Map<String, Object> item : list) {
// 获取当前节点的ID
Map<String,Object> setMsg = new HashMap<>();
setMsg.put("id", item.get("id").toString() + "-0"); //在最后面加个 -0 来表示列表的唯一id
setMsg.put("parentId", item.get("parentId").toString());
setMsg.put("findCode", item.get("findCode").toString());
setMsg.put("orgName", item.get("orgName").toString());
setMsg.put("statusFlag",item.get("statusFlag"));
// 将当前节点的ID添加到子节点的第一个位置
@SuppressWarnings("unchecked")
List<Map<String, Object>> children = (List<Map<String, Object>>) item.get("children");
if (children != null && children.size() > 0) {
//将父类的相关信息放在children的第一个位置
children.set(0,setMsg);
// 递归处理子节点
modifyList(children);
}
}
}
//删除前缀
public static Map<String,Object> removeFront(Map<String,Object> map, String name1,List<String> name2,List<String> name3) {
String orgName = map.get("orgName").toString();
orgName = removeStringAndBefore(orgName,name1);
for (String name:name2){
orgName = removePrefix(orgName,name);
for (String staticName:name3){
orgName = removePrefix(orgName,staticName);
}
}
map.put("orgName",orgName);
return map;
}
//找到字符串出现的位置,删掉字符串及前缀
public static String removeStringAndBefore(String name, String deleteMsg) {
int index = name.indexOf(deleteMsg);
if (index != -1) {
return name.substring(index + deleteMsg.length());
}
return name;
}
//例:传入abc,a ==>bc 删掉开头的字符串,不是就不删除
public static String removePrefix(String name, String deleteName) {
if (name.startsWith(deleteName)) {
return name.substring(deleteName.length());
} else {
return name;
}
}
/**
* 组织机构名称不进行删减的代码
* */
@Override
public ResponseResult showPubOrgListOld(Map<String, Object> orgId) {
//构建 Redis 缓存键 //构建 Redis 缓存键
String redisKey = "showPubOrgList_"+orgId; String redisKey = "showPubOrgList";
// 从 Redis 中获取数据 // 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey); List<PubOrg> cachedData = redisUtils.findCachedData(redisKey);
List<PubOrg> menuList = new ArrayList<>();
if (cachedData!=null){ if (cachedData!=null){
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",cachedData); menuList = cachedData;
}else {
menuList = pubOrgMapper.selectAllOrg();
redisUtils.set(redisKey, menuList);
}
List<Map<String, Object>> resultList = new ArrayList<>();
Map<Long, List<Map<String, Object>>> childrenMap = new HashMap<>();
// 构建子菜单映射表
for (PubOrg menu : menuList) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getOrgId());
map.put("parentId", menu.getOrgParentId());
map.put("orgName", menu.getOrgName());
if (!childrenMap.containsKey(menu.getOrgParentId())) {
childrenMap.put(menu.getOrgParentId(), new ArrayList<>());
}
childrenMap.get(menu.getOrgParentId()).add(map);
}
Long orgInfo=Long.valueOf(orgId.get("orgId").toString());
// 获取顶级菜单
List<Map<String, Object>> topMenus = childrenMap.get(orgInfo);
// 迭代构建菜单树
if (topMenus != null) {
for (Map<String, Object> topMenu : topMenus) {
Stack<Map<String, Object>> stack = new Stack<>();
stack.push(topMenu);
while (!stack.isEmpty()) {
Map<String, Object> currentMenu = stack.pop();
Long currentMenuId = (Long) currentMenu.get("id");
if (childrenMap.containsKey(currentMenuId)) {
List<Map<String, Object>> children = childrenMap.get(currentMenuId);
currentMenu.put("children", children);
for (int i = children.size() - 1; i >= 0; i--) {
stack.push(children.get(i));
}
}
}
resultList.add(topMenu);
}
} }
//redisUtils.set(redisKey, resultList);
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",resultList);
}
@Override
public List<String> getLowerOrg(String orgId) {
//构建 Redis 缓存键
String redisKey = "getLowerOrg";
// 从 Redis 中获取数据
List<PubOrg> cachedData = redisUtils.findCachedData(redisKey);
List<PubOrg> menuList = new ArrayList<>();
if (cachedData!=null){
menuList = cachedData;
}else {
menuList = pubOrgMapper.selectAllOrg();
redisUtils.set(redisKey, menuList);
}
List<String> resultList = new ArrayList<>(); // 存储最终的菜单树结果
Map<Long, List<String>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映射
resultList.add(orgId); //将自己加入到返回的List中
// 构建子菜单映射表
for (PubOrg menu : menuList) {
String org = menu.getOrgId().toString();
if (!childrenMap.containsKey(menu.getOrgParentId())) { // 如果父菜单还不存在于映射表中
childrenMap.put(menu.getOrgParentId(), new ArrayList<>()); // 创建一个新的子菜单列表
}
childrenMap.get(menu.getOrgParentId()).add(org); // 将当前菜单项放入对应的子菜单列表中
}
Long orgInfo = Long.valueOf(orgId);//获取输入的组织机构id信息
//Long orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符
// 获取顶级菜单
List<String> topMenus = childrenMap.get(orgInfo);
// 迭代构建菜单树
if (topMenus != null) {
Queue<String> queue = new LinkedList<>(); // 使用队列结构辅助构建菜单树
queue.addAll(topMenus); // 将当前顶级菜单项放入队列中
while (!queue.isEmpty()) {
String currentMenu = queue.poll(); // 取出队首的当前菜单项
//Long currentMenuId = currentMenu; // 获取当前菜单项的标识符
if (childrenMap.containsKey(currentMenu)) { // 如果当前菜单项有子菜单
List<String> children = childrenMap.get(currentMenu); // 获取子菜单列表
//currentMenu.put("children", children); // 将子菜单列表放入当前菜单项中的"children"字段
queue.addAll(children); // 将子菜单项放入队列中
}
resultList.add(currentMenu); // 将已经处理完的当前菜单项添加到结果列表中
}
}
//redisUtils.set(redisKey, resultList);
return resultList;
}
@Override
public ResponseResult setOrgParentIds() {
//清空parent_ids字段
pubOrgMapper.wipeParentIdsData();
//更新parent_ids字段
pubOrgMapper.setOrgParentIds();
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult setShortName(Map<String, Object> orgId) {
List<PubOrg> menuList = pubOrgMapper.selectAllOrg(); List<PubOrg> menuList = pubOrgMapper.selectAllOrg();
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
for (PubOrg menu : menuList) { for (PubOrg menu : menuList) {
//System.out.println(menu.getIdByParentId()+" "+menu.getName()+" "+menu.getParentId());
if (menu.getOrgParentId().toString().equals((orgId.get("orgId")))) { if (menu.getOrgParentId().toString().equals((orgId.get("orgId")))) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", menu.getOrgId()); map.put("id", menu.getOrgId());
...@@ -69,13 +366,19 @@ public class PubOrgServiceImpl implements PubOrgService{ ...@@ -69,13 +366,19 @@ public class PubOrgServiceImpl implements PubOrgService{
List<Map<String, Object>> children = getChildMenus(menu.getOrgId(),menuList,name1,name2,name3);//name为要删掉的前缀 List<Map<String, Object>> children = getChildMenus(menu.getOrgId(),menuList,name1,name2,name3);//name为要删掉的前缀
if (!children.isEmpty()) { if (!children.isEmpty()) {
map.put("children", children); map.put("children", children);
for (Map<String,Object> msg:children){
Long id = (Long) msg.get("id");
String orgName = msg.get("orgName").toString();
pubOrgMapper.setMsg(id,orgName);
}
} }
//map.put("children", getChildMenus(menu.getOrgId(),menuList,name1,name2,name3)); //map.put("children", getChildMenus(menu.getOrgId(),menuList,name1,name2,name3));
resultList.add(map); resultList.add(map);
} }
} }
redisUtils.set(redisKey, resultList);
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",resultList); return new ResponseResult(HttpStatus.SUCCESS,"操作成功",resultList);
} }
...@@ -99,9 +402,7 @@ public class PubOrgServiceImpl implements PubOrgService{ ...@@ -99,9 +402,7 @@ public class PubOrgServiceImpl implements PubOrgService{
result = removePrefix(result, name3); result = removePrefix(result, name3);
} }
} }
map.put("orgName", result); map.put("orgName", result);
if (result.length()>3 && (result.charAt(2)=='省' ||result.charAt(2)=='市')){ if (result.length()>3 && (result.charAt(2)=='省' ||result.charAt(2)=='市')){
name2.remove(1); name2.remove(1);
String nameHistory = result.substring(0,3); //获得“绍兴市” String nameHistory = result.substring(0,3); //获得“绍兴市”
...@@ -117,6 +418,11 @@ public class PubOrgServiceImpl implements PubOrgService{ ...@@ -117,6 +418,11 @@ public class PubOrgServiceImpl implements PubOrgService{
List<Map<String, Object>> children = getChildMenus(menu.getOrgId(), menuList,name1,name2,deleteName3); List<Map<String, Object>> children = getChildMenus(menu.getOrgId(), menuList,name1,name2,deleteName3);
if (!children.isEmpty()) { if (!children.isEmpty()) {
map.put("children", children); map.put("children", children);
// for (Map<String,Object> msg:children){
// Long id = (Long) msg.get("id");
// String orgName = msg.get("orgName").toString();
// pubOrgMapper.setMsg(id,orgName);
// }
} }
childList.add(map); childList.add(map);
} }
...@@ -124,63 +430,42 @@ public class PubOrgServiceImpl implements PubOrgService{ ...@@ -124,63 +430,42 @@ public class PubOrgServiceImpl implements PubOrgService{
return childList; return childList;
} }
//例:传入abc,a ==>bc 删掉开头的字符串,不是就不删除
public static String removePrefix(String name, String deleteName) {
if (name.startsWith(deleteName)) {
return name.substring(deleteName.length());
} else {
return name;
}
}
/**
* 组织机构名称不进行删减的代码
* */
@Override @Override
public ResponseResult showPubOrgListOld(Map<String, Object> orgId) { public ResponseResult getOrgDetail(Map<String, Object> msg) {
//构建 Redis 缓存键 try {
String redisKey = "showPubOrgListOld_"+orgId; checkNotBlank(msg.get("orgId"), "orgId不能为空");
// 从 Redis 中获取数据 } catch (IllegalArgumentException e) {
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
if (cachedData!=null){
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",cachedData);
} }
List<PubOrg> menuList = pubOrgMapper.selectAllOrg(); String orgId = msg.get("orgId").toString();
List<Map<String, Object>> resultList = new ArrayList<>();
for (PubOrg menu : menuList) {
if (menu.getOrgParentId().toString().equals((orgId.get("orgId")))) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getOrgId());
map.put("parentId", menu.getOrgParentId());
map.put("orgName", menu.getOrgName());
List<Map<String, Object>> children = getChildMenusOld(menu.getOrgId(), menuList);
if (!children.isEmpty()) {
map.put("children", children);
}
resultList.add(map);
}
}
redisUtils.set(redisKey, resultList); Map<String,Object> resultList = pubOrgMapper.getOrgDetail(orgId);
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",resultList); return new ResponseResult(HttpStatus.SUCCESS, "操作成功", resultList);
} }
private List<Map<String, Object>> getChildMenusOld(Long parentId, List<PubOrg> menuList) { @Override
List<Map<String, Object>> childList = new ArrayList<>(); public ResponseResult changeOrgState(Map<String, Object> msg) {
for (PubOrg menu : menuList) { try {
if (menu.getOrgParentId().toString().equals(parentId.toString())) { checkNotBlank(msg.get("statusFlag"), "statusFlag不能为空");
Map<String, Object> map = new HashMap<>(); checkNotBlank(msg.get("orgIdList"), "orgIdList不能为空");
map.put("id", menu.getOrgId()); } catch (IllegalArgumentException e) {
map.put("parentId", menu.getOrgParentId()); return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
map.put("orgName", menu.getOrgName());
List<Map<String, Object>> children = getChildMenusOld(menu.getOrgId(), menuList);
if (!children.isEmpty()) {
map.put("children", children);
}
childList.add(map);
}
} }
return childList; List<String> orgIdList = (List<String>) msg.get("orgIdList");
Integer statusFlag = (Integer) msg.get("statusFlag");
pubOrgMapper.changeOrgState(statusFlag,orgIdList);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
} }
} }
...@@ -131,52 +131,19 @@ public class SupplierServiceImpl implements SupplierService { ...@@ -131,52 +131,19 @@ public class SupplierServiceImpl implements SupplierService {
@Override @Override
public ResponseResult getAllSupplier(Map<String, Object> msg) { public ResponseResult getAllSupplier(Map<String, Object> msg) {
// Object name = msg.get("name"); String name="";
// Object code = msg.get("code"); String shortName="";
// List<Map<String, Object>> allSupplier=new ArrayList<>();
// // 构建 Redis 缓存键 if (msg.containsKey("name")){
// String redisKey = REDIS_SUPPLIER; name = msg.get("name").toString();
// // 从 Redis 中获取数据 }else if (msg.containsKey("shortName")){
// List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey); shortName = msg.get("shortName").toString();
// if (cachedData != null) { }
// //将Long类型的数据转化为Date
// for (Map<String,Object> one:cachedData){
// Long dataMsg = (Long) one.get("updateTime");
// one.put("updateTime", redisUtils.getDate(dataMsg));
// allSupplier.add(one);
// }
// return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allSupplier);
// }
//
// List<String> allSupplierId =getAllSupplierId();
// for (String supplierId :allSupplierId){
// Map<String, Object> supplierMsg = getOneSupplier(supplierId,null,null); //入参设置为null,关闭模糊查询
// if (supplierMsg!=null){
// allSupplier.add(supplierMsg);
// }
// }
// //将查询结果存入Redis中, 不设置过期时间 , 默认为永久
// redisUtils.set(redisKey, allSupplier);
// return new ResponseResult(HttpStatus.SUCCESS,"操作成功",allSupplier);
List<Map<String, Object>> allSupplier=new ArrayList<>(); List<Map<String, Object>> allSupplier=new ArrayList<>();
//构建 Redis 缓存键 //查询所有供应商信息,传入的参数为模糊查询的参数
String redisKey = REDIS_SUPPLIER; allSupplier = supplierMapper.getAllSupplier(name,shortName);
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
for (Map<String,Object> one:cachedData){
Long dataMsg = (Long) one.get("updateTime");
one.put("updateTime", redisUtils.getDate(dataMsg));
allSupplier.add(one);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allSupplier);
}
//将查询结果存入Redis中, 不设置过期时间 , 默认为永久
allSupplier = supplierMapper.getAllSupplier();
redisUtils.set(redisKey, allSupplier);
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",allSupplier); return new ResponseResult(HttpStatus.SUCCESS,"操作成功",allSupplier);
} }
......
...@@ -3,6 +3,7 @@ package com.junmp.jyzb.service.impl; ...@@ -3,6 +3,7 @@ package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.*; import com.junmp.jyzb.domain.*;
import com.junmp.jyzb.mapper.*; import com.junmp.jyzb.mapper.*;
import com.junmp.jyzb.service.PolicemanService; import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.service.WarehouseService; import com.junmp.jyzb.service.WarehouseService;
import com.junmp.jyzb.utils.*; import com.junmp.jyzb.utils.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -31,6 +32,9 @@ public class WarehouseServiceImpl implements WarehouseService { ...@@ -31,6 +32,9 @@ public class WarehouseServiceImpl implements WarehouseService {
private ShelfMapper shelfMapper; private ShelfMapper shelfMapper;
@Resource @Resource
private PubOrgService pubOrgService;
@Resource
private WarehouseAreaMapper areaMapper; private WarehouseAreaMapper areaMapper;
private static final String REDIS_WAREHOUSE = "Warehouse_"; private static final String REDIS_WAREHOUSE = "Warehouse_";
...@@ -202,40 +206,66 @@ public class WarehouseServiceImpl implements WarehouseService { ...@@ -202,40 +206,66 @@ public class WarehouseServiceImpl implements WarehouseService {
} }
List<Map<String, Object>> allWarehouse=new ArrayList<>(); List<Map<String, Object>> allWarehouse=new ArrayList<>();
// 构建 Redis 缓存键 // // 构建 Redis 缓存键
String redisKey = REDIS_WAREHOUSE + msg.get("IncludeLowerLevel").toString() + "_" + msg.get("orgId").toString(); // String redisKey = REDIS_WAREHOUSE + msg.get("IncludeLowerLevel").toString() + "_" + msg.get("orgId").toString();
// 从 Redis 中获取数据 // // 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey); // List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) { // if (cachedData != null) {
//将Long类型的数据转化为Date // //将Long类型的数据转化为Date
for (Map<String,Object> one:cachedData){ // for (Map<String,Object> one:cachedData){
Long dataMsg = (Long) one.get("updateTime"); // Long dataMsg = (Long) one.get("updateTime");
one.put("updateTime", redisUtils.getDate(dataMsg)); // one.put("updateTime", redisUtils.getDate(dataMsg));
allWarehouse.add(one); // allWarehouse.add(one);
} // }
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse); // return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse);
} // }
//如果组织机构是浙江省公安厅 //如果组织机构是浙江省公安厅
if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){ if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){
allWarehouse = warehouseMapper.getAllWarehouse(); allWarehouse = warehouseMapper.getAllWarehouse();
//将查询结果存入 Redis 中 //将查询结果存入 Redis 中
redisUtils.set(redisKey, allWarehouse); //redisUtils.set(redisKey, allWarehouse);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse); return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse);
} }
//获取组织机构Id
List<String> allOrgId =getAllOrgId(msg);
if (allOrgId.isEmpty()){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"未查询到相关信息");
}
//根据获取的组织机构查询警员信息
allWarehouse = getAllWarehouseByOrg(msg,allOrgId);
//获取该组织机构下所有仓库的id //获取该组织机构下所有仓库的id
//String orgId = msg.get("orgId").toString(); //String orgId = msg.get("orgId").toString();
List<String> allWarehouseId =getAllWarehouseId(msg); // List<String> allWarehouseId =getAllWarehouseId(msg);
for (String warehouseId :allWarehouseId){ // for (String warehouseId :allWarehouseId){
Map<String, Object> warehouseMsg = warehouseMapper.getOneWarehouse(warehouseId); // Map<String, Object> warehouseMsg = warehouseMapper.getOneWarehouse(warehouseId);
allWarehouse.add(warehouseMsg); // allWarehouse.add(warehouseMsg);
} // }
//将查询结果存入 Redis 中 //将查询结果存入 Redis 中
redisUtils.set(redisKey, allWarehouse); //redisUtils.set(redisKey, allWarehouse);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse); return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse);
} }
private List<String> getAllOrgId(Map<String, Object> msg) {
List<String> allOrg = new ArrayList<>();
if (msg.get("IncludeLowerLevel").equals("false")){
allOrg.add((String) msg.get("orgId"));
}else if(msg.get("IncludeLowerLevel").equals("true")){
//查询某组织机构的本级及下级
allOrg = pubOrgService.getLowerOrg(msg.get("orgId").toString());
}
return allOrg;
}
private List<Map<String, Object>> getAllWarehouseByOrg(Map<String, Object> msg, List<String> allOrgId) {
List<Map<String, Object>> allWarehouse = new ArrayList<>();
allWarehouse = warehouseMapper.getAllWarehouseByOrgList(allOrgId);
return allWarehouse;
}
@Override @Override
public ResponseResult addArea(Map<String, Object> msg) { public ResponseResult addArea(Map<String, Object> msg) {
try { try {
...@@ -472,4 +502,23 @@ public class WarehouseServiceImpl implements WarehouseService { ...@@ -472,4 +502,23 @@ public class WarehouseServiceImpl implements WarehouseService {
redisUtils.set(redisKey, warehouseId); redisUtils.set(redisKey, warehouseId);
return warehouseId; return warehouseId;
} }
@Override
public ResponseResult setWarehouseInventory(Map<String, Object> msg) {
String id;
if (msg.containsKey("locationId") && msg.get("locationId")!=""){
id = msg.get("locationId").toString();
}else {
id = null;
}
//统计仓库 装备总数
warehouseMapper.setWarehouseSumInventory(id);
//统计仓库 装备在库总数
warehouseMapper.setWarehouseInSumInventory(id);
//统计仓库 装备出库总数
warehouseMapper.setWarehouseOutSumInventory(id);
//统计仓库 装备出库总数
warehouseMapper.setWarehousePriceInventory(id);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
} }
...@@ -30,9 +30,24 @@ import java.util.Date; ...@@ -30,9 +30,24 @@ import java.util.Date;
public class ClearLogAction implements JobAction { public class ClearLogAction implements JobAction {
@Resource
private LogManagerApi logManagerApi;
@Override @Override
public void action() { public void action() {
//获取两月前的日期
// ConfigExpander.getClearLogOffsetValue()
Integer offset = 60;
//Date maxTime = DateUtil.offsetMonth(new Date(), offset);
Date maxTime = DateUtil.offsetDay(new Date(),offset);
//配置过滤条件
LogRequest request = new LogRequest();
request.setLogType(10);
request.setEndDate(DateUtil.formatDate(maxTime));
logManagerApi.clearLog(request);
log.warn(StrUtil.format("{} 清理日志完成",
DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT)));
} }
} }
package com.junmp.jyzb.task;
import com.junmp.jyzb.api.util.GenCodeUtil;
import com.junmp.jyzb.entity.Company;
import com.junmp.jyzb.mapper.ExpireMapper;
import com.junmp.jyzb.mapper.MsgMapper;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.job.api.JobAction;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map;
/**
* @Author: Zhaojw
* @Description: 过期物资消息提醒
* @DateTime: 2023/7/14 16:25
* @Params:
* @Return
*/
@Slf4j
@Component
public class InvExpireMsg implements JobAction {
@Resource
private ExpireMapper ExpireMapper;
@Resource
private ExpireMapper InvertoryMapper;
@Override
public void action() {
Company company = new Company();
// int InvCount=
Map<String,Object> oneMsg = ExpireMapper.QueryTop1000ExpireInv();
}
}
...@@ -4,7 +4,7 @@ import org.omg.CORBA.NO_PERMISSION; ...@@ -4,7 +4,7 @@ import org.omg.CORBA.NO_PERMISSION;
/** /**
* 返回状态码 * 返回状态码
* *
* @author ruoyi * @author ruoyi
*/ */
public class HttpStatus public class HttpStatus
......
...@@ -49,10 +49,12 @@ ...@@ -49,10 +49,12 @@
o.org_name as orgName, o.org_name as orgName,
c.location, c.location,
c.state, c.state,
c.update_time as updateTime c.update_time as updateTime,
from pub_org o c.sum as sum,
right join base_cabinet c on c.org_id_int =o.org_id c.in_sum as inSum,
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
</select> </select>
<select id="getAllCabinetId" resultType="String"> <select id="getAllCabinetId" resultType="String">
...@@ -87,4 +89,80 @@ ...@@ -87,4 +89,80 @@
<select id="getCabinetNumById" resultType="java.lang.String"> <select id="getCabinetNumById" resultType="java.lang.String">
select cabinet_num from base_cabinet where id =#{id} select cabinet_num from base_cabinet where id =#{id}
</select> </select>
<select id="getAllCabinetByOrgList" parameterType="java.util.List" resultType="java.util.Map">
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime,
c.sum as sum,
c.in_sum as inSum,
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
where c.org_id_int in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<update id="setCabinetSumInventory">
UPDATE base_cabinet AS c
SET sum = (
SELECT count(i.id)
FROM base_cabinet_box AS b
JOIN base_inventory AS i ON b.id = i.location_id
WHERE b.cabinet_id = c.id
)
<if test="updateId != null and updateId != ''">
where c.id = #{updateId}
</if>
</update>
<update id="setCabinetInSumInventory">
UPDATE base_cabinet AS c
JOIN (
SELECT b.cabinet_id, COUNT(i.id) AS total_count
FROM base_cabinet_box AS b
JOIN base_inventory AS i ON b.id = i.location_id
WHERE i.location_state = 'in'
GROUP BY b.cabinet_id
) AS subquery ON c.id = subquery.cabinet_id
SET c.in_sum = subquery.total_count
<if test="updateId != null and updateId != ''">
where c.id = #{updateId}
</if>
</update>
<update id="setCabinetOutSumInventory">
UPDATE base_cabinet AS c
SET out_sum = (
SELECT count(i.id)
FROM base_cabinet_box AS b
JOIN base_inventory AS i ON b.id = i.location_id
WHERE b.cabinet_id = c.id and i.location_state="out"
)
<if test="updateId != null and updateId != ''">
where c.id = #{updateId}
</if>
</update>
<update id="setCabinetPriceInventory">
UPDATE base_cabinet AS c
SET price_total = (
SELECT sum(price)
FROM base_cabinet_box AS b
JOIN base_inventory AS i ON b.id = i.location_id
WHERE b.cabinet_id = c.id
)
<if test="updateId != null and updateId != ''">
where c.id = #{updateId}
</if>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -64,4 +64,10 @@ ...@@ -64,4 +64,10 @@
<!-- <select id="getCodeById" resultType="java.lang.String">--> <!-- <select id="getCodeById" resultType="java.lang.String">-->
<!-- select from where id =#{id}--> <!-- select from where id =#{id}-->
<!-- </select>--> <!-- </select>-->
<select id="getSizeDevelop" resultType="Map">
select
*
from base_equipment_size
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
</sql> </sql>
<select id="selectAllEquipment" resultType="com.junmp.jyzb.domain.EquipmentType"> <select id="selectAllEquipment" resultType="com.junmp.jyzb.domain.EquipmentType">
SELECT id,name,unit,unit_type,code,parent_id,state,note,code,create_time,update_time SELECT id,name,unit,unit_type,code,parent_id,state,note,code,create_time,update_time,type
FROM base_equipment_type FROM base_equipment_type
where type = 0
</select> </select>
<!-- <where>--> <!-- <where>-->
<!-- <if test="SelectTypeId != null">--> <!-- <if test="SelectTypeId != null">-->
...@@ -139,4 +140,52 @@ ...@@ -139,4 +140,52 @@
select id select id
from base_equipment_type w from base_equipment_type w
</select> </select>
<select id="getChildByParentId" resultType="Map">
select
id,
name,
unit,
unit_type as unitType,
code,
parent_id as parentId,
state,
note,
create_time as createTime,
update_time as updateTime
from base_equipment_type
where parent_id = #{equipmentId}
</select>
<update id="wipeParentIdsData">
UPDATE base_equipment_type t
SET t.parent_ids = "";
</update>
<update id="setTypeParentIds" parameterType="java.util.Map">
WITH RECURSIVE cte AS (
SELECT id, parent_id, CAST(id AS CHAR(200)) AS parent_ids
FROM base_equipment_type
WHERE parent_id = "-1"
UNION ALL
SELECT o.id, o.parent_id,
CASE
WHEN FIND_IN_SET(o.parent_id, cte.parent_ids) > 0 THEN cte.parent_ids
ELSE CONCAT(cte.parent_ids, ',', o.parent_id)
END AS parent_ids
FROM base_equipment_type o
INNER JOIN cte ON o.parent_id = cte.id
)
UPDATE base_equipment_type p
JOIN cte ON p.id = cte.id
SET p.parent_ids = cte.parent_ids;
</update>
<select id="getEquipmentDevelop" resultType="Map">
select
*
from base_equipment_type
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.ExpireMapper">
<!-- <resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.Inventory">-->
<!-- &lt;!&ndash;@mbg.generated&ndash;&gt;-->
<!-- &lt;!&ndash;@Table base_equipment_size&ndash;&gt;-->
<!-- <id column="id" jdbcType="VARCHAR" property="id" />-->
<!-- <result column="type_id" jdbcType="VARCHAR" property="typeId" />-->
<!-- <result column="state" jdbcType="VARCHAR" property="state" />-->
<!-- <result column="production_date" jdbcType="DATE" property="productionDate" />-->
<!-- <result column="org_id_int" jdbcType="VARCHAR" property="orgId" />-->
<!-- <result column="warranty_period" jdbcType="INTEGER" property="warrantyPeriod" />-->
<!-- <result column="maintenance_period" jdbcType="INTEGER" property="maintenancePeriod" />-->
<!-- <result column="note" jdbcType="VARCHAR" property="note" />-->
<!-- </resultMap>-->
<select id="QueryTop1000ExpireInv" resultType="Map">
SELECT *
FROM base_inventory
WHERE DATE_ADD(production_date, INTERVAL warranty_period DAY) &lt; CURDATE()
LIMIT 1000; -- 获取第一页的1000条记录
</select>
<select id="QueryExpireInv" resultType="Map">
SELECT *
FROM base_inventory
WHERE DATE_ADD(production_date, INTERVAL warranty_period DAY) &lt; CURDATE()
LIMIT #{currentNum} OFFSET #{nextNum};
</select>
</mapper>
\ No newline at end of file
...@@ -36,4 +36,202 @@ ...@@ -36,4 +36,202 @@
production_date, warranty_period, maintenance_period, fix_count, price, create_time, production_date, warranty_period, maintenance_period, fix_count, price, create_time,
update_time, note update_time, note
</sql> </sql>
<select id="getSum" resultType="Map">
</select>
<select id="getOrgNum" resultType="Map">
</select>
<select id="getLocationInventory" resultType="Map">
select
id,
<if test="queryType == 'org'">
org_id_int as locationId,
</if>
<if test="queryType == 'warehouse' or queryType == 'cabinet'">
location_id as locationId,
</if>
<if test="queryType == 'org'">
org_name as locationName,
</if>
<if test="queryType == 'warehouse' or queryType == 'cabinet'">
location_name as locationName,
</if>
type_id as typeId,
type_name as typeName,
size_id as sizeId,
size_name as sizeName,
number,
price,
stock_number as stockNumber,
outbound_number as outboundNumber
from base_inventory_summary
<if test="queryType == 'org'">
where org_id_int = #{idMsg}
</if>
<if test="queryType == 'warehouse' or queryType == 'cabinet'">
where location_id = #{idMsg}
</if>
</select>
<delete id="deleteAllMsg">
delete from base_inventory_summary
</delete>
<insert id="setOrgInventory">
INSERT INTO base_inventory_summary (id, org_id_int, org_name, type_id,type_name,size_id,size_name, number, price, stock_number, outbound_number)
SELECT
UUID() AS id,
bi.org_id_int,
po.org_name,
bi.type_id,
t.name,
bi.size_id,
s.name,
COUNT(*) AS number,
SUM(bi.price) AS price,
SUM(CASE WHEN bi.location_state = 'in' THEN 1 ELSE 0 END) AS stock_number,
COUNT(*) - SUM(CASE WHEN bi.location_state = 'in' THEN 1 ELSE 0 END) AS outbound_number
FROM base_inventory bi
JOIN pub_org po ON bi.org_id_int = po.org_id
join base_equipment_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id
WHERE bi.org_id_int IN (
SELECT org_id_int
FROM base_inventory
GROUP BY org_id_int, type_id
HAVING type_id IN (
SELECT type_id
FROM base_inventory
GROUP BY type_id
)
)
GROUP BY bi.org_id_int, bi.type_id, bi.size_id;
</insert>
<insert id="setCabinetInventory">
INSERT INTO base_inventory_summary (id,org_id_int,org_name,location_id,location_name,type_id,type_name,size_id,size_name,number, price, stock_number, outbound_number,location_type)
SELECT
UUID() as id,
bi.org_id_int as orgIdInt,
po.org_name as orgName,
bi.location_id as locationId,
bc.name as locationName,
bi.type_id,
t.name as typeName,
bi.size_id,
s.name as sizeName,
count(*) as 'number',
sum(bi.price) as 'price',
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stockNumber',
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outboundNumber',
bi.location_type
FROM base_inventory bi
join base_cabinet_box bcb on bi.location_id = bcb.id
join base_cabinet bc on bcb.cabinet_id = bc.id
join base_equipment_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id
join pub_org po on bi.org_id_int = po.org_id
WHERE location_id IN (
SELECT location_id
FROM base_inventory
GROUP BY location_id,type_id
having type_id in(
SELECT
type_id as 'typeId'
FROM base_inventory b
GROUP BY type_id
)
)
and location_type = 1
GROUP BY location_id, type_id,size_id,bi.org_id_int;
</insert>
<insert id="setWarehouseInventory">
INSERT INTO base_inventory_summary (id,org_id_int,org_name,location_id, location_name,type_id, type_name,size_id,size_name, number, price, stock_number, outbound_number,location_type)
SELECT
UUID() as id,
bi.org_id_int as orgIdInt,
po.org_name as orgName,
bi.location_id as locationId,
bw.name as locationName,
bi.type_id,
t.name as typeName,
bi.size_id,
s.name as sizeName,
count(*) as 'number',
sum(bi.price) as 'price',
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stockNumber',
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outboundNumber',
bi.location_type
FROM base_inventory bi
join base_warehouse bw on bi.location_id = bw.id
join base_equipment_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id
join pub_org po on bi.org_id_int = po.org_id
WHERE location_id IN (
SELECT location_id
FROM base_inventory
GROUP BY location_id,type_id
having type_id in(
SELECT
type_id as 'typeId'
FROM base_inventory b
GROUP BY type_id
)
)
and location_type = 0
GROUP BY location_id, type_id,size_id,bi.org_id_int;
</insert>
<select id="getInventoryList" resultType="Map">
select
IFNULL(i.id, 'null') as id,
IFNULL(i.epc, 'null') as epc,
IFNULL(i.size_id, 'null') as sizeId,
IFNULL(es.name, 'null') as sizeName,
IFNULL(i.type_id, 'null') as typeId,
IFNULL(et.name, 'null') as typeName,
IFNULL(i.supplier_id, 'null') as supplierId,
IFNULL(s.name, 'null') as supplierName,
IFNULL(i.state, 'null') as state,
IFNULL(i.location_state, 'null') as locationState,
IFNULL(i.production_date, 'null') as productionDate,
IFNULL(i.location_type, 'null') as locationType,
IFNULL(i.location_id, 'null') as locationId,
IFNULL(i.price, 'null') as price,
IFNULL(i.shelf_id, 'null') as shelfId,
IFNULL(i.shelf_location, 'null') as shelfLocation,
IFNULL(i.bussiness_state, 'null') as bussinessState,
IFNULL(i.warranty_period, 'null') as warrantyPeriod,
IFNULL(i.maintenance_period, 'null') as maintenancePeriod,
IFNULL(i.create_time, 'null') as createTime,
IFNULL(i.update_time, 'null') as updateTime,
IFNULL(i.update_user, 'null') as updateUser,
IFNULL(i.create_user, 'null') as createUser
from base_inventory i
join base_equipment_type et on et.id = i.type_id
join base_equipment_size es on es.id = i.size_id
join base_supplier s on s.id = i.supplier_id
<if test="queryType == 'org'">
where org_id_int = #{typeCode}
</if>
<if test="queryType == 'warehouse' or queryType == 'cabinet'">
where location_id = #{typeCode}
</if>
and size_id = #{sizeId}
</select>
<select id="getInventoryByOrgId" resultType="Map">
select
*
from base_inventory i
where org_id_int =#{orgId}
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.MsgMapper">
<select id="getMsg" resultType="Map">
<if test="tableName != null and tableName != ''">
<![CDATA[
select *
from ]]>
${tableName}
<![CDATA[
where org_id = #{orgId}
]]>
</if>
</select>
<select id="getUserMsg" resultType="Map">
select
suo.user_org_id as userOrgId,
suo.user_id as userId,
suo.org_id as orgId,
suo.position_id as positionId,
su.real_name as realName,
su.nick_name as nickName,
su.account as account,
su.password as password,
su.avatar as avatar,
su.birthday as birthday,
su.sex as sex,
su.email as email,
su.phone as phone,
su.tel as tel,
su.super_admin_flag as superAdminFlag,
su.status_flag as statusFlag,
su.user_type as userType,
su.last_login_ip as lastLoginIp,
su.last_login_time as lastLoginTime,
su.del_flag as delFlag,
su.create_time as createTime,
su.create_user as createUser,
su.update_time as updateTime,
su.update_user as updateUser,
su.app_flag as appFlag
from sys_user_org suo
join sys_user su on suo.user_id = su.user_id
where suo.org_id = #{orgId}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.OrderMainMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.OrderMain">
<!--@mbg.generated-->
<!--@Table bussiness_order_main-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="order_type" jdbcType="VARCHAR" property="orderType" />
<result column="bussiness_type" jdbcType="VARCHAR" property="bussinessType" />
<result column="order_code" jdbcType="VARCHAR" property="orderCode" />
<result column="approve_type" jdbcType="VARCHAR" property="approveType" />
<result column="send_org_id" jdbcType="VARCHAR" property="sendOrgId" />
<result column="send_org_name" jdbcType="VARCHAR" property="sendOrgName" />
<result column="inventory_quantity" jdbcType="INTEGER" property="inventoryQuantity" />
<result column="actual_quantity" jdbcType="INTEGER" property="actualQuantity" />
<result column="manual_state" jdbcType="INTEGER" property="manualState" />
<result column="order_state" jdbcType="INTEGER" property="orderState" />
<result column="attachment_location" jdbcType="VARCHAR" property="attachmentLocation" />
<result column="inv_list" jdbcType="VARCHAR" property="invList" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, order_type, bussiness_type, order_code, approve_type, send_org_id, send_org_name,
inventory_quantity, actual_quantity, manual_state, order_state, attachment_location,
inv_list, create_time, update_time, create_user, update_user
</sql>
<insert id="addOrder" parameterType="com.junmp.jyzb.domain.OrderMain" useGeneratedKeys="true" keyProperty="id">
insert into business_order_main
(order_type,process_id,bussiness_type,order_code,org_id,inventory_quantity,manual_state,order_state,attachment_location,inv_list,create_time,update_time)
values
(#{orderType},#{processId},#{bussinessType},#{orderCode},#{orgId},#{inventoryQuantity},#{manualState},#{orderState},#{attachmentLocation},#{invList},#{createTime},#{updateTime})
</insert>
<select id="showOrder" resultType="Map">
SELECT
id as id,
order_type as orderType,
process_id as processId,
bussiness_type as bussinessType,
order_code as orderCode,
org_id as orgId,
inventory_quantity as inventoryQuantity,
actual_quantity as actualQuantity,
manual_state as manualState,
order_state as orderState,
attachment_location as attachmentLocation,
inv_list as invList,
create_time as createTime,
update_time as updateTime
FROM business_order_main
where org_id =#{orgId}
</select>
<update id="updateOrder">
update business_order_main o
set
order_type=#{orderType},
process_id=#{processId},
bussiness_type=#{bussinessType},
order_code=#{orderCode},
org_id=#{orgId},
inventory_quantity=#{inventoryQuantity},
actual_quantity=#{actualQuantity},
manual_state=#{manualState},
order_state=#{orderState},
attachment_location=#{attachmentLocation},
inv_list=#{invList},
update_time=#{updateTime}
where o.id =#{id}
</update>
<select id="getOrderDetail" resultType="Map">
SELECT
id as id,
order_type as orderType,
process_id as processId,
bussiness_type as bussinessType,
order_code as orderCode,
org_id as orgId,
inventory_quantity as inventoryQuantity,
actual_quantity as actualQuantity,
manual_state as manualState,
order_state as orderState,
attachment_location as attachmentLocation,
inv_list as invList,
create_time as createTime,
update_time as updateTime
FROM business_order_main
WHERE id = #{id}
</select>
</mapper>
\ No newline at end of file
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
c.name AS cabinetName, c.name AS cabinetName,
p.update_time AS updateTime p.update_time AS updateTime
FROM base_policeman p FROM base_policeman p
LEFT JOIN pub_org o ON p.org_id = o.org_id LEFT JOIN pub_org o ON p.org_id_int = o.org_id
LEFT JOIN base_cabinet c ON p.cabinet_box_id = c.id LEFT JOIN base_cabinet c ON p.cabinet_box_id = c.id
WHERE p.id = #{id}; WHERE p.id = #{id};
</select> </select>
...@@ -64,9 +64,9 @@ ...@@ -64,9 +64,9 @@
p.update_time AS updateTime p.update_time AS updateTime
<!-- GROUP_CONCAT(JSON_OBJECT('fingerId', f.id, 'fingerName', f.name,'fingerInfo', f.finger_info)) AS fingerMsg--> <!-- GROUP_CONCAT(JSON_OBJECT('fingerId', f.id, 'fingerName', f.name,'fingerInfo', f.finger_info)) AS fingerMsg-->
<!-- GROUP_CONCAT(JSON_OBJECT('fingerId', f.id, 'fingerName', f.name,'fingerInfo', f.finger_info)) AS fingerMsg--> <!-- GROUP_CONCAT(JSON_OBJECT('fingerId', f.id, 'fingerName', f.name,'fingerInfo', f.finger_info)) AS fingerMsg-->
FROM pub_org o FROM base_policeman p
right JOIN base_policeman p ON p.org_id = o.org_id left JOIN pub_org o ON p.org_id_int = o.org_id
right JOIN base_cabinet c ON p.cabinet_box_id = c.id left JOIN base_cabinet c ON p.cabinet_box_id = c.id
<!-- LEFT JOIN base_police_finger f ON f.police_id = p.id--> <!-- LEFT JOIN base_police_finger f ON f.police_id = p.id-->
<!-- GROUP BY p.id, o.org_id, o.org_name, p.name, p.sex, p.phone, p.photo, p.police_code, c.id, c.name, p.update_time--> <!-- GROUP BY p.id, o.org_id, o.org_name, p.name, p.sex, p.phone, p.photo, p.police_code, c.id, c.name, p.update_time-->
...@@ -170,4 +170,51 @@ ...@@ -170,4 +170,51 @@
<select id="getPoliceCodeById" resultType="java.lang.String"> <select id="getPoliceCodeById" resultType="java.lang.String">
select police_code from base_policeman where id =#{id} select police_code from base_policeman where id =#{id}
</select> </select>
<select id="getAllPolicemanByOrg" resultType="Map">
SELECT
p.id AS id,
p.org_id_int AS orgId,
o.org_name AS orgName,
p.name AS name,
p.sex,
p.phone,
p.photo,
p.police_code AS policeCode,
c.id AS cabinetId,
c.name AS cabinetName,
p.update_time AS updateTime
<!-- GROUP_CONCAT(JSON_OBJECT('fingerId', f.id, 'fingerName', f.name,'fingerInfo', f.finger_info)) AS fingerMsg-->
<!-- GROUP_CONCAT(JSON_OBJECT('fingerId', f.id, 'fingerName', f.name,'fingerInfo', f.finger_info)) AS fingerMsg-->
FROM base_policeman p
left JOIN pub_org o ON p.org_id_int = o.org_id
left JOIN base_cabinet c ON p.cabinet_box_id = c.id
where o.org_id =#{orgId}
<!-- LEFT JOIN base_police_finger f ON f.police_id = p.id-->
<!-- GROUP BY p.id, o.org_id, o.org_name, p.name, p.sex, p.phone, p.photo, p.police_code, c.id, c.name, p.update_time-->
</select>
<select id="getAllPolicemanByOrgList" parameterType="java.util.List" resultType="java.util.Map">
SELECT
p.id AS id,
p.org_id_int AS orgId,
o.org_name AS orgName,
p.name AS name,
p.sex,
p.phone,
p.photo,
p.police_code AS policeCode,
c.id AS cabinetId,
c.name AS cabinetName,
p.update_time AS updateTime
FROM base_policeman p
LEFT JOIN pub_org o ON p.org_id_int = o.org_id
LEFT JOIN base_cabinet c ON p.cabinet_box_id = c.id
WHERE o.org_id IN
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -32,7 +32,27 @@ ...@@ -32,7 +32,27 @@
</sql> </sql>
<select id="selectAllOrg" resultType="com.junmp.jyzb.domain.PubOrg"> <select id="selectAllOrg" resultType="com.junmp.jyzb.domain.PubOrg">
SELECT org_id,org_parent_id,org_name SELECT
IFNULL(org_id, 'null') as orgId,
IFNULL(org_parent_id, 'null') as orgParentId,
IFNULL(org_name, 'null') as orgName,
IFNULL(d_name, 'null') as dName,
IFNULL(find_code, 'null') as findCode,
IFNULL(status_flag, 'null') as statusFlag
FROM
pub_org
WHERE
del_flag = 1;
</select>
<select id="showAllPubOrgList" resultType="com.junmp.jyzb.domain.PubOrg">
SELECT org_id,
IFNULL(org_id, 'null') as orgId,
IFNULL(org_parent_id, 'null') as orgParentId,
IFNULL(org_name, 'null') as orgName,
IFNULL(d_name, 'null') as dName,
IFNULL(find_code, 'null') as findCode,
IFNULL(del_flag, 'null') as delFlag
FROM pub_org FROM pub_org
</select> </select>
...@@ -41,4 +61,70 @@ ...@@ -41,4 +61,70 @@
from pub_org t from pub_org t
where t.org_id =#{orgId} where t.org_id =#{orgId}
</select> </select>
<update id="setMsg">
update pub_org
set d_name =#{orgName}
where org_id = #{id}
</update>
<update id="wipeParentIdsData">
UPDATE pub_org t
SET t.org_parent_ids = "";
</update>
<update id="setOrgParentIds" parameterType="java.util.Map">
WITH RECURSIVE cte AS (
SELECT org_id, org_parent_id, CAST(org_id AS CHAR(200)) AS org_parent_ids
FROM pub_org
WHERE org_parent_id = -1
UNION ALL
SELECT o.org_id, o.org_parent_id,
CASE
WHEN FIND_IN_SET(o.org_parent_id, cte.org_parent_ids) > 0 THEN cte.org_parent_ids
ELSE CONCAT(cte.org_parent_ids, ',', o.org_parent_id)
END AS org_parent_ids
FROM pub_org o
INNER JOIN cte ON o.org_parent_id = cte.org_id
)
UPDATE pub_org p
JOIN cte ON p.org_id = cte.org_id
SET p.org_parent_ids = cte.org_parent_ids;
</update>
<select id="getOrgDetail" resultType="Map">
select
IFNULL(org_id,'null') as orgId,
IFNULL(org_name,'null') as orgName,
IFNULL(org_code,'null') as orgCode,
IFNULL(org_type,'null') as orgType,
IFNULL(status_flag,'null') as statusFlag,
IFNULL(remark,'null') as remark,
IFNULL(org_full_name,'null') as orgFullName,
IFNULL(find_code,'null') as findCode,
IFNULL(address,'null') as address,
IFNULL(contact,'null') as contact,
IFNULL(phone,'null') as phone,
IFNULL(create_time,'null') as createTime,
IFNULL(update_time,'null') as updateTime,
from pub_org o
where o.org_id=#{orgId}
</select>
<select id="getParentOrgName" resultType="String">
select d_name from pub_org o where org_id =#{orgParentId}
</select>
<update id="changeOrgState">
UPDATE pub_org
SET status_flag = #{statusFlag}
WHERE org_id IN
<foreach item="item" collection="orgIdList" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<select id="getOneSupplier" resultType="Map"> <select id="getOneSupplier" resultType="Map">
SELECT id, name, code, short_name AS shortName, contacts, phone, update_user,state SELECT id, name, code, short_name AS shortName, contacts, phone, update_user,state
FROM base_supplier FROM base_supplier
WHERE id = #{id} WHERE code = #{code}
<if test="SelectName != null and SelectName != ''"> <if test="SelectName != null and SelectName != ''">
AND name LIKE CONCAT('%', #{SelectName}, '%') AND name LIKE CONCAT('%', #{SelectName}, '%')
</if> </if>
...@@ -82,5 +82,15 @@ ...@@ -82,5 +82,15 @@
<select id="getAllSupplier" resultType="Map"> <select id="getAllSupplier" resultType="Map">
SELECT id, name, code, short_name AS shortName, contacts, phone, update_time as updateTime,state SELECT id, name, code, short_name AS shortName, contacts, phone, update_time as updateTime,state
FROM base_supplier FROM base_supplier
<if test="name != '' or shortName != ''">
WHERE
</if>
<if test="name != null and name != ''">
name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="shortName != null and shortName != ''">
<if test="name != null and name != ''">AND</if>
short_name LIKE CONCAT('%', #{shortName}, '%')
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<select id="getOneWarehouse" resultType="Map"> <select id="getOneWarehouse" resultType="Map">
select select
w.id as warehouseId, w.id as warehouseId,
o.org_id as orgId,
o.org_name as orgName, o.org_name as orgName,
w.name as name, w.name as name,
w.state, w.state,
...@@ -74,6 +75,7 @@ ...@@ -74,6 +75,7 @@
<select id="getAllWarehouse" resultType="Map"> <select id="getAllWarehouse" resultType="Map">
select select
w.id as warehouseId, w.id as warehouseId,
o.org_id as orgId,
o.org_name as orgName, o.org_name as orgName,
w.name as name, w.name as name,
w.state, w.state,
...@@ -84,6 +86,78 @@ ...@@ -84,6 +86,78 @@
in_sum as inSum, in_sum as inSum,
out_sum as outSum, out_sum as outSum,
w.update_time as updateTime w.update_time as updateTime
from base_warehouse w LEFT JOIN pub_org o on w.org_id=o.org_id from base_warehouse w
LEFT JOIN pub_org o on w.org_id_int=o.org_id
</select> </select>
<select id="getAllWarehouseByOrgList" parameterType="java.util.List" resultType="java.util.Map">
select
w.id as warehouseId,
o.org_id as orgId,
o.org_name as orgName,
w.name as name,
w.state,
location,
w.phone,
is_locked as isLocked,
sum,
in_sum as inSum,
out_sum as outSum,
w.update_time as updateTime
from base_warehouse w
LEFT JOIN pub_org o on w.org_id_int=o.org_id
where w.org_id_int in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<update id="setWarehouseSumInventory">
UPDATE base_warehouse AS w
SET sum = (
SELECT count(id)
FROM base_inventory AS i
WHERE i.location_id = w.id
)
<if test="updateId != null and updateId != ''">
where w.id = #{updateId}
</if>
</update>
<update id="setWarehouseInSumInventory">
UPDATE base_warehouse AS w
SET in_sum = (
SELECT count(id)
FROM base_inventory AS i
WHERE i.location_id = w.id and i.location_state="in"
)
<if test="updateId != null and updateId != ''">
where w.id = #{updateId}
</if>
</update>
<update id="setWarehouseOutSumInventory">
UPDATE base_warehouse AS w
SET out_sum = (
SELECT count(id)
FROM base_inventory AS i
WHERE i.location_id = w.id and i.location_state="out"
)
<if test="updateId != null and updateId != ''">
where w.id = #{updateId}
</if>
</update>
<update id="setWarehousePriceInventory">
UPDATE base_warehouse AS w
SET price_total = (
SELECT sum(price)
FROM base_inventory AS i
WHERE i.location_id = w.id
)
<if test="updateId != null and updateId != ''">
where w.id = #{updateId}
</if>
</update>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="jpa" name="JPA">
<configuration>
<setting name="validation-enabled" value="true" />
<datasource-mapping>
<factory-entry name="jyzb-boot" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<artifactId>jyzb-boot</artifactId> <artifactId>jyzb-boot</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<name>jyzb-boot</name> <name>jyzb-boot</name>
<packaging>war</packaging>
<dependencies> <dependencies>
<dependency> <dependency>
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>log-biz-manage</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.junmp.v2</groupId> <groupId>com.junmp.v2</groupId>
<artifactId>v2-security-boot-starter</artifactId> <artifactId>v2-security-boot-starter</artifactId>
...@@ -94,7 +97,19 @@ ...@@ -94,7 +97,19 @@
<artifactId>jyzb-process</artifactId> <artifactId>jyzb-process</artifactId>
</dependency> </dependency>
<!--MQTT-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -85,3 +85,13 @@ flowable: ...@@ -85,3 +85,13 @@ flowable:
enabled: false enabled: false
eventregistry: eventregistry:
enabled: false enabled: false
com:
mqtt:
url: tcp://broker.emqx.io:1883 #这里要写 tcp:// 不能是 mqtt,不然不是合法的 schema,源码中有
clientId: mqtt_test_spring
topics: iot/#,home/#
username: admin
password: public
timeout: 10
keepalive: 20
\ No newline at end of file
#server:
# port: 10030
# 应用服务器
server: server:
port: 10030 tomcat:
uri-encoding: UTF-8 #tomcat编码
port: 10031 #tomcat端口
spring: spring:
main: main:
#bea同名类进行注册时,准许覆盖注册 #bea同名类进行注册时,准许覆盖注册
......
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jyzb-mq</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-mq-consumer</artifactId>
</project>
\ No newline at end of file
package com.junmp.jyzb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//@EnableScheduling
//@EnableTransactionManagement
@SpringBootApplication
public class MqConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(MqConsumerApplication.class, args);
}
}
package com.junmp.jyzb.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Author : JCccc
* @CreateTime : 2019/9/3
* @Description :
**/
@Configuration
public class DirectRabbitConfig {
//队列 起名:TestDirectQueue
@Bean
public Queue TestDirectQueue() {
return new Queue("TestDirectQueue",true);
}
//Direct交换机 起名:TestDirectExchange
@Bean
DirectExchange TestDirectExchange() {
return new DirectExchange("TestDirectExchange");
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TestDirectRouting
@Bean
Binding bindingDirect() {
return BindingBuilder.bind(TestDirectQueue()).to(TestDirectExchange()).with("TestDirectRouting");
}
}
\ No newline at end of file
package com.junmp.jyzb.config;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 创建消息接收监听类
* */
@Component
@RabbitListener(queues = "TestDirectQueue") //监听的队列名称 TestDirectQueue
public class DirectReceiver {
@RabbitHandler
public void process(Object testMessage) {
System.out.println("DirectReceiver消费者收到消息 : " + testMessage);
}
}
\ No newline at end of file
package com.junmp.jyzb.controller;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@RestController
public class SendMsgController {
@Autowired
RabbitTemplate rabbitTemplate; //使用RabbitTemplate,这提供了接收/发送等等方法
@PostMapping("/sendDirectMessage")
public String sendDirectMessage() {
String messageId = String.valueOf(UUID.randomUUID());
String messageData = "test message, hello!";
String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
Map<String,Object> map=new HashMap<>();
map.put("messageId",messageId);
map.put("messageData",messageData);
map.put("createTime",createTime);
//将消息携带绑定键值:TestDirectRouting 发送到交换机TestDirectExchange
rabbitTemplate.convertAndSend("TestDirectExchange", "TestDirectRouting", map);
return "ok";
}
@PostMapping("/send")
public String sendMessage() {
String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
try {
rabbitTemplate.convertAndSend("TestDirectExchange", "TestDirectRouting", "消息发送的时间为:" + createTime);
return "消息发送成功";
} catch (Exception e) {
e.printStackTrace();
return "消息发送失败";
}
}
}
server:
port: 8090
spring:
#配置rabbitMq 服务器
rabbitmq:
host: 192.168.3.188
port: 5672
username: root
password: 123456
#虚拟host 可以不设置,使用server默认host
virtual-host: /
server:
port: 8090
spring:
#配置rabbitMq 服务器
rabbitmq:
host: 192.168.3.188
port: 5672
username: root
password: 123456
#虚拟host 可以不设置,使用server默认host
virtual-host: /
artifactId=jyzb-mq-consumer
groupId=com.junmp.jyzb
version=1.0.0
com\junmp\jyzb\controller\SendMsgController.class
com\junmp\jyzb\config\DirectRabbitConfig.class
com\junmp\jyzb\MqConsumerApplication.class
com\junmp\jyzb\config\DirectReceiver.class
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-consumer\src\main\java\com\junmp\jyzb\config\DirectReceiver.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-consumer\src\main\java\com\junmp\jyzb\config\DirectRabbitConfig.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-consumer\src\main\java\com\junmp\jyzb\MqConsumerApplication.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-consumer\src\main\java\com\junmp\jyzb\controller\SendMsgController.java
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jyzb-mq</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-mq-producer</artifactId>
</project>
\ No newline at end of file
package com.junmp.jyzb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MqProducerApplication {
public static void main(String[] args) {
SpringApplication.run(MqProducerApplication.class, args);
}
}
package com.junmp.jyzb.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Author : JCccc
* @CreateTime : 2019/9/3
* @Description :
**/
@Configuration
public class DirectRabbitConfig {
//队列 起名:TestDirectQueue
@Bean
public Queue TestDirectQueue() {
// durable:是否持久化,默认是false,持久化队列:会被存储在磁盘上,当消息代理重启时仍然存在,暂存队列:当前连接有效
// exclusive:默认也是false,只能被当前创建的连接使用,而且当连接关闭后队列即被删除。此参考优先级高于durable
// autoDelete:是否自动删除,当没有生产者或者消费者使用此队列,该队列会自动删除。
// return new Queue("TestDirectQueue",true,true,false);
//一般设置一下队列的持久化就好,其余两个就是默认false
return new Queue("TestDirectQueue",true);
}
//Direct交换机 起名:TestDirectExchange
@Bean
DirectExchange TestDirectExchange() {
// return new DirectExchange("TestDirectExchange",true,true);
return new DirectExchange("TestDirectExchange",true,false);
}
//绑定 将队列和交换机绑定, 并设置用于匹配键:TestDirectRouting
@Bean
Binding bindingDirect() {
return BindingBuilder.bind(TestDirectQueue()).to(TestDirectExchange()).with("TestDirectRouting");
}
@Bean
DirectExchange lonelyDirectExchange() {
return new DirectExchange("lonelyDirectExchange");
}
}
\ No newline at end of file
package com.junmp.jyzb.controller;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@RestController
public class SendMsgController {
@Autowired
RabbitTemplate rabbitTemplate; //使用RabbitTemplate,这提供了接收/发送等等方法
@PostMapping("/sendDirectMessage")
public String sendDirectMessage() {
String messageId = String.valueOf(UUID.randomUUID());
String messageData = "test message, hello!";
String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
Map<String,Object> map=new HashMap<>();
map.put("messageId",messageId);
map.put("messageData",messageData);
map.put("createTime",createTime);
//将消息携带绑定键值:TestDirectRouting 发送到交换机TestDirectExchange
rabbitTemplate.convertAndSend("TestDirectExchange", "TestDirectRouting", map);
return "ok";
}
@PostMapping("/send")
public String sendMessage() {
//生成当前时间
String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
try {
//将记录当前时间的信息发送到消息队列
rabbitTemplate.convertAndSend("TestDirectExchange", "TestDirectRouting", "消息发送的时间为:" + createTime);
return "消息发送成功";
} catch (Exception e) {
e.printStackTrace();
return "消息发送失败";
}
}
}
server:
port: 9001
spring:
#配置rabbitMq 服务器
rabbitmq:
host: 192.168.3.188
port: 5672
username: root
password: 123456
#虚拟host 可以不设置,使用server默认host
virtual-host: /
server:
port: 9001
spring:
#配置rabbitMq 服务器
rabbitmq:
host: 192.168.3.188
port: 5672
username: root
password: 123456
#虚拟host 可以不设置,使用server默认host
virtual-host: /
artifactId=jyzb-mq-producer
groupId=com.junmp.jyzb
version=1.0.0
com\junmp\jyzb\controller\SendMsgController.class
com\junmp\jyzb\MqProducerApplication.class
com\junmp\jyzb\config\DirectRabbitConfig.class
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-producer\src\main\java\com\junmp\jyzb\controller\SendMsgController.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-producer\src\main\java\com\junmp\jyzb\config\DirectRabbitConfig.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-producer\src\main\java\com\junmp\jyzb\MqProducerApplication.java
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-amqp:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.4.4" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.27" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-rabbit:2.3.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-amqp:2.3.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.3.1" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" name="Maven: com.rabbitmq:amqp-client:5.10.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.4.4" level="project" />
<orderEntry type="library" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
<orderEntry type="library" name="Maven: net.minidev:json-smart:2.3" level="project" />
<orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
<orderEntry type="library" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
<orderEntry type="library" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
<orderEntry type="library" name="Maven: org.assertj:assertj-core:3.18.1" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter:5.7.1" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.1" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.1" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.junit.platform:junit-platform-engine:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.mockito:mockito-core:3.6.28" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
<orderEntry type="library" name="Maven: org.objenesis:objenesis:3.1" level="project" />
<orderEntry type="library" name="Maven: org.mockito:mockito-junit-jupiter:3.6.28" level="project" />
<orderEntry type="library" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
<orderEntry type="library" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-test:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.4.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.44" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.44" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.5" level="project" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>junmp-jyzb-app</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-mq</artifactId>
<packaging>pom</packaging>
<modules>
<module>jyzb-mq-consumer</module>
<module>jyzb-mq-producer</module>
</modules>
<name>jyzb-mq</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="jpa" name="JPA">
<configuration>
<setting name="validation-enabled" value="true" />
<datasource-mapping>
<factory-entry name="jyzb-process" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>
\ No newline at end of file
...@@ -6,10 +6,13 @@ ...@@ -6,10 +6,13 @@
<groupId>com.junmp.jyzb</groupId> <groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-process</artifactId> <artifactId>jyzb-process</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<name>jyzb-process</name>
<properties> <properties>
<mysql.version>8.0.21</mysql.version> <mysql.version>8.0.21</mysql.version>
...@@ -225,11 +228,11 @@ ...@@ -225,11 +228,11 @@
<version>3.0.0</version> <version>3.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.springframework</groupId> <!-- <groupId>org.springframework</groupId>-->
<artifactId>spring-webmvc</artifactId> <!-- <artifactId>spring-webmvc</artifactId>-->
<version>5.3.19</version> <!-- <version>5.3.19</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>com.junmp.v2</groupId> <groupId>com.junmp.v2</groupId>
<artifactId>junmp-v2-common</artifactId> <artifactId>junmp-v2-common</artifactId>
...@@ -281,35 +284,10 @@ ...@@ -281,35 +284,10 @@
<groupId>com.junmp.jyzb</groupId> <groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-biz</artifactId> <artifactId>jyzb-biz</artifactId>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger-ui</artifactId>-->
<!-- <version>2.9.2</version>-->
<!-- </dependency>-->
</dependencies>
<!-- <name>jyzb-process</name>-->
</dependencies>
<!-- <build>--> <build>
<!-- <finalName>jyzb-process</finalName>--> <finalName>${project.artifactId}</finalName>
<!-- <plugins>--> </build>
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>repackage</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- &lt;!&ndash; 如果没有该项配置,则devtools不会起作用,即应用不会restart &ndash;&gt;-->
<!-- <mainClass>com.junmp.jyzb.boot.JyzbBootApplication</mainClass>-->
<!-- <fork>true</fork>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project> </project>
...@@ -12,9 +12,8 @@ public interface CommonConstants { ...@@ -12,9 +12,8 @@ public interface CommonConstants {
String FORM_VAR="formData"; String FORM_VAR="formData";
String PROCESS_STATUS="processStatus"; String PROCESS_STATUS="processStatus";
String START_USER_INFO="startUser"; String START_USER_INFO="startUser";
String BUSINESS_STATUS_1="1"; //正在处理 String BUSINESS_STATUS_1="正在处理"; //正在处理
String BUSINESS_STATUS_2="2";//撤销 String BUSINESS_STATUS_2="撤销";//撤销
String BUSINESS_STATUS_3="3";//驳回 String BUSINESS_STATUS_3="驳回";//驳回
String BUSINESS_STATUS_4="4";//已结束 String BUSINESS_STATUS_4="已结束";//已结束
} }
...@@ -20,10 +20,17 @@ import com.junmp.junmpProcess.entity.ProcessTemplates; ...@@ -20,10 +20,17 @@ import com.junmp.junmpProcess.entity.ProcessTemplates;
import com.junmp.junmpProcess.exception.WorkFlowException; import com.junmp.junmpProcess.exception.WorkFlowException;
import com.junmp.junmpProcess.service.Repository.ProcessTemplateService; import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
import com.junmp.junmpProcess.utils.BpmnConvert; import com.junmp.junmpProcess.utils.BpmnConvert;
import com.junmp.junmpProcess.utils.FormAndOrder;
import com.junmp.junmpProcess.vo.*; import com.junmp.junmpProcess.vo.*;
import com.junmp.jyzb.api.bean.req.ProductSkuReq;
import com.junmp.jyzb.api.bean.vo.TagInfoVo;
import com.junmp.jyzb.entity.ProductSku;
import com.junmp.jyzb.utils.HttpStatus; import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg; import com.junmp.jyzb.utils.ReturnMsg;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.page.PageResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows; import lombok.SneakyThrows;
...@@ -93,13 +100,13 @@ public class BpmnController { ...@@ -93,13 +100,13 @@ public class BpmnController {
} }
@ApiOperation("查看我发起的流程") @ApiOperation("查看我发起的流程")
@PostMapping("applyList") @PostMapping("applyList")
public ResponseResult applyList(@RequestBody ApplyDTO ApplyDTO) { public PageResult<HistoryProcessInstanceVO> applyList(@RequestBody ApplyDTO ApplyDTO) {
return WorkProcessService.applyList(ApplyDTO); return WorkProcessService.applyList(ApplyDTO);
} }
@ApiOperation("查看我的待办") @ApiOperation("查看我的待办")
@PostMapping("toDoList") @PostMapping("toDoList")
public ResponseResult toDoList(@RequestBody TaskDTO taskDTO){ public PageResult<TaskVO> toDoList(@RequestBody TaskDTO taskDTO){
return WorkProcessService.toDoList(taskDTO); return WorkProcessService.toDoList(taskDTO);
} }
@ApiOperation("同意按钮") @ApiOperation("同意按钮")
...@@ -107,11 +114,16 @@ public class BpmnController { ...@@ -107,11 +114,16 @@ public class BpmnController {
public ResponseResult agree(@RequestBody HandleDataDTO handleDataDTO){ public ResponseResult agree(@RequestBody HandleDataDTO handleDataDTO){
return WorkProcessService.agree(handleDataDTO); return WorkProcessService.agree(handleDataDTO);
} }
@ApiOperation("撤销按钮")
@PostMapping("revoke")
public ResponseResult revoke(@RequestBody HandleDataDTO handleDataDTO){
return WorkProcessService.revoke(handleDataDTO);
}
@ApiOperation("拒绝按钮") @ApiOperation("拒绝按钮")
@PostMapping("refuse") @PostMapping("refuse")
public ResponseResult refuse(@RequestBody HandleDataDTO handleDataDTO){ public ResponseResult refuse(@RequestBody HandleDataDTO handleDataDTO){
return WorkProcessService.refuse(handleDataDTO); return WorkProcessService.refuse(handleDataDTO);
} }
/** /**
* 查询表单模板数据 * 查询表单模板数据
...@@ -121,32 +133,19 @@ public class BpmnController { ...@@ -121,32 +133,19 @@ public class BpmnController {
*/ */
@ApiOperation("根据ID获取表单信息") @ApiOperation("根据ID获取表单信息")
@PostMapping(value = "getFormTemplateById") @PostMapping(value = "getFormTemplateById")
public ResponseResult getFormTemplateById(String templateId) { public ResponseResult getFormTemplateById(@RequestBody Map<String,Object> templateId) {
ProcessTemplates processTemplates = processTemplateService.getById(templateId); String temp= templateId.get("templateId").toString();
ProcessTemplates processTemplates = processTemplateService.getById(temp);
processTemplates.setFormId(processTemplates.getTemplateId()); processTemplates.setFormId(processTemplates.getTemplateId());
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,processTemplates); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,processTemplates);
} }
/**
* 查询表单模板数据
*
* @return 模板详情数据
*/
@ApiOperation("获取全部可用的表单和审核流") @ApiOperation("获取全部可用的表单和审核流")
@GetMapping(value = "getFormList") @GetMapping(value = "getFormList")
public ResponseResult getFormList( ) { public ApiRes<PageResult<TemplateGroupVo>> getFormList(BaseRequest br) {
return WorkProcessService.getFormList(); return ApiRes.success(WorkProcessService.getFormList(br));
} }
/**
* 查询表单模板数据
*
* @param templateId 模板id
* @return 模板详情数据
*/
@ApiOperation("通过模板id查看流程信息")
@GetMapping("getFormDetail")
public ResponseResult getFormDetail(@RequestParam("templateId") String templateId){
return WorkProcessService.getFormDetail(templateId);
}
} }
...@@ -10,6 +10,7 @@ import lombok.Data; ...@@ -10,6 +10,7 @@ import lombok.Data;
@Data @Data
public class UserInfo { public class UserInfo {
private String id; private String id;
private String userId;
private String name; private String name;
private String type; private String type;
private String sex; private String sex;
......
...@@ -2,28 +2,23 @@ package com.junmp.junmpProcess.entity; ...@@ -2,28 +2,23 @@ package com.junmp.junmpProcess.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* (ProcessTemplates)实体类 * @author : willian fu
* * @date : 2020/9/21
* @author makejava
* @since 2020-09-21 22:50:29
*/ */
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "process_templates")
@Builder @Builder
public class ProcessTemplates implements Serializable { @NoArgsConstructor
@AllArgsConstructor
public class ProcessTemplates {
private static final long serialVersionUID = -95829441258242072L; private static final long serialVersionUID = -95829441258242072L;
@TableId @TableId
...@@ -33,9 +28,9 @@ public class ProcessTemplates implements Serializable { ...@@ -33,9 +28,9 @@ public class ProcessTemplates implements Serializable {
private String templateId; private String templateId;
@TableField(exist = false) @TableField(exist = false)
private String formId; private String formId;
private String formName; private String formName;
private String orgId;
@TableField(exist = false)
private Integer groupId; private Integer groupId;
/** /**
* 摸板表单 * 摸板表单
...@@ -53,22 +48,13 @@ public class ProcessTemplates implements Serializable { ...@@ -53,22 +48,13 @@ public class ProcessTemplates implements Serializable {
* 图标背景色 * 图标背景色
*/ */
private String background; private String background;
private String notify;
/**
* 谁能提交
*/
private String whoCommit;
/**
* 谁能编辑
*/
private String whoEdit;
/** /**
* 谁能导出数据 * 图标背景色
*/ */
private String whoExport;
private String remark; private String remark;
private String notify;
/** /**
* 是否已停用 * 是否已停用
*/ */
......
package com.junmp.junmpProcess.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author : willian fu
* @date : 2020/9/21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TemplateGroupBo {
private Integer id;
private Integer groupId;
private String groupName;
private String templateId;
private String formName;
private String icon;
private Boolean isStop;
private String remark;
private Date updated;
private String background;
}
package com.junmp.junmpProcess.mapper; package com.junmp.junmpProcess.mapper;
import com.junmp.junmpProcess.dto.UserListDTO; import com.junmp.junmpProcess.dto.UserListDTO;
import com.junmp.junmpProcess.entity.TemplateGroupBo;
import com.junmp.v2.sys.api.UserServiceApi;
import com.junmp.v2.sys.api.bean.user.dto.RoleUserDto;
import com.junmp.v2.sys.api.bean.user.vo.QueryUserInfoVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
......
...@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import com.junmp.junmpProcess.entity.TemplateGroup; import com.junmp.junmpProcess.entity.TemplateGroup;
import com.junmp.junmpProcess.entity.TemplateGroupBo; import com.junmp.junmpProcess.entity.ProcessTemplates;
import java.util.List; import java.util.List;
...@@ -23,5 +23,5 @@ public interface TemplateGroupMapper extends BaseMapper<TemplateGroup> { ...@@ -23,5 +23,5 @@ public interface TemplateGroupMapper extends BaseMapper<TemplateGroup> {
*/ */
@Select("SELECT pt.template_id, pt.remark, pt.is_stop, pt.updated, pt.form_name, \n" + @Select("SELECT pt.template_id, pt.remark, pt.is_stop, pt.updated, pt.form_name, \n" +
" pt.icon, pt.background FROM process_templates pt ORDER BY updated desc") " pt.icon, pt.background FROM process_templates pt ORDER BY updated desc")
List<TemplateGroupBo> getAllFormAndGroups(); List<ProcessTemplates> getAllFormAndGroups();
} }
...@@ -10,7 +10,10 @@ import com.junmp.junmpProcess.dto.StartProcessInstanceDTO; ...@@ -10,7 +10,10 @@ import com.junmp.junmpProcess.dto.StartProcessInstanceDTO;
import com.junmp.junmpProcess.dto.TaskDTO; import com.junmp.junmpProcess.dto.TaskDTO;
import com.junmp.junmpProcess.entity.ProcessTemplates; import com.junmp.junmpProcess.entity.ProcessTemplates;
import com.junmp.junmpProcess.vo.*; import com.junmp.junmpProcess.vo.*;
import com.junmp.jyzb.entity.ProductSku;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.db.api.page.PageResult;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
...@@ -46,7 +49,7 @@ public interface WorkProcessService { ...@@ -46,7 +49,7 @@ public interface WorkProcessService {
* *
* @return * @return
*/ */
ResponseResult getFormList(); PageResult<TemplateGroupVo> getFormList(BaseRequest br);
/** /**
...@@ -68,14 +71,14 @@ public interface WorkProcessService { ...@@ -68,14 +71,14 @@ public interface WorkProcessService {
* *
* @return * @return
*/ */
ResponseResult applyList(ApplyDTO applyDTO); PageResult<HistoryProcessInstanceVO> applyList(ApplyDTO applyDTO);
/** /**
* 查看我的待办 * 查看我的待办
* *
* @return * @return
*/ */
ResponseResult toDoList(TaskDTO taskDTO); PageResult<TaskVO> toDoList(TaskDTO taskDTO);
/** /**
* 查看我的已办 * 查看我的已办
...@@ -92,6 +95,12 @@ public interface WorkProcessService { ...@@ -92,6 +95,12 @@ public interface WorkProcessService {
ResponseResult agree(HandleDataDTO handleDataDTO); ResponseResult agree(HandleDataDTO handleDataDTO);
/** /**
* 同意
*
* @return
*/
ResponseResult revoke(HandleDataDTO handleDataDTO);
/**
* 委派 * 委派
* *
* @return * @return
...@@ -112,12 +121,7 @@ public interface WorkProcessService { ...@@ -112,12 +121,7 @@ public interface WorkProcessService {
*/ */
ResponseResult refuse(HandleDataDTO handleDataDTO); ResponseResult refuse(HandleDataDTO handleDataDTO);
/**
* 撤销按钮
*
* @return
*/
Result revoke(HandleDataDTO handleDataDTO);
/** /**
* 转办按钮 * 转办按钮
......
...@@ -2,22 +2,23 @@ package com.junmp.junmpProcess.service.Bussiness.impl; ...@@ -2,22 +2,23 @@ package com.junmp.junmpProcess.service.Bussiness.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.PageUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.junmp.junmpProcess.common.R;
import com.junmp.junmpProcess.dto.*; import com.junmp.junmpProcess.dto.*;
import com.junmp.junmpProcess.dto.json.*; import com.junmp.junmpProcess.dto.json.*;
import com.junmp.junmpProcess.entity.TemplateGroupBo; import com.junmp.junmpProcess.entity.ProcessTemplates;
import com.junmp.junmpProcess.exception.WorkFlowException; import com.junmp.junmpProcess.exception.WorkFlowException;
import com.junmp.junmpProcess.mapper.ProcessTemplatesMapper;
import com.junmp.junmpProcess.mapper.TemplateGroupMapper; import com.junmp.junmpProcess.mapper.TemplateGroupMapper;
import com.junmp.junmpProcess.service.Bussiness.WorkProcessService; import com.junmp.junmpProcess.service.Bussiness.WorkProcessService;
import com.junmp.junmpProcess.service.Repository.ProcessTemplateService; import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
...@@ -27,10 +28,13 @@ import com.junmp.junmpProcess.vo.*; ...@@ -27,10 +28,13 @@ import com.junmp.junmpProcess.vo.*;
import com.junmp.jyzb.utils.HttpStatus; import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg; import com.junmp.jyzb.utils.ReturnMsg;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory;
import com.junmp.v2.db.api.page.PageResult;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.flowable.bpmn.BpmnAutoLayout; import org.flowable.bpmn.BpmnAutoLayout;
import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.*; import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process; import org.flowable.bpmn.model.Process;
import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.common.engine.impl.identity.Authentication;
...@@ -56,13 +60,11 @@ import com.junmp.junmpProcess.common.Result; ...@@ -56,13 +60,11 @@ import com.junmp.junmpProcess.common.Result;
import com.junmp.junmpProcess.common.WorkFlowConstants; import com.junmp.junmpProcess.common.WorkFlowConstants;
import com.junmp.junmpProcess.dto.json.flowJson.FlowChildNode; import com.junmp.junmpProcess.dto.json.flowJson.FlowChildNode;
import com.junmp.junmpProcess.dto.json.flowJson.Inout; import com.junmp.junmpProcess.dto.json.flowJson.Inout;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import org.flowable.task.service.impl.persistence.entity.TaskEntity; import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl; import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.junmp.junmpProcess.utils.BpmnConvert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
...@@ -75,13 +77,15 @@ import static com.junmp.junmpProcess.utils.BpmnModelUtils.*; ...@@ -75,13 +77,15 @@ import static com.junmp.junmpProcess.utils.BpmnModelUtils.*;
@Service @Service
public class WorkProcessServiceImpl implements WorkProcessService { public class WorkProcessServiceImpl extends ServiceImpl<ProcessTemplatesMapper, ProcessTemplates> implements WorkProcessService {
@Autowired @Autowired
private ProcessTemplateService processTemplateService; private ProcessTemplateService processTemplateService;
@Resource @Resource
private RepositoryService repositoryService; private RepositoryService repositoryService;
@Resource @Resource
private RuntimeService runtimeService; private RuntimeService runtimeService;
@Resource @Resource
...@@ -146,24 +150,26 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -146,24 +150,26 @@ public class WorkProcessServiceImpl implements WorkProcessService {
} }
} }
public ResponseResult getFormList() public PageResult<TemplateGroupVo> getFormList(BaseRequest br)
{ {
TemplateGroupMapper templateGroupMapper = SpringContextHolder.getBean(TemplateGroupMapper.class); TemplateGroupMapper templateGroupMapper = SpringContextHolder.getBean(TemplateGroupMapper.class);
List<TemplateGroupBo> allformAndGroups = templateGroupMapper.getAllFormAndGroups(); Page<ProcessTemplates> allformAndGroups =this.page(PageFactory.getDefaultPage());
Map<Integer, List<TemplateGroupBo>> coverMap = new LinkedHashMap<>(); templateGroupMapper.getAllFormAndGroups();
allformAndGroups.forEach(fg -> { Map<Integer, List<ProcessTemplates>> coverMap = new LinkedHashMap<>();
List<TemplateGroupBo> bos = coverMap.get(fg.getGroupId()); allformAndGroups.getRecords().forEach(fg -> {
List<ProcessTemplates> bos = coverMap.get(fg.getGroupId());
if (CollectionUtil.isEmpty(bos)) { if (CollectionUtil.isEmpty(bos)) {
List<TemplateGroupBo> list = new ArrayList<>(); List<ProcessTemplates> list = new ArrayList<>();
list.add(fg); list.add(fg);
coverMap.put(fg.getGroupId(), list); coverMap.put(fg.getGroupId(), list);
} else { } else {
bos.add(fg); bos.add(fg);
} }
}); });
List<TemplateGroupVo> results = new ArrayList<>(); PageResult<TemplateGroupVo> pageResult=new PageResult<TemplateGroupVo>();
coverMap.forEach((key, val) -> { coverMap.forEach((key, val) -> {
List<TemplateGroupVo.Template> templates = new ArrayList<>(); List<TemplateGroupVo> templates = new ArrayList<>();
val.forEach(v -> { val.forEach(v -> {
if (ObjectUtil.isNotNull(v.getTemplateId())) { if (ObjectUtil.isNotNull(v.getTemplateId())) {
String defId=""; String defId="";
...@@ -175,7 +181,7 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -175,7 +181,7 @@ public class WorkProcessServiceImpl implements WorkProcessService {
{ {
defId=ProDef.getId(); defId=ProDef.getId();
} }
templates.add(TemplateGroupVo.Template.builder() templates.add(TemplateGroupVo.builder()
.formId(v.getTemplateId()) .formId(v.getTemplateId())
.remark(v.getRemark()) .remark(v.getRemark())
.formName(v.getFormName()) .formName(v.getFormName())
...@@ -186,9 +192,13 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -186,9 +192,13 @@ public class WorkProcessServiceImpl implements WorkProcessService {
.build()); .build());
} }
}); });
results.add(TemplateGroupVo.builder().items(templates).build()); pageResult.setRecords( templates);
}); });
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,results.get(0)); pageResult.setPageSize(allformAndGroups.getSize());
pageResult.setTotalRows( allformAndGroups.getTotal());
pageResult.setPageNo(allformAndGroups.getPages());
pageResult.setTotalPage(PageUtil.totalPage(Convert.toInt(pageResult.getTotalRows()), Convert.toInt(pageResult.getPageSize())));
return pageResult;
} }
public ResponseResult createBpmn(ProcessVO processVO) throws JsonProcessingException { public ResponseResult createBpmn(ProcessVO processVO) throws JsonProcessingException {
//流程定义 //流程定义
...@@ -205,7 +215,7 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -205,7 +215,7 @@ public class WorkProcessServiceImpl implements WorkProcessService {
processTemplates.setFormName(processVO.getFormName()); processTemplates.setFormName(processVO.getFormName());
processTemplates.setIsStop(false); processTemplates.setIsStop(false);
Date date= new Date(); Date date= new Date();
processTemplates.setCreated(date);
processTemplates.setUpdated(date); processTemplates.setUpdated(date);
processTemplateService.save(processTemplates); processTemplateService.save(processTemplates);
//将json转换为bpmn //将json转换为bpmn
...@@ -253,8 +263,8 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -253,8 +263,8 @@ public class WorkProcessServiceImpl implements WorkProcessService {
@Override @Override
public ResponseResult getFormDetail(String templateId) { public ResponseResult getFormDetail(String templateId) {
ProcessTemplates processTemplates = processTemplateService.getById(templateId); ProcessTemplates processTemplates = processTemplateService.getById(templateId);
processTemplates.setLogo(processTemplates.getIcon()); processTemplates.setIcon(processTemplates.getIcon());
processTemplates.setFormId(processTemplates.getTemplateId()); processTemplates.setTemplateId(processTemplates.getTemplateId());
processTemplates.setFormName(processTemplates.getFormName()); processTemplates.setFormName(processTemplates.getFormName());
Object aa= repositoryService.createProcessDefinitionQuery(); Object aa= repositoryService.createProcessDefinitionQuery();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("Process_"+templateId).latestVersion().singleResult(); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("Process_"+templateId).latestVersion().singleResult();
...@@ -498,11 +508,15 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -498,11 +508,15 @@ public class WorkProcessServiceImpl implements WorkProcessService {
JSONObject formData = processInstanceDto.getFormData(); JSONObject formData = processInstanceDto.getFormData();
JunmpUserInfo startUserInfo = processInstanceDto.getStartUserInfo(); JunmpUserInfo startUserInfo = processInstanceDto.getStartUserInfo();
Authentication.setAuthenticatedUserId(startUserInfo.getUserId());
Map<String,Object> processVariables= new HashMap<>(); Map<String,Object> processVariables= new HashMap<>();
processVariables.put(FORM_VAR,formData); processVariables.put(FORM_VAR,formData);
processVariables.put(START_USER_INFO,JSONObject.toJSONString(startUserInfo)); processVariables.put(START_USER_INFO,JSONObject.toJSONString(startUserInfo));
processVariables.put(PROCESS_STATUS,BUSINESS_STATUS_1);
// processVariables.put("initiator",JSONObject.toJSONString(startUserInfo));
ArrayList<JunmpUserInfo> userInfos = CollUtil.newArrayList(startUserInfo); ArrayList<JunmpUserInfo> userInfos = CollUtil.newArrayList(startUserInfo);
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() { Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
}); });
...@@ -515,6 +529,7 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -515,6 +529,7 @@ public class WorkProcessServiceImpl implements WorkProcessService {
.variable("initiator",startUserInfo.getUserId()) .variable("initiator",startUserInfo.getUserId())
.variables(processVariables) .variables(processVariables)
.businessStatus(BUSINESS_STATUS_1) .businessStatus(BUSINESS_STATUS_1)
.start(); .start();
//手动完成第一个任务 //手动完成第一个任务
...@@ -546,7 +561,12 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -546,7 +561,12 @@ public class WorkProcessServiceImpl implements WorkProcessService {
* @return * @return
*/ */
@Override @Override
public ResponseResult applyList(ApplyDTO applyDTO) { public PageResult<HistoryProcessInstanceVO> applyList(ApplyDTO applyDTO) {
PageResult<HistoryProcessInstanceVO> pageResult=new PageResult<HistoryProcessInstanceVO>();
// List<Task> tasks = taskService.createTaskQuery()
// .taskCandidateOrAssigned(applyDTO.getCurrentUserInfo().getId())
// .list();
// List<Task> list = taskService.createTaskQuery().processInstanceId(processInstanceId).list();
List<HistoricProcessInstance> historicProcessInstances = List<HistoricProcessInstance> historicProcessInstances =
historyService.createHistoricProcessInstanceQuery() historyService.createHistoricProcessInstanceQuery()
.includeProcessVariables() .includeProcessVariables()
...@@ -570,7 +590,6 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -570,7 +590,6 @@ public class WorkProcessServiceImpl implements WorkProcessService {
historyProcessInstanceVO.setCurrentActivityName(getCurrentName(historicProcessInstance.getId(), flag, historicProcessInstance.getProcessDefinitionId())); historyProcessInstanceVO.setCurrentActivityName(getCurrentName(historicProcessInstance.getId(), flag, historicProcessInstance.getProcessDefinitionId()));
historyProcessInstanceVO.setBusinessStatus(MapUtil.getStr(processVariables, PROCESS_STATUS)); historyProcessInstanceVO.setBusinessStatus(MapUtil.getStr(processVariables, PROCESS_STATUS));
long totalTimes = historicProcessInstance.getEndTime() == null ? long totalTimes = historicProcessInstance.getEndTime() == null ?
(Calendar.getInstance().getTimeInMillis() - historicProcessInstance.getStartTime().getTime()) : (Calendar.getInstance().getTimeInMillis() - historicProcessInstance.getStartTime().getTime()) :
(historicProcessInstance.getEndTime().getTime() - historicProcessInstance.getStartTime().getTime()); (historicProcessInstance.getEndTime().getTime() - historicProcessInstance.getStartTime().getTime());
...@@ -584,11 +603,12 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -584,11 +603,12 @@ public class WorkProcessServiceImpl implements WorkProcessService {
historyProcessInstanceVO.setDuration(spendTimes); historyProcessInstanceVO.setDuration(spendTimes);
historyProcessInstanceVOS.add(historyProcessInstanceVO); historyProcessInstanceVOS.add(historyProcessInstanceVO);
} }
page.setRecords(historyProcessInstanceVOS); pageResult.setRecords(historyProcessInstanceVOS);
page.setCurrent(applyDTO.getPageNo()); pageResult.setTotalRows(Long.valueOf(applyDTO.getPageNo()));
page.setSize(applyDTO.getPageSize()); pageResult.setTotalPage(PageUtil.totalPage((int) count, Convert.toInt(pageResult.getPageSize())));
page.setTotal(count); pageResult.setPageSize(Long.valueOf(applyDTO.getPageSize()));
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,page); pageResult.setPageNo(Long.valueOf(applyDTO.getPageNo()));
return pageResult;
} }
/** /**
...@@ -597,7 +617,7 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -597,7 +617,7 @@ public class WorkProcessServiceImpl implements WorkProcessService {
* @return * @return
*/ */
@Override @Override
public ResponseResult toDoList(TaskDTO taskDTO) { public PageResult<TaskVO> toDoList(TaskDTO taskDTO) {
List<Task> tasks = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getUserId()) List<Task> tasks = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getUserId())
.includeProcessVariables() .includeProcessVariables()
.orderByTaskCreateTime().desc() .orderByTaskCreateTime().desc()
...@@ -605,24 +625,21 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -605,24 +625,21 @@ public class WorkProcessServiceImpl implements WorkProcessService {
long count = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getUserId()).count(); long count = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getUserId()).count();
List<TaskVO> taskVOS= new ArrayList<>(); List<TaskVO> taskVOS= new ArrayList<>();
Page<TaskVO> page =new Page<>(); Page<TaskVO> page =new Page<>();
for (Task task : tasks) {
// List<String> taskIds= new ArrayList<>();
// for (Task task : tasks) {
// Map<String, Object> processVariables = task.getProcessVariables();
// }
// Map<Long, JunmpUserInfo> collect=new HashMap<>();
for (Task task : tasks) {
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult(); ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
String startUserId = processInstance.getStartUserId();
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
Map<String, Object> processVariables = task.getProcessVariables(); Map<String, Object> processVariables = task.getProcessVariables();
TaskVO taskVO=new TaskVO(); TaskVO taskVO=new TaskVO();
taskVO.setTaskId(task.getId()); taskVO.setTaskId(task.getId());
taskVO.setProcessInstanceId(task.getProcessInstanceId()); taskVO.setProcessInstanceId(task.getProcessInstanceId());
taskVO.setProcessDefinitionName(bpmnModel.getMainProcess().getName()); taskVO.setProcessDefinitionName(bpmnModel.getMainProcess().getName());
taskVO.setStartUser(JSONObject.parseObject(MapUtil.getStr(processVariables,START_USER_INFO),new TypeReference<UserInfo>(){})); UserInfo user=new UserInfo();
user.setId(startUserId);
taskVO.setStartUser(user);
taskVO.setStartTime(processInstance.getStartTime()); taskVO.setStartTime(processInstance.getStartTime());
taskVO.setCurrentActivityName(getCurrentName(processInstance.getId(),false,processInstance.getProcessDefinitionId())); taskVO.setCurrentActivityName(getCurrentName(processInstance.getId(),false,processInstance.getProcessDefinitionId()));
...@@ -634,11 +651,10 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -634,11 +651,10 @@ public class WorkProcessServiceImpl implements WorkProcessService {
} }
taskVOS.add(taskVO); taskVOS.add(taskVO);
} }
page.setRecords(taskVOS); page.setRecords(taskVOS);
page.setCurrent(taskDTO.getPageNo()); return PageResultFactory.createPageResult(page);
page.setSize(taskDTO.getPageSize());
page.setTotal(count);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,page);
} }
...@@ -695,6 +711,40 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -695,6 +711,40 @@ public class WorkProcessServiceImpl implements WorkProcessService {
return Result.OK(page); return Result.OK(page);
} }
@Override
public ResponseResult revoke(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
Map<String,Object> map=new HashMap<>();
if(formData!=null &&formData.size()>0){
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR,formData);
}
map.put(PROCESS_STATUS,BUSINESS_STATUS_2);
runtimeService.setVariables(task.getProcessInstanceId(),map);
if(StringUtils.isNotBlank(comments)){
taskService.addComment(task.getId(),task.getProcessInstanceId(),"opinion",comments);
}
if(attachments!=null && attachments.size()>0){
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option",taskId,task.getProcessInstanceId(),attachment.getName(),attachment.getName(),attachment.getUrl());
}
}
if(StringUtils.isNotBlank(handleDataDTO.getSignInfo())){
taskService.addComment(task.getId(),task.getProcessInstanceId(),"sign",handleDataDTO.getSignInfo());
}
runtimeService.deleteProcessInstance(task.getProcessInstanceId(),"撤销");
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,"");
}
@Override @Override
public ResponseResult agree(HandleDataDTO handleDataDTO) { public ResponseResult agree(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo(); UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
...@@ -755,10 +805,6 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -755,10 +805,6 @@ public class WorkProcessServiceImpl implements WorkProcessService {
} }
} }
@Override @Override
...@@ -867,39 +913,6 @@ public class WorkProcessServiceImpl implements WorkProcessService { ...@@ -867,39 +913,6 @@ public class WorkProcessServiceImpl implements WorkProcessService {
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,""); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,"");
} }
@Override
public Result revoke(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
map.put(PROCESS_STATUS, BUSINESS_STATUS_2);
runtimeService.setVariables(task.getProcessInstanceId(), map);
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "撤销");
return Result.OK();
}
@Override @Override
public Result assignee(HandleDataDTO handleDataDTO) { public Result assignee(HandleDataDTO handleDataDTO) {
......
package com.junmp.junmpProcess.utils;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.sql.Time;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/29 16:19
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
public class FormAndOrder {
private Long formId;
/**
* 号型代码
*/
private String processDefinitionId;
/**
*
*/
@TableField(value = "sku_code")
private String formName;
/**
*
*/
private String isStop;
/**
*
*/
private String remark;
/**
*
*/
private Time updated;
/**
*
*/
private String templateId;
}
...@@ -17,23 +17,13 @@ import java.util.List; ...@@ -17,23 +17,13 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class TemplateGroupVo { public class TemplateGroupVo {
private String formId;
private List<Template> items; private String processDefinitionId;
private String formName;
@Data private Boolean isStop;
@Builder private String remark;
@AllArgsConstructor private String updated;
@NoArgsConstructor private String templateId;
public static class Template {
private String formId;
private String processDefinitionId;
private String formName;
private Boolean isStop;
private String remark;
private String updated;
private String templateId;
}
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<module>jyzb-biz</module> <module>jyzb-biz</module>
<module>jyzb-process</module> <module>jyzb-process</module>
<module>jyzb-common</module> <module>jyzb-common</module>
<module>jyzb-mq</module>
</modules> </modules>
<parent> <parent>
...@@ -35,17 +36,6 @@ ...@@ -35,17 +36,6 @@
<name>aliyun</name> <name>aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url> <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository> </repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
</repository>
<repository>
<id>oss</id>
<name>oss</name>
<url>https://oss.sonatype.org/content/groups/public</url>
</repository>
</repositories> </repositories>
<distributionManagement> <distributionManagement>
...@@ -80,6 +70,7 @@ ...@@ -80,6 +70,7 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
...@@ -131,6 +122,11 @@ ...@@ -131,6 +122,11 @@
<artifactId>v2-log-boot-starter</artifactId> <artifactId>v2-log-boot-starter</artifactId>
<version>${junmp.v2.version}</version> <version>${junmp.v2.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>log-biz-manage</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<!-- &lt;!&ndash;引入rabbitmq的相关依赖&ndash;&gt;--> <!-- &lt;!&ndash;引入rabbitmq的相关依赖&ndash;&gt;-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>com.rabbitmq</groupId>--> <!-- <groupId>com.rabbitmq</groupId>-->
...@@ -259,28 +255,6 @@ ...@@ -259,28 +255,6 @@
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
<version>2.3.1</version> <version>2.3.1</version>
</dependency> </dependency>
<!--swagger-->
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger-ui</artifactId>-->
<!-- <version>2.9.2</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger2</artifactId>-->
<!-- <version>2.9.2</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-annotations</artifactId>-->
<!-- <version>${swagger2.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-models</artifactId>-->
<!-- <version>1.5.22</version>-->
<!-- </dependency>-->
<!--swagger新ui界面--> <!--swagger新ui界面-->
<dependency> <dependency>
<groupId>com.github.xiaoymin</groupId> <groupId>com.github.xiaoymin</groupId>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论