diff --git a/src/main/java/com/cloudservice/ccs/biz/IAttendanceStatisticsBiz.java b/src/main/java/com/cloudservice/ccs/biz/IAttendanceStatisticsBiz.java index 0b87e80a7da5131e2b542ba995a2c7048efbed29..03a1df913514f41b15823ffdbb964656bc047eaf 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IAttendanceStatisticsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IAttendanceStatisticsBiz.java @@ -3,6 +3,7 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.AttendanceStatistics; import java.util.List; +import java.util.Map; public interface IAttendanceStatisticsBiz { void save(AttendanceStatistics attendanceStatistics); @@ -11,6 +12,8 @@ public interface IAttendanceStatisticsBiz { void delete(Integer id); + void partialUpdate(Integer id, Map fields); + AttendanceStatistics getOne(Integer id); List getAll(); diff --git a/src/main/java/com/cloudservice/ccs/biz/IBlackListBiz.java b/src/main/java/com/cloudservice/ccs/biz/IBlackListBiz.java index 2a6858110c0367848f71bf5ab4f4da460b142f26..5b888fd8e5d5b49d0e5051743b3a66291e24321d 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IBlackListBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IBlackListBiz.java @@ -3,6 +3,7 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.BlackList; import java.util.List; +import java.util.Map; public interface IBlackListBiz { void save(BlackList blackList); @@ -11,6 +12,8 @@ public interface IBlackListBiz { void delete(Integer id); + void partialUpdate(Integer id, Map fields); + BlackList getOne(Integer id); List getAll(); diff --git a/src/main/java/com/cloudservice/ccs/biz/ICommonWordBiz.java b/src/main/java/com/cloudservice/ccs/biz/ICommonWordBiz.java index bd7ecc0d0cb19acb07b0dc6e049368611b8e6849..4b0e86475d5726f10a61f9bf1897e3a2cfe80147 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ICommonWordBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ICommonWordBiz.java @@ -3,6 +3,7 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.CommonWord; import java.util.List; +import java.util.Map; public interface ICommonWordBiz { void save(CommonWord commonWord); @@ -11,6 +12,8 @@ public interface ICommonWordBiz { void delete(Integer id); + void partialUpdate(Integer id, Map fields); + CommonWord getOne(Integer id); List getAll(); diff --git a/src/main/java/com/cloudservice/ccs/biz/ICustomerInfoBiz.java b/src/main/java/com/cloudservice/ccs/biz/ICustomerInfoBiz.java index 602a653fd25e100faf1d7d1ab8d4de5745bbc696..82449ffa06550d2cd45321e960ed336a087968b5 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ICustomerInfoBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ICustomerInfoBiz.java @@ -3,15 +3,18 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.CustomerInfo; import java.util.List; +import java.util.Map; public interface ICustomerInfoBiz { void save(CustomerInfo customerInfo); - void update(String email, CustomerInfo customerInfo); + void update(Integer id, CustomerInfo customerInfo); - void delete(String email); + void delete(Integer id); - CustomerInfo getOne(String email); + CustomerInfo getOne(Integer id); + + void partialUpdate(Integer id, Map fields); List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IGroupManageBiz.java b/src/main/java/com/cloudservice/ccs/biz/IGroupManageBiz.java index f5ceb6401ceef530a29af2c438035e1a9d85a4f1..3aa50f3bfebe590d81c68442ab46ac06427c5140 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IGroupManageBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IGroupManageBiz.java @@ -3,6 +3,7 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.GroupManage; import java.util.List; +import java.util.Map; public interface IGroupManageBiz { void save( GroupManage groupManage); @@ -11,6 +12,8 @@ public interface IGroupManageBiz { void delete(Integer id); + void partialUpdate(Integer id, Map fields); + GroupManage getOne(Integer id); List getAll(); diff --git a/src/main/java/com/cloudservice/ccs/biz/INoticeBiz.java b/src/main/java/com/cloudservice/ccs/biz/INoticeBiz.java index d3b5636aa0b8af3c658763aadffa13a94fc03e2b..84edd18f16fd62b12674a0766f8a994f196bdd17 100644 --- a/src/main/java/com/cloudservice/ccs/biz/INoticeBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/INoticeBiz.java @@ -3,12 +3,15 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.Notice; import java.util.List; +import java.util.Map; public interface INoticeBiz { void save( Notice notice); void update(Integer id, Notice notice); + void partialUpdate(Integer id, Map fields); + void delete(Integer id); Notice getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/biz/IRoleManageBiz.java b/src/main/java/com/cloudservice/ccs/biz/IRoleManageBiz.java index acf1351a1b0eb942d11df0b8546fedad94e1168f..735341346f7ea1be8bf6b1533b25584b5cf49997 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IRoleManageBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IRoleManageBiz.java @@ -3,12 +3,15 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.RoleManage; import java.util.List; +import java.util.Map; public interface IRoleManageBiz { void save(RoleManage roleManage); void update(Integer id, RoleManage roleManage); + void partialUpdate(Integer id, Map fields); + void delete(Integer id); RoleManage getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/biz/ISessionBiz.java b/src/main/java/com/cloudservice/ccs/biz/ISessionBiz.java index 3b2ed6d7fa776571cd2129157d18009d199ef52f..2e7acf928834c9bd3dd063d67b1d0ed9e8f764c8 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ISessionBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ISessionBiz.java @@ -4,12 +4,15 @@ import com.cloudservice.ccs.entity.Session; import com.cloudservice.ccs.mapper.SessionMapper; import java.util.List; +import java.util.Map; public interface ISessionBiz { void save(Session session); void update(Integer id, Session session); + void partialUpdate(Integer id, Map fields); + void delete(Integer id); Session getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/biz/ISessionMessageBiz.java b/src/main/java/com/cloudservice/ccs/biz/ISessionMessageBiz.java index 7de74756cb63e33b39d7b4e28b3fc5423f4d5604..49465a203789585248054f3d18a92b3632b2d13e 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ISessionMessageBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ISessionMessageBiz.java @@ -3,12 +3,15 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.SessionMessage; import java.util.List; +import java.util.Map; public interface ISessionMessageBiz { void save(SessionMessage sessionMessage); void update(Integer id, SessionMessage sessionMessage); + void partialUpdate(Integer id, Map fields); + void delete(Integer id); SessionMessage getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/biz/ISystemMessageBiz.java b/src/main/java/com/cloudservice/ccs/biz/ISystemMessageBiz.java index 64cf013facd9130193810a90dfd4fce304478eeb..ef8251d5813fb53d6a2f1e999b43e49b4a881127 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ISystemMessageBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ISystemMessageBiz.java @@ -3,12 +3,15 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.SystemMessage; import java.util.List; +import java.util.Map; public interface ISystemMessageBiz { void save(SystemMessage systemMessage); void update(Integer id, SystemMessage systemMessage); + void partialUpdate(Integer id, Map fields); + void delete(Integer id); SystemMessage getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/biz/ITagsBiz.java b/src/main/java/com/cloudservice/ccs/biz/ITagsBiz.java index c34314aa018db1be68dcd5816ad68bdb285d12d5..52d6006175770f41f04ad15b9728fb095c7c9463 100644 --- a/src/main/java/com/cloudservice/ccs/biz/ITagsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/ITagsBiz.java @@ -3,12 +3,15 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.Tags; import java.util.List; +import java.util.Map; public interface ITagsBiz { void save(Tags tags); void update(Integer id, Tags tags); + void partialUpdate(Integer id, Map fields); + void delete(Integer id); Tags getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/biz/IViewStatisticsBiz.java b/src/main/java/com/cloudservice/ccs/biz/IViewStatisticsBiz.java index c2d4a1bbae896a694c746dfe286727446de1c97b..2fa4e4707ad507228933f094c6b649575c6ad3f9 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IViewStatisticsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IViewStatisticsBiz.java @@ -3,12 +3,15 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.ViewStatistics; import java.util.List; +import java.util.Map; public interface IViewStatisticsBiz { void save(ViewStatistics viewStatistics); void update(Integer id, ViewStatistics viewStatistics); + void partialUpdate(Integer id, Map fields); + void delete(Integer id); ViewStatistics getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/biz/IVisitorInfoBiz.java b/src/main/java/com/cloudservice/ccs/biz/IVisitorInfoBiz.java index 80e7743c4429a1382505f51bc61a7eb605033d64..6abd46510f3ba81bd72a26575de3f28237323f1c 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IVisitorInfoBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IVisitorInfoBiz.java @@ -3,15 +3,18 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.VisitorInfo; import java.util.List; +import java.util.Map; public interface IVisitorInfoBiz { void save(VisitorInfo visitorInfo); - void update(String ip, VisitorInfo visitorInfo); + void update(Integer id, VisitorInfo visitorInfo); - void delete(String ip); + void delete(Integer id); - VisitorInfo getOne(String ip); + void partialUpdate(Integer id, Map fields); + + VisitorInfo getOne(Integer id); List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/IWorkloadStatisticsBiz.java b/src/main/java/com/cloudservice/ccs/biz/IWorkloadStatisticsBiz.java index ab85feb9c12dfe74d20579dc2dd27027683ed1fd..8b7fcf21ef181521743b7e7969bf06165de79616 100644 --- a/src/main/java/com/cloudservice/ccs/biz/IWorkloadStatisticsBiz.java +++ b/src/main/java/com/cloudservice/ccs/biz/IWorkloadStatisticsBiz.java @@ -1,8 +1,11 @@ package com.cloudservice.ccs.biz; import com.cloudservice.ccs.entity.WorkloadStatistics; +import com.cloudservice.ccs.entity.WorkloadStatisticsAggregation; +import com.cloudservice.ccs.entity.WorkloadStatisticsWithAverage; import java.util.List; +import java.util.Map; public interface IWorkloadStatisticsBiz { @@ -12,7 +15,13 @@ public interface IWorkloadStatisticsBiz { void delete(Integer id); + void partialUpdate(Integer id, Map fields); + WorkloadStatistics getOne(Integer id); List getAll(); + + List getAllWithAverage(); + + WorkloadStatisticsAggregation getAggregation(); } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/AttendanceStatisticsImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/AttendanceStatisticsImpl.java index b97c14dbe2aa0ee0bd8525ceb05472b9633a2144..1bae9a078df191c5a8f76d4e8e4e091ca59a4952 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/AttendanceStatisticsImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/AttendanceStatisticsImpl.java @@ -3,11 +3,13 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.IAttendanceStatisticsBiz; import com.cloudservice.ccs.entity.AttendanceStatistics; import com.cloudservice.ccs.exception.AttendanceStatisticsException; +import com.cloudservice.ccs.exception.BlackListException; import com.cloudservice.ccs.mapper.AttendanceStatisticsMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class AttendanceStatisticsImpl implements IAttendanceStatisticsBiz { @@ -29,6 +31,14 @@ public class AttendanceStatisticsImpl implements IAttendanceStatisticsBiz { } } + @Override + public void partialUpdate(Integer id, Map fields) { + int result = attendanceStatisticsMapper.partialUpdate(id, fields); + if (result == 0) { + throw new AttendanceStatisticsException("Update AttendanceStatistics entity error"); + } + } + @Override public void delete(Integer id) { int result = attendanceStatisticsMapper.delete(id); diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/BlackListImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/BlackListImpl.java index ba407347f1a88b3dc82347a40930e0a23ea74734..bc6dae9bc9a8103f0a124d4a11d671ba2361ec00 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/BlackListImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/BlackListImpl.java @@ -3,11 +3,13 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.IBlackListBiz; import com.cloudservice.ccs.entity.BlackList; import com.cloudservice.ccs.exception.BlackListException; +import com.cloudservice.ccs.exception.CustomerServiceException; import com.cloudservice.ccs.mapper.BlackListMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class BlackListImpl implements IBlackListBiz { @@ -29,6 +31,13 @@ public class BlackListImpl implements IBlackListBiz { } } + @Override + public void partialUpdate(Integer id, Map fields) { + int result = blackListMapper.partialUpdate(id, fields); + if (result == 0) { + throw new BlackListException("Update BlackList entity error"); + } + } @Override public void delete(Integer id) { int result = blackListMapper.delete(id); diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/CommonWordImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/CommonWordImpl.java index 96ecf4e1677330579d260ab622173c5369be74e3..a1adf49c98c278dbfb9926f647f7ab19bc238e28 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/CommonWordImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/CommonWordImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.ICommonWordBiz; import com.cloudservice.ccs.entity.CommonWord; +import com.cloudservice.ccs.exception.BlackListException; import com.cloudservice.ccs.exception.CommonWordException; import com.cloudservice.ccs.mapper.CommonWordMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class CommonWordImpl implements ICommonWordBiz { @@ -50,4 +52,13 @@ public class CommonWordImpl implements ICommonWordBiz { public List getAll() { return commonWordMapper.getAll(); } + + + @Override + public void partialUpdate(Integer id, Map fields) { + int result = commonWordMapper.partialUpdate(id, fields); + if (result == 0) { + throw new CommonWordException("Update CommonWord entity error"); + } + } } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/CustomerInfoImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/CustomerInfoImpl.java index 8420d36eef388bdd44f8b0a4db42909429743263..1a74b313e5edae193e89aad51154a7b61ca62221 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/CustomerInfoImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/CustomerInfoImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.ICustomerInfoBiz; import com.cloudservice.ccs.entity.CustomerInfo; +import com.cloudservice.ccs.exception.CommonWordException; import com.cloudservice.ccs.exception.CustomerInfoException; import com.cloudservice.ccs.mapper.CustomerInfoMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class CustomerInfoImpl implements ICustomerInfoBiz { @@ -22,24 +24,32 @@ public class CustomerInfoImpl implements ICustomerInfoBiz { } @Override - public void update(String email, CustomerInfo customerInfo) { - int result = customerInfoMapper.update(email, customerInfo); + public void partialUpdate(Integer id, Map fields) { + int result = customerInfoMapper.partialUpdate(id, fields); if (result == 0) { throw new CustomerInfoException("Update CustomerInfo entity error"); } } @Override - public void delete(String email) { - int result = customerInfoMapper.delete(email); + public void update(Integer id, CustomerInfo customerInfo) { + int result = customerInfoMapper.update(id, customerInfo); + if (result == 0) { + throw new CustomerInfoException("Update CustomerInfo entity error"); + } + } + + @Override + public void delete(Integer id) { + int result = customerInfoMapper.delete(id); if (result == 0) { throw new CustomerInfoException("Delete CustomerInfo entity error"); } } @Override - public CustomerInfo getOne(String email) { - CustomerInfo customerInfo = customerInfoMapper.getOne(email); + public CustomerInfo getOne(Integer id) { + CustomerInfo customerInfo = customerInfoMapper.getOne(id); if (customerInfo == null) { throw new CustomerInfoException("Get CustomerInfo entity error: no such entity"); } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/CustomerServiceImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/CustomerServiceImpl.java index 71427543790a97862dde14f0604ff9f92714ba2f..d979b07e83273f1db1813740887491364a725e78 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/CustomerServiceImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/CustomerServiceImpl.java @@ -24,7 +24,7 @@ public class CustomerServiceImpl implements ICustomerServiceBiz { } int result = customerServiceMapper.save(customerService); if (result == 0) { - throw new CustomerServiceException("Create CustomerService entity error"); + throw new CustomerServiceException("创建客服失败"); } } @@ -33,7 +33,7 @@ public class CustomerServiceImpl implements ICustomerServiceBiz { if (customerService.getPassword() != null) { CustomerService originalCustomerService = customerServiceMapper.getOne(id); if (originalCustomerService == null) { - throw new CustomerServiceException("CustomerService entity being updated does not exist"); + throw new CustomerServiceException("要更新的客服不存在"); } String originalPassword = originalCustomerService.getPassword(); String newPassword = customerService.getPassword(); @@ -43,7 +43,7 @@ public class CustomerServiceImpl implements ICustomerServiceBiz { } int result = customerServiceMapper.update(id, customerService); if (result == 0) { - throw new CustomerServiceException("Update CustomerService entity error"); + throw new CustomerServiceException("更新客服信息失败"); } } @@ -54,7 +54,7 @@ public class CustomerServiceImpl implements ICustomerServiceBiz { } int result = customerServiceMapper.partialUpdate(id, fields); if (result == 0) { - throw new CustomerServiceException("Partial update CustomerService entity error"); + throw new CustomerServiceException("更新客服信息失败"); } } @@ -62,7 +62,7 @@ public class CustomerServiceImpl implements ICustomerServiceBiz { public void delete(Integer id) { int result = customerServiceMapper.delete(id); if (result == 0) { - throw new CustomerServiceException("Delete CustomerService entity error"); + throw new CustomerServiceException("删除客服失败"); } } @@ -70,7 +70,7 @@ public class CustomerServiceImpl implements ICustomerServiceBiz { public CustomerService getOne(Integer id) { CustomerService customerService = customerServiceMapper.getOne(id); if (customerService == null) { - throw new CustomerServiceException("Get CustomerService entity error: no such entity"); + throw new CustomerServiceException("要查询的客服不存在"); } return customerService; } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/GroupManageImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/GroupManageImpl.java index dff61e7856b6e59b7d4d054a707e179ba62a6d76..9e658526e5c7097cbc18d79f63af4dd9c2d68b5b 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/GroupManageImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/GroupManageImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.IGroupManageBiz; import com.cloudservice.ccs.entity.GroupManage; +import com.cloudservice.ccs.exception.CustomerServiceException; import com.cloudservice.ccs.exception.GroupManageException; import com.cloudservice.ccs.mapper.GroupManageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class GroupManageImpl implements IGroupManageBiz { @@ -36,7 +38,15 @@ public class GroupManageImpl implements IGroupManageBiz { throw new GroupManageException("Delete GroupManage entity error"); } } + @Override + public void partialUpdate(Integer id, Map fields) { + + int result = groupManageMapper.partialUpdate(id, fields); + if (result == 0) { + throw new GroupManageException("Update GroupManage entity error"); + } + } @Override public GroupManage getOne(Integer id) { GroupManage groupManage = groupManageMapper.getOne(id); diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/NoticeImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/NoticeImpl.java index 78c1e059931d8b598d9b97cec8c11ea09080b852..ca8f4920b9b661ba10aa4b9d2fca44f34f743832 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/NoticeImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/NoticeImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.INoticeBiz; import com.cloudservice.ccs.entity.Notice; +import com.cloudservice.ccs.exception.CustomerServiceException; import com.cloudservice.ccs.exception.NoticeException; import com.cloudservice.ccs.mapper.NoticeMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class NoticeImpl implements INoticeBiz { @@ -29,6 +31,14 @@ public class NoticeImpl implements INoticeBiz { } } + @Override + public void partialUpdate(Integer id, Map fields) { + int result = noticeMapper.partialUpdate(id, fields); + if (result == 0) { + throw new NoticeException("Partial update Notice failed"); + } + } + @Override public void delete(Integer id) { int result = noticeMapper.delete(id); diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/RoleManageImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/RoleManageImpl.java index 625a7d838c0c98dbd144aeac7e4f0016842e2730..fae6986a73b50522f699bd89578c0275a5ac419c 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/RoleManageImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/RoleManageImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.IRoleManageBiz; import com.cloudservice.ccs.entity.RoleManage; +import com.cloudservice.ccs.exception.CustomerServiceException; import com.cloudservice.ccs.exception.RoleManageException; import com.cloudservice.ccs.mapper.RoleManageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class RoleManageImpl implements IRoleManageBiz{ @@ -29,6 +31,14 @@ public class RoleManageImpl implements IRoleManageBiz{ } } + @Override + public void partialUpdate(Integer id, Map fields) { + int result = roleManageMapper.partialUpdate(id, fields); + if (result == 0) { + throw new RoleManageException("Partial update RoleManage failed"); + } + } + @Override public void delete(Integer id) { int result = roleManageMapper.delete(id); diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/SessionImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/SessionImpl.java index c751f784c6ee961cdb8b8cd190183960a735b2ba..da54c6502e50192ff13c1a07d89cad505fd69246 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/SessionImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/SessionImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.ISessionBiz; import com.cloudservice.ccs.entity.Session; +import com.cloudservice.ccs.exception.RoleManageException; import com.cloudservice.ccs.exception.SessionException; import com.cloudservice.ccs.mapper.SessionMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class SessionImpl implements ISessionBiz { @@ -29,6 +31,14 @@ public class SessionImpl implements ISessionBiz { } } + @Override + public void partialUpdate(Integer id, Map fields) { + int result = sessionMapper.partialUpdate(id, fields); + if (result == 0) { + throw new SessionException("Partial update Session failed"); + } + } + @Override public void delete(Integer id) { int result = sessionMapper.delete(id); diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/SessionMessageImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/SessionMessageImpl.java index 559d720cb2f2eacdd1b21a6c90a13a71e3356148..572c7c3e149f025895a0e237264251673bb08d54 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/SessionMessageImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/SessionMessageImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.ISessionMessageBiz; import com.cloudservice.ccs.entity.SessionMessage; +import com.cloudservice.ccs.exception.RoleManageException; import com.cloudservice.ccs.exception.SessionMessageException; import com.cloudservice.ccs.mapper.SessionMessageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class SessionMessageImpl implements ISessionMessageBiz { @@ -29,6 +31,14 @@ public class SessionMessageImpl implements ISessionMessageBiz { } } + @Override + public void partialUpdate(Integer id, Map fields) { + int result = sessionMessageMapper.partialUpdate(id, fields); + if (result == 0) { + throw new SessionMessageException("Partial update SessionMessage failed"); + } + } + @Override public void delete(Integer id) { int result = sessionMessageMapper.delete(id); diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/SystemMessageImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/SystemMessageImpl.java index bad518d48e68226d9ef71fa8d6c1e37f8361cd67..7b5d2b3f74b3eb4a93ed799c9b0b6c2231803996 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/SystemMessageImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/SystemMessageImpl.java @@ -2,11 +2,13 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.ISystemMessageBiz; import com.cloudservice.ccs.entity.SystemMessage; +import com.cloudservice.ccs.exception.RoleManageException; import com.cloudservice.ccs.exception.SystemMessageException; import com.cloudservice.ccs.mapper.SystemMessageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class SystemMessageImpl implements ISystemMessageBiz { @@ -18,7 +20,7 @@ public class SystemMessageImpl implements ISystemMessageBiz { public void save(SystemMessage systemMessage) { int result = systemMessageMapper.save(systemMessage); if (result == 0) { - throw new SystemMessageException("Create CustomerService entity error"); + throw new SystemMessageException("Create SystemMessage entity error"); } } @@ -26,7 +28,15 @@ public class SystemMessageImpl implements ISystemMessageBiz { public void update(Integer id, SystemMessage systemMessage) { int result = systemMessageMapper.update(id, systemMessage); if (result == 0) { - throw new SystemMessageException("Update CustomerService entity error"); + throw new SystemMessageException("Update SystemMessage entity error"); + } + } + + @Override + public void partialUpdate(Integer id, Map fields) { + int result = systemMessageMapper.partialUpdate(id, fields); + if (result == 0) { + throw new SystemMessageException("Partial update SystemMessage failed"); } } @@ -34,7 +44,7 @@ public class SystemMessageImpl implements ISystemMessageBiz { public void delete(Integer id) { int result = systemMessageMapper.delete(id); if (result == 0) { - throw new SystemMessageException("Delete CustomerService entity error"); + throw new SystemMessageException("Delete SystemMessage entity error"); } } @@ -42,7 +52,7 @@ public class SystemMessageImpl implements ISystemMessageBiz { public SystemMessage getOne(Integer id) { SystemMessage systemMessage = systemMessageMapper.getOne(id); if (systemMessage == null) { - throw new SystemMessageException("Get CustomerService entity error: no such entity"); + throw new SystemMessageException("Get SystemMessage entity error: no such entity"); } return systemMessage; } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/TagsImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/TagsImpl.java index 80ba3499c4d460df0c2f838d3302905d0ddc6871..5dbbe66862b7ee8a6875415e37e71431d8bfa1dc 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/TagsImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/TagsImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.ITagsBiz; import com.cloudservice.ccs.entity.Tags; +import com.cloudservice.ccs.exception.RoleManageException; import com.cloudservice.ccs.exception.TagsException; import com.cloudservice.ccs.mapper.TagsMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class TagsImpl implements ITagsBiz { @@ -18,7 +20,7 @@ public class TagsImpl implements ITagsBiz { public void save(Tags tags) { int result = tagsMapper.save(tags); if (result == 0) { - throw new TagsException("Create CustomerService entity error"); + throw new TagsException("Create Tags entity error"); } } @@ -26,7 +28,15 @@ public class TagsImpl implements ITagsBiz { public void update(Integer id, Tags tags) { int result = tagsMapper.update(id, tags); if (result == 0) { - throw new TagsException("Update CustomerService entity error"); + throw new TagsException("Update Tags entity error"); + } + } + + @Override + public void partialUpdate(Integer id, Map fields) { + int result = tagsMapper.partialUpdate(id, fields); + if (result == 0) { + throw new TagsException("Partial update Tags failed"); } } @@ -34,7 +44,7 @@ public class TagsImpl implements ITagsBiz { public void delete(Integer id) { int result = tagsMapper.delete(id); if (result == 0) { - throw new TagsException("Delete CustomerService entity error"); + throw new TagsException("Delete Tags entity error"); } } @@ -42,7 +52,7 @@ public class TagsImpl implements ITagsBiz { public Tags getOne(Integer id) { Tags tags = tagsMapper.getOne(id); if (tags == null) { - throw new TagsException("Get CustomerService entity error: no such entity"); + throw new TagsException("Get Tags entity error: no such entity"); } return tags; } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/ViewStatisticsImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/ViewStatisticsImpl.java index 0d96b4c381852dc8db492ed9d150c7a151504fd9..5404dbd38b4884dc23f0dfc5382028c37c6903ee 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/ViewStatisticsImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/ViewStatisticsImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.IViewStatisticsBiz; import com.cloudservice.ccs.entity.ViewStatistics; +import com.cloudservice.ccs.exception.RoleManageException; import com.cloudservice.ccs.exception.ViewStatisticsException; import com.cloudservice.ccs.mapper.ViewStatisticsMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class ViewStatisticsImpl implements IViewStatisticsBiz { @@ -18,7 +20,7 @@ public class ViewStatisticsImpl implements IViewStatisticsBiz { public void save(ViewStatistics viewStatistics) { int result = viewStatisticsMapper.save(viewStatistics); if (result == 0) { - throw new ViewStatisticsException("Create CustomerService entity error"); + throw new ViewStatisticsException("Create ViewStatistics entity error"); } } @@ -26,7 +28,15 @@ public class ViewStatisticsImpl implements IViewStatisticsBiz { public void update(Integer id, ViewStatistics viewStatistics) { int result = viewStatisticsMapper.update(id, viewStatistics); if (result == 0) { - throw new ViewStatisticsException("Update CustomerService entity error"); + throw new ViewStatisticsException("Update ViewStatistics entity error"); + } + } + + @Override + public void partialUpdate(Integer id, Map fields) { + int result = viewStatisticsMapper.partialUpdate(id, fields); + if (result == 0) { + throw new ViewStatisticsException("Partial update ViewStatistics failed"); } } @@ -34,7 +44,7 @@ public class ViewStatisticsImpl implements IViewStatisticsBiz { public void delete(Integer id) { int result = viewStatisticsMapper.delete(id); if (result == 0) { - throw new ViewStatisticsException("Delete CustomerService entity error"); + throw new ViewStatisticsException("Delete ViewStatistics entity error"); } } @@ -42,7 +52,7 @@ public class ViewStatisticsImpl implements IViewStatisticsBiz { public ViewStatistics getOne(Integer id) { ViewStatistics viewStatistics = viewStatisticsMapper.getOne(id); if (viewStatistics == null) { - throw new ViewStatisticsException("Get CustomerService entity error: no such entity"); + throw new ViewStatisticsException("Get ViewStatistics entity error: no such entity"); } return viewStatistics; } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/VisitorInfoImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/VisitorInfoImpl.java index bc02a670119d9ee62eb88dab0dbd3a0bd66e2af3..b07bada0c56b72b7f9862f19d34a25c9b3b8e4d1 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/VisitorInfoImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/VisitorInfoImpl.java @@ -2,12 +2,14 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.IVisitorInfoBiz; import com.cloudservice.ccs.entity.VisitorInfo; +import com.cloudservice.ccs.exception.CustomerServiceException; import com.cloudservice.ccs.exception.VisitorInfoException; import com.cloudservice.ccs.mapper.VisitorInfoMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class VisitorInfoImpl implements IVisitorInfoBiz { @@ -23,24 +25,33 @@ public class VisitorInfoImpl implements IVisitorInfoBiz { } @Override - public void update(String ip, VisitorInfo visitorInfo) { - int result = visitorInfoMapper.update(ip, visitorInfo); + public void update(Integer id, VisitorInfo visitorInfo) { + int result = visitorInfoMapper.update(id, visitorInfo); if (result == 0) { throw new VisitorInfoException("Update CustomerService entity error"); } } @Override - public void delete(String ip) { - int result = visitorInfoMapper.delete(ip); + public void delete(Integer id) { + int result = visitorInfoMapper.delete(id); if (result == 0) { throw new VisitorInfoException("Delete CustomerService entity error"); } } @Override - public VisitorInfo getOne(String ip) { - VisitorInfo visitorInfo = visitorInfoMapper.getOne(ip); + public void partialUpdate(Integer id, Map fields) { + + int result = visitorInfoMapper.partialUpdate(id, fields); + if (result == 0) { + throw new CustomerServiceException("访客信息失败"); + } + } + + @Override + public VisitorInfo getOne(Integer id) { + VisitorInfo visitorInfo = visitorInfoMapper.getOne(id); if (visitorInfo == null) { throw new VisitorInfoException("Get CustomerService entity error: no such entity"); } diff --git a/src/main/java/com/cloudservice/ccs/biz/impl/WorkloadStatisticsImpl.java b/src/main/java/com/cloudservice/ccs/biz/impl/WorkloadStatisticsImpl.java index 1727b7183e41efdbb74eddf9afb9b5d33ea0e5cc..51746b5e3acaa36400e1da53f9a75dbec8273606 100644 --- a/src/main/java/com/cloudservice/ccs/biz/impl/WorkloadStatisticsImpl.java +++ b/src/main/java/com/cloudservice/ccs/biz/impl/WorkloadStatisticsImpl.java @@ -2,12 +2,17 @@ package com.cloudservice.ccs.biz.impl; import com.cloudservice.ccs.biz.IWorkloadStatisticsBiz; import com.cloudservice.ccs.entity.WorkloadStatistics; +import com.cloudservice.ccs.entity.WorkloadStatisticsAggregation; +import com.cloudservice.ccs.entity.WorkloadStatisticsWithAverage; +import com.cloudservice.ccs.exception.CustomerServiceException; import com.cloudservice.ccs.exception.WorkloadStatisticsException; import com.cloudservice.ccs.mapper.WorkLoadStatisticsMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; +import java.util.Map; @Service public class WorkloadStatisticsImpl implements IWorkloadStatisticsBiz { @@ -47,8 +52,37 @@ public class WorkloadStatisticsImpl implements IWorkloadStatisticsBiz { return workloadStatistics; } + @Override + public void partialUpdate(Integer id, Map fields) { + + int result = workLoadStatisticsMapper.partialUpdate(id, fields); + if (result == 0) { + throw new CustomerServiceException("访客信息失败"); + } + } @Override public List getAll() { return workLoadStatisticsMapper.getAll(); } + + @Override + public List getAllWithAverage() { + List workloadStatisticsList = workLoadStatisticsMapper.getAll(); + List result = new ArrayList<>(); + for (WorkloadStatistics workloadStatistics : workloadStatisticsList) { + WorkloadStatisticsWithAverage item = WorkloadStatisticsWithAverage.fromWorkloadStatistics(workloadStatistics); + item.calculateAverage(); + result.add(item); + } + return result; + } + + @Override + public WorkloadStatisticsAggregation getAggregation() { + WorkloadStatisticsAggregation part1 = workLoadStatisticsMapper.getStatisticsPartOfAggregation(), + part2 = workLoadStatisticsMapper.getSessionPartOfAggregation(); + part1.setMaxSessionTime(part2.getMaxSessionTime()); + part1.setMaxMessageCount(part2.getMaxMessageCount()); + return part1; + } } diff --git a/src/main/java/com/cloudservice/ccs/config/CustomerServiceRealm.java b/src/main/java/com/cloudservice/ccs/config/CustomerServiceRealm.java index 91b9c14b228e74715be43b6525943dc574a3fbcf..2b6e3236ab324c34b6003bf9a01867ecab0c8e2b 100644 --- a/src/main/java/com/cloudservice/ccs/config/CustomerServiceRealm.java +++ b/src/main/java/com/cloudservice/ccs/config/CustomerServiceRealm.java @@ -29,15 +29,15 @@ public class CustomerServiceRealm extends AuthorizingRealm { protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { String email = (String) authenticationToken.getPrincipal(); if (email == null || email.isEmpty()) { - throw new UnknownAccountException("Null account"); + throw new UnknownAccountException("未知用户"); } Map conditions = new HashMap<>(); conditions.put("email", email); List foundCustomerServices = customerServiceMapper.getWithConditions(conditions); if (foundCustomerServices == null || foundCustomerServices.isEmpty()) { - throw new UnknownAccountException("This account does not exist"); + throw new UnknownAccountException("用户不存在"); } - String correctPassword = foundCustomerServices.get(0).getPassword(); - return new SimpleAuthenticationInfo(email, correctPassword, getName()); + CustomerService foundCustomerService = foundCustomerServices.get(0); + return new SimpleAuthenticationInfo(foundCustomerService.getCustomerServiceId(), foundCustomerService.getPassword(), getName()); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/AttendanceStatisticsController.java b/src/main/java/com/cloudservice/ccs/controller/AttendanceStatisticsController.java index ee674e134d093cf754237a07a2000dd4b91f3268..8e603ba1adb4f9e4c5a3351ff01aa149aef9134f 100644 --- a/src/main/java/com/cloudservice/ccs/controller/AttendanceStatisticsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/AttendanceStatisticsController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IAttendanceStatisticsBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.AttendanceStatistics; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -18,31 +19,40 @@ public class AttendanceStatisticsController { private IAttendanceStatisticsBiz attendanceStatisticsBiz; @PostMapping("/") - void save(@RequestBody AttendanceStatistics attendanceStatistics) { + public ApiResult save(@RequestBody AttendanceStatistics attendanceStatistics) { // 接口问题待讨论:是否应当返回生成的 id? attendanceStatisticsBiz.save(attendanceStatistics); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody AttendanceStatistics attendanceStatistics) { + public ApiResult update(@PathVariable Integer id, @RequestBody AttendanceStatistics attendanceStatistics) { attendanceStatisticsBiz.update(id, attendanceStatistics); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + attendanceStatisticsBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { attendanceStatisticsBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { AttendanceStatistics result = attendanceStatisticsBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("attendance-statistics", attendanceStatisticsBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = attendanceStatisticsBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/BlackListController.java b/src/main/java/com/cloudservice/ccs/controller/BlackListController.java index e08fcf0a69d65e45c1d608b8a1db2298e7a9e127..7793a776712468040df1457adbe211149041804d 100644 --- a/src/main/java/com/cloudservice/ccs/controller/BlackListController.java +++ b/src/main/java/com/cloudservice/ccs/controller/BlackListController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IBlackListBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.BlackList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -18,31 +19,41 @@ public class BlackListController { private IBlackListBiz blackListBiz; @PostMapping("/") - void save(@RequestBody BlackList blackList) { + public ApiResult save(@RequestBody BlackList blackList) { // 接口问题待讨论:是否应当返回生成的 id? blackListBiz.save(blackList); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody BlackList blackList) { + public ApiResult update(@PathVariable Integer id, @RequestBody BlackList blackList) { blackListBiz.update(id, blackList); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { blackListBiz.delete(id); + return ApiResult.success(); + } + + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + blackListBiz.partialUpdate(id, fields); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { BlackList result = blackListBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("black-list", blackListBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = blackListBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/CommonWordController.java b/src/main/java/com/cloudservice/ccs/controller/CommonWordController.java index 2e5a5f507faae58372fa3147c11ea86f3e07fcf8..b62bd44c519776eb64da0f198d88a5150344d336 100644 --- a/src/main/java/com/cloudservice/ccs/controller/CommonWordController.java +++ b/src/main/java/com/cloudservice/ccs/controller/CommonWordController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.ICommonWordBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.CommonWord; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -14,35 +15,44 @@ import java.util.Map; @RestController @RequestMapping("/common-word") public class CommonWordController { - @Autowired - private ICommonWordBiz commonWordBiz; + @Autowired + private ICommonWordBiz commonWordBiz; - @PostMapping("/") - void save(@RequestBody CommonWord commonWord) { + @PostMapping("/") + public ApiResult save(@RequestBody CommonWord commonWord) { // 接口问题待讨论:是否应当返回生成的 id? - commonWordBiz.save(commonWord); - } - -@PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody CommonWord commonWord) { - commonWordBiz.update(id, commonWord); - } - -@DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { - commonWordBiz.delete(id); - } - -@GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { - CommonWord result = commonWordBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); - } - -@GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("common-word", commonWordBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); - } + commonWordBiz.save(commonWord); + return ApiResult.success(); + } + + @PutMapping("/{id}") + public ApiResult update(@PathVariable Integer id, @RequestBody CommonWord commonWord) { + commonWordBiz.update(id, commonWord); + return ApiResult.success(); + } + + @DeleteMapping("/{id}") + public ApiResult delete(@PathVariable Integer id) { + commonWordBiz.delete(id); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + commonWordBiz.partialUpdate(id, fields); + return ApiResult.success(); + } + + @GetMapping("/{id}") + public ApiResult queryById(@PathVariable Integer id) { + CommonWord result = commonWordBiz.getOne(id); + return ApiResult.successWithData(result); + } + + @GetMapping("/") + public ApiResult queryAll() { + List result = commonWordBiz.getAll(); + return ApiResult.successWithData(result); + } } diff --git a/src/main/java/com/cloudservice/ccs/controller/CustomerInfoController.java b/src/main/java/com/cloudservice/ccs/controller/CustomerInfoController.java index 8ff60d67b2f455cca20236c61ae3dd40554b602e..b356619b93bbb6463db18927036bb10c79af289d 100644 --- a/src/main/java/com/cloudservice/ccs/controller/CustomerInfoController.java +++ b/src/main/java/com/cloudservice/ccs/controller/CustomerInfoController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.ICustomerInfoBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.CustomerInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -18,31 +19,39 @@ public class CustomerInfoController { private ICustomerInfoBiz customerInfoBiz; @PostMapping("/") - void save(@RequestBody CustomerInfo customerInfo) { + public ApiResult save(@RequestBody CustomerInfo customerInfo) { // 接口问题待讨论:是否应当返回生成的 id? customerInfoBiz.save(customerInfo); + return ApiResult.success(); } @PutMapping("/{email}") - void update(@PathVariable String email, @RequestBody CustomerInfo customerInfo) { - customerInfoBiz.update(email, customerInfo); + public ApiResult update(@PathVariable Integer id, @RequestBody CustomerInfo customerInfo) { + customerInfoBiz.update(id, customerInfo); + return ApiResult.success(); } @DeleteMapping("/{email}") - void delete(@PathVariable String email) { - customerInfoBiz.delete(email); + public ApiResult delete(@PathVariable Integer id) { + customerInfoBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{email}") - ResponseEntity queryById(@PathVariable String email) { - CustomerInfo result = customerInfoBiz.getOne(email); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryById(@PathVariable Integer id) { + CustomerInfo result = customerInfoBiz.getOne(id); + return ApiResult.successWithData(result); } @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("customer-info", customerInfoBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = customerInfoBiz.getAll(); + return ApiResult.successWithData(result); + } + + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + customerInfoBiz.partialUpdate(id, fields); + return ApiResult.success(); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/CustomerServiceController.java b/src/main/java/com/cloudservice/ccs/controller/CustomerServiceController.java index ef5d7ae011f31a308f71c0f79cc70b9ac51acc92..cc74bb7342e15410e28ca7acea651751310c53ba 100644 --- a/src/main/java/com/cloudservice/ccs/controller/CustomerServiceController.java +++ b/src/main/java/com/cloudservice/ccs/controller/CustomerServiceController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.ICustomerServiceBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.CustomerService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -17,45 +18,48 @@ import java.util.Map; public class CustomerServiceController { @Autowired - ICustomerServiceBiz customerServiceBiz; + private ICustomerServiceBiz customerServiceBiz; // @RequiresPermissions("all") @PostMapping("/") - void save(@RequestBody CustomerService customerService) { + public ApiResult save(@RequestBody CustomerService customerService) { // 接口问题待讨论:是否应当返回生成的 id? customerServiceBiz.save(customerService); + return ApiResult.success(); } // @RequiresPermissions("all") @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody CustomerService customerService) { + public ApiResult update(@PathVariable Integer id, @RequestBody CustomerService customerService) { customerServiceBiz.update(id, customerService); + return ApiResult.success(); } // @RequiresPermissions("all") @PutMapping("/{id}/partial") - void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { customerServiceBiz.partialUpdate(id, fields); + return ApiResult.success(); } // @RequiresPermissions("all") @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { customerServiceBiz.delete(id); + return ApiResult.success(); } // @RequiresPermissions("all") @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { CustomerService result = customerServiceBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } // @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("customer-services", customerServiceBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = customerServiceBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/GroupManageController.java b/src/main/java/com/cloudservice/ccs/controller/GroupManageController.java index 873c3c6bca5f869f8b545c03c46ff32217d7281f..5bef465fad34752e76620fc4921162c830f4955b 100644 --- a/src/main/java/com/cloudservice/ccs/controller/GroupManageController.java +++ b/src/main/java/com/cloudservice/ccs/controller/GroupManageController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IGroupManageBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.GroupManage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -15,33 +16,42 @@ import java.util.Map; @RequestMapping("/group-manage") public class GroupManageController { @Autowired - IGroupManageBiz groupManageBiz; + private IGroupManageBiz groupManageBiz; @PostMapping("/") - void save(@RequestBody GroupManage groupManage) { + public ApiResult save(@RequestBody GroupManage groupManage) { groupManageBiz.save(groupManage); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody GroupManage groupManage) { + public ApiResult update(@PathVariable Integer id, @RequestBody GroupManage groupManage) { groupManageBiz.update(id, groupManage); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { groupManageBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { GroupManage result = groupManageBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("group-manage", groupManageBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = groupManageBiz.getAll(); + return ApiResult.successWithData(result); } + + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + groupManageBiz.partialUpdate(id, fields); + return ApiResult.success(); + } + } diff --git a/src/main/java/com/cloudservice/ccs/controller/LoginController.java b/src/main/java/com/cloudservice/ccs/controller/LoginController.java index 0d5189ca3735ee890f28503640334de384230a79..c3ed33687a1eb5d03c0136c538ea78347a073aaf 100644 --- a/src/main/java/com/cloudservice/ccs/controller/LoginController.java +++ b/src/main/java/com/cloudservice/ccs/controller/LoginController.java @@ -1,9 +1,14 @@ package com.cloudservice.ccs.controller; +import com.cloudservice.ccs.biz.ICustomerServiceBiz; +import com.cloudservice.ccs.entity.ApiResult; +import com.cloudservice.ccs.entity.CustomerService; import com.cloudservice.ccs.entity.LoginData; +import com.cloudservice.ccs.mapper.CustomerServiceMapper; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.*; import org.apache.shiro.subject.Subject; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; @@ -16,23 +21,33 @@ import java.util.Map; @RestController public class LoginController { + @Autowired + private ICustomerServiceBiz customerServiceBiz; + + @Autowired + private CustomerServiceMapper customerServiceMapper; + @PostMapping("/login") - public ResponseEntity> doLogin(@RequestBody LoginData loginData){ + public ApiResult doLogin(@RequestBody LoginData loginData) { String email = loginData.getEmail(), password = loginData.getPassword(); Subject subject = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(email,password); subject.login(token); - Map map = new HashMap<>(1); - map.put("result", "success"); - return new ResponseEntity<>(map, HttpStatus.OK); + Map map = new HashMap<>(); + map.put("email", email); + return ApiResult.successWithData(customerServiceMapper.getWithConditions(map).get(0)); } @PostMapping("/logout") - public ResponseEntity> doLogout() { + public ApiResult doLogout() { Subject subject = SecurityUtils.getSubject(); subject.logout(); - Map map = new HashMap<>(1); - map.put("result", "success"); - return new ResponseEntity<>(map, HttpStatus.OK); + return ApiResult.success(); + } + + @PostMapping("/register") + public ApiResult doRegister(@RequestBody CustomerService customerService) { + customerServiceBiz.save(customerService); + return ApiResult.success(); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/NoticeController.java b/src/main/java/com/cloudservice/ccs/controller/NoticeController.java index 78c8b1a7feb0eab6d116894809326b0e36b49af9..b589f2c9a05543602969b8c2c81f552f54111663 100644 --- a/src/main/java/com/cloudservice/ccs/controller/NoticeController.java +++ b/src/main/java/com/cloudservice/ccs/controller/NoticeController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.INoticeBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.Notice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -16,33 +17,42 @@ import java.util.Map; public class NoticeController { @Autowired - INoticeBiz noticeBiz; + private INoticeBiz noticeBiz; @PostMapping("/") - void save(@RequestBody Notice notice) { + public ApiResult save(@RequestBody Notice notice) { noticeBiz.save(notice); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody Notice notice) { + private ApiResult update(@PathVariable Integer id, @RequestBody Notice notice) { noticeBiz.update(id, notice); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + noticeBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { noticeBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { Notice result = noticeBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("notice", noticeBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = noticeBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/RoleManageController.java b/src/main/java/com/cloudservice/ccs/controller/RoleManageController.java index ec57b7dca0fb37533603dfe4905fd9401d37a429..f975798613e279c406016432b9d181ba7bff1fac 100644 --- a/src/main/java/com/cloudservice/ccs/controller/RoleManageController.java +++ b/src/main/java/com/cloudservice/ccs/controller/RoleManageController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IRoleManageBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.RoleManage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -16,33 +17,42 @@ import java.util.Map; public class RoleManageController { @Autowired - IRoleManageBiz roleManageBiz; + private IRoleManageBiz roleManageBiz; @PostMapping("/") - void save(@RequestBody RoleManage roleManage) { + public ApiResult save(@RequestBody RoleManage roleManage) { roleManageBiz.save(roleManage); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody RoleManage roleManage) { + public ApiResult update(@PathVariable Integer id, @RequestBody RoleManage roleManage) { roleManageBiz.update(id, roleManage); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + roleManageBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { roleManageBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { RoleManage result = roleManageBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("role-manage", roleManageBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = roleManageBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/SessionController.java b/src/main/java/com/cloudservice/ccs/controller/SessionController.java index 56d88f8771b7dda83fe28f88d438290379291b7e..3f720b99c83e8c541f310b59d9ba5312ca9af161 100644 --- a/src/main/java/com/cloudservice/ccs/controller/SessionController.java +++ b/src/main/java/com/cloudservice/ccs/controller/SessionController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.ISessionBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.Session; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -16,33 +17,42 @@ import java.util.Map; public class SessionController { @Autowired - ISessionBiz sessionBiz; + private ISessionBiz sessionBiz; @PostMapping("/") - void save(@RequestBody Session session) { + public ApiResult save(@RequestBody Session session) { sessionBiz.save(session); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody Session session) { + public ApiResult update(@PathVariable Integer id, @RequestBody Session session) { sessionBiz.update(id, session); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + sessionBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { sessionBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { Session result = sessionBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("session", sessionBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = sessionBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/SessionMessageController.java b/src/main/java/com/cloudservice/ccs/controller/SessionMessageController.java index 5732685c77929d8d8729793b37c1146d496eb3b2..c81cb59bbfefea28b2794e6db03e40ad95f8b8de 100644 --- a/src/main/java/com/cloudservice/ccs/controller/SessionMessageController.java +++ b/src/main/java/com/cloudservice/ccs/controller/SessionMessageController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.ISessionMessageBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.SessionMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -16,33 +17,42 @@ import java.util.Map; public class SessionMessageController { @Autowired - ISessionMessageBiz sessionMessageBiz; + private ISessionMessageBiz sessionMessageBiz; @PostMapping("/") - void save(@RequestBody SessionMessage sessionMessage) { + public ApiResult save(@RequestBody SessionMessage sessionMessage) { sessionMessageBiz.save(sessionMessage); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody SessionMessage sessionMessage) { + public ApiResult update(@PathVariable Integer id, @RequestBody SessionMessage sessionMessage) { sessionMessageBiz.update(id, sessionMessage); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + sessionMessageBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { sessionMessageBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { SessionMessage result = sessionMessageBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("session-message", sessionMessageBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = sessionMessageBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/SystemMessageController.java b/src/main/java/com/cloudservice/ccs/controller/SystemMessageController.java index 336b8a77627820b724755f00d34b4b182d605b93..2222ad97b88045936fa2950bce986169ae2cbfd8 100644 --- a/src/main/java/com/cloudservice/ccs/controller/SystemMessageController.java +++ b/src/main/java/com/cloudservice/ccs/controller/SystemMessageController.java @@ -2,6 +2,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.ISystemMessageBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.SystemMessage; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -17,35 +18,44 @@ import java.util.Map; @RequestMapping("/system-message") public class SystemMessageController { @Autowired - ISystemMessageBiz systemMessageBiz; + private ISystemMessageBiz systemMessageBiz; @PostMapping("/") - void save(@RequestBody SystemMessage systemMessage) { + public ApiResult save(@RequestBody SystemMessage systemMessage) { // 接口问题待讨论:是否应当返回生成的 id? systemMessageBiz.save(systemMessage); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody SystemMessage systemMessage) { + public ApiResult update(@PathVariable Integer id, @RequestBody SystemMessage systemMessage) { systemMessageBiz.update(id, systemMessage); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + systemMessageBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { systemMessageBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { SystemMessage result = systemMessageBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("system-message", systemMessageBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = systemMessageBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/TagsController.java b/src/main/java/com/cloudservice/ccs/controller/TagsController.java index 05e93d973771a11f70e2cb2f8bf63d9206200b18..f44c22d8439719830b2fc1a65c8088d16d5c1981 100644 --- a/src/main/java/com/cloudservice/ccs/controller/TagsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/TagsController.java @@ -2,6 +2,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.ITagsBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.Tags; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -17,35 +18,44 @@ import java.util.Map; @RequestMapping("/tags") public class TagsController { @Autowired - ITagsBiz tagsBiz; + private ITagsBiz tagsBiz; @PostMapping("/") - void save(@RequestBody Tags tags) { + public ApiResult save(@RequestBody Tags tags) { // 接口问题待讨论:是否应当返回生成的 id? tagsBiz.save(tags); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody Tags tags) { + public ApiResult update(@PathVariable Integer id, @RequestBody Tags tags) { tagsBiz.update(id, tags); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + tagsBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { tagsBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { Tags result = tagsBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("tags", tagsBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = tagsBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/ViewStatisticsController.java b/src/main/java/com/cloudservice/ccs/controller/ViewStatisticsController.java index eb554e8cd9ccfb5687abdf92340826e6cfb0fcb9..3000b831e2885c72ff3dfedcdbaa8b9fdb51e216 100644 --- a/src/main/java/com/cloudservice/ccs/controller/ViewStatisticsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/ViewStatisticsController.java @@ -3,6 +3,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.ITagsBiz; import com.cloudservice.ccs.biz.IViewStatisticsBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.Tags; import com.cloudservice.ccs.entity.ViewStatistics; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -19,35 +20,44 @@ import java.util.Map; @RequestMapping("/view-statistics") public class ViewStatisticsController { @Autowired - IViewStatisticsBiz viewStatisticsBiz; + private IViewStatisticsBiz viewStatisticsBiz; @PostMapping("/") - void save(@RequestBody ViewStatistics viewStatistics) { + public ApiResult save(@RequestBody ViewStatistics viewStatistics) { // 接口问题待讨论:是否应当返回生成的 id? viewStatisticsBiz.save(viewStatistics); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody ViewStatistics viewStatistics) { + public ApiResult update(@PathVariable Integer id, @RequestBody ViewStatistics viewStatistics) { viewStatisticsBiz.update(id, viewStatistics); + return ApiResult.success(); + } + + // @RequiresPermissions("all") + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + viewStatisticsBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { viewStatisticsBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { ViewStatistics result = viewStatisticsBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("view-statistics", viewStatisticsBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = viewStatisticsBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/VisitorInfoController.java b/src/main/java/com/cloudservice/ccs/controller/VisitorInfoController.java index ed0be282e0c60140edf3f5e20818286b5e39a6ee..80bce27999ad2782ab179042a3f22a5561d2f009 100644 --- a/src/main/java/com/cloudservice/ccs/controller/VisitorInfoController.java +++ b/src/main/java/com/cloudservice/ccs/controller/VisitorInfoController.java @@ -2,6 +2,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IVisitorInfoBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.VisitorInfo; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -17,35 +18,43 @@ import java.util.Map; @RequestMapping("/visitor-info") public class VisitorInfoController { @Autowired - IVisitorInfoBiz visitorInfoBiz; + private IVisitorInfoBiz visitorInfoBiz; @PostMapping("/") - void save(@RequestBody VisitorInfo visitorInfo) { + public ApiResult save(@RequestBody VisitorInfo visitorInfo) { // 接口问题待讨论:是否应当返回生成的 id? visitorInfoBiz.save(visitorInfo); + return ApiResult.success(); } - @PutMapping("/{ip}") - void update(@PathVariable String ip, @RequestBody VisitorInfo visitorInfo) { - visitorInfoBiz.update(ip, visitorInfo); + @PutMapping("/{id}") + public ApiResult update(@PathVariable Integer id, @RequestBody VisitorInfo visitorInfo) { + visitorInfoBiz.update(id, visitorInfo); + return ApiResult.success(); } - @DeleteMapping("/{ip}") - void delete(@PathVariable String ip) { - visitorInfoBiz.delete(ip); + @DeleteMapping("/{id}") + public ApiResult delete(@PathVariable Integer id) { + visitorInfoBiz.delete(id); + return ApiResult.success(); } - @GetMapping("/{ip}") - ResponseEntity queryById(@PathVariable String ip) { - VisitorInfo result = visitorInfoBiz.getOne(ip); - return new ResponseEntity<>(result, HttpStatus.OK); + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + visitorInfoBiz.partialUpdate(id, fields); + return ApiResult.success(); + } + + @GetMapping("/{id}") + public ApiResult queryById(@PathVariable Integer id) { + VisitorInfo result = visitorInfoBiz.getOne(id); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("visitor-info", visitorInfoBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = visitorInfoBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkLogController.java b/src/main/java/com/cloudservice/ccs/controller/WorkLogController.java index aeae5ff27e959e76e49f2e0fa3ca8bc88c909091..1264661f6d3a3a1f8077e18ef81bee53a6ca1dfa 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkLogController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkLogController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IWorkLogBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.CustomerService; import com.cloudservice.ccs.entity.WorkLog; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -16,40 +17,43 @@ import java.util.Map; @RequestMapping("work-log") public class WorkLogController { @Autowired - IWorkLogBiz workLogBiz; + private IWorkLogBiz workLogBiz; @PostMapping("/") - void save(@RequestBody WorkLog workLog) { + public ApiResult save(@RequestBody WorkLog workLog) { // 接口问题待讨论:是否应当返回生成的 id? workLogBiz.save(workLog); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody WorkLog workLog) { + public ApiResult update(@PathVariable Integer id, @RequestBody WorkLog workLog) { workLogBiz.update(id, workLog); + return ApiResult.success(); } @PutMapping("/{id}/partial") - void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { workLogBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { workLogBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { WorkLog result = workLogBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("customer-services", workLogBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = workLogBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkOrderController.java b/src/main/java/com/cloudservice/ccs/controller/WorkOrderController.java index 5ab4ba94ef0cd1b553daf6375f7f4a87ee41b89e..5918c28b49fc9596592ef1c59699705afa098a75 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkOrderController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkOrderController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IWorkOrderBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.WorkOrder; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -14,40 +15,43 @@ import java.util.Map; public class WorkOrderController { @Autowired - IWorkOrderBiz workOrderBiz; + private IWorkOrderBiz workOrderBiz; @PostMapping("/") - void save(@RequestBody WorkOrder workOrder) { + public ApiResult save(@RequestBody WorkOrder workOrder) { // 接口问题待讨论:是否应当返回生成的 id? workOrderBiz.save(workOrder); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody WorkOrder workOrder) { + public ApiResult update(@PathVariable Integer id, @RequestBody WorkOrder workOrder) { workOrderBiz.update(id, workOrder); + return ApiResult.success(); } @PutMapping("/{id}/partial") - void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { workOrderBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { workOrderBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { WorkOrder result = workOrderBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("customer-services", workOrderBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = workOrderBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkOrderReplyController.java b/src/main/java/com/cloudservice/ccs/controller/WorkOrderReplyController.java index ec1023569fff5095dfb68ebb90afd750cb7383a5..b208c3e082280acdb244ed821f45d426db5fd9a8 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkOrderReplyController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkOrderReplyController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IWorkOrderReplyBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.WorkOrderReply; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -14,40 +15,43 @@ import java.util.Map; public class WorkOrderReplyController { @Autowired - IWorkOrderReplyBiz workOrderReplyBiz; + private IWorkOrderReplyBiz workOrderReplyBiz; @PostMapping("/") - void save(@RequestBody WorkOrderReply workOrderReply) { + public ApiResult save(@RequestBody WorkOrderReply workOrderReply) { // 接口问题待讨论:是否应当返回生成的 id? workOrderReplyBiz.save(workOrderReply); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody WorkOrderReply workOrderReply) { + public ApiResult update(@PathVariable Integer id, @RequestBody WorkOrderReply workOrderReply) { workOrderReplyBiz.update(id, workOrderReply); + return ApiResult.success(); } @PutMapping("/{id}/partial") - void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { workOrderReplyBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { workOrderReplyBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { WorkOrderReply result = workOrderReplyBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("customer-services", workOrderReplyBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = workOrderReplyBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkQualityStatisticsController.java b/src/main/java/com/cloudservice/ccs/controller/WorkQualityStatisticsController.java index 3ee147835ace2bb5b166ec82629b627135f29a47..55fea645215548b07170f326280e139c901dd8b5 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkQualityStatisticsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkQualityStatisticsController.java @@ -1,6 +1,7 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IWorkQualityStatisticsBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.WorkQualityStatistics; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -14,40 +15,43 @@ import java.util.Map; public class WorkQualityStatisticsController { @Autowired - IWorkQualityStatisticsBiz workQualityStatisticsBiz; + private IWorkQualityStatisticsBiz workQualityStatisticsBiz; @PostMapping("/") - void save(@RequestBody WorkQualityStatistics workQualityStatistics) { + public ApiResult save(@RequestBody WorkQualityStatistics workQualityStatistics) { // 接口问题待讨论:是否应当返回生成的 id? workQualityStatisticsBiz.save(workQualityStatistics); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody WorkQualityStatistics workQualityStatistics) { + public ApiResult update(@PathVariable Integer id, @RequestBody WorkQualityStatistics workQualityStatistics) { workQualityStatisticsBiz.update(id, workQualityStatistics); + return ApiResult.success(); } @PutMapping("/{id}/partial") - void partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { workQualityStatisticsBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { workQualityStatisticsBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { WorkQualityStatistics result = workQualityStatisticsBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("customer-services", workQualityStatisticsBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = workQualityStatisticsBiz.getAll(); + return ApiResult.successWithData(result); } } diff --git a/src/main/java/com/cloudservice/ccs/controller/WorkloadStatisticsController.java b/src/main/java/com/cloudservice/ccs/controller/WorkloadStatisticsController.java index 20dd44bbeba725d0b6eae3442be8a8a09d6cb3b1..5ffdd2ce5ce79315837fcee811319c8df2414d72 100644 --- a/src/main/java/com/cloudservice/ccs/controller/WorkloadStatisticsController.java +++ b/src/main/java/com/cloudservice/ccs/controller/WorkloadStatisticsController.java @@ -2,13 +2,16 @@ package com.cloudservice.ccs.controller; import com.cloudservice.ccs.biz.IWorkloadStatisticsBiz; +import com.cloudservice.ccs.entity.ApiResult; import com.cloudservice.ccs.entity.WorkloadStatistics; +import com.cloudservice.ccs.entity.WorkloadStatisticsWithAverage; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -17,35 +20,54 @@ import java.util.Map; @RequestMapping("/workload-statistics") public class WorkloadStatisticsController { @Autowired - IWorkloadStatisticsBiz workloadStatisticsBiz; + private IWorkloadStatisticsBiz workloadStatisticsBiz; @PostMapping("/") - void save(@RequestBody WorkloadStatistics workloadStatistics) { + public ApiResult save(@RequestBody WorkloadStatistics workloadStatistics) { // 接口问题待讨论:是否应当返回生成的 id? workloadStatisticsBiz.save(workloadStatistics); + return ApiResult.success(); } @PutMapping("/{id}") - void update(@PathVariable Integer id, @RequestBody WorkloadStatistics workloadStatistics) { + public ApiResult update(@PathVariable Integer id, @RequestBody WorkloadStatistics workloadStatistics) { workloadStatisticsBiz.update(id, workloadStatistics); + return ApiResult.success(); + } + + @PutMapping("/{id}/partial") + public ApiResult partialUpdate(@PathVariable Integer id, @RequestBody Map fields) { + workloadStatisticsBiz.partialUpdate(id, fields); + return ApiResult.success(); } @DeleteMapping("/{id}") - void delete(@PathVariable Integer id) { + public ApiResult delete(@PathVariable Integer id) { workloadStatisticsBiz.delete(id); + return ApiResult.success(); } @GetMapping("/{id}") - ResponseEntity queryById(@PathVariable Integer id) { + public ApiResult queryById(@PathVariable Integer id) { WorkloadStatistics result = workloadStatisticsBiz.getOne(id); - return new ResponseEntity<>(result, HttpStatus.OK); + return ApiResult.successWithData(result); } @RequiresPermissions("all") @GetMapping("/") - ResponseEntity>> queryAll() { - Map> result = new HashMap<>(); - result.put("workload-statistics", workloadStatisticsBiz.getAll()); - return new ResponseEntity<>(result, HttpStatus.OK); + public ApiResult queryAll() { + List result = workloadStatisticsBiz.getAll(); + return ApiResult.successWithData(result); + } + + @GetMapping("/with-average") + public ApiResult queryAllWithAverage() { + List result = workloadStatisticsBiz.getAllWithAverage(); + return ApiResult.successWithData(result); + } + + @GetMapping("/aggregation") + public ApiResult queryAggregation() { + return ApiResult.successWithData(workloadStatisticsBiz.getAggregation()); } } diff --git a/src/main/java/com/cloudservice/ccs/entity/ApiResult.java b/src/main/java/com/cloudservice/ccs/entity/ApiResult.java new file mode 100644 index 0000000000000000000000000000000000000000..e089ac4577b485d3eb6f2fbb318bc8775c0d9251 --- /dev/null +++ b/src/main/java/com/cloudservice/ccs/entity/ApiResult.java @@ -0,0 +1,30 @@ +package com.cloudservice.ccs.entity; + +import com.cloudservice.ccs.util.Constant; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class ApiResult { + + private String error; + + private Object data; + + public static ApiResult success() { + return new ApiResult(null, null); + } + + public static ApiResult successWithData(Object data) { + return new ApiResult(null, data); + } + + public static ApiResult failure() { + return new ApiResult(Constant.DEFAULT_ERROR_MESSAGE, null); + } + + public static ApiResult failureWithData(Object data) { + return new ApiResult(Constant.DEFAULT_ERROR_MESSAGE, data); + } +} diff --git a/src/main/java/com/cloudservice/ccs/entity/BlackList.java b/src/main/java/com/cloudservice/ccs/entity/BlackList.java index 00507fa15d1437bd429f2f7660b2676e501d3b3d..516dc21264b2fe016b8e02710212c317b2276e48 100644 --- a/src/main/java/com/cloudservice/ccs/entity/BlackList.java +++ b/src/main/java/com/cloudservice/ccs/entity/BlackList.java @@ -14,4 +14,5 @@ public class BlackList { @DateTimeFormat(pattern = "yyyy-MM-dd") private Date time; private String source; + private int id; } diff --git a/src/main/java/com/cloudservice/ccs/entity/CommonWord.java b/src/main/java/com/cloudservice/ccs/entity/CommonWord.java index 61300a56f20fc33b1f60ad24663d0fcd76ff61d1..e9a821a9575f82b8625abd339ad31bf00dc11873 100644 --- a/src/main/java/com/cloudservice/ccs/entity/CommonWord.java +++ b/src/main/java/com/cloudservice/ccs/entity/CommonWord.java @@ -7,5 +7,5 @@ public class CommonWord { private String content; private String lib; private String type; - private Integer creatorId; + private Integer id; } diff --git a/src/main/java/com/cloudservice/ccs/entity/CustomerInfo.java b/src/main/java/com/cloudservice/ccs/entity/CustomerInfo.java index 67efd4d70f237b05e0e18ff1aaa85006d86959de..b6704f980eb830096b29d91c1071e8f5dd31ac3e 100644 --- a/src/main/java/com/cloudservice/ccs/entity/CustomerInfo.java +++ b/src/main/java/com/cloudservice/ccs/entity/CustomerInfo.java @@ -7,6 +7,7 @@ import java.util.Date; @Data public class CustomerInfo { + private Integer id; private String state; private String visitorName; private String realName; diff --git a/src/main/java/com/cloudservice/ccs/entity/CustomerService.java b/src/main/java/com/cloudservice/ccs/entity/CustomerService.java index 8d15fbb7a7cc98d91c706b4bf7a4645ea9dfb24e..6a8638763ee5b6825185b90490605a78a78a33d7 100644 --- a/src/main/java/com/cloudservice/ccs/entity/CustomerService.java +++ b/src/main/java/com/cloudservice/ccs/entity/CustomerService.java @@ -7,7 +7,6 @@ import java.util.Date; @Data public class CustomerService { - private String phone; private String password; private String state; private String headImg; diff --git a/src/main/java/com/cloudservice/ccs/entity/ErrorResponse.java b/src/main/java/com/cloudservice/ccs/entity/ErrorResponse.java deleted file mode 100644 index bad8d26c62c209f8ccc08d79b0f8e3ac03c55ca0..0000000000000000000000000000000000000000 --- a/src/main/java/com/cloudservice/ccs/entity/ErrorResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.cloudservice.ccs.entity; - -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.Data; - -import java.util.Date; - -@Data -public class ErrorResponse { - private Date timestamp; - private String exception; - private Integer status; - private String error; - private String message; -} diff --git a/src/main/java/com/cloudservice/ccs/entity/WorkloadStatisticsAggregation.java b/src/main/java/com/cloudservice/ccs/entity/WorkloadStatisticsAggregation.java new file mode 100644 index 0000000000000000000000000000000000000000..3ad99ed95a7bdfc42bd9864eb166e08e93386e96 --- /dev/null +++ b/src/main/java/com/cloudservice/ccs/entity/WorkloadStatisticsAggregation.java @@ -0,0 +1,16 @@ +package com.cloudservice.ccs.entity; + +import lombok.Data; + +@Data +public class WorkloadStatisticsAggregation { + private Integer totalMessageCount; + private Integer totalSessionCount; + private Integer averageMessageCount; + private Integer totalSessionTime; + private Integer averageSessionTime; + private Integer totalEffectiveMessageCount; + private Integer totalEndSessionCount; + private Integer maxMessageCount; + private Integer maxSessionTime; +} diff --git a/src/main/java/com/cloudservice/ccs/entity/WorkloadStatisticsWithAverage.java b/src/main/java/com/cloudservice/ccs/entity/WorkloadStatisticsWithAverage.java new file mode 100644 index 0000000000000000000000000000000000000000..eff4cc7531f725c4027ea65c7d1ef5ac511b604d --- /dev/null +++ b/src/main/java/com/cloudservice/ccs/entity/WorkloadStatisticsWithAverage.java @@ -0,0 +1,29 @@ +package com.cloudservice.ccs.entity; + +import lombok.Builder; +import lombok.Data; + +@Data +public class WorkloadStatisticsWithAverage extends WorkloadStatistics { + + private Integer averageSessionTime; + + private Integer averageMessageCount; + + public static WorkloadStatisticsWithAverage fromWorkloadStatistics(WorkloadStatistics workloadStatistics) { + WorkloadStatisticsWithAverage res = new WorkloadStatisticsWithAverage(); + res.setId(workloadStatistics.getId()); + res.setNickName(workloadStatistics.getNickName()); + res.setTotalMessageCount(workloadStatistics.getTotalMessageCount()); + res.setTotalSessionCount(workloadStatistics.getTotalSessionCount()); + res.setTotalEffectiveSessionCount(workloadStatistics.getTotalEffectiveSessionCount()); + res.setTotalEndSessionCount(workloadStatistics.getTotalEndSessionCount()); + res.setTotalSessionTime(workloadStatistics.getTotalSessionTime()); + return res; + } + + public void calculateAverage() { + this.setAverageSessionTime(this.getTotalSessionTime() / this.getTotalSessionCount()); + this.setAverageMessageCount(this.getTotalMessageCount() / this.getTotalSessionCount()); + } +} diff --git a/src/main/java/com/cloudservice/ccs/exception/BaseException.java b/src/main/java/com/cloudservice/ccs/exception/BaseException.java index 8956c62cc85c8240d315c79ac580c6e0b6458046..79aa4de11d044f7556bd7dc26a7164f46e1255ca 100644 --- a/src/main/java/com/cloudservice/ccs/exception/BaseException.java +++ b/src/main/java/com/cloudservice/ccs/exception/BaseException.java @@ -1,15 +1,12 @@ package com.cloudservice.ccs.exception; +import com.cloudservice.ccs.util.Constant; import lombok.Data; import org.springframework.http.HttpStatus; @Data public class BaseException extends RuntimeException { - private String error = "General error"; - - private Integer status = 400; - - private HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR; + private String error = Constant.DEFAULT_ERROR_MESSAGE; public BaseException(String message) { super(message); diff --git a/src/main/java/com/cloudservice/ccs/exception/GlobalExceptionHandler.java b/src/main/java/com/cloudservice/ccs/exception/GlobalExceptionHandler.java index 8fb30eac1f8761fd548847713b2fd626954adbbb..161956b1c8d7b1cfccb75066fca7a06506684dda 100644 --- a/src/main/java/com/cloudservice/ccs/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/cloudservice/ccs/exception/GlobalExceptionHandler.java @@ -1,16 +1,14 @@ package com.cloudservice.ccs.exception; -import com.cloudservice.ccs.entity.ErrorResponse; +import com.cloudservice.ccs.entity.ApiResult; import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.UnknownAccountException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import java.util.Date; - @RestControllerAdvice public class GlobalExceptionHandler { @@ -18,38 +16,38 @@ public class GlobalExceptionHandler { /** * 处理 BaseException(以及其子类)并返回对应的错误响应 - * 剩余的异常由 Spring Boot 处理 */ @ExceptionHandler(BaseException.class) - public ResponseEntity handleBaseException(BaseException e) { - if (logger.isDebugEnabled()) { - logger.debug(e.getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(); - } - ErrorResponse errorResponse = new ErrorResponse(); - errorResponse.setTimestamp(new Date()); - errorResponse.setException(e.getClass().getName()); - errorResponse.setStatus(e.getStatus()); - errorResponse.setError(e.getError()); - errorResponse.setMessage(e.getMessage()); - return new ResponseEntity<>(errorResponse, e.getHttpStatus()); + public ApiResult handleBaseException(BaseException e) { + logException(e); + return new ApiResult(e.getError(), e.getMessage()); } /** * 处理认证、鉴权相关异常并返回对应的错误响应 */ @ExceptionHandler(AuthenticationException.class) - public ResponseEntity handleAuthenticationException(AuthenticationException e) { + public ApiResult handleException(AuthenticationException e) { + logException(e); + if (e instanceof UnknownAccountException) { + return ApiResult.failureWithData("未知用户"); + } else if (e instanceof IncorrectCredentialsException) { + return ApiResult.failureWithData("用户名或密码错误"); + } else { + return ApiResult.failureWithData("未知认证错误:" + e.getClass().getName() + ": " + e.getMessage()); + } + } + + @ExceptionHandler(Exception.class) + public ApiResult handleException(Exception e) { + logException(e); + return ApiResult.failureWithData("未知错误:" + e.getClass().getName() + ": " + e.getMessage()); + } + + private void logException(Exception e) { if (logger.isDebugEnabled()) { logger.debug(e.getClass().getName() + ": " + e.getMessage()); e.printStackTrace(); } - ErrorResponse errorResponse = new ErrorResponse(); - errorResponse.setTimestamp(new Date()); - errorResponse.setException(e.getClass().getName()); - errorResponse.setStatus(400); - errorResponse.setError("Authentication failure"); - errorResponse.setMessage(e.getMessage()); - return new ResponseEntity<>(errorResponse, HttpStatus.FORBIDDEN); } } diff --git a/src/main/java/com/cloudservice/ccs/mapper/AttendanceStatisticsMapper.java b/src/main/java/com/cloudservice/ccs/mapper/AttendanceStatisticsMapper.java index 477799a27f3ea432f52bdb8431775b8ba24ed61a..9e3341c7b19f091df50bf32cf20c6f0659dede92 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/AttendanceStatisticsMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/AttendanceStatisticsMapper.java @@ -4,6 +4,7 @@ import com.cloudservice.ccs.entity.AttendanceStatistics; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface AttendanceStatisticsMapper { @@ -13,6 +14,8 @@ public interface AttendanceStatisticsMapper { int delete(Integer id); + int partialUpdate(Integer id, Map fields); + AttendanceStatistics getOne(Integer id); List getAll(); diff --git a/src/main/java/com/cloudservice/ccs/mapper/BlackListMapper.java b/src/main/java/com/cloudservice/ccs/mapper/BlackListMapper.java index cf476345f537bea461694c7700c8e7cd5713ce8c..a6e3a0f97cd3165e314eaec665b7373a9796de6d 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/BlackListMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/BlackListMapper.java @@ -5,6 +5,7 @@ import com.cloudservice.ccs.entity.BlackList; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface BlackListMapper { @@ -14,6 +15,8 @@ public interface BlackListMapper { int delete(Integer id); + int partialUpdate(Integer id, Map fields); + BlackList getOne(Integer id); List getAll(); diff --git a/src/main/java/com/cloudservice/ccs/mapper/CommonWordMapper.java b/src/main/java/com/cloudservice/ccs/mapper/CommonWordMapper.java index 5359487ab366759850411b43fc51af88279e4cb6..7775be88bb9d48576c10b32c5c908fb94f01481d 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/CommonWordMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/CommonWordMapper.java @@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; @Mapper public interface CommonWordMapper { @@ -14,6 +15,8 @@ public interface CommonWordMapper { int delete(Integer id); + int partialUpdate(Integer id, Map fields); + CommonWord getOne(Integer id); List getAll(); diff --git a/src/main/java/com/cloudservice/ccs/mapper/CustomerInfoMapper.java b/src/main/java/com/cloudservice/ccs/mapper/CustomerInfoMapper.java index b1b3843f9d6172cb864b5eac3f8bf9663f27a493..f02214f114f7866e4339e7bd45116cfddd2efc7c 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/CustomerInfoMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/CustomerInfoMapper.java @@ -5,16 +5,19 @@ import com.cloudservice.ccs.entity.CustomerInfo; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface CustomerInfoMapper { int save( CustomerInfo customerInfo); - int update(String email, CustomerInfo customerInfo); + int update(Integer id, CustomerInfo customerInfo); - int delete(String email); + int delete(Integer id); - CustomerInfo getOne(String email); + int partialUpdate(Integer id, Map fields); + + CustomerInfo getOne(Integer id); List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/mapper/GroupManageMapper.java b/src/main/java/com/cloudservice/ccs/mapper/GroupManageMapper.java index cc201289ca61bbdf69f0c8d5d768dbb73809dfb9..5b73432c2fba677bb3f9d1b8c30150ba11a03b26 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/GroupManageMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/GroupManageMapper.java @@ -5,6 +5,7 @@ import com.cloudservice.ccs.entity.GroupManage; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface GroupManageMapper { @@ -14,6 +15,8 @@ public interface GroupManageMapper { int delete(Integer id); + int partialUpdate(Integer id, Map fields); + GroupManage getOne(Integer id); List getAll(); diff --git a/src/main/java/com/cloudservice/ccs/mapper/NoticeMapper.java b/src/main/java/com/cloudservice/ccs/mapper/NoticeMapper.java index 8e181efd0fb9fcbbfdd13a7c3106d3d05ef3216e..3b84dbd51276e1d5b58687ae1a4ef85fe5779213 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/NoticeMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/NoticeMapper.java @@ -5,6 +5,7 @@ import com.cloudservice.ccs.entity.Notice; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface NoticeMapper { @@ -12,6 +13,8 @@ public interface NoticeMapper { int update(Integer id, Notice notice); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); Notice getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/RoleManageMapper.java b/src/main/java/com/cloudservice/ccs/mapper/RoleManageMapper.java index 2e27155181aade5e816a0a1fe4da17490f4551a2..74ac9673a0ee4a80702b99368a55f0c7b8223eee 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/RoleManageMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/RoleManageMapper.java @@ -5,6 +5,7 @@ import com.cloudservice.ccs.entity.RoleManage; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface RoleManageMapper { @@ -12,6 +13,8 @@ public interface RoleManageMapper { int update(Integer id, RoleManage roleManage); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); RoleManage getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/SessionMapper.java b/src/main/java/com/cloudservice/ccs/mapper/SessionMapper.java index da915c46db15e70ee219029280342ab100d83aea..04a95646e860a7358f1edeb9e5b6cb8f980e9b06 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/SessionMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/SessionMapper.java @@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface SessionMapper { @@ -12,6 +13,8 @@ public interface SessionMapper { int update(Integer id, Session session); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); Session getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/SessionMessageMapper.java b/src/main/java/com/cloudservice/ccs/mapper/SessionMessageMapper.java index 3e39d914353ee4fe442e8b66861705fb41ce4f8c..bbdbad6956abde632e9795c13b9edb6773afa72f 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/SessionMessageMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/SessionMessageMapper.java @@ -4,6 +4,7 @@ import com.cloudservice.ccs.entity.SessionMessage; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface SessionMessageMapper { @@ -11,6 +12,8 @@ public interface SessionMessageMapper { int update(Integer id, SessionMessage sessionMessage); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); SessionMessage getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/SystemMessageMapper.java b/src/main/java/com/cloudservice/ccs/mapper/SystemMessageMapper.java index 5ba0e868fd8fb68b1e72b8ab35c734a63a514eaa..165c7c664b47e8b5062159dcc1ccde4a50ff9380 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/SystemMessageMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/SystemMessageMapper.java @@ -4,6 +4,7 @@ import com.cloudservice.ccs.entity.SystemMessage; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface SystemMessageMapper { @@ -11,6 +12,8 @@ public interface SystemMessageMapper { int update(Integer id, SystemMessage systemMessage); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); SystemMessage getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/TagsMapper.java b/src/main/java/com/cloudservice/ccs/mapper/TagsMapper.java index e2234de2880eaa15f17d70487603ec9ccc8a03f5..9844da587c74d6403b85390058809099b144573b 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/TagsMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/TagsMapper.java @@ -4,6 +4,7 @@ import com.cloudservice.ccs.entity.Tags; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface TagsMapper { @@ -11,6 +12,8 @@ public interface TagsMapper { int update(Integer id, Tags tags); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); Tags getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/ViewStatisticsMapper.java b/src/main/java/com/cloudservice/ccs/mapper/ViewStatisticsMapper.java index 976657b4f81b1c1ef9ecf5b74b2cb35330d71535..8871e2d01c575d6e6516dde0192967d8c39ac6a0 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/ViewStatisticsMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/ViewStatisticsMapper.java @@ -4,6 +4,7 @@ import com.cloudservice.ccs.entity.ViewStatistics; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface ViewStatisticsMapper { @@ -11,6 +12,8 @@ public interface ViewStatisticsMapper { int update(Integer id, ViewStatistics viewStatistics); + int partialUpdate(Integer id, Map fields); + int delete(Integer id); ViewStatistics getOne(Integer id); diff --git a/src/main/java/com/cloudservice/ccs/mapper/VisitorInfoMapper.java b/src/main/java/com/cloudservice/ccs/mapper/VisitorInfoMapper.java index cb538b7cfb8a637d2efb653b0f223f6bf6731c13..e1c42d8e07f271c245517252068883297ace63dd 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/VisitorInfoMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/VisitorInfoMapper.java @@ -6,16 +6,19 @@ import com.cloudservice.ccs.entity.VisitorInfo; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface VisitorInfoMapper { int save(VisitorInfo visitorInfo); - int update(String ip, VisitorInfo visitorInfo); + int update(Integer id, VisitorInfo visitorInfo); - int delete(String ip); + int partialUpdate(Integer id, Map fields); - VisitorInfo getOne(String ip); + int delete(Integer id); + + VisitorInfo getOne(Integer id); List getAll(); } diff --git a/src/main/java/com/cloudservice/ccs/mapper/WorkLoadStatisticsMapper.java b/src/main/java/com/cloudservice/ccs/mapper/WorkLoadStatisticsMapper.java index 502563ecb775e86a7659b9fe525abc774db3f2a5..4759be908151779c5dcdf85061b06b119d930de1 100644 --- a/src/main/java/com/cloudservice/ccs/mapper/WorkLoadStatisticsMapper.java +++ b/src/main/java/com/cloudservice/ccs/mapper/WorkLoadStatisticsMapper.java @@ -3,9 +3,11 @@ package com.cloudservice.ccs.mapper; import com.cloudservice.ccs.entity.VisitorInfo; import com.cloudservice.ccs.entity.WorkloadStatistics; +import com.cloudservice.ccs.entity.WorkloadStatisticsAggregation; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface WorkLoadStatisticsMapper { @@ -14,8 +16,13 @@ public interface WorkLoadStatisticsMapper { int update(Integer id, WorkloadStatistics workloadStatistics); int delete(Integer id); + int partialUpdate(Integer id, Map fields); WorkloadStatistics getOne(Integer id); List getAll(); + + WorkloadStatisticsAggregation getStatisticsPartOfAggregation(); + + WorkloadStatisticsAggregation getSessionPartOfAggregation(); } diff --git a/src/main/java/com/cloudservice/ccs/util/Constant.java b/src/main/java/com/cloudservice/ccs/util/Constant.java new file mode 100644 index 0000000000000000000000000000000000000000..e6245abd6e40b0a751eb2fc8975cbcb4f1d6950f --- /dev/null +++ b/src/main/java/com/cloudservice/ccs/util/Constant.java @@ -0,0 +1,5 @@ +package com.cloudservice.ccs.util; + +public class Constant { + public static final String DEFAULT_ERROR_MESSAGE = "error"; +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 635175f72cf0e9bcbb5cd158b9f584143d53a028..b302dbfa12ac458f3f5b67d1c35d9ca16067d78c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -10,3 +10,8 @@ spring: mybatis: mapper-locations: classpath:mapper/*.xml type-aliases-package: com.cloudservice.ccs.entity + +logging: + level: + root: INFO + # web: DEBUG # 将本行注释去掉以查看 Web 请求与响应等详细信息(包括请求与响应日志等) diff --git a/src/main/resources/mapper/AttendanceStatisticsMapper.xml b/src/main/resources/mapper/AttendanceStatisticsMapper.xml index bf8ee5fa453d30d95583dd58fce0aac50c5eb022..6fdf4ffd3ac96d89c89168191f15ade1e9ec25d6 100644 --- a/src/main/resources/mapper/AttendanceStatisticsMapper.xml +++ b/src/main/resources/mapper/AttendanceStatisticsMapper.xml @@ -33,4 +33,13 @@ + + + UPDATE attendance_statistics SET + + ${field} = #{value} + + WHERE id = #{id}; + + \ No newline at end of file diff --git a/src/main/resources/mapper/BlackListMapper.xml b/src/main/resources/mapper/BlackListMapper.xml index f98d464ac6547dba3f28eed6b3b6132fb4be42a3..3bbb88dd8a8b0df8acbd186cec5cdc1ceeaf9f67 100644 --- a/src/main/resources/mapper/BlackListMapper.xml +++ b/src/main/resources/mapper/BlackListMapper.xml @@ -9,6 +9,14 @@ ) + + UPDATE black_list SET + + ${field} = #{value} + + WHERE id = #{id}; + + UPDATE black_list SET customerServiceId=#{blackList.customerServiceId}, diff --git a/src/main/resources/mapper/CommonWordMapper.xml b/src/main/resources/mapper/CommonWordMapper.xml index 45e766c2a8e2304903765e82d0c2d9996ac2d75b..0f5067ed3fa903f64e849ac88bda5eea48530543 100644 --- a/src/main/resources/mapper/CommonWordMapper.xml +++ b/src/main/resources/mapper/CommonWordMapper.xml @@ -15,20 +15,28 @@ content = #{commonWord.content}, lib = #{commonWord.lib}, type = #{commonWord.type} - WHERE creatorId = #{id}; + WHERE id = #{id}; DELETE FROM common_word - WHERE creatorId = #{id}; + WHERE id = #{id}; + + + UPDATE common_word SET + + ${field} = #{value} + + WHERE id = #{id}; + \ No newline at end of file diff --git a/src/main/resources/mapper/CustomerInfoMapper.xml b/src/main/resources/mapper/CustomerInfoMapper.xml index 13a74e3e78aeefe40b2e45dcb6442ca872dfea7e..adff4fce8e744dedc9398221d0a9380aa875a2d1 100644 --- a/src/main/resources/mapper/CustomerInfoMapper.xml +++ b/src/main/resources/mapper/CustomerInfoMapper.xml @@ -3,14 +3,15 @@ INSERT INTO customer_info ( - state, visitorName, realName,phone,email,company,address,level,channel,tagsId,remark,customerServiceId + id,state, visitorName, realName,phone,email,company,address,level,channel,tagsId,remark,customerServiceId ) VALUES ( - #{state}, #{visitorName}, #{realName}, #{phone}, #{email}, #{company}, #{address}, #{level}, #{channel}, #{tagsId}, #{remark}, #{customerServiceId} + #{id},#{state}, #{visitorName}, #{realName}, #{phone}, #{email}, #{company}, #{address}, #{level}, #{channel}, #{tagsId}, #{remark}, #{customerServiceId} ) UPDATE customer_info SET + id = #{id}, state = #{customerInfo.state}, visitorName = #{customerInfo.visitorName}, realName = #{customerInfo.realName}, @@ -22,20 +23,28 @@ tagsId = #{customerInfo.tagsId}, remark = #{customerInfo.remark}, customerServiceId = #{customerInfo.customerServiceId} - WHERE email = #{email}; + WHERE id = #{id}; DELETE FROM customer_info - WHERE email = #{email}; + WHERE id = #{id}; + + + UPDATE customer_info SET + + ${field} = #{value} + + WHERE id = #{id}; + \ No newline at end of file diff --git a/src/main/resources/mapper/CustomerServiceMapper.xml b/src/main/resources/mapper/CustomerServiceMapper.xml index f0d80e099ac19254511ad8c5f5bbd38aaf137f7d..557269d469635dc1a6250ba384cabef855a2d2ac 100644 --- a/src/main/resources/mapper/CustomerServiceMapper.xml +++ b/src/main/resources/mapper/CustomerServiceMapper.xml @@ -13,9 +13,7 @@ UPDATE customer_service SET - phone = #{customerService.phone}, - password = #{customerService.password}, headImg = #{customerService.headImg}, email = #{customerService.email}, diff --git a/src/main/resources/mapper/GroupManageMapper.xml b/src/main/resources/mapper/GroupManageMapper.xml index bf3d0ac84cfa9e532d84cf3a1aed675aa33b7aba..123b915c6175bf5f5fd7f749e40e64541a9496df 100644 --- a/src/main/resources/mapper/GroupManageMapper.xml +++ b/src/main/resources/mapper/GroupManageMapper.xml @@ -30,4 +30,12 @@ + + + UPDATE group_manage SET + + ${field} = #{value} + + WHERE groupId = #{id}; + \ No newline at end of file diff --git a/src/main/resources/mapper/NoticeMapper.xml b/src/main/resources/mapper/NoticeMapper.xml index 8c549d8473f3f350c2fa9164a53f60af2e7f39a4..7e78ed0a5a58a27c12e8e9307b3975e7e202156b 100644 --- a/src/main/resources/mapper/NoticeMapper.xml +++ b/src/main/resources/mapper/NoticeMapper.xml @@ -18,6 +18,14 @@ WHERE id = #{id}; + + UPDATE notice SET + + ${field} = #{value} + + WHERE id = #{id}; + + DELETE FROM notice WHERE id = #{id}; diff --git a/src/main/resources/mapper/RoleManageMapper.xml b/src/main/resources/mapper/RoleManageMapper.xml index ec397e2e2faa7d62505db4221ec8b81be3db31db..33ec58edd5505cdd3fc28d381488a1618f996c66 100644 --- a/src/main/resources/mapper/RoleManageMapper.xml +++ b/src/main/resources/mapper/RoleManageMapper.xml @@ -18,6 +18,14 @@ where roleId = #{id} + + UPDATE role_manage SET + + ${field} = #{value} + + WHERE roleId = #{id}; + + DELETE FROM role_manage WHERE roleId = #{id}; diff --git a/src/main/resources/mapper/SessionMapper.xml b/src/main/resources/mapper/SessionMapper.xml index 1e6fef63f68376954b12e50d364c9f4b74d161f3..d428a962ec54d3eabc7248cd97d5a103a6bb616b 100644 --- a/src/main/resources/mapper/SessionMapper.xml +++ b/src/main/resources/mapper/SessionMapper.xml @@ -25,6 +25,14 @@ where sessionId = #{id}; + + UPDATE session SET + + ${field} = #{value} + + WHERE sessionId = #{id}; + + DELETE FROM session WHERE sessionId = #{id}; diff --git a/src/main/resources/mapper/SessionMessageMapper.xml b/src/main/resources/mapper/SessionMessageMapper.xml index 5caa6516233edbd7e6a423b6cabcfa6d7fe76f02..ec92e98c7f993cb1a6edd4ac0364bb455dea376e 100644 --- a/src/main/resources/mapper/SessionMessageMapper.xml +++ b/src/main/resources/mapper/SessionMessageMapper.xml @@ -17,6 +17,14 @@ where msgSenderId = #{id} + + UPDATE session_message SET + + ${field} = #{value} + + WHERE msgSenderId = #{id}; + + DELETE FROM session_message WHERE msgSenderId = #{id}; diff --git a/src/main/resources/mapper/SystemMessageMapper.xml b/src/main/resources/mapper/SystemMessageMapper.xml index 300675d31c34777d2454f717f48f7880d1a4874e..366331e8fa1803627b933129aa9b821def20f29e 100644 --- a/src/main/resources/mapper/SystemMessageMapper.xml +++ b/src/main/resources/mapper/SystemMessageMapper.xml @@ -16,6 +16,14 @@ where id = #{id}; + + UPDATE system_message SET + + ${field} = #{value} + + WHERE id = #{id}; + + DELETE FROM system_message WHERE id= #{id}; diff --git a/src/main/resources/mapper/TagsMapper.xml b/src/main/resources/mapper/TagsMapper.xml index c9efdc9a918053281916d09c2f7823955728b805..ec652a69689308845834bf2ea4e72ade29dc367a 100644 --- a/src/main/resources/mapper/TagsMapper.xml +++ b/src/main/resources/mapper/TagsMapper.xml @@ -18,6 +18,14 @@ where creatorId = #{Tags.id}; + + UPDATE tags SET + + ${field} = #{value} + + WHERE creatorId = #{id}; + + DELETE FROM tags WHERE creatorId = #{id}; diff --git a/src/main/resources/mapper/ViewStatisticsMapper.xml b/src/main/resources/mapper/ViewStatisticsMapper.xml index 9a4ab702cf19242889c1b2526d1e74035fd88996..b15f3ed2ba701d2672d2fd273fd39b5985cbbb88 100644 --- a/src/main/resources/mapper/ViewStatisticsMapper.xml +++ b/src/main/resources/mapper/ViewStatisticsMapper.xml @@ -17,6 +17,14 @@ where id= #{id}; + + UPDATE view_statistics SET + + ${field} = #{value} + + WHERE id = #{id}; + + DELETE FROM view_statistics WHERE id= #{id}; diff --git a/src/main/resources/mapper/VisitorInfoMapper.xml b/src/main/resources/mapper/VisitorInfoMapper.xml index 39ee5a239856e723bb0f851f437913818cb73235..45c099e18c396f7cd0663fd155397140ef2cace8 100644 --- a/src/main/resources/mapper/VisitorInfoMapper.xml +++ b/src/main/resources/mapper/VisitorInfoMapper.xml @@ -5,14 +5,15 @@ INSERT INTO visitor_info ( - ip,visitorName,terminal,browser,screenSize,device,customerServiceId,state,visitDuration + id,ip,visitorName,terminal,browser,screenSize,device,customerServiceId,state,visitDuration ) VALUES ( - #{ip}, #{visitorName}, #{terminal}, #{browser}, #{screenSize}, #{device}, #{customerServiceId}, #{state}, #{visitDuration} + #{id},#{ip}, #{visitorName}, #{terminal}, #{browser}, #{screenSize}, #{device}, #{customerServiceId}, #{state}, #{visitDuration} ) UPDATE visitor_info SET + id = #{Visitor.id}, ip = #{VisitorInfo.ip}, visitorName = #{VisitorInfo.visitorName}, terminal = #{VisitorInfo.terminal}, @@ -22,7 +23,15 @@ customerServiceId = #{VisitorInfo.customerServiceId}, state = #{VisitorInfo.state}, visitDuration = #{VisitorInfo.visitDuration} - WHERE ip = #{ip}; + WHERE id = #{id}; + + + + UPDATE visitor_info SET + + ${field} = #{value} + + WHERE id = #{id}; @@ -32,7 +41,7 @@ SELECT * FROM workload_statistics; + + + \ No newline at end of file