diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/TripReportController.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/TripReportController.java new file mode 100644 index 0000000..81ba1c1 --- /dev/null +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/controller/TripReportController.java @@ -0,0 +1,94 @@ +/** + * 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.elink.esua.epdc.modules.epidemic.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.dto.TripReportDTO; +import com.elink.esua.epdc.modules.epidemic.excel.TripReportExcel; +import com.elink.esua.epdc.modules.epidemic.service.TripReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 行程上报信息 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-10-13 + */ +@RestController +@RequestMapping("tripreport") +public class TripReportController { + + @Autowired + private TripReportService tripReportService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = tripReportService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TripReportDTO data = tripReportService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TripReportDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + tripReportService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TripReportDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + tripReportService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + tripReportService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = tripReportService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, TripReportExcel.class); + } + +} \ No newline at end of file diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/TripReportDao.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/TripReportDao.java new file mode 100644 index 0000000..0dbe177 --- /dev/null +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/dao/TripReportDao.java @@ -0,0 +1,33 @@ +/** + * 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.elink.esua.epdc.modules.epidemic.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.epidemic.entity.TripReportEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 行程上报信息 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-10-13 + */ +@Mapper +public interface TripReportDao extends BaseDao { + +} \ No newline at end of file diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/TripReportEntity.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/TripReportEntity.java new file mode 100644 index 0000000..5ac7eec --- /dev/null +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/entity/TripReportEntity.java @@ -0,0 +1,146 @@ +/** + * 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.elink.esua.epdc.modules.epidemic.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 行程上报信息 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-10-13 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_trip_report") +public class TripReportEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + private String name; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证 + */ + private String idCard; + + /** + * 现居住地编码 + */ + private String nowAddressCode; + + /** + * 现居住地名称 + */ + private String nowAddressName; + + /** + * 现居住详细地址 + */ + private String nowAddressDaetail; + + /** + * 来自地区编码 + */ + private String comeAddressCode; + + /** + * 来自地区名称 + */ + private String comeAddressName; + + /** + * 来到(本地)时间 + */ + private Date comeDate; + + /** + * 返回时间 + */ + private Date backDate; + + /** + * 备注 + */ + private String note; + + /** + * 用户id + */ + private String userId; + + /** + * 手机号 + */ + private String userMobile; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 头像 + */ + private String faceImg; + + /** + * 部门ID + */ + private String deptId; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 父所有部门 + */ + private String parentDeptIds; + + /** + * 父所有部门 + */ + private String parentDeptNames; + +} \ No newline at end of file diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/TripReportExcel.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/TripReportExcel.java new file mode 100644 index 0000000..0f24459 --- /dev/null +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/excel/TripReportExcel.java @@ -0,0 +1,119 @@ +/** + * 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.elink.esua.epdc.modules.epidemic.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 行程上报信息 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-10-13 + */ +@Data +public class TripReportExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "姓名") + private String name; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "身份证") + private String idCard; + + @Excel(name = "现居住地编码") + private String nowAddressCode; + + @Excel(name = "现居住地名称") + private String nowAddressName; + + @Excel(name = "现居住详细地址") + private String nowAddressDaetail; + + @Excel(name = "来自地区编码") + private String comeAddressCode; + + @Excel(name = "来自地区名称") + private String comeAddressName; + + @Excel(name = "来到(本地)时间") + private Date comeDate; + + @Excel(name = "返回时间") + private Date backDate; + + @Excel(name = "备注") + private String note; + + @Excel(name = "用户id") + private String userId; + + @Excel(name = "手机号") + private String userMobile; + + @Excel(name = "真实姓名") + private String realName; + + @Excel(name = "头像") + private String faceImg; + + @Excel(name = "部门ID") + private String deptId; + + @Excel(name = "部门名称") + private String deptName; + + @Excel(name = "所有部门ID") + private String allDeptIds; + + @Excel(name = "所有部门名称") + private String allDeptNames; + + @Excel(name = "父所有部门") + private String parentDeptIds; + + @Excel(name = "父所有部门") + private String parentDeptNames; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "逻辑删除标识") + private String delFlag; + + +} \ No newline at end of file diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/TripReportRedis.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/TripReportRedis.java new file mode 100644 index 0000000..24c0551 --- /dev/null +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/redis/TripReportRedis.java @@ -0,0 +1,47 @@ +/** + * 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.elink.esua.epdc.modules.epidemic.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 行程上报信息 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-10-13 + */ +@Component +public class TripReportRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/TripReportService.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/TripReportService.java new file mode 100644 index 0000000..e2fe3c5 --- /dev/null +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/TripReportService.java @@ -0,0 +1,95 @@ +/** + * 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.elink.esua.epdc.modules.epidemic.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.TripReportDTO; +import com.elink.esua.epdc.modules.epidemic.entity.TripReportEntity; + +import java.util.List; +import java.util.Map; + +/** + * 行程上报信息 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-10-13 + */ +public interface TripReportService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-10-13 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-10-13 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TripReportDTO + * @author generator + * @date 2021-10-13 + */ + TripReportDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-10-13 + */ + void save(TripReportDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-10-13 + */ + void update(TripReportDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-10-13 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/TripReportServiceImpl.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/TripReportServiceImpl.java new file mode 100644 index 0000000..fc82b2f --- /dev/null +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/TripReportServiceImpl.java @@ -0,0 +1,104 @@ +/** + * 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.elink.esua.epdc.modules.epidemic.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.dto.TripReportDTO; +import com.elink.esua.epdc.modules.epidemic.dao.TripReportDao; +import com.elink.esua.epdc.modules.epidemic.entity.TripReportEntity; +import com.elink.esua.epdc.modules.epidemic.redis.TripReportRedis; +import com.elink.esua.epdc.modules.epidemic.service.TripReportService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 行程上报信息 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-10-13 + */ +@Service +public class TripReportServiceImpl extends BaseServiceImpl implements TripReportService { + + @Autowired + private TripReportRedis tripReportRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TripReportDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TripReportDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public TripReportDTO get(String id) { + TripReportEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TripReportDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TripReportDTO dto) { + TripReportEntity entity = ConvertUtils.sourceToTarget(dto, TripReportEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TripReportDTO dto) { + TripReportEntity entity = ConvertUtils.sourceToTarget(dto, TripReportEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epdc-cloud-custom/src/main/resources/mapper/epidemic/TripReportDao.xml b/epdc-cloud-custom/src/main/resources/mapper/epidemic/TripReportDao.xml new file mode 100644 index 0000000..8ed10b3 --- /dev/null +++ b/epdc-cloud-custom/src/main/resources/mapper/epidemic/TripReportDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file