diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceItemAddFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceItemAddFormDTO.java new file mode 100644 index 0000000000..6ac82ec0db --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceItemAddFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form.demand; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * 新增或者修改服务事项分类 + */ +@Data +public class ServiceItemAddFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) + private String customerId; + + @NotBlank(message = "分类名称不能为空", groups = AddUserShowGroup.class) + @Length(max = 100, message = "分类名称至多输入100字", groups = AddUserShowGroup.class) + private String categoryName; + + @NotNull(message = "", groups = AddUserShowGroup.class) + private Integer awardPoint; + + private String categoryId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceItemPageFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceItemPageFormDTO.java new file mode 100644 index 0000000000..cb1586d413 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceItemPageFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form.demand; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 服务事项分类列表查询入参 + * 目前不分页 + */ +@Data +public class ServiceItemPageFormDTO extends PageFormDTO implements Serializable { + public interface AddUserInternalGroup {} + + @NotBlank(message = "客户id不能为空",groups = AddUserInternalGroup.class) + private String customerId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/StatusFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/StatusFormDTO.java index 879d632cc7..2e8e95db04 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/StatusFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/StatusFormDTO.java @@ -17,4 +17,7 @@ public class StatusFormDTO implements Serializable { @NotNull(message = "usableFlag不能为空", groups = AddUserInternalGroup.class) private Boolean usableFlag; + + @NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class) + private String userId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceItemResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceItemResultDTO.java new file mode 100644 index 0000000000..3408b5f724 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceItemResultDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.result.demand; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 服务事项分类列表查询返参 + * 目前不分页 + */ +@Data +public class ServiceItemResultDTO implements Serializable { + private static final long serialVersionUID = -590440160577071133L; + private String categoryId; + private String categoryName; + private Integer awardPoint; + private Boolean usableFlag; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java index 4bb3a8c969..2fb6ad864f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java @@ -114,7 +114,8 @@ public class IcResiDemandDictController { * @return */ @PostMapping("updatestatus") - public Result updateStatus(@RequestBody StatusFormDTO formDTO){ + public Result updateStatus(@LoginUser TokenDto tokenDto,@RequestBody StatusFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO,StatusFormDTO.AddUserInternalGroup.class); icResiDemandDictService.updateStatus(formDTO); return new Result(); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java new file mode 100644 index 0000000000..d2f9f6d412 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java @@ -0,0 +1,71 @@ +package com.epmet.controller; + + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.demand.ServiceItemAddFormDTO; +import com.epmet.dto.form.demand.ServiceItemPageFormDTO; +import com.epmet.dto.form.demand.StatusFormDTO; +import com.epmet.dto.result.demand.ServiceItemResultDTO; +import com.epmet.service.IcServiceItemDictService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 服务事项分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-27 + */ +@RestController +@RequestMapping("serviceitem") +public class IcServiceItemDictController { + + @Autowired + private IcServiceItemDictService icServiceItemDictService; + + + /** + * 01、分页列表查询 + * + * @param formDTO + * @return + */ + @PostMapping("list") + public Result> page(@RequestBody ServiceItemPageFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ServiceItemPageFormDTO.AddUserInternalGroup.class); + PageData page = icServiceItemDictService.page(formDTO); + return new Result>().ok(page); + } + + /** + * 02、新增分类 + * @param formDTO + * @return + */ + @PostMapping("saveorupdate") + public Result addOrUpdate(@RequestBody ServiceItemAddFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ServiceItemAddFormDTO.AddUserShowGroup.class,ServiceItemAddFormDTO.AddUserInternalGroup.class); + icServiceItemDictService.addOrUpdate(formDTO); + return new Result(); + } + + /** + * 03、启用或者禁用分类 + * @param formDTO + * @return + */ + @PostMapping("updatestatus") + public Result updateStatus(@LoginUser TokenDto tokenDto, @RequestBody StatusFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,StatusFormDTO.AddUserInternalGroup.class); + icServiceItemDictService.updateStatus(formDTO); + return new Result(); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java new file mode 100644 index 0000000000..5837b45aea --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java @@ -0,0 +1,37 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.demand.ServiceItemResultDTO; +import com.epmet.entity.IcServiceItemDictEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 服务事项分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-01-14 + */ +@Mapper +public interface IcServiceItemDictDao extends BaseDao { + + List pageList(String customerId); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcServiceItemDictEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcServiceItemDictEntity.java new file mode 100644 index 0000000000..c0b34489f5 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcServiceItemDictEntity.java @@ -0,0 +1,83 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 服务事项分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-01-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_service_item_dict") +public class IcServiceItemDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 父级,一级默认为0 + */ + private String parentCode; + + /** + * 分类编码 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 级别 + */ + private Integer level; + + /** + * 备注 + */ + private String remark; + + /** + * 排序 + */ + private Integer sort; + + /** + * 1可用,0不可用 + */ + private Boolean usableFlag; + + /** + * 奖励积分 + */ + private Integer awardPoint; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java new file mode 100644 index 0000000000..a93e50aaff --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java @@ -0,0 +1,55 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.demand.ServiceItemAddFormDTO; +import com.epmet.dto.form.demand.ServiceItemPageFormDTO; +import com.epmet.dto.form.demand.StatusFormDTO; +import com.epmet.dto.result.demand.ServiceItemResultDTO; +import com.epmet.entity.IcServiceItemDictEntity; + +/** + * 服务事项分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-01-14 + */ +public interface IcServiceItemDictService extends BaseService { + + /** + * 01、列表查询 + * @param formDTO + * @return + */ + PageData page(ServiceItemPageFormDTO formDTO); + + /** + * 02、添加或者修改分类 + * @param formDTO + */ + void addOrUpdate(ServiceItemAddFormDTO formDTO); + + /** + * 03、启用或者禁用分类 + * @param formDTO + * @return + */ + void updateStatus(StatusFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java index 0e352910c6..493004ce71 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java @@ -217,6 +217,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dao.IcServiceItemDictDao; +import com.epmet.dto.form.demand.ServiceItemAddFormDTO; +import com.epmet.dto.form.demand.ServiceItemPageFormDTO; +import com.epmet.dto.form.demand.StatusFormDTO; +import com.epmet.dto.result.demand.ServiceItemResultDTO; +import com.epmet.entity.IcServiceItemDictEntity; +import com.epmet.service.IcServiceItemDictService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +/** + * 服务事项分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-01-14 + */ +@Slf4j +@Service +public class IcServiceItemDictServiceImpl extends BaseServiceImpl implements IcServiceItemDictService { + + + /** + * 列表查询 + * + * @param formDTO + * @return + */ + @Override + public PageData page(ServiceItemPageFormDTO formDTO) { + //目前不分页,只是接口支持分页 + List list = baseDao.pageList(formDTO.getCustomerId()); + return new PageData<>(list, CollectionUtils.isNotEmpty(list) ? list.size() : NumConstant.ZERO); + } + + /** + * 02、添加或者修改分类 + * + * @param formDTO + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void addOrUpdate(ServiceItemAddFormDTO formDTO) { + //分类名称是否唯一 + LambdaQueryWrapper nameQuery = new LambdaQueryWrapper<>(); + nameQuery.eq(IcServiceItemDictEntity::getCustomerId, formDTO.getCustomerId()) + .eq(IcServiceItemDictEntity::getCategoryName, formDTO.getCategoryName()) + .ne(StringUtils.isNotBlank(formDTO.getCategoryId()), IcServiceItemDictEntity::getId, formDTO.getCategoryId()); + if (baseDao.selectCount(nameQuery) > 0) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前客户下,分类名称已存在", "分类名称已存在"); + } + if (StringUtils.isNotBlank(formDTO.getCategoryId())) { + LambdaUpdateWrapper update = new LambdaUpdateWrapper<>(); + update.eq(IcServiceItemDictEntity::getId, formDTO.getCategoryId()); + update.set(IcServiceItemDictEntity::getCategoryName, formDTO.getCategoryName()) + .set(IcServiceItemDictEntity::getAwardPoint, formDTO.getAwardPoint()); + baseDao.update(null, update); + return; + } + LambdaQueryWrapper maxQuery = new LambdaQueryWrapper<>(); + maxQuery.eq(IcServiceItemDictEntity::getCustomerId, formDTO.getCustomerId()) + .orderByDesc(IcServiceItemDictEntity::getCategoryCode).last("limit 1"); + IcServiceItemDictEntity max = baseDao.selectOne(maxQuery); + // 获取编码 + IcServiceItemDictEntity insert = new IcServiceItemDictEntity(); + insert.setCustomerId(formDTO.getCustomerId()); + insert.setAwardPoint(formDTO.getAwardPoint()); + insert.setCategoryName(formDTO.getCategoryName()); + insert.setUsableFlag(true); + insert.setParentCode(NumConstant.ZERO_STR); + insert.setLevel(NumConstant.ONE); + insert.setSort(null != max ? max.getSort() + 1 : NumConstant.ONE); + insert.setCategoryCode(null != max ? String.valueOf(Integer.valueOf(max.getCategoryCode()) + 1) : "1001"); + baseDao.insert(insert); + } + + /** + * 03、启用或者禁用分类 + * + * @param formDTO + * @return + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void updateStatus(StatusFormDTO formDTO) { + LambdaUpdateWrapper update = new LambdaUpdateWrapper<>(); + update.eq(IcServiceItemDictEntity::getId, formDTO.getCategoryId()) + .set(IcServiceItemDictEntity::getUsableFlag, formDTO.getUsableFlag()) + .set(IcServiceItemDictEntity::getUpdatedTime, new Date()) + .set(IcServiceItemDictEntity::getUpdatedBy, formDTO.getUserId()); + baseDao.update(null, update); + } + + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.8__service_item_dict.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.8__service_item_dict.sql new file mode 100644 index 0000000000..098a4965fb --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.8__service_item_dict.sql @@ -0,0 +1,117 @@ +CREATE TABLE `ic_service_item_dict` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `PARENT_CODE` varchar(32) NOT NULL COMMENT '父级,一级默认为0', + `CATEGORY_CODE` varchar(32) NOT NULL COMMENT '分类编码', + `CATEGORY_NAME` varchar(255) NOT NULL COMMENT '分类名称', + `LEVEL` int(11) NOT NULL COMMENT '级别', + `REMARK` varchar(255) DEFAULT NULL COMMENT '备注', + `SORT` int(10) unsigned NOT NULL COMMENT '排序', + `USABLE_FLAG` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1可用,0不可用', + `AWARD_POINT` int(11) NOT NULL COMMENT '奖励积分', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE, + UNIQUE KEY `uk_dict_value` (`CATEGORY_CODE`,`CUSTOMER_ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='服务事项分类字典表'; + + +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1', 'default', '0', '1001', '积极配合社区安全巡查员进行场所消防、安全等方面的检查,并具备必须的安全意识及设备设施', 1, NULL, 1, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2', 'default', '0', '1002', '积极参与社区举办的各类生产生活安全培训讲座等', 1, NULL, 2, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('3', 'default', '0', '1003', '定期开展内部自检自查,安全培训及演练,紧绷安全生产生活弦', 1, NULL, 3, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('4', 'default', '0', '1004', '社区困难群体生活帮扶', 1, NULL, 4, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5', 'default', '0', '1005', '社区低保、伤残等困难家庭子女学习辅导', 1, NULL, 5, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('6', 'default', '0', '1006', '未成年人兴趣培养', 1, NULL, 6, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('7', 'default', '0', '1007', '楼道基础设施维护', 1, NULL, 7, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('8', 'default', '0', '1008', '健康知识专业讲座', 1, NULL, 8, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('9', 'default', '0', '1009', '老年人现代智能设备培训', 1, NULL, 9, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('10', 'default', '0', '1010', '空巢老人志愿帮扶', 1, NULL, 10, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('11', 'default', '0', '1011', '法律专业问题咨询', 1, NULL, 11, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('12', 'default', '0', '1012', '矛盾调解专业法律顾问', 1, NULL, 12, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('13', 'default', '0', '1013', '居民紧急自救、他救技能', 1, NULL, 13, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('14', 'default', '0', '1014', '少儿安全意识培养', 1, NULL, 14, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('15', 'default', '0', '1015', '文化队伍的培育和提升', 1, NULL, 15, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('16', 'default', '0', '1016', '老年群体的心理辅导', 1, NULL, 16, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('17', 'default', '0', '1017', '丰富多样的文体活动', 1, NULL, 17, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('18', 'default', '0', '1018', '失业人员技能培训', 1, NULL, 18, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('19', 'default', '0', '1019', '青年人文化活动的开展', 1, NULL, 19, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('20', 'default', '0', '1020', '亲子教育课堂', 1, NULL, 20, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('21', 'default', '0', '1021', '未成年人“家风”培育', 1, NULL, 21, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); +INSERT INTO `epmet_heart`.`ic_service_item_dict` (`ID`, `CUSTOMER_ID`, `PARENT_CODE`, `CATEGORY_CODE`, `CATEGORY_NAME`, `LEVEL`, `REMARK`, `SORT`, `USABLE_FLAG`, `AWARD_POINT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('22', 'default', '0', '1022', '和谐邻里活动开展', 1, NULL, 22, 1, 10, 0, 0, 'APP_USER', '2022-01-13 14:37:12', 'APP_USER', '2022-01-13 14:37:12'); + + + +-- 共建单位及九小场所共建 统一删除 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于服务事项分类" +where CATEGORY_CODE='1010' or PARENT_CODE='1010'; + +-- 居民积分统一从需求分类中移除 +-- 1、民生服务 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1002' or PARENT_CODE='1002'; +-- 2、便民服务 +-- 2.1便民服务-参与日常矛盾调解并取得一定成效 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='10030001' or PARENT_CODE='10030001'; +-- 2.2便民服务-爱心敲门,自愿与社区高龄、独居、孤寡、残障等人员结对子,参与日常探望、帮扶 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='10030004' or PARENT_CODE='10030004'; +-- 2.3便民服务-收集反馈社区特殊群体(高龄、残障、独居等)生活需求,并协助社区共同落实解决。 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='10030005' or PARENT_CODE='10030005'; +-- 3、城市建设 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1004' or PARENT_CODE='1004'; +-- 4、社区建设 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1005' or PARENT_CODE='1005'; +-- 5、社区自治 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1006' or PARENT_CODE='1006'; +-- 6、思想建设 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1008' or PARENT_CODE='1008'; +-- 7、文化娱乐 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1009' or PARENT_CODE='1009'; +-- 8、社会治安 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1013' or PARENT_CODE='1013'; +-- 9、消防安全 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1014' or PARENT_CODE='1014'; +-- 10、文化体育 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1015' or PARENT_CODE='1015'; +-- 11、慈善募捐 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1020' or PARENT_CODE='1020'; +-- 12、其他 +update ic_resi_demand_dict set DEL_FLAG='1',UPDATED_TIME=NOW(),REMARK="当前分类归属于居民积分" +where CATEGORY_CODE='1022' or PARENT_CODE='1022'; + + + +-- 删除需求记录、服务记录、评价记录 +update ic_user_demand_rec +set DEL_FLAG='1',UPDATED_TIME=NOW(),UPDATED_BY='删除分类' +where CATEGORY_CODE in ( + select distinct m.CATEGORY_CODE + from ic_resi_demand_dict m where m.DEL_FLAG='1' + and m.CUSTOMER_ID!='default' +); +update ic_user_demand_service set DEL_FLAG='1',UPDATED_TIME=NOW() +where DEMAND_REC_ID in( + select m.id from ic_user_demand_rec m where m.DEL_FLAG='1' +); +update ic_user_demand_satisfaction set DEL_FLAG='1',UPDATED_TIME=NOW() +WHERE DEMAND_REC_ID IN( + select m.id from ic_user_demand_rec m where m.DEL_FLAG='1' +); + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml new file mode 100644 index 0000000000..f89b3c6a83 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AddOftenUseFunctionFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AddOftenUseFunctionFormDTO.java new file mode 100644 index 0000000000..f03b2a2cf0 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AddOftenUseFunctionFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/1/17 10:09 上午 + * @DESC + */ +@Data +public class AddOftenUseFunctionFormDTO implements Serializable { + + private static final long serialVersionUID = -8044386389656626183L; + + public interface AddOftenUseFunctionForm{} + + @NotBlank(message = "menuId不能为空", groups = AddOftenUseFunctionForm.class) + private String menuId; + + @NotNull(message = "sort不能为空", groups = AddOftenUseFunctionForm.class) + private Integer sort; +} diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java new file mode 100644 index 0000000000..73ff018a10 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/1/17 9:41 上午 + * @DESC + */ +@Data +public class OftenUseFunctionListResultDTO implements Serializable { + + private static final long serialVersionUID = 8561818114575776804L; + + /** + * 跳转url + */ + private String url; + + /** + * 菜单ID + */ + private String menuId; + + /** + * 菜单名字 + */ + private String menuName; + + /** + * 图标 + */ + private String icon; + + /** + * 排序 + */ + private String sort; +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/IcOftenUseFunctionController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/IcOftenUseFunctionController.java index b852a732f2..07f036e90a 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/IcOftenUseFunctionController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/IcOftenUseFunctionController.java @@ -1,15 +1,21 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.IcOftenUseFunctionDTO; +import com.epmet.dto.form.AddOftenUseFunctionFormDTO; +import com.epmet.dto.result.OftenUseFunctionListResultDTO; import com.epmet.service.IcOftenUseFunctionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * 常用功能 * @@ -23,19 +29,27 @@ public class IcOftenUseFunctionController { @Autowired private IcOftenUseFunctionService icOftenUseFunctionService; - @PostMapping - public Result save(@RequestBody IcOftenUseFunctionDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icOftenUseFunctionService.save(dto); - return new Result(); + /** + * @Description 【社区查询】常用功能查询 + * @param tokenDto + * @author zxc + * @date 2022/1/17 9:47 上午 + */ + @PostMapping("oftenusefunctionlist") + public Result> oftenUseFunctionList(@LoginUser TokenDto tokenDto){ + return new Result>().ok(icOftenUseFunctionService.oftenUseFunctionList(tokenDto)); } - @PutMapping - public Result update(@RequestBody IcOftenUseFunctionDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - icOftenUseFunctionService.update(dto); + /** + * @Description 【社区查询】常用功能添加(就是修改) + * @param formDTOS + * @param tokenDto + * @author zxc + * @date 2022/1/17 10:13 上午 + */ + @PostMapping("addoftenusefunction") + public Result addOftenUseFunction(@RequestBody List formDTOS, @LoginUser TokenDto tokenDto){ + icOftenUseFunctionService.addOftenUseFunction(formDTOS, tokenDto); return new Result(); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/IcOftenUseFunctionDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/IcOftenUseFunctionDao.java index 9c1a1e4a21..ee0cec00e9 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/IcOftenUseFunctionDao.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/IcOftenUseFunctionDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.OftenUseFunctionListResultDTO; import com.epmet.entity.IcOftenUseFunctionEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 常用功能 @@ -29,5 +33,22 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcOftenUseFunctionDao extends BaseDao { - + + /** + * @Description 【社区查询】常用功能查询 + * @param userId + * @author zxc + * @date 2022/1/17 10:06 上午 + */ + List oftenUseFunctionList(@Param("userId")String userId); + + /** + * @Description 删除旧数据 + * @param userId + * @param customerId + * @author zxc + * @date 2022/1/17 10:25 上午 + */ + void deleteOldData(@Param("userId")String userId,@Param("customerId")String customerId); + } \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/IcOftenUseFunctionService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/IcOftenUseFunctionService.java index 440e229478..8d0c15b59c 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/IcOftenUseFunctionService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/IcOftenUseFunctionService.java @@ -18,9 +18,14 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcOftenUseFunctionDTO; +import com.epmet.dto.form.AddOftenUseFunctionFormDTO; +import com.epmet.dto.result.OftenUseFunctionListResultDTO; import com.epmet.entity.IcOftenUseFunctionEntity; +import java.util.List; + /** * 常用功能 * @@ -30,22 +35,19 @@ import com.epmet.entity.IcOftenUseFunctionEntity; public interface IcOftenUseFunctionService extends BaseService { /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2022-01-17 + * @Description 【社区查询】常用功能查询 + * @param tokenDto + * @author zxc + * @date 2022/1/17 9:47 上午 */ - void save(IcOftenUseFunctionDTO dto); + List oftenUseFunctionList(TokenDto tokenDto); /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2022-01-17 + * @Description 【社区查询】常用功能添加(就是修改) + * @param formDTOS + * @param tokenDto + * @author zxc + * @date 2022/1/17 10:13 上午 */ - void update(IcOftenUseFunctionDTO dto); + void addOftenUseFunction(List formDTOS, TokenDto tokenDto); } \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/IcOftenUseFunctionServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/IcOftenUseFunctionServiceImpl.java index b695a925ff..f12a56feef 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/IcOftenUseFunctionServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/IcOftenUseFunctionServiceImpl.java @@ -18,14 +18,21 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcOftenUseFunctionDao; import com.epmet.dto.IcOftenUseFunctionDTO; +import com.epmet.dto.form.AddOftenUseFunctionFormDTO; +import com.epmet.dto.result.OftenUseFunctionListResultDTO; import com.epmet.entity.IcOftenUseFunctionEntity; import com.epmet.service.IcOftenUseFunctionService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.List; + /** * 常用功能 * @@ -35,18 +42,40 @@ import org.springframework.transaction.annotation.Transactional; @Service public class IcOftenUseFunctionServiceImpl extends BaseServiceImpl implements IcOftenUseFunctionService { + /** + * @Description 【社区查询】常用功能查询 + * @param tokenDto + * @author zxc + * @date 2022/1/17 9:47 上午 + */ @Override - @Transactional(rollbackFor = Exception.class) - public void save(IcOftenUseFunctionDTO dto) { - IcOftenUseFunctionEntity entity = ConvertUtils.sourceToTarget(dto, IcOftenUseFunctionEntity.class); - insert(entity); + public List oftenUseFunctionList(TokenDto tokenDto) { + List result = baseDao.oftenUseFunctionList(tokenDto.getUserId()); + if (CollectionUtils.isNotEmpty(result)){ + return result; + } + return new ArrayList<>(); } + /** + * @Description 【社区查询】常用功能添加(就是修改) + * @param formDTOS + * @param tokenDto + * @author zxc + * @date 2022/1/17 10:13 上午 + */ @Override @Transactional(rollbackFor = Exception.class) - public void update(IcOftenUseFunctionDTO dto) { - IcOftenUseFunctionEntity entity = ConvertUtils.sourceToTarget(dto, IcOftenUseFunctionEntity.class); - updateById(entity); + public void addOftenUseFunction(List formDTOS, TokenDto tokenDto) { + if (CollectionUtils.isNotEmpty(formDTOS)){ + baseDao.deleteOldData(tokenDto.getUserId(),tokenDto.getCustomerId()); + List entities = ConvertUtils.sourceToTarget(formDTOS, IcOftenUseFunctionEntity.class); + entities.forEach(e -> { + e.setCustomerId(tokenDto.getCustomerId()); + e.setUserId(tokenDto.getUserId()); + }); + insertBatch(entities); + } } } \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml index 78574bd371..5f25af85fc 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml @@ -3,5 +3,25 @@ + + + DELETE FROM ic_often_use_function WHERE USER_ID = #{userId} AND CUSTOMER_ID = #{customerId} + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/EditIndividualCategoryFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/EditIndividualCategoryFormDTO.java new file mode 100644 index 0000000000..b41d1d04df --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/EditIndividualCategoryFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/1/17 10:59 上午 + * @DESC + */ +@Data +public class EditIndividualCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = -3492393795553841513L; + + public interface EditIndividualCategoryForm{} + + @NotBlank(message = "columnId不能为空",groups = EditIndividualCategoryForm.class) + private String columnId; + + @NotNull(message = "sort不能为空",groups = EditIndividualCategoryForm.class) + private Integer sort; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IndividualCategoryListResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IndividualCategoryListResultDTO.java new file mode 100644 index 0000000000..4089a151df --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IndividualCategoryListResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/1/17 10:52 上午 + * @DESC + */ +@Data +public class IndividualCategoryListResultDTO implements Serializable { + + private static final long serialVersionUID = -3294223041971531203L; + + /** + * 标签 + */ + private String label; + + /** + * 图片 + */ + private String managementIcon; + + /** + * 字段名 + */ + private String columnName; + + /** + * 排序 + */ + private Integer sort; +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcIndividualCategoryManageController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcIndividualCategoryManageController.java index 44fe329111..cd3122cd47 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcIndividualCategoryManageController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcIndividualCategoryManageController.java @@ -1,15 +1,21 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.IcIndividualCategoryManageDTO; +import com.epmet.dto.form.EditIndividualCategoryFormDTO; +import com.epmet.dto.result.IndividualCategoryListResultDTO; import com.epmet.service.IcIndividualCategoryManageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * 个人分类管理 * @@ -23,19 +29,27 @@ public class IcIndividualCategoryManageController { @Autowired private IcIndividualCategoryManageService icIndividualCategoryManageService; - @PostMapping - public Result save(@RequestBody IcIndividualCategoryManageDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icIndividualCategoryManageService.save(dto); - return new Result(); + /** + * @Description 【人员分类管理】查询个人分类列表 + * @param tokenDto + * @author zxc + * @date 2022/1/17 10:55 上午 + */ + @PostMapping("individualcategorylist") + public Result> individualCategoryList(@LoginUser TokenDto tokenDto){ + return new Result>().ok(icIndividualCategoryManageService.individualCategoryList(tokenDto)); } - @PutMapping - public Result update(@RequestBody IcIndividualCategoryManageDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - icIndividualCategoryManageService.update(dto); + /** + * @Description 【人员分类管理】个人分类修改(添加修改一个接口) + * @param formDTOS + * @param tokenDto + * @author zxc + * @date 2022/1/17 11:04 上午 + */ + @PostMapping("editindividualcategory") + public Result editIndividualCategory(@RequestBody List formDTOS,@LoginUser TokenDto tokenDto){ + icIndividualCategoryManageService.editIndividualCategory(formDTOS,tokenDto); return new Result(); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcIndividualCategoryManageDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcIndividualCategoryManageDao.java index cdc466058b..772cfc7e73 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcIndividualCategoryManageDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcIndividualCategoryManageDao.java @@ -1,8 +1,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.IndividualCategoryListResultDTO; import com.epmet.entity.IcIndividualCategoryManageEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 个人分类管理 @@ -12,5 +16,22 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcIndividualCategoryManageDao extends BaseDao { - + + /** + * @Description 删除旧数据 + * @param userId + * @param customerId + * @author zxc + * @date 2022/1/17 11:10 上午 + */ + void deleteOldData(@Param("userId")String userId,@Param("customerId")String customerId); + + /** + * @Description 【人员分类管理】查询个人分类列表 + * @param userId + * @author zxc + * @date 2022/1/17 1:25 下午 + */ + List individualCategoryList(@Param("userId")String userId); + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcIndividualCategoryManageService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcIndividualCategoryManageService.java index e21285817c..4b15339377 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcIndividualCategoryManageService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcIndividualCategoryManageService.java @@ -2,7 +2,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcIndividualCategoryManageDTO; +import com.epmet.dto.form.EditIndividualCategoryFormDTO; +import com.epmet.dto.result.IndividualCategoryListResultDTO; import com.epmet.entity.IcIndividualCategoryManageEntity; import java.util.List; @@ -17,22 +20,20 @@ import java.util.Map; public interface IcIndividualCategoryManageService extends BaseService { /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2022-01-17 + * @Description 【人员分类管理】查询个人分类列表 + * @param tokenDto + * @author zxc + * @date 2022/1/17 10:55 上午 */ - void save(IcIndividualCategoryManageDTO dto); + List individualCategoryList(TokenDto tokenDto); /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2022-01-17 + * @Description 【人员分类管理】个人分类修改(添加修改一个接口) + * @param formDTOS + * @param tokenDto + * @author zxc + * @date 2022/1/17 11:04 上午 */ - void update(IcIndividualCategoryManageDTO dto); + void editIndividualCategory(List formDTOS, TokenDto tokenDto); + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcIndividualCategoryManageServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcIndividualCategoryManageServiceImpl.java index 073cbc82b4..c684c8c36e 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcIndividualCategoryManageServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcIndividualCategoryManageServiceImpl.java @@ -1,23 +1,19 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.IcIndividualCategoryManageDao; -import com.epmet.dto.IcIndividualCategoryManageDTO; +import com.epmet.dto.form.EditIndividualCategoryFormDTO; +import com.epmet.dto.result.IndividualCategoryListResultDTO; import com.epmet.entity.IcIndividualCategoryManageEntity; import com.epmet.service.IcIndividualCategoryManageService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; -import java.util.Map; /** * 个人分类管理 @@ -28,18 +24,39 @@ import java.util.Map; @Service public class IcIndividualCategoryManageServiceImpl extends BaseServiceImpl implements IcIndividualCategoryManageService { + /** + * @Description 【人员分类管理】查询个人分类列表 + * @param tokenDto + * @author zxc + * @date 2022/1/17 10:55 上午 + */ @Override - @Transactional(rollbackFor = Exception.class) - public void save(IcIndividualCategoryManageDTO dto) { - IcIndividualCategoryManageEntity entity = ConvertUtils.sourceToTarget(dto, IcIndividualCategoryManageEntity.class); - insert(entity); + public List individualCategoryList(TokenDto tokenDto) { + List result = baseDao.individualCategoryList(tokenDto.getUserId()); + if (CollectionUtils.isNotEmpty(result)){ + return result; + } + return new ArrayList<>(); } + /** + * @Description 【人员分类管理】个人分类修改(添加修改一个接口) + * @param formDTOS + * @param tokenDto + * @author zxc + * @date 2022/1/17 11:04 上午 + */ @Override @Transactional(rollbackFor = Exception.class) - public void update(IcIndividualCategoryManageDTO dto) { - IcIndividualCategoryManageEntity entity = ConvertUtils.sourceToTarget(dto, IcIndividualCategoryManageEntity.class); - updateById(entity); + public void editIndividualCategory(List formDTOS, TokenDto tokenDto) { + if (CollectionUtils.isNotEmpty(formDTOS)){ + baseDao.deleteOldData(tokenDto.getUserId(),tokenDto.getCustomerId()); + List entities = ConvertUtils.sourceToTarget(formDTOS, IcIndividualCategoryManageEntity.class); + entities.forEach(e -> { + e.setCustomerId(tokenDto.getCustomerId()); + e.setUserId(tokenDto.getUserId()); + }); + insertBatch(entities); + } } - } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcIndividualCategoryManageDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcIndividualCategoryManageDao.xml index abb3d01e4a..926e0a8baf 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcIndividualCategoryManageDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcIndividualCategoryManageDao.xml @@ -3,5 +3,21 @@ + + + DELETE FROM ic_individual_category_manage WHERE USER_ID = #{userId} AND CUSTOMER_ID = #{customerId} + + + \ No newline at end of file