parent
d91a3174f4
commit
ec839b84e7
@ -0,0 +1,104 @@ |
||||
package com.keyware.htey.controller.Department; |
||||
|
||||
import java.util.List; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.keyware.htey.entity.department.Department; |
||||
import com.keyware.htey.service.itf.DepartmentService; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @description 组织资产4列的所有数据 |
||||
* @Package com.keyware.htey.controller.user |
||||
* @date 2025/1/10 11:29 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping("/Department") |
||||
@Tag(name = "DEPARTMENT API", description = "部门表数据接口") |
||||
@Slf4j |
||||
public class DepartmentController { |
||||
@Autowired |
||||
private DepartmentService departmentService; |
||||
|
||||
@GetMapping("/selectById") |
||||
@ResponseBody |
||||
@Operation(summary = "部门表查询", description = "返回部门表信息") |
||||
@ApiResponse(responseCode = "200", description = "成功部门表信息") |
||||
public Department selectById(@RequestParam String id) { |
||||
return departmentService.getById(id); |
||||
} |
||||
|
||||
/** |
||||
* @author yangmengchuan |
||||
* @date 2025/1/7 |
||||
* @description 新增部门表 |
||||
*/ |
||||
@RequestMapping( |
||||
value = {"/addDepartment"}, |
||||
method = {RequestMethod.POST}, |
||||
produces = {"application/json; charset=utf-8"} |
||||
) |
||||
@ResponseBody |
||||
@Operation(summary = "新增部门表", description = "返回新增部门信息") |
||||
@ApiResponse(responseCode = "200", description = "成功新增部门信息") |
||||
public boolean addDepartment(@RequestBody Department department) { |
||||
Department oneDepartment = departmentService.getOne( |
||||
new QueryWrapper<Department>().eq("id", department.getId())); |
||||
if (oneDepartment != null) { |
||||
return false; |
||||
} |
||||
return departmentService.save(department); |
||||
} |
||||
|
||||
/** |
||||
* @author yangmengchuan |
||||
* @date 2025/1/7 |
||||
* @description 修改部门 |
||||
*/ |
||||
@RequestMapping( |
||||
value = {"/updateDepartment"}, |
||||
method = {RequestMethod.POST}, |
||||
produces = {"application/json; charset=utf-8"} |
||||
) |
||||
@ResponseBody |
||||
@Operation(summary = "修改部门", description = "返回修改部门信息") |
||||
@ApiResponse(responseCode = "200", description = "成功修改部门信息") |
||||
public boolean updateDepartment(@RequestBody List<Department> departments) { |
||||
boolean flag = true; |
||||
for (Department department : departments) { |
||||
boolean update = departmentService.updateById(department); |
||||
if (!update) { |
||||
flag = false; |
||||
break; |
||||
} |
||||
} |
||||
return flag; |
||||
} |
||||
|
||||
/** |
||||
* @author yangmengchuan |
||||
* @date 2025/1/7 |
||||
* @description 根据id进行删除 |
||||
*/ |
||||
@GetMapping("/deleteDepartment") |
||||
@ResponseBody |
||||
@Operation(summary = "根据id删除部门", description = "返回删除部门信息") |
||||
@ApiResponse(responseCode = "200", description = "成功删除部门信息") |
||||
public boolean deleteDepartment(@RequestParam String id) { |
||||
return departmentService.removeById(id); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,41 @@ |
||||
package com.keyware.htey.controller.Usersecret; |
||||
|
||||
import com.keyware.htey.entity.usersecret.Usersecret; |
||||
import com.keyware.htey.service.itf.UsersecretService; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
/** |
||||
* @author daijiajun |
||||
* @date 2025/1/7 |
||||
* @description 用户登录日志 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping("/usersecret") |
||||
@Slf4j |
||||
@Tag(name = "Usersecret API", description = "用户登录秘密管理接口") |
||||
public class UsersecretController { |
||||
@Autowired |
||||
private UsersecretService usersecretService; |
||||
|
||||
/** |
||||
* @author daijiajun |
||||
* @date 2025/1/7 |
||||
* @description 根据id获取用户信息 |
||||
*/ |
||||
@GetMapping("/selectById") |
||||
@ResponseBody |
||||
@Operation(summary = "根据id查询秘密", description = "返回查询秘密信息") |
||||
@ApiResponse(responseCode = "200", description = "成功获取用户信息") |
||||
public Usersecret selectById(@RequestParam String id) { |
||||
return usersecretService.getById(id); |
||||
} |
||||
} |
@ -0,0 +1,62 @@ |
||||
package com.keyware.htey.controller.humanResourceManagement; |
||||
|
||||
import com.keyware.htey.entity.user.AuditLog; |
||||
import com.keyware.htey.service.itf.AuditLogService; |
||||
import com.keyware.htey.utli.AjaxMessage; |
||||
import com.keyware.htey.utli.ExcelUtils; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.poi.ss.usermodel.Sheet; |
||||
import org.apache.poi.ss.usermodel.Workbook; |
||||
import org.apache.poi.ss.usermodel.WorkbookFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
@Controller |
||||
@RequestMapping("/humanResourceManagement") |
||||
@Tag(name = "Excl API", description = "表格接口") |
||||
@Slf4j |
||||
public class HumanResourceManagementController { |
||||
@Autowired |
||||
private AuditLogService auditLogService; |
||||
|
||||
@RequestMapping(value = {"/analysisExcl"},method = {RequestMethod.POST},produces = {"application/json; charset=utf-8"}) |
||||
@ResponseBody |
||||
@Operation(summary = "用户列表导入", description = "返回导入信息") |
||||
@ApiResponse(responseCode = "200", description = "成功导入信息") |
||||
public AjaxMessage analysisExcl(@RequestParam MultipartFile multipartfile) { |
||||
AjaxMessage ajaxMessage = new AjaxMessage(); |
||||
try { |
||||
Workbook workbook = WorkbookFactory.create(multipartfile.getInputStream()); |
||||
Sheet sheet = workbook.getSheetAt(0); |
||||
ExcelUtils.checkFirstRowName(ajaxMessage, sheet); |
||||
if ("0".equals(ajaxMessage.getCode())) { |
||||
return ajaxMessage; |
||||
} |
||||
AuditLog auditLog = new AuditLog(); |
||||
String message = new ExcelUtils().insertUser(auditLog, sheet); |
||||
ajaxMessage.setCode("1"); |
||||
ajaxMessage.setMessage(message); |
||||
// String comments = this.getUser_idFormSession("userName") + message;
|
||||
String comments = message; |
||||
String logName = "批量导入"; |
||||
String logNameType = "用户列表"; |
||||
auditLog.setLogName(logName); |
||||
auditLog.setLogNameType(logNameType); |
||||
auditLog.setComments(comments); |
||||
auditLogService.addAuditLog(auditLog); |
||||
} catch (Exception var8) { |
||||
log.error("导入失败", var8); |
||||
var8.printStackTrace(); |
||||
ajaxMessage.setCode("0"); |
||||
} |
||||
return ajaxMessage; |
||||
} |
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.keyware.htey.controller.organizeassets; |
||||
|
||||
import com.keyware.htey.entity.organizeassets.OFourColum; |
||||
import com.keyware.htey.service.itf.OFourColumService; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.beans.factory.annotation.Qualifier; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @description 组织资产4列的所有数据 |
||||
* @Package com.keyware.htey.controller.user |
||||
* @date 2025/1/10 11:29 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping("/oFourColum") |
||||
@Tag(name = "OFourColum API", description = "组织资产4列的所有数据接口") |
||||
@Slf4j |
||||
public class OFourColumController { |
||||
@Qualifier("newOFourColumService") |
||||
@Autowired |
||||
private OFourColumService oFourColumService; |
||||
|
||||
@GetMapping("/selectByUserInfo17suo") |
||||
@ResponseBody |
||||
@Operation(summary = "用户密级查询", description = "返回用户密级信息") |
||||
@ApiResponse(responseCode = "200", description = "成功用户密级信息") |
||||
public OFourColum selectOFourColumById(@RequestParam String id) { |
||||
return oFourColumService.getById(id); |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
package com.keyware.htey.controller.user; |
||||
|
||||
import com.keyware.htey.entity.user.AuditLog; |
||||
import com.keyware.htey.service.itf.AuditLogService; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
/** |
||||
* @author daijiajun |
||||
* @date 2025/1/7 |
||||
* @description 用户登录日志 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping("/auditLog") |
||||
@Slf4j |
||||
@Tag(name = "AuditLog API", description = "用户登录日志管理接口") |
||||
public class AuditLogController { |
||||
@Autowired |
||||
private AuditLogService auditLogService; |
||||
|
||||
/** |
||||
* @author daijiajun |
||||
* @date 2025/1/7 |
||||
* @description 新增用户登录日志 |
||||
*/ |
||||
@RequestMapping( |
||||
value = {"/addAuditLog"}, |
||||
method = {RequestMethod.POST}, |
||||
produces = {"application/json; charset=utf-8"} |
||||
) |
||||
@ResponseBody |
||||
@Operation(summary = "新增用户登录日志", description = "返回添加成功失败信息") |
||||
@ApiResponse(responseCode = "200", description = "成功用户登录日志信息") |
||||
public boolean addAuditLog(@RequestBody AuditLog auditLog) { |
||||
return auditLogService.save(auditLog); |
||||
} |
||||
} |
@ -0,0 +1,31 @@ |
||||
package com.keyware.htey.entity.department; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
@TableName("DEPARTMENT") |
||||
public class Department implements Serializable { |
||||
private static final long serialVersionUID = -1292417487409772488L; |
||||
private String id; |
||||
private String deptName; |
||||
private String parentId; |
||||
private Integer orderNo; |
||||
private String comments; |
||||
private String deptCreateTime; |
||||
private String deptNumber; |
||||
private String manager; |
||||
private Integer totalWorkers; |
||||
private String superLeader; |
||||
private String interfacePerson; |
||||
private String departAbbrevia; |
||||
private String charge; |
||||
private String isSys; |
||||
private String projectSource; |
||||
} |
@ -0,0 +1,18 @@ |
||||
package com.keyware.htey.entity.number; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
@TableName("NUMBER_BUILDER") |
||||
public class NumberBuilder implements Serializable { |
||||
private static final long serialVersionUID = -1292417487409772488L; |
||||
private String numberId; |
||||
private String number; |
||||
} |
@ -0,0 +1,24 @@ |
||||
package com.keyware.htey.entity.organizeassets; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
@TableName("KT_O_FOUR_COLUM") |
||||
public class OFourColum implements Serializable { |
||||
private static final long serialVersionUID = 1663815585294731536L; |
||||
private String id; |
||||
private String name; |
||||
private String code; |
||||
private String describe; |
||||
private String parentId; |
||||
private Integer seq; |
||||
private String formLevel; |
||||
private String isDefault; |
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.keyware.htey.entity.user; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
@TableName("K_USER_AUDIT_LOG") |
||||
public class AuditLog implements Serializable { |
||||
private static final long serialVersionUID = -1292417487409772488L; |
||||
private String id; |
||||
private String logName; |
||||
private String logNameType; |
||||
private String userName; |
||||
private String deptName; |
||||
private String ipAddress; |
||||
private String operTime; |
||||
private String comments; |
||||
private String userId; |
||||
private String projectSource; |
||||
private String status; |
||||
@TableField(exist = false) |
||||
private String fileTime; |
||||
@TableField(exist = false) |
||||
private String startTime; |
||||
@TableField(exist = false) |
||||
private String endTime; |
||||
} |
@ -1,15 +1,57 @@ |
||||
package com.keyware.htey.entity.user; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
import java.io.Serializable; |
||||
@Data |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
@TableName("K_USER") |
||||
public class User implements Serializable { |
||||
private static final long serialVersionUID = -1292417487409772488L; |
||||
private String id; |
||||
private String userId; |
||||
private String userName; |
||||
private String password; |
||||
private String departId; |
||||
private String userCreationTime; |
||||
private String userPwdModifTime; |
||||
private Long userStatus; |
||||
private Long userLock; |
||||
private Long userPwdError; |
||||
private String userPwdErrorDate; |
||||
private String exitTime; |
||||
private String passwordOld; |
||||
private String post; |
||||
private String email; |
||||
private String officeTelephone; |
||||
private String userNumber; |
||||
private String idCard; |
||||
private String mobilePhone; |
||||
private Long sex; |
||||
private String homePhone; |
||||
private Long logout; |
||||
private String initPwdTime; |
||||
private String sort; |
||||
private String isSys; |
||||
private String logoutTime; |
||||
private String projectSource; |
||||
private String uesrRankId; |
||||
@TableField(exist = false) |
||||
private String deptName; |
||||
@TableField(exist = false) |
||||
private String userNameForSerch; |
||||
@TableField(exist = false) |
||||
private String flag; |
||||
@TableField(exist = false) |
||||
private String secret; |
||||
@TableField(exist = false) |
||||
private String ids; |
||||
@TableField(exist = false) |
||||
private String secretName; |
||||
} |
||||
|
@ -0,0 +1,18 @@ |
||||
package com.keyware.htey.entity.usersecret; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
@TableName("USERSECRET") |
||||
public class Usersecret implements Serializable { |
||||
private static final long serialVersionUID = -1292417487409772488L; |
||||
private String id; |
||||
private String secret; |
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.keyware.htey.mybatis.itf; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.keyware.htey.entity.user.AuditLog; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author yangmengchuan |
||||
* @date 2025/1/7 |
||||
* @description 用户与数据库交互 |
||||
*/ |
||||
@Mapper |
||||
public interface AuditLogMapper extends BaseMapper<AuditLog> { |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
package com.keyware.htey.mybatis.itf; |
||||
|
||||
import java.util.List; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.keyware.htey.entity.department.Department; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
/** |
||||
* @author yangmengchuan |
||||
* @date 2025/1/7 |
||||
* @description 用户与数据库交互 |
||||
*/ |
||||
@Mapper |
||||
public interface DepartmentMapper extends BaseMapper<Department> { |
||||
List<Department> selectByDeparmentName(@Param("deptName") String var1, @Param("projectSource") String var2); |
||||
|
||||
Department selectByPrimaryKey(String var1); |
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.keyware.htey.mybatis.itf; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.keyware.htey.entity.organizeassets.OFourColum; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author yangmengchuan |
||||
* @date 2025/1/7 |
||||
* @description 用户与数据库交互 |
||||
*/ |
||||
@Mapper |
||||
public interface OFourColumMapper extends BaseMapper<OFourColum> { |
||||
|
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.keyware.htey.mybatis.itf; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.keyware.htey.entity.usersecret.Usersecret; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author yangmengchuan |
||||
* @date 2025/1/7 |
||||
* @description 用户与数据库交互 |
||||
*/ |
||||
@Mapper |
||||
public interface UsersecretMapper extends BaseMapper<Usersecret> { |
||||
int insertSelective(Usersecret var1); |
||||
} |
@ -0,0 +1,20 @@ |
||||
package com.keyware.htey.mybatis.itf.number; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.keyware.htey.entity.number.NumberBuilder; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.mybatis.itf.number |
||||
* @date 2025/1/14 9:32 |
||||
*/ |
||||
@Mapper |
||||
public interface NumberBuilderMapper extends BaseMapper<NumberBuilder> { |
||||
NumberBuilder selectByPrimaryKey(String var1); |
||||
|
||||
int insertSelective(NumberBuilder var1); |
||||
|
||||
int updateByPrimaryKeySelective(NumberBuilder var1); |
||||
} |
@ -0,0 +1,41 @@ |
||||
package com.keyware.htey.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.keyware.htey.entity.user.AuditLog; |
||||
import com.keyware.htey.mybatis.itf.AuditLogMapper; |
||||
import com.keyware.htey.service.itf.AuditLogService; |
||||
import com.keyware.htey.utli.Constant; |
||||
import com.keyware.htey.utli.DateUtils; |
||||
import com.keyware.htey.utli.IdGenerator; |
||||
import com.keyware.htey.utli.IpUtil; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
@Slf4j |
||||
public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog> implements AuditLogService { |
||||
@Autowired |
||||
private AuditLogMapper auditLogMapper; |
||||
|
||||
public boolean insertLog(AuditLog auditLog) { |
||||
//todo 登录人信息
|
||||
//String userName = (String)session.getAttribute("userName");
|
||||
//String departName = (String)session.getAttribute("departName");
|
||||
//String userId = (String)session.getAttribute("userId");
|
||||
auditLog.setId(IdGenerator.uuid32()); |
||||
auditLog.setOperTime(DateUtils.getDateTime()); |
||||
auditLog.setIpAddress(IpUtil.getLocalIP()); |
||||
//auditLog.setUserName(userName);
|
||||
//auditLog.setDeptName(departName);
|
||||
//auditLog.setUserId(userId);
|
||||
return this.save(auditLog); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean addAuditLog(AuditLog auditLog) { |
||||
auditLog.setProjectSource(Constant.projectName); |
||||
return insertLog(auditLog); |
||||
} |
||||
} |
@ -0,0 +1,29 @@ |
||||
package com.keyware.htey.service.impl; |
||||
|
||||
import java.util.List; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.keyware.htey.entity.department.Department; |
||||
import com.keyware.htey.mybatis.itf.DepartmentMapper; |
||||
import com.keyware.htey.service.itf.DepartmentService; |
||||
import com.keyware.htey.utli.Constant; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
@Slf4j |
||||
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService { |
||||
@Autowired |
||||
private DepartmentMapper departmentMapper; |
||||
|
||||
@Override |
||||
public List<Department> selectByDeparmentName(String deptName) { |
||||
return this.departmentMapper.selectByDeparmentName(deptName, Constant.projectName); |
||||
} |
||||
|
||||
@Override |
||||
public Department selectByPrimaryKey(String id) { |
||||
return this.departmentMapper.selectByPrimaryKey(id); |
||||
} |
||||
} |
@ -0,0 +1,69 @@ |
||||
package com.keyware.htey.service.impl; |
||||
|
||||
import com.keyware.htey.entity.number.NumberBuilder; |
||||
import com.keyware.htey.mybatis.itf.number.NumberBuilderMapper; |
||||
import com.keyware.htey.service.itf.number.NumberBuilderService; |
||||
import com.keyware.htey.utli.Constant; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.service.impl |
||||
* @date 2025/1/14 9:24 |
||||
*/ |
||||
@Service |
||||
public class NumberBuilderServiceImpl implements NumberBuilderService { |
||||
@Autowired |
||||
private NumberBuilderMapper numberBuilderMapper; |
||||
|
||||
@Override |
||||
public String getUserNumber() { |
||||
Integer userNumber = this.getNumber("user_code"); |
||||
NumberBuilder selectByPrimaryKey = this.numberBuilderMapper.selectByPrimaryKey("userCodePre"); |
||||
if (userNumber == 1) { |
||||
return selectByPrimaryKey != null ? selectByPrimaryKey.getNumber() + "0001" : Constant.RULE_NUMBER + "0001"; |
||||
} else { |
||||
return selectByPrimaryKey != null ? selectByPrimaryKey.getNumber() + this.getStringNumber(userNumber) |
||||
: Constant.RULE_NUMBER + this.getStringNumber(userNumber); |
||||
} |
||||
} |
||||
|
||||
public Integer getNumber(String codeType) { |
||||
NumberBuilder numberBuilder = this.numberBuilderMapper.selectByPrimaryKey(codeType); |
||||
if (numberBuilder == null) { |
||||
return "seq_code".equals(codeType) ? 2 : 1; |
||||
} else { |
||||
return Integer.valueOf(numberBuilder.getNumber()) + 1; |
||||
} |
||||
} |
||||
|
||||
private String getStringNumber(Integer number) { |
||||
String strNumber; |
||||
for (strNumber = number.toString(); strNumber.length() < 4; strNumber = "0" + strNumber) { |
||||
} |
||||
return strNumber; |
||||
} |
||||
|
||||
public Integer updateNumber(String codeType) { |
||||
NumberBuilder numberBuilder = this.numberBuilderMapper.selectByPrimaryKey(codeType); |
||||
if (numberBuilder == null) { |
||||
NumberBuilder numberBuilder2 = new NumberBuilder(); |
||||
if ("seq_code".equals(codeType)) { |
||||
numberBuilder2.setNumber("2"); |
||||
} else { |
||||
numberBuilder2.setNumber("1"); |
||||
} |
||||
|
||||
numberBuilder2.setNumberId(codeType); |
||||
this.numberBuilderMapper.insertSelective(numberBuilder2); |
||||
return "seq_code".equals(codeType) ? 2 : 1; |
||||
} else { |
||||
Integer codeValue = Integer.valueOf(numberBuilder.getNumber()) + 1; |
||||
numberBuilder.setNumber(codeValue.toString()); |
||||
this.numberBuilderMapper.updateByPrimaryKeySelective(numberBuilder); |
||||
return Integer.valueOf(numberBuilder.getNumber()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.keyware.htey.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.keyware.htey.entity.organizeassets.OFourColum; |
||||
import com.keyware.htey.mybatis.itf.OFourColumMapper; |
||||
import com.keyware.htey.service.itf.OFourColumService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service("newOFourColumService") |
||||
@Slf4j |
||||
public class OFourColumServiceImpl extends ServiceImpl<OFourColumMapper, OFourColum> implements OFourColumService { |
||||
@Autowired |
||||
private OFourColumMapper oFourColumMapper; |
||||
|
||||
} |
@ -1,15 +1,74 @@ |
||||
package com.keyware.htey.service.impl; |
||||
|
||||
import java.util.List; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.keyware.htey.entity.user.User; |
||||
import com.keyware.htey.mybatis.itf.UserMapper; |
||||
import com.keyware.htey.service.itf.UserService; |
||||
import com.keyware.htey.utli.Constant; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service("userService") |
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService{ |
||||
@Service |
||||
@Slf4j |
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService { |
||||
@Autowired |
||||
private UserMapper userMapper; |
||||
private static String projectName = "kdtr"; |
||||
|
||||
@Override |
||||
public List<User> selectByUserInfo17suo(User user) { |
||||
user.setProjectSource(projectName); |
||||
user.setUserStatus(1L); |
||||
return userMapper.selectByUserInfo17suo(user); |
||||
} |
||||
|
||||
@Override |
||||
public int updateByPrimaryKey(User user) { |
||||
return this.userMapper.updateByPrimaryKey(user); |
||||
} |
||||
|
||||
@Override |
||||
public int unlock(List<?> record) { |
||||
return this.userMapper.unlock(record); |
||||
} |
||||
|
||||
@Override |
||||
public int updateStatus(User user) { |
||||
return this.userMapper.updateStatus(user); |
||||
} |
||||
|
||||
@Override |
||||
public List<User> selectByUserNumber(String userNumber) { |
||||
return this.userMapper.selectByUserNumber(userNumber, Constant.projectName); |
||||
} |
||||
|
||||
@Override |
||||
public int insert(User record) { |
||||
record.setProjectSource(Constant.projectName); |
||||
return this.userMapper.insert(record); |
||||
} |
||||
|
||||
@Override |
||||
public List<User> selectAll(String userId) { |
||||
return this.userMapper.selectAll(userId, Constant.projectName); |
||||
} |
||||
|
||||
@Override |
||||
public int insertSelective(User record) { |
||||
record.setProjectSource(Constant.projectName); |
||||
return this.userMapper.insertSelective(record); |
||||
} |
||||
|
||||
@Override |
||||
public User selectByPrimaryKey(String id) { |
||||
return this.userMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public int recovery(List record) { |
||||
return this.userMapper.recovery(record); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,21 @@ |
||||
package com.keyware.htey.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.keyware.htey.entity.usersecret.Usersecret; |
||||
import com.keyware.htey.mybatis.itf.UsersecretMapper; |
||||
import com.keyware.htey.service.itf.UsersecretService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
@Slf4j |
||||
public class UsersecretServiceImpl extends ServiceImpl<UsersecretMapper, Usersecret> implements UsersecretService { |
||||
@Autowired |
||||
private UsersecretMapper usersecretMapper; |
||||
|
||||
@Override |
||||
public int insertSelective(Usersecret userSecret) { |
||||
return this.usersecretMapper.insertSelective(userSecret); |
||||
} |
||||
} |
@ -0,0 +1,8 @@ |
||||
package com.keyware.htey.service.itf; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.keyware.htey.entity.user.AuditLog; |
||||
|
||||
public interface AuditLogService extends IService<AuditLog> { |
||||
public boolean addAuditLog(AuditLog auditLog); |
||||
} |
@ -0,0 +1,12 @@ |
||||
package com.keyware.htey.service.itf; |
||||
|
||||
import java.util.List; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.keyware.htey.entity.department.Department; |
||||
|
||||
public interface DepartmentService extends IService<Department> { |
||||
List<Department> selectByDeparmentName(String var1); |
||||
|
||||
Department selectByPrimaryKey(String var1); |
||||
} |
@ -0,0 +1,8 @@ |
||||
package com.keyware.htey.service.itf; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.keyware.htey.entity.organizeassets.OFourColum; |
||||
|
||||
public interface OFourColumService extends IService<OFourColum> { |
||||
|
||||
} |
@ -1,7 +1,29 @@ |
||||
package com.keyware.htey.service.itf; |
||||
|
||||
import java.util.List; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.keyware.htey.entity.user.User; |
||||
|
||||
public interface UserService extends IService<User> { |
||||
|
||||
List<User> selectByUserInfo17suo(User user); |
||||
|
||||
int updateByPrimaryKey(User user); |
||||
|
||||
int unlock(List<?> list); |
||||
|
||||
int updateStatus(User var1); |
||||
|
||||
List<User> selectByUserNumber(String var1); |
||||
|
||||
int insert(User var1); |
||||
|
||||
List<User> selectAll(String var1); |
||||
|
||||
int insertSelective(User var1); |
||||
|
||||
User selectByPrimaryKey(String var1); |
||||
|
||||
int recovery(List var1); |
||||
} |
||||
|
@ -0,0 +1,8 @@ |
||||
package com.keyware.htey.service.itf; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.keyware.htey.entity.usersecret.Usersecret; |
||||
|
||||
public interface UsersecretService extends IService<Usersecret> { |
||||
int insertSelective(Usersecret var1); |
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.keyware.htey.service.itf.number; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.service.itf.number |
||||
* @date 2025/1/14 9:23 |
||||
*/ |
||||
public interface NumberBuilderService { |
||||
String getUserNumber(); |
||||
|
||||
Integer updateNumber(String var1); |
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.keyware.htey.utli; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
public class AjaxMessage { |
||||
private static final long serialVersionUID = 1680802699076731536L; |
||||
private String code; |
||||
private String message; |
||||
private String data; |
||||
private String token; |
||||
|
||||
} |
@ -0,0 +1,14 @@ |
||||
package com.keyware.htey.utli; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.utli |
||||
* @date 2025/1/13 14:54 |
||||
*/ |
||||
public class Constant { |
||||
public static String projectName = "kdtr"; |
||||
public static String RULE_NUMBER = "kw"; |
||||
public static Integer userCount = 0; |
||||
public static String ERROE_MESSAGE = "系统错误,请联系管理员"; |
||||
} |
@ -0,0 +1,545 @@ |
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package com.keyware.htey.utli; |
||||
|
||||
import java.text.DateFormat; |
||||
import java.text.ParseException; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Calendar; |
||||
import java.util.Date; |
||||
import java.util.GregorianCalendar; |
||||
import java.util.Iterator; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
import java.util.TreeMap; |
||||
|
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang.StringUtils; |
||||
import org.apache.commons.lang.time.DateFormatUtils; |
||||
|
||||
@Slf4j |
||||
public class DateUtils extends org.apache.commons.lang.time.DateUtils { |
||||
private static GregorianCalendar gc; |
||||
private static String[] parsePatterns; |
||||
public static String DEFAULT_DATE_FORMAT; |
||||
|
||||
public DateUtils() { |
||||
} |
||||
|
||||
public static String getDate() { |
||||
return getDate("yyyy-MM-dd"); |
||||
} |
||||
|
||||
public static String getDate(String pattern) { |
||||
return DateFormatUtils.format(new Date(), pattern); |
||||
} |
||||
|
||||
public static String formatDate(Date date, Object[] pattern) { |
||||
String formatDate = null; |
||||
if (pattern != null && pattern.length > 0) { |
||||
formatDate = DateFormatUtils.format(date, pattern[0].toString()); |
||||
} else { |
||||
formatDate = DateFormatUtils.format(date, "yyyy-MM-dd"); |
||||
} |
||||
|
||||
return formatDate; |
||||
} |
||||
|
||||
public static String formatDateTime(Date date) { |
||||
return formatDate(date, new Object[] {"yyyy-MM-dd HH:mm:ss"}); |
||||
} |
||||
|
||||
public static String getTime() { |
||||
return formatDate(new Date(), new Object[] {"HH:mm:ss"}); |
||||
} |
||||
|
||||
public static String getDateTime() { |
||||
return formatDate(new Date(), new Object[] {"yyyy-MM-dd HH:mm:ss"}); |
||||
} |
||||
|
||||
public static String getYear() { |
||||
return formatDate(new Date(), new Object[] {"yyyy"}); |
||||
} |
||||
|
||||
public static String getMonth() { |
||||
return formatDate(new Date(), new Object[] {"MM"}); |
||||
} |
||||
|
||||
public static String getDay() { |
||||
return formatDate(new Date(), new Object[] {"dd"}); |
||||
} |
||||
|
||||
public static String getWeek() { |
||||
return formatDate(new Date(), new Object[] {"E"}); |
||||
} |
||||
|
||||
public static Date parseDate(Object str) { |
||||
if (str == null) { |
||||
return null; |
||||
} else { |
||||
try { |
||||
return parseDate(str.toString(), parsePatterns); |
||||
} catch (Exception var2) { |
||||
log.error("日期转换失败", var2); |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static long pastDays(Date date) { |
||||
long t = (new Date()).getTime() - date.getTime(); |
||||
return t / 86400000L; |
||||
} |
||||
|
||||
public static Date getDateStart(Date date) { |
||||
if (date == null) { |
||||
return null; |
||||
} else { |
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||
|
||||
try { |
||||
date = sdf.parse(formatDate(date, new Object[] {"yyyy-MM-dd"}) + " 00:00:00"); |
||||
} catch (ParseException var3) { |
||||
log.error("获取日期失败", var3); |
||||
var3.printStackTrace(); |
||||
} |
||||
|
||||
return date; |
||||
} |
||||
} |
||||
|
||||
public static Date getDateEnd(Date date) { |
||||
if (date == null) { |
||||
return null; |
||||
} else { |
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||
|
||||
try { |
||||
date = sdf.parse(formatDate(date, new Object[] {"yyyy-MM-dd"}) + " 23:59:59"); |
||||
} catch (ParseException var3) { |
||||
log.error("获取日期失败", var3); |
||||
var3.printStackTrace(); |
||||
} |
||||
|
||||
return date; |
||||
} |
||||
} |
||||
|
||||
public static Date getCurrentDate() { |
||||
Date date = new Date(System.currentTimeMillis()); |
||||
return date; |
||||
} |
||||
|
||||
public static int getCurrentTime(TimeFormatType timeFormatType) { |
||||
return getTime(getCurrentDate(), timeFormatType); |
||||
} |
||||
|
||||
public static int getTime(Date date, TimeFormatType timeFormatType) { |
||||
try { |
||||
Calendar c = Calendar.getInstance(); |
||||
c.setTime(date); |
||||
int type = timeFormatType.getValue(); |
||||
int i = c.get(type); |
||||
return type == 2 ? i + 1 : i; |
||||
} catch (Exception var5) { |
||||
log.error("获取日期失败", var5); |
||||
throw new RuntimeException("获取失败", var5); |
||||
} |
||||
} |
||||
|
||||
public static long getMillis(Date date) { |
||||
Calendar c = Calendar.getInstance(); |
||||
c.setTime(date); |
||||
return c.getTimeInMillis(); |
||||
} |
||||
|
||||
public static int operationDate(Date date, Date diffDate, DateOperationType dateOperationType) { |
||||
long add = getMillis(date) + getMillis(diffDate); |
||||
long diff = getMillis(date) - getMillis(diffDate); |
||||
return (int)((dateOperationType.getValue() ? add : diff) / 86400000L); |
||||
} |
||||
|
||||
public static Date operationDateOfMonth(Date date, int month, DateOperationType dateOperationType) { |
||||
Calendar c = Calendar.getInstance(); |
||||
c.setTime(date); |
||||
c.add(2, dateOperationType.getValue() ? month : month - month * 2); |
||||
return c.getTime(); |
||||
} |
||||
|
||||
public static Date operationDateOfDay(Date date, int day, DateOperationType dateOperationType) { |
||||
Calendar c = Calendar.getInstance(); |
||||
c.setTime(date); |
||||
long millis = c.getTimeInMillis(); |
||||
long millisOfday = (long)(day * 24 * 3600 * 1000); |
||||
long sumMillis = dateOperationType.getValue() ? millis + millisOfday : millis - millisOfday; |
||||
c.setTimeInMillis(sumMillis); |
||||
return c.getTime(); |
||||
} |
||||
|
||||
private static Object OpearationDate(Object object, String formatStr) { |
||||
if (object != null && null != formatStr && !"".equals(formatStr)) { |
||||
SimpleDateFormat format = new SimpleDateFormat(formatStr); |
||||
|
||||
try { |
||||
return object instanceof Date ? format.format(object) : format.parse(object.toString()); |
||||
} catch (Exception var4) { |
||||
log.error("操作失败", var4); |
||||
throw new RuntimeException("操作失败", var4); |
||||
} |
||||
} else { |
||||
throw new RuntimeException("参数不能为空"); |
||||
} |
||||
} |
||||
|
||||
public static Date getLastWorkDay(Date curDate, int n) { |
||||
Date endDate = curDate; |
||||
|
||||
for (int i = 0; i < n; ++i) { |
||||
endDate = new Date(endDate.getTime() - 86400000L); |
||||
int day_of_week = getDayOfWeek(endDate); |
||||
if (day_of_week == 1) { |
||||
endDate = new Date(endDate.getTime() - 172800000L); |
||||
} else if (day_of_week == 7) { |
||||
endDate = new Date(endDate.getTime() - 86400000L); |
||||
} |
||||
} |
||||
|
||||
return endDate; |
||||
} |
||||
|
||||
public static Integer getDayOfWeek(Date date) { |
||||
Calendar cal = new GregorianCalendar(); |
||||
cal.setTime(date); |
||||
return cal.get(7); |
||||
} |
||||
|
||||
private static void initCalendar(Date date) { |
||||
if (date == null) { |
||||
throw new IllegalArgumentException("argument date must be not null"); |
||||
} else { |
||||
gc.clear(); |
||||
gc.setTime(date); |
||||
} |
||||
} |
||||
|
||||
public static Date getAfterDate(Date date, int days) { |
||||
initCalendar(date); |
||||
gc.set(6, gc.get(6) + days); |
||||
return gc.getTime(); |
||||
} |
||||
|
||||
public static boolean before(String first, String second) { |
||||
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd"); |
||||
Date a = null; |
||||
Date b = null; |
||||
|
||||
try { |
||||
a = dfs.parse(first); |
||||
b = dfs.parse(second); |
||||
} catch (ParseException var6) { |
||||
log.error("操作失败", var6); |
||||
var6.printStackTrace(); |
||||
} |
||||
|
||||
return a.before(b); |
||||
} |
||||
|
||||
public static final String getDateStr(Date aDate) { |
||||
SimpleDateFormat df = null; |
||||
String returnValue = ""; |
||||
if (aDate != null) { |
||||
df = new SimpleDateFormat(parsePatterns[0]); |
||||
returnValue = df.format(aDate); |
||||
} |
||||
|
||||
return returnValue; |
||||
} |
||||
|
||||
public static final String getTimeStr(Date aDate) { |
||||
SimpleDateFormat df = null; |
||||
String returnValue = ""; |
||||
if (aDate != null) { |
||||
df = new SimpleDateFormat(parsePatterns[1]); |
||||
returnValue = df.format(aDate); |
||||
} |
||||
|
||||
return returnValue; |
||||
} |
||||
|
||||
public static Date convertStringToDate(String strDate) { |
||||
Date aDate = null; |
||||
|
||||
try { |
||||
String pattern = "\\d{4}[-|/]\\d{2}[-|/]\\d{2}[ ]\\d{2}[:]\\d{2}[:]\\d{2}"; |
||||
if (strDate.matches(pattern)) { |
||||
if (strDate.contains("/")) { |
||||
aDate = convertStringToDate("yyyy/MM/dd HH:mm:ss", strDate); |
||||
} else { |
||||
aDate = convertStringToDate(parsePatterns[1], strDate); |
||||
} |
||||
} else if (strDate.contains("/")) { |
||||
aDate = convertStringToDate("yyyy/MM/dd", strDate); |
||||
} else { |
||||
aDate = convertStringToDate(parsePatterns[0], strDate); |
||||
} |
||||
} catch (ParseException var3) { |
||||
log.error("操作失败", var3); |
||||
log.error("Could not convert '" + strDate + "' to a date, throwing exception"); |
||||
var3.printStackTrace(); |
||||
} |
||||
|
||||
return aDate; |
||||
} |
||||
|
||||
public static final Date convertStringToDate(String aMask, String strDate) throws ParseException { |
||||
SimpleDateFormat df = null; |
||||
Date date = null; |
||||
df = new SimpleDateFormat(aMask); |
||||
|
||||
try { |
||||
date = df.parse(strDate); |
||||
return date; |
||||
} catch (ParseException var5) { |
||||
log.error("日期转换失败", var5); |
||||
throw new ParseException(var5.getMessage(), var5.getErrorOffset()); |
||||
} |
||||
} |
||||
|
||||
public static final String getTimeStr(String format, Date aDate) { |
||||
SimpleDateFormat df = null; |
||||
String returnValue = ""; |
||||
if (aDate != null) { |
||||
df = new SimpleDateFormat(format); |
||||
returnValue = df.format(aDate); |
||||
} |
||||
|
||||
return returnValue; |
||||
} |
||||
|
||||
public static String beforNumDay(Date date, int day) { |
||||
Calendar c = Calendar.getInstance(); |
||||
c.setTime(date); |
||||
c.add(6, day); |
||||
return (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(c.getTime()); |
||||
} |
||||
|
||||
public static String strToDate(String strDate) { |
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||
return sdf.format(new Date(Long.parseLong(strDate))); |
||||
} |
||||
|
||||
public static String formatTime(Date date, String formats) { |
||||
if (StringUtils.isEmpty(formats)) { |
||||
formats = "yyyy-MM-dd HH:mm:ss"; |
||||
} |
||||
|
||||
String time = ""; |
||||
DateFormat format = new SimpleDateFormat(formats); |
||||
if (date != null) { |
||||
time = format.format(date); |
||||
return time; |
||||
} else { |
||||
throw new RuntimeException("Empty date!"); |
||||
} |
||||
} |
||||
|
||||
public static long betweenDays(String startDate, String endDate) throws ParseException { |
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
||||
Date enddate = simpleDateFormat.parse(endDate); |
||||
Date startdate = simpleDateFormat.parse(startDate); |
||||
Calendar cal = Calendar.getInstance(); |
||||
cal.setTime(enddate); |
||||
long endTime = cal.getTimeInMillis(); |
||||
cal.setTime(startdate); |
||||
long startTime = cal.getTimeInMillis(); |
||||
long between_days = (endTime - startTime) / 86400000L; |
||||
return between_days; |
||||
} |
||||
|
||||
public static long betweenSecond(String startDate, String endDate) throws ParseException { |
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||
Date enddate = simpleDateFormat.parse(endDate); |
||||
Date startdate = simpleDateFormat.parse(startDate); |
||||
Calendar cal = Calendar.getInstance(); |
||||
cal.setTime(enddate); |
||||
long endTime = cal.getTimeInMillis(); |
||||
cal.setTime(startdate); |
||||
long startTime = cal.getTimeInMillis(); |
||||
long between_second = (endTime - startTime) / 1000L; |
||||
return between_second; |
||||
} |
||||
|
||||
public static String getDateTimeInt() { |
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
||||
String dateTime = simpleDateFormat.format(new Date()).trim(); |
||||
return dateTime; |
||||
} |
||||
|
||||
public static String[] getTimeInterval(Date date) { |
||||
String[] date1 = new String[2]; |
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||
Calendar cal = Calendar.getInstance(); |
||||
cal.setTime(date); |
||||
int dayWeek = cal.get(7); |
||||
if (1 == dayWeek) { |
||||
cal.add(5, -1); |
||||
} |
||||
|
||||
System.out.println("要计算日期为:" + sdf.format(cal.getTime())); |
||||
cal.setFirstDayOfWeek(2); |
||||
int day = cal.get(7); |
||||
cal.add(5, cal.getFirstDayOfWeek() - day); |
||||
String imptimeBegin = sdf.format(cal.getTime()); |
||||
System.out.println("所在周星期一的日期:" + imptimeBegin); |
||||
cal.add(5, 6); |
||||
String imptimeEnd = sdf.format(cal.getTime()); |
||||
System.out.println("所在周星期日的日期:" + imptimeEnd); |
||||
date1[0] = imptimeBegin; |
||||
date1[1] = imptimeEnd; |
||||
return date1; |
||||
} |
||||
|
||||
private static String[] showResult(String[] dateArray) { |
||||
Map<String, Integer> dateMap = new TreeMap(); |
||||
int arrayLen = dateArray.length; |
||||
|
||||
for (int i = 0; i < arrayLen; ++i) { |
||||
String dateKey = dateArray[i]; |
||||
if (dateMap.containsKey(dateKey)) { |
||||
int value = (Integer)dateMap.get(dateKey) + 1; |
||||
dateMap.put(dateKey, value); |
||||
} else { |
||||
dateMap.put(dateKey, 1); |
||||
} |
||||
} |
||||
|
||||
Set<String> keySet = dateMap.keySet(); |
||||
String[] sorttedArray = new String[keySet.size()]; |
||||
Iterator<String> iter = keySet.iterator(); |
||||
|
||||
String key; |
||||
for (int index = 0; iter.hasNext(); sorttedArray[index++] = key) { |
||||
key = (String)iter.next(); |
||||
} |
||||
|
||||
int sorttedArrayLen = sorttedArray.length; |
||||
System.out.println("最小日期是:" + sorttedArray[0] + ", 天数为" + dateMap.get(sorttedArray[0])); |
||||
System.out.println("最大日期是:" + sorttedArray[sorttedArrayLen - 1] + ", 天数为" + dateMap.get( |
||||
sorttedArray[sorttedArrayLen - 1])); |
||||
return new String[] {sorttedArray[0], sorttedArray[sorttedArrayLen - 1]}; |
||||
} |
||||
|
||||
public static int countTwoDayWeek(Date startDate, Date endDate) { |
||||
String[] startWeek = getTimeInterval(startDate); |
||||
String[] endWeek = getTimeInterval(endDate); |
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
||||
Calendar cal = Calendar.getInstance(); |
||||
|
||||
try { |
||||
cal.setTime(dateFormat.parse(startWeek[0])); |
||||
long time1 = cal.getTimeInMillis(); |
||||
cal.setTime(dateFormat.parse(endWeek[1])); |
||||
long time2 = cal.getTimeInMillis(); |
||||
long between_days = (time2 - time1) / 86400000L; |
||||
Double days = Double.parseDouble(String.valueOf(between_days)); |
||||
if (days / 7.0 > 0.0 && days / 7.0 <= 1.0) { |
||||
return 1; |
||||
} else if (days / 7.0 > 1.0) { |
||||
int day = days.intValue(); |
||||
return day % 7 > 0 ? day / 7 + 1 : day / 7; |
||||
} else { |
||||
return days / 7.0 == 0.0 ? 0 : 0; |
||||
} |
||||
} catch (Exception var14) { |
||||
log.error("日期计算失败", var14); |
||||
var14.printStackTrace(); |
||||
return 0; |
||||
} |
||||
} |
||||
|
||||
public static long calculateTimeDifferenceByCalendar(String startDate, String endDate) { |
||||
if (startDate != null && endDate != null) { |
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
||||
|
||||
try { |
||||
Date d1 = df.parse(startDate); |
||||
Date d2 = df.parse(endDate); |
||||
long diff = d2.getTime() - d1.getTime(); |
||||
long min = diff / 60000L; |
||||
return min; |
||||
} catch (Exception var9) { |
||||
log.error("计算两个日期相差多少分钟时出错!", var9); |
||||
var9.printStackTrace(); |
||||
return 0L; |
||||
} |
||||
} else { |
||||
return 0L; |
||||
} |
||||
} |
||||
|
||||
static { |
||||
gc = new GregorianCalendar(Locale.CHINA); |
||||
DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; |
||||
gc.setLenient(true); |
||||
gc.setFirstDayOfWeek(2); |
||||
parsePatterns = new String[] {"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy/MM/dd", |
||||
"yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm"}; |
||||
} |
||||
|
||||
public static enum DateOperationType { |
||||
ADD(true), |
||||
DIFF(false); |
||||
|
||||
private final boolean value; |
||||
|
||||
private DateOperationType(boolean operation) { |
||||
this.value = operation; |
||||
} |
||||
|
||||
public boolean getValue() { |
||||
return this.value; |
||||
} |
||||
} |
||||
|
||||
public static enum TimeFormatType { |
||||
YEAR(1), |
||||
MONTH(2), |
||||
DAY(5), |
||||
HOUR(11), |
||||
MINUTE(12), |
||||
SECOND(13); |
||||
|
||||
private final int value; |
||||
|
||||
private TimeFormatType(int formatStr) { |
||||
this.value = formatStr; |
||||
} |
||||
|
||||
public int getValue() { |
||||
return this.value; |
||||
} |
||||
} |
||||
|
||||
public static enum DateFormatType { |
||||
DATE_FORMAT_STR("yyyy-MM-dd HH:mm:ss"), |
||||
SIMPLE_DATE_TIME_FORMAT_STR("yyyyMMddHHmmss"), |
||||
SIMPLE_DATE_FORMAT_STR("yyyy-MM-dd"), |
||||
SIMPLE_DATE_FORMAT_VIRGULE_STR("yyyy/MM/dd"), |
||||
HOUR_MINUTE_SECOND("HH:mm:ss"), |
||||
HOUR_MINUTE("HH:mm"); |
||||
|
||||
private final String value; |
||||
|
||||
private DateFormatType(String formatStr) { |
||||
this.value = formatStr; |
||||
} |
||||
|
||||
public String getValue() { |
||||
return this.value; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,68 @@ |
||||
package com.keyware.htey.utli; |
||||
|
||||
import java.security.MessageDigest; |
||||
|
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.utli |
||||
* @date 2025/1/13 16:46 |
||||
*/ |
||||
@Slf4j |
||||
public class EncryptUtil { |
||||
|
||||
public EncryptUtil() { |
||||
} |
||||
|
||||
public static String md5AndSha(String inputText) { |
||||
return sha(md5(inputText)); |
||||
} |
||||
|
||||
public static String md5(String inputText) { |
||||
return encrypt(inputText, "md5"); |
||||
} |
||||
|
||||
public static String sha(String inputText) { |
||||
return encrypt(inputText, "sha-1"); |
||||
} |
||||
|
||||
private static String encrypt(String inputText, String algorithmName) { |
||||
if (inputText != null && !"".equals(inputText.trim())) { |
||||
if (algorithmName == null || "".equals(algorithmName.trim())) { |
||||
algorithmName = "md5"; |
||||
} |
||||
|
||||
String encryptText = null; |
||||
|
||||
try { |
||||
MessageDigest m = MessageDigest.getInstance(algorithmName); |
||||
m.update(inputText.getBytes("UTF8")); |
||||
byte[] s = m.digest(); |
||||
return hex(s); |
||||
} catch (Exception var6) { |
||||
log.error("操作失败", var6); |
||||
var6.printStackTrace(); |
||||
} |
||||
|
||||
return encryptText; |
||||
} else { |
||||
throw new IllegalArgumentException("请输入要加密的内容"); |
||||
} |
||||
} |
||||
|
||||
private static String hex(byte[] arr) { |
||||
StringBuffer sb = new StringBuffer(); |
||||
|
||||
for (byte b : arr) { |
||||
sb.append(Integer.toHexString(b & 255 | 256).substring(1, 3)); |
||||
} |
||||
|
||||
return sb.toString(); |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
System.out.println(md5("123456")); |
||||
} |
||||
} |
@ -0,0 +1,360 @@ |
||||
package com.keyware.htey.utli; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.regex.Matcher; |
||||
import java.util.regex.Pattern; |
||||
|
||||
import com.keyware.htey.entity.department.Department; |
||||
import com.keyware.htey.entity.user.AuditLog; |
||||
import com.keyware.htey.entity.user.User; |
||||
import com.keyware.htey.mybatis.itf.UserMapper; |
||||
import com.keyware.htey.service.itf.AuditLogService; |
||||
import com.keyware.htey.service.itf.DepartmentService; |
||||
import com.keyware.htey.service.itf.UserService; |
||||
import com.keyware.htey.service.itf.number.NumberBuilderService; |
||||
import org.apache.poi.ss.usermodel.Cell; |
||||
import org.apache.poi.ss.usermodel.CellType; |
||||
import org.apache.poi.ss.usermodel.DateUtil; |
||||
import org.apache.poi.ss.usermodel.Row; |
||||
import org.apache.poi.ss.usermodel.Sheet; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.util.StringUtils; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.utli |
||||
* @date 2025/1/14 8:51 |
||||
*/ |
||||
public class ExcelUtils { |
||||
@Autowired |
||||
private UserMapper userMapper; |
||||
@Autowired |
||||
private UserService userService; |
||||
@Autowired |
||||
private DepartmentService departmentService; |
||||
@Autowired |
||||
private NumberBuilderService numberBuilderService; |
||||
@Autowired |
||||
private AuditLogService auditLogService; |
||||
|
||||
public static void checkFirstRowName(AjaxMessage ajaxMessage, Sheet sheet) { |
||||
Row row = sheet.getRow(0); |
||||
List<String> columnName = new ArrayList(); |
||||
columnName.add("用户账号*"); |
||||
//if ("huayin".equals(customer)) {
|
||||
// columnName.add("用户编号*");
|
||||
//} else {
|
||||
columnName.add("员工编号*"); |
||||
//}
|
||||
|
||||
columnName.add("姓名*"); |
||||
//if ("huayin".equals(customer)) {
|
||||
// columnName.add("证件");
|
||||
//} else {
|
||||
columnName.add("身份证号码"); |
||||
//}
|
||||
|
||||
columnName.add("所属部门"); |
||||
columnName.add("电子邮件"); |
||||
columnName.add("性别"); |
||||
columnName.add("手机"); |
||||
columnName.add("办公电话"); |
||||
columnName.add("家庭电话"); |
||||
columnName.add("职务"); |
||||
if (null == row) { |
||||
ajaxMessage.setCode("0"); |
||||
ajaxMessage.setMessage("上传文档与批量导入平台用户的标准模板不一致,请下载excel模板进行编辑。"); |
||||
} else { |
||||
for (int i = 0; i < columnName.size(); ++i) { |
||||
Cell cell = row.getCell(i); |
||||
String cellValue = getCellValue(cell); |
||||
cellValue = cellValue.replaceAll(" ", ""); |
||||
if (!((String)columnName.get(i)).equals(cellValue)) { |
||||
ajaxMessage.setCode("0"); |
||||
ajaxMessage.setMessage("上传文档与批量导入平台用户的标准模板不一致,请下载excel模板进行编辑。"); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private static String getCellValue(org.apache.poi.ss.usermodel.Cell cell) { |
||||
String cellValue = ""; |
||||
if (cell == null) { |
||||
return cellValue; |
||||
} else { |
||||
try { |
||||
switch (cell.getCellType()) { |
||||
case NUMERIC: |
||||
if (DateUtil.isCellDateFormatted(cell)) { |
||||
cellValue = DateUtils.formatDateTime(cell.getDateCellValue()); |
||||
} else { |
||||
cell.setCellType(CellType.NUMERIC); |
||||
cellValue = String.valueOf(cell.getNumericCellValue()); |
||||
} |
||||
break; |
||||
case STRING: |
||||
cellValue = cell.getStringCellValue(); |
||||
break; |
||||
case FORMULA: |
||||
cell.setCellType(CellType.FORMULA); |
||||
cellValue = String.valueOf(cell.getCellFormula()); |
||||
break; |
||||
case BLANK: |
||||
cellValue = ""; |
||||
break; |
||||
case BOOLEAN: |
||||
cellValue = String.valueOf(cell.getBooleanCellValue()); |
||||
break; |
||||
case ERROR: |
||||
cellValue = "错误"; |
||||
break; |
||||
default: |
||||
cellValue = ""; |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return cellValue; |
||||
} |
||||
} |
||||
|
||||
public String insertUser(AuditLog auditLog, Sheet sheet) { |
||||
int inserted = 0; |
||||
int skip = 0; |
||||
String userNames = ""; |
||||
int rowNum = sheet.getPhysicalNumberOfRows(); |
||||
List<String> userList = new ArrayList(); |
||||
List<String> userList3 = new ArrayList(); |
||||
List<String> userList4 = new ArrayList(); |
||||
List<String> userList5 = new ArrayList(); |
||||
|
||||
int i; |
||||
Row row; |
||||
String userId; |
||||
String userNumber; |
||||
for (i = 1; i < rowNum; ++i) { |
||||
row = sheet.getRow(i); |
||||
if (null == row) { |
||||
return "导入失败:请在中间空白行输入必填项"; |
||||
} |
||||
|
||||
userId = this.getCellValue(row.getCell(0)); |
||||
userNumber = this.getCellValue(row.getCell(1)); |
||||
userList.add(userId); |
||||
userList4.add(userNumber); |
||||
} |
||||
|
||||
int j; |
||||
for (i = 0; i < userList.size() - 1; ++i) { |
||||
for (j = userList.size() - 1; j > i; --j) { |
||||
if (((String)userList.get(j)).equals(userList.get(i))) { |
||||
userList3.add(userList.get(j)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
for (i = 0; i < userList4.size() - 1; ++i) { |
||||
for (j = userList4.size() - 1; j > i; --j) { |
||||
if (((String)userList4.get(j)).equals(userList4.get(i))) { |
||||
userList5.add(userList4.get(j)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
String userName; |
||||
String idCard; |
||||
String email; |
||||
String mobilePhone; |
||||
String officeTelephone; |
||||
String homePhone; |
||||
String regEx; |
||||
for (i = 1; i < rowNum; ++i) { |
||||
row = sheet.getRow(i); |
||||
userId = this.getCellValue(row.getCell(0)); |
||||
userNumber = this.getCellValue(row.getCell(1)); |
||||
userName = this.getCellValue(row.getCell(2)); |
||||
int var29; |
||||
if ("".equals(userId) && "".equals(userName) && "".equals(userNumber)) { |
||||
var29 = skip + 1; |
||||
return "导入失败:必填项不能为空"; |
||||
} |
||||
|
||||
if (!StringUtils.hasText(userId)) { |
||||
var29 = skip + 1; |
||||
return "导入失败:登录账号不能为空"; |
||||
} |
||||
|
||||
if ("".equals(userNumber)) { |
||||
var29 = skip + 1; |
||||
return "导入失败:员工编号不能为空"; |
||||
} |
||||
|
||||
if ("".equals(userName)) { |
||||
var29 = skip + 1; |
||||
return "导入失败:姓名不能为空"; |
||||
} |
||||
|
||||
idCard = this.getCellValue(row.getCell(3)); |
||||
email = this.getCellValue(row.getCell(5)); |
||||
mobilePhone = this.getCellValue(row.getCell(7)); |
||||
officeTelephone = this.getCellValue(row.getCell(8)); |
||||
homePhone = this.getCellValue(row.getCell(9)); |
||||
String post = this.getCellValue(row.getCell(10)); |
||||
if (userId.length() > 25 || userNumber.length() > 20 || userName.length() > 25 || email.length() > 100 |
||||
|| officeTelephone.length() > 50 || homePhone.length() > 50 || post.length() > 50) { |
||||
var29 = skip + 1; |
||||
return "导入失败:输入信息长度入有误"; |
||||
} |
||||
|
||||
if (StringUtils.hasText(officeTelephone) && officeTelephone.length() < 2) { |
||||
var29 = skip + 1; |
||||
return "导入失败:办公电话输入长度有误"; |
||||
} |
||||
|
||||
if (StringUtils.hasText(homePhone) && homePhone.length() < 2) { |
||||
var29 = skip + 1; |
||||
return "导入失败:家庭电话输入长度有误"; |
||||
} |
||||
|
||||
Pattern pattern; |
||||
Matcher matcher; |
||||
boolean rs; |
||||
|
||||
if (StringUtils.hasText(userId)) { |
||||
regEx = "[0-9a-zA-Z\\_\\-\\(\\)]+"; |
||||
pattern = Pattern.compile(regEx); |
||||
matcher = pattern.matcher(userId); |
||||
rs = matcher.matches(); |
||||
if (!rs) { |
||||
var29 = skip + 1; |
||||
return "导入失败:账号" + userId + "输入有误"; |
||||
} |
||||
} |
||||
|
||||
User user = new User(); |
||||
user.setUserId(userId); |
||||
List<User> selectByUserId = userMapper.selectByUserId(userId, Constant.projectName); |
||||
|
||||
if (selectByUserId != null && selectByUserId.size() > 0) { |
||||
var29 = skip + 1; |
||||
return "导入失败:登录账号" + userId + "不能重复添加"; |
||||
} |
||||
|
||||
if (userList3.contains(userId)) { |
||||
var29 = skip + 1; |
||||
return "导入失败:登录账号" + userId + "不能重复添加"; |
||||
} |
||||
|
||||
if (userList5.contains(userNumber)) { |
||||
var29 = skip + 1; |
||||
return "导入失败:员工编号" + userNumber + "不能重复添加"; |
||||
} |
||||
|
||||
if (StringUtils.hasText(userNumber)) { |
||||
user.setUserId((String)null); |
||||
user.setUserNumber(userNumber); |
||||
List<User> users = userService.selectByUserNumber(userNumber); |
||||
if (users != null && users.size() > 0) { |
||||
var29 = skip + 1; |
||||
return "导入失败:用户编号" + userNumber + "不能重复添加"; |
||||
} |
||||
} |
||||
} |
||||
|
||||
for (i = 1; i < rowNum; ++i) { |
||||
row = sheet.getRow(i); |
||||
userId = this.getCellValue(row.getCell(0)); |
||||
userNumber = this.getCellValue(row.getCell(1)); |
||||
userName = this.getCellValue(row.getCell(2)); |
||||
idCard = this.getCellValue(row.getCell(3)); |
||||
email = this.getCellValue(row.getCell(4)); |
||||
mobilePhone = null; |
||||
officeTelephone = this.getCellValue(row.getCell(5)); |
||||
homePhone = this.getCellValue(row.getCell(6)); |
||||
Long sexLong = null; |
||||
regEx = this.getCellValue(row.getCell(7)); |
||||
officeTelephone = this.getCellValue(row.getCell(8)); |
||||
homePhone = this.getCellValue(row.getCell(9)); |
||||
String post = this.getCellValue(row.getCell(10)); |
||||
if (!"男".equals(homePhone) && !"女".equals(homePhone)) { |
||||
sexLong = null; |
||||
} |
||||
|
||||
if ("男".equals(homePhone)) { |
||||
sexLong = 0L; |
||||
} |
||||
|
||||
if ("女".equals(homePhone)) { |
||||
sexLong = 1L; |
||||
} |
||||
|
||||
User user = new User(); |
||||
user.setUserId(userId); |
||||
List<Department> selectByDeparmentName = this.departmentService.selectByDeparmentName(email); |
||||
if (selectByDeparmentName != null && selectByDeparmentName.size() > 0) { |
||||
mobilePhone = ((Department)selectByDeparmentName.get(0)).getId(); |
||||
} |
||||
|
||||
if (!StringUtils.hasText(userNumber)) { |
||||
userNumber = this.numberBuilderService.getUserNumber(); |
||||
this.numberBuilderService.updateNumber("user_code"); |
||||
} |
||||
|
||||
user.setId(IdGenerator.uuid32()); |
||||
user.setUserId(userId); |
||||
user.setUserName(userName); |
||||
user.setPassword(EncryptUtil.md5("11AAaa")); |
||||
user.setDepartId(mobilePhone); |
||||
user.setUserCreationTime(DateUtils.getDate()); |
||||
user.setUserPwdModifTime(DateUtils.getDate("yyyy-MM-dd HH:mm")); |
||||
user.setUserStatus(0L); |
||||
user.setUserLock(0L); |
||||
user.setUserPwdError(0L); |
||||
user.setUserPwdErrorDate(DateUtils.getDate()); |
||||
user.setPost(post); |
||||
user.setEmail(officeTelephone); |
||||
user.setOfficeTelephone(officeTelephone); |
||||
user.setUserNumber(userNumber); |
||||
user.setIdCard(idCard); |
||||
user.setMobilePhone(regEx); |
||||
user.setSex(sexLong); |
||||
user.setHomePhone(homePhone); |
||||
user.setLogout(0L); |
||||
userNames = userNames + userName + ","; |
||||
user.setSort(String.valueOf(Long.parseLong(DateUtils.getDateTimeInt()) + (long)i)); |
||||
user.setIsSys("0"); |
||||
userService.insert(user); |
||||
++inserted; |
||||
} |
||||
|
||||
if (!"".equals(userNames) && null != userNames) { |
||||
//todo 登录人的用户名 userName
|
||||
// String comments = sUserName + "新增了用户" + userNames.substring(0, userNames.length() - 1);
|
||||
String comments = "新增了用户" + userNames.substring(0, userNames.length() - 1); |
||||
String logName = "批量添加人员"; |
||||
String logNameType = "用户列表"; |
||||
auditLog.setLogName(logName); |
||||
auditLog.setLogNameType(logNameType); |
||||
auditLog.setComments(comments); |
||||
auditLogService.addAuditLog(auditLog); |
||||
//todo 添加MESSAGE_TABLE表
|
||||
//String numCode = (String)request.getSession().getAttribute("customCode");
|
||||
//if (numCode != null && numCode.equals("tianjin712suo")) {
|
||||
// User safeUser = userService.selectUserByUserId("safesecret");
|
||||
// /**
|
||||
// * @Description:新增发送人ID及消息简短描述
|
||||
// * Modify Name:WangChenyu
|
||||
// * Modify DateTime:2022年10月25日
|
||||
// */
|
||||
// String loginUserId = (String)request.getSession().getAttribute("user_id");
|
||||
// this.messageService.insertMessage("批量用户添加", "批量添加" + inserted + "个用户", "用户管理", null,
|
||||
// loginUserId, safeUser.getId(), "", "0", "K");
|
||||
//}
|
||||
} |
||||
|
||||
return "操作成功,添加" + inserted + "条数据," + skip + "条数据未添加成功"; |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.keyware.htey.utli; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
import com.keyware.htey.entity.user.User; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.utli |
||||
* @date 2025/1/13 17:15 |
||||
*/ |
||||
public class IdComposeListUtil { |
||||
public static List<String> listId(List<User> userList) { |
||||
String userIds = stringId(userList); |
||||
return Arrays.asList(userIds.split(",")); |
||||
} |
||||
public static String stringId(List<User> userList) { |
||||
return userList.stream() |
||||
.map(User::getId) |
||||
.map(String::valueOf) // 将ID转换为字符串
|
||||
.collect(Collectors.joining(", ")); // 使用逗号分隔
|
||||
} |
||||
} |
@ -0,0 +1,63 @@ |
||||
package com.keyware.htey.utli; |
||||
|
||||
import java.security.SecureRandom; |
||||
import java.util.UUID; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.utli |
||||
* @date 2025/1/13 14:56 |
||||
*/ |
||||
public class IdGenerator { |
||||
private static SecureRandom random = new SecureRandom(); |
||||
private static String[] BASE_CHARACTER = new String[] {"2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", |
||||
"E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; |
||||
|
||||
public IdGenerator() { |
||||
} |
||||
|
||||
public static String uuid32() { |
||||
return UUID.randomUUID().toString().replaceAll("-", ""); |
||||
} |
||||
|
||||
public static String uuid36() { |
||||
return UUID.randomUUID().toString(); |
||||
} |
||||
|
||||
public static long randomLong() { |
||||
return Math.abs(random.nextLong()); |
||||
} |
||||
|
||||
public static String random12Str() { |
||||
StringBuilder sb = new StringBuilder(); |
||||
|
||||
for (int i = 0; i < 12; ++i) { |
||||
sb.append(BASE_CHARACTER[(int)(32.0 * Math.random())]); |
||||
} |
||||
|
||||
return sb.toString(); |
||||
} |
||||
|
||||
public static String random10Str() { |
||||
char[] ss = new char[10]; |
||||
|
||||
for (int i = 0; i < 10; ++i) { |
||||
int f = (int)(Math.random() * 3.0); |
||||
if (f == 0) { |
||||
ss[i] = (char)((int)(65.0 + Math.random() * 26.0)); |
||||
} else if (f == 1) { |
||||
ss[i] = (char)((int)(97.0 + Math.random() * 26.0)); |
||||
} else { |
||||
ss[i] = (char)((int)(48.0 + Math.random() * 10.0)); |
||||
} |
||||
} |
||||
|
||||
String is = new String(ss); |
||||
return is; |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
System.out.println(uuid32() + "11"); |
||||
} |
||||
} |
@ -0,0 +1,25 @@ |
||||
package com.keyware.htey.utli; |
||||
|
||||
import java.net.InetAddress; |
||||
|
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.utli |
||||
* @date 2025/1/13 13:56 |
||||
*/ |
||||
@Slf4j |
||||
public class IpUtil { |
||||
public static String getLocalIP() { |
||||
try { |
||||
InetAddress inetAddress = InetAddress.getLocalHost(); |
||||
return inetAddress.getHostAddress(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return ""; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,135 @@ |
||||
package com.keyware.htey.utli; |
||||
|
||||
import java.lang.reflect.Type; |
||||
import java.util.Collection; |
||||
import java.util.Enumeration; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
|
||||
import com.google.gson.Gson; |
||||
import com.google.gson.GsonBuilder; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang.StringUtils; |
||||
|
||||
/** |
||||
* @author daijj8 |
||||
* @version V1.0 |
||||
* @Package com.keyware.htey.utli |
||||
* @date 2025/1/13 15:29 |
||||
*/ |
||||
@Slf4j |
||||
public class JsonUtils { |
||||
|
||||
public static final String EMPTY = ""; |
||||
public static final String EMPTY_JSON = "{}"; |
||||
public static final String EMPTY_JSON_ARRAY = "[]"; |
||||
public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd HH:mm:ss"; |
||||
public static final Double SINCE_VERSION_10 = 1.0; |
||||
public static final Double SINCE_VERSION_11 = 1.1; |
||||
public static final Double SINCE_VERSION_12 = 1.2; |
||||
|
||||
public JsonUtils() { |
||||
} |
||||
|
||||
public static String arrayListToJsonString(List menusParent) { |
||||
JSONArray jsonArray = new JSONArray(menusParent); |
||||
return jsonArray.toJSONString(); |
||||
} |
||||
|
||||
public static String objectToJsonString(Object obj) { |
||||
return JSON.toJSON(obj).toString(); |
||||
} |
||||
|
||||
public static Object jsonStringToObject(String jsonString, Class clazz) { |
||||
return JSONObject.parseObject(jsonString, clazz); |
||||
} |
||||
|
||||
public static List jsonStringToList(String jsonString, Class clazz) { |
||||
return JSON.parseArray(jsonString, clazz); |
||||
} |
||||
|
||||
public static <T> String listToJson(List<T> list) { |
||||
Gson gson = (new GsonBuilder()).setDateFormat("yyyy-MM-dd HH:mm:ss").create(); |
||||
return gson.toJson(list); |
||||
} |
||||
|
||||
public static String toJson(Object target) { |
||||
return toJson(target, (Type)null, false, (Double)null, (String)null, false); |
||||
} |
||||
|
||||
public static String toJson(Object target, Type targetType, boolean isSerializeNulls, Double version, |
||||
String datePattern, boolean excludesFieldsWithoutExpose) { |
||||
if (target == null) { |
||||
return "{}"; |
||||
} else { |
||||
GsonBuilder builder = new GsonBuilder(); |
||||
builder.disableHtmlEscaping(); |
||||
if (isSerializeNulls) { |
||||
builder.serializeNulls(); |
||||
} |
||||
|
||||
if (version != null) { |
||||
builder.setVersion(version); |
||||
} |
||||
|
||||
if (StringUtils.isEmpty(datePattern)) { |
||||
datePattern = "yyyy-MM-dd HH:mm:ss"; |
||||
} |
||||
|
||||
builder.setDateFormat(datePattern); |
||||
if (excludesFieldsWithoutExpose) { |
||||
builder.excludeFieldsWithoutExposeAnnotation(); |
||||
} |
||||
|
||||
String result = ""; |
||||
Gson gson = builder.create(); |
||||
|
||||
try { |
||||
if (targetType != null) { |
||||
result = gson.toJson(target, targetType); |
||||
} else { |
||||
result = gson.toJson(target); |
||||
} |
||||
} catch (Exception var10) { |
||||
log.error("操作失败", var10); |
||||
if (!(target instanceof Collection) && !(target instanceof Iterator) && !(target instanceof Enumeration) |
||||
&& !target.getClass().isArray()) { |
||||
result = "{}"; |
||||
} else { |
||||
result = "[]"; |
||||
} |
||||
} |
||||
|
||||
return result; |
||||
} |
||||
} |
||||
|
||||
public static <T> T fromJson(String json, Class<T> clazz) { |
||||
return fromJson(json, clazz, (String)null); |
||||
} |
||||
|
||||
public static <T> T fromJson(String json, Class<T> clazz, String datePattern) { |
||||
if (StringUtils.isEmpty(json)) { |
||||
return null; |
||||
} else { |
||||
GsonBuilder builder = new GsonBuilder(); |
||||
if (StringUtils.isEmpty(datePattern)) { |
||||
datePattern = "yyyy-MM-dd HH:mm:ss"; |
||||
} |
||||
|
||||
builder.setDateFormat(datePattern); |
||||
Gson gson = builder.create(); |
||||
|
||||
try { |
||||
return gson.fromJson(json, clazz); |
||||
} catch (Exception var6) { |
||||
log.error("操作失败", var6); |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
<?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.keyware.htey.mybatis.itf.AuditLogMapper"> |
||||
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.user.AuditLog"> |
||||
<id column="ID" property="id" jdbcType="VARCHAR"/> |
||||
<result column="LOG_NAME" property="logName" jdbcType="VARCHAR"/> |
||||
<result column="LOG_NAME_TYPE" property="logNameType" jdbcType="VARCHAR"/> |
||||
<result column="USER_NAME" property="userName" jdbcType="VARCHAR"/> |
||||
<result column="DEPT_NAME" property="deptName" jdbcType="VARCHAR"/> |
||||
<result column="IP_ADDRESS" property="ipAddress" jdbcType="VARCHAR"/> |
||||
<result column="OPER_TIME" property="operTime" jdbcType="VARCHAR"/> |
||||
<result column="COMMENTS" property="comments" jdbcType="VARCHAR"/> |
||||
<result column="USER_ID" property="userId" jdbcType="VARCHAR"/> |
||||
<result column="PROJECT_SOURCE" property="projectSource" jdbcType="VARCHAR"/> |
||||
<result column="STATUS" property="status" jdbcType="VARCHAR"/> |
||||
</resultMap> |
||||
|
||||
</mapper> |
@ -0,0 +1,42 @@ |
||||
<?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.keyware.htey.mybatis.itf.DepartmentMapper"> |
||||
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.department.Department"> |
||||
<id column="ID" property="id" jdbcType="VARCHAR"/> |
||||
<result column="DEPT_NAME" property="deptName" jdbcType="VARCHAR"/> |
||||
<result column="PARENT_ID" property="parentId" jdbcType="VARCHAR"/> |
||||
<result column="ORDER_NO" property="orderNo" jdbcType="INTEGER"/> |
||||
<result column="COMMENTS" property="comments" jdbcType="VARCHAR"/> |
||||
<result column="DEPT_CREATE_TIME" property="deptCreateTime" jdbcType="VARCHAR"/> |
||||
<result column="DEPT_NUMBER" property="deptNumber" jdbcType="VARCHAR"/> |
||||
<result column="MANAGER" property="manager" jdbcType="VARCHAR"/> |
||||
<result column="TOTAL_WORKERS" property="totalWorkers" jdbcType="INTEGER"/> |
||||
<result column="SUPER_LEADER" property="superLeader" jdbcType="VARCHAR"/> |
||||
<result column="INTERFACE_PERSON" property="interfacePerson" jdbcType="VARCHAR"/> |
||||
<result column="DEPART_ABBREVIA" property="departAbbrevia" jdbcType="VARCHAR"/> |
||||
<result column="CHARGE" property="charge" jdbcType="VARCHAR"/> |
||||
<result column="IS_SYS" property="isSys" jdbcType="VARCHAR"/> |
||||
<result column="PROJECT_SOURCE" property="projectSource" jdbcType="VARCHAR"/> |
||||
</resultMap> |
||||
|
||||
<sql id="Base_Column_List"> |
||||
ID |
||||
, DEPT_NAME, PARENT_ID, ORDER_NO, COMMENTS, DEPT_CREATE_TIME, DEPT_NUMBER, MANAGER, |
||||
TOTAL_WORKERS, SUPER_LEADER, INTERFACE_PERSON, DEPART_ABBREVIA, CHARGE, IS_SYS, PROJECT_SOURCE |
||||
</sql> |
||||
|
||||
<select id="selectByDeparmentName" parameterType="java.lang.String" resultMap="BaseResultMap"> |
||||
select |
||||
<include refid="Base_Column_List"/> |
||||
from DEPARTMENT |
||||
where DEPT_NAME = #{deptName,jdbcType=VARCHAR} |
||||
</select> |
||||
|
||||
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> |
||||
select |
||||
<include refid="Base_Column_List"/> |
||||
from DEPARTMENT |
||||
where ID = #{id,jdbcType=VARCHAR} |
||||
</select> |
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
<?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.keyware.htey.mybatis.itf.OFourColumMapper"> |
||||
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.organizeassets.OFourColum"> |
||||
<id column="ID" property="id" jdbcType="VARCHAR"/> |
||||
<result column="NAME" property="name" jdbcType="VARCHAR"/> |
||||
<result column="CODE" property="code" jdbcType="VARCHAR"/> |
||||
<result column="DESCRIBE" property="describe" jdbcType="VARCHAR"/> |
||||
<result column="PARENT_ID" property="parentId" jdbcType="VARCHAR"/> |
||||
<result column="SEQ" property="seq" jdbcType="INTEGER"/> |
||||
<result column="IS_DEFAULT" property="formLevel" jdbcType="VARCHAR"/> |
||||
<result column="FORM_LEVEL" property="isDefault" jdbcType="VARCHAR"/> |
||||
</resultMap> |
||||
</mapper> |
@ -0,0 +1,381 @@ |
||||
<?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.keyware.htey.mybatis.itf.UserMapper"> |
||||
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.user.User"> |
||||
<id column="ID" property="id" jdbcType="VARCHAR"/> |
||||
<result column="USER_ID" property="userId" jdbcType="VARCHAR"/> |
||||
<result column="USER_NAME" property="userName" jdbcType="VARCHAR"/> |
||||
<result column="PASSWORD" property="password" jdbcType="VARCHAR"/> |
||||
<result column="DEPART_ID" property="departId" jdbcType="VARCHAR"/> |
||||
<result column="USER_CREATION_TIME" property="userCreationTime" jdbcType="VARCHAR"/> |
||||
<result column="USER_PWD_MODIF_TIME" property="userPwdModifTime" jdbcType="VARCHAR"/> |
||||
<result column="USER_STATUS" property="userStatus" jdbcType="DECIMAL"/> |
||||
<result column="USER_LOCK" property="userLock" jdbcType="DECIMAL"/> |
||||
<result column="USER_PWD_ERROR" property="userPwdError" jdbcType="DECIMAL"/> |
||||
<result column="USER_PWD_ERROR_DATE" property="userPwdErrorDate" jdbcType="VARCHAR"/> |
||||
<result column="EXIT_TIME" jdbcType="VARCHAR" property="exitTime"/> |
||||
<result column="PASSWORD_OLD" jdbcType="VARCHAR" property="passwordOld"/> |
||||
<result column="POST" property="post" jdbcType="VARCHAR"/> |
||||
<result column="EMAIL" property="email" jdbcType="VARCHAR"/> |
||||
<result column="OFFICE_TELEPHONE" property="officeTelephone" jdbcType="VARCHAR"/> |
||||
<result column="USER_NUMBER" property="userNumber" jdbcType="VARCHAR"/> |
||||
<result column="ID_CARD" property="idCard" jdbcType="VARCHAR"/> |
||||
<result column="MOBILE_PHONE" property="mobilePhone" jdbcType="VARCHAR"/> |
||||
<result column="SEX" property="sex" jdbcType="DECIMAL"/> |
||||
<result column="HOME_PHONE" property="homePhone" jdbcType="VARCHAR"/> |
||||
<result column="LOGOUT" property="logout" jdbcType="DECIMAL"/> |
||||
<result column="INIT_PWD_TIME" property="initPwdTime" jdbcType="VARCHAR"/> |
||||
<result column="SORT" property="sort" jdbcType="VARCHAR"/> |
||||
<result column="LOGOUT_TIME" property="logoutTime" jdbcType="VARCHAR"/> |
||||
<result column="DEPT_NAME" property="deptName" jdbcType="VARCHAR"/> |
||||
<result column="UESR_RANK_ID" property="uesrRankId" jdbcType="VARCHAR"/> |
||||
<result column="secret" property="secret" jdbcType="VARCHAR"/> |
||||
</resultMap> |
||||
|
||||
<sql id="Base_Column_List"> |
||||
ID |
||||
, USER_ID, USER_NAME, PASSWORD, DEPART_ID, USER_CREATION_TIME, USER_PWD_MODIF_TIME, |
||||
USER_STATUS, USER_LOCK, USER_PWD_ERROR, USER_PWD_ERROR_DATE, EXIT_TIME, PASSWORD_OLD, |
||||
POST, EMAIL, OFFICE_TELEPHONE, USER_NUMBER, ID_CARD, MOBILE_PHONE, SEX, HOME_PHONE, |
||||
LOGOUT, INIT_PWD_TIME, SORT, IS_SYS, LOGOUT_TIME, PROJECT_SOURCE, UESR_RANK_ID,IMG_DATA |
||||
</sql> |
||||
|
||||
<select id="selectByUserInfo17suo" resultType="com.keyware.htey.entity.user.User" |
||||
parameterType="com.keyware.htey.entity.user.User"> |
||||
select |
||||
K_USER.ID, |
||||
K_USER.USER_ID, |
||||
K_USER.USER_NAME, |
||||
K_USER.PASSWORD, |
||||
K_USER.DEPART_ID, |
||||
K_USER.USER_CREATION_TIME, |
||||
K_USER.USER_PWD_MODIF_TIME, |
||||
K_USER.USER_STATUS, |
||||
K_USER.USER_LOCK, |
||||
K_USER.USER_PWD_ERROR, |
||||
K_USER.USER_PWD_ERROR_DATE, |
||||
K_USER.EXIT_TIME, |
||||
K_USER.PASSWORD_OLD, |
||||
K_USER.POST, |
||||
K_USER.EMAIL, |
||||
K_USER.OFFICE_TELEPHONE, |
||||
K_USER.USER_NUMBER, |
||||
K_USER.ID_CARD, |
||||
K_USER.MOBILE_PHONE, |
||||
K_USER.SEX, |
||||
K_USER.HOME_PHONE, |
||||
K_USER.LOGOUT, |
||||
K_USER.INIT_PWD_TIME, |
||||
K_USER.SORT , |
||||
K_USER.LOGOUT_TIME, |
||||
K_USER.UESR_RANK_ID, |
||||
DEPARTMENT.DEPT_NAME, |
||||
USERSECRET.SECRET |
||||
from K_USER |
||||
left join DEPARTMENT on K_USER.DEPART_ID = DEPARTMENT.ID |
||||
left join USERSECRET on K_USER.ID = USERSECRET.ID |
||||
where K_USER.LOGOUT != '1' |
||||
and K_USER.PROJECT_SOURCE = #{user.projectSource,jdbcType=VARCHAR} |
||||
<if test="user.flag != null"> |
||||
and K_USER.USER_ID != 'safesecret' |
||||
and K_USER.USER_ID != 'safeaudit' |
||||
and K_USER.USER_ID != 'admin' |
||||
</if> |
||||
<if test="user.id != null"> |
||||
and K_USER.ID = #{user.id,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="user.userId != null"> |
||||
and K_USER.USER_ID = #{user.userId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="user.isSys != 'sysadmin'"> |
||||
and K_USER.IS_SYS = '0' |
||||
</if> |
||||
<if test="user.userNameForSerch != null"> |
||||
and (K_USER.USER_NAME like '%'||#{user.userNameForSerch,jdbcType=VARCHAR}||'%' ) |
||||
</if> |
||||
<if test="user.departId != null and user.departId != ''"> |
||||
and K_USER.DEPART_ID=#{user.departId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="user.post != null and post != ''"> |
||||
and K_USER.POST=#{user.post,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="user.userStatus == null"> |
||||
and K_USER.USER_STATUS = '0' |
||||
</if> |
||||
<if test="user.userNumber != null and user.userNumber != ''"> |
||||
and K_USER.USER_NUMBER = #{user.userNumber,jdbcType=VARCHAR} |
||||
</if> |
||||
order by SORT asc |
||||
</select> |
||||
|
||||
<update id="updateByPrimaryKey" parameterType="com.keyware.htey.entity.user.User"> |
||||
update K_USER |
||||
<set> |
||||
<if test="userId!=null">USER_ID = #{userId,jdbcType=VARCHAR},</if> |
||||
<if test="userName!=null">USER_NAME = #{userName,jdbcType=VARCHAR},</if> |
||||
<if test="password!=null">PASSWORD = #{password,jdbcType=VARCHAR},</if> |
||||
<if test="departId!=null">DEPART_ID = #{departId,jdbcType=VARCHAR},</if> |
||||
<if test="userCreationTime!=null">USER_CREATION_TIME = #{userCreationTime,jdbcType=VARCHAR},</if> |
||||
<if test="userPwdModifTime!=null">USER_PWD_MODIF_TIME = #{userPwdModifTime,jdbcType=VARCHAR},</if> |
||||
<if test="userStatus!=null">USER_STATUS= #{userStatus,jdbcType=INTEGER},</if> |
||||
<if test="userLock!=null">USER_LOCK= #{userLock,jdbcType=INTEGER},</if> |
||||
<if test="userPwdError!=null">USER_PWD_ERROR = #{userPwdError,jdbcType=INTEGER},</if> |
||||
<if test="userPwdErrorDate!=null">USER_PWD_ERROR_DATE = #{userPwdErrorDate,jdbcType=VARCHAR},</if> |
||||
<if test="exitTime!=null">EXIT_TIME = #{exitTime,jdbcType=VARCHAR},</if> |
||||
<if test="passwordOld!=null">PASSWORD_OLD = #{passwordOld,jdbcType=VARCHAR},</if> |
||||
<if test="post!=null">POST = #{post,jdbcType=VARCHAR},</if> |
||||
<if test="email!=null">EMAIL = #{email,jdbcType=VARCHAR},</if> |
||||
<if test="officeTelephone!=null">OFFICE_TELEPHONE = #{officeTelephone,jdbcType=VARCHAR},</if> |
||||
<if test="userNumber!=null">USER_NUMBER = #{userNumber,jdbcType=VARCHAR},</if> |
||||
<if test="idCard!=null">ID_CARD = #{idCard,jdbcType=VARCHAR},</if> |
||||
<if test="mobilePhone!=null">MOBILE_PHONE = #{mobilePhone,jdbcType=VARCHAR},</if> |
||||
<if test="sex!=null">SEX = #{sex,jdbcType=DECIMAL},</if> |
||||
<if test="homePhone!=null">HOME_PHONE = #{homePhone,jdbcType=VARCHAR},</if> |
||||
<if test="logout!=null">LOGOUT = #{logout,jdbcType=DECIMAL},</if> |
||||
<if test="initPwdTime!=null">INIT_PWD_TIME = #{initPwdTime,jdbcType=VARCHAR},</if> |
||||
<if test="sort!=null">SORT = #{sort,jdbcType=VARCHAR},</if> |
||||
<if test="logoutTime !=null "> |
||||
LOGOUT_TIME = #{logoutTime,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="uesrRankId != null"> |
||||
UESR_RANK_ID = #{uesrRankId,jdbcType=VARCHAR}, |
||||
</if> |
||||
</set> |
||||
where ID = #{id,jdbcType=VARCHAR} |
||||
</update> |
||||
<update id="unlock" parameterType="com.keyware.htey.entity.user.User"> |
||||
update K_USER |
||||
set USER_LOCK= '0', |
||||
USER_PWD_ERROR = '0', |
||||
USER_PWD_ERROR_DATE = '' |
||||
where ID in |
||||
<foreach item="item" index="index" collection="list" |
||||
open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</update> |
||||
<update id="updateStatus" parameterType="com.keyware.htey.entity.user.User"> |
||||
update K_USER |
||||
set USER_STATUS= #{userStatus,jdbcType=INTEGER} |
||||
where ID = #{id,jdbcType=VARCHAR} |
||||
</update> |
||||
<select id="selectByUserId" resultMap="BaseResultMap" parameterType="java.lang.String"> |
||||
select |
||||
<include refid="Base_Column_List"/> |
||||
from K_USER |
||||
where USER_ID= #{userId,jdbcType=VARCHAR} |
||||
and PROJECT_SOURCE = #{projectSource} |
||||
</select> |
||||
|
||||
<select id="selectByUserNumber" parameterType="java.lang.String" resultMap="BaseResultMap"> |
||||
select |
||||
<include refid="Base_Column_List"/> |
||||
from K_USER |
||||
where USER_NUMBER = #{userNumber,jdbcType=VARCHAR} |
||||
and PROJECT_SOURCE = #{projectSource} |
||||
</select> |
||||
<select id="selectAll" resultMap="BaseResultMap" parameterType="java.lang.String"> |
||||
select ID, USER_ID, USER_NAME, |
||||
PASSWORD, DEPART_ID, USER_CREATION_TIME, |
||||
USER_PWD_MODIF_TIME, USER_STATUS, USER_LOCK, |
||||
USER_PWD_ERROR, USER_PWD_ERROR_DATE,EXIT_TIME,PASSWORD_OLD, |
||||
POST, EMAIL, OFFICE_TELEPHONE, USER_NUMBER, ID_CARD, MOBILE_PHONE, SEX, HOME_PHONE,LOGOUT,INIT_PWD_TIME,SORT |
||||
from K_USER where LOGOUT != '1' |
||||
and PROJECT_SOURCE = #{projectSource,jdbcType=VARCHAR} |
||||
<if test="userId != 'sysadmin'"> |
||||
and IS_SYS = '0' |
||||
</if> |
||||
order by SORT asc |
||||
</select> |
||||
<insert id="insertSelective" parameterType="com.keyware.htey.entity.user.User"> |
||||
insert into K_USER |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
ID, |
||||
</if> |
||||
<if test="userId != null"> |
||||
USER_ID, |
||||
</if> |
||||
<if test="userName != null"> |
||||
USER_NAME, |
||||
</if> |
||||
<if test="password != null"> |
||||
PASSWORD, |
||||
</if> |
||||
<if test="departId != null"> |
||||
DEPART_ID, |
||||
</if> |
||||
<if test="userCreationTime != null"> |
||||
USER_CREATION_TIME, |
||||
</if> |
||||
<if test="userPwdModifTime != null"> |
||||
USER_PWD_MODIF_TIME, |
||||
</if> |
||||
<if test="userStatus != null"> |
||||
USER_STATUS, |
||||
</if> |
||||
<if test="userLock != null"> |
||||
USER_LOCK, |
||||
</if> |
||||
<if test="userPwdError != null"> |
||||
USER_PWD_ERROR, |
||||
</if> |
||||
<if test="userPwdErrorDate != null"> |
||||
USER_PWD_ERROR_DATE, |
||||
</if> |
||||
<if test="exitTime != null"> |
||||
EXIT_TIME, |
||||
</if> |
||||
<if test="passwordOld != null"> |
||||
PASSWORD_OLD, |
||||
</if> |
||||
<if test="post != null"> |
||||
POST, |
||||
</if> |
||||
<if test="email != null"> |
||||
EMAIL, |
||||
</if> |
||||
<if test="officeTelephone != null"> |
||||
OFFICE_TELEPHONE, |
||||
</if> |
||||
<if test="userNumber != null"> |
||||
USER_NUMBER, |
||||
</if> |
||||
<if test="idCard != null"> |
||||
ID_CARD, |
||||
</if> |
||||
<if test="mobilePhone != null"> |
||||
MOBILE_PHONE, |
||||
</if> |
||||
<if test="sex != null"> |
||||
SEX, |
||||
</if> |
||||
<if test="homePhone != null"> |
||||
HOME_PHONE, |
||||
</if> |
||||
<if test="logout != null"> |
||||
LOGOUT, |
||||
</if> |
||||
<if test="initPwdTime != null"> |
||||
INIT_PWD_TIME, |
||||
</if> |
||||
<if test="sort != null"> |
||||
SORT, |
||||
</if> |
||||
<if test="isSys != null"> |
||||
IS_SYS, |
||||
</if> |
||||
<if test="logoutTime != null"> |
||||
LOGOUT_TIME, |
||||
</if> |
||||
<if test="projectSource != null"> |
||||
PROJECT_SOURCE, |
||||
</if> |
||||
<if test="uesrRankId != null"> |
||||
UESR_RANK_ID, |
||||
</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
#{id,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="userId != null"> |
||||
#{userId,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="userName != null"> |
||||
#{userName,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="password != null"> |
||||
#{password,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="departId != null"> |
||||
#{departId,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="userCreationTime != null"> |
||||
#{userCreationTime,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="userPwdModifTime != null"> |
||||
#{userPwdModifTime,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="userStatus != null"> |
||||
#{userStatus,jdbcType=DECIMAL}, |
||||
</if> |
||||
<if test="userLock != null"> |
||||
#{userLock,jdbcType=DECIMAL}, |
||||
</if> |
||||
<if test="userPwdError != null"> |
||||
#{userPwdError,jdbcType=DECIMAL}, |
||||
</if> |
||||
<if test="userPwdErrorDate != null"> |
||||
#{userPwdErrorDate,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="exitTime != null"> |
||||
#{exitTime,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="passwordOld != null"> |
||||
#{passwordOld,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="post != null"> |
||||
#{post,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="email != null"> |
||||
#{email,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="officeTelephone != null"> |
||||
#{officeTelephone,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="userNumber != null"> |
||||
#{userNumber,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="idCard != null"> |
||||
#{idCard,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="mobilePhone != null"> |
||||
#{mobilePhone,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="sex != null"> |
||||
#{sex,jdbcType=DECIMAL}, |
||||
</if> |
||||
<if test="homePhone != null"> |
||||
#{homePhone,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="logout != null"> |
||||
#{logout,jdbcType=DECIMAL}, |
||||
</if> |
||||
<if test="initPwdTime != null"> |
||||
#{initPwdTime,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="sort != null"> |
||||
#{sort,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="isSys != null"> |
||||
#{isSys,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="logoutTime != null"> |
||||
#{logoutTime,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="projectSource != null"> |
||||
#{projectSource,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="uesrRankId != null"> |
||||
#{uesrRankId,jdbcType=VARCHAR}, |
||||
</if> |
||||
</trim> |
||||
</insert> |
||||
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> |
||||
select |
||||
<include refid="Base_Column_List"/> |
||||
from K_USER |
||||
where ID = #{id,jdbcType=VARCHAR} |
||||
</select> |
||||
<update id="recovery" parameterType="com.keyware.htey.entity.user.User"> |
||||
update K_USER |
||||
set LOGOUT='0' ,LOGOUT_TIME = null |
||||
where ID in |
||||
<foreach item="item" index="index" collection="list" |
||||
open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</update> |
||||
</mapper> |
@ -0,0 +1,12 @@ |
||||
<?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.keyware.htey.mybatis.itf.UsersecretMapper"> |
||||
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.usersecret.Usersecret"> |
||||
<id column="ID" property="id" jdbcType="VARCHAR"/> |
||||
<result column="SECRET" property="secret" jdbcType="VARCHAR"/> |
||||
</resultMap> |
||||
<insert id="insertSelective" parameterType="com.keyware.htey.entity.usersecret.Usersecret"> |
||||
insert into USERSECRET (ID, SECRET) |
||||
values (#{id,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR}) |
||||
</insert> |
||||
</mapper> |
@ -0,0 +1,46 @@ |
||||
<?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.keyware.htey.mybatis.itf.number.NumberBuilderMapper"> |
||||
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.number.NumberBuilder"> |
||||
<id column="NUMBER_ID" property="numberId" jdbcType="VARCHAR"/> |
||||
<result column="NUMBER_" property="number" jdbcType="VARCHAR"/> |
||||
</resultMap> |
||||
<sql id="Base_Column_List"> |
||||
NUMBER_ID |
||||
, NUMBER_ |
||||
</sql> |
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> |
||||
select |
||||
<include refid="Base_Column_List"/> |
||||
from NUMBER_BUILDER |
||||
where NUMBER_ID = #{numberId,jdbcType=VARCHAR} |
||||
</select> |
||||
<insert id="insertSelective" parameterType="com.keyware.htey.entity.number.NumberBuilder"> |
||||
insert into NUMBER_BUILDER |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<if test="numberId != null"> |
||||
NUMBER_ID, |
||||
</if> |
||||
<if test="number != null"> |
||||
NUMBER_, |
||||
</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="numberId != null"> |
||||
#{numberId,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="number != null"> |
||||
#{number,jdbcType=VARCHAR}, |
||||
</if> |
||||
</trim> |
||||
</insert> |
||||
<update id="updateByPrimaryKeySelective" parameterType="com.keyware.htey.entity.number.NumberBuilder"> |
||||
update NUMBER_BUILDER |
||||
<set> |
||||
<if test="number != null"> |
||||
NUMBER_ = #{number,jdbcType=VARCHAR}, |
||||
</if> |
||||
</set> |
||||
where NUMBER_ID = #{numberId,jdbcType=VARCHAR} |
||||
</update> |
||||
</mapper> |
Loading…
Reference in new issue