From 4c3dd6ab02134744128ef1a4061e98e067ad50f8 Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Tue, 19 Jan 2021 11:57:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8A=84=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DgCopyForController.java | 18 ++- .../controller/DgCopyUserController.java | 34 +++++- .../controller/DgProcessUserController.java | 42 +++++-- .../guarantee/mapper/DgCopyUserMapper.java | 5 + .../model/request/CopyForMeRequest.java | 32 +++++ .../model/request/CopySendRequest.java | 18 +++ .../model/request/CopySendUserRequest.java | 18 +++ .../model/response/CopyForMeResponse.java | 61 ++++++++++ .../guarantee/service/IDgCopyUserService.java | 9 ++ .../service/IDgProcessUserService.java | 2 + .../service/impl/DgCopyForServiceImpl.java | 49 ++++++-- .../service/impl/DgCopyUserServiceImpl.java | 114 +++++++++++++++++- .../impl/DgProcessUserServiceImpl.java | 29 +++++ .../src/main/resources/bootstrap.properties | 87 ++++++------- .../mapper/guarantee/DgCopyUserMapper.xml | 39 ++++++ .../framework/domain/guarantee/DgCopyFor.java | 42 +------ 16 files changed, 487 insertions(+), 112 deletions(-) create mode 100644 dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopyForMeRequest.java create mode 100644 dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendRequest.java create mode 100644 dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendUserRequest.java create mode 100644 dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/CopyForMeResponse.java diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgCopyForController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgCopyForController.java index 75f247b6..9483d30f 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgCopyForController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgCopyForController.java @@ -1,14 +1,14 @@ package com.daqing.financial.guarantee.controller; +import com.daqing.financial.guarantee.model.request.CopySendRequest; import com.daqing.financial.guarantee.service.IDgCopyForService; import com.daqing.financial.guarantee.util.R; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.io.IOException; @@ -30,13 +30,11 @@ public class DgCopyForController { private IDgCopyForService copyForService; @ApiOperation("抄送任务") - @GetMapping("/copySend") - public R copySend(@ApiParam(name = "businessId", value = "业务id") - @RequestParam Integer businessId, - @ApiParam(name = "processId", value = "进程id") - @RequestParam Integer processId, - @ApiParam(name = "imgData", value = "base64图片编码") - @RequestParam String imgData){ + @PostMapping("/copySend") + public R copySend(@RequestBody CopySendRequest copySendRequest){ + Integer businessId = copySendRequest.getBusinessId(); + Integer processId = copySendRequest.getProcessId(); + String imgData = copySendRequest.getImgData(); try { boolean ok = copyForService.copySendUser(businessId,processId,imgData); return ok ? R.ok() : R.error(); diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgCopyUserController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgCopyUserController.java index fd7303cd..6c8e91b0 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgCopyUserController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgCopyUserController.java @@ -1,11 +1,21 @@ package com.daqing.financial.guarantee.controller; +import com.daqing.financial.guarantee.model.request.CopyForMeRequest; +import com.daqing.financial.guarantee.model.response.CopyForMeResponse; +import com.daqing.financial.guarantee.service.IDgCopyUserService; +import com.daqing.financial.guarantee.util.R; import io.swagger.annotations.Api; -import org.springframework.web.bind.annotation.RequestMapping; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; /** *

@@ -20,4 +30,24 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("/dg-copy-user") public class DgCopyUserController { + @Autowired + private IDgCopyUserService copyUserService; + + @ApiOperation("查询抄送我的") + @PostMapping("/queryCopyForMe") + public R queryCopyForMe(@RequestBody CopyForMeRequest copyForMeRequest){ + List copyForMeList = copyUserService.queryCopyForMe(copyForMeRequest); + return R.ok().data("copyForMeList",copyForMeList); + } + + @ApiOperation(value = "导出抄送我的列表") + @GetMapping("/exportCopyForMe") + public void queryCopyForMe(HttpServletResponse response){ + try { + copyUserService.exportCopyForMe(response); + } catch (IOException e) { + e.printStackTrace(); + } + } + } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java index 74b472ef..5e69fc06 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java @@ -1,26 +1,24 @@ package com.daqing.financial.guarantee.controller; - import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.daqing.financial.guarantee.feign.HrmsFeignService; -import com.daqing.financial.guarantee.model.response.PersonalEfficiencyListResponse; +import com.daqing.financial.guarantee.model.request.CopySendUserRequest; +import com.daqing.financial.guarantee.service.IDgProcessManageService; import com.daqing.financial.guarantee.service.IDgProcessUserService; import com.daqing.financial.guarantee.util.R; +import com.daqing.framework.domain.guarantee.DgProcessManage; import com.daqing.framework.domain.guarantee.DgProcessUser; import com.daqing.framework.model.response.ResponseResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.ArrayList; +import java.util.Date; import java.util.LinkedHashMap; import java.util.List; @@ -43,6 +41,9 @@ public class DgProcessUserController { @Autowired private HrmsFeignService hrmsFeignService; + @Autowired + private IDgProcessManageService processManageService; + @ApiOperation("根据进程id查询抄送用户") @GetMapping("/queryCopySendUser") public R queryCopySendUser( @@ -51,7 +52,6 @@ public class DgProcessUserController { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("process_id",processId).select("user_id"); List list = processUserService.list(wrapper); - List arr = new ArrayList<>(); for (DgProcessUser res : list) { arr.add(res.getUserId()); @@ -72,6 +72,30 @@ public class DgProcessUserController { return R.ok().data("userList",list); } + @ApiOperation("添加流程的抄送用户") + @PostMapping("/addCopySendUser") + public R addCopySendUser(@RequestBody CopySendUserRequest copySendUserRequest){ + boolean save = processUserService.saveCopySendUser(copySendUserRequest); + return save ? R.ok() : R.error(); + } + @ApiOperation(value = "删除流程的抄送用户") + @PostMapping("removeCopySendUser") + public R removeCopySendUser( + @ApiParam(name = "processId", value = "进程id", required = true) + @RequestParam("processId") String processId, + @ApiParam(name = "userId", value = "用户id", required = true) + @RequestParam("userId") String userId){ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("process_id",processId).eq("user_id",userId); + boolean remove = processUserService.remove(wrapper); + //更新流程管理的更新时间 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("id",processId); + DgProcessManage processManage = new DgProcessManage(); + processManage.setUpdateTime(new Date()); + processManageService.update(processManage,updateWrapper); + return remove ? R.ok() : R.error(); + } } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgCopyUserMapper.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgCopyUserMapper.java index 520da2f2..9aeb4dbe 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgCopyUserMapper.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgCopyUserMapper.java @@ -2,9 +2,13 @@ package com.daqing.financial.guarantee.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.daqing.financial.guarantee.model.request.CopyForMeRequest; +import com.daqing.financial.guarantee.model.response.CopyForMeResponse; import com.daqing.framework.domain.guarantee.DgCopyUser; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** *

* 抄送用户表 Mapper 接口 @@ -16,4 +20,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface DgCopyUserMapper extends BaseMapper { + List selectCopyForMe(CopyForMeRequest copyForMeRequest); } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopyForMeRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopyForMeRequest.java new file mode 100644 index 00000000..24a3db47 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopyForMeRequest.java @@ -0,0 +1,32 @@ +package com.daqing.financial.guarantee.model.request; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2021/1/18 9:57 + * @Version 1.0 + */ +@Data +public class CopyForMeRequest { + + @ApiModelProperty("申请时间,固定类型,0:今天,1:昨天,2:本周,3:本月,4:本年") + private Integer createFixedTime; + + @ApiModelProperty("客户名称") + private String clientName; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("起始时间") + private String startTime; + + @ApiModelProperty("用户id") + private Integer userId; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("结束时间") + private String endTime; + +} diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendRequest.java new file mode 100644 index 00000000..55b011ca --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendRequest.java @@ -0,0 +1,18 @@ +package com.daqing.financial.guarantee.model.request; + +import lombok.Data; + +/** + * @Author chen + * @DATE 2021/1/18 16:15 + * @Version 1.0 + */ +@Data +public class CopySendRequest { + + private Integer businessId; + + private Integer processId; + + private String imgData; +} diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendUserRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendUserRequest.java new file mode 100644 index 00000000..c1905c05 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendUserRequest.java @@ -0,0 +1,18 @@ +package com.daqing.financial.guarantee.model.request; + +import lombok.Data; + +import java.util.List; + +/** + * @Author chen + * @DATE 2021/1/18 9:33 + * @Version 1.0 + */ +@Data +public class CopySendUserRequest { + + private Integer processId; + + private List userIds; +} diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/CopyForMeResponse.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/CopyForMeResponse.java new file mode 100644 index 00000000..f5a2d200 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/CopyForMeResponse.java @@ -0,0 +1,61 @@ +package com.daqing.financial.guarantee.model.response; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.daqing.framework.utils.excel.BusinessStatusConverter; +import com.daqing.framework.utils.excel.TaskNodeConverter; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2021/1/18 9:56 + * @Version 1.0 + */ +@Data +public class CopyForMeResponse { + + @ExcelIgnore + @ApiModelProperty(value = "提单人id") + private Integer applicantId; + + @ExcelIgnore + @ApiModelProperty(value = "审批人id") + private Integer approveId; + + @ApiModelProperty(value = "提单人") + @ExcelProperty(value = "提单人",index = 0) + private String applicant; + + @ApiModelProperty("客户名称") + @ExcelProperty(value = "客户名称",index = 1) + private String clientName; + + @ApiModelProperty("申请日期") + @ExcelProperty(value = "申请日期",index = 2) + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private String applicationDate; + + @ApiModelProperty("任务节点") + @ExcelProperty(value = "任务节点",index = 3,converter = TaskNodeConverter.class) + private String taskNode; + + @ApiModelProperty("审批人") + @ExcelProperty(value = "审批人",index = 4) + private String approve; + + @ApiModelProperty("审批时间") + @ExcelProperty(value = "审批时间",index = 5) + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private String approveDate; + + @ApiModelProperty("业务状态") + @ExcelProperty(value = "业务状态",index = 6,converter = BusinessStatusConverter.class) + private Integer businessStatus; + + @ExcelIgnore + @ApiModelProperty("截图路径") + private String picUrl; + +} diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgCopyUserService.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgCopyUserService.java index 85ea827d..e190d190 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgCopyUserService.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgCopyUserService.java @@ -2,8 +2,14 @@ package com.daqing.financial.guarantee.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.financial.guarantee.model.request.CopyForMeRequest; +import com.daqing.financial.guarantee.model.response.CopyForMeResponse; import com.daqing.framework.domain.guarantee.DgCopyUser; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + /** *

* 抄送用户表 服务类 @@ -14,4 +20,7 @@ import com.daqing.framework.domain.guarantee.DgCopyUser; */ public interface IDgCopyUserService extends IService { + List queryCopyForMe(CopyForMeRequest copyForMeRequest); + + void exportCopyForMe(HttpServletResponse response) throws IOException; } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgProcessUserService.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgProcessUserService.java index 3fadb8af..7c5d4115 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgProcessUserService.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgProcessUserService.java @@ -2,6 +2,7 @@ package com.daqing.financial.guarantee.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.financial.guarantee.model.request.CopySendUserRequest; import com.daqing.framework.domain.guarantee.DgProcessUser; /** @@ -14,4 +15,5 @@ import com.daqing.framework.domain.guarantee.DgProcessUser; */ public interface IDgProcessUserService extends IService { + boolean saveCopySendUser(CopySendUserRequest copySendUserRequest); } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgCopyForServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgCopyForServiceImpl.java index 09a6576c..4df98a40 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgCopyForServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgCopyForServiceImpl.java @@ -1,7 +1,9 @@ package com.daqing.financial.guarantee.service.impl; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.daqing.financial.guarantee.mapper.DgCopyForMapper; import com.daqing.financial.guarantee.mapper.DgCopyUserMapper; import com.daqing.financial.guarantee.mapper.DgProcessUserMapper; @@ -46,21 +48,38 @@ public class DgCopyForServiceImpl extends ServiceImpl wrapperOne = new QueryWrapper<>(); + wrapperOne.eq("business_id",businessId).eq("process_id",processId); + DgCopyFor copyFor = baseMapper.selectOne(wrapperOne); + if (ObjectUtil.isNotNull(copyFor)){ + //更新数据 + DgCopyFor copyForUpdate = new DgCopyFor(); + copyForUpdate.setPicUrl(accessPath); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("business_id",businessId).eq("process_id",processId); + baseMapper.update(copyForUpdate, updateWrapper); + }else { + DgCopyFor copyForAdd = new DgCopyFor(); + copyForAdd.setBusinessId(businessId); + copyForAdd.setProcessId(processId); + copyForAdd.setPicUrl(accessPath); + //添加抄送详情 + baseMapper.insert(copyForAdd); + copyFor.setId(copyForAdd.getId()); + } + //取出抄送详情id Integer copyForId = copyFor.getId(); //查询该模块下需要抄送的用户id QueryWrapper wrapper = new QueryWrapper<>(); @@ -69,11 +88,17 @@ public class DgCopyForServiceImpl extends ServiceImpl { Integer userId = dgProcessUser.getUserId(); - DgCopyUser copyUser = new DgCopyUser(); - copyUser.setCopyId(copyForId); - copyUser.setUserId(userId); - //添加抄送关系 - copyUserMapper.insert(copyUser); + //已经抄送的用户无需再次抄送 + QueryWrapper wrapperCopyUser = new QueryWrapper<>(); + wrapperCopyUser.eq("user_id",userId).eq("copy_id",copyForId); + DgCopyUser dgCopyUser = copyUserMapper.selectOne(wrapperCopyUser); + if (ObjectUtil.isNull(dgCopyUser)){ + DgCopyUser copyUser = new DgCopyUser(); + copyUser.setCopyId(copyForId); + copyUser.setUserId(userId); + //添加抄送关系 + copyUserMapper.insert(copyUser); + } }); } return true; diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgCopyUserServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgCopyUserServiceImpl.java index d3401cc9..6428412a 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgCopyUserServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgCopyUserServiceImpl.java @@ -1,10 +1,30 @@ package com.daqing.financial.guarantee.service.impl; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.financial.guarantee.feign.HrmsFeignService; import com.daqing.financial.guarantee.mapper.DgCopyUserMapper; +import com.daqing.financial.guarantee.model.request.CopyForMeRequest; +import com.daqing.financial.guarantee.model.response.CopyForMeResponse; import com.daqing.financial.guarantee.service.IDgCopyUserService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.financial.guarantee.util.DateUtils; import com.daqing.framework.domain.guarantee.DgCopyUser; +import com.daqing.framework.model.response.ResponseResult; +import com.daqing.framework.util.RedisUtil; +import com.daqing.framework.utils.excel.EasyExcelUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.stream.Collectors; /** *

@@ -17,4 +37,96 @@ import org.springframework.stereotype.Service; @Service public class DgCopyUserServiceImpl extends ServiceImpl implements IDgCopyUserService { + @Autowired + private HrmsFeignService hrmsFeignService; + + @Override + public List queryCopyForMe(CopyForMeRequest copyForMeRequest) { + // 时间筛选(固定时间) + if (copyForMeRequest.getCreateFixedTime() != null && (copyForMeRequest.getStartTime() == null || + copyForMeRequest.getStartTime().length() == 0) && (copyForMeRequest.getEndTime() == null || + copyForMeRequest.getEndTime().length() == 0)) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + switch (copyForMeRequest.getCreateFixedTime()) { + case 0: + copyForMeRequest.setStartTime(dateFormat.format(DateUtils.getDayBegin())); + copyForMeRequest.setEndTime(dateFormat.format(DateUtils.getDayEnd()));// 今天 + break; + case 1: + copyForMeRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYesterday())); + copyForMeRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYesterDay()));// 昨天 + break; + case 2: + copyForMeRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfWeek())); + copyForMeRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfWeek()));// 本周 + break; + case 3: + copyForMeRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfMonth())); + copyForMeRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfMonth()));// 本月 + break; + case 4: + copyForMeRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYear())); + copyForMeRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYear()));// 本年 + break; + default: + copyForMeRequest.setStartTime(null); + copyForMeRequest.setEndTime(null); + } + } + String userId = this.getUserId(); + copyForMeRequest.setUserId(Integer.parseInt(userId)); + List copyForMeResponseList = baseMapper.selectCopyForMe(copyForMeRequest); + + if (copyForMeResponseList.size() > 0) { + List arr = new ArrayList<>(); + for (CopyForMeResponse res : copyForMeResponseList) { + Integer approveId = res.getApproveId(); + if (approveId!=null){ + arr.add(res.getApproveId()); + } + arr.add(res.getApplicantId()); + } + //去重 + List collect = arr.stream().distinct().collect(Collectors.toList()); + //根据提单人id查询其部门名称 + ResponseResult responseResult = hrmsFeignService.getAccountAndDeptNameById(collect); + List employeeMessage = null; + if (responseResult.getData() != null) { + employeeMessage = (List) responseResult.getData(); + } + + for (CopyForMeResponse response : copyForMeResponseList) { + for (LinkedHashMap res : employeeMessage) { + if (response.getApplicantId().equals(res.get("id"))) {//如果提单人id相同情况下,就往对象里面赋值 + response.setApplicant(JSONObject.toJSONString(res.get("account")).replace("\"", "")); + } + if (response.getApproveId()!=null){ + if (response.getApproveId().equals(res.get("id"))) {//如果审批人id相同情况下,就往对象里面赋值 + response.setApprove(JSONObject.toJSONString(res.get("account")).replace("\"", "")); + } + } + } + } + } + + return copyForMeResponseList; + } + + /** + * 获取当前登录用户信息 + */ + private String getUserId() { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String token = request.getHeader("token"); + return RedisUtil.get("dq:token:" + token); + } + + @Override + public void exportCopyForMe(HttpServletResponse response) throws IOException { + CopyForMeRequest copyForMeRequest = new CopyForMeRequest(); + String userId = this.getUserId(); + copyForMeRequest.setUserId(Integer.parseInt(userId)); + List copyForMeList = this.queryCopyForMe(copyForMeRequest); + EasyExcelUtil.download(response,CopyForMeResponse.class,copyForMeList,"我的抄送列表","第一页"); + } } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java index fb8cad4c..0a7cfb61 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java @@ -1,11 +1,19 @@ package com.daqing.financial.guarantee.service.impl; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.daqing.financial.guarantee.mapper.DgProcessManageMapper; import com.daqing.financial.guarantee.mapper.DgProcessUserMapper; +import com.daqing.financial.guarantee.model.request.CopySendUserRequest; import com.daqing.financial.guarantee.service.IDgProcessUserService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.framework.domain.guarantee.DgProcessManage; import com.daqing.framework.domain.guarantee.DgProcessUser; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; +import java.util.List; + /** *

* 业务模块选择抄送用户表 服务实现类 @@ -17,4 +25,25 @@ import org.springframework.stereotype.Service; @Service public class DgProcessUserServiceImpl extends ServiceImpl implements IDgProcessUserService { + @Autowired + private DgProcessManageMapper processManageMapper; + + @Override + public boolean saveCopySendUser(CopySendUserRequest copySendUserRequest) { + Integer processId = copySendUserRequest.getProcessId(); + List userIds = copySendUserRequest.getUserIds(); + userIds.forEach(userId -> { + DgProcessUser processUser = new DgProcessUser(); + processUser.setProcessId(processId); + processUser.setUserId(userId); + baseMapper.insert(processUser); + }); + //更新流程管理的更新时间 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("id",processId); + DgProcessManage processManage = new DgProcessManage(); + processManage.setUpdateTime(new Date()); + processManageMapper.update(processManage,updateWrapper); + return true; + } } diff --git a/dq-financial-guarantee/src/main/resources/bootstrap.properties b/dq-financial-guarantee/src/main/resources/bootstrap.properties index 69a06a1a..7d37225f 100644 --- a/dq-financial-guarantee/src/main/resources/bootstrap.properties +++ b/dq-financial-guarantee/src/main/resources/bootstrap.properties @@ -1,21 +1,26 @@ #服务名称 -#spring.application.name=dq-financial-guarantee -##配置中心地址 -#spring.cloud.nacos.config.server-addr=127.0.0.1:8848 -#spring.cloud.nacos.config.file-extension=yml -##redis配置 -#spring.redis.host=127.0.0.1 -#spring.redis.port=6379 -#spring.redis.password= -#spring.redis.database=0 -#spring.redis.timeout=30000 -#spring.redis.jedis.pool.max-active=8 -#spring.redis.jedis.pool.max-wait=-1 -#spring.redis.jedis.pool.max-idle=8 -#spring.redis.jedis.pool.min-idle=0 +spring.application.name=dq-financial-guarantee +#配置中心地址 +spring.cloud.nacos.config.server-addr=127.0.0.1:8848 +spring.cloud.nacos.config.file-extension=yml +#redis配置 +spring.redis.host=127.0.0.1 +spring.redis.port=6379 +spring.redis.password= +spring.redis.database=0 +spring.redis.timeout=30000 +spring.redis.jedis.pool.max-active=8 +spring.redis.jedis.pool.max-wait=-1 +spring.redis.jedis.pool.max-idle=8 +spring.redis.jedis.pool.min-idle=0 + +#设置请求头大小 +server.max-http-header-size=102400 + +server.tomcat.max-http-post-size=10MB #本地测试环境 -#spring.cloud.nacos.config.namespace=1520c5ea-5f15-4ac1-9eb1-d25924825b99 +spring.cloud.nacos.config.namespace=1520c5ea-5f15-4ac1-9eb1-d25924825b99 #线上测试环境 #spring.cloud.nacos.config.namespace=5698e60a-9d0b-433f-a69f-12b0a2d23128 @@ -36,29 +41,29 @@ ribbon.ConnectTimeout: 120000 # ##正式环境(prod) ##服务名称 -spring.application.name=dq-financial-guarantee -#配置中心地址 -spring.cloud.nacos.config.server-addr=120.78.127.12:8848 -spring.cloud.nacos.config.namespace=502bfc93-6e2f-44aa-93ad-f074664c6826 - -spring.cloud.nacos.config.ext-config[0].data-id=dq-financial-guarantee.yml -spring.cloud.nacos.config.ext-config[0].group=prod -spring.cloud.nacos.config.ext-config[0].refresh=true - -spring.cloud.nacos.config.ext-config[1].data-id=datasource.yml -spring.cloud.nacos.config.ext-config[1].group=prod -spring.cloud.nacos.config.ext-config[1].refresh=true - -spring.cloud.nacos.config.ext-config[2].data-id=mybatis.yml -spring.cloud.nacos.config.ext-config[2].group=prod -spring.cloud.nacos.config.ext-config[2].refresh=true - -spring.redis.host=127.0.0.1 -spring.redis.port=6379 -spring.redis.password=dq123456 -spring.redis.database=0 -spring.redis.timeout=30000 -spring.redis.jedis.pool.max-active=8 -spring.redis.jedis.pool.max-wait=-1 -spring.redis.jedis.pool.max-idle=8 -spring.redis.jedis.pool.min-idle=0 +#spring.application.name=dq-financial-guarantee +##配置中心地址 +#spring.cloud.nacos.config.server-addr=120.78.127.12:8848 +#spring.cloud.nacos.config.namespace=502bfc93-6e2f-44aa-93ad-f074664c6826 +# +#spring.cloud.nacos.config.ext-config[0].data-id=dq-financial-guarantee.yml +#spring.cloud.nacos.config.ext-config[0].group=prod +#spring.cloud.nacos.config.ext-config[0].refresh=true +# +#spring.cloud.nacos.config.ext-config[1].data-id=datasource.yml +#spring.cloud.nacos.config.ext-config[1].group=prod +#spring.cloud.nacos.config.ext-config[1].refresh=true +# +#spring.cloud.nacos.config.ext-config[2].data-id=mybatis.yml +#spring.cloud.nacos.config.ext-config[2].group=prod +#spring.cloud.nacos.config.ext-config[2].refresh=true +# +#spring.redis.host=127.0.0.1 +#spring.redis.port=6379 +#spring.redis.password=dq123456 +#spring.redis.database=0 +#spring.redis.timeout=30000 +#spring.redis.jedis.pool.max-active=8 +#spring.redis.jedis.pool.max-wait=-1 +#spring.redis.jedis.pool.max-idle=8 +#spring.redis.jedis.pool.min-idle=0 diff --git a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgCopyUserMapper.xml b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgCopyUserMapper.xml index 2e17964c..ab195f78 100644 --- a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgCopyUserMapper.xml +++ b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgCopyUserMapper.xml @@ -9,4 +9,43 @@ + + + + + + + + + + + + + diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgCopyFor.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgCopyFor.java index 325a5d72..1e85f5d7 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgCopyFor.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgCopyFor.java @@ -2,6 +2,7 @@ package com.daqing.framework.domain.guarantee; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import java.io.Serializable; import java.util.Date; @@ -14,6 +15,7 @@ import java.util.Date; * @author Qyq * @since 2021-01-15 */ +@Data @TableName("dg_copy_for") public class DgCopyFor implements Serializable { @@ -44,42 +46,8 @@ public class DgCopyFor implements Serializable { @TableField(fill = FieldFill.INSERT) private Date createTime; - public Integer getId() { - return id; - } + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; - public void setId(Integer id) { - this.id = id; - } - public Integer getBusinessId() { - return businessId; - } - - public void setBusinessId(Integer businessId) { - this.businessId = businessId; - } - public Integer getProcessId() { - return processId; - } - - public void setProcessId(Integer processId) { - this.processId = processId; - } - public String getPicUrl() { - return picUrl; - } - - public void setPicUrl(String picUrl) { - this.picUrl = picUrl; - } - - @Override - public String toString() { - return "DgCopyFor{" + - "id=" + id + - ", businessId=" + businessId + - ", processId=" + processId + - ", picUrl=" + picUrl + - "}"; - } } From 02de2d781750bfd061229e4b2f16ef1b5b89973c Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Tue, 19 Jan 2021 18:21:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../financial/guarantee/controller/DgProcessUserController.java | 2 +- .../com/daqing/framework/domain/guarantee/DgProcessUser.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java index 5e69fc06..5e292c4c 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java @@ -50,7 +50,7 @@ public class DgProcessUserController { @ApiParam(name = "processId", value = "进程id") @RequestParam Integer processId){ QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("process_id",processId).select("user_id"); + wrapper.eq("process_id",processId); List list = processUserService.list(wrapper); List arr = new ArrayList<>(); for (DgProcessUser res : list) { diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgProcessUser.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgProcessUser.java index acfd1fb1..84013d02 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgProcessUser.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgProcessUser.java @@ -1,6 +1,7 @@ package com.daqing.framework.domain.guarantee; import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -39,6 +40,7 @@ public class DgProcessUser implements Serializable { @ApiModelProperty(value = "创建时间") @TableField(fill = FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; @TableField(exist = false)