Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4a56064d64
|
|
@ -0,0 +1,135 @@
|
|||
package com.bonus.base.config;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
/**
|
||||
* 数据库连接地址
|
||||
*/
|
||||
public static final String SOURCEURL = "jdbc:mysql://127.0.0.1:3306/bns-smartwh";
|
||||
|
||||
/**
|
||||
* 数据库连接账户
|
||||
*/
|
||||
public static final String SOURCEUSER = "shuaima";
|
||||
|
||||
/**
|
||||
* 数据库连接密码
|
||||
*/
|
||||
public static final String SOURCEPASSWORD = "Mashuai123@";
|
||||
|
||||
/**
|
||||
* 班组负责人
|
||||
*/
|
||||
public static final String TEAM_LEADER = "0900101";
|
||||
|
||||
/**
|
||||
* 班组安全员
|
||||
*/
|
||||
public static final String TEAM_SAFETY = "0900102";
|
||||
|
||||
/**
|
||||
* 班组技术员
|
||||
*/
|
||||
public static final String TEAM_TECHNICAL = "0900103";
|
||||
|
||||
/**
|
||||
* 特种作业人员
|
||||
*/
|
||||
public static final String SPECIALIZED_WORKER = "0900106";
|
||||
|
||||
/**
|
||||
* xls
|
||||
*/
|
||||
public static final String XLS = "xls";
|
||||
|
||||
/**
|
||||
* XLSX
|
||||
*/
|
||||
public static final String XLSX = "xlsx";
|
||||
|
||||
/**
|
||||
* 失败标记
|
||||
*/
|
||||
public static final Integer FAIL = 500;
|
||||
|
||||
/**
|
||||
* 登录成功状态
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS_STATUS = "0";
|
||||
|
||||
/**
|
||||
* 登录失败状态
|
||||
*/
|
||||
public static final String LOGIN_FAIL_STATUS = "1";
|
||||
|
||||
/**
|
||||
* 登录成功
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS = "Success";
|
||||
|
||||
/**
|
||||
* 注销
|
||||
*/
|
||||
public static final String LOGOUT = "Logout";
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public static final String REGISTER = "Register";
|
||||
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
public static final String LOGIN_FAIL = "Error";
|
||||
|
||||
/**
|
||||
* 验证码有效期(分钟)
|
||||
*/
|
||||
public static final long CAPTCHA_EXPIRATION = 2;
|
||||
|
||||
/**
|
||||
* 资源映射路径 前缀
|
||||
*/
|
||||
public static final String RESOURCE_PREFIX = "/profile";
|
||||
|
||||
/**
|
||||
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
|
||||
*/
|
||||
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.bonus" };
|
||||
|
||||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
*/
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.bonus.job.task" };
|
||||
|
||||
/**
|
||||
* 定时任务违规的字符
|
||||
*/
|
||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||
"org.springframework", "org.apache", "com.bonus.common.core.utils.file" };
|
||||
|
||||
/**
|
||||
* 指定集合的大小
|
||||
*/
|
||||
public static final int COMMON_COLLECTION_SIZE = 16;
|
||||
|
||||
/**
|
||||
* 加密公钥
|
||||
*/
|
||||
public static final String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==";
|
||||
|
||||
/**
|
||||
* 解密私钥
|
||||
*/
|
||||
public static final String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y=";
|
||||
|
||||
public static final String SM4_KEY = "0123456789abcdeffedcba9876543210";
|
||||
|
||||
public static final String SM4_IV = "1234567890abcdef1234567890abcdef";
|
||||
|
||||
}
|
||||
|
|
@ -11,18 +11,24 @@ import lombok.Getter;
|
|||
@AllArgsConstructor
|
||||
public enum ExceptionEnum {
|
||||
|
||||
PARAM_NULL(1001, "参数为空"),
|
||||
IOT_CODE_DUPLICATE(1002, "设备编号重复"),
|
||||
IOT_TO_DELETE(1003, "该iot设备绑定相关类型设备,无法删除"),
|
||||
PARAM_NULL(1001, "导入数据为空"),
|
||||
TO_PARAM_NULL(1007, "参数为空"),
|
||||
NAME_DUPLICATE(1002, "名称重复,请重新输入"),
|
||||
IMPORT_TO_DATABASE(1003, "该表单中存在相同名称的数据,请修改后重新提交"),
|
||||
SUCCESS(200, "操作成功"),
|
||||
SAVE_TO_DATABASE(500, "新增保存失败,请联系管理员!!!"),
|
||||
DELETE_TO_DATABASE(500, "删除失败,请联系管理员!!!"),
|
||||
BIND_TO_DATABASE(500, "绑定失败,请联系管理员!!!"),
|
||||
UN_BIND_TO_DATABASE(500, "解绑失败,请联系管理员!!!"),
|
||||
UPDATE_TO_DATABASE(500, "修改失败,请联系管理员!!!"),
|
||||
SAVE_TO_DATABASE(500, "新增保存失败,请联系管理员"),
|
||||
DELETE_TO_DATABASE(500, "删除失败,请联系管理员"),
|
||||
INVALID_ID_CARD_FORMAT(1004, "身份证号格式不正确"),
|
||||
UN_BIND_TO_DATABASE(500, "解散失败,请联系管理员"),
|
||||
EXISTENCE_OF_MEMBERS(1005, "班组中还存在成员,无法解散"),
|
||||
EXISTENCE_OF_BIND(1006, "该人员还绑定相关设备,无法移出"),
|
||||
UPDATE_TO_DATABASE(500, "修改失败,请联系管理员"),
|
||||
BIND_TO_DATABASE(500, "人员设备绑定失败,请联系管理员"),
|
||||
NOT_BIND_TO_DATABASE(500, "人员设备解绑失败,请联系管理员"),
|
||||
NOT_REMOVE_TO_DATABASE(500, "移出班组失败,请联系管理员"),
|
||||
|
||||
INVALID_PHONE_NUMBER_FORMAT(501, "手机号格式不正确!!"),
|
||||
IOT_ENCODING_ERROR(502, "输入的IOT编码有误,请输入正确的编码!!!");
|
||||
INVALID_PHONE_NUMBER_FORMAT(501, "手机号格式不正确"),
|
||||
DELETE_PROJECT_ERROR(502, "该工程关联相应杆塔,无法删除");
|
||||
private Integer code;
|
||||
|
||||
private String msg;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,160 @@
|
|||
package com.bonus.base.controller;
|
||||
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import com.bonus.base.service.TbPeopleService;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import static com.bonus.base.config.Constants.TEAM_LEADER;
|
||||
import static com.bonus.base.config.Constants.TEAM_SAFETY;
|
||||
import static com.bonus.base.config.Constants.TEAM_TECHNICAL;
|
||||
import static com.bonus.base.config.Constants.SPECIALIZED_WORKER;
|
||||
|
||||
/**
|
||||
* 人员管理(TbPeople)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 17:42:37
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tbPeople")
|
||||
public class TbPeopleController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbPeopleService tbPeopleService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbPeople 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult queryByPage(TbPeople tbPeople) {
|
||||
if (tbPeople.getIsAll() != null) {
|
||||
return AjaxResult.success(tbPeopleService.queryByPage(tbPeople));
|
||||
}
|
||||
startPage();
|
||||
List<TbPeople> list = tbPeopleService.queryByPage(tbPeople);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult queryById(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(tbPeopleService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbPeople 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TbPeople tbPeople) {
|
||||
return tbPeopleService.insert(tbPeople);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param tbPeople 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TbPeople tbPeople) {
|
||||
return tbPeopleService.update(tbPeople);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteById(@PathVariable("id") Long id) {
|
||||
return tbPeopleService.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员信息导出
|
||||
* @param response
|
||||
* @param tbPeople
|
||||
*/
|
||||
@ApiOperation("人员信息导出")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TbPeople tbPeople) {
|
||||
List<TbPeople> list = tbPeopleService.queryByPage(tbPeople);
|
||||
list.forEach(people -> {
|
||||
if (people.getSex() == 0) {
|
||||
people.setSexName("女");
|
||||
} else if (people.getSex() == 1) {
|
||||
people.setSexName("男");
|
||||
}
|
||||
if (StringUtils.isNotBlank(people.getPostCode())) {
|
||||
if (TEAM_LEADER.equals(people.getPostCode())){
|
||||
people.setPostName("班组负责人");
|
||||
} else if (TEAM_SAFETY.equals(people.getPostCode())){
|
||||
people.setPostName("班组安全员");
|
||||
} else if (TEAM_TECHNICAL.equals(people.getPostCode())){
|
||||
people.setPostName("班组技术员");
|
||||
} else if (SPECIALIZED_WORKER.equals(people.getPostCode())){
|
||||
people.setPostName("特种作业人员");
|
||||
}
|
||||
}
|
||||
});
|
||||
ExcelUtil<TbPeople> util = new ExcelUtil<>(TbPeople.class);
|
||||
util.exportExcel(response, list, "人员信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入模版下载
|
||||
*/
|
||||
@PostMapping("/downLoad")
|
||||
public void downLoadExcelFile(){
|
||||
HttpServletResponse resp = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
||||
tbPeopleService.downLoadTemplate(resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员信息导入
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file)
|
||||
{
|
||||
return tbPeopleService.importTbProPower(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从北京电科院数据库获取人员列表
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/getList")
|
||||
public AjaxResult queryByPage() {
|
||||
List<TbPeople> list = tbPeopleService.getList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ public class TbProDepartController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult queryByPage(TbProDepart tbProDepart) {
|
||||
if (tbProDepart.getIsAll()) {
|
||||
if (tbProDepart.getIsAll() != null && tbProDepart.getIsAll() == 0) {
|
||||
return AjaxResult.success(tbProDepartService.queryByPage(tbProDepart));
|
||||
}
|
||||
startPage();
|
||||
|
|
@ -120,5 +120,15 @@ public class TbProDepartController extends BaseController {
|
|||
util.exportExcel(response, list, "项目部管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 从北京电科院数据库获取项目部名称列表
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/getList")
|
||||
public AjaxResult queryByPage() {
|
||||
List<TbProDepart> list = tbProDepartService.getList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,133 @@
|
|||
package com.bonus.base.controller;
|
||||
|
||||
import com.bonus.base.domain.TbProDepart;
|
||||
import com.bonus.base.domain.TbProPower;
|
||||
import com.bonus.base.service.TbProPowerService;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程杆塔表(TbProPower)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 16:08:51
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tbProPower")
|
||||
public class TbProPowerController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbProPowerService tbProPowerService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbProPower 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo queryByPage(TbProPower tbProPower) {
|
||||
startPage();
|
||||
List<TbProPower> list = tbProPowerService.queryByPage(tbProPower);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult queryById(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(tbProPowerService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbProPower 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TbProPower tbProPower) {
|
||||
return tbProPowerService.insert(tbProPower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param tbProPower 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TbProPower tbProPower) {
|
||||
return tbProPowerService.update(tbProPower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteById(@PathVariable("id") Long id) {
|
||||
return tbProPowerService.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 杆塔导出
|
||||
* @param response
|
||||
* @param tbProPower
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TbProPower tbProPower) {
|
||||
List<TbProPower> list = tbProPowerService.queryByPage(tbProPower);
|
||||
ExcelUtil<TbProPower> util = new ExcelUtil<>(TbProPower.class);
|
||||
util.exportExcel(response, list, "杆塔管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入模版下载
|
||||
*/
|
||||
@PostMapping("/downLoad")
|
||||
public void downLoadExcelFile(){
|
||||
HttpServletResponse resp = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
||||
tbProPowerService.downLoadTemplate(resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 杆塔导入
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, Long proId)
|
||||
{
|
||||
return tbProPowerService.importTbProPower(file, proId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从北京电科院数据库获取杆塔列表
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/getList")
|
||||
public AjaxResult queryByPage() {
|
||||
List<TbProPower> list = tbProPowerService.getList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.bonus.base.controller;
|
||||
|
||||
import com.bonus.base.domain.TbProject;
|
||||
import com.bonus.base.service.TbProjectService;
|
||||
import com.bonus.base.vo.TbProjectVo;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程表(TbProject)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 14:56:49
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tbProject")
|
||||
public class TbProjectController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbProjectService tbProjectService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbProject 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult queryByPage(TbProject tbProject) {
|
||||
if (tbProject.getIsAll() != null && tbProject.getIsAll() == 0) {
|
||||
return AjaxResult.success(tbProjectService.queryByPage(tbProject));
|
||||
}
|
||||
startPage();
|
||||
List<TbProjectVo> list = tbProjectService.queryByPage(tbProject);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult queryById(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(tbProjectService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbProject 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TbProject tbProject) {
|
||||
return tbProjectService.insert(tbProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param tbProject 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TbProject tbProject) {
|
||||
return tbProjectService.update(tbProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteById(@PathVariable("id") Long id) {
|
||||
return tbProjectService.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工程管理导出
|
||||
* @param response
|
||||
* @param tbProject
|
||||
*/
|
||||
@ApiOperation("工程管理导出")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TbProject tbProject) {
|
||||
List<TbProjectVo> list = tbProjectService.queryByPage(tbProject);
|
||||
ExcelUtil<TbProjectVo> util = new ExcelUtil<>(TbProjectVo.class);
|
||||
util.exportExcel(response, list, "工程管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 从北京电科院数据库获取项目部名称列表
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/getList")
|
||||
public AjaxResult queryByPage() {
|
||||
List<TbProjectVo> list = tbProjectService.getList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
package com.bonus.base.controller;
|
||||
|
||||
import com.bonus.base.domain.TbTeam;
|
||||
import com.bonus.base.service.TbTeamService;
|
||||
import com.bonus.base.vo.TbDeviceVo;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班组管理(TbTeam)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-10 09:46:24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tbTeam")
|
||||
public class TbTeamController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbTeamService tbTeamService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbTeam 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo queryByPage(TbTeam tbTeam) {
|
||||
startPage();
|
||||
List<TbTeam> list = tbTeamService.queryByPage(tbTeam);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult queryById(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(tbTeamService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbTeam 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TbTeam tbTeam) {
|
||||
return tbTeamService.insert(tbTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param tbTeam 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TbTeam tbTeam) {
|
||||
return tbTeamService.update(tbTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键解散班组
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteById(@PathVariable("id") Long id) {
|
||||
return tbTeamService.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定操作
|
||||
*
|
||||
* @param tbTeam 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("/bind")
|
||||
public AjaxResult bind(@RequestBody TbTeam tbTeam) {
|
||||
return tbTeamService.bind(tbTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑操作
|
||||
*
|
||||
* @param tbTeam 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("/unbind")
|
||||
public AjaxResult unbind(@RequestBody TbTeam tbTeam) {
|
||||
return tbTeamService.unbind(tbTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移出班组
|
||||
*
|
||||
* @param tbTeam 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
public AjaxResult remove(@RequestBody TbTeam tbTeam) {
|
||||
return tbTeamService.remove(tbTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 智能安全帽列表查询
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/devList")
|
||||
public AjaxResult queryByPage(TbDeviceVo tbDeviceVo) {
|
||||
return AjaxResult.success(tbTeamService.selectDeviceList(tbDeviceVo));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.bonus.base.controller;
|
||||
|
||||
import com.bonus.base.domain.TbUserPost;
|
||||
import com.bonus.base.service.TbUserPostService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人员到岗到位签到表(TbUserPost)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-12 18:29:36
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tbUserPost")
|
||||
public class TbUserPostController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbUserPostService tbUserPostService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbUserPost 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo queryByPage(TbUserPost tbUserPost) {
|
||||
startPage();
|
||||
List<TbUserPost> list = tbUserPostService.queryByPage(tbUserPost);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult queryById(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(tbUserPostService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbUserPost 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TbUserPost tbUserPost) {
|
||||
return AjaxResult.success(tbUserPostService.insert(tbUserPost));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -3,6 +3,7 @@ package com.bonus.base.domain;
|
|||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 地区列表实体
|
||||
* @Author ma_sh
|
||||
* @create 2024/9/9 13:07
|
||||
*/
|
||||
|
|
@ -10,9 +11,9 @@ import lombok.Data;
|
|||
public class TbArea {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
* 区域id
|
||||
*/
|
||||
private Long id;
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 人员管理(TbPeople)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 17:42:40
|
||||
*/
|
||||
@Data
|
||||
public class TbPeople implements Serializable {
|
||||
private static final long serialVersionUID = -26170181506246593L;
|
||||
|
||||
/**
|
||||
* 是否下拉选
|
||||
*/
|
||||
private Integer isAll;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private Long teamId;
|
||||
/**
|
||||
* 人员名称
|
||||
*/
|
||||
@Excel(name = "姓名")
|
||||
private String relName;
|
||||
|
||||
/**
|
||||
* 性别名称
|
||||
*/
|
||||
@Excel(name = "性别")
|
||||
private String sexName;
|
||||
|
||||
/**
|
||||
* 岗位工种
|
||||
*/
|
||||
private String postCode;
|
||||
|
||||
/**
|
||||
* 岗位工种名称
|
||||
*/
|
||||
@Excel(name = "岗位工种")
|
||||
private String postName;
|
||||
|
||||
/**
|
||||
* 性别(自动计算识别) 1 男 0 女
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
@Excel(name = "身份证号码")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 联系方式(sm4加密存储)
|
||||
*/
|
||||
@Excel(name = "电话")
|
||||
private String relPhone;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUser;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long updateUser;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 智能安全帽名称
|
||||
*/
|
||||
private String devName;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -18,7 +19,7 @@ public class TbProDepart implements Serializable {
|
|||
/**
|
||||
* 是否下拉选
|
||||
*/
|
||||
private Boolean isAll;
|
||||
private Integer isAll;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
|
|
@ -27,10 +28,18 @@ public class TbProDepart implements Serializable {
|
|||
/**
|
||||
* 项目部名称
|
||||
*/
|
||||
@Excel(name = "项目部名称")
|
||||
private String departName;
|
||||
|
||||
/**
|
||||
* 项目部编号(对应字典表)
|
||||
*/
|
||||
private Long dictCode;
|
||||
|
||||
/**
|
||||
* 项目部类型(字典表)
|
||||
*/
|
||||
@Excel(name = "项目部类型")
|
||||
private String departType;
|
||||
/**
|
||||
* 地区(区域表 type==0)
|
||||
|
|
@ -40,19 +49,23 @@ public class TbProDepart implements Serializable {
|
|||
/**
|
||||
* 地区名称
|
||||
*/
|
||||
@Excel(name = "地区")
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@Excel(name = "负责人")
|
||||
private String headUser;
|
||||
/**
|
||||
* 负责人联系电话(sm4)加密(查询展示脱敏)
|
||||
*/
|
||||
@Excel(name = "电话")
|
||||
private String headUserPhone;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String remarks;
|
||||
/**
|
||||
* 创建时间
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 工程杆塔表(TbProPower)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 16:08:54
|
||||
*/
|
||||
@Data
|
||||
public class TbProPower implements Serializable {
|
||||
private static final long serialVersionUID = -14997927411499975L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 工程杆塔名称
|
||||
*/
|
||||
@Excel(name = "杆塔名称")
|
||||
private String gtName;
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Long proId;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Excel(name = "杆塔经度")
|
||||
private String lat;
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
@Excel(name = "杆塔纬度")
|
||||
private String lon;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 工程表(TbProject)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 14:56:53
|
||||
*/
|
||||
@Data
|
||||
public class TbProject implements Serializable {
|
||||
private static final long serialVersionUID = 917938286678595897L;
|
||||
|
||||
/**
|
||||
* 是否下拉选
|
||||
*/
|
||||
private Integer isAll;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称")
|
||||
private String proName;
|
||||
/**
|
||||
* 所属项目部
|
||||
*/
|
||||
private Long departId;
|
||||
|
||||
/**
|
||||
* 所属项目部名称
|
||||
*/
|
||||
@Excel(name = "所属项目部")
|
||||
private String departName;
|
||||
|
||||
/**
|
||||
* 电压等级(字典表配置)
|
||||
*/
|
||||
private Integer relId;
|
||||
|
||||
/**
|
||||
* 工程类型(字典表配置)(01 线路 02 变电 03 ...)
|
||||
*/
|
||||
private String proType;
|
||||
|
||||
/**
|
||||
* 工程状态 (字典表配置)
|
||||
*/
|
||||
private String proStatus;
|
||||
/**
|
||||
* 建管单位(区域表)-按照选择的项目部 进行二级联动)
|
||||
*/
|
||||
private Integer areaId;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Excel(name = "经度")
|
||||
private String lon;
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
@Excel(name = "纬度")
|
||||
private String lat;
|
||||
/**
|
||||
* 删除状态(0 正常 1删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUser;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long updateUser;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班组管理(TbTeam)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-10 09:46:27
|
||||
*/
|
||||
@Data
|
||||
public class TbTeam implements Serializable {
|
||||
private static final long serialVersionUID = 462186367930963504L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
private Long devId;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@Excel(name = "班组名称")
|
||||
private String teamName;
|
||||
/**
|
||||
* 班组长id
|
||||
*/
|
||||
private Long relId;
|
||||
|
||||
/**
|
||||
* 班组长手机号码(SM4加密)
|
||||
*/
|
||||
private String relPhone;
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private String proId;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "所属工程")
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 班组长名称2
|
||||
*/
|
||||
@Excel(name = "班组长")
|
||||
private String relName;
|
||||
|
||||
/**
|
||||
* 班组人数
|
||||
*/
|
||||
@Excel(name = "班组成员")
|
||||
private Integer peopleCount;
|
||||
|
||||
/**
|
||||
* 班组状态
|
||||
*/
|
||||
@Excel(name = "班组状态")
|
||||
private String teamStatus;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@Excel(name = "创建日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUser;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 解散时间
|
||||
*/
|
||||
@Excel(name = "解散日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date jsTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long updateUser;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
/**
|
||||
* 班组人员集合
|
||||
*/
|
||||
private List<TbPeople> peopleList;
|
||||
|
||||
/**
|
||||
* 班组人员id集合
|
||||
*/
|
||||
private List<Long> idList;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 人员到岗到位签到表(TbUserPost)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-12 18:29:39
|
||||
*/
|
||||
@Data
|
||||
public class TbUserPost implements Serializable {
|
||||
private static final long serialVersionUID = 935926443103754206L;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
private String postName;
|
||||
/**
|
||||
* 人员名称
|
||||
*/
|
||||
private String relName;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String relPhone;
|
||||
/**
|
||||
* 签到时间
|
||||
*/
|
||||
private String createTime;
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Long proId;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bonus.base.mapper;
|
||||
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人员管理(TbPeople)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 17:42:38
|
||||
*/
|
||||
public interface TbPeopleMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbPeople queryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbPeople 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbPeople tbPeople);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbPeople 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbPeople tbPeople);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param tbPeople
|
||||
* @return
|
||||
*/
|
||||
List<TbPeople> queryByPage(TbPeople tbPeople);
|
||||
|
||||
/**
|
||||
* 根据姓名查询
|
||||
* @param tbPeople
|
||||
* @return
|
||||
*/
|
||||
TbPeople queryByName(TbPeople tbPeople);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据
|
||||
* @param tbPeople
|
||||
* @return
|
||||
*/
|
||||
int insertOrUpdate(TbPeople tbPeople);
|
||||
}
|
||||
|
||||
|
|
@ -65,5 +65,12 @@ public interface TbProDepartMapper {
|
|||
* @return
|
||||
*/
|
||||
List<TbData> getDataList(TbData data);
|
||||
|
||||
/**
|
||||
* 根据名称查询
|
||||
* @param tbProDepart
|
||||
* @return
|
||||
*/
|
||||
TbProDepart selectByName(TbProDepart tbProDepart);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.bonus.base.mapper;
|
||||
|
||||
import com.bonus.base.domain.TbProPower;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程杆塔表(TbProPower)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 16:08:51
|
||||
*/
|
||||
public interface TbProPowerMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbProPower queryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbProPower 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbProPower tbProPower);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbProPower 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbProPower tbProPower);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询数据
|
||||
* @param tbProPower
|
||||
* @return
|
||||
*/
|
||||
List<TbProPower> queryByPage(TbProPower tbProPower);
|
||||
|
||||
/**
|
||||
* 根据名称查询
|
||||
* @param tbProPower
|
||||
* @return
|
||||
*/
|
||||
TbProPower selectByName(TbProPower tbProPower);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.bonus.base.mapper;
|
||||
|
||||
import com.bonus.base.domain.TbProject;
|
||||
import com.bonus.base.vo.TbProjectVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程表(TbProject)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 14:56:50
|
||||
*/
|
||||
public interface TbProjectMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbProjectVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbProject 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbProject tbProject);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbProject 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbProject tbProject);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param tbProject
|
||||
* @return
|
||||
*/
|
||||
List<TbProjectVo> queryByPage(TbProject tbProject);
|
||||
|
||||
/**
|
||||
* 根据名称查询
|
||||
* @param tbProject
|
||||
* @return
|
||||
*/
|
||||
TbProjectVo selectByName(TbProject tbProject);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package com.bonus.base.mapper;
|
||||
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import com.bonus.base.domain.TbTeam;
|
||||
import com.bonus.base.vo.TbDeviceVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班组管理(TbTeam)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-10 09:46:25
|
||||
*/
|
||||
public interface TbTeamMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbTeam queryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbTeam 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbTeam 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
List<TbTeam> queryByPage(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 根据id查询班组人员
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<TbPeople> getList(Long id);
|
||||
|
||||
/**
|
||||
* 批量插入班组人员
|
||||
* @param teamId
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int insertPeople(@Param("teamId") Long teamId, @Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 更新班组人员
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
int updatePeople(Long teamId);
|
||||
|
||||
/**
|
||||
* 更新班组人员
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int updateById(Long id);
|
||||
|
||||
/**
|
||||
* 人员设备绑定
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
int bind(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 人员设备解绑
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
int unbind(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 根据id查询人员
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int select(Long id);
|
||||
|
||||
/**
|
||||
* 移出班组
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int remove(Long id);
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
* @param tbDeviceVo
|
||||
* @return
|
||||
*/
|
||||
List<TbDeviceVo> selectDeviceList(TbDeviceVo tbDeviceVo);
|
||||
|
||||
/**
|
||||
* 查询人员列表信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<TbPeople> selectList(Long id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.base.mapper;
|
||||
|
||||
import com.bonus.base.domain.TbUserPost;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人员到岗到位签到表(TbUserPost)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-12 18:29:37
|
||||
*/
|
||||
public interface TbUserPostMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbUserPost queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param tbUserPost 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbUserPost> queryAllByLimit(TbUserPost tbUserPost, @Param("pageable") Pageable pageable);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param tbUserPost 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbUserPost> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbUserPost> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbUserPost> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<TbUserPost> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param tbUserPost
|
||||
* @return
|
||||
*/
|
||||
List<TbUserPost> queryByPage(TbUserPost tbUserPost);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.bonus.base.service;
|
||||
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人员管理(TbPeople)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 17:42:42
|
||||
*/
|
||||
public interface TbPeopleService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbPeople queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbPeople 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<TbPeople> queryByPage(TbPeople tbPeople);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbPeople 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult insert(TbPeople tbPeople);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbPeople 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult update(TbPeople tbPeople);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
AjaxResult deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 导入模版
|
||||
* @param resp
|
||||
*/
|
||||
void downLoadTemplate(HttpServletResponse resp);
|
||||
|
||||
/**
|
||||
* 从北京电科院数据库获取人员列表
|
||||
* @return
|
||||
*/
|
||||
List<TbPeople> getList();
|
||||
|
||||
/**
|
||||
* 导入人员信息
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
AjaxResult importTbProPower(MultipartFile file);
|
||||
}
|
||||
|
|
@ -70,4 +70,11 @@ public interface TbProDepartService {
|
|||
* @return
|
||||
*/
|
||||
List<TbData> getDataList(TbData data);
|
||||
|
||||
/**
|
||||
* 获取项目部列表
|
||||
* @return
|
||||
*/
|
||||
List<TbProDepart> getList();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
package com.bonus.base.service;
|
||||
|
||||
import com.bonus.base.domain.TbProDepart;
|
||||
import com.bonus.base.domain.TbProPower;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程杆塔表(TbProPower)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 16:08:57
|
||||
*/
|
||||
public interface TbProPowerService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbProPower queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbProPower 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<TbProPower> queryByPage(TbProPower tbProPower);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbProPower 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult insert(TbProPower tbProPower);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbProPower 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult update(TbProPower tbProPower);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
AjaxResult deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file
|
||||
* @param proId
|
||||
* @return
|
||||
*/
|
||||
AjaxResult importTbProPower(MultipartFile file, Long proId);
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
* @param resp
|
||||
*/
|
||||
void downLoadTemplate(HttpServletResponse resp);
|
||||
|
||||
/**
|
||||
* 从北京电科院数据库获取杆塔列表
|
||||
* @return
|
||||
*/
|
||||
List<TbProPower> getList();
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.bonus.base.service;
|
||||
|
||||
import com.bonus.base.domain.TbProject;
|
||||
import com.bonus.base.vo.TbProjectVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程表(TbProject)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 14:56:54
|
||||
*/
|
||||
public interface TbProjectService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbProjectVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbProject 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<TbProjectVo> queryByPage(TbProject tbProject);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbProject 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult insert(TbProject tbProject);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbProject 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult update(TbProject tbProject);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
AjaxResult deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 查询工程列表
|
||||
* @return
|
||||
*/
|
||||
List<TbProjectVo> getList();
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.base.service;
|
||||
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import com.bonus.base.domain.TbTeam;
|
||||
import com.bonus.base.vo.TbDeviceVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班组管理(TbTeam)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-10 09:46:29
|
||||
*/
|
||||
public interface TbTeamService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
List<TbPeople> queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbTeam 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<TbTeam> queryByPage(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbTeam 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult insert(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbTeam 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult update(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 通过主键解散班组
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
AjaxResult deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 绑定设备
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult bind(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 解绑设备
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult unbind(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 移出班组
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult remove(TbTeam tbTeam);
|
||||
|
||||
/**
|
||||
* 智能安全帽列表查询
|
||||
* @return
|
||||
*/
|
||||
List<TbDeviceVo> selectDeviceList(TbDeviceVo tbDeviceVo);
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.base.service;
|
||||
|
||||
import com.bonus.base.domain.TbUserPost;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人员到岗到位签到表(TbUserPost)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-12 18:29:41
|
||||
*/
|
||||
public interface TbUserPostService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbUserPost queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbUserPost 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<TbUserPost> queryByPage(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult insert(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbUserPost update(TbUserPost tbUserPost);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,359 @@
|
|||
package com.bonus.base.service.impl;
|
||||
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.config.Constants;
|
||||
import com.bonus.base.config.ExceptionEnum;
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import com.bonus.base.domain.TbProPower;
|
||||
import com.bonus.base.mapper.TbPeopleMapper;
|
||||
import com.bonus.base.service.TbPeopleService;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.security.Security;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 人员管理(TbPeople)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 17:42:44
|
||||
*/
|
||||
@Service("tbPeopleService")
|
||||
@Slf4j
|
||||
public class TbPeopleServiceImpl implements TbPeopleService {
|
||||
@Resource
|
||||
private TbPeopleMapper tbPeopleDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbPeople queryById(Long id) {
|
||||
return tbPeopleDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbPeople 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<TbPeople> queryByPage(TbPeople tbPeople) {
|
||||
List<TbPeople> peopleList = tbPeopleDao.queryByPage(tbPeople);
|
||||
if (CollectionUtils.isNotEmpty(peopleList)) {
|
||||
peopleList.forEach(people -> {
|
||||
if (StringUtils.isNotBlank(people.getRelPhone())) {
|
||||
people.setRelPhone(Sm4Utils.decode(people.getRelPhone()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(people.getIdCard())) {
|
||||
people.setIdCard(Sm4Utils.decode(people.getIdCard()));
|
||||
}
|
||||
});
|
||||
}
|
||||
return peopleList;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.println(Sm4Utils.decode("495d83e0f1f5c928669e1d18bc0f889d806e129ca685d1140c26a10c3e938299"));
|
||||
|
||||
}
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbPeople 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insert(TbPeople tbPeople) {
|
||||
if (tbPeople == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//校验前端传的手机号
|
||||
if (getObjectResultBean(tbPeople)) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
||||
}
|
||||
//校验前端传入的身份证号
|
||||
String CREDENTIALS_CODE_PATTERN = "^[1-9]\\d{5}[1-9]\\d{3}((0[1-9])|(1[0-2]))(0[1-9]|([1|2][0-9])|3[0-1])((\\d{4})|\\d{3}X)$";
|
||||
if (StringUtils.isNotBlank(tbPeople.getIdCard())) {
|
||||
if (!Pattern.matches(CREDENTIALS_CODE_PATTERN, tbPeople.getIdCard())) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_ID_CARD_FORMAT.getCode(), ExceptionEnum.INVALID_ID_CARD_FORMAT.getMsg());
|
||||
}
|
||||
}
|
||||
//同名同身份证号判重
|
||||
TbPeople people = tbPeopleDao.queryByName(tbPeople);
|
||||
if (people != null) {
|
||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
tbPeople.setCreateUser(SecurityUtils.getUserId());
|
||||
tbPeople.setRelPhone(Sm4Utils.encode(tbPeople.getRelPhone()));
|
||||
tbPeople.setIdCard(Sm4Utils.encode(tbPeople.getIdCard()));
|
||||
int result = tbPeopleDao.insert(tbPeople);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号校验方法抽取
|
||||
* @param tbPeople
|
||||
* @return
|
||||
*/
|
||||
private boolean getObjectResultBean(TbPeople tbPeople) {
|
||||
if (StringUtils.isNotBlank(tbPeople.getRelPhone())) {
|
||||
if (!PhoneUtil.isMobile(tbPeople.getRelPhone())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbPeople 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult update(TbPeople tbPeople) {
|
||||
if (tbPeople == null || tbPeople.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//校验前端传的手机号
|
||||
if (getObjectResultBean(tbPeople)) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
||||
}
|
||||
//校验前端传入的身份证号
|
||||
String CREDENTIALS_CODE_PATTERN = "^[1-9]\\d{5}[1-9]\\d{3}((0[1-9])|(1[0-2]))(0[1-9]|([1|2][0-9])|3[0-1])((\\d{4})|\\d{3}X)$";
|
||||
if (StringUtils.isNotBlank(tbPeople.getIdCard())) {
|
||||
if (!Pattern.matches(CREDENTIALS_CODE_PATTERN, tbPeople.getIdCard())) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_ID_CARD_FORMAT.getCode(), ExceptionEnum.INVALID_ID_CARD_FORMAT.getMsg());
|
||||
}
|
||||
}
|
||||
//同名同身份证号判重
|
||||
TbPeople people = tbPeopleDao.queryByName(tbPeople);
|
||||
if (people != null && !people.getId().equals(tbPeople.getId())) {
|
||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
tbPeople.setUpdateUser(SecurityUtils.getUserId());
|
||||
tbPeople.setRelPhone(Sm4Utils.encode(tbPeople.getRelPhone()));
|
||||
int result = tbPeopleDao.update(tbPeople);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.UPDATE_TO_DATABASE.getCode(), ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteById(Long id) {
|
||||
int result = tbPeopleDao.deleteById(id);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.DELETE_TO_DATABASE.getCode(), ExceptionEnum.DELETE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入模版
|
||||
* @param response
|
||||
*/
|
||||
@Override
|
||||
public void downLoadTemplate(HttpServletResponse response) {
|
||||
//模板名称
|
||||
String templateName = "TbPeopleTemplate.xlsx";
|
||||
OutputStream out = null;
|
||||
InputStream input =null;
|
||||
try {
|
||||
input = this.getClass().getClassLoader().getResourceAsStream("template/TbPeopleTemplate.xlsx");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("content-Type", "application/vnd.ms-excel");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;filename=" + new String((templateName).getBytes(), "iso-8859-1"));
|
||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
out = response.getOutputStream();
|
||||
// 缓冲区
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入内容输出到浏览器中
|
||||
while ((bytesToRead = input.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
IOUtils.closeQuietly(out);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从北京电科院数据库获取人员列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TbPeople> getList() {
|
||||
String sourceUrl = Constants.SOURCEURL;
|
||||
String sourceUser = Constants.SOURCEUSER;
|
||||
String sourcePassword = Constants.SOURCEPASSWORD;
|
||||
List<TbPeople> list = new ArrayList<>();
|
||||
|
||||
try (Connection sourceConn = DriverManager.getConnection(sourceUrl, sourceUser, sourcePassword);
|
||||
Statement selectStmt = sourceConn.createStatement()) {
|
||||
|
||||
String selectQuery = "SELECT t1.real_name as relName, t1.id_card as idCard,t2.gender as sex, t1.position_code as postCode, t2.mobile as relPhone, t1.team_id as teamId FROM dky_get_working_team_member t1 " +
|
||||
"LEFT JOIN dky_get_personnel t2 on t1.personnel_id = t2.personnel_id and t2.delete_flag = 0 " +
|
||||
"WHERE t1.delete_flag = 0";
|
||||
|
||||
try (ResultSet rs = selectStmt.executeQuery(selectQuery)) {
|
||||
while (rs.next()) {
|
||||
String relName = rs.getString("relName");
|
||||
String idCard = rs.getString("idCard");
|
||||
String sex = rs.getString("sex");
|
||||
String postCode = rs.getString("postCode");
|
||||
String relPhone = rs.getString("relPhone");
|
||||
String teamId = rs.getString("teamId");
|
||||
|
||||
if (StringUtils.isBlank(relName)) {
|
||||
TbPeople tbPeople = new TbPeople();
|
||||
tbPeople.setRelName(relName);
|
||||
if (StringUtils.isNotBlank(idCard)) {
|
||||
tbPeople.setIdCard(idCard);
|
||||
}
|
||||
if (StringUtils.isNotBlank(sex)) {
|
||||
tbPeople.setSex(Integer.parseInt(sex));
|
||||
}
|
||||
if (StringUtils.isNotBlank(postCode)) {
|
||||
tbPeople.setPostCode(postCode);
|
||||
}
|
||||
if (StringUtils.isNotBlank(relPhone)) {
|
||||
tbPeople.setRelPhone(relPhone);
|
||||
}
|
||||
if (StringUtils.isNotBlank(teamId)) {
|
||||
tbPeople.setTeamId(Long.parseLong(teamId));
|
||||
}
|
||||
list.add(tbPeople);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed to execute SQL query", e);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed to connect to database", e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入人员信息
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult importTbProPower(MultipartFile file) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (fileName != null) {
|
||||
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
if (!Constants.XLS.equalsIgnoreCase(fileExtension) && !Constants.XLSX.equalsIgnoreCase(fileExtension)) {
|
||||
// 文件后缀名不符合要求
|
||||
return AjaxResult.error("文件后缀名不符合要求,必须为xls或xlsx结尾");
|
||||
}
|
||||
}
|
||||
try {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
Workbook workbook = new XSSFWorkbook(inputStream);
|
||||
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
// 得到Excel的行数
|
||||
int totalRows = sheet.getPhysicalNumberOfRows();
|
||||
|
||||
// 检查是否有行数
|
||||
if (totalRows <= 0) {
|
||||
throw new IllegalArgumentException("Excel文件中没有数据,请检查后重新导入");
|
||||
}
|
||||
// 读取第一行表头
|
||||
Row headerRow = sheet.getRow(0);
|
||||
|
||||
if (headerRow == null) {
|
||||
throw new IllegalArgumentException("文件中没有表头");
|
||||
}
|
||||
// 获取表头的列数
|
||||
int totalCells = headerRow.getPhysicalNumberOfCells();
|
||||
// 预期的表头列数为5列,可以根据实际需求修改这个条件
|
||||
if (totalCells != 5) {
|
||||
throw new IllegalArgumentException("表头列数与预期不符,请检查导入模板");
|
||||
}
|
||||
// 读取表头内容并验证每一列
|
||||
for (int cellNum = 0; cellNum < totalCells; cellNum++) {
|
||||
Cell cell = headerRow.getCell(cellNum);
|
||||
// 获取单元格内容并去除首尾空格
|
||||
String headerValue = cell.getStringCellValue().trim();
|
||||
// 根据列索引进行验证
|
||||
switch (cellNum) {
|
||||
case 0:
|
||||
if (!"杆塔名称".equals(headerValue)) {
|
||||
throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!"杆塔经度".equals(headerValue)) {
|
||||
throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!"杆塔纬度".equals(headerValue)) {
|
||||
throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ExcelUtil<TbPeople> util = new ExcelUtil<>(TbPeople.class);
|
||||
List<TbPeople> tbPeopleList = util.importExcel(file.getInputStream());
|
||||
int result = 0;
|
||||
for (TbPeople tbPeople : tbPeopleList) {
|
||||
tbPeople.setCreateUser(SecurityUtils.getUserId());
|
||||
result += tbPeopleDao.insertOrUpdate(tbPeople);
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.base.service.impl;
|
|||
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.config.Constants;
|
||||
import com.bonus.base.config.ExceptionEnum;
|
||||
import com.bonus.base.domain.TbArea;
|
||||
import com.bonus.base.domain.TbData;
|
||||
|
|
@ -10,10 +11,14 @@ import com.bonus.base.mapper.TbProDepartMapper;
|
|||
import com.bonus.base.service.TbProDepartService;
|
||||
import com.bonus.base.utils.PhoneNumberUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +56,7 @@ public class TbProDepartServiceImpl implements TbProDepartService {
|
|||
list.forEach(item -> {
|
||||
if (StringUtils.isNotBlank(item.getHeadUserPhone())) {
|
||||
//对手机号进行中间加密
|
||||
item.setHeadUserPhone(PhoneNumberUtils.maskPhoneNumber(item.getHeadUserPhone()));
|
||||
item.setHeadUserPhone(Sm4Utils.decode(item.getHeadUserPhone()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -66,9 +71,21 @@ public class TbProDepartServiceImpl implements TbProDepartService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult insert(TbProDepart tbProDepart) {
|
||||
if (tbProDepart == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//名称重复性校验,一个地区内不能重复
|
||||
TbProDepart depart = tbProDepartDao.selectByName(tbProDepart);
|
||||
if (depart != null) {
|
||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
if (getObjectResultBean(tbProDepart)) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
||||
}
|
||||
if (StringUtils.isNotBlank(tbProDepart.getHeadUserPhone())) {
|
||||
tbProDepart.setHeadUserPhone(Sm4Utils.encode(tbProDepart.getHeadUserPhone()));
|
||||
}
|
||||
tbProDepart.setCreateUser(SecurityUtils.getUserId());
|
||||
int result = tbProDepartDao.insert(tbProDepart);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
|
|
@ -98,9 +115,18 @@ public class TbProDepartServiceImpl implements TbProDepartService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult update(TbProDepart tbProDepart) {
|
||||
if (tbProDepart == null || tbProDepart.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//名称重复性校验,一个地区内不能重复
|
||||
TbProDepart depart = tbProDepartDao.selectByName(tbProDepart);
|
||||
if (depart != null && !depart.getId().equals(tbProDepart.getId())) {
|
||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
if (getObjectResultBean(tbProDepart)) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
||||
}
|
||||
tbProDepart.setUpdateUser(SecurityUtils.getUserId());
|
||||
int result = tbProDepartDao.update(tbProDepart);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
|
|
@ -142,10 +168,62 @@ public class TbProDepartServiceImpl implements TbProDepartService {
|
|||
*/
|
||||
@Override
|
||||
public List<TbData> getDataList(TbData data) {
|
||||
List<TbData> list = tbProDepartDao.getDataList(data);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 将 dictLabel 的值赋给 departType
|
||||
data.setDepartType(data.getDictLabel());
|
||||
return tbProDepartDao.getDataList(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目部列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TbProDepart> getList() {
|
||||
String sourceUrl = Constants.SOURCEURL;
|
||||
String sourceUser = Constants.SOURCEUSER;
|
||||
String sourcePassword = Constants.SOURCEPASSWORD;
|
||||
List<TbProDepart> list = new ArrayList<>();
|
||||
|
||||
try (Connection sourceConn = DriverManager.getConnection(sourceUrl, sourceUser, sourcePassword);
|
||||
Statement selectStmt = sourceConn.createStatement()) {
|
||||
|
||||
String selectQuery = "SELECT t2.project_department_name AS departName, t2.department_type AS departType, t1.province AS areaName, t1.legal_repr AS headUser, " +
|
||||
"t1.legal_repr_mobile AS headUserPhone " +
|
||||
"FROM dky_get_sgc_unit t1 " +
|
||||
"LEFT JOIN dky_get_project_department t2 ON t1.unit_code = t2.build_unit_code " +
|
||||
"AND t2.delete_flag = 0 WHERE t1.delete_flag = 0";
|
||||
|
||||
try (ResultSet rs = selectStmt.executeQuery(selectQuery)) {
|
||||
while (rs.next()) {
|
||||
String departName = rs.getString("departName");
|
||||
String departType = rs.getString("departType");
|
||||
String areaName = rs.getString("areaName");
|
||||
String headUser = rs.getString("headUser");
|
||||
String headUserPhone = rs.getString("headUserPhone");
|
||||
|
||||
TbProDepart tbProDepart = new TbProDepart();
|
||||
if (StringUtils.isBlank(departName)) {
|
||||
tbProDepart.setDepartName(departName);
|
||||
if (StringUtils.isBlank(departType)) {
|
||||
tbProDepart.setDepartType(departType);
|
||||
}
|
||||
if (StringUtils.isBlank(areaName)) {
|
||||
tbProDepart.setAreaName(areaName);
|
||||
}
|
||||
if (StringUtils.isBlank(headUser)) {
|
||||
tbProDepart.setHeadUser(headUser);
|
||||
}
|
||||
if (StringUtils.isBlank(headUserPhone)) {
|
||||
tbProDepart.setHeadUserPhone(headUserPhone);
|
||||
}
|
||||
}
|
||||
|
||||
list.add(tbProDepart);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed to execute SQL query", e);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed to connect to database", e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,293 @@
|
|||
package com.bonus.base.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.config.Constants;
|
||||
import com.bonus.base.config.ExceptionEnum;
|
||||
import com.bonus.base.domain.TbProDepart;
|
||||
import com.bonus.base.domain.TbProPower;
|
||||
import com.bonus.base.mapper.TbProPowerMapper;
|
||||
import com.bonus.base.service.TbProPowerService;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工程杆塔表(TbProPower)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 16:09:00
|
||||
*/
|
||||
@Service("tbProPowerService")
|
||||
@Slf4j
|
||||
public class TbProPowerServiceImpl implements TbProPowerService {
|
||||
@Resource
|
||||
private TbProPowerMapper tbProPowerDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbProPower queryById(Long id) {
|
||||
return tbProPowerDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbProPower 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<TbProPower> queryByPage(TbProPower tbProPower) {
|
||||
return tbProPowerDao.queryByPage(tbProPower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbProPower 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insert(TbProPower tbProPower) {
|
||||
if (tbProPower == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//根据名称判重
|
||||
TbProPower power = tbProPowerDao.selectByName(tbProPower);
|
||||
if (power != null) {
|
||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
int result = tbProPowerDao.insert(tbProPower);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbProPower 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult update(TbProPower tbProPower) {
|
||||
if (tbProPower == null || tbProPower.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//根据名称判重
|
||||
TbProPower power = tbProPowerDao.selectByName(tbProPower);
|
||||
if (power != null && !power.getId().equals(tbProPower.getId())) {
|
||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
int result = tbProPowerDao.update(tbProPower);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.UPDATE_TO_DATABASE.getCode(), ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteById(Long id) {
|
||||
int result = tbProPowerDao.deleteById(id);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.DELETE_TO_DATABASE.getCode(), ExceptionEnum.DELETE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入杆塔信息
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult importTbProPower(MultipartFile file, Long proId) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (fileName != null) {
|
||||
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
if (!Constants.XLS.equalsIgnoreCase(fileExtension) && !Constants.XLSX.equalsIgnoreCase(fileExtension)) {
|
||||
// 文件后缀名不符合要求
|
||||
return AjaxResult.error("文件后缀名不符合要求,必须为xls或xlsx结尾");
|
||||
}
|
||||
}
|
||||
try {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
Workbook workbook = new XSSFWorkbook(inputStream);
|
||||
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
// 得到Excel的行数
|
||||
int totalRows = sheet.getPhysicalNumberOfRows();
|
||||
|
||||
// 检查是否有行数
|
||||
if (totalRows <= 0) {
|
||||
throw new IllegalArgumentException("Excel文件中没有数据,请检查后重新导入");
|
||||
}
|
||||
// 读取第一行表头
|
||||
Row headerRow = sheet.getRow(0);
|
||||
|
||||
if (headerRow == null) {
|
||||
throw new IllegalArgumentException("文件中没有表头");
|
||||
}
|
||||
// 获取表头的列数
|
||||
int totalCells = headerRow.getPhysicalNumberOfCells();
|
||||
// 假设预期的表头列数为3列,可以根据实际需求修改这个条件
|
||||
if (totalCells != 3) {
|
||||
throw new IllegalArgumentException("表头列数与预期不符,请检查导入模板");
|
||||
}
|
||||
// 读取表头内容并验证每一列
|
||||
for (int cellNum = 0; cellNum < totalCells; cellNum++) {
|
||||
Cell cell = headerRow.getCell(cellNum);
|
||||
// 获取单元格内容并去除首尾空格
|
||||
String headerValue = cell.getStringCellValue().trim();
|
||||
// 根据列索引进行验证
|
||||
switch (cellNum) {
|
||||
case 0:
|
||||
if (!"杆塔名称".equals(headerValue)) {
|
||||
throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!"杆塔经度".equals(headerValue)) {
|
||||
throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!"杆塔纬度".equals(headerValue)) {
|
||||
throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ExcelUtil<TbProPower> util = new ExcelUtil<>(TbProPower.class);
|
||||
List<TbProPower> tbProPowerList = util.importExcel(file.getInputStream());
|
||||
int result = 0;
|
||||
for (TbProPower tbProPower : tbProPowerList) {
|
||||
tbProPower.setProId(proId);
|
||||
// 根据名称查询
|
||||
TbProPower power = tbProPowerDao.selectByName(tbProPower);
|
||||
if (power != null) {
|
||||
//进行更新操作
|
||||
tbProPower.setId(power.getId());
|
||||
result += tbProPowerDao.update(tbProPower);
|
||||
} else {
|
||||
result += tbProPowerDao.insert(tbProPower);
|
||||
}
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入模版下载
|
||||
* @param response
|
||||
*/
|
||||
@Override
|
||||
public void downLoadTemplate(HttpServletResponse response) {
|
||||
//模板名称
|
||||
String templateName = "TbProPowerTemplate.xlsx";
|
||||
OutputStream out = null;
|
||||
InputStream input = null;
|
||||
try {
|
||||
input = this.getClass().getClassLoader().getResourceAsStream("template/TbProPowerTemplate.xlsx");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("content-Type", "application/vnd.ms-excel");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;filename=" + new String((templateName).getBytes(), "iso-8859-1"));
|
||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
out = response.getOutputStream();
|
||||
// 缓冲区
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入内容输出到浏览器中
|
||||
while ((bytesToRead = input.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
IOUtils.closeQuietly(out);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从北京电科院数据库获取杆塔列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TbProPower> getList() {
|
||||
String sourceUrl = Constants.SOURCEURL;
|
||||
String sourceUser = Constants.SOURCEUSER;
|
||||
String sourcePassword = Constants.SOURCEPASSWORD;
|
||||
List<TbProPower> list = new ArrayList<>();
|
||||
|
||||
try (Connection sourceConn = DriverManager.getConnection(sourceUrl, sourceUser, sourcePassword);
|
||||
Statement selectStmt = sourceConn.createStatement()) {
|
||||
|
||||
String selectQuery = "SELECT * FROM dky_get_sm_tower_safety WHERE delete_flag = 0";
|
||||
|
||||
try (ResultSet rs = selectStmt.executeQuery(selectQuery)) {
|
||||
while (rs.next()) {
|
||||
String towerNo = rs.getString("tower_no");
|
||||
String longitude = rs.getString("longitude");
|
||||
String latitude = rs.getString("latitude");
|
||||
|
||||
TbProPower tbProPower = new TbProPower();
|
||||
if (StringUtils.isNotBlank(towerNo)) {
|
||||
tbProPower.setGtName(towerNo);
|
||||
if (StringUtils.isNotBlank(longitude)) {
|
||||
tbProPower.setLon(longitude);
|
||||
}
|
||||
if (StringUtils.isNotBlank(latitude)) {
|
||||
tbProPower.setLat(latitude);
|
||||
}
|
||||
}
|
||||
list.add(tbProPower);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed to execute SQL query", e);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed to connect to database", e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,282 @@
|
|||
package com.bonus.base.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.config.Constants;
|
||||
import com.bonus.base.config.ExceptionEnum;
|
||||
import com.bonus.base.domain.TbProDepart;
|
||||
import com.bonus.base.domain.TbProPower;
|
||||
import com.bonus.base.domain.TbProject;
|
||||
import com.bonus.base.mapper.TbProjectMapper;
|
||||
import com.bonus.base.service.TbProjectService;
|
||||
import com.bonus.base.vo.TbProjectPowerVo;
|
||||
import com.bonus.base.vo.TbProjectVo;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 工程表(TbProject)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-09 14:56:57
|
||||
*/
|
||||
@Service("tbProjectService")
|
||||
public class TbProjectServiceImpl implements TbProjectService {
|
||||
|
||||
@Resource
|
||||
private TbProjectMapper tbProjectDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbProjectVo queryById(Long id) {
|
||||
return tbProjectDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbProject 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<TbProjectVo> queryByPage(TbProject tbProject) {
|
||||
List<TbProjectVo> list = tbProjectDao.queryByPage(tbProject);
|
||||
return list.stream().filter(project -> project.getProName() != null).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbProject 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insert(TbProject tbProject) {
|
||||
if (tbProject == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//工程名称判重
|
||||
TbProjectVo project = tbProjectDao.selectByName(tbProject);
|
||||
if (project != null) {
|
||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
tbProject.setCreateUser(SecurityUtils.getUserId());
|
||||
int result = tbProjectDao.insert(tbProject);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbProject 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult update(TbProject tbProject) {
|
||||
if (tbProject == null || tbProject.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//工程名称判重
|
||||
TbProjectVo project = tbProjectDao.selectByName(tbProject);
|
||||
if (project != null && !project.getId().equals(tbProject.getId())) {
|
||||
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
tbProject.setUpdateUser(SecurityUtils.getUserId());
|
||||
int result = tbProjectDao.update(tbProject);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
} else {
|
||||
return AjaxResult.error(ExceptionEnum.UPDATE_TO_DATABASE.getCode(), ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteById(Long id) {
|
||||
//杆塔个数不为0,无法删除
|
||||
if (tbProjectDao.queryById(id).getPowerTotal() > 0) {
|
||||
return AjaxResult.error(ExceptionEnum.DELETE_PROJECT_ERROR.getCode(), ExceptionEnum.DELETE_PROJECT_ERROR.getMsg());
|
||||
}
|
||||
int result = tbProjectDao.deleteById(id);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
} else {
|
||||
return AjaxResult.error(ExceptionEnum.DELETE_TO_DATABASE.getCode(), ExceptionEnum.DELETE_TO_DATABASE.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TbProjectVo> getList() {
|
||||
String sourceUrl = Constants.SOURCEURL;
|
||||
String sourceUser = Constants.SOURCEUSER;
|
||||
String sourcePassword = Constants.SOURCEPASSWORD;
|
||||
List<TbProjectVo> projectVoList = new ArrayList<>();
|
||||
List<TbProjectPowerVo> powers = new ArrayList<>();
|
||||
|
||||
try (Connection sourceConn = DriverManager.getConnection(sourceUrl, sourceUser, sourcePassword);
|
||||
Statement selectStmt = sourceConn.createStatement()) {
|
||||
|
||||
String selectQuery = "SELECT * FROM dky_get_single_project";
|
||||
|
||||
/*//工程、杆塔组装
|
||||
String selectQuery = "SELECT t1.single_project_name AS proName," +
|
||||
"t1.voltage_level AS relName," +
|
||||
"t1.single_project_type AS proTypeName," +
|
||||
"t1.construction_status AS proStatusName," +
|
||||
"t2.tower_no AS towerNo," +
|
||||
"t2.longitude AS longitude," +
|
||||
"t2.latitude AS latitude " +
|
||||
"FROM dky_get_single_project t1 " +
|
||||
"LEFT JOIN dky_get_sm_tower_safety t2 ON t1.single_project_code = t2.single_project_code " +
|
||||
"AND t2.delete_flag = 0 " +
|
||||
"WHERE t1.delete_flag = 0";*/
|
||||
|
||||
try (ResultSet rs = selectStmt.executeQuery(selectQuery)) {
|
||||
while (rs.next()) {
|
||||
String proName = rs.getString("single_project_name");
|
||||
String proTypeName = rs.getString("single_project_type");
|
||||
String relName = rs.getString("voltage_level");
|
||||
String proStatusName = rs.getString("construction_status");
|
||||
if (StringUtils.isNotBlank(proName)) {
|
||||
TbProjectVo tbProjectVo = new TbProjectVo();
|
||||
tbProjectVo.setProName(proName);
|
||||
if (StringUtils.isNotBlank(relName)) {
|
||||
tbProjectVo.setRelName(relName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(proTypeName)) {
|
||||
tbProjectVo.setProTypeName(proTypeName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(proStatusName)) {
|
||||
tbProjectVo.setProStatusName(proStatusName);
|
||||
}
|
||||
projectVoList.add(tbProjectVo);
|
||||
}
|
||||
}
|
||||
/*while (rs.next()) {
|
||||
//工程名称
|
||||
String proName = rs.getString("proName");
|
||||
//电压等级
|
||||
String relName = rs.getString("relName");
|
||||
String proTypeName = rs.getString("proTypeName");
|
||||
String proStatusName = rs.getString("proStatusName");
|
||||
String towerNo = rs.getString("towerNo");
|
||||
String longitude = rs.getString("longitude");
|
||||
String latitude = rs.getString("latitude");
|
||||
|
||||
if (StringUtils.isNotBlank(proName)) {
|
||||
TbProjectPowerVo tbProjectVo = new TbProjectPowerVo();
|
||||
tbProjectVo.setProName(proName);
|
||||
// 设置其他属性前先判断非空
|
||||
if (StringUtils.isNotBlank(relName)) {
|
||||
tbProjectVo.setRelName(relName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(proTypeName)) {
|
||||
tbProjectVo.setProTypeName(proTypeName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(proStatusName)) {
|
||||
tbProjectVo.setProStatusName(proStatusName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(towerNo)) {
|
||||
tbProjectVo.setGtName(towerNo);
|
||||
}
|
||||
if (StringUtils.isNotBlank(longitude)) {
|
||||
tbProjectVo.setLon(longitude);
|
||||
}
|
||||
if (StringUtils.isNotBlank(latitude)) {
|
||||
tbProjectVo.setLat(latitude);
|
||||
}
|
||||
powers.add(tbProjectVo);
|
||||
}
|
||||
}*/
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed to execute SQL query", e);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed to connect to database", e);
|
||||
}
|
||||
|
||||
/*if (CollectionUtils.isNotEmpty(powers)) {
|
||||
// 使用 Stream API 对数据进行分组
|
||||
Map<String, List<TbProjectPowerVo>> groupedProjects = powers.stream()
|
||||
.collect(Collectors.groupingBy(p -> getKey(p.getProName(), p.getRelName(), p.getProTypeName(), p.getProStatusName())));
|
||||
// 遍历分组后的数据,创建 TbProjectVo 对象并组装到列表中
|
||||
for (Map.Entry<String, List<TbProjectPowerVo>> entry : groupedProjects.entrySet()) {
|
||||
String[] keyParts = entry.getKey().split("_");
|
||||
String proName = keyParts[0];
|
||||
String relName = keyParts[1];
|
||||
String proTypeName = keyParts[2];
|
||||
String proStatusName = keyParts[3];
|
||||
|
||||
TbProjectVo projectVo = new TbProjectVo();
|
||||
projectVo.setProName(proName);
|
||||
projectVo.setRelName(relName);
|
||||
projectVo.setProTypeName(proTypeName);
|
||||
projectVo.setProStatusName(proStatusName);
|
||||
|
||||
List<TbProPower> powerList = new ArrayList<>();
|
||||
for (TbProjectPowerVo project : entry.getValue()) {
|
||||
TbProPower power = new TbProPower();
|
||||
power.setGtName(project.getGtName());
|
||||
power.setLat(project.getLat());
|
||||
power.setLon(project.getLon());
|
||||
// 设置其他属性,如 id、proId 等
|
||||
powerList.add(power);
|
||||
}
|
||||
|
||||
projectVo.setPowerList(powerList);
|
||||
projectVoList.add(projectVo);
|
||||
}
|
||||
}*/
|
||||
return projectVoList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 拼接工程名称、电压等级、工程类型、工程状态
|
||||
* 工程、杆塔组装使用
|
||||
* @param proName
|
||||
* @param relName
|
||||
* @param proTypeName
|
||||
* @param proStatusName
|
||||
* @return
|
||||
*/
|
||||
private String getKey(String proName, String relName, String proTypeName, String proStatusName) {
|
||||
return proName + "_" + relName + "_" + proTypeName + "_" + proStatusName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,222 @@
|
|||
package com.bonus.base.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.config.ExceptionEnum;
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import com.bonus.base.domain.TbTeam;
|
||||
import com.bonus.base.mapper.TbTeamMapper;
|
||||
import com.bonus.base.service.TbTeamService;
|
||||
import com.bonus.base.vo.TbDeviceVo;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班组管理(TbTeam)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-10 09:46:32
|
||||
*/
|
||||
@Service("tbTeamService")
|
||||
public class TbTeamServiceImpl implements TbTeamService {
|
||||
@Resource
|
||||
private TbTeamMapper tbTeamDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public List<TbPeople> queryById(Long id) {
|
||||
//TbTeam tbTeam = tbTeamDao.queryById(id);
|
||||
List<TbPeople> list = tbTeamDao.selectList(id);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(tbPeople -> {
|
||||
if (StringUtils.isNotBlank(tbPeople.getRelPhone())) {
|
||||
// 解密 relPhone
|
||||
String decodedPhone = Sm4Utils.decode(tbPeople.getRelPhone());
|
||||
tbPeople.setRelPhone(decodedPhone);
|
||||
}
|
||||
if (StringUtils.isNotBlank(tbPeople.getIdCard())) {
|
||||
String decodedIdCard = Sm4Utils.decode(tbPeople.getIdCard());
|
||||
tbPeople.setIdCard(decodedIdCard);
|
||||
}
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbTeam 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<TbTeam> queryByPage(TbTeam tbTeam) {
|
||||
List<TbTeam> teamList = tbTeamDao.queryByPage(tbTeam);
|
||||
if (CollectionUtils.isNotEmpty(teamList)) {
|
||||
for (TbTeam team : teamList) {
|
||||
if (StringUtils.isNotBlank(team.getRelName()) && StringUtils.isNotBlank(team.getRelPhone())) {
|
||||
// 解密 relPhone,并拼接到 relName 后面
|
||||
String decodedPhone = Sm4Utils.decode(team.getRelPhone());
|
||||
team.setRelName(team.getRelName() + "\\" + decodedPhone);
|
||||
}
|
||||
}
|
||||
}
|
||||
return teamList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbTeam 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult insert(TbTeam tbTeam) {
|
||||
if (tbTeam == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
int result = 0;
|
||||
//单纯添加班组成员
|
||||
if (tbTeam.getId() != null && CollectionUtils.isNotEmpty(tbTeam.getIdList())) {
|
||||
//将班组id插入到班组人员表
|
||||
for (Long id : tbTeam.getIdList()) {
|
||||
result += tbTeamDao.insertPeople(tbTeam.getId(), id);
|
||||
}
|
||||
} else {
|
||||
tbTeam.setCreateUser(SecurityUtils.getUserId());
|
||||
if (StringUtils.isNotBlank(tbTeam.getRelPhone())) {
|
||||
tbTeam.setRelPhone(Sm4Utils.encode(tbTeam.getRelPhone()));
|
||||
}
|
||||
result += tbTeamDao.insert(tbTeam);
|
||||
if (CollectionUtils.isNotEmpty(tbTeam.getIdList())) {
|
||||
//将班组id插入到班组人员表
|
||||
for (Long id : tbTeam.getIdList()) {
|
||||
result += tbTeamDao.insertPeople(tbTeam.getTeamId(), id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbTeam 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult update(TbTeam tbTeam) {
|
||||
if (tbTeam == null || tbTeam.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
int result = 0;
|
||||
//修改时可能重新添加表单,根据id先将tb_people表中team_id字段置为null
|
||||
result += tbTeamDao.updatePeople(tbTeam.getId());
|
||||
//修改
|
||||
tbTeam.setUpdateUser(SecurityUtils.getUserId());
|
||||
result += tbTeamDao.update(tbTeam);
|
||||
if (CollectionUtils.isNotEmpty(tbTeam.getIdList())) {
|
||||
//将班组id插入到班组人员表
|
||||
for (Long id : tbTeam.getIdList()) {
|
||||
result += tbTeamDao.insertPeople(tbTeam.getId(), id);
|
||||
}
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键解散班组
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteById(Long id) {
|
||||
//根据id去查询班组中是否存在成员,存在则不能解散
|
||||
if (tbTeamDao.getList(id).size() > 0) {
|
||||
return AjaxResult.error(ExceptionEnum.EXISTENCE_OF_MEMBERS.getCode(), ExceptionEnum.EXISTENCE_OF_MEMBERS.getMsg());
|
||||
}
|
||||
int result = tbTeamDao.updateById(id);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.UN_BIND_TO_DATABASE.getCode(), ExceptionEnum.UN_BIND_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员设备绑定
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult bind(TbTeam tbTeam) {
|
||||
tbTeam.setUpdateUser(SecurityUtils.getUserId());
|
||||
int result = tbTeamDao.bind(tbTeam);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.BIND_TO_DATABASE.getCode(), ExceptionEnum.BIND_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员设备解绑
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult unbind(TbTeam tbTeam) {
|
||||
tbTeam.setUpdateUser(SecurityUtils.getUserId());
|
||||
int result = tbTeamDao.unbind(tbTeam);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.NOT_BIND_TO_DATABASE.getCode(), ExceptionEnum.NOT_BIND_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 移出班组
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult remove(TbTeam tbTeam) {
|
||||
//健全判断,若人员绑定设备,则无法移出班组
|
||||
if (tbTeamDao.select(tbTeam.getId()) > 0) {
|
||||
return AjaxResult.error(ExceptionEnum.EXISTENCE_OF_BIND.getCode(), ExceptionEnum.EXISTENCE_OF_BIND.getMsg());
|
||||
}
|
||||
//移出班组
|
||||
int result = tbTeamDao.remove(tbTeam.getId());
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.NOT_REMOVE_TO_DATABASE.getCode(), ExceptionEnum.NOT_REMOVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 智能安全帽列表查询
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TbDeviceVo> selectDeviceList(TbDeviceVo tbDeviceVo) {
|
||||
return tbTeamDao.selectDeviceList(tbDeviceVo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.bonus.base.service.impl;
|
||||
|
||||
import com.bonus.base.config.ExceptionEnum;
|
||||
import com.bonus.base.domain.TbUserPost;
|
||||
import com.bonus.base.mapper.TbUserPostMapper;
|
||||
import com.bonus.base.service.TbUserPostService;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人员到岗到位签到表(TbUserPost)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-09-12 18:29:43
|
||||
*/
|
||||
@Service("tbUserPostService")
|
||||
public class TbUserPostServiceImpl implements TbUserPostService {
|
||||
@Resource
|
||||
private TbUserPostMapper tbUserPostDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbUserPost queryById(Long id) {
|
||||
return tbUserPostDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbUserPost 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<TbUserPost> queryByPage(TbUserPost tbUserPost) {
|
||||
return tbUserPostDao.queryByPage(tbUserPost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insert(TbUserPost tbUserPost) {
|
||||
int result = tbUserPostDao.insert(tbUserPost);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
} else {
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbUserPost update(TbUserPost tbUserPost) {
|
||||
this.tbUserPostDao.update(tbUserPost);
|
||||
return this.queryById(tbUserPost.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
package com.bonus.base.utils;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/5/25 16:07
|
||||
*/
|
||||
public class RsaUtil {
|
||||
//签名算法名称
|
||||
private static final String RSA_KEY_ALGORITHM = "RSA";
|
||||
|
||||
//RSA密钥长度,默认密钥长度是1024,密钥长度必须是64的倍数,在512到65536位之间,不管是RSA还是RSA2长度推荐使用2048
|
||||
private static final int KEY_SIZE = 2048;
|
||||
|
||||
/**
|
||||
* 公钥加密(用于数据加密)
|
||||
*
|
||||
* @param data 加密前的字符串
|
||||
* @param publicKeyStr base64编码后的公钥
|
||||
* @return base64编码后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptByPublicKey(String data, String publicKeyStr) throws Exception {
|
||||
//Java原生base64解码
|
||||
byte[] pubKey = Base64.getDecoder().decode(publicKeyStr);
|
||||
//创建X509编码密钥规范
|
||||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(pubKey);
|
||||
//返回转换指定算法的KeyFactory对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM);
|
||||
//根据X509编码密钥规范产生公钥对象
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
|
||||
//根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式)
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
//用公钥初始化此Cipher对象(加密模式)
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
//对数据加密
|
||||
byte[] encrypt = cipher.doFinal(data.getBytes());
|
||||
//返回base64编码后的字符串
|
||||
return Base64.getEncoder().encodeToString(encrypt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 私钥解密(用于数据解密)
|
||||
*
|
||||
* @param data 解密前的字符串
|
||||
* @param privateKeyStr 私钥
|
||||
* @return 解密后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptByPrivateKey(String data, String privateKeyStr) throws Exception {
|
||||
//Java原生base64解码
|
||||
byte[] priKey = Base64.getDecoder().decode(privateKeyStr);
|
||||
//创建PKCS8编码密钥规范
|
||||
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(priKey);
|
||||
//返回转换指定算法的KeyFactory对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM);
|
||||
//根据PKCS8编码密钥规范产生私钥对象
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8KeySpec);
|
||||
//根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式)
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
//用私钥初始化此Cipher对象(解密模式)
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
//对数据解密
|
||||
byte[] decrypt = cipher.doFinal(Base64.getDecoder().decode(data));
|
||||
//返回字符串
|
||||
return new String(decrypt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 私钥加密(用于数据签名)
|
||||
*
|
||||
* @param data 加密前的字符串
|
||||
* @param privateKeyStr base64编码后的私钥
|
||||
* @return base64编码后后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptByPrivateKey(String data, String privateKeyStr) throws Exception {
|
||||
//Java原生base64解码
|
||||
byte[] priKey = Base64.getDecoder().decode(privateKeyStr);
|
||||
//创建PKCS8编码密钥规范
|
||||
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(priKey);
|
||||
//返回转换指定算法的KeyFactory对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM);
|
||||
//根据PKCS8编码密钥规范产生私钥对象
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8KeySpec);
|
||||
//根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式)
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
//用私钥初始化此Cipher对象(加密模式)
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
//对数据加密
|
||||
byte[] encrypt = cipher.doFinal(data.getBytes());
|
||||
//返回base64编码后的字符串
|
||||
return Base64.getEncoder().encodeToString(encrypt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥解密(用于数据验签)
|
||||
*
|
||||
* @param data 解密前的字符串
|
||||
* @param publicKeyStr base64编码后的公钥
|
||||
* @return 解密后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptByPublicKey(String data, String publicKeyStr) throws Exception {
|
||||
//Java原生base64解码
|
||||
byte[] pubKey = Base64.getDecoder().decode(publicKeyStr);
|
||||
//创建X509编码密钥规范
|
||||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(pubKey);
|
||||
//返回转换指定算法的KeyFactory对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM);
|
||||
//根据X509编码密钥规范产生公钥对象
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
|
||||
//根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式)
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
//用公钥初始化此Cipher对象(解密模式)
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
//对数据解密
|
||||
byte[] decrypt = cipher.doFinal(Base64.getDecoder().decode(data));
|
||||
//返回字符串
|
||||
return new String(decrypt);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bonus.base.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/9/10 15:21
|
||||
*/
|
||||
@Data
|
||||
public class TbDeviceVo {
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
private Long devId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String devName;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String devCode;
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.bonus.base.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 第三方数据库获取工程、杆塔集合字段
|
||||
* @Author ma_sh
|
||||
* @create 2024/9/11 17:32
|
||||
*/
|
||||
@Data
|
||||
public class TbProjectPowerVo {
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 电压等级名称
|
||||
*/
|
||||
private String relName;
|
||||
|
||||
/**
|
||||
* 工程类型名称
|
||||
*/
|
||||
private String proTypeName;
|
||||
|
||||
/**
|
||||
* 工程状态名称
|
||||
*/
|
||||
private String proStatusName;
|
||||
|
||||
/**
|
||||
* 工程杆塔名称
|
||||
*/
|
||||
private String gtName;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Long proId;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private String lon;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.bonus.base.vo;
|
||||
|
||||
import com.bonus.base.domain.TbProPower;
|
||||
import com.bonus.base.domain.TbProject;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工程返回数据封装
|
||||
* @Author ma_sh
|
||||
* @create 2024/9/9 15:13
|
||||
*/
|
||||
@Data
|
||||
public class TbProjectVo extends TbProject {
|
||||
|
||||
/**
|
||||
* 电压等级名称
|
||||
*/
|
||||
@Excel(name = "电压等级")
|
||||
private String relName;
|
||||
|
||||
/**
|
||||
* 工程类型名称
|
||||
*/
|
||||
@Excel(name = "工程类型")
|
||||
private String proTypeName;
|
||||
|
||||
/**
|
||||
* 工程状态名称
|
||||
*/
|
||||
@Excel(name = "工程状态")
|
||||
private String proStatusName;
|
||||
|
||||
/**
|
||||
* 建管单位名称
|
||||
*/
|
||||
@Excel(name = "建管单位")
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 杆塔总数
|
||||
*/
|
||||
@Excel(name = "杆塔")
|
||||
private Integer powerTotal;
|
||||
|
||||
/**
|
||||
* 杆塔列表集合
|
||||
*/
|
||||
private List<TbProPower> powerList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
<?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.bonus.base.mapper.TbPeopleMapper">
|
||||
|
||||
<select id="selectByName" resultType="com.bonus.base.domain.TbPeople">
|
||||
select
|
||||
tp.id as id, tp.team_id as teamId, tp.rel_name as relName, tp.rel_phone as relPhone, tp.id_card as idCard,
|
||||
tp.post_code as postCode, sda
|
||||
</select>
|
||||
|
||||
<select id="queryByPage" resultType="com.bonus.base.domain.TbPeople">
|
||||
select
|
||||
tp.id as id, tp.team_id as teamId, tp.rel_name as relName, tp.rel_phone as relPhone, tp.id_card as idCard,
|
||||
tp.post_code as postCode, tp.sex as sex, td.dev_name as devName, CASE WHEN tp.team_id IS NULL THEN 0 ELSE 1 END as delFlag
|
||||
from tb_people tp
|
||||
left join tb_device td on tp.dev_id = td.id and td.del_flag = '0'
|
||||
where tp.del_flag = '0'
|
||||
<if test="id != null">
|
||||
and tp.team_id = #{id}
|
||||
UNION
|
||||
select
|
||||
tp.id as id, tp.team_id as teamId, tp.rel_name as relName, tp.rel_phone as relPhone, tp.id_card as idCard,
|
||||
tp.post_code as postCode, tp.sex as sex, td.dev_name as devName, CASE WHEN tp.team_id IS NULL THEN 0 ELSE 1 END as delFlag
|
||||
from tb_people tp
|
||||
left join tb_team tt on tt.rel_id = tp.id and tt.del_flag = '0'
|
||||
left join tb_device td on tp.dev_id = td.id and td.del_flag = '0'
|
||||
WHERE tt.id = #{id}
|
||||
ORDER BY delFlag
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
and tp.rel_name like concat('%',#{relName},'%')
|
||||
</if>
|
||||
<if test="sex != null">
|
||||
and tp.sex = #{sex}
|
||||
</if>
|
||||
/**
|
||||
* 班组长条件筛选,一个班组长只可带领一个组,班组员条件筛选,一个组员只可在一个班组
|
||||
*/
|
||||
<if test="isAll != null and isAll == 0">
|
||||
and (tp.team_id is null and tp.id not in (select rel_id from tb_team where del_flag = '0' and js_time is null))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryById" resultType="com.bonus.base.domain.TbPeople">
|
||||
select tp.id as id,
|
||||
tp.team_id as teamId,
|
||||
tp.rel_name as relName,
|
||||
tp.rel_phone as relPhone,
|
||||
tp.id_card as idCard,
|
||||
tp.post_code as postCode,
|
||||
tp.sex as sex
|
||||
from tb_people tp
|
||||
where tp.del_flag = '0' and tp.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryByName" resultType="com.bonus.base.domain.TbPeople">
|
||||
select tp.id as id,
|
||||
tp.team_id as teamId,
|
||||
tp.rel_name as relName,
|
||||
tp.rel_phone as relPhone,
|
||||
tp.id_card as idCard,
|
||||
tp.post_code as postCode,
|
||||
sda.dict_label as postName,
|
||||
tp.sex as sex
|
||||
from tb_people tp
|
||||
left join sys_dict_data sda on tp.post_code = sda.dict_code
|
||||
where tp.del_flag = '0'
|
||||
<if test="relName != null and relName != ''">
|
||||
and tp.rel_name = #{relName}
|
||||
</if>
|
||||
<if test="idCard != null and idCard != ''">
|
||||
and tp.id_card = #{idCard}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO tb_people
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="teamId != null and teamId != ''">team_id,</if>
|
||||
<if test="relName != null and relName != ''">rel_name,</if>
|
||||
<if test="relPhone != null and relPhone != ''">rel_phone,</if>
|
||||
<if test="idCard != null and idCard != ''">id_card,</if>
|
||||
<if test="postCode != null">post_code,</if>
|
||||
<if test="sex != null">sex,</if>
|
||||
<if test="createUser != null">create_user,</if>
|
||||
create_time,
|
||||
del_flag
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="teamId != null and teamId != ''">#{teamId},</if>
|
||||
<if test="relName != null and relName != ''">#{relName},</if>
|
||||
<if test="relPhone != null and relPhone != ''">#{relPhone},</if>
|
||||
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
||||
<if test="postCode != null">#{postCode},</if>
|
||||
<if test="sex != null">#{sex},</if>
|
||||
<if test="createUser != null">#{createUser},</if>
|
||||
NOW(),
|
||||
0
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdate">
|
||||
INSERT INTO tb_people
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="teamId != null and teamId != ''">team_id,</if>
|
||||
<if test="relName != null and relName != ''">rel_name,</if>
|
||||
<if test="relPhone != null and relPhone != ''">rel_phone,</if>
|
||||
<if test="idCard != null and idCard != ''">id_card,</if>
|
||||
<if test="postCode != null">post_code,</if>
|
||||
<if test="sex != null">sex,</if>
|
||||
<if test="createUser != null">create_user,</if>
|
||||
create_time,
|
||||
del_flag
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="teamId != null and teamId != ''">#{teamId},</if>
|
||||
<if test="relName != null and relName != ''">#{relName},</if>
|
||||
<if test="relPhone != null and relPhone != ''">#{relPhone},</if>
|
||||
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
||||
<if test="postCode != null">#{postCode},</if>
|
||||
<if test="sex != null">#{sex},</if>
|
||||
<if test="createUser != null">#{createUser},</if>
|
||||
NOW(),
|
||||
0
|
||||
</trim>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
team_id = VALUES(team_id),
|
||||
rel_phone = VALUES(rel_phone),
|
||||
post_code = VALUES(post_code),
|
||||
sex = VALUES(sex),
|
||||
create_user = VALUES(create_user),
|
||||
create_time = NOW(),
|
||||
del_flag = 0
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_people
|
||||
<set>
|
||||
<if test="teamId != null">
|
||||
team_id = #{teamId},
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
rel_name = #{relName},
|
||||
</if>
|
||||
<if test="relPhone != null and relPhone != ''">
|
||||
rel_phone = #{relPhone},
|
||||
</if>
|
||||
<if test="idCard != null and idCard != ''">
|
||||
id_card = #{idCard},
|
||||
</if>
|
||||
<if test="postCode != null and postCode != ''">
|
||||
post_code = #{postCode},
|
||||
</if>
|
||||
<if test="sex != null">
|
||||
sex = #{sex},
|
||||
</if>
|
||||
update_time = NOW(),
|
||||
<if test="updateUser != null">
|
||||
update_user = #{updateUser},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
update tb_people set del_flag = '1' where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
@ -9,50 +9,52 @@
|
|||
<select id="queryByPage" resultType="com.bonus.base.domain.TbProDepart">
|
||||
select
|
||||
tpd.id as id,
|
||||
depart_name as departName, depart_type as departType, area_id as areaId, ta.area_name as areaName,head_user as
|
||||
headUser,
|
||||
head_user_phone as headUserPhone, remarks as remarks, create_time as createTime, create_user as createUser,
|
||||
update_time as updateTime,
|
||||
update_user as updateUser, del_flag as delFlag
|
||||
tpd.depart_name as departName, sda.dict_label as departType, sda.dict_code as dictCode, tpd.area_id as areaId,
|
||||
ta.area_name as areaName, tpd.head_user as headUser,
|
||||
tpd.head_user_phone as headUserPhone, tpd.remarks as remarks, tpd.create_time as createTime, tpd.create_user as
|
||||
createUser,
|
||||
tpd.update_time as updateTime,
|
||||
tpd.update_user as updateUser, tpd.del_flag as delFlag
|
||||
from tb_pro_depart tpd
|
||||
left join tb_area ta on tpd.area_id = ta.id
|
||||
where del_flag = '0'
|
||||
<if test="id != null">
|
||||
and tpd.id = #{id}
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
and ta.area_name like concat('%',#{areaName},'%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
and depart_name like concat('%',#{departName},'%')
|
||||
</if>
|
||||
<if test="headUser != null and headUser != ''">
|
||||
and head_user like concat('%',#{headUser},'%')
|
||||
</if>
|
||||
left join sys_dict_data sda on tpd.depart_type = sda.dict_code
|
||||
where tpd.del_flag = '0'
|
||||
<if test="id != null">
|
||||
and tpd.id = #{id}
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''">
|
||||
and tpd.area_id = #{areaId}
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
and tpd.depart_name like concat('%',#{departName},'%')
|
||||
</if>
|
||||
<if test="headUser != null and headUser != ''">
|
||||
and tpd.head_user like concat('%',#{headUser},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultType="com.bonus.base.domain.TbProDepart">
|
||||
select tpd.id as id,
|
||||
depart_name as departName,
|
||||
depart_type as departType,
|
||||
area_id as areaId,
|
||||
tpd.depart_name as departName,
|
||||
tpd.depart_type as departType,
|
||||
tpd.area_id as areaId,
|
||||
ta.area_name as areaName,
|
||||
head_user as headUser,
|
||||
head_user_phone as headUserPhone,
|
||||
remarks as remarks,
|
||||
create_time as createTime,
|
||||
create_user as createUser,
|
||||
update_time as updateTime,
|
||||
update_user as updateUser,
|
||||
del_flag as delFlag
|
||||
tpd.head_user as headUser,
|
||||
tpd.head_user_phone as headUserPhone,
|
||||
tpd.remarks as remarks,
|
||||
tpd.create_time as createTime,
|
||||
tpd.create_user as createUser,
|
||||
tpd.update_time as updateTime,
|
||||
tpd.update_user as updateUser,
|
||||
tpd.del_flag as delFlag
|
||||
from tb_pro_depart tpd
|
||||
left join tb_areata on tpd.area_id = ta.id
|
||||
left join tb_area ta on tpd.area_id = ta.id
|
||||
where del_flag = '0'
|
||||
and tpd.id = #{id}
|
||||
</select>
|
||||
<select id="getAreaList" resultType="com.bonus.base.domain.TbArea">
|
||||
select id as id, area_name as areaName, area_type as areaType, p_id as pId
|
||||
select id as areaId, area_name as areaName, area_type as areaType, p_id as pId
|
||||
from tb_area
|
||||
where del_flag = '0'
|
||||
<if test="areaType != null and areaType != ''">
|
||||
|
|
@ -68,6 +70,19 @@
|
|||
and dict_type = #{dictType}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByName" resultType="com.bonus.base.domain.TbProDepart">
|
||||
select id as id, depart_name as departName, depart_type as departType, area_id as areaId, head_user as headUser,
|
||||
head_user_phone as headUserPhone, remarks as remarks, create_time as createTime, create_user as createUser,
|
||||
update_time as updateTime, update_user as updateUser, del_flag as delFlag
|
||||
from tb_pro_depart
|
||||
where del_flag = '0'
|
||||
<if test="departName != null and departName != ''">
|
||||
and depart_name = #{departName}
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''">
|
||||
and area_id = #{areaId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert">
|
||||
|
|
@ -81,8 +96,6 @@
|
|||
<if test="remarks != null">remarks,</if>
|
||||
create_time,
|
||||
<if test="createUser != null">create_user,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateUser != null">update_user,</if>
|
||||
del_flag
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -94,8 +107,6 @@
|
|||
<if test="remarks != null">#{remarks},</if>
|
||||
NOW(),
|
||||
<if test="createUser != null">#{createUser},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateUser != null">#{updateUser},</if>
|
||||
0
|
||||
</trim>
|
||||
</insert>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
<?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.bonus.base.mapper.TbProPowerMapper">
|
||||
|
||||
<select id="queryByPage" resultType="com.bonus.base.domain.TbProPower">
|
||||
select
|
||||
tb.id as id, tb.gt_name as gtName, tb.pro_id as proId, tb.lat as lat, tb.lon as lon, tb.del_flag as delFlag
|
||||
from tb_pro_power tb
|
||||
where tb.del_flag = '0'
|
||||
<if test="gtName != null and gtName != ''">
|
||||
and tb.gt_name like concat('%',#{gtName},'%')
|
||||
</if>
|
||||
</select>
|
||||
<select id="queryById" resultType="com.bonus.base.domain.TbProPower">
|
||||
select
|
||||
id, gt_name, pro_id, lat, lon, del_flag
|
||||
from tb_pro_power
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectByName" resultType="com.bonus.base.domain.TbProPower">
|
||||
select
|
||||
id, gt_name, pro_id, lat, lon, del_flag
|
||||
from tb_pro_power
|
||||
where del_flag = '0'
|
||||
<if test="gtName != null and gtName != ''">
|
||||
and gt_name = #{gtName}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and pro_id = #{proId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO tb_pro_power
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="gtName != null and gtName != ''">gt_name,</if>
|
||||
<if test="proId != null">pro_id,</if>
|
||||
<if test="lon != null">lon,</if>
|
||||
<if test="lat != null">lat,</if>
|
||||
del_flag
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="gtName != null and gtName != ''">#{gtName},</if>
|
||||
<if test="proId != null">#{proId},</if>
|
||||
<if test="lon != null">#{lon},</if>
|
||||
<if test="lat != null">#{lat},</if>
|
||||
0
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_pro_power
|
||||
<set>
|
||||
<if test="gtName != null and gtName != ''">
|
||||
gt_name = #{gtName},
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
pro_id = #{proId},
|
||||
</if>
|
||||
<if test="lat != null and lat != ''">
|
||||
lat = #{lat},
|
||||
</if>
|
||||
<if test="lon != null and lon != ''">
|
||||
lon = #{lon},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
update tb_pro_power set del_flag = '1' where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
<?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.bonus.base.mapper.TbProjectMapper">
|
||||
<delete id="deleteById">
|
||||
update tb_project set del_flag = '1' where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryByPage" resultType="com.bonus.base.vo.TbProjectVo">
|
||||
select
|
||||
tb.id as id, tb.pro_name as proName, tb.depart_id as departId, tpd.depart_name as departName, tb.rel_id as
|
||||
relId, sda.dict_label as relName, tb.pro_type as proType,
|
||||
CASE
|
||||
WHEN tb.pro_type = 1 THEN '变电工程'
|
||||
WHEN tb.pro_type = 2 THEN '线路工程'
|
||||
ELSE '电缆工程'
|
||||
END AS proTypeName,
|
||||
tb.pro_status AS proStatus,
|
||||
CASE
|
||||
WHEN tb.pro_status = 0 THEN '施工'
|
||||
ELSE '暂停'
|
||||
END AS proStatusName,
|
||||
tb.area_id as areaId, ta.area_name as areaName,
|
||||
tb.lon as lon, tb.lat as lat, tb.del_flag as delFlag, count(tpp.pro_id) as powerTotal
|
||||
from tb_project tb
|
||||
left join tb_pro_depart tpd on tb.depart_id = tpd.id
|
||||
left join tb_area ta on tb.area_id = ta.id
|
||||
left join sys_dict_data sda on tb.rel_id = sda.dict_code
|
||||
left join tb_pro_power tpp on tpp.pro_id = tb.id and tpp.del_flag = '0'
|
||||
where tb.del_flag = '0'
|
||||
<if test="id != null">
|
||||
and tb.id = #{id}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
and tb.pro_name like concat('%',#{proName},'%')
|
||||
</if>
|
||||
<if test="relId != null and relId != '' ">
|
||||
and tb.rel_id = #{relId}
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''">
|
||||
and tb.area_id = #{areaId}
|
||||
</if>
|
||||
<if test="proType != null and proType != ''">
|
||||
and tb.pro_type = #{proType}
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
and tpd.depart_name like concat('%',#{departName},'%')
|
||||
</if>
|
||||
GROUP BY tb.id
|
||||
</select>
|
||||
|
||||
<select id="queryById" resultType="com.bonus.base.vo.TbProjectVo">
|
||||
select tb.id as id,
|
||||
tb.pro_name as proName,
|
||||
tb.depart_id as departId,
|
||||
tpd.depart_name as departName,
|
||||
tb.rel_id as relId,
|
||||
sda.dict_label as relName,
|
||||
tb.pro_type as proType,
|
||||
tb.pro_status as proStatus,
|
||||
tb.area_id as areaId,
|
||||
ta.area_name as areaName,
|
||||
tb.lon as lon,
|
||||
tb.lat as lat,
|
||||
tb.del_flag as delFlag,
|
||||
count(tpp.pro_id) as powerTotal
|
||||
from tb_project tb
|
||||
left join tb_pro_depart tpd on tb.depart_id = tpd.id
|
||||
left join tb_area ta on tb.area_id = ta.id
|
||||
left join sys_dict_data sda on tb.rel_id = sda.dict_code
|
||||
left join tb_pro_power tpp on tpp.pro_id = tb.id and tpp.del_flag = '0'
|
||||
where tb.del_flag = '0'
|
||||
and tb.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByName" resultType="com.bonus.base.vo.TbProjectVo">
|
||||
select tb.id as id,
|
||||
tb.pro_name as proName,
|
||||
tb.depart_id as departId,
|
||||
tpd.depart_name as departName,
|
||||
tb.rel_id as relId,
|
||||
sda.dict_label as relName,
|
||||
tb.pro_type as proType,
|
||||
tb.pro_status as proStatus,
|
||||
tb.area_id as areaId,
|
||||
ta.area_name as areaName,
|
||||
tb.lon as lon,
|
||||
tb.lat as lat,
|
||||
tb.del_flag as delFlag
|
||||
from tb_project tb
|
||||
left join tb_pro_depart tpd on tb.depart_id = tpd.id
|
||||
left join tb_area ta on tb.area_id = ta.id
|
||||
left join sys_dict_data sda on tb.rel_id = sda.dict_code
|
||||
where tb.del_flag = '0'
|
||||
<if test="proName != null and proName != ''">
|
||||
and tb.pro_name = #{proName}
|
||||
</if>
|
||||
<if test="departId != null and departId != ''">
|
||||
and tb.depart_id = #{departId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO tb_project
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="proName != null and proName != ''">pro_name,</if>
|
||||
<if test="departId != null">depart_id,</if>
|
||||
<if test="relId != null">rel_id,</if>
|
||||
<if test="proType != null">pro_type,</if>
|
||||
<if test="proStatus != null">pro_status,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="lon != null">lon,</if>
|
||||
<if test="lat != null">lat,</if>
|
||||
create_time,
|
||||
<if test="createUser != null">create_user,</if>
|
||||
del_flag
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="proName != null and proName != ''">#{proName},</if>
|
||||
<if test="departId != null">#{departId},</if>
|
||||
<if test="relId != null">#{relId},</if>
|
||||
<if test="proType != null">#{proType},</if>
|
||||
<if test="proStatus != null">#{proStatus},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="lon != null">#{lon},</if>
|
||||
<if test="lat != null">#{lat},</if>
|
||||
NOW(),
|
||||
<if test="createUser != null">#{createUser},</if>
|
||||
0
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_project
|
||||
<set>
|
||||
<if test="proName != null and proName != ''">
|
||||
pro_name = #{proName},
|
||||
</if>
|
||||
<if test="departId != null">
|
||||
depart_id = #{departId},
|
||||
</if>
|
||||
<if test="relId != null and relId != ''">
|
||||
rel_id = #{relId},
|
||||
</if>
|
||||
<if test="proType != null and proType != ''">
|
||||
pro_type = #{proType},
|
||||
</if>
|
||||
<if test="proStatus != null and proStatus != ''">
|
||||
pro_status = #{proStatus},
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''">
|
||||
area_id = #{areaId},
|
||||
</if>
|
||||
<if test="lon != null and lon != ''">
|
||||
lon = #{lon},
|
||||
</if>
|
||||
<if test="lat != null and lat != ''">
|
||||
lat = #{lat},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
update_time = NOW(),
|
||||
<if test="updateUser != null">
|
||||
update_user = #{updateUser},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
<?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.bonus.base.mapper.TbTeamMapper">
|
||||
|
||||
<select id="queryByPage" resultType="com.bonus.base.domain.TbTeam">
|
||||
select
|
||||
tt.id as id, tt.team_name as teamName, tt.rel_id as relId, tt.rel_name AS
|
||||
relName, tt.rel_phone as relPhone,
|
||||
tt.pro_id as proId, tt.pro_name as proName, tt.create_time as createTime, tt.create_user as createUser,
|
||||
tt.update_time as updateTime, tt.js_time as jsTime, tt.update_user as updateUser, tt.del_flag as delFlag,
|
||||
(count(tp.team_id) + 1) as peopleCount,
|
||||
CASE
|
||||
WHEN tt.js_time is null THEN '正常'
|
||||
ELSE '已解散'
|
||||
END AS teamStatus
|
||||
from tb_team tt
|
||||
left join tb_people tp on tp.team_id = tt.id and tp.del_flag = '0'
|
||||
where tt.del_flag = '0'
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="teamName != null and teamName != ''">
|
||||
and team_name like concat('%',#{teamName},'%')
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
and tt.rel_name like concat('%',#{relName},'%')
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
tt.team_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR tt.rel_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR tt.pro_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR
|
||||
CASE WHEN tt.js_time IS NULL THEN '正常' ELSE '已解散' END
|
||||
LIKE CONCAT('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY tt.id
|
||||
ORDER BY tt.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="queryById" resultType="com.bonus.base.domain.TbTeam">
|
||||
select
|
||||
id, team_name, rel_id, rel_name, rel_phone, pro_id, pro_name, create_time, create_user, update_time, js_time, update_user, del_flag
|
||||
from tb_team
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getList" resultType="com.bonus.base.domain.TbPeople">
|
||||
select
|
||||
tp.id as id, tp.team_id as teamId, tp.rel_name as relName, tp.rel_phone as relPhone,
|
||||
tp.sex as sex, tp.id_card as idCard, tp.post_code as postCode, tp.create_time as createTime,
|
||||
tp.create_user as createUser, tp.update_time as updateTime, tp.update_user updateUser, tp.del_flag as delFlag
|
||||
from tb_people tp
|
||||
where tp.del_flag = '0' and tp.team_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="select" resultType="java.lang.Integer">
|
||||
select COUNT(dev_id) from tb_people where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceList" resultType="com.bonus.base.vo.TbDeviceVo">
|
||||
select td.id as devId,
|
||||
td.dev_name as devName,
|
||||
td.dev_type as devType,
|
||||
td.dev_code as devCode
|
||||
from tb_device td
|
||||
where td.del_flag = '0'
|
||||
AND NOT EXISTS(SELECT 1 FROM tb_people tp WHERE tp.dev_id = td.id AND tp.del_flag = '0')
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
td.dev_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR td.dev_code LIKE CONCAT('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultType="com.bonus.base.domain.TbPeople">
|
||||
SELECT
|
||||
tp.id AS id,
|
||||
tp.team_id AS teamId,
|
||||
tp.rel_name AS relName,
|
||||
tp.rel_phone AS relPhone,
|
||||
tp.sex AS sex,
|
||||
tp.id_card AS idCard,
|
||||
tp.post_code AS postCode,
|
||||
tp.create_time AS createTime,
|
||||
tp.create_user AS createUser,
|
||||
tp.update_time AS updateTime,
|
||||
tp.update_user updateUser,
|
||||
tp.del_flag AS delFlag
|
||||
FROM
|
||||
tb_people tp
|
||||
LEFT JOIN tb_team tt ON tp.team_id = tt.id
|
||||
AND tt.del_flag = '0'
|
||||
WHERE
|
||||
tp.del_flag = '0'
|
||||
AND ( tp.team_id IS NULL OR tp.team_id = #{id} )
|
||||
AND ( tp.id NOT IN ( SELECT rel_id FROM tb_team WHERE del_flag = '0' AND js_time IS NULL ) ) UNION
|
||||
SELECT
|
||||
tp.id AS id,
|
||||
tp.team_id AS teamId,
|
||||
tp.rel_name AS relName,
|
||||
tp.rel_phone AS relPhone,
|
||||
tp.sex AS sex,
|
||||
tp.id_card AS idCard,
|
||||
tp.post_code AS postCode,
|
||||
tp.create_time AS createTime,
|
||||
tp.create_user AS createUser,
|
||||
tp.update_time AS updateTime,
|
||||
tp.update_user updateUser,
|
||||
tp.del_flag AS delFlag
|
||||
FROM
|
||||
tb_people tp
|
||||
LEFT JOIN tb_team tt ON tp.id = tt.rel_id
|
||||
AND tt.del_flag = '0'
|
||||
WHERE
|
||||
tp.del_flag = '0'
|
||||
AND tt.id = #{id}
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="teamId" useGeneratedKeys="true">
|
||||
INSERT INTO tb_team
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="teamName != null and teamName != ''">team_name,</if>
|
||||
<if test="relId != null">rel_id,</if>
|
||||
<if test="relName != null and relName != ''">rel_name,</if>
|
||||
<if test="relPhone != null and relPhone != ''">rel_phone,</if>
|
||||
<if test="proId != null">pro_id,</if>
|
||||
<if test="proName != null and proName != ''">pro_name,</if>
|
||||
<if test="createUser != null">create_user,</if>
|
||||
create_time,
|
||||
del_flag
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="teamName != null and teamName != ''">#{teamName},</if>
|
||||
<if test="relId != null">#{relId},</if>
|
||||
<if test="relName != null and relName != ''">#{relName},</if>
|
||||
<if test="relPhone != null and relPhone != ''">#{relPhone},</if>
|
||||
<if test="proId != null">#{proId},</if>
|
||||
<if test="proName != null and proName != ''">#{proName},</if>
|
||||
<if test="createUser != null">#{createUser},</if>
|
||||
NOW(),
|
||||
0
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertPeople">
|
||||
update tb_people
|
||||
set team_id = #{teamId}
|
||||
where id = #{id}
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_team
|
||||
<set>
|
||||
<if test="teamName != null and teamName != ''">
|
||||
team_name = #{teamName},
|
||||
</if>
|
||||
<if test="relId != null">
|
||||
rel_id = #{relId},
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
rel_name = #{relName},
|
||||
</if>
|
||||
<if test="relPhone != null and relPhone != ''">
|
||||
rel_phone = #{relPhone},
|
||||
</if>
|
||||
<if test="proId != null and proId != ''">
|
||||
pro_id = #{proId},
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
pro_name = #{proName},
|
||||
</if>
|
||||
update_time = NOW(),
|
||||
<if test="jsTime != null">
|
||||
js_time = #{jsTime},
|
||||
</if>
|
||||
<if test="updateUser != null">
|
||||
update_user = #{updateUser},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updatePeople">
|
||||
UPDATE tb_people
|
||||
set team_id = null
|
||||
WHERE team_id = #{teamId}
|
||||
</update>
|
||||
|
||||
<update id="updateById">
|
||||
UPDATE tb_team
|
||||
set js_time = NOW()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="bind">
|
||||
UPDATE tb_people
|
||||
set dev_id = #{devId},
|
||||
update_user = #{updateUser},
|
||||
update_time = NOW()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="unbind">
|
||||
UPDATE tb_people
|
||||
set dev_id = null,
|
||||
update_user = #{updateUser},
|
||||
update_time = NOW()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="remove">
|
||||
UPDATE tb_people
|
||||
set team_id = null
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
<?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.bonus.base.mapper.TbUserPostMapper">
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from tb_user_post
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="postName != null and postName != ''">
|
||||
and post_name = #{postName}
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
and rel_name = #{relName}
|
||||
</if>
|
||||
<if test="relPhone != null and relPhone != ''">
|
||||
and rel_phone = #{relPhone}
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and pro_id = #{proId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryByPage" resultType="com.bonus.base.domain.TbUserPost">
|
||||
select
|
||||
id, post_name, rel_name, rel_phone, create_time, pro_id
|
||||
from tb_user_post
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="postName != null and postName != ''">
|
||||
and post_name = #{postName}
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
and rel_name = #{relName}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryById" resultType="com.bonus.base.domain.TbUserPost">
|
||||
select
|
||||
id, post_name, rel_name, rel_phone, create_time, pro_id
|
||||
from tb_user_post
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_user_post(post_name, rel_name, rel_phone, create_time, pro_id)
|
||||
values (#{postName}, #{relName}, #{relPhone}, NOW(), #{proId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_user_post(post_name, rel_name, rel_phone, create_time, pro_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.postName}, #{entity.relName}, #{entity.relPhone}, #{entity.createTime}, #{entity.proId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_user_post(post_name, rel_name, rel_phone, create_time, pro_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.postName}, #{entity.relName}, #{entity.relPhone}, #{entity.createTime}, #{entity.proId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
post_name = values(post_name),
|
||||
rel_name = values(rel_name),
|
||||
rel_phone = values(rel_phone),
|
||||
create_time = values(create_time),
|
||||
pro_id = values(pro_id)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_user_post
|
||||
<set>
|
||||
<if test="postName != null and postName != ''">
|
||||
post_name = #{postName},
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
rel_name = #{relName},
|
||||
</if>
|
||||
<if test="relPhone != null and relPhone != ''">
|
||||
rel_phone = #{relPhone},
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
pro_id = #{proId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue