From f6ad461117feaba940c460644a383960aea67b78 Mon Sep 17 00:00:00 2001 From: liuyiliang Date: Tue, 18 Feb 2025 15:52:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?exam=E5=B7=A5=E7=A8=8B=E6=BC=94=E7=A4=BA?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ccic/safeliab/entity/InsDemo.java | 77 +++++++++++++++++++ ccic-exam/pom.xml | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 ccic-entity/src/main/java/com/ccic/safeliab/entity/InsDemo.java diff --git a/ccic-entity/src/main/java/com/ccic/safeliab/entity/InsDemo.java b/ccic-entity/src/main/java/com/ccic/safeliab/entity/InsDemo.java new file mode 100644 index 0000000..7db63a4 --- /dev/null +++ b/ccic-entity/src/main/java/com/ccic/safeliab/entity/InsDemo.java @@ -0,0 +1,77 @@ +package com.ccic.safeliab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 演示 + *

+ * + * @author testjava + * @since 2022-11-05 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ins_demo") +public class InsDemo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.NONE) + @JsonFormat(shape = JsonFormat.Shape.STRING) + private Long id; + + /** + * 编码 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 創建人ID + */ + @JsonFormat(shape = JsonFormat.Shape.STRING) + @TableField(fill = FieldFill.INSERT) + private Long createUser; + + /** + * 修改人ID + */ + @JsonFormat(shape = JsonFormat.Shape.STRING) + @TableField(fill = FieldFill.INSERT) + private Long updateUser; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + /** + * 状态 + */ + private int status; + + /** + * 删除标识 + */ + private int isDeleted; +} diff --git a/ccic-exam/pom.xml b/ccic-exam/pom.xml index db9f844..39c3d4e 100644 --- a/ccic-exam/pom.xml +++ b/ccic-exam/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - ccic-emam + ccic-exam 1.0-SNAPSHOT From a2942f7ddb9a563735b7aa6945a06f5e40fa1b52 Mon Sep 17 00:00:00 2001 From: liuyiliang Date: Thu, 20 Feb 2025 13:51:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=80=83=E8=AF=95=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E5=85=B8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ccic/safeliab/entity/ExDict.java | 85 +++++++++++++++++++ .../com/ccic/safeliab/dao/DictMapper.java | 41 +++++++++ .../filter/TokenAuthenticationFilter.java | 2 +- .../ccic/safeliab/service/DictService.java | 37 ++++++++ .../safeliab/service/DictServiceImpl.java | 39 +++++++++ .../com/ccic/safeliab/web/DemoController.java | 2 +- .../com/ccic/safeliab/web/DictController.java | 51 +++++++++++ .../src/main/resources/mappers/DictMapper.xml | 21 +++++ 8 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/dao/DictMapper.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java create mode 100644 ccic-exam/src/main/resources/mappers/DictMapper.xml diff --git a/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java b/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java new file mode 100644 index 0000000..b946f97 --- /dev/null +++ b/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serializable; + +/** + * 实体类 + * + * @author Chill + */ +@Data +@TableName("ex_dict") +public class ExDict implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "event_id", type = IdType.INPUT) + @JsonFormat(shape = JsonFormat.Shape.STRING) + private Long id; + + /** + * 父主键 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long parentId; + + /** + * 字典码 + */ + private String code; + + /** + * 字典值 + */ + private Integer dictKey; + + /** + * 字典名称 + */ + private String dictValue; + + /** + * 排序 + */ + private Integer sort; + + /** + * 字典备注 + */ + private String remark; + + /** + * 是否已删除 + */ + @TableLogic + private Integer isDeleted; + + +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/dao/DictMapper.java b/ccic-exam/src/main/java/com/ccic/safeliab/dao/DictMapper.java new file mode 100644 index 0000000..cf9c082 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/dao/DictMapper.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ccic.safeliab.entity.ExDict; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Chill + */ +@Mapper +public interface DictMapper extends BaseMapper { + + + /** + * 获取字典表 + * + * @param code 字典编号 + * @return + */ + List getList(String code); + +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/filter/TokenAuthenticationFilter.java b/ccic-exam/src/main/java/com/ccic/safeliab/filter/TokenAuthenticationFilter.java index 4d590cb..22efc9b 100644 --- a/ccic-exam/src/main/java/com/ccic/safeliab/filter/TokenAuthenticationFilter.java +++ b/ccic-exam/src/main/java/com/ccic/safeliab/filter/TokenAuthenticationFilter.java @@ -26,7 +26,7 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter { //System.out.println("经过了此过滤器"); String uri = httpServletRequest.getRequestURI(); if (uri.indexOf("login") > 0 || uri.indexOf("getWorkId") > 0 || uri.indexOf("userLogin") > 0 - || uri.indexOf("userWxLogin") > 0 || uri.indexOf("demo") > 0) { + || uri.indexOf("userWxLogin") > 0 || uri.indexOf("demo") > 0 || uri.indexOf("ex") > 0) { filterChain.doFilter(httpServletRequest, httpServletResponse); return; } diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java new file mode 100644 index 0000000..66846bc --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ccic.safeliab.entity.ExDict; + +import java.util.List; + +/** + * 服务类 + * + * @author Chill + */ +public interface DictService extends IService { + + /** + * 获取字典表 + * + * @param code 字典编号 + * @return + */ + List getList(String code); +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java new file mode 100644 index 0000000..b41e929 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ccic.safeliab.dao.DictMapper; +import com.ccic.safeliab.entity.ExDict; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 服务实现类 + * + * @author Chill + */ +@Service +public class DictServiceImpl extends ServiceImpl implements DictService { + + + @Override + public List getList(String code) { + return baseMapper.getList(code); + } + +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/web/DemoController.java b/ccic-exam/src/main/java/com/ccic/safeliab/web/DemoController.java index a1b68c6..18e2eb9 100644 --- a/ccic-exam/src/main/java/com/ccic/safeliab/web/DemoController.java +++ b/ccic-exam/src/main/java/com/ccic/safeliab/web/DemoController.java @@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController -@RequestMapping("/demo") +@RequestMapping("/ex/demo") public class DemoController { @Autowired diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java b/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java new file mode 100644 index 0000000..07297df --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.web; + +import com.ccic.safeliab.util.R; +import com.ccic.safeliab.entity.ExDict; +import com.ccic.safeliab.service.DictService; +import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import java.util.List; + + +/** + * 控制器 + * + * @author Chill + */ +@RestController +@RequestMapping("/ex/dict") +public class DictController { + + @Autowired + private DictService dictService; + + /** + * 获取字典 + * + * @return + */ + @GetMapping("/dictionary") + public R dictionary(String code) { + List tree = dictService.getList(code); + return R.ok().data(tree); + } + + +} diff --git a/ccic-exam/src/main/resources/mappers/DictMapper.xml b/ccic-exam/src/main/resources/mappers/DictMapper.xml new file mode 100644 index 0000000..3395eea --- /dev/null +++ b/ccic-exam/src/main/resources/mappers/DictMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + From ad0de10c8d87227a17b5848f66dbb955559bdf28 Mon Sep 17 00:00:00 2001 From: liuyiliang Date: Tue, 25 Feb 2025 15:05:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/bootstrap.yml | 4 +- .../com/ccic/safeliab/entity/BaseEntity.java | 43 ++++++++++++ .../java/com/ccic/safeliab/entity/ExDict.java | 11 +-- ccic-exam/pom.xml | 6 ++ .../ccic/safeliab/service/DictService.java | 6 +- .../safeliab/service/DictServiceImpl.java | 6 +- .../safeliab/service/StatisticsService.java | 33 +++++++++ .../service/StatisticsServiceImpl.java | 67 +++++++++++++++++++ .../ccic/safeliab/support/BaseService.java | 9 +++ .../safeliab/support/BaseServiceImpl.java | 50 ++++++++++++++ .../java/com/ccic/safeliab/vo/CustomerVO.java | 14 ++++ .../com/ccic/safeliab/web/DictController.java | 1 - .../safeliab/web/StatisticsController.java | 23 +++++++ ccic-exam/src/main/resources/bootstrap.yml | 2 +- 14 files changed, 258 insertions(+), 17 deletions(-) create mode 100644 ccic-entity/src/main/java/com/ccic/safeliab/entity/BaseEntity.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/service/StatisticsService.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/service/StatisticsServiceImpl.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/support/BaseService.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/support/BaseServiceImpl.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/vo/CustomerVO.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/web/StatisticsController.java diff --git a/ccic-business/src/main/resources/bootstrap.yml b/ccic-business/src/main/resources/bootstrap.yml index 95d2dd7..ab65b45 100644 --- a/ccic-business/src/main/resources/bootstrap.yml +++ b/ccic-business/src/main/resources/bootstrap.yml @@ -45,7 +45,7 @@ spring: discovery: group: ${spring.profiles.active} #生产环境 - namespace: safeliab + namespace: safeliab-uat # 配置 config: server-addr: 10.3.67.7:8848 @@ -54,5 +54,5 @@ spring: group: ${spring.profiles.active} file-extension: yaml #生产环境 - namespace: safeliab + namespace: safeliab-uat diff --git a/ccic-entity/src/main/java/com/ccic/safeliab/entity/BaseEntity.java b/ccic-entity/src/main/java/com/ccic/safeliab/entity/BaseEntity.java new file mode 100644 index 0000000..633eb4f --- /dev/null +++ b/ccic-entity/src/main/java/com/ccic/safeliab/entity/BaseEntity.java @@ -0,0 +1,43 @@ +package com.ccic.safeliab.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +@Data +public class BaseEntity { + @JsonSerialize( + using = ToStringSerializer.class + ) + private Long createdBy; + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + private Date createAt; + @JsonSerialize( + using = ToStringSerializer.class + ) + private Long updateBy; + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + private Date updateAt; + private Integer status; + @TableLogic + private Integer isDeleted; + + public BaseEntity() { + } + +} diff --git a/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java b/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java index b946f97..7e794b5 100644 --- a/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java +++ b/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExDict.java @@ -33,14 +33,15 @@ import java.io.Serializable; */ @Data @TableName("ex_dict") -public class ExDict implements Serializable { +public class ExDict extends BaseEntity implements Serializable { private static final long serialVersionUID = 1L; /** * 主键 */ - @TableId(value = "event_id", type = IdType.INPUT) +// @TableId(value = "id", type = IdType.INPUT) + @TableId(value = "id", type = IdType.ID_WORKER) @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; @@ -75,11 +76,5 @@ public class ExDict implements Serializable { */ private String remark; - /** - * 是否已删除 - */ - @TableLogic - private Integer isDeleted; - } diff --git a/ccic-exam/pom.xml b/ccic-exam/pom.xml index 39c3d4e..2cce39f 100644 --- a/ccic-exam/pom.xml +++ b/ccic-exam/pom.xml @@ -175,6 +175,12 @@ org.apache.commons commons-pool2 + + com.ccic.safeliab + ccic-business + 1.0-SNAPSHOT + compile + diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java index 66846bc..c767792 100644 --- a/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictService.java @@ -15,17 +15,17 @@ */ package com.ccic.safeliab.service; -import com.baomidou.mybatisplus.extension.service.IService; import com.ccic.safeliab.entity.ExDict; +import com.ccic.safeliab.support.BaseService; import java.util.List; /** * 服务类 * - * @author Chill + * @author edwong */ -public interface DictService extends IService { +public interface DictService extends BaseService { /** * 获取字典表 diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java index b41e929..e355619 100644 --- a/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/DictServiceImpl.java @@ -15,9 +15,11 @@ */ package com.ccic.safeliab.service; +import cn.hutool.crypto.SecureUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ccic.safeliab.dao.DictMapper; import com.ccic.safeliab.entity.ExDict; +import com.ccic.safeliab.support.BaseServiceImpl; import org.springframework.stereotype.Service; import java.util.List; @@ -25,10 +27,10 @@ import java.util.List; /** * 服务实现类 * - * @author Chill + * @author edwong */ @Service -public class DictServiceImpl extends ServiceImpl implements DictService { +public class DictServiceImpl extends BaseServiceImpl implements DictService { @Override diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/StatisticsService.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/StatisticsService.java new file mode 100644 index 0000000..1fc65e8 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/StatisticsService.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ccic.safeliab.entity.Customer; +import com.ccic.safeliab.vo.CustomerVO; + +import java.util.Map; + + +/** + * 服务类 + * + * @author edwong + */ +public interface StatisticsService { + + Page findPage(CustomerVO customer); +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/StatisticsServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/StatisticsServiceImpl.java new file mode 100644 index 0000000..90e45a7 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/StatisticsServiceImpl.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ccic.safeliab.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ccic.safeliab.entity.Customer; +import com.ccic.safeliab.entity.Device; +import com.ccic.safeliab.entity.User; +import com.ccic.safeliab.support.Condition; +import com.ccic.safeliab.util.CcicUtill; +import com.ccic.safeliab.vo.CustomerVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.Map; + + +/** + * 服务实现类 + * + * @author edwong + */ +@Service +public class StatisticsServiceImpl implements StatisticsService { + + @Autowired + private ICustomerService customerService; + + @Override + public Page findPage(CustomerVO customer) { + Page page = new Page(customer.getPage(), customer.getNum()); + QueryWrapper wrapper = Condition.getQueryWrapper(customer); + if (!StringUtils.isEmpty(customer.getKeyword())) { + // 客户名称与编号过滤 + wrapper.lambda().like(Customer::getCustomerName, customer.getKeyword()) + .or() + .like(Customer::getCustomerNo, customer.getKeyword()); + } + if (!StringUtils.isEmpty(customer.getTypePid())) { + // 归属机构 + wrapper.lambda().eq(Customer::getTypePid, customer.getTypePid()); + } + if (!StringUtils.isEmpty(customer.getTypePid())) { + // 管理分类 + wrapper.lambda().eq(Customer::getTypePid, customer.getTypePid()); + } + wrapper.orderByDesc("changed_at"); + customerService.page(page,wrapper); + + return page; + } +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseService.java b/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseService.java new file mode 100644 index 0000000..2631f29 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseService.java @@ -0,0 +1,9 @@ +package com.ccic.safeliab.support; + +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +public interface BaseService extends IService { + boolean deleteLogic(List ids); +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseServiceImpl.java new file mode 100644 index 0000000..ad021a5 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseServiceImpl.java @@ -0,0 +1,50 @@ +package com.ccic.safeliab.support; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ccic.safeliab.entity.BaseEntity; +import com.ccic.safeliab.entity.Customer; +import org.springframework.validation.annotation.Validated; + +import java.util.Date; +import java.util.List; + +@Validated +public class BaseServiceImpl, T extends BaseEntity> extends ServiceImpl implements BaseService { + public BaseServiceImpl() { + } + + public boolean save(T entity) { + Customer user = new Customer(); + user.setCustomerId(Long.parseLong("3009473735814009")); + if (user != null) { + entity.setCreatedBy(user.getCustomerId()); + entity.setUpdateBy(user.getCustomerId()); + } + + Date now = new Date(); + entity.setCreateAt(now); + entity.setUpdateAt(now); + if (entity.getStatus() == null) { + entity.setStatus(1); + } + + entity.setIsDeleted(0); + return super.save(entity); + } + + public boolean updateById(T entity) { + Customer user = new Customer(); + if (user != null) { + entity.setUpdateBy(user.getCustomerId()); + } + + entity.setUpdateAt(new Date()); + return super.updateById(entity); + } + + public boolean deleteLogic(List ids) { + return super.removeByIds(ids); + } +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/vo/CustomerVO.java b/ccic-exam/src/main/java/com/ccic/safeliab/vo/CustomerVO.java new file mode 100644 index 0000000..c4998a6 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/vo/CustomerVO.java @@ -0,0 +1,14 @@ +package com.ccic.safeliab.vo; + +import com.ccic.safeliab.entity.Customer; +import lombok.Data; + +@Data +public class CustomerVO extends Customer { + + private String keyword; + + private Integer page; + + private Integer num; +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java b/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java index 07297df..99004d5 100644 --- a/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java +++ b/ccic-exam/src/main/java/com/ccic/safeliab/web/DictController.java @@ -18,7 +18,6 @@ package com.ccic.safeliab.web; import com.ccic.safeliab.util.R; import com.ccic.safeliab.entity.ExDict; import com.ccic.safeliab.service.DictService; -import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/web/StatisticsController.java b/ccic-exam/src/main/java/com/ccic/safeliab/web/StatisticsController.java new file mode 100644 index 0000000..af5e8a2 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/web/StatisticsController.java @@ -0,0 +1,23 @@ +package com.ccic.safeliab.web; + +import com.ccic.safeliab.service.StatisticsService; +import com.ccic.safeliab.util.R; +import com.ccic.safeliab.vo.CustomerVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +@RestController +@RequestMapping("/ex/statistics") +public class StatisticsController { + + @Autowired + private StatisticsService statisticsService; + + @PostMapping("/page") + public R page(@RequestBody CustomerVO customer) { + return R.ok().dataPage(statisticsService.findPage(customer)); + } + + +} diff --git a/ccic-exam/src/main/resources/bootstrap.yml b/ccic-exam/src/main/resources/bootstrap.yml index 58af5e6..acfd355 100644 --- a/ccic-exam/src/main/resources/bootstrap.yml +++ b/ccic-exam/src/main/resources/bootstrap.yml @@ -55,4 +55,4 @@ spring: file-extension: yaml #生产环境 namespace: safeliab-uat - +workerID: 1 \ No newline at end of file