Merge branch 'weicd' of http://192.168.1.110:5678/r/pms-upgrade into master
# Conflicts:
# eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskUserServiceImpl.java
11 files added
14 files modified
| | |
| | | //获取数据 |
| | | List<OapiDingTalkRecordResult> getAttendanceList(List<OapiDingTalkRecordResult> oapiDingTalkRecordResultList, String access_token, String workDate, List<String> userIdList, Long offset, Long limit) throws Exception; |
| | | |
| | | //发送信息到钉钉 |
| | | void sendNotice(List<String> userIdList, String title, String content, String type) throws Exception; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.quartz.utils; |
| | | import org.apache.tomcat.util.codec.binary.Base64; |
| | | |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | |
| | | /** |
| | | * Author :tk-pc-40 |
| | | * ModifiedBy :tk-pc-40 |
| | | * CreatedAt :2022/3/23 |
| | | */ |
| | | public class aesUtils { |
| | | |
| | | /*** |
| | | * key和iv值需要和前端一致 |
| | | */ |
| | | public static final String KEY = "1234567890123456"; |
| | | |
| | | public static final String IV = "1234567890123456"; |
| | | |
| | | /** |
| | | * 加密方法 |
| | | * |
| | | * @param data 要加密的数据 |
| | | * @param key 加密key |
| | | * @param iv 加密iv |
| | | * @return 加密的结果 |
| | | */ |
| | | public static String encrypt(String data, String key, String iv) { |
| | | try { |
| | | //"算法/模式/补码方式"NoPadding PkcsPadding |
| | | Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); |
| | | int blockSize = cipher.getBlockSize(); |
| | | |
| | | byte[] dataBytes = data.getBytes(); |
| | | int plaintextLength = dataBytes.length; |
| | | if (plaintextLength % blockSize != 0) { |
| | | plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize)); |
| | | } |
| | | |
| | | byte[] plaintext = new byte[plaintextLength]; |
| | | System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length); |
| | | |
| | | SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES"); |
| | | IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes()); |
| | | |
| | | cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec); |
| | | byte[] encrypted = cipher.doFinal(plaintext); |
| | | |
| | | return new Base64().encodeToString(encrypted); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解密方法 |
| | | * |
| | | * @param data 要解密的数据 |
| | | * @param key 解密key |
| | | * @param iv 解密iv |
| | | * @return 解密的结果 |
| | | */ |
| | | public static String desEncrypt(String data, String key, String iv) { |
| | | try { |
| | | byte[] encrypted1 = new Base64().decode(data); |
| | | |
| | | Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); |
| | | SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES"); |
| | | IvParameterSpec ivSpec = new IvParameterSpec(iv.getBytes()); |
| | | cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); |
| | | byte[] original = cipher.doFinal(encrypted1); |
| | | return new String(original).trim(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_contract") |
| | | public class SysContract extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "员工id") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`contract_name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "合同名称") |
| | | private String contractName; |
| | | |
| | | @Column(name = "`contract_start_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "合同开始时间") |
| | | private Timestamp contractStartTime; |
| | | |
| | | @Column(name = "`contract_end_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "合同结束时间") |
| | | private Timestamp contractEndTime; |
| | | |
| | | @Column(name = "`company_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "公司id") |
| | | private Long companyId; |
| | | |
| | | public void copy(SysContract source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| | |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | DictDetail findByDictNameAndValue(String name, String value); |
| | | |
| | | /** |
| | | * 根据字典value查询 |
| | | * @param |
| | | * @param |
| | | */ |
| | | @Query(value = "SELECT * FROM `sys_dict_detail` where value = ?", nativeQuery = true) |
| | | DictDetail seleteByValue(String value); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | public interface SysContractRepository extends JpaRepository<SysContract, Long>, JpaSpecificationExecutor<SysContract> { |
| | | } |
| | |
| | | public interface SystemSettingRepository extends JpaRepository<SystemSetting, Long>, JpaSpecificationExecutor<SystemSetting> { |
| | | |
| | | /** |
| | | * 根据标题查询公司(导出用) |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SystemSetting findByLabel(String lable); |
| | | SystemSetting findByValue(String value); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.service.SysContractService; |
| | | import me.zhengjie.modules.system.service.dto.SysContractQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同部分管理") |
| | | @RequestMapping("/api/sysContract") |
| | | public class SysContractController { |
| | | |
| | | private final SysContractService sysContractService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public void exportSysContract(HttpServletResponse response, SysContractQueryCriteria criteria) throws IOException { |
| | | sysContractService.download(sysContractService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同部分") |
| | | @ApiOperation("查询合同部分") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysContractQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysContractService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同部分") |
| | | @ApiOperation("查询合同部分") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysContractService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同部分") |
| | | @ApiOperation("新增合同部分") |
| | | @PreAuthorize("@el.check('sysContract:add')") |
| | | public ResponseEntity<Object> createSysContract(@Validated @RequestBody SysContract resources){ |
| | | return new ResponseEntity<>(sysContractService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同部分") |
| | | @ApiOperation("修改合同部分") |
| | | @PreAuthorize("@el.check('sysContract:edit')") |
| | | public ResponseEntity<Object> updateSysContract(@Validated @RequestBody SysContract resources){ |
| | | sysContractService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同部分") |
| | | @ApiOperation("删除合同部分") |
| | | @PreAuthorize("@el.check('sysContract:del')") |
| | | public ResponseEntity<Object> deleteSysContract(@RequestBody Long[] ids) { |
| | | sysContractService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.domain.vo.CalendarVo; |
| | | import me.zhengjie.modules.system.service.SystemSettingService; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.SystemSettingDto; |
| | | import me.zhengjie.modules.system.service.dto.SystemSettingQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | systemSettingService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping(value = "/getCompName") |
| | | @Log("选择用户改变公司") |
| | | @ApiOperation("选择用户改变公司") |
| | | public ResponseEntity<Object> getCompName(@Validated @RequestBody SystemSettingDto resources){ |
| | | return new ResponseEntity<>(systemSettingService.getCompName(resources), HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.service.dto.SysContractDto; |
| | | import me.zhengjie.modules.system.service.dto.SysContractQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | public interface SysContractService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysContractQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SysContractDto> |
| | | */ |
| | | List<SysContractDto> queryAll(SysContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SysContractDto |
| | | */ |
| | | SysContractDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SysContractDto |
| | | */ |
| | | SysContractDto create(SysContract resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysContract resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysContractDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SystemSettingDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SystemSetting getCompName(SystemSettingDto resources); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Data |
| | | public class SysContractDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 员工id */ |
| | | private Long userId; |
| | | |
| | | /** 合同名称 */ |
| | | private String contractName; |
| | | |
| | | /** 合同开始时间 */ |
| | | private Timestamp contractStartTime; |
| | | |
| | | /** 合同结束时间 */ |
| | | private Timestamp contractEndTime; |
| | | |
| | | /** 公司id */ |
| | | private Long companyId; |
| | | |
| | | /** 公司名称 */ |
| | | private String compName; |
| | | |
| | | /** 用户名称 */ |
| | | private String userName; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Data |
| | | public class SysContractQueryCriteria{ |
| | | |
| | | //用户查询 |
| | | @Query |
| | | private Long userId; |
| | | |
| | | //合同名称 |
| | | @Query(type = Query.Type.INNER_LIKE, propName = "contractName") |
| | | private String contractName; |
| | | |
| | | // 合同开始时间 |
| | | @Query(type = Query.Type.BETWEEN, propName = "contractStartTime") |
| | | private List<Timestamp> contractStartTime; |
| | | |
| | | // 合同结束时间 |
| | | @Query(type = Query.Type.BETWEEN, propName = "contractEndTime") |
| | | private List<Timestamp> contractEndTime; |
| | | |
| | | //公司查询 |
| | | @Query |
| | | private Long companyId; |
| | | } |
| | |
| | | |
| | | /** 值 */ |
| | | private String value; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.Attendance; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto; |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SystemSettingRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysContractRepository; |
| | | import me.zhengjie.modules.system.service.SysContractService; |
| | | import me.zhengjie.modules.system.service.dto.SysContractDto; |
| | | import me.zhengjie.modules.system.service.dto.SysContractQueryCriteria; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysContractMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SysContractServiceImpl implements SysContractService { |
| | | |
| | | private final SysContractRepository sysContractRepository; |
| | | private final SysContractMapper sysContractMapper; |
| | | private final UserRepository userRepository; |
| | | private final SystemSettingRepository systemSettingRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysContractQueryCriteria criteria, Pageable pageable){ |
| | | Page<SysContract> page = sysContractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<SysContract, SysContractDto> func = new Function<SysContract, SysContractDto>(){ |
| | | |
| | | @Override |
| | | public SysContractDto apply(SysContract attendance) { |
| | | // 将实体类转换成DTO |
| | | SysContractDto sysContractDto = sysContractMapper.toDto(attendance); |
| | | //查询用户信息 |
| | | User user = userRepository.findById(sysContractDto.getUserId()).orElseGet(User::new); |
| | | sysContractDto.setUserName(user.getNickName()); |
| | | //查询公司信息 |
| | | SystemSetting systemSetting = systemSettingRepository.findById(sysContractDto.getCompanyId()).orElseGet(SystemSetting::new); |
| | | sysContractDto.setCompName(systemSetting.getLabel()); |
| | | return sysContractDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysContractDto> queryAll(SysContractQueryCriteria criteria){ |
| | | return sysContractMapper.toDto(sysContractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysContractDto findById(Long id) { |
| | | SysContract sysContract = sysContractRepository.findById(id).orElseGet(SysContract::new); |
| | | ValidationUtil.isNull(sysContract.getId(),"SysContract","id",id); |
| | | return sysContractMapper.toDto(sysContract); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysContractDto create(SysContract resources) { |
| | | return sysContractMapper.toDto(sysContractRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(SysContract resources) { |
| | | SysContract sysContract = sysContractRepository.findById(resources.getId()).orElseGet(SysContract::new); |
| | | ValidationUtil.isNull( sysContract.getId(),"SysContract","id",resources.getId()); |
| | | sysContract.copy(resources); |
| | | sysContractRepository.save(sysContract); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | sysContractRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<SysContractDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (SysContractDto sysContract : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | User user = userRepository.findById(sysContract.getUserId()).orElseGet(User::new); |
| | | SystemSetting systemSetting = systemSettingRepository.findById(sysContract.getCompanyId()).orElseGet(SystemSetting::new); |
| | | map.put("所属员工", user.getNickName()); |
| | | map.put("合同名称", sysContract.getContractName()); |
| | | map.put("合同开始时间", sysContract.getContractStartTime()); |
| | | map.put("合同结束时间", sysContract.getContractEndTime()); |
| | | map.put("公司", systemSetting.getLabel()); |
| | | map.put("创建者", sysContract.getCreateBy()); |
| | | map.put("创建时间", sysContract.getCreateTime()); |
| | | map.put("更新者", sysContract.getUpdateBy()); |
| | | map.put("更新时间", sysContract.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| | |
| | | package me.zhengjie.modules.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | |
| | | private final SystemSettingRepository systemSettingRepository; |
| | | private final SystemSettingMapper systemSettingMapper; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SystemSettingQueryCriteria criteria, Pageable pageable){ |
| | |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SystemSetting getCompName(SystemSettingDto resources) { |
| | | // 查询用户表 |
| | | User user = userRepository.findById(Long.valueOf(resources.getUserId())).orElseGet(User::new); |
| | | // 查询公司表 |
| | | SystemSetting systemSetting = systemSettingRepository.findByValue(user.getCompany()); |
| | | return systemSetting; |
| | | } |
| | | } |
| | |
| | | for(Attendance attendance : attendanceList){ |
| | | CalendarVo onDuty = new CalendarVo(); |
| | | onDuty.setDate(df.format(attendance.getAttendanceDate())); |
| | | onDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getStartClockResults()).get("msg")) ? "上班打卡时间:" + attendance.getRosteringWorkStartTime().toString() : "上班:" + formateResult(attendance.getStartClockResults()).get("msg")); |
| | | String dsf = formateResult(attendance.getStartClockResults()).get("msg").toString(); |
| | | onDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getStartClockResults()).get("msg")) ? "上班打卡时间:" + attendance.getActualWorkStartTime().toString() : "上班:" + formateResult(attendance.getStartClockResults()).get("msg")); |
| | | onDuty.setIsOk((Boolean) formateResult(attendance.getStartClockResults()).get("status")); |
| | | onDuty.setType(1); |
| | | CalendarVo offDuty = new CalendarVo(); |
| | | offDuty.setDate(df.format(attendance.getAttendanceDate())); |
| | | offDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getEndClockResults()).get("msg")) ? "下班打卡时间:" + attendance.getRosteringWorkEndTime().toString() : "下班:" + formateResult(attendance.getEndClockResults()).get("msg")); |
| | | offDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getEndClockResults()).get("msg")) ? "下班打卡时间:" + attendance.getActualWorkEndTime().toString() : "下班:" + formateResult(attendance.getEndClockResults()).get("msg")); |
| | | offDuty.setIsOk((Boolean) formateResult(attendance.getEndClockResults()).get("status")); |
| | | offDuty.setType(1); |
| | | calendarInfo.add(onDuty); |
| | |
| | | for (UserDto userDTO : queryAll) { |
| | | List<String> roles = userDTO.getRoles().stream().map(RoleSmallDto::getName).collect(Collectors.toList()); |
| | | String levelName = userDTO.getLevelId() != null ? sysLevelRepository.findById(userDTO.getLevelId()).orElseGet(SysLevel::new).getName() : ""; |
| | | SystemSetting systemSetting = systemSettingRepository.findByLabel(userDTO.getCompany()); |
| | | SystemSetting systemSetting = systemSettingRepository.findByValue(userDTO.getCompany()); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("用户名", userDTO.getUsername()); |
| | | map.put("角色", roles); |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.service.dto.SysContractDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysContractMapper extends BaseMapper<SysContractDto, SysContract> { |
| | | |
| | | } |
| | |
| | | /** |
| | | * 根据项目ID、任务ID查询 |
| | | * @param projectId |
| | | * @param taskId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT user_id AS userId, task_id AS taskId, COALESCE(MAX(task_progress), 0) AS taskProgress FROM task_daliy WHERE project_id = ?1 AND fill_date <= ?2 GROUP BY user_id, task_id", nativeQuery = true) |
| | |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * from task_daliy where user_id = ?1 and fill_date <= ?3 and fill_date >= ?2 group by fill_date", nativeQuery = true) |
| | | @Query(value = "SELECT id,project_id,task_id,user_id,fill_date,consumed_workload,task_progress,settlement_status,SUM( consumed_hours ) AS consumed_hours,remarks,create_by,create_time,update_by,update_time from task_daliy where user_id = ?1 and fill_date <= ?3 and fill_date >= ?2 group by fill_date", nativeQuery = true) |
| | | List<TaskDaliy> findAllByUserAndDate(Long userId, LocalDate startDate, LocalDate endDate); |
| | | |
| | | /** |
| | |
| | | @Log("新增任务分配") |
| | | @ApiOperation("新增任务分配") |
| | | @PreAuthorize("@el.check('taskUser:add')") |
| | | public ResponseEntity<Object> createTaskUser(@Validated @RequestBody TaskUser resources){ |
| | | public ResponseEntity<Object> createTaskUser(@Validated @RequestBody TaskUser resources) throws Exception { |
| | | return new ResponseEntity<>(taskUserService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | |
| | | @Log("修改任务分配") |
| | | @ApiOperation("修改任务分配") |
| | | @PreAuthorize("@el.check('taskUser:edit')") |
| | | public ResponseEntity<Object> updateTaskUser(@Validated @RequestBody TaskUser resources){ |
| | | public ResponseEntity<Object> updateTaskUser(@Validated @RequestBody TaskUser resources) throws Exception { |
| | | taskUserService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | |
| | | * @param resources / |
| | | * @return TaskUserDto |
| | | */ |
| | | TaskUserDto create(TaskUser resources); |
| | | TaskUserDto create(TaskUser resources) throws Exception; |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(TaskUser resources); |
| | | void update(TaskUser resources) throws Exception; |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectTaskRepository; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | |
| | | private final UserRepository userRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final ProjectTaskRepository projectTaskRepository; |
| | | private final RoleService roleService; |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public TaskUserDto create(TaskUser resources) { |
| | | public TaskUserDto create(TaskUser resources) throws Exception { |
| | | //查询任务名称 |
| | | ProjectTask projectTask = projectTaskRepository.findById(resources.getTaskId()).orElseGet(ProjectTask::new); |
| | | //查询字典 |
| | | DictDetail dict = dictDetailRepository.seleteByValue(resources.getTaskStatus()); |
| | | //发送钉钉给审批人 |
| | | List<String> sendList = new ArrayList<>(); |
| | | //查询所属用户信息 |
| | | User user = userRepository.findById(resources.getUserId()).orElseGet(User::new); |
| | | sendList.add(user.getDingding()); |
| | | opaiDingTalkService.sendNotice(sendList, "任务创建提醒", "### 任务创建提示 \n >" + |
| | | " \n 任务名称:" + projectTask.getName() + |
| | | " \n 当前任务状态: " + dict.getLabel() + |
| | | " \n 任务创建成功,请登录PMS系统查看。", "card"); |
| | | return taskUserMapper.toDto(taskUserRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(TaskUser resources) { |
| | | public void update(TaskUser resources) throws Exception { |
| | | TaskUser taskUser = taskUserRepository.findById(resources.getId()).orElseGet(TaskUser::new); |
| | | ValidationUtil.isNull( taskUser.getId(),"TaskUser","id",resources.getId()); |
| | | taskUser.copy(resources); |
| | | taskUserRepository.save(taskUser); |
| | | // 根据项目ID查询项目信息 |
| | | Project project = projectRepository.findById(resources.getProjectId()).orElseGet(Project::new); |
| | | //查询字典 |
| | | DictDetail dict = dictDetailRepository.seleteByValue(resources.getTaskStatus()); |
| | | //查询任务名称 |
| | | ProjectTask projectTask = projectTaskRepository.findById(resources.getTaskId()).orElseGet(ProjectTask::new); |
| | | //发送钉钉给审批人 |
| | | List<String> sendList = new ArrayList<>(); |
| | | //查询所属用户信息 |
| | | User user = userRepository.findById(resources.getUserId()).orElseGet(User::new); |
| | | sendList.add(user.getDingding()); |
| | | opaiDingTalkService.sendNotice(sendList, "任务变更提醒", "### 任务变更提示 \n >" + |
| | | "项目名称:" + project.getName() + |
| | | " \n 任务名称:" + projectTask.getName() + |
| | | " \n 当前任务状态: " + dict.getLabel() + |
| | | " \n 当前任务有新的变更,请登录PMS系统查看。", "card"); |
| | | } |
| | | |
| | | @Override |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysContract/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysContract', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysContract/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysContract', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| | | export function getCompName(data) { |
| | | return request({ |
| | | url: 'api/systemSetting/getCompName', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, getCompName } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-model="query.contractName" |
| | | clearable |
| | | size="small" |
| | | placeholder="输入合同名称" |
| | | style="width: 200px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.contractStartTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="合同开始日期" |
| | | end-placeholder="合同开始日期" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.contractEndTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="合同结束日期" |
| | | end-placeholder="合同结束日期" |
| | | /> |
| | | <el-select v-model="query.companyId" filterable clearable placeholder="所属公司" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in companyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="合同名称" prop="contractName"> |
| | | <el-input v-model="form.contractName" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" clearable filterable placeholder="请选择" style="width: 370px;" @change="getComp(form.userId)"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="开始时间" prop="contractStartTime"> |
| | | <el-date-picker |
| | | v-model="form.contractStartTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.contractEndTime ? time.getTime() > new Date(form.contractEndTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="结束时间" prop="contractEndTime"> |
| | | <el-date-picker |
| | | v-model="form.contractEndTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.contractStartTime ? time.getTime() < new Date(form.contractStartTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="公司" prop="companyId"> |
| | | <el-select v-model="form.companyId" style="width: 370px" clearable> |
| | | <el-option v-for="item in companyList" :key="item.id" :label="item.label" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="crud.cancelCU">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userId" label="所属员工" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="contractName" label="合同名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.contractName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="contractStartTime" label="合同开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="contractEndTime" label="合同结束时间" show-overflow-tooltip /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="companyId" label="公司"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.compName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','sysContract:edit','sysContract:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudSysContract from '@/api/system/sysContract' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudSystemSetting from '@/api/system/systemSetting' |
| | | import crudUser from '@/api/system/user' |
| | | |
| | | const defaultForm = { id: null, userId: null, contractName: null, contractStartTime: null, contractEndTime: null, companyId: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'SysContract', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '合同部分', url: 'api/sysContract', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysContract }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'sysContract:add'], |
| | | edit: ['admin', 'sysContract:edit'], |
| | | del: ['admin', 'sysContract:del'], |
| | | download: ['admin', 'sysContract:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '员工不能为空', trigger: 'blur' } |
| | | ], |
| | | contractName: [ |
| | | { required: true, message: '合同名称不能为空', trigger: 'blur' } |
| | | ], |
| | | contractStartTime: [ |
| | | { required: true, message: '合同开始时间不能为空', trigger: 'blur' } |
| | | ], |
| | | contractEndTime: [ |
| | | { required: true, message: '合同结束时间不能为空', trigger: 'blur' } |
| | | ], |
| | | companyId: [ |
| | | { required: true, message: '公司不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | companyList: [], |
| | | users: [] } |
| | | }, |
| | | methods: { |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getUsers() |
| | | // 查询配置参数 |
| | | crudSystemSetting.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 根据员工选择公司 |
| | | getComp(data) { |
| | | if (data !== '') { |
| | | var form = JSON.stringify({ |
| | | 'userId': data |
| | | }) |
| | | crudSystemSetting.getCompName(form).then(res => { |
| | | this.form.companyId = res.label |
| | | }) |
| | | } else { |
| | | this.form.companyId = null |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | > |
| | | 用户级别其他 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.contract" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="info" |
| | | icon="el-icon-view" |
| | | style="margin-left: 4px !important;" |
| | | @click="toContract" |
| | | > |
| | | 用户合同部分 |
| | | </el-button> |
| | | </crudOperation> |
| | | </div> |
| | | <!--表单渲染--> |
| | |
| | | download: ['admin', 'user:download'], |
| | | levelWage: ['admin', 'user:levelWage'], |
| | | levelInsurance: ['admin', 'user:levelInsurance'], |
| | | levelOther: ['admin', 'user:levelOther'] |
| | | levelOther: ['admin', 'user:levelOther'], |
| | | contract: ['admin', 'user:contract'] |
| | | }, |
| | | enabledTypeOptions: [ |
| | | { key: 'true', display_name: '激活' }, |
| | |
| | | // 去用户级别其他 |
| | | toLevelOther() { |
| | | // 跳转页面 |
| | | this.$router.push({ path: '/system/sysUserLevelOther' }) |
| | | this.$router.push({ path: '/system/SysUserLevelOther' }) |
| | | }, |
| | | // 魏传栋 - 始 |
| | | // 去合同部分 |
| | | toContract() { |
| | | // 跳转页面 |
| | | this.$router.push({ path: '/system/sysContract' }) |
| | | } |
| | | } |
| | | } |