38 changed files with 2227 additions and 51 deletions
@ -0,0 +1,40 @@ |
|||
package com.elink.esua.epdc.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author songyunpeng |
|||
* @Description 根据小程序码内的字符串,解析机构名称和第三方哨卡id接口 返回结果集 |
|||
* @create 2020-02-14 |
|||
*/ |
|||
@Data |
|||
public class EpdcSentryPostInfoResultDTO implements Serializable { |
|||
|
|||
/** |
|||
* 街道名 |
|||
*/ |
|||
private String streetName; |
|||
/** |
|||
* 社区名 |
|||
*/ |
|||
private String communityName; |
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private Long gridId; |
|||
/** |
|||
* 网格名 |
|||
*/ |
|||
private String gridName; |
|||
/** |
|||
* 哨卡名称 |
|||
*/ |
|||
private String sentryPostName; |
|||
/** |
|||
* 第三方哨卡ID |
|||
*/ |
|||
private String thirdSentryPostId; |
|||
|
|||
} |
@ -0,0 +1,116 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 疫情防控哨卡表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-02-14 |
|||
*/ |
|||
@Data |
|||
public class EpidemicSentryPostDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 哨卡编码 |
|||
*/ |
|||
private String sentryPostCode; |
|||
|
|||
/** |
|||
* 哨卡名称 |
|||
*/ |
|||
private String sentryPostName; |
|||
|
|||
/** |
|||
* 第三方哨卡id |
|||
*/ |
|||
private String thirdSentryPostId; |
|||
|
|||
/** |
|||
* 哨卡所在网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 哨卡小程序码访问地址 |
|||
*/ |
|||
private String maCodeUrl; |
|||
|
|||
/** |
|||
* 父所有部门ID |
|||
*/ |
|||
private String parentDeptIds; |
|||
|
|||
/** |
|||
* 父所有部门名称 |
|||
*/ |
|||
private String parentDeptNames; |
|||
|
|||
/** |
|||
* 所有部门ID |
|||
*/ |
|||
private String allDeptIds; |
|||
|
|||
/** |
|||
* 所有部门名称 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
/** |
|||
* 删除标识 0:否,1:是 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.elink.esua.epdc.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @program: esua-epdc-cloud |
|||
* @description: 生成小程序码 |
|||
* @author: wangtong |
|||
* @create: 2020-02-14 17:38 |
|||
**/ |
|||
@Data |
|||
public class CreateCodeFormDTO implements Serializable { |
|||
|
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 哨卡id |
|||
*/ |
|||
private String postId; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.elink.esua.epdc.config; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.io.*; |
|||
|
|||
/** |
|||
* 接收文件转化File |
|||
* Created by liuhongwei on 2019/6/21. |
|||
*/ |
|||
public class StreamUtils { |
|||
|
|||
|
|||
|
|||
public static File conversionFile(MultipartFile file){ |
|||
|
|||
File toFile =null; |
|||
InputStream ins = null; |
|||
try { |
|||
// 转化字节流
|
|||
ins = file.getInputStream(); |
|||
// 获取文件名字
|
|||
toFile = new File(file.getOriginalFilename()); |
|||
// 字节转化文件
|
|||
inputStreamToFile(ins, toFile); |
|||
ins.close(); |
|||
} catch (IOException e) { |
|||
new RenException(500,"文件转化失败"); |
|||
} |
|||
return toFile; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 流转化 |
|||
* @param ins file |
|||
* @return |
|||
* @author liuhongwei |
|||
* @date 2019/6/14 14:07 |
|||
*/ |
|||
public static void inputStreamToFile(InputStream ins, File file) { |
|||
try { |
|||
OutputStream os = new FileOutputStream(file); |
|||
int bytesRead = 0; |
|||
byte[] buffer = new byte[8192]; |
|||
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { |
|||
os.write(buffer, 0, bytesRead); |
|||
} |
|||
os.close(); |
|||
ins.close(); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,175 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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.EpidemicSentryPostDTO; |
|||
import com.elink.esua.epdc.dto.form.CreateCodeFormDTO; |
|||
import com.elink.esua.epdc.modules.epidemic.excel.EpidemicSentryPostExcel; |
|||
import com.elink.esua.epdc.modules.epidemic.service.EpidemicSentryPostService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 疫情防控哨卡表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-02-14 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("epidemicSentryPost") |
|||
public class EpidemicSentryPostController { |
|||
|
|||
@Autowired |
|||
private EpidemicSentryPostService epidemicSentryPostService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<EpidemicSentryPostDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<EpidemicSentryPostDTO> page = epidemicSentryPostService.page(params); |
|||
return new Result<PageData<EpidemicSentryPostDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<EpidemicSentryPostDTO> get(@PathVariable("id") String id){ |
|||
EpidemicSentryPostDTO data = epidemicSentryPostService.get(id); |
|||
return new Result<EpidemicSentryPostDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody EpidemicSentryPostDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
epidemicSentryPostService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody EpidemicSentryPostDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
String sentryPostCode = dto.getSentryPostCode().toUpperCase(); |
|||
//编号是否重复判断
|
|||
Integer data = epidemicSentryPostService.countSentryPostCode(sentryPostCode); |
|||
if (data > 0){ |
|||
return new Result().error("哨卡编码编号重复"); |
|||
} |
|||
dto.setSentryPostCode(sentryPostCode); |
|||
epidemicSentryPostService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
epidemicSentryPostService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<EpidemicSentryPostDTO> list = epidemicSentryPostService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, EpidemicSentryPostExcel.class); |
|||
} |
|||
|
|||
@GetMapping("getEpidemicSentryBySentryPostCode/{sentryPostCode}") |
|||
public Result<EpidemicSentryPostDTO> getEpidemicSentryBySentryPostCode(@PathVariable String sentryPostCode){ |
|||
EpidemicSentryPostDTO data = epidemicSentryPostService.getEpidemicSentryBySentryPostCode(sentryPostCode); |
|||
return new Result<EpidemicSentryPostDTO>().ok(data); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @Description: 哨卡名称查询(未绑定网格id的) |
|||
* @Param: [] |
|||
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<java.util.Map<java.lang.String,java.lang.String>>> |
|||
* @Author: zy |
|||
* @Date: 2020-02-14 |
|||
*/ |
|||
@GetMapping("selectListSentryPostName") |
|||
public Result<List<Map<String,String>>> selectListSentryPostName(){ |
|||
List<Map<String,String>> data = epidemicSentryPostService.listSentryPostName(); |
|||
return new Result<List<Map<String,String>>>().ok(data); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @Description: 查询哨卡名称是否重复 |
|||
* @Param: [sentryPostCode] |
|||
* @return: java.lang.Integer |
|||
* @Author: zy |
|||
* @Date: 2020-02-15 |
|||
*/ |
|||
@GetMapping("sentryPostCodeIsRepeat/{sentryPostCode}") |
|||
public Result<Integer> sentryPostCodeIsRepeat(@PathVariable("sentryPostCode") String sentryPostCode){ |
|||
Integer data = epidemicSentryPostService.countSentryPostCode(sentryPostCode); |
|||
return new Result<Integer>().ok(data); |
|||
} |
|||
|
|||
/*** |
|||
* 导入 |
|||
* @param file |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author qushutong |
|||
* @date 2020/2/14 12:34 |
|||
*/ |
|||
@PostMapping("importExcel") |
|||
public Result importExcel(@RequestParam("file") MultipartFile file) { |
|||
return epidemicSentryPostService.insertEpidemicList(file); |
|||
} |
|||
|
|||
/** |
|||
*生成哨卡单个小程序码 |
|||
* |
|||
* @author wangtong |
|||
* @date 2020/2/14 17:46 |
|||
* @param [formDto] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
*/ |
|||
@PostMapping("createCode") |
|||
public Result createPostsCode(@RequestBody CreateCodeFormDTO formDto){ |
|||
return this.epidemicSentryPostService.createPostsCode(formDto); |
|||
} |
|||
|
|||
/** |
|||
*生成哨卡多个小程序码 |
|||
* |
|||
* @author wangtong |
|||
* @date 2020/2/14 17:46 |
|||
* @param [formDto] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
*/ |
|||
@PostMapping("createCodes") |
|||
public Result createPostsCodes(@RequestBody CreateCodeFormDTO formDto){ |
|||
return this.epidemicSentryPostService.createPostsCodes(formDto); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,59 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.epidemic.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO; |
|||
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicSentryPostEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 疫情防控哨卡表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-02-14 |
|||
*/ |
|||
@Mapper |
|||
public interface EpidemicSentryPostDao extends BaseDao<EpidemicSentryPostEntity> { |
|||
|
|||
EpidemicSentryPostEntity selectOneOfEpidemicSentryBySentryPostCode(String sentryPostCode); |
|||
|
|||
|
|||
/** |
|||
* @Description: 哨卡名称查询(未绑定网格id的) |
|||
* @Param: [] |
|||
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<java.util.Map<java.lang.String,java.lang.String>>> |
|||
* @Author: zy |
|||
* @Date: 2020-02-14 |
|||
*/ |
|||
List<Map<String,String>> selectListSentryPostName(); |
|||
|
|||
/** |
|||
* @Description: 查询哨卡名称是否重复 |
|||
* @Param: [sentryPostCode] |
|||
* @return: java.lang.Integer |
|||
* @Author: zy |
|||
* @Date: 2020-02-15 |
|||
*/ |
|||
Integer selectCountSentryPostCode(String sentryPostCode); |
|||
} |
@ -0,0 +1,86 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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 2020-02-14 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_epidemic_sentry_post") |
|||
public class EpidemicSentryPostEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 哨卡编码 |
|||
*/ |
|||
private String sentryPostCode; |
|||
|
|||
/** |
|||
* 哨卡名称 |
|||
*/ |
|||
private String sentryPostName; |
|||
|
|||
/** |
|||
* 第三方哨卡id |
|||
*/ |
|||
private String thirdSentryPostId; |
|||
|
|||
/** |
|||
* 哨卡所在网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 哨卡小程序码访问地址 |
|||
*/ |
|||
private String maCodeUrl; |
|||
|
|||
/** |
|||
* 父所有部门ID |
|||
*/ |
|||
private String parentDeptIds; |
|||
|
|||
/** |
|||
* 父所有部门名称 |
|||
*/ |
|||
private String parentDeptNames; |
|||
|
|||
/** |
|||
* 所有部门ID |
|||
*/ |
|||
private String allDeptIds; |
|||
|
|||
/** |
|||
* 所有部门名称 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
} |
@ -0,0 +1,83 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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 2020-02-14 |
|||
*/ |
|||
@Data |
|||
public class EpidemicSentryPostExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "哨卡编码") |
|||
private String sentryPostCode; |
|||
|
|||
@Excel(name = "哨卡名称") |
|||
private String sentryPostName; |
|||
|
|||
@Excel(name = "第三方哨卡id") |
|||
private String thirdSentryPostId; |
|||
|
|||
@Excel(name = "哨卡所在网格id") |
|||
private String gridId; |
|||
|
|||
@Excel(name = "哨卡小程序码访问地址") |
|||
private String maCodeUrl; |
|||
|
|||
@Excel(name = "父所有部门ID") |
|||
private String parentDeptIds; |
|||
|
|||
@Excel(name = "父所有部门名称") |
|||
private String parentDeptNames; |
|||
|
|||
@Excel(name = "所有部门ID") |
|||
private String allDeptIds; |
|||
|
|||
@Excel(name = "所有部门名称") |
|||
private String allDeptNames; |
|||
|
|||
@Excel(name = "删除标识 0:否,1:是") |
|||
private String delFlag; |
|||
|
|||
@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; |
|||
|
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.elink.esua.epdc.modules.epidemic.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.UploadToOssDTO; |
|||
import com.elink.esua.epdc.modules.epidemic.feign.fallback.OssFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
|
|||
|
|||
/** |
|||
* @author work@yujt.net.cn |
|||
* @date 19/9/19 10:12 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_OSS_SERVER, fallback = OssFeignClientFallback.class) |
|||
public interface OssFeignClient { |
|||
//,url = "http://127.0.0.1:9095"
|
|||
|
|||
/** |
|||
* File文件上传到文件服务器 |
|||
* |
|||
* @param dto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.lang.String> |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/9/19 10:15 |
|||
*/ |
|||
@PostMapping(value = "oss/file/uploadFile", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result<String> uploadFile(UploadToOssDTO dto); |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.elink.esua.epdc.modules.epidemic.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.UploadToOssDTO; |
|||
import com.elink.esua.epdc.modules.epidemic.feign.OssFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @author work@yujt.net.cn |
|||
* @date 19/9/19 10:12 |
|||
*/ |
|||
@Component |
|||
public class OssFeignClientFallback implements OssFeignClient { |
|||
|
|||
@Override |
|||
public Result<String> uploadFile(UploadToOssDTO dto) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_OSS_SERVER, "uploadFile", dto.getFileName()); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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 2020-02-14 |
|||
*/ |
|||
@Component |
|||
public class EpidemicSentryPostRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,153 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO; |
|||
import com.elink.esua.epdc.dto.form.CreateCodeFormDTO; |
|||
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicSentryPostEntity; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 疫情防控哨卡表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-02-14 |
|||
*/ |
|||
public interface EpidemicSentryPostService extends BaseService<EpidemicSentryPostEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<EpidemicSentryPostDTO> |
|||
* @author generator |
|||
* @date 2020-02-14 |
|||
*/ |
|||
PageData<EpidemicSentryPostDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<EpidemicSentryPostDTO> |
|||
* @author generator |
|||
* @date 2020-02-14 |
|||
*/ |
|||
List<EpidemicSentryPostDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return EpidemicSentryPostDTO |
|||
* @author generator |
|||
* @date 2020-02-14 |
|||
*/ |
|||
EpidemicSentryPostDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-02-14 |
|||
*/ |
|||
void save(EpidemicSentryPostDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-02-14 |
|||
*/ |
|||
void update(EpidemicSentryPostDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-02-14 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* @Description 根据哨卡编码获取疫情防控哨卡表数据 |
|||
* @Author songyunpeng |
|||
* @Date 2020/2/14 |
|||
* @Param [sentryPostCode] |
|||
* @return com.elink.esua.epdc.dto.EpidemicSentryPostDTO |
|||
**/ |
|||
EpidemicSentryPostDTO getEpidemicSentryBySentryPostCode(String sentryPostCode); |
|||
|
|||
/** |
|||
* @Description: 哨卡名称查询(未绑定网格id的) |
|||
* @Param: [] |
|||
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<java.util.Map<java.lang.String,java.lang.String>>> |
|||
* @Author: zy |
|||
* @Date: 2020-02-14 |
|||
*/ |
|||
List<Map<String,String>> listSentryPostName(); |
|||
|
|||
/** |
|||
* @Description: 查询哨卡名称是否重复 |
|||
* @Param: [sentryPostCode] |
|||
* @return: java.lang.Integer |
|||
* @Author: zy |
|||
* @Date: 2020-02-15 |
|||
*/ |
|||
Integer countSentryPostCode(String sentryPostCode);; |
|||
|
|||
/*** |
|||
* 导入表格 |
|||
* @param |
|||
* @return void |
|||
* @author qushutong |
|||
* @date 2020/2/14 12:38 |
|||
*/ |
|||
Result insertEpidemicList(MultipartFile file); |
|||
|
|||
/** |
|||
*生成单个哨卡小程序码 |
|||
* |
|||
* @author wangtong |
|||
* @date 2020/2/14 17:57 |
|||
* @param [formDto] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
*/ |
|||
Result createPostsCode(CreateCodeFormDTO formDto); |
|||
|
|||
/** |
|||
*生成多个哨卡小程序码 |
|||
* @author wangtong |
|||
* @date 2020/2/14 20:58 |
|||
* @param [formDto] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
*/ |
|||
Result createPostsCodes(CreateCodeFormDTO formDto); |
|||
} |
@ -0,0 +1,301 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.epidemic.service.impl; |
|||
|
|||
import cn.afterturn.easypoi.excel.ExcelImportUtil; |
|||
import cn.afterturn.easypoi.excel.entity.ImportParams; |
|||
import cn.hutool.core.collection.CollUtil; |
|||
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.constant.NumConstant; |
|||
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.config.StreamUtils; |
|||
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO; |
|||
import com.elink.esua.epdc.dto.UploadToOssDTO; |
|||
import com.elink.esua.epdc.dto.form.CreateCodeFormDTO; |
|||
import com.elink.esua.epdc.modules.epidemic.dao.EpidemicSentryPostDao; |
|||
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicSentryPostEntity; |
|||
import com.elink.esua.epdc.modules.epidemic.excel.EpidemicSentryPostExcel; |
|||
import com.elink.esua.epdc.modules.epidemic.feign.OssFeignClient; |
|||
import com.elink.esua.epdc.modules.epidemic.redis.EpidemicSentryPostRedis; |
|||
import com.elink.esua.epdc.modules.epidemic.service.EpidemicSentryPostService; |
|||
import com.elink.esua.epdc.utils.WxMaServiceUtils; |
|||
import me.chanjar.weixin.common.error.WxErrorException; |
|||
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 org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.File; |
|||
import java.io.FileInputStream; |
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 疫情防控哨卡表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-02-14 |
|||
*/ |
|||
@Service |
|||
public class EpidemicSentryPostServiceImpl extends BaseServiceImpl<EpidemicSentryPostDao, EpidemicSentryPostEntity> implements EpidemicSentryPostService { |
|||
|
|||
@Autowired |
|||
private EpidemicSentryPostRedis epidemicSentryPostRedis; |
|||
|
|||
@Autowired |
|||
private WxMaServiceUtils wxMaServiceUtils; |
|||
|
|||
@Autowired |
|||
private OssFeignClient ossFeignClient; |
|||
|
|||
/** |
|||
* 小程序首页 |
|||
*/ |
|||
private static String MA_FRONT_PAGE_URL = "pages/fromVirus/fromVirus"; |
|||
|
|||
@Override |
|||
public PageData<EpidemicSentryPostDTO> page(Map<String, Object> params) { |
|||
IPage<EpidemicSentryPostEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, EpidemicSentryPostDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<EpidemicSentryPostDTO> list(Map<String, Object> params) { |
|||
List<EpidemicSentryPostEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, EpidemicSentryPostDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<EpidemicSentryPostEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
String gridId = (String) params.get(FieldConstant.GRID_ID_HUMP); |
|||
String sentryPostCode = (String) params.get("sentryPostCode"); |
|||
|
|||
QueryWrapper<EpidemicSentryPostEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
wrapper.eq(StringUtils.isNotBlank(gridId), "grid_id", gridId); |
|||
wrapper.like(StringUtils.isNotBlank(sentryPostCode), "sentry_post_code", sentryPostCode); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public EpidemicSentryPostDTO get(String id) { |
|||
EpidemicSentryPostEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, EpidemicSentryPostDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(EpidemicSentryPostDTO dto) { |
|||
EpidemicSentryPostEntity entity = ConvertUtils.sourceToTarget(dto, EpidemicSentryPostEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(EpidemicSentryPostDTO dto) { |
|||
EpidemicSentryPostEntity entity = ConvertUtils.sourceToTarget(dto, EpidemicSentryPostEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public EpidemicSentryPostDTO getEpidemicSentryBySentryPostCode(String sentryPostCode) { |
|||
EpidemicSentryPostEntity entity = baseDao.selectOneOfEpidemicSentryBySentryPostCode(sentryPostCode); |
|||
return ConvertUtils.sourceToTarget(entity, EpidemicSentryPostDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<Map<String, String>> listSentryPostName() { |
|||
return baseDao.selectListSentryPostName(); |
|||
} |
|||
|
|||
@Override |
|||
public Integer countSentryPostCode(String sentryPostCode) { |
|||
//字母转大写
|
|||
sentryPostCode = sentryPostCode.toUpperCase(); |
|||
return baseDao.selectCountSentryPostCode(sentryPostCode); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public Result insertEpidemicList(MultipartFile file) { |
|||
File f = StreamUtils.conversionFile(file); |
|||
ImportParams importParams = new ImportParams(); |
|||
List<EpidemicSentryPostEntity> oldEntityList = baseDao.selectList(new QueryWrapper<>()); |
|||
List<EpidemicSentryPostExcel> epidemicExcelList = ExcelImportUtil.importExcel(f, EpidemicSentryPostExcel.class, importParams); |
|||
// third_sentry_post_id 已存在更新 不存在插入
|
|||
List<EpidemicSentryPostDTO> newEpidemicList = this.updataOrSaveExcel(epidemicExcelList, oldEntityList); |
|||
List<EpidemicSentryPostEntity> epidemicList = ConvertUtils.sourceToTarget(newEpidemicList, EpidemicSentryPostEntity.class); |
|||
boolean b = insertBatch(epidemicList); |
|||
return new Result(); |
|||
} |
|||
|
|||
private List<EpidemicSentryPostDTO> updataOrSaveExcel(List<EpidemicSentryPostExcel> epidemicExcelList, List<EpidemicSentryPostEntity> oldEntityList) { |
|||
List<EpidemicSentryPostExcel> newEpidemicList = new ArrayList<>(); |
|||
newEpidemicList.addAll(epidemicExcelList); |
|||
QueryWrapper<EpidemicSentryPostEntity> wrapper; |
|||
for (EpidemicSentryPostExcel item : epidemicExcelList) { |
|||
if (StringUtils.isNotBlank(item.getThirdSentryPostId())) { |
|||
item.setThirdSentryPostId(item.getThirdSentryPostId().trim()); |
|||
} |
|||
for (EpidemicSentryPostEntity oldItem : oldEntityList) { |
|||
if (StringUtils.isNotBlank(item.getThirdSentryPostId()) && item.getThirdSentryPostId().equals(oldItem.getThirdSentryPostId())) { |
|||
//三方哨卡Id相同时 更新
|
|||
EpidemicSentryPostEntity epidemicSentryPostEntity = ConvertUtils.sourceToTarget(item, EpidemicSentryPostEntity.class); |
|||
wrapper = new QueryWrapper<>(); |
|||
wrapper.eq("third_sentry_post_id", epidemicSentryPostEntity.getThirdSentryPostId()); |
|||
update(epidemicSentryPostEntity, wrapper); |
|||
newEpidemicList.remove(item); |
|||
} |
|||
} |
|||
} |
|||
return ConvertUtils.sourceToTarget(newEpidemicList, EpidemicSentryPostDTO.class); |
|||
} |
|||
|
|||
@Transactional |
|||
@Override |
|||
public Result createPostsCode(CreateCodeFormDTO formDto) { |
|||
if (!StringUtils.isNotBlank(formDto.getPostId())) { |
|||
throw new RenException("哨卡id不可为空!"); |
|||
} |
|||
EpidemicSentryPostEntity entity = baseDao.selectById(formDto.getPostId()); |
|||
if (entity == null) { |
|||
throw new RenException("根据哨卡id未查到哨卡信息!"); |
|||
} |
|||
if (!StringUtils.isNotBlank(entity.getGridId())) { |
|||
throw new RenException("根据哨卡id未查到网格id信息!"); |
|||
} |
|||
if (StringUtils.isNotBlank(entity.getMaCodeUrl())) { |
|||
throw new RenException("该小程序码已经存在!"); |
|||
} |
|||
String param = entity.getGridId().concat("-").concat(entity.getSentryPostCode()); |
|||
entity.setMaCodeUrl(this.createMaCode(param, MA_FRONT_PAGE_URL)); |
|||
baseDao.updateById(entity); |
|||
return new Result().ok("生成单个小程序码成功。"); |
|||
} |
|||
|
|||
@Transactional |
|||
@Override |
|||
public Result createPostsCodes(CreateCodeFormDTO formDto) { |
|||
if (!StringUtils.isNotBlank(formDto.getGridId())) { |
|||
throw new RenException("网格id不可为空!"); |
|||
} |
|||
EpidemicSentryPostEntity data = new EpidemicSentryPostEntity(); |
|||
data.setGridId(formDto.getGridId()); |
|||
QueryWrapper<EpidemicSentryPostEntity> wrapper = new QueryWrapper<>(data); |
|||
List<EpidemicSentryPostEntity> categoryEntityList = baseDao.selectList(wrapper); |
|||
if (CollUtil.isEmpty(categoryEntityList)) { |
|||
throw new RenException("根据网格id未查到哨卡信息!"); |
|||
} |
|||
Boolean isHave = false; |
|||
for (EpidemicSentryPostEntity entity : categoryEntityList) { |
|||
if (StringUtils.isNotBlank(entity.getMaCodeUrl())) { |
|||
continue; |
|||
} |
|||
String param = entity.getGridId().concat("-").concat(entity.getSentryPostCode()); |
|||
entity.setMaCodeUrl(this.createMaCode(param, MA_FRONT_PAGE_URL)); |
|||
baseDao.updateById(entity); |
|||
isHave = true; |
|||
} |
|||
if(!isHave){ |
|||
throw new RenException("该网格下的哨卡编码已经全部存在,不可重复生成!"); |
|||
} |
|||
return new Result().ok("批量生成小程序码成功。"); |
|||
} |
|||
|
|||
/** |
|||
* 创建微信小程序码,并上传到oss |
|||
* |
|||
* @param param 小程序码的参数 |
|||
* @param pageUrl 小程序码的跳转链接 |
|||
* @return java.lang.String 小程序码的下载抵制 |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/10/22 10:14 |
|||
*/ |
|||
private String createMaCode(String param, String pageUrl) { |
|||
File wxaCodeUnlimit; |
|||
try { |
|||
wxaCodeUnlimit = wxMaServiceUtils.normalWxMaService().getQrcodeService() |
|||
.createWxaCodeUnlimit(param, pageUrl, 1280, true, null, false); |
|||
} catch (WxErrorException e) { |
|||
throw new RenException("请求微信接口失败"); |
|||
} |
|||
|
|||
UploadToOssDTO dto = new UploadToOssDTO(); |
|||
dto.setFileByte(this.fileToByteArray(wxaCodeUnlimit)); |
|||
dto.setFileName(wxaCodeUnlimit.getName()); |
|||
|
|||
Result<String> ossResult = ossFeignClient.uploadFile(dto); |
|||
if (null == ossResult || !ossResult.success() || null == ossResult.getData()) { |
|||
throw new RenException("小程序码上传失败"); |
|||
} |
|||
return ossResult.getData(); |
|||
} |
|||
|
|||
/** |
|||
* File文件转为byte[] |
|||
* |
|||
* @param file |
|||
* @return byte[] |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/9/19 15:56 |
|||
*/ |
|||
private byte[] fileToByteArray(File file) { |
|||
try { |
|||
//获取输入流
|
|||
FileInputStream fis = new FileInputStream(file); |
|||
//新的 byte 数组输出流,缓冲区容量1024byte
|
|||
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024); |
|||
//缓存
|
|||
byte[] b = new byte[1024]; |
|||
int n; |
|||
while ((n = fis.read(b)) != NumConstant.ONE_NEG) { |
|||
bos.write(b, NumConstant.ZERO, n); |
|||
} |
|||
fis.close(); |
|||
//改变为byte[]
|
|||
byte[] data = bos.toByteArray(); |
|||
bos.close(); |
|||
return data; |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return null; |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.modules.epidemic.dao.EpidemicSentryPostDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.epidemic.entity.EpidemicSentryPostEntity" id="epidemicSentryPostMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="sentryPostCode" column="sentry_post_code"/> |
|||
<result property="sentryPostName" column="sentry_post_name"/> |
|||
<result property="thirdSentryPostId" column="third_sentry_post_id"/> |
|||
<result property="gridId" column="grid_id"/> |
|||
<result property="maCodeUrl" column="ma_code_url"/> |
|||
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/> |
|||
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/> |
|||
<result property="allDeptIds" column="ALL_DEPT_IDS"/> |
|||
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<select id="selectOneOfEpidemicSentryBySentryPostCode" resultMap="epidemicSentryPostMap"> |
|||
select |
|||
ID, |
|||
sentry_post_code, |
|||
sentry_post_name, |
|||
third_sentry_post_id, |
|||
grid_id, |
|||
ma_code_url, |
|||
PARENT_DEPT_IDS, |
|||
PARENT_DEPT_NAMES, |
|||
DEL_FLAG, |
|||
REVISION, |
|||
CREATED_BY, |
|||
CREATED_TIME, |
|||
UPDATED_BY, |
|||
UPDATED_TIME |
|||
from epdc_epidemic_sentry_post |
|||
where sentry_post_code = #{sentryPostCode} |
|||
</select> |
|||
<select id="selectListSentryPostName" resultType="Map"> |
|||
SELECT |
|||
p.ID id, |
|||
p.sentry_post_name sentryPostName |
|||
FROM |
|||
epdc_epidemic_sentry_post p |
|||
WHERE |
|||
p.DEL_FLAG = 0 |
|||
AND p.grid_id IS NULL |
|||
ORDER BY |
|||
p.CREATED_TIME desc |
|||
</select> |
|||
|
|||
<select id="selectCountSentryPostCode" resultType="Integer" parameterType="String"> |
|||
SELECT |
|||
count(1) |
|||
FROM |
|||
epdc_epidemic_sentry_post p |
|||
WHERE |
|||
p.DEL_FLAG = 0 |
|||
AND p.sentry_post_code = #{sentryPostCode} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,81 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto.epdc; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 用户车辆信息表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-02-15 |
|||
*/ |
|||
@Data |
|||
public class UserCarInfoDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String carNumber; |
|||
|
|||
/** |
|||
* 删除标记 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 注册时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
package com.elink.esua.epdc.dto.epdc.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/2/15 10:49 |
|||
* @Description: 居民在防疫哨卡进行登记时,上送数据并完善党群系统个人信息 |
|||
*/ |
|||
@Data |
|||
public class EpdcAppPidemicCompleteInfoFromDTO implements Serializable { |
|||
private static final long serialVersionUID = -582216042705118851L; |
|||
|
|||
|
|||
/** |
|||
* postId : 79829 |
|||
* name : AcIr6xcOZ0 |
|||
* idcard : IYG4MnDCs1 |
|||
* phone : OZQRjNMqXk |
|||
* habitationDetail : C5zuxTv9mx |
|||
* isRent : VlInKevtSy |
|||
* isDriver : zW3ek3AUpm |
|||
* carNum : 6oOeXKemVl |
|||
*/ |
|||
@NotBlank(message = "第三方哨卡ID") |
|||
private String postId; |
|||
@NotBlank(message = "姓名") |
|||
private String name; |
|||
@NotBlank(message = "身份证号") |
|||
private String idcard; |
|||
@NotBlank(message = "手机号") |
|||
private String phone; |
|||
@NotBlank(message = "居住地址") |
|||
private String habitationDetail; |
|||
@NotBlank(message = "是否租房") |
|||
private String isRent; |
|||
@NotBlank(message = "是否有车") |
|||
private String isDriver; |
|||
@NotBlank(message = "车牌号码") |
|||
private String carNum; |
|||
|
|||
private String userId; |
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.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.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.dto.epdc.UserCarInfoDTO; |
|||
import com.elink.esua.epdc.excel.UserCarInfoExcel; |
|||
import com.elink.esua.epdc.service.UserCarInfoService; |
|||
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 2020-02-15 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("usercarinfo") |
|||
public class UserCarInfoController { |
|||
|
|||
@Autowired |
|||
private UserCarInfoService userCarInfoService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<UserCarInfoDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<UserCarInfoDTO> page = userCarInfoService.page(params); |
|||
return new Result<PageData<UserCarInfoDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<UserCarInfoDTO> get(@PathVariable("id") String id){ |
|||
UserCarInfoDTO data = userCarInfoService.get(id); |
|||
return new Result<UserCarInfoDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody UserCarInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
userCarInfoService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody UserCarInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
userCarInfoService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
userCarInfoService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<UserCarInfoDTO> list = userCarInfoService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, UserCarInfoExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.UserCarInfoEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 用户车辆信息表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-02-15 |
|||
*/ |
|||
@Mapper |
|||
public interface UserCarInfoDao extends BaseDao<UserCarInfoEntity> { |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.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 2020-02-15 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_user_car_info") |
|||
public class UserCarInfoEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String carNumber; |
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.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 2020-02-15 |
|||
*/ |
|||
@Data |
|||
public class UserCarInfoExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "昵称") |
|||
private String userId; |
|||
|
|||
@Excel(name = "手机号") |
|||
private String carNumber; |
|||
|
|||
@Excel(name = "删除标记") |
|||
private String delFlag; |
|||
|
|||
@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; |
|||
|
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.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 2020-02-15 |
|||
*/ |
|||
@Component |
|||
public class UserCarInfoRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,104 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.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.epdc.UserCarInfoDTO; |
|||
import com.elink.esua.epdc.entity.UserCarInfoEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用户车辆信息表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-02-15 |
|||
*/ |
|||
public interface UserCarInfoService extends BaseService<UserCarInfoEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<UserCarInfoDTO> |
|||
* @author generator |
|||
* @date 2020-02-15 |
|||
*/ |
|||
PageData<UserCarInfoDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<UserCarInfoDTO> |
|||
* @author generator |
|||
* @date 2020-02-15 |
|||
*/ |
|||
List<UserCarInfoDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return UserCarInfoDTO |
|||
* @author generator |
|||
* @date 2020-02-15 |
|||
*/ |
|||
UserCarInfoDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-02-15 |
|||
*/ |
|||
void save(UserCarInfoDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-02-15 |
|||
*/ |
|||
void update(UserCarInfoDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-02-15 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/*** |
|||
* 根据carNumber |
|||
* @param carNumber |
|||
* @return com.elink.esua.epdc.dto.epdc.UserCarInfoDTO |
|||
* @author qushutong |
|||
* @date 2020/2/15 18:42 |
|||
*/ |
|||
UserCarInfoDTO selectOneByCarNumber(String carNumber); |
|||
} |
@ -0,0 +1,112 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.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.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.dao.UserCarInfoDao; |
|||
import com.elink.esua.epdc.dto.epdc.UserCarInfoDTO; |
|||
import com.elink.esua.epdc.entity.UserCarInfoEntity; |
|||
import com.elink.esua.epdc.redis.UserCarInfoRedis; |
|||
import com.elink.esua.epdc.service.UserCarInfoService; |
|||
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 2020-02-15 |
|||
*/ |
|||
@Service |
|||
public class UserCarInfoServiceImpl extends BaseServiceImpl<UserCarInfoDao, UserCarInfoEntity> implements UserCarInfoService { |
|||
|
|||
@Autowired |
|||
private UserCarInfoRedis userCarInfoRedis; |
|||
|
|||
@Override |
|||
public PageData<UserCarInfoDTO> page(Map<String, Object> params) { |
|||
IPage<UserCarInfoEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, UserCarInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<UserCarInfoDTO> list(Map<String, Object> params) { |
|||
List<UserCarInfoEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, UserCarInfoDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<UserCarInfoEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<UserCarInfoEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public UserCarInfoDTO get(String id) { |
|||
UserCarInfoEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, UserCarInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(UserCarInfoDTO dto) { |
|||
UserCarInfoEntity entity = ConvertUtils.sourceToTarget(dto, UserCarInfoEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(UserCarInfoDTO dto) { |
|||
UserCarInfoEntity entity = ConvertUtils.sourceToTarget(dto, UserCarInfoEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public UserCarInfoDTO selectOneByCarNumber(String carNumber) { |
|||
QueryWrapper wrapper = new QueryWrapper(); |
|||
wrapper.eq("CAR_NUMBER",carNumber); |
|||
UserCarInfoEntity userCarInfoEntity = baseDao.selectOne(wrapper); |
|||
return ConvertUtils.sourceToTarget(userCarInfoEntity,UserCarInfoDTO.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.dao.UserCarInfoDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.entity.UserCarInfoEntity" id="userCarInfoMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="carNumber" column="CAR_NUMBER"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue