Commit 2ab32b8c by Administrator

Merge branch 'tzq' into 'develop'

登录人信息API 优化,企业中心-显示常用的企业开票资料API 优化

See merge request 8timerv2/8timerapiv200!75
parents 4d80a30b de977859
...@@ -3,19 +3,16 @@ package cn.timer.api.aspect; ...@@ -3,19 +3,16 @@ package cn.timer.api.aspect;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature; import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError; import org.springframework.validation.ObjectError;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -23,7 +20,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -23,7 +20,6 @@ import com.alibaba.fastjson.JSONObject;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.ClassUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.timer.api.aspect.lang.annotation.BindingResultCtrol; import cn.timer.api.aspect.lang.annotation.BindingResultCtrol;
import cn.timer.api.aspect.lang.bean.ValidationError; import cn.timer.api.aspect.lang.bean.ValidationError;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
...@@ -43,7 +39,7 @@ public class BindingResultAspect { ...@@ -43,7 +39,7 @@ public class BindingResultAspect {
{ {
} }
// execution 配置织入点 // execution 配置织入点 -匹配 cn.timer.api.controller 包下的所有子包的类的方法
@Pointcut("execution(* cn.timer.api.controller.*.*.*(..))") @Pointcut("execution(* cn.timer.api.controller.*.*.*(..))")
public void clazzPointCut() public void clazzPointCut()
{ {
...@@ -78,9 +74,9 @@ public class BindingResultAspect { ...@@ -78,9 +74,9 @@ public class BindingResultAspect {
fieldString = fieldString.substring(fieldString.lastIndexOf(".") + 1); fieldString = fieldString.substring(fieldString.lastIndexOf(".") + 1);
} }
for (String str : one.getCodes()) { // for (String str : one.getCodes()) {
System.err.println(str); // System.err.println(str);
} // }
ve = ValidationError.builder().field(fieldString).msg(one.getDefaultMessage()).build(); ve = ValidationError.builder().field(fieldString).msg(one.getDefaultMessage()).build();
listVe.add(ve); listVe.add(ve);
...@@ -93,26 +89,7 @@ public class BindingResultAspect { ...@@ -93,26 +89,7 @@ public class BindingResultAspect {
Console.log("返回内容 {}: " ,JSONObject.toJSONString(retVal)); Console.log("返回内容 {}: " ,JSONObject.toJSONString(retVal));
Long endtime = System.currentTimeMillis(); Long endtime = System.currentTimeMillis();
Console.log("执行耗时为{}:" ,endtime-startTime + "ms"); Console.log("执行耗时为{}:" ,endtime-startTime + "ms");
// Object[] objs = joinPoint.getArgs();
//
// List<Object> listObj = CollectionUtil.toList(objs);
// BeanPropertyBindingResult optional = (BeanPropertyBindingResult)listObj.stream()
// .filter(p -> "BeanPropertyBindingResult".equals(ClassUtil.getClassName(p, true)))
// .findFirst()
// .orElse(null);
// if (optional != null && optional.hasErrors()) {
// System.err.println("Optional: "+ optional);
// }
return retVal; return retVal;
} }
......
...@@ -229,13 +229,15 @@ public class QyzxController { ...@@ -229,13 +229,15 @@ public class QyzxController {
@GetMapping(value = "/invoiceusual") @GetMapping(value = "/invoiceusual")
@ApiOperation(value = "显示常用的企业开票资料", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "显示常用的企业开票资料", httpMethod = "GET", notes = "接口发布说明")
public Result<QyzxInvoiceUsual> invoiceusual(@CurrentUser UserBean userBean) { public Result<QyzxInvoiceUsual> invoiceusual(@CurrentUser UserBean userBean) {
QyzxInvoiceUsual one = new LambdaQueryChainWrapper<QyzxInvoiceUsual>(qyzxInvoiceUsualMapper) QyzxInvoiceUsual one = qyzxInvoiceUsualMapper.selectOne(new QueryWrapper<QyzxInvoiceUsual>().lambda()
.eq(QyzxInvoiceUsual::getOrgCode, userBean.getOrgCode()).one(); .eq(QyzxInvoiceUsual::getOrgCode, userBean.getOrgCode()));
if (one.getShippingArea() == null) { if (one != null) {
one.setShippingArea(""); if (one.getShippingArea() == null) {
} one.setShippingArea("");
if (one.getShippingAddress() == null) { }
one.setShippingAddress(""); if (one.getShippingAddress() == null) {
one.setShippingAddress("");
}
} }
return ResultUtil.data(one, "显示常用的企业开票资料"); return ResultUtil.data(one, "显示常用的企业开票资料");
} }
......
...@@ -9,6 +9,7 @@ import javax.validation.Valid; ...@@ -9,6 +9,7 @@ import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -30,6 +31,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -30,6 +31,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.timer.api.aspect.lang.annotation.BindingResultCtrol; import cn.timer.api.aspect.lang.annotation.BindingResultCtrol;
import cn.timer.api.aspect.lang.bean.ValidationError;
import cn.timer.api.bean.spmk.SpmkApprovalG; import cn.timer.api.bean.spmk.SpmkApprovalG;
import cn.timer.api.bean.spmk.SpmkApprovalTemplate; import cn.timer.api.bean.spmk.SpmkApprovalTemplate;
import cn.timer.api.bean.spmk.SpmkApprovalTemplateG; import cn.timer.api.bean.spmk.SpmkApprovalTemplateG;
...@@ -246,17 +248,31 @@ public class SpmkServiceImpl { ...@@ -246,17 +248,31 @@ public class SpmkServiceImpl {
} }
/** /**
* 查询列表-审批组 * 查询列表-审批组-审批管理
*/
@GetMapping(value = "/all_approval_g")
@ApiOperation(value = "11.查询列表-审批组-审批管理", httpMethod = "GET", notes = "查询列表-审批组-审批管理")
@ApiOperationSupport(order = 11)
public Result<Object> selectListAgByAdmin(@CurrentUser UserBean userBean){
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
System.out.println(depts);
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin(userBean.getOrgCode(), userBean.getEmpNum(), depts),"操作成功!");
}
/**
* 查询列表-审批组-个人审批
*/ */
@GetMapping(value = "/list_approval_g") @GetMapping(value = "/list_approval_g")
@ApiOperation(value = "11.查询列表-审批组", httpMethod = "GET", notes = "查询列表-审批组") @ApiOperation(value = "11.查询列表-审批组-个人审批", httpMethod = "GET", notes = "查询列表-审批组-个人审批")
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
public Result<Object> selectListAg(@CurrentUser UserBean userBean){ public Result<Object> selectListAg(@CurrentUser UserBean userBean){
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum()); List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
System.out.println(depts); System.out.println(depts);
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum(), depts),"操作成功!"); return ResultUtil.data(spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum(), depts),"操作成功!");
} }
/** /**
...@@ -399,7 +415,6 @@ public class SpmkServiceImpl { ...@@ -399,7 +415,6 @@ public class SpmkServiceImpl {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
// @BindingResultCtrol(title = "发起审批") // @BindingResultCtrol(title = "发起审批")
public Result<Object> saveCa(@CurrentUser UserBean userBean,@Valid @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto,BindingResult bindingResult) throws Exception{ public Result<Object> saveCa(@CurrentUser UserBean userBean,@Valid @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto,BindingResult bindingResult) throws Exception{
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>() YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
.lambda() .lambda()
.select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName) .select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName)
......
...@@ -79,6 +79,7 @@ import cn.timer.api.dao.yggl.YgglMainEmpMapper; ...@@ -79,6 +79,7 @@ import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.yggl.YgglMainLzbMapper; import cn.timer.api.dao.yggl.YgglMainLzbMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper; import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.yggl.AddygdaDto; import cn.timer.api.dto.yggl.AddygdaDto;
import cn.timer.api.dto.yggl.LoginInfoDto;
import cn.timer.api.dto.yggl.LoginerChargeDto; import cn.timer.api.dto.yggl.LoginerChargeDto;
import cn.timer.api.dto.yggl.LzbQueryDto; import cn.timer.api.dto.yggl.LzbQueryDto;
import cn.timer.api.dto.yggl.LzygQueryDto; import cn.timer.api.dto.yggl.LzygQueryDto;
...@@ -145,17 +146,35 @@ public class YgglController { ...@@ -145,17 +146,35 @@ public class YgglController {
@GetMapping(value = "/loginmessage") @GetMapping(value = "/loginmessage")
@ApiOperation(value = " 获取登录人的相关信息", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = " 获取登录人的相关信息", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 68) @ApiOperationSupport(order = 68)
public Result<YgglMainEmp> loginmessage(@CurrentUser UserBean userBean) { public Result<LoginInfoDto> loginmessage(@CurrentUser UserBean userBean) {
Integer empNum = userBean.getEmpNum(); Integer empNum = userBean.getEmpNum();
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
LoginInfoDto loginInfo = LoginInfoDto.builder().build();
YgglMainEmp ygglMainEmp = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper) YgglMainEmp ygglMainEmp = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId, YgglMainEmp::getName, YgglMainEmp::getRzTime, YgglMainEmp::getEmpNum) .select(YgglMainEmp::getBmgwId,
YgglMainEmp::getName,
YgglMainEmp::getRzTime,
YgglMainEmp::getZzTime,
YgglMainEmp::getEmpNum)
.eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one(); .eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
Integer gw = ygglMainEmp.getBmgwId(); if (ygglMainEmp != null) {
ZzglBmgwM bmid = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getUpId) Integer gw = ygglMainEmp.getBmgwId();
.eq(ZzglBmgwM::getId, gw).eq(ZzglBmgwM::getOrgCode, orgCode).one(); ZzglBmgwM gwObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getUpId,ZzglBmgwM::getName)
ygglMainEmp.setUnionid(bmid.toString()); .eq(ZzglBmgwM::getId, gw).eq(ZzglBmgwM::getOrgCode, orgCode).one();
return ResultUtil.data(ygglMainEmp, "部门id返回字段为unionid");
ZzglBmgwM bmObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getId,ZzglBmgwM::getName)
.eq(ZzglBmgwM::getId, gwObj.getUpId()).eq(ZzglBmgwM::getOrgCode, orgCode).one();
loginInfo.setEmpNum(ygglMainEmp.getEmpNum());
loginInfo.setName(ygglMainEmp.getName());
loginInfo.setBmId(bmObj != null ? bmObj.getId() : null);
loginInfo.setBmName(bmObj != null ? bmObj.getName() : null);
loginInfo.setGwId(gw);
loginInfo.setGwName(gwObj != null ? gwObj.getName() : "");
loginInfo.setEntryTime(ygglMainEmp.getRzTime());
loginInfo.setRegularTime(ygglMainEmp.getRzTime());
}
return ResultUtil.data(loginInfo, "操作成功!");
} }
/** /**
......
...@@ -21,4 +21,6 @@ public interface SpmkApprovalGMapper extends BaseMapper<SpmkApprovalG> { ...@@ -21,4 +21,6 @@ public interface SpmkApprovalGMapper extends BaseMapper<SpmkApprovalG> {
boolean updateListRandsById(List<SpmkApprovalG> list); boolean updateListRandsById(List<SpmkApprovalG> list);
List<SpmkApprovalG> selectListAgInCaByAdmin(@Param("org_code") Integer org_code, @Param("emp_num") Integer emp_num, @Param("deptIds") List<Integer> deptIds);
} }
...@@ -2,12 +2,10 @@ package cn.timer.api.dto.spmk; ...@@ -2,12 +2,10 @@ package cn.timer.api.dto.spmk;
import java.util.List; import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.DecimalMax; import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin; import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package cn.timer.api.dto.yggl;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class LoginInfoDto {
@ApiModelProperty(value = "员工id", example = "1")
private Integer empNum;
@ApiModelProperty(value = "员工姓名", example = "1")
private String name;
@ApiModelProperty(value = "部门id", example = "1")
private Integer bmId;
@ApiModelProperty(value = "部门名称", example = "1")
private String bmName;
@ApiModelProperty(value = "岗位id", example = "1")
private Integer gwId;
@ApiModelProperty(value = "岗位名称", example = "1")
private String gwName;
@ApiModelProperty(value = "入职日期", example = "1")
private Date entryTime;
@ApiModelProperty(value = "转正时间", example = "1")
private Date regularTime;
}
...@@ -66,6 +66,18 @@ ...@@ -66,6 +66,18 @@
b.router SpmkCustomApproval_router --> b.router SpmkCustomApproval_router -->
</sql> </sql>
<select id="selectListAgInCaByAdmin" resultMap="BaseResultMapDto">
SELECT
<include refid="Base_Column_List_Alias_a" />,
<include refid="Base_Column_List_Alias_ca" />
FROM spmk_approval_g a
LEFT JOIN spmk_custom_approval b
ON a.id = b.approval_g_id
WHERE a.org_code = #{org_code}
ORDER BY a.ranks, b.ranks
</select>
<select id="selectListAgInCa" resultMap="BaseResultMapDto"> <select id="selectListAgInCa" resultMap="BaseResultMapDto">
SELECT SELECT
<include refid="Base_Column_List_Alias_a" />, <include refid="Base_Column_List_Alias_a" />,
......
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