From d30017df796e4e4aef20f320f3c27d90ba8cbeff Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Fri, 26 Jun 2026 08:43:01 +0800
Subject: [PATCH] 修改
---
hazmat-system/src/main/resources/mapper/system/SysUserRoleMapper.xml | 7
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzEntryRecordService.java | 13
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatFlowService.java | 4
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysMenuController.java | 10
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/SubscribeController.java | 80 ++
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzHazmatOrder.java | 27
hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeMapper.java | 25
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysUserServiceImpl.java | 6
hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml | 3
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java | 251 +++++++
hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeHazmatMapper.java | 13
hazmat-framework/src/main/java/com/gkhy/hazmat/framework/listener/CustomListener.java | 1
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatFlowServiceImpl.java | 183 +++++
hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/SecurityConfig.java | 14
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/dto/ChemicalLedger.java | 194 +++++
hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatMapper.java | 3
hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SysUserRoleMapper.java | 2
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/SubscribeService.java | 23
hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml | 17
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SubscribeServiceImpl.java | 257 +++++++
hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatBasicMapper.java | 1
hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml | 24
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java | 4
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseZkd.java | 18
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java | 26
hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/filter/ThirdPartyTokenFilter.java | 107 +++
hazmat-framework/src/main/java/com/gkhy/hazmat/framework/web/service/UserDetailServiceImpl.java | 25
hazmat-common/src/main/java/com/gkhy/hazmat/common/annotation/ThirdPartyToken.java | 13
hazmat-common/src/main/java/com/gkhy/hazmat/common/utils/SecurityUtils.java | 5
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java | 15
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatFlow.java | 105 +++
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzEntryRecordController.java | 59 +
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatService.java | 6
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/SubscribeHazmat.java | 47 +
hazmat-system/src/main/resources/mapper/system/SubscribeMapper.xml | 123 +++
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysUserController.java | 12
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/dto/HazmatDto.java | 15
hazmat-system/src/main/resources/mapper/system/SubscribeHazmatMapper.xml | 9
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/Subscribe.java | 72 ++
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatServiceImpl.java | 50 +
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseCupZkd.java | 12
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/ThirdPartController.java | 63 +
42 files changed, 1,901 insertions(+), 43 deletions(-)
diff --git a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysMenuController.java b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysMenuController.java
index 9c8e4e0..3c5e2bb 100644
--- a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysMenuController.java
+++ b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysMenuController.java
@@ -37,7 +37,7 @@
/**
* 获取菜单列表
*/
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
@GetMapping("/list")
public CommonResult list(SysMenu menu)
{
@@ -48,7 +48,7 @@
/**
* 根据菜单编号获取详细信息
*/
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
@GetMapping(value = "/{menuId}")
public CommonResult getInfo(@PathVariable Long menuId)
{
@@ -82,7 +82,7 @@
/**
* 新增菜单
*/
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public CommonResult add(@Validated @RequestBody SysMenu menu)
@@ -102,7 +102,7 @@
/**
* 修改菜单
*/
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public CommonResult edit(@Validated @RequestBody SysMenu menu)
@@ -126,7 +126,7 @@
/**
* 删除菜单
*/
-// @PreAuthorize("hasAnyAuthority('system:menu:remove')")
+ @PreAuthorize("hasAnyAuthority('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public CommonResult remove(@PathVariable("menuId") Long menuId)
diff --git a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysUserController.java b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysUserController.java
index 6e2c83c..ee9c569 100644
--- a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysUserController.java
+++ b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/system/SysUserController.java
@@ -42,7 +42,7 @@
// @PreAuthorize("hasAuthority('hazmat:manage:company')")
// @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company')")
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company','hazmat:manage:common')")
@ApiOperation(value = "用户列表(分页)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
@@ -61,7 +61,7 @@
return success(sysUserService.selectUserById(userId));
}
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company')")
@RepeatSubmit
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@ApiOperation(value = "新增用户")
@@ -70,7 +70,7 @@
return success(sysUserService.addUser(user));
}
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company','hazmat:manage:common')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company','hazmat:manage:common')")
@RepeatSubmit
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@ApiOperation(value = "编辑用户")
@@ -79,7 +79,7 @@
return success(sysUserService.updateUser(user));
}
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company')")
@RepeatSubmit
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@ApiOperation(value = "删除用户")
@@ -88,7 +88,7 @@
return success(sysUserService.deleteUserById(userId));
}
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company','hazmat:manage:common')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company','hazmat:manage:common')")
@RepeatSubmit
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@ApiOperation(value = "重置密码")
@@ -98,7 +98,7 @@
return success();
}
-// @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company')")
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company')")
@RepeatSubmit
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@ApiOperation(value = "修改用户状态")
diff --git a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzEntryRecordController.java b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzEntryRecordController.java
index 2bbe4a1..5002235 100644
--- a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzEntryRecordController.java
+++ b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzEntryRecordController.java
@@ -4,6 +4,7 @@
import com.gkhy.hazmat.common.annotation.RepeatSubmit;
import com.gkhy.hazmat.common.api.CommonResult;
import com.gkhy.hazmat.system.domain.HzEntryRecord;
+import com.gkhy.hazmat.system.domain.HzHazmat;
import com.gkhy.hazmat.system.service.HzEntryRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -85,4 +86,62 @@
return CommonResult.success(entryRecordService.deleteEntryRecordById(entryRecordId));
}
+
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
+ @RepeatSubmit
+ @ApiOperation(value = "新增订单入库记录")
+ @PostMapping("/orderadd")
+ public CommonResult orderadd(@Validated @RequestBody HzEntryRecord entryRecord){
+ return CommonResult.success(entryRecordService.insertOrderEntryRecord(entryRecord));
+ }
+
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
+ @RepeatSubmit
+ @ApiOperation(value = "编辑订单入库记录")
+ @PutMapping("/orderedit")
+ public CommonResult orderedit(@Validated @RequestBody HzEntryRecord entryRecord){
+ return CommonResult.success(entryRecordService.updateOrderEntryRecord(entryRecord));
+ }
+
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
+ @RepeatSubmit
+ @ApiOperation(value = "删除订单入库记录")
+ @DeleteMapping(value = { "order/{entryRecordId}" })
+ public CommonResult orderdelete(@PathVariable(value = "entryRecordId", required = true) Long entryRecordId){
+ return CommonResult.success(entryRecordService.deleteOrderEntryRecordById(entryRecordId));
+ }
+
+
+ @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
+ @RepeatSubmit
+ @ApiOperation(value = "订单入库")
+ @PostMapping("/orderEntry/{entryRecordId}")
+ public CommonResult orderEntry(@PathVariable(value = "entryRecordId", required = true) Long entryRecordId){
+ entryRecordService.orderEntry(entryRecordId);
+ return CommonResult.success();
+ }
+
+
+ @ApiOperation(value = "订单入库记录列表(分页)")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
+ @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10")
+ })
+ @GetMapping("/orderlist")
+ public CommonResult orderlist(HzEntryRecord entryRecord){
+ return CommonResult.success(entryRecordService.selectOrderEntryRecordList(entryRecord));
+ }
+
+ @ApiOperation(value = "根据订单入库id分页查询详情列表")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
+ @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
+ })
+ @GetMapping("order/hazmatlist")
+ public CommonResult orderhazmatlist(HzHazmat hzHazmat){
+ return CommonResult.success(entryRecordService.selectOrderHazmatListByEntryId(hzHazmat));
+ }
+
+
+
}
diff --git a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/SubscribeController.java b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/SubscribeController.java
new file mode 100644
index 0000000..24395d9
--- /dev/null
+++ b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/SubscribeController.java
@@ -0,0 +1,80 @@
+
+package com.gkhy.hazmat.admin.controller.web;
+
+import com.gkhy.hazmat.common.annotation.Log;
+import com.gkhy.hazmat.common.api.CommonPage;
+import com.gkhy.hazmat.common.api.CommonResult;
+import com.gkhy.hazmat.common.enums.BusinessType;
+import com.gkhy.hazmat.system.domain.Subscribe;
+import com.gkhy.hazmat.system.service.SubscribeService;
+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.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/system/subscribe")
+@Api(tags = "申购单管理")
+public class SubscribeController {
+
+ @Autowired
+ private SubscribeService subscribeService;
+
+ @PostMapping("/list")
+ @ApiOperation("查询申购单列表")
+ public CommonResult<CommonPage<Subscribe>> list(@RequestBody Subscribe subscribe) {
+ CommonPage<Subscribe> page = subscribeService.selectSubscribeList(subscribe);
+ return CommonResult.success(page);
+ }
+
+ @PostMapping("/auditList")
+ @ApiOperation("查询待审批申购单列表")
+ public CommonResult<CommonPage<Subscribe>> auditList(@RequestBody Subscribe subscribe) {
+ CommonPage<Subscribe> page = subscribeService.selectAuditList(subscribe);
+ return CommonResult.success(page);
+ }
+
+ @GetMapping("selectById/{id}")
+ @ApiOperation("获取申购单详细信息")
+ public CommonResult<Subscribe> getInfo(@ApiParam("申购单ID") @RequestParam("id") Long id) {
+ Subscribe subscribe = subscribeService.selectSubscribeById(id);
+ return CommonResult.success(subscribe);
+ }
+
+ @PostMapping("/insert")
+ @ApiOperation("新增申购单")
+ @Log(title = "申购单管理", businessType = BusinessType.INSERT)
+ public CommonResult add(@Validated @RequestBody Subscribe subscribe) {
+ subscribeService.insertSubscribe(subscribe);
+ return CommonResult.success();
+ }
+
+ @PostMapping("/update")
+ @ApiOperation("修改申购单")
+ @Log(title = "申购单管理", businessType = BusinessType.UPDATE)
+ public CommonResult edit(@Validated @RequestBody Subscribe subscribe) {
+ subscribeService.updateSubscribe(subscribe);
+ return CommonResult.success();
+ }
+
+ @GetMapping("/delete")
+ @ApiOperation("删除申购单")
+ @Log(title = "申购单管理", businessType = BusinessType.DELETE)
+ public CommonResult remove(@ApiParam("申购单ID") @RequestParam("id") Long id) {
+ subscribeService.deleteSubscribeById(id);
+ return CommonResult.success();
+ }
+
+ @GetMapping("/audit")
+ @ApiOperation("审核申购单")
+ @Log(title = "申购单审核", businessType = BusinessType.UPDATE)
+ public CommonResult audit(@RequestParam("id") Long id,
+ @RequestParam("status") Integer status,
+ @RequestParam("opinion") String opinion
+ ) {
+ subscribeService.auditSubscribe(id, status,opinion);
+ return CommonResult.success();
+ }
+}
\ No newline at end of file
diff --git a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/ThirdPartController.java b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/ThirdPartController.java
new file mode 100644
index 0000000..8a30f12
--- /dev/null
+++ b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/ThirdPartController.java
@@ -0,0 +1,63 @@
+package com.gkhy.hazmat.admin.controller.web;
+
+import com.gkhy.hazmat.common.annotation.ThirdPartyToken;
+import com.gkhy.hazmat.common.api.CommonResult;
+import com.gkhy.hazmat.system.domain.HzHazmat;
+import com.gkhy.hazmat.system.domain.HzHazmatFlow;
+import com.gkhy.hazmat.system.domain.HzWarehouse;
+import com.gkhy.hazmat.system.domain.dto.ChemicalLedger;
+import com.gkhy.hazmat.system.domain.dto.HazmatDto;
+import com.gkhy.hazmat.system.domain.vo.HzHazmatOrder;
+import com.gkhy.hazmat.system.service.HzHazmatFlowService;
+import com.gkhy.hazmat.system.service.HzHazmatService;
+import com.gkhy.hazmat.system.service.HzWarehouseService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/hazmat/zkd/data")
+@Api(tags = "第三放调用")
+public class ThirdPartController {
+ @Autowired
+ private HzWarehouseService warehouseService;
+
+ @Autowired
+ private HzHazmatService hazmatService;
+
+ @Autowired
+ private HzHazmatFlowService hazmatFlowService;
+
+
+ @ApiOperation(value = "zkd仓库列表")
+ @GetMapping("/getWarehouse")
+ @ThirdPartyToken
+ public CommonResult Thirdlist(HzWarehouse warehouse){
+ return CommonResult.success(warehouseService.selectzkdWarehouseList(warehouse));
+ }
+
+ @ApiOperation(value = "zkd根据仓库id和存储柜id查询入库订单相关危化品")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "query", name = "warehouseId", dataType = "long", required = true, value = "仓库id"),
+ @ApiImplicitParam(paramType = "query", name = "cupboardId", dataType = "long", required = true, value = "存储柜id")
+ })
+ @GetMapping("/getEntryRecord")
+ @ThirdPartyToken
+ public CommonResult listByWarehouseAndCupboard(@RequestBody HazmatDto hazmat) {
+ List<HzHazmatOrder> hazmatList = hazmatService.selectByWarehouseAndCupboard(hazmat);
+ return CommonResult.success(hazmatList);
+ }
+
+ @ApiOperation(value = "第三方平台推送流向数据")
+ @PostMapping("/pushFlowData")
+ @ThirdPartyToken
+ public CommonResult pushFlowData(@RequestBody List<ChemicalLedger> flowDTO) {
+ return hazmatFlowService.pushFlowFromThirdParty(flowDTO);
+ }
+
+}
diff --git a/hazmat-common/src/main/java/com/gkhy/hazmat/common/annotation/ThirdPartyToken.java b/hazmat-common/src/main/java/com/gkhy/hazmat/common/annotation/ThirdPartyToken.java
new file mode 100644
index 0000000..e9f7aaa
--- /dev/null
+++ b/hazmat-common/src/main/java/com/gkhy/hazmat/common/annotation/ThirdPartyToken.java
@@ -0,0 +1,13 @@
+package com.gkhy.hazmat.common.annotation;
+import java.lang.annotation.*;
+
+@Target({ ElementType.METHOD, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface ThirdPartyToken {
+ /**
+ * token来源标识,用于区分不同的第三方平台
+ * @return 平台标识
+ */
+ String platform() default "";
+}
diff --git a/hazmat-common/src/main/java/com/gkhy/hazmat/common/utils/SecurityUtils.java b/hazmat-common/src/main/java/com/gkhy/hazmat/common/utils/SecurityUtils.java
index cb6649d..d5ea027 100644
--- a/hazmat-common/src/main/java/com/gkhy/hazmat/common/utils/SecurityUtils.java
+++ b/hazmat-common/src/main/java/com/gkhy/hazmat/common/utils/SecurityUtils.java
@@ -19,6 +19,11 @@
return userId != null && 1L == userId;
}
+ public static boolean isSystemUser(Integer userType)
+ {
+ return userType != null && 0L == userType;
+ }
+
/**
* 判断密码是否相同
* @param rawPasword 真实密码
diff --git a/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/listener/CustomListener.java b/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/listener/CustomListener.java
index e386e99..2f92713 100644
--- a/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/listener/CustomListener.java
+++ b/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/listener/CustomListener.java
@@ -67,6 +67,7 @@
hazmatFlow.setState(OperateStatusEnum.ENTRY.getCode());
hazmatFlow.setCompanyId(hazmatEntryEvent.getCompanyId());
hazmatFlow.setNum(item.getRemaining());
+ hazmatFlow.setConsumption(item.getRemaining());
hazmatFlow.setCreateId(hazmatEntryEvent.getUserId());
return hazmatFlow;
}).collect(Collectors.toList());
diff --git a/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/SecurityConfig.java b/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/SecurityConfig.java
index c51f814..3a6dcd2 100644
--- a/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/SecurityConfig.java
+++ b/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/SecurityConfig.java
@@ -1,6 +1,7 @@
package com.gkhy.hazmat.framework.security;
import com.gkhy.hazmat.framework.security.filter.JwtAuthenticationTokenFilter;
+import com.gkhy.hazmat.framework.security.filter.ThirdPartyTokenFilter;
import com.gkhy.hazmat.framework.security.handle.AuthenticationEntryPointImpl;
import com.gkhy.hazmat.framework.security.handle.LogoutSuccessHandlerImpl;
import org.springframework.beans.factory.annotation.Autowired;
@@ -51,6 +52,9 @@
*/
@Autowired
private JwtAuthenticationTokenFilter authenticationTokenFilter;
+
+ @Autowired
+ private ThirdPartyTokenFilter thirdPartyTokenFilter;
/**
* 跨域过滤器
@@ -101,7 +105,7 @@
httpSecurity
// CSRF禁用,因为不使用session
- .cors().and()
+// .cors().and()
.csrf().disable()
// 禁用HTTP响应标头
.headers().cacheControl().disable().and()
@@ -111,6 +115,7 @@
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
+ .antMatchers("/api/hazmat/zkd/data/**").permitAll()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/**/login", "/register", "/system/captcha/captchaImage").permitAll()
// 静态资源,可匿名访问
@@ -123,10 +128,11 @@
// 添加Logout filter
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
// 添加JWT filter
+ httpSecurity.addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class);
+ // 2. 第三方固定Token过滤器
+ httpSecurity.addFilterBefore(thirdPartyTokenFilter, UsernamePasswordAuthenticationFilter.class);
+ // 3. 登录用户JWT过滤器
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
- // 添加CORS filter
- httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
- httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
}
/**
diff --git a/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/filter/ThirdPartyTokenFilter.java b/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/filter/ThirdPartyTokenFilter.java
new file mode 100644
index 0000000..31ac28c
--- /dev/null
+++ b/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/security/filter/ThirdPartyTokenFilter.java
@@ -0,0 +1,107 @@
+
+package com.gkhy.hazmat.framework.security.filter;
+
+import com.alibaba.fastjson2.JSON;
+import com.gkhy.hazmat.common.annotation.ThirdPartyToken;
+import com.gkhy.hazmat.common.api.CommonResult;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.MediaType;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.web.filter.OncePerRequestFilter;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.HandlerExecutionChain;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+
+/**
+ * 第三方平台token验证过滤器
+ */
+@Component
+public class ThirdPartyTokenFilter extends OncePerRequestFilter {
+
+ @Value("${third-party.token:}")
+ private String thirdPartyToken;
+
+ private static final Logger logger = LoggerFactory.getLogger(ThirdPartyTokenFilter.class);
+ private static final String TOKEN_HEADER = "X-Token";
+
+ private final RequestMappingHandlerMapping handlerMapping;
+
+ public ThirdPartyTokenFilter(RequestMappingHandlerMapping handlerMapping) {
+ this.handlerMapping = handlerMapping;
+ }
+
+ @Override
+ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+ throws ServletException, IOException {
+ // 跨域OPTIONS预检直接放行
+ if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
+ filterChain.doFilter(request, response);
+ return;
+ }
+
+ boolean isThirdAuth = false;
+ try {
+ HandlerExecutionChain handlerChain = handlerMapping.getHandler(request);
+ boolean needThirdToken = false;
+ if (handlerChain != null && handlerChain.getHandler() instanceof HandlerMethod) {
+ HandlerMethod handlerMethod = (HandlerMethod) handlerChain.getHandler();
+ ThirdPartyToken annotation = handlerMethod.getMethodAnnotation(ThirdPartyToken.class);
+ if (annotation == null) {
+ annotation = handlerMethod.getBeanType().getAnnotation(ThirdPartyToken.class);
+ }
+ needThirdToken = annotation != null;
+ }
+
+ // 仅标记@ThirdPartyToken的接口校验固定Token
+ if (needThirdToken) {
+ String clientToken = request.getHeader(TOKEN_HEADER);
+ if (!StringUtils.hasText(clientToken)) {
+ writeError(response, "请求头缺少X-Token第三方凭证");
+ return;
+ }
+ if (!thirdPartyToken.equals(clientToken)) {
+ writeError(response, "第三方Token无效,请核对凭证");
+ return;
+ }
+ // 写入安全上下文,携带专属权限
+ UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(
+ "third_party_single_platform", null, new ArrayList<>()
+ );
+ SecurityContextHolder.getContext().setAuthentication(authToken);
+ isThirdAuth = true;
+ }
+ filterChain.doFilter(request, response);
+ } catch (Exception e) {
+ logger.error("第三方Token过滤器解析处理器异常", e);
+ filterChain.doFilter(request, response);
+ } finally {
+ // 清除上下文,防止线程复用越权
+ if (isThirdAuth) {
+ SecurityContextHolder.clearContext();
+ }
+ }
+ }
+
+ /**
+ * 统一401错误返回
+ */
+ private void writeError(HttpServletResponse response, String msg) throws IOException {
+ response.setContentType("application/json;charset=UTF-8");
+ response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ response.getWriter().write("{\"code\":401,\"msg\":\"" + msg + "\",\"data\":null}");
+ }
+}
\ No newline at end of file
diff --git a/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/web/service/UserDetailServiceImpl.java b/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/web/service/UserDetailServiceImpl.java
index 572be55..8136177 100644
--- a/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/web/service/UserDetailServiceImpl.java
+++ b/hazmat-framework/src/main/java/com/gkhy/hazmat/framework/web/service/UserDetailServiceImpl.java
@@ -61,20 +61,23 @@
Set<String> roleKeys = permissionService.getRolePermission(user);
Set<String> permKeys = permissionService.getMenuPermission(user);
- List<GrantedAuthority> authorities = new ArrayList<>();
+// List<GrantedAuthority> authorities = new ArrayList<>();
+// for (String perm : permKeys) {
+// authorities.add(new SimpleGrantedAuthority(perm));
+// }
+ List<GrantedAuthority> authorities=new ArrayList<>();
for (String perm : permKeys) {
authorities.add(new SimpleGrantedAuthority(perm));
}
-// List<GrantedAuthority> authorities=new ArrayList<>();
-// if(UserTypeEnum.SYSTEM_USER.getCode().equals(user.getUserType())) {
-// authorities.add(new SimpleGrantedAuthority("hazmat:manage:system"));
-// }else if(UserTypeEnum.COMPANY_USER.getCode().equals(user.getUserType())){
-// authorities.add(new SimpleGrantedAuthority("hazmat:manage:company"));
-// }else if(UserTypeEnum.NORMAL_USER.getCode().equals(user.getUserType())){
-// authorities.add(new SimpleGrantedAuthority("hazmat:manage:common"));
-// }else if (UserTypeEnum.CHECK_USER.getCode().equals(user.getUserType())){
-// authorities.add(new SimpleGrantedAuthority("hazmat:manage:system"));
-// }
+ if(UserTypeEnum.SYSTEM_USER.getCode().equals(user.getUserType())) {
+ authorities.add(new SimpleGrantedAuthority("hazmat:manage:system"));
+ }else if(UserTypeEnum.COMPANY_USER.getCode().equals(user.getUserType())){
+ authorities.add(new SimpleGrantedAuthority("hazmat:manage:company"));
+ }else if(UserTypeEnum.NORMAL_USER.getCode().equals(user.getUserType())){
+ authorities.add(new SimpleGrantedAuthority("hazmat:manage:common"));
+ }else if (UserTypeEnum.CHECK_USER.getCode().equals(user.getUserType())){
+ authorities.add(new SimpleGrantedAuthority("hazmat:manage:system"));
+ }
return new LoginUserDetails(user,authorities,roleKeys,permKeys);
}
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java
index 28c8fc0..c413c5a 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java
@@ -57,7 +57,7 @@
@TableField("batch_no")
private String batchNo;
- @NotNull(message = "危化品基础id不能为空")
+// @NotNull(message = "危化品基础id不能为空")
@ApiModelProperty(value = "危化品基础id",required = true)
@TableField("basic_id")
private Long basicId;
@@ -90,6 +90,15 @@
@TableField("remark")
private String remark;
+ @ApiModelProperty("申购单号")
+ @TableField("subscribe_num")
+ private String subscribeNum;
+
+ @ApiModelProperty("类型(0入库,1订单入库)")
+ @TableField("type")
+ private Integer type;
+
+
@ApiModelProperty("危化品基础数据对象")
@TableField(exist = false)
private HzHazmatBasic hazmatBasic;
@@ -102,5 +111,9 @@
@TableField(exist = false)
private HzWarehouseCupboard cupboard;
+ @ApiModelProperty("申购单对象")
+ @TableField(exist = false)
+ private Subscribe subscribe;
+
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatFlow.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatFlow.java
index 117511e..1dde9af 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatFlow.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatFlow.java
@@ -64,6 +64,111 @@
@TableField("version")
private Integer version;
+ @ApiModelProperty("台账id")
+ @TableField("uuid")
+ private String uuid;
+
+ @ApiModelProperty("主柜id")
+ @TableField("cabinet_id")
+ private Long cabinetId;
+
+ @ApiModelProperty("主柜名称")
+ @TableField("cabinet_name")
+ private String cabinetName;
+
+ @ApiModelProperty("副柜id")
+ @TableField("auxiliary_cabinet_id")
+ private Long auxiliaryCabinetId;
+
+ @ApiModelProperty("副柜名称")
+ @TableField("auxiliary_cabinet_name")
+ private String auxiliaryCabinetName;
+
+ @ApiModelProperty("库存所属人")
+ @TableField("owner")
+ private String owner;
+
+ @ApiModelProperty("化学品分类")
+ @TableField("chemical_type")
+ private String chemicalType;
+
+ @ApiModelProperty("容器编号")
+ @TableField("container_no")
+ private String containerNo;
+
+ @ApiModelProperty("用途")
+ @TableField("container_use")
+ private String containerUse;
+
+ @ApiModelProperty("管控类")
+ @TableField("control_type")
+ private String controlType;
+
+ @ApiModelProperty("第一操作人")
+ @TableField("u_name_one")
+ private String uNameOne;
+
+ @ApiModelProperty("第一操作人人脸图片URL")
+ @TableField("facelmg_url")
+ private String facelmgUrl;
+
+ @ApiModelProperty("第二操作人")
+ @TableField("u_name_two")
+ private String uNameTwo;
+
+ @ApiModelProperty("第二操作人脸图片URL")
+ @TableField("facelmg_url_two")
+ private String facelmgUrlTwo;
+
+ @ApiModelProperty("危险化学品分类")
+ @TableField("hazchem_type")
+ private String hazchemType;
+
+ @ApiModelProperty("操作")
+ @TableField("operate")
+ private String operate;
+
+ @ApiModelProperty("学院名称")
+ @TableField("org_name")
+ private String orgName;
+
+ @ApiModelProperty("其他作废原因")
+ @TableField("reason")
+ private String reason;
+
+ @ApiModelProperty("作废原因 0空瓶 1破损 2过期 3余量不足 4其他")
+ @TableField("reason_id")
+ private Integer reasonId;
+
+ @ApiModelProperty("化学品类型")
+ @TableField("regulatory")
+ private String regulatory;
+
+ @ApiModelProperty("实验室名称")
+ @TableField("room_name")
+ private String roomName;
+
+ @ApiModelProperty("学校名称")
+ @TableField("school_name")
+ private String schoolName;
+
+ @ApiModelProperty("操作人")
+ @TableField("username")
+ private String username;
+
+ @ApiModelProperty("重量")
+ @TableField("weight")
+ private BigDecimal weight;
+
+ @ApiModelProperty("重量单位")
+ @TableField("weight_unit")
+ private String weightUnit;
+
+ @ApiModelProperty("用量")
+ @TableField("consumption")
+ private BigDecimal consumption;
+
+
@ApiModelProperty("危化品基础数据对象")
@TableField(exist = false)
private HzHazmatBasic hazmatBasic;
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/Subscribe.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/Subscribe.java
new file mode 100644
index 0000000..970a638
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/Subscribe.java
@@ -0,0 +1,72 @@
+package com.gkhy.hazmat.system.domain;
+
+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 com.fasterxml.jackson.annotation.JsonInclude;
+import com.gkhy.hazmat.common.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+@Getter
+@Setter
+@Accessors(chain = true)
+@TableName("subscribe")
+@ApiModel(value = "Subscribe对象", description = "申购单")
+@JsonInclude(NON_NULL)
+public class Subscribe extends BaseEntity {
+ @ApiModelProperty("主键ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ @ApiModelProperty("申购单号")
+ @TableField("subscribe_num")
+ private String subscribeNum;
+
+ @ApiModelProperty("申购人ID")
+ @TableField("subscribe_person_id")
+ private Long subscribePersonId;
+
+ @ApiModelProperty("申购人姓名")
+ @TableField("subscribe_person_name")
+ private String subscribePersonName;
+
+ @ApiModelProperty("审核ID")
+ @TableField("check_id")
+ private Long checkId;
+
+ @ApiModelProperty("审核名称")
+ @TableField("check_name")
+ private String checkName;
+
+ @ApiModelProperty("审核意见")
+ @TableField("opinion")
+ private String opinion;
+
+ @ApiModelProperty("文件路径")
+ @TableField("file_path")
+ private String filePath;
+
+ @ApiModelProperty("文件名称")
+ @TableField("file_name")
+ private String fileName;
+
+ @ApiModelProperty("状态 0待审核 1通过 2驳回")
+ @TableField("status")
+ private Integer status;
+
+ @ApiModelProperty("删除标志")
+ @TableField("del_flag")
+ private Integer delFlag;
+
+ @TableField(exist = false)
+ private List<SubscribeHazmat> subscribeHazmats;
+}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/SubscribeHazmat.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/SubscribeHazmat.java
new file mode 100644
index 0000000..a7386b9
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/SubscribeHazmat.java
@@ -0,0 +1,47 @@
+package com.gkhy.hazmat.system.domain;
+
+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 com.fasterxml.jackson.annotation.JsonInclude;
+import com.gkhy.hazmat.common.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+@Getter
+@Setter
+@Accessors(chain = true)
+@TableName("subscribe_hazmat")
+@ApiModel(value = "SubscribeHazmat", description = "危化品明细表")
+@JsonInclude(NON_NULL)
+public class SubscribeHazmat extends BaseEntity {
+ @ApiModelProperty("主键ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ @ApiModelProperty("申购单ID")
+ @TableField("subscribe_id")
+ private Long subscribeId;
+
+ @ApiModelProperty("危化品ID")
+ @TableField("basic_id")
+ private Long basicId;
+
+ @ApiModelProperty("危化品名称")
+ @TableField("hazmat_name")
+ private String hazmatName;
+
+ @ApiModelProperty("危化品数量")
+ @TableField("hazmat_count")
+ private Integer hazmatCount;
+
+ @ApiModelProperty("删除标志")
+ @TableField("del_flag")
+ private Integer delFlag;
+}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/dto/ChemicalLedger.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/dto/ChemicalLedger.java
new file mode 100644
index 0000000..61908ff
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/dto/ChemicalLedger.java
@@ -0,0 +1,194 @@
+package com.gkhy.hazmat.system.domain.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class ChemicalLedger {
+
+ /**
+ * 台账id
+ */
+ private String id;
+
+ /**
+ * 副柜id
+ */
+ private Integer auxiliaryCabinetId;
+
+ /**
+ * 副柜名称
+ */
+ private String auxiliaryCabinetName;
+
+ /**
+ * 主柜id
+ */
+ private Integer cabinetId;
+
+ /**
+ * 主柜名
+ */
+ private String cabinetName;
+
+ /**
+ * 库存所属人
+ */
+ private String owner;
+
+ /**
+ * cas号
+ */
+ private String cas;
+
+ /**
+ * 化学品名称
+ */
+ private String chemicalName;
+
+ /**
+ * 化学品分类(一级分类)
+ */
+ private String chemicalType;
+
+ /**
+ * 用量
+ */
+ private BigDecimal consumption;
+
+ /**
+ * 容器编号
+ */
+ private String containerNo;
+
+ /**
+ * 用途
+ */
+ private String containerUse;
+
+ /**
+ * 管制类(三级分类)
+ */
+ private String controlType;
+
+ /**
+ * 操作时间
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ /**
+ * 创建人
+ */
+ private String createUserName;
+
+ /**
+ * 第一操作人
+ */
+ private String uNameOne;
+
+ /**
+ * 人脸照片地址
+ */
+ private String faceImgUrl;
+
+ /**
+ * 第二操作人
+ */
+ private String uNameTwo;
+
+ /**
+ * 人脸照片2地址
+ */
+ private String faceImgUrlTwo;
+
+ /**
+ * 危险化学品分类(二级分类)
+ */
+ private String hazchemType;
+
+ /**
+ * 操作类型
+ */
+ private Integer storageType;
+
+ /**
+ * 操作
+ */
+ private String operate;
+
+ /**
+ * 学院名称
+ */
+ private String orgName;
+
+ /**
+ * 其他作废原因
+ */
+ private String reason;
+
+ /**
+ * 作废原因 0 空瓶 1 破损 2 过期 3 余量不足 4 其他
+ */
+ private Integer reasonId;
+
+ /**
+ * 化学品类型
+ */
+ private String regulatory;
+
+ /**
+ * 备注
+ */
+ private String remark;
+
+ /**
+ * 实验室名称
+ */
+ private String roomName;
+
+ /**
+ * 学校名称
+ */
+ private String schoolName;
+
+ /**
+ * 试剂规格
+ */
+ private String standard;
+
+ /**
+ * 规格单位
+ */
+ private String unit;
+
+ /**
+ * 操作人
+ */
+ private String username;
+
+ /**
+ * 重量
+ */
+ private BigDecimal weight;
+
+ /**
+ * 重量单位
+ */
+ private String weightUnit;
+
+ /**
+ * 数量
+ */
+ private Integer num;
+ private Long hazmatId;
+
+
+}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/dto/HazmatDto.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/dto/HazmatDto.java
new file mode 100644
index 0000000..803255d
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/dto/HazmatDto.java
@@ -0,0 +1,15 @@
+package com.gkhy.hazmat.system.domain.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.time.LocalDateTime;
+
+@Setter
+@Getter
+public class HazmatDto {
+
+ private Long cabinetId;
+ private Long auxiliaryCabinetId;
+ private LocalDateTime time;
+}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzHazmatOrder.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzHazmatOrder.java
new file mode 100644
index 0000000..dfd3964
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzHazmatOrder.java
@@ -0,0 +1,27 @@
+package com.gkhy.hazmat.system.domain.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+
+@Setter
+@Getter
+public class HzHazmatOrder {
+
+ private Long hzhazmatId;//试剂id
+ private Long cabinetId;//主柜id
+ private Long auxiliaryCabinetId;//副柜id
+ private String subscribeNum;//申购单号
+ private String cas;//cas号
+ private String standard;//规格
+ private BigDecimal remaining;//数量
+ private String productSn;//试剂编码
+ private String subscribePersonName;//申购人
+ private String ofDept;//所属部门
+}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseCupZkd.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseCupZkd.java
new file mode 100644
index 0000000..a7cd111
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseCupZkd.java
@@ -0,0 +1,12 @@
+package com.gkhy.hazmat.system.domain.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class HzWarehouseCupZkd {
+
+ private Integer auxiliaryCabinetId;
+ private String auxiliaryCabinetName;
+}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseZkd.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseZkd.java
new file mode 100644
index 0000000..010fe81
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseZkd.java
@@ -0,0 +1,18 @@
+package com.gkhy.hazmat.system.domain.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+@Getter
+@Setter
+public class HzWarehouseZkd {
+
+ private Long cabinetId;
+ private String cabinetName;
+
+ private List<HzWarehouseCupZkd> warehouseCupZkds;
+}
+
+
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatBasicMapper.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatBasicMapper.java
index 903894d..dda1521 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatBasicMapper.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatBasicMapper.java
@@ -47,4 +47,5 @@
List<HzBasicVo> basicCount();
+ HzHazmatBasic selectByCas(String cas);
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatMapper.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatMapper.java
index df27091..f2298af 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatMapper.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzHazmatMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.hazmat.system.domain.HzHazmat;
+import com.gkhy.hazmat.system.domain.dto.HazmatDto;
import com.gkhy.hazmat.system.domain.dto.HazmatUseStatisticDTO;
import com.gkhy.hazmat.system.domain.vo.*;
import org.apache.ibatis.annotations.Mapper;
@@ -107,4 +108,6 @@
List<HzCompanyMessage> companyMessage(Long type);
Integer countTotal(Long companyId);
+
+ List<HzHazmat> selectByWarehouseAndCupboard(HazmatDto hazmatDto);
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeHazmatMapper.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeHazmatMapper.java
new file mode 100644
index 0000000..b25d0ae
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeHazmatMapper.java
@@ -0,0 +1,13 @@
+
+package com.gkhy.hazmat.system.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gkhy.hazmat.system.domain.SubscribeHazmat;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface SubscribeHazmatMapper extends BaseMapper<SubscribeHazmat> {
+ List<SubscribeHazmat> selectbySubscribeId(Long id);
+}
\ No newline at end of file
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeMapper.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeMapper.java
index 9a99825..cd51822 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeMapper.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SubscribeMapper.java
@@ -1,4 +1,25 @@
package com.gkhy.hazmat.system.mapper;
-public interface SubscribeMapper {
-}
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gkhy.hazmat.system.domain.Subscribe;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface SubscribeMapper extends BaseMapper<Subscribe> {
+
+ List<Subscribe> selectSubscribeList(Subscribe subscribe);
+
+ Subscribe selectSubscribeById(@Param("subscribeId") Long subscribeId);
+
+ int insertSubscribe(Subscribe subscribe);
+
+ int updateSubscribe(Subscribe subscribe);
+
+ int deleteSubscribeById(@Param("subscribeId") Long subscribeId);
+
+ Subscribe selectBySubscribeNum(String subscribeNum);
+
+ Subscribe selectbyNum(String subscribeNum);
+
+}
\ No newline at end of file
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SysUserRoleMapper.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SysUserRoleMapper.java
index 6e2749d..eb6390f 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SysUserRoleMapper.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/SysUserRoleMapper.java
@@ -61,4 +61,6 @@
* @return 结果
*/
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
+
+ void insert(SysUserRole ur);
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzEntryRecordService.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzEntryRecordService.java
index 167b24d..b3370e3 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzEntryRecordService.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzEntryRecordService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.hazmat.common.api.CommonPage;
import com.gkhy.hazmat.system.domain.HzEntryRecord;
+import com.gkhy.hazmat.system.domain.HzHazmat;
/**
* <p>
@@ -66,4 +67,16 @@
* @return
*/
CommonPage selectHazmatListByEntryId(Long entryId);
+
+ void orderEntry(Long entryRecordId);
+
+ int insertOrderEntryRecord(HzEntryRecord entryRecord);
+
+ int updateOrderEntryRecord(HzEntryRecord entryRecord);
+
+ int deleteOrderEntryRecordById(Long entryRecordId);
+
+ CommonPage selectOrderEntryRecordList(HzEntryRecord entryRecord);
+
+ CommonPage selectOrderHazmatListByEntryId(HzHazmat hzHazmat);
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatFlowService.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatFlowService.java
index 938791e..1a821bb 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatFlowService.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatFlowService.java
@@ -2,7 +2,9 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.hazmat.common.api.CommonPage;
+import com.gkhy.hazmat.common.api.CommonResult;
import com.gkhy.hazmat.system.domain.HzHazmatFlow;
+import com.gkhy.hazmat.system.domain.dto.ChemicalLedger;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -77,4 +79,6 @@
* @return
*/
List<HzHazmatFlow> getAllHazmatFlowByHazmatId(Long hazmatId,Long companyId);
+
+ CommonResult pushFlowFromThirdParty(List<ChemicalLedger> flows);
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatService.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatService.java
index 94e96ac..558eb31 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatService.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatService.java
@@ -4,7 +4,11 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.hazmat.common.api.CommonPage;
import com.gkhy.hazmat.system.domain.HzHazmat;
+import com.gkhy.hazmat.system.domain.dto.HazmatDto;
+import com.gkhy.hazmat.system.domain.vo.HzHazmatOrder;
import com.gkhy.hazmat.system.domain.vo.HzHazmatWarehouseVO;
+
+import java.util.List;
/**
* <p>
@@ -96,4 +100,6 @@
* @param hazmat
*/
void changeRemaining(HzHazmat hazmat);
+
+ List<HzHazmatOrder> selectByWarehouseAndCupboard(HazmatDto hazmatDto);
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java
index 88bb848..1dd9d46 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java
@@ -4,6 +4,8 @@
import com.gkhy.hazmat.common.api.CommonPage;
import com.gkhy.hazmat.system.domain.HzWarehouse;
import com.gkhy.hazmat.system.domain.HzWarehouseCupboard;
+import com.gkhy.hazmat.system.domain.vo.HzWarehouseVo;
+import com.gkhy.hazmat.system.domain.vo.HzWarehouseZkd;
import java.util.List;
@@ -95,4 +97,6 @@
* @return
*/
List<HzWarehouseCupboard> selectByWarehouseId(Long warehouseId);
+
+ List<HzWarehouseZkd> selectzkdWarehouseList(HzWarehouse warehouse);
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/SubscribeService.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/SubscribeService.java
new file mode 100644
index 0000000..ee9d9a2
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/SubscribeService.java
@@ -0,0 +1,23 @@
+
+package com.gkhy.hazmat.system.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gkhy.hazmat.common.api.CommonPage;
+import com.gkhy.hazmat.system.domain.Subscribe;
+
+public interface SubscribeService extends IService<Subscribe> {
+
+ CommonPage<Subscribe> selectSubscribeList(Subscribe subscribe);
+
+ Subscribe selectSubscribeById(Long subscribeId);
+
+ int insertSubscribe(Subscribe subscribe);
+
+ int updateSubscribe(Subscribe subscribe);
+
+ int deleteSubscribeById(Long subscribeId);
+
+ void auditSubscribe(Long subscribeId, Integer status,String opinion);
+
+ CommonPage<Subscribe> selectAuditList(Subscribe subscribe);
+}
\ No newline at end of file
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java
index aac3a7f..66af1f2 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java
@@ -23,6 +23,7 @@
import com.gkhy.hazmat.system.mapper.*;
import com.gkhy.hazmat.system.service.HzEntryRecordService;
import com.gkhy.hazmat.system.service.HzHazmatService;
+import com.gkhy.hazmat.system.service.SubscribeService;
import com.gkhy.hazmat.system.service.TabooWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -63,12 +64,19 @@
@Autowired
private HzTabooWarningMapper tabooWarningMapper;
+ @Autowired
+ private SubscribeMapper subscribeMapper;
+
+ @Autowired
+ private SubscribeHazmatMapper subscribeHazmatMapper;
+
@Override
public CommonPage selectEntryRecordList(HzEntryRecord entryRecord) {
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
entryRecord.setCompanyId(currentUser.getCompanyId());
}
+ entryRecord.setType(0);
PageUtils.startPage();
List<HzEntryRecord> entryRecordList = baseMapper.selectEntryRecordList(entryRecord);
return CommonPage.restPage(entryRecordList);
@@ -98,6 +106,7 @@
}
entryRecord.setCompanyId(currentUser.getCompanyId());
entryRecord.setCreateBy(currentUser.getUsername());
+ entryRecord.setType(0);
checkUserAllowed(null,currentUser);
int row=0;
synchronized (this) {
@@ -350,6 +359,248 @@
return CommonPage.restPage(hazmatList);
}
+ @Override
+ @Transactional(rollbackFor = RuntimeException.class)
+ public void orderEntry(Long entryRecordId) {
+ HzEntryRecord entryRecord=getById(entryRecordId);
+ if(entryRecord.getState().equals(EntryStateEnum.ENTER.getCode())){
+ throw new ApiException("已完成入库,不能再操作");
+ }
+ SysUser currentUser=SecurityUtils.getLoginUser().getUser();
+ checkUserAllowed(entryRecord,currentUser);
+ Subscribe subscribe = subscribeMapper.selectbyNum(entryRecord.getSubscribeNum());
+ if(subscribe==null){
+ throw new ApiException("申购单不存在");
+ }
+ int currentStartCode = entryRecord.getStartCode();
+ List<SubscribeHazmat> subscribeHazmats = subscribeHazmatMapper.selectbySubscribeId(subscribe.getId());
+ for (SubscribeHazmat subscribeHazmat : subscribeHazmats) {
+ HzHazmatBasic hazmatBasic=hazmatBasicMapper.selectById(subscribeHazmat.getBasicId());
+ if(hazmatBasic==null){
+ throw new ApiException("危化品基础数据不存在");
+ }
+ Integer hazmatCount = subscribeHazmat.getHazmatCount() != null ? subscribeHazmat.getHazmatCount() : 0;
+ if (hazmatCount <= 0) {
+ continue;
+ }
+ // 计算该危化品的条码范围
+ int hazmatStartCode = currentStartCode;
+ int hazmatEndCode = currentStartCode + hazmatCount - 1;
+
+ // 更新下一个危化品的起始码
+ currentStartCode = hazmatEndCode + 1;
+ int count = hazmatMapper.selectHazmatCountOfWarehouse(entryRecord.getWarehouseId(), hazmatBasic.getId(), currentUser.getCompanyId(), entryRecord.getCupboardId());
+ //新增危化品变动记录
+ HzWarehouseRecord warehouseRecord = new HzWarehouseRecord()
+ .setWarehouseId(entryRecord.getWarehouseId())
+ .setCupboardId(entryRecord.getCupboardId())
+ .setBasicId(hazmatBasic.getId())
+ .setNum(entryRecord.getNum())
+ .setCompanyId(currentUser.getCompanyId())
+ .setCreateId(currentUser.getId())
+ .setRemaining(entryRecord.getNum() + count);
+ warehouseRecordMapper.insert(warehouseRecord);
+ // 校验生成相忌数据
+ Map<String, Long> redata = (Map<String, Long>)redisService.get(Constant.TABOO_UNIQUE_KEY);
+ if (!redata.isEmpty()){
+ // 查询对应仓库和柜子的物品信息获取品类 获取相冲相弱相吸相异
+ List<TabooDisVo> collectData =
+ hazmatMapper.selectHazmatWarehouseCheck(entryRecord.getWarehouseId(), currentUser.getCompanyId(), entryRecord.getCupboardId());
+ if (!collectData.isEmpty() && collectData.size() > 0) {
+ for (TabooDisVo collectDatum : collectData) {
+ String key1 = collectDatum.getSpNum() + "_" + hazmatBasic.getPeculiarityNumber();
+ String key2 = hazmatBasic.getPeculiarityNumber() + "_" + collectDatum.getSpNum();
+
+ if (redata.containsKey(key1) || redata.containsKey(key2)) {
+ // 记录数据
+ Long l = redata.get(key1);
+ Long l1 = l == null ? redata.get(key2) : l;
+ HzTabooWarning tabooWarning = new HzTabooWarning()
+ .setWarningType(l1)
+ .setWarehouseId(entryRecord.getWarehouseId())
+ .setCupboardId(entryRecord.getCupboardId())
+ .setEntryId(entryRecord.getId())
+ .setCompanyId(currentUser.getCompanyId())
+ .setTabooBasicId(collectDatum.getId()).setCreateBy(currentUser.getUsername());
+ tabooWarningMapper.insert(tabooWarning);
+ break;
+ }
+ }
+ }
+ }else {
+ throw new ApiException("危化品相忌信息不存在");
+ }
+ List<HzHazmat> hazmatList = new ArrayList<>();
+ for (int i = hazmatStartCode; i <=hazmatEndCode; i++) {
+ String lastCode= StringUtils.addZeroForNum(String.valueOf(i),4);
+ String code=String.format("%s%s",entryRecord.getCodePrex(),lastCode);
+ hazmatList.add(new HzHazmat().setWarehouseId(entryRecord.getWarehouseId())
+ .setCupboardId(entryRecord.getCupboardId())
+ .setBasicId(subscribeHazmat.getBasicId())
+ .setCupboardId(entryRecord.getCupboardId())
+ .setEntryId(entryRecord.getId())
+ .setRemaining(hazmatBasic.getMetering())
+ .setCompanyId(currentUser.getCompanyId())
+ .setState(HazmatStatusEnum.WAREHOUSEIN.getCode())
+ .setCode(code));
+ }
+
+ //批量创建危化品
+ if (hazmatList.size() > 100) {
+ while (!hazmatList.isEmpty()) {
+ int endIndex = Math.min(hazmatList.size(), 100);
+ List<HzHazmat> subList = hazmatList.subList(0, endIndex);
+ hazmatService.saveBatch(subList);
+ hazmatList = hazmatList.subList(endIndex, hazmatList.size());
+ }
+ } else {
+ hazmatService.saveBatch(hazmatList);
+ }
+ // }
+ //更新入库记录状态
+ entryRecord.setState(EntryStateEnum.ENTER.getCode());
+ updateById(entryRecord);
+
+// IdTableNameHandler.removeCurrentId();
+ }
+
+ //异步执行
+ // 注册一个事务完成后执行的回调
+ TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
+ @Override
+ public void afterCommit() {
+ customEventPublisher.publishEntry(entryRecord.getId(), CodePrexEnum.MATERIAL.getCode(), currentUser.getCompanyId(), currentUser.getId());
+ }
+ });
+ }
+
+ @Override
+ public int insertOrderEntryRecord(HzEntryRecord entryRecord) {
+ SysUser currentUser=SecurityUtils.getLoginUser().getUser();
+ Map<String, Object> parms = new HashMap<>();
+ parms.put("subscribe_num",entryRecord.getSubscribeNum());
+ List<HzEntryRecord> hzEntryRecords = baseMapper.selectByMap(parms);
+ if (hzEntryRecords.size()>0){
+ throw new ApiException("申购单已入库,不能重复添加");
+ }
+
+ Subscribe subscribe = subscribeMapper.selectbyNum(entryRecord.getSubscribeNum());
+ if(subscribe==null){
+ throw new ApiException("申购单不存在");
+ }
+ List<SubscribeHazmat> subscribeHazmats = subscribeHazmatMapper.selectbySubscribeId(subscribe.getId());
+ for (SubscribeHazmat subscribeHazmat : subscribeHazmats) {
+ HzHazmatBasic hazmatBasic=hazmatBasicMapper.selectById(subscribeHazmat.getBasicId());
+ if(hazmatBasic==null){
+ throw new ApiException("危化品基础数据不存在"+hazmatBasic.getName());
+ }
+ if(subscribeHazmat.getHazmatCount()>hazmatBasic.getMaxEntry()){
+ throw new ApiException(hazmatBasic.getName()+"数量超过单次入库最大数量<"+hazmatBasic.getMaxEntry()+">");
+ }
+ }
+ entryRecord.setCompanyId(currentUser.getCompanyId());
+ entryRecord.setCreateBy(currentUser.getUsername());
+ entryRecord.setType(1);
+ checkUserAllowed(null,currentUser);
+ int row=0;
+ synchronized (this) {
+ //生成条码范围
+ generateCode(entryRecord);
+ row = baseMapper.insert(entryRecord);
+ if (row < 1) {
+ throw new ApiException("新增入库记录失败");
+ }
+ }
+ return row;
+ }
+
+ @Override
+ public int updateOrderEntryRecord(HzEntryRecord entryRecord) {
+ SysUser currentUser = SecurityUtils.getLoginUser().getUser();
+ checkUserAllowed(entryRecord,currentUser);
+ Subscribe subscribe = subscribeMapper.selectbyNum(entryRecord.getSubscribeNum());
+ if(subscribe==null){
+ throw new ApiException("申购单不存在");
+ }
+ List<SubscribeHazmat> subscribeHazmats = subscribeHazmatMapper.selectbySubscribeId(subscribe.getId());
+ for (SubscribeHazmat subscribeHazmat : subscribeHazmats) {
+ HzHazmatBasic hazmatBasic=hazmatBasicMapper.selectById(subscribeHazmat.getBasicId());
+ if(hazmatBasic==null){
+ throw new ApiException("危化品基础数据不存在"+hazmatBasic.getName());
+ }
+ if(entryRecord.getNum()>hazmatBasic.getMaxEntry()){
+ throw new ApiException(hazmatBasic.getName()+"数量超过单次入库最大数量<"+hazmatBasic.getMaxEntry()+">");
+ }
+ }
+ HzEntryRecord existEr=baseMapper.selectById(entryRecord.getId());
+ if(existEr.getState().equals(EntryStateEnum.ENTER.getCode())){
+ throw new ApiException("已经入库,不能再修改");
+ }
+ if (!Objects.equals(existEr.getNum(),entryRecord.getNum())) {
+ generateCode2(entryRecord);
+ }
+ entryRecord.setUpdateBy(currentUser.getUsername());
+ int row=baseMapper.updateById(entryRecord);
+ if(row<1){
+ throw new ApiException("更新入库信息失败");
+ }
+ return row;
+ }
+
+ @Override
+ public int deleteOrderEntryRecordById(Long entryRecordId) {
+ HzEntryRecord entryRecord=baseMapper.selectById(entryRecordId);
+ if(entryRecord==null){
+ throw new ApiException("入库记录不存在");
+ }
+ if(entryRecord.getState().equals(EntryStateEnum.ENTER.getCode())){
+ throw new ApiException("已入库状态的记录不能删除");
+ }
+ SysUser currentUser = SecurityUtils.getLoginUser().getUser();
+ checkUserAllowed(entryRecord,currentUser);
+ int update = baseMapper.deleteById(entryRecordId);
+ return update;
+ }
+
+ @Override
+ public CommonPage selectOrderEntryRecordList(HzEntryRecord entryRecord) {
+ SysUser currentUser = SecurityUtils.getLoginUser().getUser();
+ if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
+ entryRecord.setCompanyId(currentUser.getCompanyId());
+ }
+ entryRecord.setType(1);
+ PageUtils.startPage();
+ List<HzEntryRecord> entryRecordList = baseMapper.selectEntryRecordList(entryRecord);
+ for (HzEntryRecord hzEntryRecord : entryRecordList) {
+ if (hzEntryRecord.getSubscribeNum() != null) {
+ Subscribe subscribe = subscribeMapper.selectbyNum(hzEntryRecord.getSubscribeNum());
+ subscribe.setSubscribeHazmats(subscribeHazmatMapper.selectbySubscribeId(subscribe.getId()));
+ hzEntryRecord.setSubscribe(subscribe);
+ }
+ }
+ return CommonPage.restPage(entryRecordList);
+ }
+
+ @Override
+ public CommonPage selectOrderHazmatListByEntryId(HzHazmat hzHazmat) {
+ SysUser currentUser = SecurityUtils.getLoginUser().getUser();
+ HzEntryRecord entryRecord=getById(hzHazmat.getEntryId());
+ if(entryRecord==null){
+ throw new ApiException("入库信息不存在");
+ }
+ checkUserAllowed(entryRecord,currentUser);
+// if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
+// IdTableNameHandler.setCurrentId(entryRecord.getCompanyId());
+// }else {
+// //设置分表id
+// IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
+// }
+ PageUtils.startPage();
+ List<HzHazmat> hazmatList = hazmatMapper.selectHazmatList(hzHazmat);
+// IdTableNameHandler.removeCurrentId();
+ return CommonPage.restPage(hazmatList);
+ }
+
public void checkUserAllowed(HzEntryRecord entryRecord,SysUser user) {
if (user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
throw new ApiException("管理员不能操作");
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatFlowServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatFlowServiceImpl.java
index 459e845..c8b65c4 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatFlowServiceImpl.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatFlowServiceImpl.java
@@ -5,23 +5,31 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.hazmat.common.api.CommonPage;
//import com.gkhy.hazmat.common.config.IdTableNameHandler;
+import com.gkhy.hazmat.common.api.CommonResult;
import com.gkhy.hazmat.common.domain.entity.SysUser;
import com.gkhy.hazmat.common.enums.CodePrexEnum;
+import com.gkhy.hazmat.common.enums.HazmatStatusEnum;
+import com.gkhy.hazmat.common.enums.OperateStatusEnum;
import com.gkhy.hazmat.common.enums.UserTypeEnum;
import com.gkhy.hazmat.common.exception.ApiException;
import com.gkhy.hazmat.common.utils.PageUtils;
import com.gkhy.hazmat.common.utils.SecurityUtils;
import com.gkhy.hazmat.system.domain.HzHazmat;
+import com.gkhy.hazmat.system.domain.HzHazmatBasic;
import com.gkhy.hazmat.system.domain.HzHazmatFlow;
+import com.gkhy.hazmat.system.domain.HzWarehouseRecord;
+import com.gkhy.hazmat.system.domain.dto.ChemicalLedger;
+import com.gkhy.hazmat.system.mapper.HzHazmatBasicMapper;
import com.gkhy.hazmat.system.mapper.HzHazmatFlowMapper;
import com.gkhy.hazmat.system.mapper.HzHazmatMapper;
+import com.gkhy.hazmat.system.mapper.HzWarehouseRecordMapper;
import com.gkhy.hazmat.system.service.HzHazmatFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
+import java.math.BigDecimal;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -36,6 +44,12 @@
public class HzHazmatFlowServiceImpl extends ServiceImpl<HzHazmatFlowMapper, HzHazmatFlow> implements HzHazmatFlowService {
@Autowired
private HzHazmatMapper hazmatMapper;
+
+ @Autowired
+ private HzHazmatBasicMapper hazmatBasicMapper;
+
+ @Autowired
+ private HzWarehouseRecordMapper warehouseRecordMapper;
@Override
public CommonPage selectHazmatFlowList(HzHazmatFlow hazmatFlow) {
@@ -175,6 +189,169 @@
return hazmatFlowList;
}
+ @Override
+ @Transactional
+ public CommonResult pushFlowFromThirdParty(List<ChemicalLedger> flows) {
+ List<HzHazmatFlow> hazmatFlowList = new ArrayList<>();
+ List<String> errorMessages = new ArrayList<>();
+ int successCount = 0;
+ int failCount = 0;
+ for (int i = 0; i < flows.size(); i++) {
+ ChemicalLedger flowData = flows.get(i);
+ try {
+ HzHazmatFlow hazmatFlow = convertToHzHazmatFlow(flowData);
+ HzHazmatBasic hzHazmatBasic = hazmatBasicMapper.selectByCas(flowData.getCas());
+ hazmatFlow.setBasicId(hzHazmatBasic.getId());
+ if (hazmatFlow.getBasicId() == null) {
+ errorMessages.add(String.format("第%d条数据:cas号没有对应基础信息", i + 1));
+ failCount++;
+ continue;
+ }
+
+ if (hazmatFlow.getState() == null) {
+ errorMessages.add(String.format("第%d条数据:操作状态不能为空", i + 1));
+ failCount++;
+ continue;
+ }
+ HzHazmat hzHazmat = hazmatMapper.selectById(hazmatFlow.getHazmatId());
+ int count = hazmatMapper.selectHazmatCountOfWarehouse(hazmatFlow.getCabinetId(), hazmatFlow.getBasicId(),18L,hazmatFlow.getAuxiliaryCabinetId());
+ if (hazmatFlow.getState()==3){
+ if (hzHazmat.getState()==2||hzHazmat.getState()==3||hzHazmat.getState()==4){
+ errorMessages.add(String.format("第%d条数据:危化品状态异常,不能出库", i + 1));
+ }else {
+ hzHazmat.setState(HazmatStatusEnum.USING.getCode());
+ hzHazmat.setUpdateBy(hazmatFlow.getCreateBy());
+ HzWarehouseRecord warehouseRecord = new HzWarehouseRecord()
+ .setWarehouseId(hzHazmat.getWarehouseId())
+ .setBasicId(hzHazmat.getBasicId())
+ .setCupboardId(hzHazmat.getCupboardId())
+ .setCreateBy(hazmatFlow.getCreateBy())
+ .setNum(-1)
+ .setState(OperateStatusEnum.USING.getCode())
+ .setCompanyId(18L)
+ .setRemaining(count-1);
+ warehouseRecordMapper.insert(warehouseRecord);
+ }
+ hazmatMapper.updateById(hzHazmat);
+ }
+ if (hazmatFlow.getState()==4){
+ HzWarehouseRecord warehouseRecord = new HzWarehouseRecord()
+ .setWarehouseId(hzHazmat.getWarehouseId())
+ .setBasicId(hzHazmat.getBasicId())
+ .setCupboardId(hzHazmat.getCupboardId())
+ .setCreateBy(hazmatFlow.getCreateBy())
+ .setNum(-1)
+ .setState(OperateStatusEnum.DISCARD.getCode())
+ .setCompanyId(18L)
+ .setRemaining(count-1);
+ warehouseRecordMapper.insert(warehouseRecord);
+ hzHazmat.setUpdateBy(hazmatFlow.getCreateBy());
+ if (hazmatFlow.getReasonId()==0||hazmatFlow.getReasonId()==3){
+ hzHazmat.setState(HazmatStatusEnum.USED.getCode());
+ }else {
+ hzHazmat.setState(HazmatStatusEnum.DISCARD.getCode());
+ }
+ hazmatMapper.updateById(hzHazmat);
+ }
+ if (hazmatFlow.getState()==2&&hzHazmat.getState()==HazmatStatusEnum.USING.getCode()){
+ HzWarehouseRecord warehouseRecord = new HzWarehouseRecord()
+ .setWarehouseId(hzHazmat.getWarehouseId())
+ .setBasicId(hzHazmat.getBasicId())
+ .setCupboardId(hzHazmat.getCupboardId())
+ .setCreateBy(hazmatFlow.getCreateBy())
+ .setNum(1)
+ .setState(OperateStatusEnum.RETURN.getCode())
+ .setCompanyId(18L)
+ .setRemaining(count+1);
+ warehouseRecordMapper.insert(warehouseRecord);
+ hzHazmat.setUpdateBy(hazmatFlow.getCreateBy());
+ hzHazmat.setState(HazmatStatusEnum.USEWAREHOUSEIN.getCode());
+ hazmatMapper.updateById(hzHazmat);
+ }else{
+ errorMessages.add(String.format("第%d条数据:危化品状态异常,不能回库", i + 1));
+ }
+
+// if (hazmatFlow.getNum() == null || hazmatFlow.getNum().compareTo(BigDecimal.ZERO) <= 0) {
+// errorMessages.add(String.format("第%d条数据:数量必须大于0", i + 1));
+// failCount++;
+// continue;
+// }
+
+ hazmatFlowList.add(hazmatFlow);
+ successCount++;
+
+ } catch (Exception e) {
+ errorMessages.add(String.format("第%d条数据处理失败:%s", i + 1, e.getMessage()));
+ failCount++;
+ }
+ }
+
+ if (!hazmatFlowList.isEmpty()) {
+ boolean saveResult = this.saveBatch(hazmatFlowList, 50);
+ if (!saveResult) {
+ return CommonResult.failed("批量保存流向数据失败");
+ }
+ }
+
+
+
+ Map<String, Object> resultData = new HashMap<>();
+ resultData.put("totalCount", flows.size());
+ resultData.put("successCount", successCount);
+ resultData.put("failCount", failCount);
+ if (!errorMessages.isEmpty()) {
+ resultData.put("errorMessages", errorMessages);
+ }
+
+ if (failCount > 0) {
+ return CommonResult.success(resultData, "批量推送完成,部分数据失败");
+ }
+
+ return CommonResult.success(resultData, "批量推送成功");
+ }
+
+ private HzHazmatFlow convertToHzHazmatFlow(ChemicalLedger flowData) {
+ HzHazmatFlow hazmatFlow = new HzHazmatFlow();
+ hazmatFlow.setUuid(flowData.getId());
+ hazmatFlow.setHazmatId(flowData.getHazmatId());
+// hazmatFlow.setBasicId(flowData.getBasicId());
+ hazmatFlow.setState(flowData.getStorageType());
+ hazmatFlow.setNum(BigDecimal.valueOf(flowData.getNum()));
+ hazmatFlow.setCompanyId(18L);
+// hazmatFlow.setCreateId(flowData.getCreateId());
+ hazmatFlow.setCabinetId(Long.valueOf(flowData.getCabinetId()));
+ hazmatFlow.setCabinetName(flowData.getCabinetName());
+ hazmatFlow.setAuxiliaryCabinetId(Long.valueOf(flowData.getAuxiliaryCabinetId()));
+ hazmatFlow.setAuxiliaryCabinetName(flowData.getAuxiliaryCabinetName());
+ hazmatFlow.setOwner(flowData.getOwner());
+ hazmatFlow.setChemicalType(flowData.getChemicalType());
+ hazmatFlow.setContainerNo(flowData.getContainerNo());
+ hazmatFlow.setContainerUse(flowData.getContainerUse());
+ hazmatFlow.setControlType(flowData.getControlType());
+ hazmatFlow.setCreateBy(flowData.getCreateUserName());
+ hazmatFlow.setUNameOne(flowData.getUNameOne());
+ hazmatFlow.setFacelmgUrl(flowData.getFaceImgUrl());
+ hazmatFlow.setUNameTwo(flowData.getUNameTwo());
+ hazmatFlow.setFacelmgUrlTwo(flowData.getFaceImgUrlTwo());
+ hazmatFlow.setHazchemType(flowData.getHazchemType());
+ hazmatFlow.setOperate(flowData.getOperate());
+ hazmatFlow.setOrgName(flowData.getOrgName());
+ hazmatFlow.setReason(flowData.getReason());
+ hazmatFlow.setReasonId(flowData.getReasonId());
+ hazmatFlow.setRegulatory(flowData.getRegulatory());
+ hazmatFlow.setRoomName(flowData.getRoomName());
+ hazmatFlow.setSchoolName(flowData.getSchoolName());
+ hazmatFlow.setUsername(flowData.getUsername());
+ hazmatFlow.setWeight(flowData.getWeight());
+ hazmatFlow.setWeightUnit(flowData.getWeightUnit());
+ hazmatFlow.setConsumption(flowData.getConsumption());
+ if (flowData.getCreateTime() != null) {
+ hazmatFlow.setCreateTime(flowData.getCreateTime());
+ }
+ return hazmatFlow;
+ }
+
+
public void checkUserAllowed(HzHazmatFlow hazmatFlow,SysUser user) {
if (user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
throw new ApiException("管理员不能操作");
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatServiceImpl.java
index c654ce0..d248bfb 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatServiceImpl.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatServiceImpl.java
@@ -7,6 +7,7 @@
import com.github.pagehelper.PageHelper;
import com.gkhy.hazmat.common.api.CommonPage;
//import com.gkhy.hazmat.common.config.IdTableNameHandler;
+import com.gkhy.hazmat.common.api.CommonResult;
import com.gkhy.hazmat.common.domain.entity.SysUser;
import com.gkhy.hazmat.common.enums.CodePrexEnum;
import com.gkhy.hazmat.common.enums.HazmatStatusEnum;
@@ -16,6 +17,8 @@
import com.gkhy.hazmat.common.utils.PageUtils;
import com.gkhy.hazmat.common.utils.SecurityUtils;
import com.gkhy.hazmat.system.domain.*;
+import com.gkhy.hazmat.system.domain.dto.HazmatDto;
+import com.gkhy.hazmat.system.domain.vo.HzHazmatOrder;
import com.gkhy.hazmat.system.domain.vo.HzHazmatWarehouseVO;
import com.gkhy.hazmat.system.mapper.*;
import com.gkhy.hazmat.system.service.HzHazmatService;
@@ -24,10 +27,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -49,6 +49,15 @@
private HzHazmatBasicMapper hazmatBasicMapper;
@Autowired
private HzWarehouseMapper warehouseMapper;
+
+ @Autowired
+ private SubscribeMapper subscribeMapper;
+
+ @Autowired
+ private HzEntryRecordMapper hzEntryRecordMapper;
+
+ @Autowired
+ private SysUserMapper sysUserMapper;
@Override
@@ -327,6 +336,7 @@
hazmatFlow.setState(OperateStatusEnum.DISCARD.getCode());
hazmatFlow.setCompanyId(currentUser.getCompanyId());
hazmatFlow.setNum(hazmat.getRemaining().multiply(BigDecimal.valueOf(-1)));
+ hazmatFlow.setConsumption(hazmat.getRemaining());
hazmatFlow.setCreateId(currentUser.getId());
hazmatFlowMapper.insert(hazmatFlow);
@@ -396,6 +406,38 @@
// IdTableNameHandler.removeCurrentId();
}
+ @Override
+ public List<HzHazmatOrder> selectByWarehouseAndCupboard(HazmatDto hazmatDto) {
+// if (hazmatDto.getCabinetId() == null || hazmatDto.getAuxiliaryCabinetId() == null) {
+// throw new ApiException("仓库id和存储柜id不能为空");
+// }
+ List<HzHazmatOrder> orders = new ArrayList<>();
+
+ List<HzHazmat> hzHazmats = baseMapper.selectByWarehouseAndCupboard(hazmatDto);
+ for (HzHazmat hzHazmat : hzHazmats) {
+ HzHazmatOrder hzHazmatOrder = new HzHazmatOrder();
+ HzEntryRecord hzEntryRecord = hzEntryRecordMapper.selectById(hzHazmat.getEntryId());
+ Subscribe subscribes = subscribeMapper.selectBySubscribeNum(hzEntryRecord.getSubscribeNum());
+ HzHazmatBasic hzHazmatBasic = hazmatBasicMapper.selectById(hzHazmat.getBasicId());
+ SysUser sysuer = sysUserMapper.getUserById(subscribes.getSubscribePersonId());
+ hzHazmatOrder.setHzhazmatId(hzHazmat.getId());
+ hzHazmatOrder.setCabinetId(hazmatDto.getCabinetId());
+ hzHazmatOrder.setAuxiliaryCabinetId(hazmatDto.getAuxiliaryCabinetId());
+ hzHazmatOrder.setSubscribeNum(subscribes.getSubscribeNum());
+ hzHazmatOrder.setCas(hzHazmatBasic.getCas());
+ hzHazmatOrder.setStandard(hzHazmatBasic.getHazmatFormat());
+ hzHazmatOrder.setRemaining(hzHazmat.getRemaining());
+ hzHazmatOrder.setProductSn(hzHazmatBasic.getProductSn());
+ hzHazmatOrder.setSubscribePersonName(subscribes.getSubscribePersonName());
+ hzHazmatOrder.setOfDept(sysuer.getDepartName());
+ orders.add(hzHazmatOrder);
+
+ }
+
+
+ return orders;
+ }
+
public void checkUserAllowed(HzHazmat hazmat,SysUser user) {
if (user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
throw new ApiException("管理员不能操作");
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java
index 6d2360c..7082d3b 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java
@@ -10,7 +10,9 @@
import com.gkhy.hazmat.common.utils.SecurityUtils;
import com.gkhy.hazmat.system.domain.HzWarehouse;
import com.gkhy.hazmat.system.domain.HzWarehouseCupboard;
+import com.gkhy.hazmat.system.domain.vo.HzWarehouseCupZkd;
import com.gkhy.hazmat.system.domain.vo.HzWarehouseVo;
+import com.gkhy.hazmat.system.domain.vo.HzWarehouseZkd;
import com.gkhy.hazmat.system.mapper.HzWarehouseMapper;
import com.gkhy.hazmat.system.service.HzWarehouseService;
import org.springframework.beans.BeanUtils;
@@ -198,4 +200,28 @@
public List<HzWarehouseCupboard> selectByWarehouseId(Long warehouseId) {
return baseMapper.selectByWarehouseId(warehouseId);
}
+
+ @Override
+ public List<HzWarehouseZkd> selectzkdWarehouseList(HzWarehouse warehouse) {
+ warehouse.setCompanyId(18L);
+ List<HzWarehouseZkd> hzWarehouseVos = new ArrayList<>();
+ List<HzWarehouse> warehouseList=baseMapper.selectWarehouseList(warehouse);
+ for (HzWarehouse hzWarehouseVo : warehouseList) {
+ HzWarehouseZkd hzWarehouseVo1 = new HzWarehouseZkd();
+ hzWarehouseVo1.setCabinetId(hzWarehouseVo.getId());
+ hzWarehouseVo1.setCabinetName(hzWarehouseVo.getName());
+ List<HzWarehouseCupboard> hzWarehouseCupboards = baseMapper.selectByWarehouseId(hzWarehouseVo.getId());
+
+ List<HzWarehouseCupZkd> arrayList = new ArrayList<>();
+ for (HzWarehouseCupboard hzWarehouseCupboard : hzWarehouseCupboards) {
+ HzWarehouseCupZkd hzWarehouseCupZkd = new HzWarehouseCupZkd();
+ hzWarehouseCupZkd.setAuxiliaryCabinetId(hzWarehouseCupboard.getId());
+ hzWarehouseCupZkd.setAuxiliaryCabinetName(hzWarehouseCupboard.getCupboardName());
+ arrayList.add(hzWarehouseCupZkd);
+ }
+ hzWarehouseVo1.setWarehouseCupZkds(arrayList);
+ hzWarehouseVos.add(hzWarehouseVo1);
+ }
+ return hzWarehouseVos;
+ }
}
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SubscribeServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SubscribeServiceImpl.java
new file mode 100644
index 0000000..c179ecc
--- /dev/null
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SubscribeServiceImpl.java
@@ -0,0 +1,257 @@
+
+package com.gkhy.hazmat.system.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gkhy.hazmat.common.api.CommonPage;
+import com.gkhy.hazmat.common.exception.ApiException;
+import com.gkhy.hazmat.common.utils.PageUtils;
+import com.gkhy.hazmat.common.utils.SecurityUtils;
+import com.gkhy.hazmat.system.domain.HzHazmatBasic;
+import com.gkhy.hazmat.system.domain.Subscribe;
+import com.gkhy.hazmat.system.domain.SubscribeHazmat;
+import com.gkhy.hazmat.system.mapper.HzHazmatBasicMapper;
+import com.gkhy.hazmat.system.mapper.SubscribeHazmatMapper;
+import com.gkhy.hazmat.system.mapper.SubscribeMapper;
+import com.gkhy.hazmat.system.service.SubscribeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+@Service
+public class SubscribeServiceImpl extends ServiceImpl<SubscribeMapper, Subscribe> implements SubscribeService {
+
+ @Resource
+ private SubscribeMapper subscribeMapper;
+
+ @Autowired
+ private SubscribeHazmatMapper subscribeHazmatMapper;
+
+ @Autowired
+ private HzHazmatBasicMapper hazmatBasicMapper;
+ @Override
+ public CommonPage<Subscribe> selectSubscribeList(Subscribe subscribe) {
+ Integer currentUserId = SecurityUtils.getLoginUser().getUser().getUserType();
+ boolean isAdmin = SecurityUtils.isSystemUser(currentUserId);
+
+ if (!isAdmin) {
+ if (subscribe.getSubscribePersonId() == null) {
+ subscribe.setSubscribePersonId(SecurityUtils.getUserId());
+ } else {
+ if (!subscribe.getSubscribePersonId().equals(SecurityUtils.getUserId())) {
+ throw new ApiException("无权限查看其他用户的申购单");
+ }
+ }
+ }
+
+ PageUtils.startPage();
+ List<Subscribe> subscribeList = subscribeMapper.selectSubscribeList(subscribe);
+ for (Subscribe subscribe1 : subscribeList) {
+ LambdaQueryWrapper<SubscribeHazmat> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(SubscribeHazmat::getSubscribeId, subscribe1.getId());
+ List<SubscribeHazmat> hazmatList = subscribeHazmatMapper.selectList(wrapper);
+ subscribe1.setSubscribeHazmats(hazmatList);
+ }
+ return CommonPage.restPage(subscribeList);
+ }
+
+ @Override
+ public Subscribe selectSubscribeById(Long subscribeId) {
+ Subscribe subscribe = subscribeMapper.selectSubscribeById(subscribeId);
+ if (subscribe == null) {
+ throw new ApiException("申购单不存在");
+ }
+
+ Integer currentUserId = SecurityUtils.getLoginUser().getUser().getUserType();
+ boolean isAdmin = SecurityUtils.isSystemUser(currentUserId);
+
+ if (!isAdmin && !subscribe.getSubscribePersonId().equals(SecurityUtils.getUserId())
+ && !SecurityUtils.getUserId().equals(subscribe.getCheckId())) {
+ throw new ApiException("无权限查看该申购单");
+ }
+
+ LambdaQueryWrapper<SubscribeHazmat> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(SubscribeHazmat::getSubscribeId, subscribeId);
+ List<SubscribeHazmat> hazmatList = subscribeHazmatMapper.selectList(wrapper);
+ subscribe.setSubscribeHazmats(hazmatList);
+
+ return subscribe;
+ }
+
+ @Override
+ @Transactional(rollbackFor = RuntimeException.class)
+ public int insertSubscribe(Subscribe subscribe) {
+ Long currentUserId = SecurityUtils.getUserId();
+ String currentUserName = SecurityUtils.getLoginUser().getUser().getName();
+
+ subscribe.setSubscribePersonId(currentUserId);
+ subscribe.setSubscribePersonName(currentUserName);
+ subscribe.setCreateBy(currentUserName);
+ subscribe.setCreateTime(LocalDateTime.now());
+ subscribe.setSubscribeNum(generateSubscribeNum());
+ int row = subscribeMapper.insertSubscribe(subscribe);
+ if (row < 1) {
+ throw new ApiException("新增申购单失败");
+ }
+
+ if (subscribe.getSubscribeHazmats() != null && !subscribe.getSubscribeHazmats().isEmpty()) {
+ for (SubscribeHazmat hazmat : subscribe.getSubscribeHazmats()) {
+ HzHazmatBasic hazmatBasic=hazmatBasicMapper.selectById(hazmat.getBasicId());
+ if(hazmat.getHazmatCount()>hazmatBasic.getMaxEntry()){
+ throw new ApiException(hazmatBasic.getName()+"数量超过单次入库最大数量<"+hazmatBasic.getMaxEntry()+">");
+ }
+ hazmat.setSubscribeId(subscribe.getId());
+ hazmat.setDelFlag(0);
+ subscribeHazmatMapper.insert(hazmat);
+ }
+ }
+
+ return row;
+ }
+
+
+ private String generateSubscribeNum() {
+ LocalDateTime now = LocalDateTime.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+ return now.format(formatter);
+ }
+
+ @Override
+ @Transactional(rollbackFor = RuntimeException.class)
+ public int updateSubscribe(Subscribe subscribe) {
+ Subscribe existSubscribe = subscribeMapper.selectById(subscribe.getId());
+ if (existSubscribe == null) {
+ throw new ApiException("申购单不存在");
+ }
+
+ if (existSubscribe.getStatus() != 0) {
+ throw new ApiException("只能修改待审核状态的申购单");
+ }
+
+ Long currentUserId = SecurityUtils.getUserId();
+ boolean isAdmin = SecurityUtils.isAdmin(currentUserId);
+
+ if (!isAdmin && !existSubscribe.getSubscribePersonId().equals(currentUserId)) {
+ throw new ApiException("无权限修改该申购单");
+ }
+
+ subscribe.setUpdateBy(SecurityUtils.getUsername());
+ subscribe.setUpdateTime(LocalDateTime.now());
+
+ int row = subscribeMapper.updateSubscribe(subscribe);
+ if (row < 1) {
+ throw new ApiException("更新申购单失败");
+ }
+
+ if (subscribe.getSubscribeHazmats() != null) {
+ LambdaQueryWrapper<SubscribeHazmat> deleteWrapper = new LambdaQueryWrapper<>();
+ deleteWrapper.eq(SubscribeHazmat::getSubscribeId, subscribe.getId());
+ subscribeHazmatMapper.delete(deleteWrapper);
+
+ for (SubscribeHazmat hazmat : subscribe.getSubscribeHazmats()) {
+ hazmat.setSubscribeId(subscribe.getId());
+ hazmat.setDelFlag(0);
+ subscribeHazmatMapper.insert(hazmat);
+ }
+ }
+
+ return row;
+ }
+
+ @Override
+ @Transactional(rollbackFor = RuntimeException.class)
+ public int deleteSubscribeById(Long subscribeId) {
+ Subscribe subscribe = subscribeMapper.selectSubscribeById(subscribeId);
+ if (subscribe == null) {
+ throw new ApiException("申购单不存在");
+ }
+
+ if (subscribe.getStatus() != 0) {
+ throw new ApiException("只能删除待审核状态的申购单");
+ }
+
+ Long currentUserId = SecurityUtils.getUserId();
+ boolean isAdmin = SecurityUtils.isAdmin(currentUserId);
+
+ if (!isAdmin && !subscribe.getSubscribePersonId().equals(currentUserId)) {
+ throw new ApiException("无权限删除该申购单");
+ }
+
+ LambdaQueryWrapper<SubscribeHazmat> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(SubscribeHazmat::getSubscribeId, subscribeId);
+ SubscribeHazmat updateHazmat = new SubscribeHazmat();
+ updateHazmat.setDelFlag(1);
+ subscribeHazmatMapper.update(updateHazmat, wrapper);
+
+ subscribe.setDelFlag(1);
+ subscribe.setUpdateBy(SecurityUtils.getUsername());
+ subscribe.setUpdateTime(LocalDateTime.now());
+
+ return subscribeMapper.updateSubscribe(subscribe);
+ }
+
+ @Override
+ @Transactional(rollbackFor = RuntimeException.class)
+ public void auditSubscribe(Long subscribeId, Integer status,String opinion) {
+ if (status == null || (status != 1 && status != 2)) {
+ throw new ApiException("审核状态不正确,1为通过,2为驳回");
+ }
+ if (status == 2 && opinion == null) {
+ throw new ApiException("通过审核时,请填写审核意见");
+ }
+
+ Subscribe subscribe = subscribeMapper.selectSubscribeById(subscribeId);
+ if (subscribe == null) {
+ throw new ApiException("申购单不存在");
+ }
+
+ if (subscribe.getStatus() != 0) {
+ throw new ApiException("该申购单已审核,不能重复审核");
+ }
+
+ Long currentUserId = SecurityUtils.getUserId();
+ if (subscribe.getCheckId() != null && !currentUserId.equals(subscribe.getCheckId())) {
+ throw new ApiException("非审批人不可审批");
+ }
+
+ String currentUserName = SecurityUtils.getUsername();
+
+ subscribe.setStatus(status);
+ subscribe.setOpinion(opinion);
+ subscribe.setUpdateBy(currentUserName);
+ subscribe.setUpdateTime(LocalDateTime.now());
+
+ int row = subscribeMapper.updateSubscribe(subscribe);
+ if (row < 1) {
+ throw new ApiException("审核操作失败");
+ }
+ }
+
+ @Override
+ public CommonPage<Subscribe> selectAuditList(Subscribe subscribe) {
+ Long currentUserId = SecurityUtils.getUserId();
+ boolean isAdmin = SecurityUtils.isAdmin(currentUserId);
+
+ if (!isAdmin) {
+ subscribe.setCheckId(currentUserId);
+ }
+
+ PageUtils.startPage();
+ List<Subscribe> subscribeList = subscribeMapper.selectSubscribeList(subscribe);
+
+ for (Subscribe subscribe1 : subscribeList) {
+ LambdaQueryWrapper<SubscribeHazmat> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(SubscribeHazmat::getSubscribeId, subscribe1.getId());
+ wrapper.eq(SubscribeHazmat::getDelFlag, 0);
+ List<SubscribeHazmat> hazmatList = subscribeHazmatMapper.selectList(wrapper);
+ subscribe1.setSubscribeHazmats(hazmatList);
+ }
+
+ return CommonPage.restPage(subscribeList);
+ }
+}
\ No newline at end of file
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysUserServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysUserServiceImpl.java
index 2d23246..f70fbc9 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysUserServiceImpl.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysUserServiceImpl.java
@@ -48,6 +48,8 @@
@Autowired
private SysUserRoleMapper roleMapper;
+
+
@Override
public CommonPage<SysUser> selectUserList(SysUser user) {
SysUser currentUser= SecurityUtils.getLoginUser().getUser();
@@ -114,6 +116,10 @@
user.setCreateBy(SecurityUtils.getUsername());
user.setPassword(SecurityUtils.encryptPassword(Base64.decodeStr(user.getPassword())));
int row=baseMapper.insert(user);
+ SysUserRole ur = new SysUserRole();
+ ur.setUserId(user.getId());
+ ur.setRoleId(100L);
+ roleMapper.insert(ur);
if(row<1){
throw new ApiException("新增用户失败");
}
diff --git a/hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml
index 0d70094..1dd621e 100644
--- a/hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml
+++ b/hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml
@@ -19,6 +19,7 @@
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
+ <result property="subscribeNum" column="subscribe_num" />
<association property="warehouse" javaType="com.gkhy.hazmat.system.domain.HzWarehouse" resultMap="wareResult" />
<association property="hazmatBasic" javaType="com.gkhy.hazmat.system.domain.HzHazmatBasic" resultMap="hazmatBasicResult" />
<association property="cupboard" javaType="com.gkhy.hazmat.system.domain.HzWarehouseCupboard" resultMap="cupboardResult"/>
@@ -54,7 +55,7 @@
<sql id="selectEntryRecordVo">
select a.id, a.warehouse_id,a.cupboard_id, a.num,a.batch_no,a.state,a.basic_id,a.company_id,a.start_code,a.end_code,a.code_prex,a.version, a.create_by,
- a.create_time, a.update_by, a.update_time, a.remark,
+ a.create_time, a.update_by, a.update_time, a.remark,a.subscribe_num,
b.id as basic_idd,b.name as basic_name,b.cas as basic_cas,b.hazmat_type as basic_hazmat_type,b.hazmat_character as basic_hazmat_character,
b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,b.product_sn,b.min_package as basic_min_package,b.max_entry,
c.id as warehouse_id,c.name as warehouse_name,d.id as cupboard_id,d.cupboard_name
@@ -67,6 +68,9 @@
parameterType="com.gkhy.hazmat.system.domain.HzEntryRecord">
<include refid="selectEntryRecordVo"/>
<where>
+ <if test="type != null">
+ and a.type = #{type}
+ </if>
<if test="params.name != null and params.name != ''">
AND b.name like concat('%', #{params.name}, '%')
</if>
@@ -79,11 +83,14 @@
<if test="state != null">
AND a.state= #{state}
</if>
- <if test="params.warehouseId !=null">
- and a.warehouse_id = #{params.warehouseId}
+ <if test="warehouseId !=null">
+ and a.warehouse_id = #{warehouseId}
</if>
- <if test="params.cupboardId !=null">
- and a.cupboard_id = #{params.cupboardId}
+ <if test="cupboardId !=null">
+ and a.cupboard_id = #{cupboardId}
+ </if>
+ <if test="subscribeNum != null">
+ and a.subscribe_num = #{subscribeNum}
</if>
</where>
order by a.id desc
diff --git a/hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml
index bfb143a..72159f1 100644
--- a/hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml
+++ b/hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml
@@ -110,4 +110,7 @@
SUM(FIND_IN_SET('非易燃品', hazmat_character) > 0) AS count
FROM hz_hazmat_basic WHERE del_flag =0
</select>
+ <select id="selectByCas" resultType="com.gkhy.hazmat.system.domain.HzHazmatBasic">
+ select * from hz_hazmat_basic where del_flag=0 and `cas`=#{cas}
+ </select>
</mapper>
diff --git a/hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml
index 03ddf27..bbed529 100644
--- a/hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml
+++ b/hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml
@@ -245,6 +245,30 @@
AND company_id = #{companyId}
</if>
</select>
+ <select id="selectByWarehouseAndCupboard" resultType="com.gkhy.hazmat.system.domain.HzHazmat">
+ select a.id,a.entry_id, a.basic_id, a.warehouse_id, a.code,a.remaining, a.state,a.company_id,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
+ b.id as basic_id,b.name as basic_name,b.cas as basic_cas,b.hazmat_type as basic_hazmat_type,b.hazmat_character as basic_hazmat_character,
+ b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,
+ b.product_sn,b.min_package as basic_min_package,c.name as warehouse_name,d.cupboard_name as cupboard_name
+ from hz_hazmat a
+ left join hz_hazmat_basic b on b.id=a.basic_id
+ left join hz_warehouse c on c.id=a.warehouse_id
+ left join hz_warehouse_cupboard d on d.id=a.cupboard_id
+ <where>
+ and a.del_flag=0 and a.state in (0,1)
+ <if test="cabinetId !=null">
+ and a.warehouse_id=#{cabinetId}
+ </if>
+ <if test="auxiliaryCabinetId!=null">
+ and a.cupboard_id=#{auxiliaryCabinetId}
+ </if>
+ <if test="time!=null">
+ and a.create_time >= #{time}
+ </if>
+
+ </where>
+ order by a.id desc
+ </select>
<!-- SELECT COUNT(*) AS count, DATE_FORMAT(create_time, '%H') AS hour-->
<!-- FROM hz_hazmat-->
<!-- WHERE create_time >= #{startDate} AND create_time < #{endDate}-->
diff --git a/hazmat-system/src/main/resources/mapper/system/SubscribeHazmatMapper.xml b/hazmat-system/src/main/resources/mapper/system/SubscribeHazmatMapper.xml
new file mode 100644
index 0000000..9e41914
--- /dev/null
+++ b/hazmat-system/src/main/resources/mapper/system/SubscribeHazmatMapper.xml
@@ -0,0 +1,9 @@
+<?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.gkhy.hazmat.system.mapper.SubscribeHazmatMapper">
+
+
+ <select id="selectbySubscribeId" resultType="com.gkhy.hazmat.system.domain.SubscribeHazmat">
+ select * from subscribe_hazmat where subscribe_id = #{subscribeId}
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/hazmat-system/src/main/resources/mapper/system/SubscribeMapper.xml b/hazmat-system/src/main/resources/mapper/system/SubscribeMapper.xml
new file mode 100644
index 0000000..ed796a1
--- /dev/null
+++ b/hazmat-system/src/main/resources/mapper/system/SubscribeMapper.xml
@@ -0,0 +1,123 @@
+<?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.gkhy.hazmat.system.mapper.SubscribeMapper">
+
+ <resultMap type="com.gkhy.hazmat.system.domain.Subscribe" id="SubscribeResult">
+ <result property="id" column="id" />
+ <result property="subscribeNum" column="subscribe_num" />
+ <result property="subscribePersonId" column="subscribe_person_id" />
+ <result property="subscribePersonName" column="subscribe_person_name" />
+ <result property="checkId" column="check_id" />
+ <result property="checkName" column="check_name" />
+ <result property="opinion" column="opinion" />
+ <result property="filePath" column="file_path" />
+ <result property="fileName" column="file_name" />
+ <result property="status" column="status" />
+ <result property="delFlag" column="del_flag" />
+ <result property="createBy" column="create_by" />
+ <result property="createTime" column="create_time" />
+ <result property="updateBy" column="update_by" />
+ <result property="updateTime" column="update_time" />
+ </resultMap>
+
+ <sql id="selectSubscribeVo">
+ select id, subscribe_num, subscribe_person_id, subscribe_person_name,
+ check_id, check_name,opinion, file_path, file_name, status, del_flag,
+ create_by, create_time, update_by, update_time
+ from subscribe
+ </sql>
+
+ <select id="selectSubscribeList" resultMap="SubscribeResult">
+ <include refid="selectSubscribeVo"/>
+ <where>
+ and del_flag = 0
+ <if test="subscribePersonId != null">
+ AND subscribe_person_id = #{subscribePersonId}
+ </if>
+ <if test="checkId != null">
+ AND check_id = #{checkId}
+ </if>
+ <if test="status != null">
+ AND status = #{status}
+ </if>
+ </where>
+ order by create_time desc
+ </select>
+
+ <select id="selectSubscribeById" resultMap="SubscribeResult">
+ <include refid="selectSubscribeVo"/>
+ where id = #{subscribeId} and del_flag = 0
+ </select>
+ <select id="selectBySubscribeNum" resultType="com.gkhy.hazmat.system.domain.Subscribe">
+ select id, subscribe_num, subscribe_person_id, subscribe_person_name,
+ check_id, check_name,opinion, file_path, file_name, status, del_flag,
+ create_by, create_time, update_by, update_time
+ from subscribe
+ where subscribe_num = #{subscribeNum} and del_flag = 0
+ </select>
+ <select id="selectbyNum" resultType="com.gkhy.hazmat.system.domain.Subscribe">
+ select id, subscribe_num, subscribe_person_id, subscribe_person_name,
+ check_id, check_name,opinion, file_path, file_name, status, del_flag,
+ create_by, create_time, update_by, update_time
+ from subscribe
+ where subscribe_num = #{subscribeNum} and del_flag = 0
+ </select>
+
+ <insert id="insertSubscribe" parameterType="com.gkhy.hazmat.system.domain.Subscribe" useGeneratedKeys="true" keyProperty="id">
+ insert into subscribe
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="subscribeNum != null">subscribe_num,</if>
+ <if test="subscribePersonId != null">subscribe_person_id,</if>
+ <if test="subscribePersonName != null">subscribe_person_name,</if>
+ <if test="checkId != null">check_id,</if>
+ <if test="checkName != null">check_name,</if>
+ <if test="filePath != null">file_path,</if>
+ <if test="fileName != null">file_name,</if>
+ <if test="status != null">status,</if>
+ <if test="delFlag != null">del_flag,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="updateBy != null">update_by,</if>
+ <if test="updateTime != null">update_time,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="subscribeNum != null">#{subscribeNum},</if>
+ <if test="subscribePersonId != null">#{subscribePersonId},</if>
+ <if test="subscribePersonName != null">#{subscribePersonName},</if>
+ <if test="checkId != null">#{checkId},</if>
+ <if test="checkName != null">#{checkName},</if>
+ <if test="filePath != null">#{filePath},</if>
+ <if test="fileName != null">#{fileName},</if>
+ <if test="status != null">#{status},</if>
+ <if test="delFlag != null">#{delFlag},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="updateBy != null">#{updateBy},</if>
+ <if test="updateTime != null">#{updateTime},</if>
+ </trim>
+ </insert>
+
+ <update id="updateSubscribe" parameterType="com.gkhy.hazmat.system.domain.Subscribe">
+ update subscribe
+ <set>
+ <if test="subscribeNum != null">subscribe_num = #{subscribeNum},</if>
+ <if test="subscribePersonId != null">subscribe_person_id = #{subscribePersonId},</if>
+ <if test="subscribePersonName != null">subscribe_person_name = #{subscribePersonName},</if>
+ <if test="checkId != null">check_id = #{checkId},</if>
+ <if test="checkName != null">check_name = #{checkName},</if>
+ <if test="filePath != null">file_path = #{filePath},</if>
+ <if test="fileName != null">file_name = #{fileName},</if>
+ <if test="status != null">status = #{status},</if>
+ <if test="opinion != null">opinion = #{opinion},</if>
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ </set>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteSubscribeById">
+ update subscribe set del_flag = 1 where id = #{subscribeId}
+ </delete>
+
+</mapper>
\ No newline at end of file
diff --git a/hazmat-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/hazmat-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
index 51476e5..fe04897 100644
--- a/hazmat-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
+++ b/hazmat-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
@@ -30,8 +30,11 @@
(#{item.userId},#{item.roleId})
</foreach>
</insert>
-
- <delete id="deleteUserRoleInfo" parameterType="com.gkhy.hazmat.system.domain.SysUserRole">
+ <insert id="insert">
+ insert into sys_user_role(user_id, role_id) value (#{userId},#{roleId})
+ </insert>
+
+ <delete id="deleteUserRoleInfo" parameterType="com.gkhy.hazmat.system.domain.SysUserRole">
delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
</delete>
--
Gitblit v1.9.2