Commit 71a3aa2c authored by fangxinjiang's avatar fangxinjiang

EKP 权限-- 配置文件

parent 247ef19f
......@@ -215,6 +215,8 @@ public class SalaryProveController {
} else {
return R.failed("参数出错!");
}
// 存储最近一次选择的档案信息
tProveApplyService.setCompanyRedisInfo(record.getUnitName(),record.getUnitAddr(),record.getPhone());
return R.ok(record);
}
......@@ -427,4 +429,14 @@ public class SalaryProveController {
return R.failed("无此证明记录!");
}
}
/**
* 获取最近一次选择的客户名称
*
* @author fxj
* @date 2023-08-23 17:31:05
**/
@GetMapping("/getLastCompanyName")
public R<TCompanyInfo> getLastCompanyName() {
return tProveApplyService.getLastCompanyName();
}
}
......@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
......@@ -89,7 +91,7 @@ public class TCompanyInfoController {
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('demo_tcompanyinfo_get')")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo_get')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo_get')")
public R<TCompanyInfo> getById(@PathVariable("id") String id) {
return R.ok(tCompanyInfoService.getById(id));
}
......@@ -100,10 +102,10 @@ public class TCompanyInfoController {
* @param tCompanyInfo 收入证明 中的 单位信息维护表
* @return R
*/
@Operation(summary = "新增收入证明 中的 单位信息维护表", description = "新增收入证明 中的 单位信息维护表:hasPermission('demo_tcompanyinfo_add')")
@Operation(summary = "新增收入证明 中的 单位信息维护表", description = "新增收入证明 中的 单位信息维护表:hasPermission('tcompanyinfo_add')")
@SysLog("新增收入证明 中的 单位信息维护表")
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo_add')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo_add')")
public R<Boolean> save(@RequestBody TCompanyInfo tCompanyInfo) {
TCompanyInfo exits = tCompanyInfoService.getOne(Wrappers.<TCompanyInfo>query().lambda()
.eq(TCompanyInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
......@@ -111,6 +113,11 @@ public class TCompanyInfoController {
if (Common.isNotNull(exits)){
return R.failed("已存在相同公司名称的有效数据!");
}
tCompanyInfo.setCreateName(SecurityUtils.getUser().getNickname());
tCompanyInfo.setCreateBy(SecurityUtils.getUser().getId());
tCompanyInfo.setCreateTime(LocalDateTime.now());
tCompanyInfo.setUpdateBy(SecurityUtils.getUser().getId());
tCompanyInfo.setUpdateTime(LocalDateTime.now());
return R.ok(tCompanyInfoService.save(tCompanyInfo));
}
/**
......@@ -119,10 +126,10 @@ public class TCompanyInfoController {
* @param tCompanyInfo 收入证明 中的 单位信息维护表
* @return R
*/
@Operation(summary = "修改收入证明 中的 单位信息维护表", description = "修改收入证明 中的 单位信息维护表:hasPermission('demo_tcompanyinfo_edit')")
@Operation(summary = "修改收入证明 中的 单位信息维护表", description = "修改收入证明 中的 单位信息维护表:hasPermission('tcompanyinfo_edit')")
@SysLog("修改收入证明 中的 单位信息维护表")
@PutMapping
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo_edit')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo_edit')")
public R<Boolean> updateById(@RequestBody TCompanyInfo tCompanyInfo) {
TCompanyInfo exits = tCompanyInfoService.getOne(Wrappers.<TCompanyInfo>query().lambda()
.eq(TCompanyInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
......@@ -131,6 +138,9 @@ public class TCompanyInfoController {
if (Common.isNotNull(exits)){
return R.failed("已存在相同公司名称的有效数据!");
}
tCompanyInfo.setCreateTime(LocalDateTime.now());
tCompanyInfo.setUpdateBy(SecurityUtils.getUser().getId());
tCompanyInfo.setUpdateTime(LocalDateTime.now());
return R.ok(tCompanyInfoService.updateById(tCompanyInfo));
}
......@@ -140,10 +150,10 @@ public class TCompanyInfoController {
* @param id id
* @return R
*/
@Operation(summary = "通过id删除收入证明 中的 单位信息维护表", description = "通过id删除收入证明 中的 单位信息维护表:hasPermission('demo_tcompanyinfo_del')")
@Operation(summary = "通过id删除收入证明 中的 单位信息维护表", description = "通过id删除收入证明 中的 单位信息维护表:hasPermission('tcompanyinfo_del')")
@SysLog("通过id删除收入证明 中的 单位信息维护表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo_del')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tCompanyInfoService.removeById(id));
}
......@@ -155,10 +165,10 @@ public class TCompanyInfoController {
* @date 2023-08-23 17:31:05
**/
@SneakyThrows
@Operation(description = "批量新增收入证明 中的 单位信息维护表 hasPermission('demo_tcompanyinfo-batch-import')")
@Operation(description = "批量新增收入证明 中的 单位信息维护表 hasPermission('tcompanyinfo-batch-import')")
@SysLog("批量新增收入证明 中的 单位信息维护表")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo-batch-import')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return tCompanyInfoService.importDiy(file.getInputStream());
}
......@@ -169,9 +179,9 @@ public class TCompanyInfoController {
* @author fxj
* @date 2023-08-23 17:31:05
**/
@Operation(description = "导出收入证明 中的 单位信息维护表 hasPermission('demo_tcompanyinfo-export')")
@Operation(description = "导出收入证明 中的 单位信息维护表 hasPermission('tcompanyinfo-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('demo_tcompanyinfo-export')")
@PreAuthorize("@pms.hasPermission('tcompanyinfo-export')")
public void export(HttpServletResponse response, @RequestBody TCompanyInfoSearchVo searchVo) {
tCompanyInfoService.listExport(response, searchVo);
}
......
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCompanyInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -23,4 +24,7 @@ public interface TProveApplyService extends IService<TProveApply> {
R<String> validSave(TProveApply proveApply, String[] attaIdArray);
R<TCompanyInfo> getLastCompanyName();
void setCompanyRedisInfo(String unitName, String unitAddr, String phone);
}
......@@ -5,13 +5,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCompanyInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TProveApplyMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TProveApplyService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,7 +30,8 @@ import java.util.List;
*/
@Service
public class TProveApplyServiceImpl extends ServiceImpl<TProveApplyMapper, TProveApply> implements TProveApplyService {
@Autowired
private RedisUtil redisUtil;
@Autowired
private TAttaInfoService tAttaInfoService;
......@@ -79,5 +83,30 @@ public class TProveApplyServiceImpl extends ServiceImpl<TProveApplyMapper, TProv
return R.ok("操作成功!");
}
@Override
public R<TCompanyInfo> getLastCompanyName() {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
String userKey = CacheConstants.WXHR_LAST_SELECT_COMPANY_NAME + "_" + user.getId();
Object info = redisUtil.get(userKey);
if(Common.isEmpty(info)){
return R.ok(null);
}
return R.ok((TCompanyInfo)info);
}
@Override
public void setCompanyRedisInfo(String unitName, String unitAddr, String phone) {
YifuUser user = SecurityUtils.getUser();
if (!Common.isEmpty(user)){
String userKey = CacheConstants.WXHR_LAST_SELECT_COMPANY_NAME + "_" + user.getId();
TCompanyInfo info = new TCompanyInfo();
info.setCompanyName(unitName);
info.setCompanyTel(phone);
info.setCompanyAddress(unitAddr);
redisUtil.set(userKey,info);
}
}
}
......@@ -53,7 +53,7 @@
AND a.id = #{tCompanyInfo.id}
</if>
<if test="tCompanyInfo.companyName != null and tCompanyInfo.companyName.trim() != ''">
AND a.COMPANY_NAME = #{tCompanyInfo.companyName}
AND a.COMPANY_NAME like CONCAT('%',#{tCompanyInfo.companyName},'%')
</if>
<if test="tCompanyInfo.companyAddress != null and tCompanyInfo.companyAddress.trim() != ''">
AND a.COMPANY_ADDRESS = #{tCompanyInfo.companyAddress}
......
......@@ -165,4 +165,9 @@ public interface CacheConstants {
String FUND_IMPORT_HANDLE_LOCK = "fund_import_handle_handle_lock";
public static final String WX_ACCOSS_TOKEN = "WX_ACCOSS_TOKEN";
/**
* 登录用户最近一次选择的收入证明单位名称
*/
public static final String WXHR_LAST_SELECT_COMPANY_NAME = "wxhr_last_select_company_name";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment