diff --git a/doc/api.md b/doc/api.md index ba43514..95f5d64 100644 --- a/doc/api.md +++ b/doc/api.md @@ -91,107 +91,89 @@ |参数名称|参数类型|允许为空|参数说明| | ---- | ---- | ---- | ---- | -|serverWindowId| long | N | 窗口ID | +|swId| long | N | 服务窗口ID | - 返回示例 ```json { - "code": 200, - "success": true, - "data": [ - { - "id": "1666700063321280514", - "tenantId": "000000", - "parentId": "1666626082400526337", - "code": "dispute_type", - "dictKey": "401", - "dictValue": "其他事项", - "sort": 401, - "remark": "", - "isSealed": 0, - "isDeleted": 0 - }, - { - "id": "1666626705640546306", - "tenantId": "000000", - "parentId": "1666625859938836481", - "code": "dispute_type", - "dictKey": "101", - "dictValue": "婚恋家庭纠纷", - "sort": 1, - "remark": "", - "isSealed": 0, - "isDeleted": 0 - } - ], - "msg": "操作成功" + "code": 200, + "success": true, + "data": [ + { + "swId": "1666702666826436610", + "swName": "市卫健局", + "disputeIds": "1666699928344383490,1666629875083141122,1666697888226529282,1666697948918108162", + "disputeNames": "残疾人权益保障,劳动、社保纠纷,房产物业纠纷,涉法涉诉纠纷", + "status": 1 + } + ], + "msg": "操作成功" } ``` -### 2. 禁用/启用 +### 2. 获取根据id获取详情 - 请求地址 -`POST` `/blade-business/serverDisputeConf/enable` +`GET` `/blade-business/serverDisputeConf/detail` - 请求参数 |参数名称|参数类型|允许为空|参数说明| | ---- | ---- | ---- | ---- | -| id | long | N | 关联记录ID | +|swId| long | N | 服务窗口ID | - 返回示例 ```json { - "code": 200, - "success": true, - "data": "", - "msg": "操作成功" + "code": 200, + "success": true, + "data": { + "swId": "1666702666826436610", + "swName": "市卫健局", + "disputeIds": "1666699928344383490,1666629875083141122,1666697888226529282,1666697948918108162", + "disputeNames": "残疾人权益保障,劳动、社保纠纷,房产物业纠纷,涉法涉诉纠纷", + "status": 1 + }, + "msg": "操作成功" } ``` -### 3. 删除 +### 3. 禁用/启用 - 请求地址 -`POST` `/blade-business/serverDisputeConf/delete` +`POST` `/blade-business/serverDisputeConf/enable` - 请求参数 |参数名称|参数类型|允许为空|参数说明| | ---- | ---- | ---- | ---- | -| id | long | N | 关联记录ID | +|swId| long | N | 服务窗口ID | - 返回示例 ```json { - "code": 200, - "success": true, - "data": "", - "msg": "操作成功" + "code": 200, + "success": true, + "data": {}, + "msg": "操作成功" } ``` -### 4. 获取根据id获取详情 +### 4. 删除 - 请求地址 -`GET` `/blade-business/serverDisputeConf/detail` +`POST` `/blade-business/serverDisputeConf/delete` - 请求参数 |参数名称|参数类型|允许为空|参数说明| | ---- | ---- | ---- | ---- | -| id | long | N | 关联记录ID | +| swId | long | N | 服务窗口ID | - 返回示例 ```json { - "code": 200, - "success": true, - "data": { - "id": "1666625605998895105", - "serverWindowId": "1666625235998895105", - "serverWindowName": "市交通局", - "disputeIds": "1666625605998898705,1666625605998894105", - "disputeNames": "交通事故,道路纠纷", - "status": 1 - }, - "msg": "操作成功" + "code": 200, + "success": true, + "data": {}, + "msg": "操作成功" } ``` @@ -203,17 +185,26 @@ |参数名称|参数类型|允许为空|参数说明| | ---- | ---- | ---- | ---- | -| id | long | N | 关联记录ID | -| serverWindowId | long | N | 服务窗口ID | +| swId | long | N | 服务窗口ID | | disputeIds | string | N | 纠纷id, 多个以逗号分割 | +| status | int | N | 启用状态, 0:禁用, 1:启用 | + +- 请求示例 +```json +{ + "swId": "1646019847", + "disputeIds": "123321,12341,5345", + "status": "1" +} +``` - 返回示例 ```json { - "code": 200, - "success": true, - "data": "", - "msg": "操作成功" + "code": 200, + "success": true, + "data": {}, + "msg": "操作成功" } ``` diff --git a/doc/sql/mysql/business_increase.sql b/doc/sql/mysql/business_increase.sql index def16a6..06df5b4 100644 --- a/doc/sql/mysql/business_increase.sql +++ b/doc/sql/mysql/business_increase.sql @@ -1,2 +1,4 @@ alter table mp_appeal add column `source_type` int(4) default 0 COMMENT '数据来源 0:系统添加, 1:数据导入'; alter table mp_appeal add column `handle_dept` bigint COMMENT '数据录入时, 处理部门'; + +alter table mp_appeal_visitor add column `sort` int(10) COMMENT '排序'; diff --git a/src/main/java/org/springblade/common/constant/BusinessConstant.java b/src/main/java/org/springblade/common/constant/BusinessConstant.java new file mode 100644 index 0000000..048c6fe --- /dev/null +++ b/src/main/java/org/springblade/common/constant/BusinessConstant.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.common.constant; + +/** + * 通用常量 + * + * @author Chill + */ +public interface BusinessConstant { + + /** + * 启用禁用, 0:禁用, 1:启用 + */ + Integer ENABLE_CODE_ENABLE = 1; + Integer ENABLE_CODE_DISABLE = 0; + + +} diff --git a/src/main/java/org/springblade/modules/business/controller/AppealRegController.java b/src/main/java/org/springblade/modules/business/controller/AppealRegController.java index 2f9289e..fc20c74 100644 --- a/src/main/java/org/springblade/modules/business/controller/AppealRegController.java +++ b/src/main/java/org/springblade/modules/business/controller/AppealRegController.java @@ -22,8 +22,12 @@ import lombok.AllArgsConstructor; import org.springblade.common.constant.CommonConstant; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tenant.annotation.TenantDS; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springblade.core.tool.api.R; +import org.springblade.modules.business.entity.AppealReg; +import org.springblade.modules.business.entity.ServerWindowsDispute; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; /** * 控制器 @@ -38,5 +42,54 @@ import org.springframework.web.bind.annotation.RestController; @Api(value = "诉求登记管理", tags = "诉求登记管理接口") public class AppealRegController extends BladeController { + /** + * 列表 + * + * @param appealStatus 诉求状态 + * @param startTime 登记时间-开始 + * @param endTime 登记时间-结束 + * @param appealType 诉求类型 + * @param windowId 处理窗口ID + * @param username 代表姓名 + * @return + */ + @GetMapping("/list") + public R list(String appealStatus, String startTime, String endTime, String appealType, String windowId, String username) { + return null; + } + + /** + * 导出 + * + * @param appealStatus 诉求状态 + * @param startTime 登记时间-开始 + * @param endTime 登记时间-结束 + * @param appealType 诉求类型 + * @param windowId 处理窗口ID + * @param username 代表姓名 + * @return + */ + @GetMapping("/export") + public R export(String appealStatus, String startTime, String endTime, String appealType, String windowId, String username) { + return null; + } + + /** + * 根据id获取诉求信息, 上一次调解记录(点击"再次调解") + * + * @param appealId 诉求id + * @return + */ + @GetMapping("/getById") + public R getById(String appealId) { + return null; + } + /** + * 保存 + */ + @PostMapping("/save") + public R save(@RequestBody Map entity) { + return null; + } } diff --git a/src/main/java/org/springblade/modules/business/controller/ServerDisputeConfController.java b/src/main/java/org/springblade/modules/business/controller/ServerDisputeConfController.java index 45a898b..0b9b0fb 100644 --- a/src/main/java/org/springblade/modules/business/controller/ServerDisputeConfController.java +++ b/src/main/java/org/springblade/modules/business/controller/ServerDisputeConfController.java @@ -1,31 +1,17 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ package org.springblade.modules.business.controller; -import com.github.xiaoymin.knife4j.annotations.ApiSort; -import io.swagger.annotations.*; import lombok.AllArgsConstructor; import org.springblade.common.constant.CommonConstant; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tenant.annotation.TenantDS; +import org.springblade.core.tool.api.R; +import org.springblade.modules.business.entity.ServerWindowsDispute; +import org.springblade.modules.business.service.IServerWindowsDisputeService; +import org.springblade.modules.business.vo.ServerWindowsDisputeVO; import org.springframework.web.bind.annotation.*; /** - * 控制器 + * 诉求类型管理 * * @author Chill */ @@ -33,9 +19,55 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping(CommonConstant.APPLICATION_NAME_BUSINESS + "/serverDisputeConf") @AllArgsConstructor -@ApiSort(1) -@Api(value = "诉求类型管理", tags = "诉求类型管理接口") public class ServerDisputeConfController extends BladeController { + IServerWindowsDisputeService swDisputeService; + + /** + * 列表 + * + * @param swId 窗口id + */ + @GetMapping("/getList") + public R getServerWindowList(Long swId) { + return R.data(swDisputeService.getServerWindowList(swId)); + } + + /** + * 获取根据id获取详情 + * + * @param swId 窗口id + */ + @GetMapping("/detail") + public R detail(Long swId) { + return R.data(swDisputeService.detail(swId)); + } + + /** + * 保存 + */ + @PostMapping("/save") + public R save(@RequestBody ServerWindowsDisputeVO entity) { + return R.status(swDisputeService.saveEntity(entity)); + } + + /** + * 禁用/启用 + * + * @param swId 窗口id + */ + @PostMapping("/enable") + public R enable(Long swId) { + return R.status(swDisputeService.enable(swId)); + } + /** + * 删除 + * + * @param swId 窗口id + */ + @PostMapping("/delete") + public R delete(Long swId) { + return R.status(swDisputeService.delete(swId)); + } } diff --git a/src/main/java/org/springblade/modules/business/dto/ServerWindowsDisputeDTO.java b/src/main/java/org/springblade/modules/business/dto/ServerWindowsDisputeDTO.java new file mode 100644 index 0000000..e22ab8b --- /dev/null +++ b/src/main/java/org/springblade/modules/business/dto/ServerWindowsDisputeDTO.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.modules.business.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 服务窗口-纠纷关联表 + * + * @author Chill + */ + +@Data +public class ServerWindowsDisputeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 窗口ID + */ + private Long swId; + + /** + * 窗口名称 + */ + private String swName; + + /** + * 纠纷字典id + */ + private Long disputeId; + + /** + * 诉求名称字符串 + */ + private String disputeName; + + /** + * 状态 0:禁用, 1:启用 + */ + private int status; + +} diff --git a/src/main/java/org/springblade/modules/business/entity/Appeal.java b/src/main/java/org/springblade/modules/business/entity/Appeal.java index fffd882..831f4f4 100644 --- a/src/main/java/org/springblade/modules/business/entity/Appeal.java +++ b/src/main/java/org/springblade/modules/business/entity/Appeal.java @@ -19,19 +19,21 @@ package org.springblade.modules.business.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tenant.mp.TenantEntity; import java.util.Date; /** * 诉求表 + * * @author Chill */ @Data @TableName("mp_appeal") @EqualsAndHashCode(callSuper = true) -public class Appeal extends TenantEntity { +public class Appeal extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/springblade/modules/business/entity/AppealMediation.java b/src/main/java/org/springblade/modules/business/entity/AppealMediation.java index 323aead..9760e4c 100644 --- a/src/main/java/org/springblade/modules/business/entity/AppealMediation.java +++ b/src/main/java/org/springblade/modules/business/entity/AppealMediation.java @@ -19,6 +19,7 @@ package org.springblade.modules.business.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tenant.mp.TenantEntity; import java.util.Date; @@ -31,7 +32,7 @@ import java.util.Date; @Data @TableName("mp_appeal_mediation") @EqualsAndHashCode(callSuper = true) -public class AppealMediation extends TenantEntity { +public class AppealMediation extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/springblade/modules/business/entity/AppealMediationFile.java b/src/main/java/org/springblade/modules/business/entity/AppealMediationFile.java index 0b1e53f..9eff993 100644 --- a/src/main/java/org/springblade/modules/business/entity/AppealMediationFile.java +++ b/src/main/java/org/springblade/modules/business/entity/AppealMediationFile.java @@ -19,6 +19,7 @@ package org.springblade.modules.business.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tenant.mp.TenantEntity; /** @@ -29,7 +30,7 @@ import org.springblade.core.tenant.mp.TenantEntity; @Data @TableName("mp_appeal_mediation_file") @EqualsAndHashCode(callSuper = true) -public class AppealMediationFile extends TenantEntity { +public class AppealMediationFile extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/springblade/modules/business/entity/AppealReg.java b/src/main/java/org/springblade/modules/business/entity/AppealReg.java index 3eab7cb..7cc709d 100644 --- a/src/main/java/org/springblade/modules/business/entity/AppealReg.java +++ b/src/main/java/org/springblade/modules/business/entity/AppealReg.java @@ -19,6 +19,7 @@ package org.springblade.modules.business.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tenant.mp.TenantEntity; import java.util.Date; @@ -31,7 +32,7 @@ import java.util.Date; @Data @TableName("mp_appeal_reg") @EqualsAndHashCode(callSuper = true) -public class AppealReg extends TenantEntity { +public class AppealReg extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/springblade/modules/business/entity/AppealVisitor.java b/src/main/java/org/springblade/modules/business/entity/AppealVisitor.java index 5eed251..ed92b99 100644 --- a/src/main/java/org/springblade/modules/business/entity/AppealVisitor.java +++ b/src/main/java/org/springblade/modules/business/entity/AppealVisitor.java @@ -19,6 +19,7 @@ package org.springblade.modules.business.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tenant.mp.TenantEntity; /** @@ -29,7 +30,7 @@ import org.springblade.core.tenant.mp.TenantEntity; @Data @TableName("mp_appeal_visitor") @EqualsAndHashCode(callSuper = true) -public class AppealVisitor extends TenantEntity { +public class AppealVisitor extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/springblade/modules/business/entity/ServerWindowsDispute.java b/src/main/java/org/springblade/modules/business/entity/ServerWindowsDispute.java index 254c13a..0b3a053 100644 --- a/src/main/java/org/springblade/modules/business/entity/ServerWindowsDispute.java +++ b/src/main/java/org/springblade/modules/business/entity/ServerWindowsDispute.java @@ -17,29 +17,49 @@ package org.springblade.modules.business.entity; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tenant.mp.TenantEntity; +import java.io.Serializable; + /** * 服务窗口-纠纷关联表 + * * @author Chill */ @Data @TableName("mp_server_windows_dispute") -@EqualsAndHashCode(callSuper = true) -public class ServerWindowsDispute extends TenantEntity { +public class ServerWindowsDispute extends BaseEntity { private static final long serialVersionUID = 1L; /** - * 诉求id + * 窗口id,即账号id */ private Long swId; + + /** + * 窗口名称 + */ + private Long swName; + /** - * 诉求登记Id + * 纠纷字典id */ - private Long disputeId; + private String disputeId; + /** + * 纠纷名称 + */ + private String disputeName; + + /** + * 状态 0:禁用, 1:启用 + */ + private Integer status; } diff --git a/src/main/java/org/springblade/modules/business/mapper/ServerWindowsDisputeMapper.java b/src/main/java/org/springblade/modules/business/mapper/ServerWindowsDisputeMapper.java index f6f94d0..d41194e 100644 --- a/src/main/java/org/springblade/modules/business/mapper/ServerWindowsDisputeMapper.java +++ b/src/main/java/org/springblade/modules/business/mapper/ServerWindowsDisputeMapper.java @@ -17,7 +17,13 @@ package org.springblade.modules.business.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.springblade.modules.business.dto.ServerWindowsDisputeDTO; import org.springblade.modules.business.entity.ServerWindowsDispute; +import org.springblade.modules.business.vo.ServerWindowsDisputeVO; + +import java.util.List; +import java.util.Map; /** * Mapper 接口 @@ -26,5 +32,25 @@ import org.springblade.modules.business.entity.ServerWindowsDispute; */ public interface ServerWindowsDisputeMapper extends BaseMapper { + /** + * 获取窗口,诉求配置列表 + * + * @param swId 窗口id + * @return + */ + List getSwDisputeList(@Param("swId") Long swId); + + /** + * 根据窗口id, 更新配置状态 + * + * @param swId + */ + boolean updateStatusBySwId(@Param("swId") Long swId, @Param("status") int status); + /** + * 根据窗口id, 删除配置 + * + * @param swId + */ + boolean deletedBySwId(@Param("swId") Long swId); } diff --git a/src/main/java/org/springblade/modules/business/mapper/ServerWindowsDisputeMapper.xml b/src/main/java/org/springblade/modules/business/mapper/ServerWindowsDisputeMapper.xml index 00d7a74..0539680 100644 --- a/src/main/java/org/springblade/modules/business/mapper/ServerWindowsDisputeMapper.xml +++ b/src/main/java/org/springblade/modules/business/mapper/ServerWindowsDisputeMapper.xml @@ -2,4 +2,22 @@ + + + + update mp_server_windows_dispute set `status` = #{status} where sw_id = #{swId} + + + + delete from mp_server_windows_dispute where sw_id = #{swId} + diff --git a/src/main/java/org/springblade/modules/business/service/IServerWindowsDisputeService.java b/src/main/java/org/springblade/modules/business/service/IServerWindowsDisputeService.java index 33d0980..58602e7 100644 --- a/src/main/java/org/springblade/modules/business/service/IServerWindowsDisputeService.java +++ b/src/main/java/org/springblade/modules/business/service/IServerWindowsDisputeService.java @@ -1,29 +1,53 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ package org.springblade.modules.business.service; +import com.baomidou.mybatisplus.extension.service.IService; +import org.springblade.core.tool.api.R; import org.springblade.modules.business.entity.ServerWindowsDispute; -import org.springblade.core.mp.base.BaseService; +import org.springblade.modules.business.vo.ServerWindowsDisputeVO; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** - * 服务类 + * 服务类 * * @author BladeX */ -public interface IServerWindowsDisputeService extends BaseService { +public interface IServerWindowsDisputeService extends IService { + + /** + * 获取窗口,诉求配置列表 + * + * @param swId + * @return + */ + List getServerWindowList(Long swId); + + /** + * 获取根据id获取详情 + * + * @param swId 窗口id + */ + ServerWindowsDisputeVO detail(Long swId); + + /** + * 保存 + */ + boolean saveEntity(ServerWindowsDisputeVO vo); + + /** + * 禁用/启用 + * + * @param swId 窗口id + */ + boolean enable(Long swId); + /** + * 删除 + * + * @param swId 窗口id + */ + boolean delete(Long swId); } diff --git a/src/main/java/org/springblade/modules/business/service/impl/ServerWindowsDisputeServiceImpl.java b/src/main/java/org/springblade/modules/business/service/impl/ServerWindowsDisputeServiceImpl.java index 0901a3c..dda10b9 100644 --- a/src/main/java/org/springblade/modules/business/service/impl/ServerWindowsDisputeServiceImpl.java +++ b/src/main/java/org/springblade/modules/business/service/impl/ServerWindowsDisputeServiceImpl.java @@ -1,27 +1,20 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ package org.springblade.modules.business.service.impl; +import org.springblade.common.constant.BusinessConstant; +import org.springblade.core.tool.utils.Func; +import org.springblade.modules.business.dto.ServerWindowsDisputeDTO; import org.springblade.modules.business.entity.ServerWindowsDispute; import org.springblade.modules.business.mapper.ServerWindowsDisputeMapper; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.modules.business.service.IServerWindowsDisputeService; +import org.springblade.modules.business.vo.ServerWindowsDisputeVO; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + /** * 服务实现类 * @@ -30,4 +23,94 @@ import org.springframework.stereotype.Service; @Service public class ServerWindowsDisputeServiceImpl extends BaseServiceImpl implements IServerWindowsDisputeService { + @Override + public List getServerWindowList(Long swId) { + List dtoList = baseMapper.getSwDisputeList(swId); + List voList = new ArrayList<>(); + + if (Func.isEmpty(dtoList)) { + return voList; + } + + Map> map = dtoList.stream().collect(Collectors.groupingBy(ServerWindowsDisputeDTO::getSwId)); + map.values().forEach(swdList -> { + ServerWindowsDisputeDTO dto = swdList.get(0); + String disputeIds = swdList.stream().map(ServerWindowsDisputeDTO::getDisputeId).map(String::valueOf).collect(Collectors.joining(",")); + String disputeNames = swdList.stream().map(ServerWindowsDisputeDTO::getDisputeName).collect(Collectors.joining(",")); + + ServerWindowsDisputeVO vo = new ServerWindowsDisputeVO(); + vo.setSwId(dto.getSwId()); + vo.setSwName(dto.getSwName()); + vo.setDisputeIds(disputeIds); + vo.setDisputeNames(disputeNames); + vo.setStatus(dto.getStatus()); + + voList.add(vo); + }); + + return voList; + } + + @Override + public ServerWindowsDisputeVO detail(Long swId) { + List dtoList = baseMapper.getSwDisputeList(swId); + if (Func.isEmpty(dtoList)) { + return null; + } + + ServerWindowsDisputeDTO dto = dtoList.get(0); + String disputeIds = dtoList.stream().map(ServerWindowsDisputeDTO::getDisputeId).map(String::valueOf).collect(Collectors.joining(",")); + String disputeNames = dtoList.stream().map(ServerWindowsDisputeDTO::getDisputeName).collect(Collectors.joining(",")); + + ServerWindowsDisputeVO vo = new ServerWindowsDisputeVO(); + vo.setSwId(dto.getSwId()); + vo.setSwName(dto.getSwName()); + vo.setDisputeIds(disputeIds); + vo.setDisputeNames(disputeNames); + vo.setStatus(dto.getStatus()); + return vo; + } + + @Override + public boolean saveEntity(ServerWindowsDisputeVO vo) { + if (Func.isEmpty(vo.getDisputeIds())) { + return false; + } + // 先删除原来的配置 + delete(vo.getSwId()); + + List saveList = new ArrayList<>(); + String[] disputeIdList = vo.getDisputeIds().split(","); + for (String s : disputeIdList) { + ServerWindowsDispute dispute = new ServerWindowsDispute(); + dispute.setSwId(vo.getSwId()); + dispute.setDisputeId(s); + dispute.setStatus(vo.getStatus()); + saveList.add(dispute); + } + + return saveBatch(saveList); + } + + @Override + public boolean enable(Long swId) { + List dtoList = baseMapper.getSwDisputeList(swId); + if (Func.isEmpty(dtoList)) { + return false; + } + + // 若原状态为启用, 更新为禁用, 若原状态为禁用, 更新为启用 + ServerWindowsDisputeDTO dto = dtoList.get(0); + if (BusinessConstant.ENABLE_CODE_DISABLE == dto.getStatus()) { + return baseMapper.updateStatusBySwId(swId, BusinessConstant.ENABLE_CODE_ENABLE); + } else { + return baseMapper.updateStatusBySwId(swId, BusinessConstant.ENABLE_CODE_DISABLE); + } + + } + + @Override + public boolean delete(Long swId) { + return baseMapper.deletedBySwId(swId); + } } diff --git a/src/main/java/org/springblade/modules/business/vo/ServerWindowsDisputeVO.java b/src/main/java/org/springblade/modules/business/vo/ServerWindowsDisputeVO.java new file mode 100644 index 0000000..88c5eb0 --- /dev/null +++ b/src/main/java/org/springblade/modules/business/vo/ServerWindowsDisputeVO.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.modules.business.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 服务窗口-纠纷关联表 + * + * @author Chill + */ + +@Data +public class ServerWindowsDisputeVO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 窗口ID + */ + private Long swId; + + /** + * 窗口名称 + */ + private String swName; + + /** + * 纠纷字典id, 以逗号分割 + */ + private String disputeIds; + + /** + * 诉求名称字符串, 以逗号分割 + */ + private String disputeNames; + + /** + * 状态 0:禁用, 1:启用 + */ + private int status; + +}