Commit 9b6098c3 authored by fangxinjiang's avatar fangxinjiang

工资查询优化-fxj

parent e879a7d2
...@@ -61,7 +61,7 @@ public class TQuestionFeedbackInfo extends BaseEntity { ...@@ -61,7 +61,7 @@ public class TQuestionFeedbackInfo extends BaseEntity {
/** /**
* 手机号码 * 手机号码
*/ */
@ExcelAttribute(name = "手机号码", isNotEmpty = true, errorInfo = "手机号码不能为空", maxLength = 20) @ExcelAttribute(name = "手机号码",isPhone = true, isNotEmpty = true, errorInfo = "手机号码不能为空", maxLength = 20)
@NotBlank(message = "手机号码不能为空") @NotBlank(message = "手机号码不能为空")
@Length(max = 20, message = "手机号码不能超过20个字符") @Length(max = 20, message = "手机号码不能超过20个字符")
@ExcelProperty("手机号码") @ExcelProperty("手机号码")
......
...@@ -65,7 +65,11 @@ public class TSalaryAccountPhoneController { ...@@ -65,7 +65,11 @@ public class TSalaryAccountPhoneController {
**/ **/
@Operation(description = "获取工资报账信息") @Operation(description = "获取工资报账信息")
@GetMapping("/getSalaryAccount") @GetMapping("/getSalaryAccount")
public R<AccountForWxVo> getSalaryAccount(@RequestParam String idNumber, String year) { public R<AccountForWxVo> getSalaryAccount(@RequestParam String idNumber, String year,String openId) {
//校验openId,openId 不对直接返回
if (!checkOpenId(openId)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
AccountForWxVo result = new AccountForWxVo(); AccountForWxVo result = new AccountForWxVo();
//处理身份证防止小写干扰 //处理身份证防止小写干扰
idNumber = idNumber.toUpperCase(); idNumber = idNumber.toUpperCase();
...@@ -122,7 +126,11 @@ public class TSalaryAccountPhoneController { ...@@ -122,7 +126,11 @@ public class TSalaryAccountPhoneController {
**/ **/
@Operation(description = "获取工资明细信息") @Operation(description = "获取工资明细信息")
@GetMapping("/getSalaryAccountForm") @GetMapping("/getSalaryAccountForm")
public R<TSalarySetVo> getSalaryAccountForm(@RequestParam String id, Integer type) { public R<TSalarySetVo> getSalaryAccountForm(@RequestParam String id, Integer type,String openId) {
//校验openId,openId 不对直接返回
if (!checkOpenId(openId)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
//类型判断 //类型判断
if (null == type) { if (null == type) {
return R.failed("查询类型不能为空"); return R.failed("查询类型不能为空");
...@@ -242,4 +250,12 @@ public class TSalaryAccountPhoneController { ...@@ -242,4 +250,12 @@ public class TSalaryAccountPhoneController {
} }
} }
private boolean checkOpenId(String openId){
R<Boolean> r = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/user/inner/checkWxUserByOpenId", openId, Boolean.class, SecurityConstants.FROM_IN);
if (Common.isNotNull(r)){
return r.getData().booleanValue();
}
return false;
}
} }
...@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
...@@ -55,6 +56,7 @@ import java.io.InputStream; ...@@ -55,6 +56,7 @@ import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* 薪资结算附件表 * 薪资结算附件表
...@@ -72,6 +74,8 @@ public class TSalaryAttaServiceImpl extends ServiceImpl<TSalaryAttaMapper, TSala ...@@ -72,6 +74,8 @@ public class TSalaryAttaServiceImpl extends ServiceImpl<TSalaryAttaMapper, TSala
private final TSalaryStandardService tSalaryStandardService; private final TSalaryStandardService tSalaryStandardService;
private final TSalaryAccountService tSalaryAccountService; private final TSalaryAccountService tSalaryAccountService;
private final AtomicInteger atomicInteger = new AtomicInteger(0);
/** /**
* 薪资结算附件表简单分页查询 * 薪资结算附件表简单分页查询
* *
...@@ -139,35 +143,49 @@ public class TSalaryAttaServiceImpl extends ServiceImpl<TSalaryAttaMapper, TSala ...@@ -139,35 +143,49 @@ public class TSalaryAttaServiceImpl extends ServiceImpl<TSalaryAttaMapper, TSala
@Override @Override
public R<FileVo> uploadAtta(@RequestBody MultipartFile file, String filePath, String linkId public R<FileVo> uploadAtta(@RequestBody MultipartFile file, String filePath, String linkId
, Integer linkType, Integer engineerType, String printRemark, String recordId) throws IOException { , Integer linkType, Integer engineerType, String printRemark, String recordId) throws IOException {
String fileName = System.currentTimeMillis() + "_" + file.getOriginalFilename(); //初始化附件上传队列上限值
//filePath不传默认存储空间的根目录 int maxLimit = 5;
//jpg,jpeg,png,bmp if (atomicInteger.incrementAndGet() <= maxLimit){
String key = "";
if (!Common.isNotNull(filePath)) {
key = fileName;
} else {
key = filePath + "/" + fileName;
}
boolean flag = ossUtil.uploadFileByStream(file.getInputStream(), key, null);
FileVo fileVo;
TSalaryAtta salaryAtta;
URL url = null;
if (flag) {
log.info("文件:" + fileName + "上传至存储空间" + ossUtil.getBucketName() + "成功!");
salaryAtta = this.saveTSalaryAtta(fileName, key, file.getSize(), linkId, linkType, engineerType, printRemark, recordId);
try { try {
this.save(salaryAtta); String fileName = System.currentTimeMillis() + "_" + file.getOriginalFilename();
} catch (Exception e) { //filePath不传默认存储空间的根目录
log.error("OSS文件上传接口异常:" + e.getMessage()); //jpg,jpeg,png,bmp
ossUtil.deleteObject(null, key); String key = "";
return R.failed("failed:" + e.getMessage()); if (!Common.isNotNull(filePath)) {
key = fileName;
} else {
key = filePath + "/" + fileName;
}
boolean flag = ossUtil.uploadFileByStream(file.getInputStream(), key, null);
FileVo fileVo;
TSalaryAtta salaryAtta;
URL url = null;
if (flag) {
salaryAtta = this.saveTSalaryAtta(fileName, key, file.getSize(), linkId, linkType, engineerType, printRemark, recordId);
try {
this.save(salaryAtta);
} catch (Exception e) {
log.error("OSS文件上传接口异常:" + e.getMessage());
ossUtil.deleteObject(null, key);
return R.failed("failed:" + e.getMessage());
}
url = ossUtil.getObjectUrl(null, salaryAtta.getAttaSrc());
fileVo = new FileVo(salaryAtta.getId(), salaryAtta.getAttaName(), url.toString());
return R.ok(fileVo);
} else {
return R.failed("failed:上传至存储空间失败");
}
}catch (Exception e){
log.error("附件上传异常:",e);
}finally {
atomicInteger.decrementAndGet();
} }
url = ossUtil.getObjectUrl(null, salaryAtta.getAttaSrc()); }else {
fileVo = new FileVo(salaryAtta.getId(), salaryAtta.getAttaName(), url.toString()); atomicInteger.decrementAndGet();
return R.ok(fileVo); log.error("超出阈值:"+ ResultConstants.FILE_UPLOADING_DATA);
} else { return R.failed(ResultConstants.FILE_UPLOADING_DATA);
return R.failed("failed:上传至存储空间失败");
} }
return null;
} }
/** /**
......
...@@ -44,9 +44,12 @@ security: ...@@ -44,9 +44,12 @@ security:
- /tsalaryemployee/inner/getEmpTaxMonth - /tsalaryemployee/inner/getEmpTaxMonth
- /tsalaryemployee/inner/getSalaryEmployee - /tsalaryemployee/inner/getSalaryEmployee
- /tsalaryemployee/inner/savePreNewEmpInfo - /tsalaryemployee/inner/savePreNewEmpInfo
- /tmobilechangeinfo/add - /tmobilechangeinfo/add # 工资条换号申请不需要token
- /tquestionfeedbackinfo/add - /tquestionfeedbackinfo/add # 工资条问题反馈不需要token
- /tsalaryatta/** - /salaryEmployeeSelect/getSalaryAccountForm # 工资条查询通过openId控制
- /salaryEmployeeSelect/getSalaryAccount # 工资条查询明细通过openId控制
- /tsalaryatta/ossUploadFile # 工资条查询附件上传 无token
- /tsalaryatta/ossFileDelete/** # 工资条查询附件上传删除 无token
......
...@@ -496,6 +496,31 @@ public class UserController { ...@@ -496,6 +496,31 @@ public class UserController {
return null; return null;
} }
/**
* @Author fxj
* @Description 通过openId验证是否存在用户
* @Date 11:35 2024/12/20
* @Param
* @return
**/
@Inner
@PostMapping("/inner/checkWxUserByOpenId")
public Boolean checkWxUserByOpenId(@RequestBody String openId) {
try{
if (Common.isNotNull(openId)){
int count = (int) userService.count(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getWxOpenid, openId)
.eq(SysUser::getDelFlag, CommonConstants.ZERO_STRING));
if (count > 0){
return true;
}
}
}catch (Exception e){
log.error("通过openId:{}验证微信用户异常:{}",openId,e);
return false;
}
return false;
}
/** /**
* C端用户信息注册 * C端用户信息注册
* *
......
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