| | |
| | | **/spy.log |
| | | */.DS_Store |
| | | /.txlcn/ |
| | | /febs-server/febs-server-hr/Users/work/mavenRepository/ |
| | | /febs-cloud/Users/work/mavenRepository/ |
| | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | |
| | | <resources> |
| | | <resource> |
| | | <directory>src/main/java</directory> |
| | | <includes> |
| | | <include>**/*.xml</include> |
| | | </includes> |
| | | <filtering>false</filtering> |
| | | </resource> |
| | | </resources> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.controller; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.server.hr.entity.Label; |
| | | import cc.mrbird.febs.server.hr.service.ILabelService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 标签 Controller |
| | | * |
| | | * @author yz |
| | | * @date 2021-02-17 22:18:51 |
| | | */ |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequestMapping("label") |
| | | @RequiredArgsConstructor |
| | | public class LabelController { |
| | | |
| | | private final ILabelService labelService; |
| | | |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('label:list')") |
| | | public FebsResponse getAllLabels(Label label) { |
| | | return new FebsResponse().data(labelService.findLabels(label)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('label:list')") |
| | | public FebsResponse labelList(QueryRequest request, Label label) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.labelService.findLabels(request, label)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('label:add')") |
| | | public void addLabel(@Valid Label label) throws FebsException { |
| | | try { |
| | | this.labelService.createLabel(label); |
| | | } catch (Exception e) { |
| | | String message = "新增Label失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('label:delete')") |
| | | public void deleteLabel(Label label) throws FebsException { |
| | | try { |
| | | this.labelService.deleteLabel(label); |
| | | } catch (Exception e) { |
| | | String message = "删除Label失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('label:update')") |
| | | public void updateLabel(Label label) throws FebsException { |
| | | try { |
| | | this.labelService.updateLabel(label); |
| | | } catch (Exception e) { |
| | | String message = "修改Label失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | @TableField("empId") |
| | | private Long empid; |
| | | /** |
| | | * 文件存储地址 |
| | | */ |
| | | @TableField("filesAddress") |
| | | private String filesaddress; |
| | | |
| | | /** |
| | | * 工伤数量 |
| | | * 文件格式 |
| | | */ |
| | | @TableField("lz") |
| | | private Integer lz; |
| | | @TableField("filesFormat") |
| | | private String filesformat; |
| | | |
| | | /** |
| | | * 劳资数量 |
| | | * 文件名称 |
| | | */ |
| | | @TableField("gz") |
| | | private Integer gz; |
| | | @TableField("filesName") |
| | | private String filesname; |
| | | |
| | | /** |
| | | * 回执数量 |
| | | * 文件夹ID |
| | | */ |
| | | @TableField("hz") |
| | | private Integer hz; |
| | | @TableField("labelId") |
| | | private Long labelid; |
| | | |
| | | /** |
| | | * 截图记录数量 |
| | | */ |
| | | @TableField("jljt") |
| | | private Integer jljt; |
| | | |
| | | /** |
| | | * 劳动合同数量 |
| | | */ |
| | | @TableField("ldht") |
| | | private Integer ldht; |
| | | |
| | | /** |
| | | * 离职手续数量 |
| | | */ |
| | | @TableField("lzsx") |
| | | private Integer lzsx; |
| | | |
| | | /** |
| | | * 记录最后更新人 |
| | | */ |
| | | @TableField("modifier") |
| | | private String modifier; |
| | | |
| | | /** |
| | | * 记录最后更新时间 |
| | | */ |
| | | @TableField("modifyTime") |
| | | private Date modifytime; |
| | | |
| | | /** |
| | | * 请假数量 |
| | | */ |
| | | @TableField("qj") |
| | | private Integer qj; |
| | | |
| | | /** |
| | | * 入职表数量 |
| | | */ |
| | | @TableField("rzb") |
| | | private Integer rzb; |
| | | |
| | | /** |
| | | * 社保数量 |
| | | */ |
| | | @TableField("sb") |
| | | private Integer sb; |
| | | |
| | | /** |
| | | * 身份证数量 |
| | | */ |
| | | @TableField("sfz") |
| | | private Integer sfz; |
| | | |
| | | /** |
| | | * 失业金数量 |
| | | */ |
| | | @TableField("syj") |
| | | private Integer syj; |
| | | |
| | | /** |
| | | * 记录版本号,用来进行乐观锁控制 |
| | | */ |
| | | @TableField("version") |
| | | private Integer version; |
| | | |
| | | /** |
| | | * 相关合同数量 |
| | | */ |
| | | @TableField("xght") |
| | | private Integer xght; |
| | | |
| | | /** |
| | | * 相关证件数量 |
| | | */ |
| | | @TableField("xgzj") |
| | | private Integer xgzj; |
| | | |
| | | /** |
| | | * 银行卡数量 |
| | | */ |
| | | @TableField("yhk") |
| | | private Integer yhk; |
| | | |
| | | /** |
| | | * 意外险数量 |
| | | */ |
| | | @TableField("ywx") |
| | | private Integer ywx; |
| | | |
| | | /** |
| | | * 自离数量 |
| | | */ |
| | | @TableField("zl") |
| | | private Integer zl; |
| | | |
| | | /** |
| | | * 照片数量 |
| | | */ |
| | | @TableField("zp") |
| | | private Integer zp; |
| | | |
| | | /** |
| | | * 体检表数量 |
| | | */ |
| | | @TableField("tjb") |
| | | private Integer tjb; |
| | | |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.entity; |
| | | |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | /** |
| | | * 标签 Entity |
| | | * |
| | | * @author yz |
| | | * @date 2021-02-17 22:18:51 |
| | | */ |
| | | @Data |
| | | @TableName("t_label") |
| | | public class Label { |
| | | |
| | | /** |
| | | * 记录状态 0-正常 1-删除 2-暂存 |
| | | */ |
| | | @TableField("delFlag") |
| | | private Integer delFlag = 0; |
| | | /** |
| | | * 记录版本号,用来进行乐观锁控制 |
| | | */ |
| | | @TableField("version") |
| | | private Integer version; |
| | | |
| | | /** |
| | | * 记录创建时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createtime; |
| | | |
| | | /** |
| | | * 记录创建人 |
| | | */ |
| | | @TableField("creator") |
| | | private String creator; |
| | | |
| | | /** |
| | | * 记录最后更新时间 |
| | | */ |
| | | @TableField("modifyTime") |
| | | private Date modifytime; |
| | | |
| | | /** |
| | | * 记录最后更新人 |
| | | */ |
| | | @TableField("modifier") |
| | | private String modifier; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(value = "labelId") |
| | | private Long labelid; |
| | | |
| | | /** |
| | | * 标签名称 |
| | | */ |
| | | @TableField("labelName") |
| | | private String labelname; |
| | | /** |
| | | * 标签名称 |
| | | */ |
| | | @TableField("labelCode") |
| | | private String labelcode; |
| | | |
| | | /** |
| | | * 标签显示顺序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | } |
| | |
| | | public interface EmpAccessoryMapper extends BaseMapper<EmpAccessory> { |
| | | |
| | | |
| | | @Select("select * from (select a.empName,a.empId,a.empNumb,a.age,a.archivesStatus,a.sex,a.insuranceType,a.politics,a.education,a.entryDate,a.certificateNumb,(select dept_Name from t_dept as dept where dept.dept_Id= a.deptId) as deptName,a.jobName,b.jljt,b.zp,b.ldht,b.sfz,b.rzb,b.tjb,b.hz,b.yhk,b.xgzj,b.xght,b.qj,b.cf,b.czsq,b.lzsx,b.zl,b.sb,b.syj,b.ywx,b.gs,b.lz from t_emp_baseinfo a left join t_emp_accessory b on a.empId = b.empId where a.delFlag = 0) a ${ew.customSqlSegment}") |
| | | IPage<Map<String,Object>> selectPageVo(Page<?> page, @Param(Constants.WRAPPER) Wrapper wrapper); |
| | | @Select("${sql} ${ew.customSqlSegment}") |
| | | IPage<Map<String,Object>> selectPageVo(Page<?> page, @Param(Constants.WRAPPER) Wrapper wrapper, @Param("sql") String sql); |
| | | |
| | | String getQuerySql(); |
| | | } |
| | |
| | | <?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="cc.mrbird.febs.server.generator.gen.mapper.EmpAccessoryMapper"> |
| | | <mapper namespace="cc.mrbird.febs.server.hr.mapper.EmpAccessoryMapper"> |
| | | |
| | | <select id="getQuerySql" resultType="java.lang.String"> |
| | | select CONCAT('select a.delFlag,a.empName,a.empId,a.empNumb,a.age,a.archivesStatus,a.sex,a.insuranceType,a.politics,a.education,a.entryDate,a.certificateNumb, |
| | | (select dept_Name from t_dept as dept where dept.dept_Id= a.deptId) as deptName,a.jobName,',(SELECT |
| | | GROUP_CONCAT(DISTINCT |
| | | CONCAT( |
| | | '(SELECT COUNT(1) FROM t_emp_accessory accessory inner join t_label label where label.labelId=accessory.labelId and accessory.delFlag = 0 and label.delFlag = 0) AS ''', |
| | | label.labelCode, '''' |
| | | ) |
| | | ) |
| | | FROM t_label label order by label.sort),' from t_emp_baseinfo a') as querySql |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.mapper; |
| | | |
| | | import cc.mrbird.febs.server.hr.entity.Label; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * 标签 Mapper |
| | | * |
| | | * @author yz |
| | | * @date 2021-02-17 22:18:51 |
| | | */ |
| | | public interface LabelMapper extends BaseMapper<Label> { |
| | | |
| | | } |
| New file |
| | |
| | | <?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="cc.mrbird.febs.server.hr.mapper.LabelMapper"> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.service; |
| | | |
| | | |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.server.hr.entity.Label; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 标签 Service接口 |
| | | * |
| | | * @author yz |
| | | * @date 2021-02-17 22:18:51 |
| | | */ |
| | | public interface ILabelService extends IService<Label> { |
| | | /** |
| | | * 查询(分页) |
| | | * |
| | | * @param request QueryRequest |
| | | * @param label label |
| | | * @return IPage<Label> |
| | | */ |
| | | IPage<Label> findLabels(QueryRequest request, Label label); |
| | | |
| | | /** |
| | | * 查询(所有) |
| | | * |
| | | * @param label label |
| | | * @return List<Label> |
| | | */ |
| | | List<Label> findLabels(Label label); |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param label label |
| | | */ |
| | | void createLabel(Label label); |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param label label |
| | | */ |
| | | void updateLabel(Label label); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param label label |
| | | */ |
| | | void deleteLabel(Label label); |
| | | } |
| | |
| | | queryWrapper.eq("a.politics", vo.getPolitics()); |
| | | } |
| | | } |
| | | queryWrapper.eq("a.delFlag",0); |
| | | Page<EmpAccessory> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return empAccessoryMapper.selectPageVo(page, queryWrapper); |
| | | String querySql = empAccessoryMapper.getQuerySql(); |
| | | return empAccessoryMapper.selectPageVo(page, queryWrapper,querySql); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void download(String fileids, HttpServletRequest request, HttpServletResponse response) { |
| | | String[] arr = fileids.split(","); |
| | | List<File> files = new ArrayList<>(); |
| | | List<String> fileName = new ArrayList<>(); |
| | | Arrays.stream(arr).forEach(i -> { |
| | | FilesUpload filesUpload = this.getById(i); |
| | | files.add(new File(properties.getUploadPpath() + filesUpload.getFilesaddress())); |
| | | fileName.add(filesUpload.getFilesname()); |
| | | }); |
| | | //设置压缩包的名字 |
| | | //解决不同浏览器压缩包名字含有中文时乱码的问题 |
| | |
| | | try { |
| | | //添加ZipEntry,并ZipEntry中写入文件流 |
| | | //这里,加上i是防止要下载的文件有重名的导致下载失败 |
| | | zipos.putNextEntry(new ZipEntry(file.getName())); |
| | | zipos.putNextEntry(new ZipEntry(fileName.get(i))); |
| | | os = new DataOutputStream(zipos); |
| | | InputStream is = new FileInputStream(file); |
| | | byte[] b = new byte[100]; |
| | |
| | | folder.setModifier(operatorId); |
| | | folder.setCreatetime(new Date()); |
| | | folder.setModifytime(new Date()); |
| | | folder.setVersion(0); |
| | | this.save(folder); |
| | | } |
| | | |
| | |
| | | public void deleteFolder(Folder folder) { |
| | | LambdaUpdateWrapper<Folder> wapper = new LambdaUpdateWrapper<>(); |
| | | wapper.eq(Folder::getFolderid,folder.getFolderid()).setSql("delFlag = 1"); |
| | | // TODO 设置删除条件 |
| | | this.update(wapper); |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.core.constant.ModuleCode; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.core.utils.SequenceUtil; |
| | | import cc.mrbird.febs.server.hr.entity.Folder; |
| | | import cc.mrbird.febs.server.hr.entity.Label; |
| | | import cc.mrbird.febs.server.hr.mapper.LabelMapper; |
| | | import cc.mrbird.febs.server.hr.service.ILabelService; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.function.Predicate; |
| | | |
| | | /** |
| | | * 标签 Service实现 |
| | | * |
| | | * @author yz |
| | | * @date 2021-02-17 22:18:51 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) |
| | | public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements ILabelService { |
| | | |
| | | private final LabelMapper labelMapper; |
| | | private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser()) |
| | | .map(u -> u.getUserId().toString()) |
| | | .orElse("1"); |
| | | @Override |
| | | public IPage<Label> findLabels(QueryRequest request, Label label) { |
| | | LambdaQueryWrapper<Label> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // TODO 设置查询条件 |
| | | Page<Label> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.page(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Label> findLabels(Label label) { |
| | | LambdaQueryWrapper<Label> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.select(Label::getLabelcode,Label::getLabelname,Label::getLabelid).eq(Label::getDelFlag,0); |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createLabel(Label label) { |
| | | label.setLabelid(SequenceUtil.generateId(0L, ModuleCode.HR_FIlE)); |
| | | label.setCreator(operatorId); |
| | | label.setModifier(operatorId); |
| | | label.setCreatetime(new Date()); |
| | | label.setModifytime(new Date()); |
| | | label.setVersion(0); |
| | | this.save(label); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateLabel(Label label) { |
| | | this.saveOrUpdate(label); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteLabel(Label label) { |
| | | LambdaUpdateWrapper<Label> wapper = new LambdaUpdateWrapper<>(); |
| | | wapper.eq(Label::getLabelid,label.getLabelid()).setSql("delFlag = 1"); |
| | | this.update(wapper); |
| | | } |
| | | } |
| | |
| | | config: |
| | | server-addr: ${nacos.url}:8848 |
| | | group: DEFAULT_GROUP |
| | | prefix: febs-server-Hr |
| | | prefix: febs-server-hr |
| | | file-extension: yaml |
| | | discovery: |
| | | server-addr: ${nacos.url}:8848 |
| | |
| | | # 批量插入单次最大值,比如配置为1000,那么数据库插入1000条数据commit一次 |
| | | febs.server.hr.uploadPpath=D:/upload/hr/ |
| | | febs.server.hr.uploadPpath=C:/upload/hr/ |