diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupController.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupController.java new file mode 100644 index 00000000..efe2859e --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupController.java @@ -0,0 +1,246 @@ +package com.jero.drafting.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.jero.common.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.service.RolePermissionService; +import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.ValidUtil; +import com.jero.common.util.oConvertUtils; +import com.jero.drafting.entity.PayDraftingGroup; +import com.jero.drafting.service.IPayDraftingGroupService; +import com.jero.drafting.vo.PayDraftingGroupVo; +import com.jero.project.common.PayProjectCommon; +import com.jero.project.entity.PayWorkingGroup; +import com.jero.project.service.IPayWorkingGroupService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 起草组表 前端控制器 + *

+ * + * @author sz + * @since 2024-01-02 + */ +@Api(tags = "起草组项目") +@RestController +@RequestMapping("/drafting/payDraftingGroup") +@Slf4j +public class PayDraftingGroupController extends JeroController { + + @Resource + private IPayDraftingGroupService payDraftingGroupService; + @Resource + private RolePermissionService rolePermissionService; + @Resource + private IPayWorkingGroupService payWorkingGroupService; + + /** + * 分页列表查询 + * + * @param payDraftingGroup 起草组项目 + * @param pageNo 页数 + * @param pageSize 条数 + */ +// @RequiresPermissions("draftingGroupProject:search") + @ApiOperation(value="起草组项目-分页列表查询", notes="起草组项目-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(PayDraftingGroup payDraftingGroup, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) { + // 校验参数 + if(!StringUtils.isBlank(payDraftingGroup.getDraftingGroupProject()) && payDraftingGroup.getDraftingGroupProject().length() > 50){ + return Result.error("起草组项目长度不能大于50个字符"); + } + + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if(!rolePermissionService.getRolePermission("draftingGroupProject:search")){ + payDraftingGroup.setPrincipalA(sysUser.getId()); + payDraftingGroup.setPrincipalB(sysUser.getId()); + } + + // 分页条件查询 + Page page = new Page<>(pageNo, pageSize); + if(!StringUtils.isBlank(payDraftingGroup.getDraftingGroupProject())){ + payDraftingGroup.setDraftingGroupProject(oConvertUtils.replaceAllPercent(payDraftingGroup.getDraftingGroupProject())); + } + + IPage pageList = payDraftingGroupService.queryPageList(page,payDraftingGroup); + if (!Objects.isNull(pageList)) { + List listPayDraftingGroupVo = pageList.getRecords(); + if (!CollectionUtils.isEmpty(listPayDraftingGroupVo)) { + listPayDraftingGroupVo.forEach(p->{ + if(!rolePermissionService.getRolePermission("generalProject:search") && Objects.equals(p.getPrincipalIdB(),sysUser.getId())){ + p.setCheckoutOperation(PayProjectCommon.CHECKOUT_OPERATION2); + }else{ + p.setCheckoutOperation(PayProjectCommon.CHECKOUT_OPERATION1); + } + // 根据工作组id查询对应的工作组名称 + if (StringUtils.isNotBlank(p.getWorkingGroupId())) { + PayWorkingGroup payWorkingGroup = payDraftingGroupService.getPayWorkingGroupNameById(p.getWorkingGroupId()); + if (!Objects.isNull(payWorkingGroup)) { + p.setWorkingGroupName(payWorkingGroup.getWorkingGroupProject()); + } + } + }); + pageList.setRecords(listPayDraftingGroupVo); + } + } + + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param payDraftingGroup 起草组项目 + * @return + */ + @AutoLog(value = "起草组项目-添加",operateType = 1) +// @RequiresPermissions("draftingGroupProject:add") + @ApiOperation(value="起草组项目-添加", notes="起草组项目-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody PayDraftingGroup payDraftingGroup) { + // 参数校验 + StringBuilder msg = ValidUtil.validateAll(payDraftingGroup); + if(!StringUtils.isBlank(msg)){ + return Result.error(msg.toString()); + } + try { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PayDraftingGroup::getDraftingGroupProject,payDraftingGroup.getDraftingGroupProject()); + PayDraftingGroup payDraftingGroupDB = payDraftingGroupService.getOne(queryWrapper); + if(!Objects.isNull(payDraftingGroupDB)) { + return Result.error("起草组项目已存在!"); + } + }catch (Exception e){ + log.info("起草组项目-添加",e); + return Result.error("起草组项目已存在!"); + } + payDraftingGroupService.setPayDraftingGroup(payDraftingGroup); + payDraftingGroupService.save(payDraftingGroup); + return Result.OK("添加成功!"); + } + + /** + * 通过id删除 + * + * @param id 工作组项目id + * @return + */ + @AutoLog(value = "起草组项目-通过id删除",operateType = 2) +// @RequiresPermissions("draftingGroupProject:delete") + @ApiOperation(value="起草组项目-通过id删除", notes="起草组项目-通过id删除") + @GetMapping(value = "/delete") + public Result delete(@RequestParam(name="id") String id) { + if(StringUtils.isBlank(id)){ + return Result.error("id不能为空!"); + } + payDraftingGroupService.deleteById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids 起草组项目ids 逗号分隔 + * @return + */ +// @RequiresPermissions("draftingGroupProject:batchDel") + @ApiOperation(value="起草组项目-批量删除", notes="起草组项目-批量删除") + @GetMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids") String ids) { + if(StringUtils.isBlank(ids)){ + return Result.error("id不能为空!"); + } + String[] s = ids.split(","); + for (String s1 : s) { + if(StringUtils.isBlank(s1)){ + return Result.error("id不能为空!"); + } + } + payDraftingGroupService.deleteByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 复制 + * + * @param payDraftingGroup 起草组项目 + * @return + */ + @AutoLog(value = "起草组项目-复制",operateType = 3) +// @RequiresPermissions("draftingGroupProject:copy") + @ApiOperation(value="起草组项目-复制", notes="起草组项目-复制") + @PostMapping(value = "/copy") + public Result copy(@RequestBody PayDraftingGroup payDraftingGroup) { + if(StringUtils.isBlank(payDraftingGroup.getId())){ + return Result.error("起草组id不能为空!"); + } + PayDraftingGroup payDraftingGroupOld = payDraftingGroupService.getById(payDraftingGroup.getId()); + if(Objects.isNull(payDraftingGroupOld)){ + return Result.error("起草组不存在!"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if(!rolePermissionService.getRolePermission("draftingGroupProject:copy") && !Objects.equals(payDraftingGroupOld.getPrincipalIdA(),sysUser.getId())){ + return Result.error(payDraftingGroupOld.getDraftingGroupProject() + "数据权限不足!"); + } + payDraftingGroupService.copy(payDraftingGroup); + return Result.OK("复制成功!"); + } + + /** + * 通过id查询 + * + * @param id 起草组项目id + * @return + */ + @ApiOperation(value="起草组项目-通过id查询", notes="起草组项目-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id") String id) { + if (StringUtils.isBlank(id)) { + return Result.error("起草组id不能为空"); + } + PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(id); + if(Objects.isNull(payDraftingGroup)) { + return Result.error("未找到对应数据"); + } + return Result.OK(payDraftingGroup); + } + + /** + * 查询所有工作组 + * @return + */ + @ApiOperation(value="工作组项目-查询所有工作组", notes="工作组项目-查询所有工作组") + @GetMapping(value = "/queryAllWorkingGroupsIdAndName") + public Result queryAllWorkingGroupsIdAndName() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("id","working_group_project"); + queryWrapper.lambda().groupBy(PayWorkingGroup::getWorkingGroupProject); + List payWorkingGroups = payWorkingGroupService.list(queryWrapper); + List> mapList = payWorkingGroups.stream().map(p -> { + HashMap map = new HashMap<>(); + map.put("id", p.getId()); + map.put("workingGroupProject", p.getWorkingGroupProject()); + return map; + }).collect(Collectors.toList()); + return Result.OK(mapList); + } +} \ No newline at end of file diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupSubItemContactsController.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupSubItemContactsController.java new file mode 100644 index 00000000..40c10a14 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupSubItemContactsController.java @@ -0,0 +1,27 @@ +package com.jero.drafting.controller; + +import com.jero.common.system.base.controller.JeroController; +import com.jero.drafting.entity.PayDraftingGroupSubItem; +import com.jero.drafting.entity.PayDraftingGroupSubItemContacts; +import com.jero.drafting.service.IPayDraftingGroupSubItemContactsService; +import com.jero.drafting.service.IPayDraftingGroupSubItemService; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 起草组成员企业联系人表 前端控制器 + *

+ * + * @author sz + * @since 2024-01-02 + */ +@Api(tags="起草组成员") +@RestController +@RequestMapping("/drafting/payDraftingGroupSubitemContacts") +@Slf4j +public class PayDraftingGroupSubItemContactsController extends JeroController { + +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupSubItemController.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupSubItemController.java new file mode 100644 index 00000000..5bf2b149 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/controller/PayDraftingGroupSubItemController.java @@ -0,0 +1,372 @@ +package com.jero.drafting.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.jero.common.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.exception.JeroBootException; +import com.jero.common.service.ProjectDetailService; +import com.jero.common.service.RolePermissionService; +import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.PasswordUtil; +import com.jero.common.util.ValidUtil; +import com.jero.common.util.oConvertUtils; +import com.jero.common.vo.ProjectDetailVO; +import com.jero.drafting.entity.PayDraftingGroup; +import com.jero.drafting.entity.PayDraftingGroupSubItem; +import com.jero.drafting.entity.PayDraftingGroupSubItemContacts; +import com.jero.drafting.service.IPayDraftingGroupService; +import com.jero.drafting.service.IPayDraftingGroupSubItemContactsService; +import com.jero.drafting.service.IPayDraftingGroupSubItemService; +import com.jero.drafting.vo.PayDraftingGroupSubItemExcel; +import com.jero.modules.system.service.ISysUserService; +import com.jero.project.entity.PayWorkingGroup; +import com.jero.project.entity.PayWorkingGroupSubItem; +import com.jero.project.entity.PayWorkingGroupSubItemContacts; +import com.jero.project.vo.excel.PayWorkingGroupSubItemExcel; +import com.jero.temporary.entity.PayContactsManagementTemporary; +import com.jero.temporary.service.IPayContactsManagementTemporaryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 起草组成员表 前端控制器 + *

+ * + * @author sz + * @since 2024-01-02 + */ +@Api(tags="起草组成员") +@RestController +@RequestMapping("/drafting/payDraftingGroupSubitem") +@Slf4j +public class PayDraftingGroupSubItemController extends JeroController { + + @Resource + private IPayDraftingGroupService payDraftingGroupService; + @Resource + private IPayDraftingGroupSubItemService payDraftingGroupSubItemService; + @Resource + private IPayDraftingGroupSubItemContactsService payDraftingGroupSubItemContactsService; + @Resource + private RolePermissionService rolePermissionService; + @Resource + private IPayContactsManagementTemporaryService payContactsManagementTemporaryService; + + /** + * 分页列表查询 + * + * @param payDraftingGroupSubItem 起草组成员 + * @param pageNo 页数 + * @param pageSize 条数 + * @param paymentDate 日期 + * @return + */ +// @RequiresPermissions("draftingGroupMember:search") + @ApiOperation(value = "起草组成员-分页列表查询", notes = "起草组成员-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(PayDraftingGroupSubItem payDraftingGroupSubItem, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + @RequestParam(name = "paymentDate", required = false) String paymentDate) { + if (!StringUtils.isBlank(payDraftingGroupSubItem.getChargeCompanyTemporaryName()) && payDraftingGroupSubItem.getChargeCompanyTemporaryName().length() > 50) { + return Result.error("成员单位长度不能大于50个字符"); + } + if (StringUtils.isBlank(payDraftingGroupSubItem.getDraftingGroupId())) { + return Result.error("起草组id不能为空!"); + } + if(!StringUtils.isBlank(payDraftingGroupSubItem.getChargeCompanyTemporaryName())){ + payDraftingGroupSubItem.setChargeCompanyTemporaryName(oConvertUtils.replaceAllPercent(payDraftingGroupSubItem.getChargeCompanyTemporaryName())); + } + PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(payDraftingGroupSubItem.getDraftingGroupId()); + if(Objects.isNull(payDraftingGroup)){ + return Result.error("起草组不存在!"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if(!rolePermissionService.getRolePermission("draftingGroupMember:search") && !Objects.equals(payDraftingGroup.getPrincipalIdA(),sysUser.getId())){ + return Result.error("数据权限不足!"); + } + Page page = new Page<>(pageNo, pageSize); + IPage pageList = payDraftingGroupSubItemService.queryPageList(page, payDraftingGroupSubItem, paymentDate); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param payDraftingGroupSubItem 起草组成员 + * @return + */ + @AutoLog(value = "起草组成员-添加",operateType = 2) +// @RequiresPermissions("draftingGroupMember:add") + @ApiOperation(value = "起草组成员-添加", notes = "起草组成员-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody PayDraftingGroupSubItem payDraftingGroupSubItem) { + StringBuilder msg = ValidUtil.validateAll(payDraftingGroupSubItem); + if (!StringUtils.isBlank(msg)) { + return Result.error(msg.toString()); + } + payDraftingGroupSubItemService.addPayDraftingGroupSubItem(payDraftingGroupSubItem); + return Result.OK("添加成功!"); + } + + /** + * 通过id删除 + * + * @param id 起草组成员id + * @return + */ + @AutoLog(value = "起草组成员-删除",operateType = 4) +// @RequiresPermissions("draftingGroupMember:delete") + @ApiOperation(value = "起草组成员-通过id删除", notes = "起草组成员-通过id删除") + @GetMapping(value = "/delete") + public Result delete(@RequestParam(name = "id") String id) { + payDraftingGroupSubItemService.delete(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids 起草组成员ids 逗号分隔 + * @return + */ +// @RequiresPermissions("draftingGroupMember:batchDel") + @ApiOperation(value = "起草组成员-批量删除", notes = "起草组成员-批量删除") + @GetMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids") String ids) { + payDraftingGroupSubItemService.deleteBatch(ids); + return Result.OK("批量删除成功!"); + } + + /** + * 编辑 + * + * @param payDraftingGroupSubItem 工作组成员 + * @return + */ + @AutoLog(value = "工作组成员-修改",operateType = 3) +// @RequiresPermissions("draftingGroupMember:edit") + @ApiOperation(value = "工作组成员-编辑", notes = "工作组成员-编辑") + @PostMapping(value = "/edit") + public Result edit(@RequestBody PayDraftingGroupSubItem payDraftingGroupSubItem) { + StringBuilder msg = ValidUtil.validateAll(payDraftingGroupSubItem); + if (!StringUtils.isBlank(msg)) { + return Result.error(msg.toString()); + } + payDraftingGroupSubItemService.editPayWorkingGroupSubItem(payDraftingGroupSubItem); + return Result.OK("编辑成功!"); + } + +// /** +// * 通过id查询 +// * +// * @param id 起草组成员 +// * @return +// */ +// @ApiOperation(value = "起草组成员-通过id查询", notes = "起草组成员-通过id查询") +// @GetMapping(value = "/queryById") +// public Result queryById(@RequestParam(name = "id") String id) { +// PayDraftingGroupSubItem payDraftingGroupSubitem = payDraftingGroupSubItemService.getById(id); +// if (payDraftingGroupSubitem == null) { +// return Result.error("未找到对应数据"); +// } +// ProjectDetailVO projectDetailVO = projectDetailService.getProjectDetail(payDraftingGroupSubitem.getId()); +// return Result.OK(projectDetailVO); +// } + + /** + * 模板下载 + * + * @return + */ +// @RequiresPermissions("draftingGroupMember:downTemplate") + @ApiOperation(value = "起草组成员-模板下载", notes = "起草组成员-模板下载") + @GetMapping(value = "/downloadExcelModel") + public ModelAndView downloadExcelModel() { + return super.exportTemplate(PayDraftingGroupSubItem.class, "起草组成员导入模板"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @return + */ + @AutoLog(value = "起草组成员-excel导入数据",operateType = 5) +// @RequiresPermissions("draftingGroupMember:import") + @PostMapping(value = "/importExcel") + @ApiOperation(value = "起草组成员-通过excel导入数据", notes = "起草组成员-通过excel导入数据") + public Result importExcel(HttpServletRequest request) { + List excelData = super.getExcelData(request, PayDraftingGroupSubItem.class); + if (excelData.isEmpty()) { + throw new JeroBootException("导入数据为空,请填写数据之后重新导入!"); + } + payDraftingGroupSubItemService.importExcel(request); + return Result.OK("文件导入成功!"); + } + + /** + * 导出excel + * + * @param request + * @param payDraftingGroupSubItem 起草组成员 + */ + @AutoLog(value = "起草组成员-导出excel",operateType = 6) +// @RequiresPermissions("draftingGroupMember:export") + @GetMapping(value = "/exportXls") + @ApiOperation(value = "起草组成员-导出excel", notes = "起草组成员-导出excel") + public ModelAndView exportXls(HttpServletRequest request, + PayDraftingGroupSubItem payDraftingGroupSubItem, + @RequestParam(name = "paymentDate", required = false) String paymentDate) { + PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(payDraftingGroupSubItem.getDraftingGroupId()); + if(Objects.isNull(payDraftingGroup)){ + throw new JeroBootException("起草组不存在!"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if(!rolePermissionService.getRolePermission("draftingGroupMember:export") + && !Objects.equals(payDraftingGroup.getPrincipalIdA(),sysUser.getId()) + && !Objects.equals(payDraftingGroup.getPrincipalIdB(),sysUser.getId())){ + throw new JeroBootException("数据权限不足!"); + } + // Step.2 获取导出数据 + Page page = new Page<>(-1, -1); + IPage payWorkingGroupSubItemIPage = payDraftingGroupSubItemService.queryPageList(page, payDraftingGroupSubItem, paymentDate); + List pageList = payWorkingGroupSubItemIPage.getRecords(); + List exportList; + + // 过滤选中数据 + String selections = request.getParameter("selections"); + if (oConvertUtils.isNotEmpty(selections)) { + List selectionList = Arrays.asList(selections.split(",")); + exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); + } else { + exportList = pageList; + } + List excelList = new ArrayList<>(); + if(!CollectionUtils.isEmpty(exportList)){ + // 拿到所有的起草组成员id的list + List listDGSIds = exportList.stream().map(PayDraftingGroupSubItem::getId).collect(Collectors.toList()); + LambdaQueryWrapper queryPayDraftingGroupSubItemContacts = new LambdaQueryWrapper<>(); + queryPayDraftingGroupSubItemContacts.in(PayDraftingGroupSubItemContacts::getDraftingGroupSubId,listDGSIds); + // 拿到所有起草组成员对应的起草组联系人信息 + List payDraftingGroupSubItemContactsList = payDraftingGroupSubItemContactsService.list(queryPayDraftingGroupSubItemContacts); + for (PayDraftingGroupSubItem draftingGroupSubItem : exportList) { + PayDraftingGroupSubItemExcel excel = new PayDraftingGroupSubItemExcel(); + BeanUtils.copyProperties(draftingGroupSubItem,excel); + // 拿到该成员对应联系人信息的list + List listPayDraftingGroupSubItemContacts = payDraftingGroupSubItemContactsList.stream().filter(o->Objects.equals(draftingGroupSubItem.getId(),o.getDraftingGroupSubId())).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listPayDraftingGroupSubItemContacts)){ + listPayDraftingGroupSubItemContacts.sort(Comparator.comparing(PayDraftingGroupSubItemContacts::getOrderNum)); + // 拿到该名成员对应的联系人的id的list + List listIds = listPayDraftingGroupSubItemContacts.stream().map(PayDraftingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); + // 拿到所有联系人信息对应的详情信息 + List listPayContactsManagementTemporary = payContactsManagementTemporaryService.listByIds(listIds); + for (int i = 0; i < listPayDraftingGroupSubItemContacts.size(); i++) { + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = listPayDraftingGroupSubItemContacts.get(i); + // 拿到该联系人的详情信息 + List temporary = listPayContactsManagementTemporary.stream().filter(s->Objects.equals(s.getId(),payDraftingGroupSubItemContacts.getContactsTemporaryId())).collect(Collectors.toList()); + String email = ""; + String phone = ""; + String name = payDraftingGroupSubItemContacts.getContactsTemporaryName(); + String remark = payDraftingGroupSubItemContacts.getRemarks(); + if(!CollectionUtils.isEmpty(temporary)){ + email = temporary.get(0).getEmail(); + // 解密 + if (StringUtils.isNotBlank(email)){ + email = PasswordUtil.decrypt(email); + } + phone = temporary.get(0).getPhone(); + if (StringUtils.isNotBlank(phone)){ + phone = PasswordUtil.decrypt(phone); + } + } + switch (i){ + case 0: + excel.setContactsNameOne(name); + excel.setRemarksOne(remark); + excel.setContactsEmailOne(email); + excel.setContactsPhoneOne(phone); + break; + case 1: + excel.setContactsNameTwo(name); + excel.setRemarksTwo(remark); + excel.setContactsEmailTwo(email); + excel.setContactsPhoneTwo(phone); + break; + case 2: + excel.setContactsNameThree(name); + excel.setRemarksThree(remark); + excel.setContactsEmailThree(email); + excel.setContactsPhoneThree(phone); + break; + case 3: + excel.setContactsNameFour(name); + excel.setRemarksFour(remark); + excel.setContactsEmailFour(email); + excel.setContactsPhoneFour(phone); + break; + case 4: + excel.setContactsNameFive(name); + excel.setRemarksFive(remark); + excel.setContactsEmailFive(email); + excel.setContactsPhoneFive(phone); + break; + case 5: + excel.setContactsNameSix(name); + excel.setRemarksSix(remark); + excel.setContactsEmailSix(email); + excel.setContactsPhoneSix(phone); + break; + case 6: + excel.setContactsNameSeven(name); + excel.setRemarksSeven(remark); + excel.setContactsEmailSeven(email); + excel.setContactsPhoneSeven(phone); + break; + case 7: + excel.setContactsNameEight(name); + excel.setRemarksEight(remark); + excel.setContactsEmailEight(email); + excel.setContactsPhoneEight(phone); + break; + case 8: + excel.setContactsNameNine(name); + excel.setRemarksNine(remark); + excel.setContactsEmailNine(email); + excel.setContactsPhoneNine(phone); + break; + case 9: + excel.setContactsNameTen(name); + excel.setRemarksTen(remark); + excel.setContactsEmailTen(email); + excel.setContactsPhoneTen(phone); + break; + default:break; + } + } + } + excelList.add(excel); + System.err.println(excelList); + } + } + return super.exportListXls(excelList, PayDraftingGroupSubItemExcel.class, "起草组成员"); + } +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroup.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroup.java new file mode 100644 index 00000000..cd76a916 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroup.java @@ -0,0 +1,150 @@ +package com.jero.drafting.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.time.LocalDateTime; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +/** + *

+ * 起草组表 + *

+ * + * @author sz + * @since 2024-01-02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("pay_drafting_group") +@ApiModel(value="PayDraftingGroup对象", description="起草组表") +public class PayDraftingGroup implements Serializable { + + private static final long serialVersionUID = 1L; + + /**主键*/ + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /**起草组项目*/ + @Excel(name = "起草组项目", width = 15) + @ApiModelProperty(value = "起草组项目") + @NotEmpty(message = "起草组项目不能为空") + @Size(max = 50,message = "起草组项目长度不能大于50个字符") + private String draftingGroupProject; + + @ApiModelProperty(value = "工作组id") + @NotEmpty(message = "工作组id不能为空") + @Size(max = 50,message = "工作组id长度不能大于50个字符") + private String workingGroupId; + /**运行年份*/ + @Excel(name = "运行年份", width = 15) + @ApiModelProperty(value = "运行年份") + @NotEmpty(message = "运行年份不能为空") + @Pattern(regexp = "^\\d{4}$",message = "运行年份格式错误") + private String year; + + /**负责人Aid*/ + @Excel(name = "负责人Aid", width = 15) + @ApiModelProperty(value = "负责人Aid") + @NotEmpty(message = "负责人Aid不能为空") + @Size(max = 32,message = "负责人Aid长度不能大于32个字符") + private String principalIdA; + + /**负责人名称A*/ + @Excel(name = "负责人名称A", width = 15) + @ApiModelProperty(value = "负责人名称A") + private String principalNameA; + + /**负责人Aid*/ + @Excel(name = "负责人Bid", width = 15) + @ApiModelProperty(value = "负责人Bid") + @NotEmpty(message = "负责人Bid不能为空") + @Size(max = 32,message = "负责人Bid长度不能大于32个字符") + private String principalIdB; + + /**负责人名称A*/ + @Excel(name = "负责人名称N", width = 15) + @ApiModelProperty(value = "负责人名称B") + private String principalNameB; + + /**每年召开次数*/ + @Excel(name = "每年召开次数", width = 15) + @ApiModelProperty(value = "每年召开次数") + @Size(max = 50,message = "每年召开次数长度不能大于50个字符") + private String convokeNum; + + /**运行周期*/ + @Excel(name = "运行周期", width = 15) + @ApiModelProperty(value = "运行周期") + @Size(max = 50,message = "运行周期长度不能大于50个字符") + private String operationCycle; + + /**任务及目标*/ + @Excel(name = "任务及目标", width = 15) + @ApiModelProperty(value = "任务及目标") + @Size(max = 200,message = "任务及目标长度不能大于200个字符") + private String missionAndObjectives; + + /**备注*/ + @Excel(name = "备注", width = 15) + @ApiModelProperty(value = "备注") + @Size(max = 200,message = "备注长度不能大于200个字符") + private String remarks; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + + /**创建时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private Date createTime; + + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + + /**更新时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + /** + * 负责人A(用于权限查询) + */ + @TableField(exist = false) + private String principalA; + + /** + * 负责人B(用于权限查询) + */ + @TableField(exist = false) + private String principalB; + + @TableField(exist = false) + @ApiModelProperty(value = "企业联系人") + private String companyContactName; + + @TableField(exist = false) + @ApiModelProperty(value = "企业名称") + private String companyName; + +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroupSubItem.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroupSubItem.java new file mode 100644 index 00000000..30ef7f3a --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroupSubItem.java @@ -0,0 +1,415 @@ +package com.jero.drafting.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.jero.common.aspect.annotation.Dict; +import com.jero.contract.entity.PayIncomeContract; +import com.jero.project.entity.PayWorkingGroupSubItemContacts; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.Date; +import java.util.List; + +/** + * @Description: 起草组成员表 实体 + * @Author: sz + * @Date: 2024-01-02 + * @Version: V1.0 + */ +@Data +@TableName("pay_drafting_group_subitem") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="pay_drafting_group_subitem对象", description="pay_drafting_group_subitem") +public class PayDraftingGroupSubItem implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + + /**来款项目*/ + @ApiModelProperty(value = "来款项目") + @TableField(exist = false) + private String chargeProject; + + /**起草组id*/ + @ApiModelProperty(value = "起草组id") + @Size(max = 32,message = "起草组id长度不能大于32个字符") + private String draftingGroupId; + + /**成员单位id*/ + @ApiModelProperty(value = "成员单位id") + @Size(max = 32,message = "成员单位id长度不能大于32个字符") + private String chargeCompanyId; + + /**临时成员单位id*/ + @ApiModelProperty(value = "临时成员单位id") + private String chargeCompanyTemporaryId; + + /**临时成员单位*/ + @Excel(name = "成员单位", width = 15) + @ApiModelProperty(value = "临时成员单位") + private String chargeCompanyTemporaryName; + + /**企业联系人1id*/ + @ApiModelProperty(value = "企业联系人1id") + @Size(max = 32,message = "企业联系人1id长度不能大于32个字符") + private String contactsIdOne; + + /**临时企业联系人1id*/ + @ApiModelProperty(value = "临时企业联系人1id") + private String contactsTemporaryIdOne; + + /**临时企业联系人1名称*/ + @ApiModelProperty(value = "临时企业联系人1名称") + private String contactsTemporaryNameOne; + + /**企业联系人2id*/ + @Size(max = 32,message = "企业联系人2id长度不能大于32个字符") + private String contactsIdTwo; + + /**临时企业联系人2id*/ + @ApiModelProperty(value = "临时企业联系人2id") + private String contactsTemporaryIdTwo; + + /**临时企业联系人2名称*/ + @ApiModelProperty(value = "临时企业联系人2名称") + private String contactsTemporaryNameTwo; + + /**企业联系人3id*/ + @Size(max = 32,message = "企业联系人3id长度不能大于32个字符") + private String contactsIdThree; + + /**临时企业联系人3id*/ + @ApiModelProperty(value = "临时企业联系人3id") + private String contactsTemporaryIdThree; + + /**临时企业联系人3名称*/ + @ApiModelProperty(value = "临时企业联系人3名称") + private String contactsTemporaryNameThree; + + /**备注*/ + @Excel(name = "备注", width = 15) + @ApiModelProperty(value = "备注") + @Size(max = 200,message = "备注长度不能大于200个字符") + private String remarks; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + + /**创建时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private Date createTime; + + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + + /**更新时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + /** + * 企业联系人列表 + */ + @ApiModelProperty(value = "企业联系人列表") + @TableField(exist = false) + private List payDraftingGroupSubItemContactsList; + + /**项目ids 多个以逗号分隔*/ + @TableField(exist = false) + @ApiModelProperty(value = "项目ids 多个以逗号分隔") + private String projectIds; + /**会议id*/ + @TableField(exist = false) + private String meetingId; + /** + * 负责人 + */ + @TableField(exist = false) + @ApiModelProperty(value = "负责人") + private String principalName; + /**负责人联系电话*/ + @TableField(exist = false) + @ApiModelProperty(value = "负责人联系电话") + private String principalPhone; + /**负责人邮箱*/ + @TableField(exist = false) + @ApiModelProperty(value = "负责人邮箱") + private String principalEmail; + /** + * 运行年份 + */ + @TableField(exist = false) + @ApiModelProperty(value = "运行年份") + private String year; + /**运行周期*/ + @ApiModelProperty(value = "运行周期") + @TableField(exist = false) + private String operationCycle; + /**任务及目标*/ + @ApiModelProperty(value = "任务及目标") + @TableField(exist = false) + private String missionAndObjectives; + + /**企业联系人1名称*/ + @Excel(name = "企业联系人1", width = 15) + @ApiModelProperty(value = "企业联系人1") + @TableField(exist = false) + private String contactsNameOne; + /** + * 企业联系人1手机号 + */ + @Excel(name = "企业联系人1手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneOne; + /** + * 企业联系人1邮箱 + */ + @Excel(name = "企业联系人1邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailOne; + /**联系人1备注*/ + @Excel(name = "联系人1备注", width = 15) + @ApiModelProperty(value = "联系人1备注") + @Size(max = 50,message = "联系人1备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksOne; + + /**企业联系人2名称*/ + @Excel(name = "企业联系人2", width = 15) + @ApiModelProperty(value = "企业联系人2") + @TableField(exist = false) + private String contactsNameTwo; + /** + * 企业联系人2手机号 + */ + @Excel(name = "企业联系人2手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneTwo; + /** + * 企业联系人2邮箱 + */ + @Excel(name = "企业联系人2邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailTwo; + /**联系人2备注*/ + @Excel(name = "联系人2备注", width = 15) + @ApiModelProperty(value = "联系人2备注") + @Size(max = 50,message = "联系人2备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksTwo; + + /**企业联系人3名称*/ + @Excel(name = "企业联系人3", width = 15) + @ApiModelProperty(value = "企业联系人3") + @TableField(exist = false) + private String contactsNameThree; + /** + * 企业联系人3手机号 + */ + @Excel(name = "企业联系人3手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneThree; + /** + * 企业联系人3邮箱 + */ + @Excel(name = "企业联系人3邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailThree; + /**联系人3备注*/ + @Excel(name = "联系人3备注", width = 15) + @ApiModelProperty(value = "联系人3备注") + @Size(max = 50,message = "联系人3备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksThree; + + /**企业联系人4名称*/ + @Excel(name = "企业联系人4", width = 15) + @ApiModelProperty(value = "企业联系人4") + @TableField(exist = false) + private String contactsNameFour; + /** + * 企业联系人4手机号 + */ + @Excel(name = "企业联系人4手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneFour; + /** + * 企业联系人4邮箱 + */ + @Excel(name = "企业联系人4邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailFour; + /**联系人4备注*/ + @Excel(name = "联系人4备注", width = 15) + @ApiModelProperty(value = "联系人4备注") + @Size(max = 50,message = "联系人4备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksFour; + + /**企业联系人5名称*/ + @Excel(name = "企业联系人5", width = 15) + @ApiModelProperty(value = "企业联系人5") + @TableField(exist = false) + private String contactsNameFive; + /** + * 企业联系人5手机号 + */ + @Excel(name = "企业联系人5手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneFive; + /** + * 企业联系人5邮箱 + */ + @Excel(name = "企业联系人5邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailFive; + /**联系人5备注*/ + @Excel(name = "联系人5备注", width = 15) + @ApiModelProperty(value = "联系人5备注") + @Size(max = 50,message = "联系人5备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksFive; + + /**企业联系人6名称*/ + @Excel(name = "企业联系人6", width = 15) + @ApiModelProperty(value = "企业联系人6") + @TableField(exist = false) + private String contactsNameSix; + /** + * 企业联系人6手机号 + */ + @Excel(name = "企业联系人6手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneSix; + /** + * 企业联系人6邮箱 + */ + @Excel(name = "企业联系人6邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailSix; + /**联系人6备注*/ + @Excel(name = "联系人6备注", width = 15) + @ApiModelProperty(value = "联系人6备注") + @Size(max = 50,message = "联系人6备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksSix; + + /**企业联系人7名称*/ + @Excel(name = "企业联系人7", width = 15) + @ApiModelProperty(value = "企业联系人7") + @TableField(exist = false) + private String contactsNameSeven; + /** + * 企业联系人7手机号 + */ + @Excel(name = "企业联系人7手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneSeven; + /** + * 企业联系人7邮箱 + */ + @Excel(name = "企业联系人7邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailSeven; + /**联系人7备注*/ + @Excel(name = "联系人7备注", width = 15) + @ApiModelProperty(value = "联系人7备注") + @Size(max = 50,message = "联系人7备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksSeven; + + /**企业联系人8名称*/ + @Excel(name = "企业联系人8", width = 15) + @ApiModelProperty(value = "企业联系人8") + @TableField(exist = false) + private String contactsNameEight; + /** + * 企业联系人8手机号 + */ + @Excel(name = "企业联系人8手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneEight; + /** + * 企业联系人8邮箱 + */ + @Excel(name = "企业联系人8邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailEight; + /**联系人8备注*/ + @Excel(name = "联系人8备注", width = 15) + @ApiModelProperty(value = "联系人8备注") + @Size(max = 50,message = "联系人8备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksEight; + + /**企业联系人9名称*/ + @Excel(name = "企业联系人9", width = 15) + @ApiModelProperty(value = "企业联系人9") + @TableField(exist = false) + private String contactsNameNine; + /** + * 企业联系人9手机号 + */ + @Excel(name = "企业联系人9手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneNine; + /** + * 企业联系人9邮箱 + */ + @Excel(name = "企业联系人9邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailNine; + /**联系人9备注*/ + @Excel(name = "联系人9备注", width = 15) + @ApiModelProperty(value = "联系人9备注") + @Size(max = 50,message = "联系人9备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksNine; + + /**企业联系人10名称*/ + @Excel(name = "企业联系人10", width = 15) + @ApiModelProperty(value = "企业联系人10") + @TableField(exist = false) + private String contactsNameTen; + /** + * 企业联系人10手机号 + */ + @Excel(name = "企业联系人10手机号", width = 15) + @TableField(exist = false) + private String contactsPhoneTen; + /** + * 企业联系人10邮箱 + */ + @Excel(name = "企业联系人10邮箱", width = 15) + @TableField(exist = false) + private String contactsEmailTen; + /**联系人10备注*/ + @Excel(name = "联系人10备注", width = 15) + @ApiModelProperty(value = "联系人10备注") + @Size(max = 50,message = "联系人10备注长度不能大于50个字符") + @TableField(exist = false) + private String remarksTen; +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroupSubItemContacts.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroupSubItemContacts.java new file mode 100644 index 00000000..110a9b66 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/entity/PayDraftingGroupSubItemContacts.java @@ -0,0 +1,131 @@ +package com.jero.drafting.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: 起草组企业联系人表 实体 + * @Author: sz + * @Date: 2024-01-02 + * @Version: V1.0 + */ +@Data +@TableName("pay_drafting_group_subitem_contacts") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="pay_drafting_group_subitem_contacts", description="pay_drafting_group_subitem_contacts") +public class PayDraftingGroupSubItemContacts implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private String id; + /**起草组id*/ + @Excel(name = "起草组id", width = 15) + @ApiModelProperty(value = "起草组id") + private String draftingGroupId; + /**起草组成员id*/ + @Excel(name = "起草组成员id", width = 15) + @ApiModelProperty(value = "起草组成员id") + private String draftingGroupSubId; + /**企业联系人id*/ + @Excel(name = "企业联系人id", width = 15) + @ApiModelProperty(value = "企业联系人id") + private String contactsId; + /**临时企业联系人id*/ + @Excel(name = "临时企业联系人id", width = 15) + @ApiModelProperty(value = "临时企业联系人id") + private String contactsTemporaryId; + /**临时企业联系人名称*/ + @Excel(name = "临时企业联系人名称", width = 15) + @ApiModelProperty(value = "临时企业联系人名称") + private String contactsTemporaryName; + /**联系人备注*/ + @Excel(name = "联系人备注", width = 15) + @ApiModelProperty(value = "联系人备注") + private String remarks; + /**序号*/ + @Excel(name = "序号", width = 15) + @ApiModelProperty(value = "序号") + private Integer orderNum; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + /** + * 企业联系人性别3 + */ + @ApiModelProperty(value = "企业联系人性别") + @TableField(exist = false) + private String gender; + /** + * 企业联系人性别3 + */ + @ApiModelProperty(value = "企业联系人性别") + @TableField(exist = false) + private String gender_dictText; + /** + * 企业联系人职务3 + */ + @ApiModelProperty(value = "企业联系人职务") + @TableField(exist = false) + private String post; + /** + * 企业联系人电话3 + */ + @ApiModelProperty(value = "企业联系人电话") + @TableField(exist = false) + private String phone; + /** + * 企业联系人邮箱3 + */ + @ApiModelProperty(value = "企业联系人邮箱") + @TableField(exist = false) + private String email; + /** + * 企业联系人邮编3 + */ + @ApiModelProperty(value = "企业联系人邮编") + @TableField(exist = false) + private String postalCodeContacts; + /** + * 企业联系人地址 + */ + @ApiModelProperty(value = "企业联系人地址") + @TableField(exist = false) + private String contactAddress; + + /** + * 企业名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "企业名称") + private String companyName; +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupMapper.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupMapper.java new file mode 100644 index 00000000..73bced4c --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupMapper.java @@ -0,0 +1,22 @@ +package com.jero.drafting.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.jero.drafting.entity.PayDraftingGroup; +import com.jero.drafting.vo.PayDraftingGroupVo; +import com.jero.project.vo.PayWorkingGroupVO; + +/** + *

+ * 起草组表 Mapper 接口 + *

+ * + * @author sz + * @since 2024-01-02 + */ +public interface PayDraftingGroupMapper extends BaseMapper { + + IPage queryPageList(Page page, PayDraftingGroup payDraftingGroup); +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupSubItemContactsMapper.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupSubItemContactsMapper.java new file mode 100644 index 00000000..d669acc0 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupSubItemContactsMapper.java @@ -0,0 +1,25 @@ +package com.jero.drafting.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.drafting.entity.PayDraftingGroupSubItem; +import com.jero.drafting.entity.PayDraftingGroupSubItemContacts; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 起草组成员企业联系人表 Mapper 接口 + *

+ * + * @author sz + * @since 2024-01-02 + */ +public interface PayDraftingGroupSubItemContactsMapper extends BaseMapper { + List getSubItemContacts(@Param("draftingGroupSubId")String id); + + /** + * 根据成员id获得主联系人 + */ + String getMasterContactsId(String draftingGroupSubItemId); +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupSubItemMapper.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupSubItemMapper.java new file mode 100644 index 00000000..ee243d49 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/PayDraftingGroupSubItemMapper.java @@ -0,0 +1,26 @@ +package com.jero.drafting.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.jero.drafting.entity.PayDraftingGroupSubItem; + +/** + *

+ * 起草组成员表 Mapper 接口 + *

+ * + * @author sz + * @since 2024-01-02 + */ +public interface PayDraftingGroupSubItemMapper extends BaseMapper { + + /** + * 分页查询 + * @param page + * @param payDraftingGroupSubItem + * @param paymentDate + * @return + */ + IPage queryPageList(Page page, PayDraftingGroupSubItem payDraftingGroupSubItem, String paymentDate); +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupMapper.xml new file mode 100644 index 00000000..55667753 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupMapper.xml @@ -0,0 +1,50 @@ + + + + + + diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupSubItemContactsMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupSubItemContactsMapper.xml new file mode 100644 index 00000000..add1acce --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupSubItemContactsMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupSubItemMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupSubItemMapper.xml new file mode 100644 index 00000000..e25b491c --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/mapper/xml/PayDraftingGroupSubItemMapper.xml @@ -0,0 +1,40 @@ + + + + + + diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupService.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupService.java new file mode 100644 index 00000000..65cde88b --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupService.java @@ -0,0 +1,61 @@ +package com.jero.drafting.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.jero.drafting.entity.PayDraftingGroup; +import com.jero.drafting.vo.PayDraftingGroupVo; +import com.jero.project.entity.PayWorkingGroup; +import com.jero.project.vo.PayWorkingGroupVO; + +import java.util.List; + +/** + *

+ * 起草组表 服务类 + *

+ * + * @author sz + * @since 2024-01-02 + */ +public interface IPayDraftingGroupService extends IService { + + /** + * 分页查询 + * @param page + * @param payDraftingGroup + * @return + */ + IPage queryPageList(Page page, PayDraftingGroup payDraftingGroup); + + /** + * 给PayDraftingGroup 属性赋值 + * @param payDraftingGroup + */ + void setPayDraftingGroup(PayDraftingGroup payDraftingGroup); + + /** + * 根据工作组的id拿到工作组的名称 + * @param payWorkingGroupId + * @return + */ + PayWorkingGroup getPayWorkingGroupNameById(String payWorkingGroupId); + + /** + * 根据id删除 + * @param id + */ + void deleteById(String id); + + /** + * 批量删除 + * @param ids + */ + void deleteByIds(List ids); + + /** + * 复制 + * @param payDraftingGroup + */ + void copy(PayDraftingGroup payDraftingGroup); +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupSubItemContactsService.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupSubItemContactsService.java new file mode 100644 index 00000000..632c9de8 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupSubItemContactsService.java @@ -0,0 +1,16 @@ +package com.jero.drafting.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.jero.drafting.entity.PayDraftingGroupSubItem; +import com.jero.drafting.entity.PayDraftingGroupSubItemContacts; + +/** + *

+ * 起草组成员企业联系人表 服务类 + *

+ * + * @author sz + * @since 2024-01-02 + */ +public interface IPayDraftingGroupSubItemContactsService extends IService { +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupSubItemService.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupSubItemService.java new file mode 100644 index 00000000..6aa5d1cd --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/IPayDraftingGroupSubItemService.java @@ -0,0 +1,59 @@ +package com.jero.drafting.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.jero.drafting.entity.PayDraftingGroupSubItem; +import com.jero.project.entity.PayWorkingGroupSubItem; + +import javax.servlet.http.HttpServletRequest; + +/** + *

+ * 起草组成员表 服务类 + *

+ * + * @author sz + * @since 2024-01-02 + */ +public interface IPayDraftingGroupSubItemService extends IService { + + /** + * 分页查询 + * @param page + * @param payDraftingGroupSubItem + * @param paymentDate + * @return + */ + IPage queryPageList(Page page, PayDraftingGroupSubItem payDraftingGroupSubItem, String paymentDate); + + /** + * 添加 + * @param payDraftingGroupSubItem + */ + void addPayDraftingGroupSubItem(PayDraftingGroupSubItem payDraftingGroupSubItem); + + /** + * 根据id删除 + * @param id + */ + void delete(String id); + + /** + * 批量删除 + * @param ids + */ + void deleteBatch(String ids); + + /** + * 编辑 + * @param payDraftingGroupSubItem + */ + void editPayWorkingGroupSubItem(PayDraftingGroupSubItem payDraftingGroupSubItem); + + /** + * excel导入 + * @param request + */ + void importExcel(HttpServletRequest request); +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupServiceImpl.java new file mode 100644 index 00000000..d5c1cf28 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupServiceImpl.java @@ -0,0 +1,219 @@ +package com.jero.drafting.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.api.vo.Result; +import com.jero.common.exception.JeroBootException; +import com.jero.common.service.RolePermissionService; +import com.jero.common.system.vo.LoginUser; +import com.jero.drafting.entity.PayDraftingGroup; +import com.jero.drafting.entity.PayDraftingGroupSubItem; +import com.jero.drafting.mapper.PayDraftingGroupMapper; +import com.jero.drafting.service.IPayDraftingGroupService; +import com.jero.drafting.service.IPayDraftingGroupSubItemService; +import com.jero.drafting.vo.PayDraftingGroupVo; +import com.jero.modules.system.entity.SysUser; +import com.jero.modules.system.service.ISysUserService; +import com.jero.modules.system.service.impl.SysUserServiceImpl; +import com.jero.project.entity.PayWorkingGroup; +import com.jero.project.entity.PayWorkingGroupSubItem; +import com.jero.project.service.IPayWorkingGroupService; +import com.jero.project.service.IPayWorkingGroupSubItemService; +import com.jero.project.vo.PayWorkingGroupVO; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + *

+ * 起草组表 服务实现类 + *

+ * + * @author sz + * @since 2024-01-02 + */ +@Service +@Transactional +public class PayDraftingGroupServiceImpl extends ServiceImpl implements IPayDraftingGroupService { + + @Resource + private PayDraftingGroupMapper payDraftingGroupMapper; + @Resource + private ISysUserService sysUserService; + @Resource + private IPayWorkingGroupService payWorkingGroupService; + @Resource + private RolePermissionService rolePermissionService; + @Resource + private IPayDraftingGroupSubItemService payDraftingGroupSubItemService; + + + /** + * 分页查询 + * + * @param page + * @param payDraftingGroup + * @return + */ + @Override + public IPage queryPageList(Page page, PayDraftingGroup payDraftingGroup) { + return payDraftingGroupMapper.queryPageList(page, payDraftingGroup); + } + + /** + * 获取负责人A的名称 + * + * @param payDraftingGroup + */ + @Override + public void setPayDraftingGroup(PayDraftingGroup payDraftingGroup) { + // 负责人A名称 + SysUser principalIdA = sysUserService.getById(payDraftingGroup.getPrincipalIdA()); + if (Objects.isNull(principalIdA)) { + throw new JeroBootException("负责人A不存在!"); + } + payDraftingGroup.setPrincipalNameA(principalIdA.getRealname()); + // 负责人B名称 + SysUser principalIdB = sysUserService.getById(payDraftingGroup.getPrincipalIdB()); + if (Objects.isNull(principalIdB)) { + throw new JeroBootException("负责人B不存在!"); + } + payDraftingGroup.setPrincipalNameB(principalIdB.getRealname()); + + } + + /** + * 根据工作组的id拿到工作组的名称 + * + * @param payWorkingGroupId + * @return + */ + @Override + public PayWorkingGroup getPayWorkingGroupNameById(String payWorkingGroupId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PayWorkingGroup::getId, payWorkingGroupId); + PayWorkingGroup payWorkingGroup = payWorkingGroupService.getOne(queryWrapper); + return payWorkingGroup; + } + + /** + * 根据id删除 + * + * @param id + */ + @Override + public void deleteById(String id) { + PayDraftingGroup payDraftingGroupOld = getById(id); + if (Objects.isNull(payDraftingGroupOld)) { + throw new JeroBootException("该起草组不存在!"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (!rolePermissionService.getRolePermission("draftingGroupProject:delete") && !Objects.equals(payDraftingGroupOld.getPrincipalIdA(), sysUser.getId())) { + throw new JeroBootException(payDraftingGroupOld.getDraftingGroupProject() + "起草组项目不可操作!"); + } + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(PayDraftingGroupSubItem::getDraftingGroupId, id); + List listPayDraftingGroupSubItem = payDraftingGroupSubItemService.list(query); + if (!CollectionUtils.isEmpty(listPayDraftingGroupSubItem)) { + throw new JeroBootException(payDraftingGroupOld.getDraftingGroupProject() + "起草组下存在企业,不可进行删除!"); + } + + removeById(id); + LambdaUpdateWrapper updatePayDraftingGroupSubItem = new LambdaUpdateWrapper<>(); + updatePayDraftingGroupSubItem.eq(PayDraftingGroupSubItem::getDraftingGroupId, id); + payDraftingGroupSubItemService.remove(updatePayDraftingGroupSubItem); + } + + /** + * 批量删除 + * + * @param ids + */ + @Override + public void deleteByIds(List ids) { + StringBuilder sb = new StringBuilder(); + StringBuilder sb1 = new StringBuilder(); + ids.forEach(p -> { + PayDraftingGroup payDraftingGroupOld = getById(p); + if (Objects.isNull(payDraftingGroupOld)) { + throw new JeroBootException("起草组不存在!"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (!rolePermissionService.getRolePermission("draftingGroupProject:batchDel") && !Objects.equals(payDraftingGroupOld.getPrincipalIdA(), sysUser.getId())) { + sb.append(payDraftingGroupOld.getDraftingGroupProject() + "起草组项目不可操作!
"); + } + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(PayDraftingGroupSubItem::getDraftingGroupId, p); + List listPayDraftingGroupSubItem = payDraftingGroupSubItemService.list(query); + if (!CollectionUtils.isEmpty(listPayDraftingGroupSubItem)) { + sb1.append(payDraftingGroupOld.getDraftingGroupProject() + "起草组下存在企业,不可进行删除!
updatePayDraftingGroupSubItem = new LambdaUpdateWrapper<>(); + updatePayDraftingGroupSubItem.in(PayDraftingGroupSubItem::getDraftingGroupId, ids); + payDraftingGroupSubItemService.remove(updatePayDraftingGroupSubItem); + } + + /** + * 复制 + * + * @param payDraftingGroup + */ + @Override + public void copy(PayDraftingGroup payDraftingGroup) { + PayDraftingGroup payDraftingGroupOld = getById(payDraftingGroup.getId()); + if(Objects.isNull(payDraftingGroupOld)){ + throw new JeroBootException("起草组不存在!"); + } + if(payDraftingGroup.getDraftingGroupProject().length() == 50){ + throw new JeroBootException("起草组名称长度为50位,不可复制,请修改之后再复制!"); + } + String str = payDraftingGroup.getDraftingGroupProject() + "-副本"; + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.like(PayDraftingGroup::getDraftingGroupProject,str); + List listPayDraftingGroup = list(queryWrapper); + if(!CollectionUtils.isEmpty(listPayDraftingGroup)){ + String rex = "^[0-9]*[1-9][0-9]*$"; + List list = new ArrayList<>(); + String finalStr = str; + listPayDraftingGroup.forEach(p->{ + String project = p.getDraftingGroupProject(); + if(!StringUtils.isEmpty(project) && !Objects.equals(p.getId(),payDraftingGroupOld.getId())){ + String projectNew = project.substring(finalStr.length()); + Pattern pa = Pattern.compile(rex); + Matcher m = pa.matcher(projectNew); + if (m.find()){ + list.add(Integer.parseInt(projectNew)); + } + } + }); + if(!CollectionUtils.isEmpty(list)){ + int m = list.stream().max(Comparator.comparing(Integer::intValue)).get(); + str = str + (m + 1); + } + }else{ + str = str + 1; + } + } +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupSubItemContactsServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupSubItemContactsServiceImpl.java new file mode 100644 index 00000000..43047b91 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupSubItemContactsServiceImpl.java @@ -0,0 +1,24 @@ +package com.jero.drafting.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.drafting.entity.PayDraftingGroupSubItem; +import com.jero.drafting.entity.PayDraftingGroupSubItemContacts; +import com.jero.drafting.mapper.PayDraftingGroupSubItemContactsMapper; +import com.jero.drafting.mapper.PayDraftingGroupSubItemMapper; +import com.jero.drafting.service.IPayDraftingGroupSubItemContactsService; +import com.jero.drafting.service.IPayDraftingGroupSubItemService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + *

+ * 起草组成员企业联系人表 服务实现类 + *

+ * + * @author sz + * @since 2024-01-02 + */ +@Service +public class PayDraftingGroupSubItemContactsServiceImpl extends ServiceImpl implements IPayDraftingGroupSubItemContactsService { +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupSubItemServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupSubItemServiceImpl.java new file mode 100644 index 00000000..7040d13a --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/service/impl/PayDraftingGroupSubItemServiceImpl.java @@ -0,0 +1,645 @@ +package com.jero.drafting.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.exception.JeroBootException; +import com.jero.common.service.RolePermissionService; +import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.ImportExcelUtil; +import com.jero.common.util.ValidUtil; +import com.jero.company.entity.PayCompanyManagement; +import com.jero.company.entity.PayContactsManagement; +import com.jero.company.service.IPayCompanyManagementService; +import com.jero.company.service.IPayContactsManagementService; +import com.jero.contract.service.IPayIncomeContractService; +import com.jero.drafting.entity.PayDraftingGroup; +import com.jero.drafting.entity.PayDraftingGroupSubItem; +import com.jero.drafting.entity.PayDraftingGroupSubItemContacts; +import com.jero.drafting.mapper.PayDraftingGroupSubItemContactsMapper; +import com.jero.drafting.mapper.PayDraftingGroupSubItemMapper; +import com.jero.drafting.service.IPayDraftingGroupService; +import com.jero.drafting.service.IPayDraftingGroupSubItemContactsService; +import com.jero.drafting.service.IPayDraftingGroupSubItemService; +import com.jero.meeting.service.IPayMeetingRemindRecordService; +import com.jero.modules.system.entity.SysUser; +import com.jero.modules.system.service.ISysUserService; +import com.jero.pack.entity.PayPackCompanyProject; +import com.jero.pack.service.IPayPackCompanyProjectService; +import com.jero.temporary.entity.PayCompanyManagementTemporary; +import com.jero.temporary.entity.PayContactsManagementTemporary; +import com.jero.temporary.service.IPayCompanyManagementTemporaryService; +import com.jero.temporary.service.IPayContactsManagementTemporaryService; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecgframework.poi.excel.ExcelImportCheckUtil; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 起草组成员表 服务实现类 + *

+ * + * @author sz + * @since 2024-01-02 + */ +@Service +@Transactional +public class PayDraftingGroupSubItemServiceImpl extends ServiceImpl implements IPayDraftingGroupSubItemService { + + @Resource + private PayDraftingGroupSubItemMapper payDraftingGroupSubItemMapper; + @Resource + private IPayDraftingGroupSubItemContactsService payDraftingGroupSubItemContactsService; + @Resource + private IPayDraftingGroupService payDraftingGroupService; + @Resource + private IPayDraftingGroupSubItemService payDraftingGroupSubItemService; + @Resource + private IPayCompanyManagementTemporaryService payCompanyManagementTemporaryService; + @Resource + private IPayContactsManagementTemporaryService payContactsManagementTemporaryService; + @Resource + private ISysUserService sysUserService; + @Resource + private IPayCompanyManagementService payCompanyManagementService; + @Resource + private IPayContactsManagementService payContactsManagementService; + @Resource + private RolePermissionService rolePermissionService; + @Resource + private PayDraftingGroupSubItemContactsMapper payDraftingGroupSubItemContactsMapper; + + /** + * 分页查询 + * + * @param page + * @param payDraftingGroupSubItem + * @param paymentDate + * @return + */ + @Override + public IPage queryPageList(Page page, PayDraftingGroupSubItem payDraftingGroupSubItem, String paymentDate) { + IPage payDraftingGroupSubItemIPage = payDraftingGroupSubItemMapper.queryPageList(page, payDraftingGroupSubItem, paymentDate); + List records = payDraftingGroupSubItemIPage.getRecords(); + if (!CollectionUtils.isEmpty(records)) { + // 获取企业联系人 + List listIds = records.stream().map(PayDraftingGroupSubItem::getId).collect(Collectors.toList()); + LambdaQueryWrapper queryDraftingGroupSubItemContacts = new LambdaQueryWrapper<>(); + queryDraftingGroupSubItemContacts.in(PayDraftingGroupSubItemContacts::getDraftingGroupSubId, listIds); + List payDraftingGroupSubItemContactsList = payDraftingGroupSubItemContactsService.list(queryDraftingGroupSubItemContacts); + + for (PayDraftingGroupSubItem draftingGroupSubItem : records) { + if (!CollectionUtils.isEmpty(payDraftingGroupSubItemContactsList)) { + List pdg = payDraftingGroupSubItemContactsList.stream().filter(p -> Objects.equals(p.getDraftingGroupSubId(), draftingGroupSubItem.getId())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(pdg)) { + pdg.sort(Comparator.comparing(PayDraftingGroupSubItemContacts::getOrderNum)); + draftingGroupSubItem.setContactsTemporaryNameOne(pdg.get(0).getContactsTemporaryName()); + draftingGroupSubItem.setPayDraftingGroupSubItemContactsList(pdg); + } else { + draftingGroupSubItem.setContactsTemporaryNameOne(""); + draftingGroupSubItem.setPayDraftingGroupSubItemContactsList(null); + } + } else { + draftingGroupSubItem.setContactsTemporaryNameOne(""); + draftingGroupSubItem.setPayDraftingGroupSubItemContactsList(null); + } + } + } + return payDraftingGroupSubItemIPage; + } + + /** + * 添加 + * + * @param payDraftingGroupSubItem + */ + @Override + public void addPayDraftingGroupSubItem(PayDraftingGroupSubItem payDraftingGroupSubItem) { + // 验证企业联系人list中是否有重复的联系人 + List payDraftingGroupSubItemContactsList = payDraftingGroupSubItem.getPayDraftingGroupSubItemContactsList(); + if (!CollectionUtils.isEmpty(payDraftingGroupSubItemContactsList)) { + long oldNum = payDraftingGroupSubItemContactsList.size(); + long newNum = payDraftingGroupSubItemContactsList.stream().map(PayDraftingGroupSubItemContacts::getContactsId).collect(Collectors.toList()).stream().distinct().count(); + if (oldNum != newNum) { + throw new JeroBootException("企业联系人重复"); + } + } + PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(payDraftingGroupSubItem.getDraftingGroupId()); + if (Objects.isNull(payDraftingGroup)) { + throw new JeroBootException("起草组不存在!"); + } + try { + // 编辑保存前再次校验来款项目是否存在 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PayDraftingGroupSubItem::getDraftingGroupId, payDraftingGroupSubItem.getDraftingGroupId()); + queryWrapper.eq(PayDraftingGroupSubItem::getChargeCompanyId, payDraftingGroupSubItem.getChargeCompanyId()); + PayDraftingGroupSubItem payDraftingGroupSubItemNew = payDraftingGroupSubItemService.getOne(queryWrapper); + // 企业和联系人同时存在,则校验不通过 + if (!Objects.isNull(payDraftingGroupSubItemNew)) { + throw new JeroBootException("起草组成员单位已存在!"); + } + } catch (Exception e) { + throw new JeroBootException("起草组成员单位已存在!"); + } + setPayDraftingGroupSubItemAdd(payDraftingGroupSubItem); + payDraftingGroupSubItemService.save(payDraftingGroupSubItem); + List listPayDraftingGroupSubItemContactsNew = payDraftingGroupSubItem.getPayDraftingGroupSubItemContactsList(); + // 添加联系人表 + if (!CollectionUtils.isEmpty(listPayDraftingGroupSubItemContactsNew)) { + for (int i = 0; i < listPayDraftingGroupSubItemContactsNew.size(); i++) { + listPayDraftingGroupSubItemContactsNew.get(i).setOrderNum(i + 1); + listPayDraftingGroupSubItemContactsNew.get(i).setDraftingGroupId(payDraftingGroupSubItem.getDraftingGroupId()); + listPayDraftingGroupSubItemContactsNew.get(i).setDraftingGroupSubId(payDraftingGroupSubItem.getId()); + } + payDraftingGroupSubItemContactsService.saveBatch(listPayDraftingGroupSubItemContactsNew); + } + SysUser sysUserInfo = sysUserService.getById(payDraftingGroup.getPrincipalIdA()); + if (Objects.isNull(sysUserInfo)) { + throw new JeroBootException("负责人不存在!"); + } + } + + /** + * 插入企业信息,联系人信息到临时表,更新项目记录 + * + * @param payDraftingGroupSubItem + */ + private void setPayDraftingGroupSubItemAdd(PayDraftingGroupSubItem payDraftingGroupSubItem) { + // 企业 + PayCompanyManagementTemporary chargeCompanyName = payCompanyManagementTemporaryService.insertCompanyManagementTemporary(payDraftingGroupSubItem.getChargeCompanyId()); + if (Objects.isNull(chargeCompanyName)) { + throw new JeroBootException("企业名称为空!"); + } + payDraftingGroupSubItem.setChargeCompanyTemporaryId(chargeCompanyName.getId()); + payDraftingGroupSubItem.setChargeCompanyTemporaryName(chargeCompanyName.getCompanyName()); + List payDraftingGroupSubItemContactsList = payDraftingGroupSubItem.getPayDraftingGroupSubItemContactsList(); + if (!CollectionUtils.isEmpty(payDraftingGroupSubItemContactsList)) { + for (int i = 0; i < payDraftingGroupSubItemContactsList.size(); i++) { + // 企业联系人 + PayContactsManagementTemporary contactsName = payContactsManagementTemporaryService.insertContactsManagementTemporary(payDraftingGroupSubItemContactsList.get(i).getContactsId()); + if (Objects.isNull(contactsName)) { + throw new JeroBootException("企业联系人" + (i + 1) + "名称为空!"); + } + payDraftingGroupSubItemContactsList.get(i).setContactsTemporaryId(contactsName.getId()); + payDraftingGroupSubItemContactsList.get(i).setContactsTemporaryName(contactsName.getName()); + } + } + } + + /** + * 根据id删除 + * + * @param id + */ + @Override + public void delete(String id) { + if (StringUtils.isBlank(id)) { + throw new JeroBootException("id不能为空!"); + } + deleteProject(id, "draftingGroupMember:delete"); + payDraftingGroupSubItemService.removeById(id); + // 删除成员企业联系人 + LambdaUpdateWrapper updatePayWorkingGroupSubItemContacts = new LambdaUpdateWrapper<>(); + updatePayWorkingGroupSubItemContacts.eq(PayDraftingGroupSubItemContacts::getDraftingGroupSubId, id); + payDraftingGroupSubItemContactsService.remove(updatePayWorkingGroupSubItemContacts); + } + + /** + * 删除联系信息 + * + * @param id + * @param perm + */ + private void deleteProject(String id, String perm) { + PayDraftingGroupSubItem payDraftingGroupSubItem = payDraftingGroupSubItemService.getById(id); + if (Objects.isNull(payDraftingGroupSubItem)) { + throw new JeroBootException("该成员不存在!"); + } + PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(payDraftingGroupSubItem.getDraftingGroupId()); + if (Objects.isNull(payDraftingGroup)) { + throw new JeroBootException("起草组不存在!"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (!rolePermissionService.getRolePermission(perm) + && !Objects.equals(payDraftingGroup.getPrincipalIdA(), sysUser.getId()) + && !Objects.equals(payDraftingGroup.getPrincipalIdB(), sysUser.getId())) { + throw new JeroBootException("起草组成员不可操作!"); + } + // 删除企业联系人临时数据 + payCompanyManagementTemporaryService.removeById(payDraftingGroupSubItem.getChargeCompanyTemporaryId()); + List subItemContacts = payDraftingGroupSubItemContactsMapper.getSubItemContacts(id); + List temporaryIds = subItemContacts.stream().map(PayDraftingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); + payContactsManagementTemporaryService.removeByIds(temporaryIds); + } + + /** + * 批量删除 + * + * @param ids + */ + @Override + public void deleteBatch(String ids) { + if (StringUtils.isBlank(ids)) { + throw new JeroBootException("id不能为空!"); + } + String[] s = ids.split(","); + for (String s1 : s) { + if (StringUtils.isBlank(s1)) { + throw new JeroBootException("id不能为空!"); + } + deleteProject(s1, "draftingGroupMember:batchDel"); + } + payDraftingGroupSubItemService.removeByIds(Arrays.asList(ids.split(","))); + // 删除成员企业联系人 + LambdaUpdateWrapper updatePayWorkingGroupSubItemContacts = new LambdaUpdateWrapper<>(); + updatePayWorkingGroupSubItemContacts.in(PayDraftingGroupSubItemContacts::getDraftingGroupSubId, Arrays.asList(ids.split(","))); + payDraftingGroupSubItemContactsService.remove(updatePayWorkingGroupSubItemContacts); + } + + /** + * 编辑 + * + * @param payDraftingGroupSubItem + */ + @Override + public void editPayWorkingGroupSubItem(PayDraftingGroupSubItem payDraftingGroupSubItem) { + String draftingGroupSubItemId = payDraftingGroupSubItem.getId(); + PayDraftingGroupSubItem payDraftingGroupSubItemOld = payDraftingGroupSubItemService.getById(draftingGroupSubItemId); + if (Objects.isNull(payDraftingGroupSubItemOld)) { + throw new JeroBootException("项目不存在!"); + } + PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(payDraftingGroupSubItemOld.getDraftingGroupId()); + if (Objects.isNull(payDraftingGroup)) { + throw new JeroBootException("起草组不存在!"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (!rolePermissionService.getRolePermission("draftingGroupMember:edit") + && !Objects.equals(payDraftingGroup.getPrincipalIdA(), sysUser.getId()) + && !Objects.equals(payDraftingGroup.getPrincipalIdB(), sysUser.getId())) { + throw new JeroBootException("起草组成员不可操作!"); + } + try { + // 编辑保存前再次校验来款项目是否存在 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PayDraftingGroupSubItem::getDraftingGroupId, payDraftingGroupSubItem.getDraftingGroupId()); + queryWrapper.eq(PayDraftingGroupSubItem::getChargeCompanyId, payDraftingGroupSubItem.getChargeCompanyId()); + PayDraftingGroupSubItem payDraftingGroupSubItemNew = payDraftingGroupSubItemService.getOne(queryWrapper); + // 企业和联系人同时存在,则校验不通过 + if (!Objects.isNull(payDraftingGroupSubItemNew) && !Objects.equals(payDraftingGroupSubItemNew.getId(), draftingGroupSubItemId)) { + throw new JeroBootException("起草组成员单位已存在!"); + } + } catch (Exception e) { + throw new JeroBootException("起草组成员单位已存在!"); + } + LambdaQueryWrapper queryPayDraftingGroupSubItemContacts = new LambdaQueryWrapper<>(); + queryPayDraftingGroupSubItemContacts.eq(PayDraftingGroupSubItemContacts::getDraftingGroupSubId, payDraftingGroupSubItemOld.getId()); + List listPayDraftingGroupSubItemContacts = payDraftingGroupSubItemContactsService.list(queryPayDraftingGroupSubItemContacts); + if (!CollectionUtils.isEmpty(listPayDraftingGroupSubItemContacts)) { + payDraftingGroupSubItemOld.setPayDraftingGroupSubItemContactsList(listPayDraftingGroupSubItemContacts); + } + setPayDraftingGroupSubItemEdit(payDraftingGroupSubItem, payDraftingGroupSubItemOld); + List listPayDraftingGroupSubItemContactsNew = payDraftingGroupSubItem.getPayDraftingGroupSubItemContactsList(); + // 添加联系人表 + if (!CollectionUtils.isEmpty(listPayDraftingGroupSubItemContactsNew)) { + // 先删除之前的企业联系人 + LambdaUpdateWrapper updatePayWorkingGroupSubItemContacts = new LambdaUpdateWrapper<>(); + updatePayWorkingGroupSubItemContacts.eq(PayDraftingGroupSubItemContacts::getDraftingGroupSubId, draftingGroupSubItemId); + payDraftingGroupSubItemContactsService.remove(updatePayWorkingGroupSubItemContacts); + // 添加新的企业联系人 + for (int i = 0; i < listPayDraftingGroupSubItemContactsNew.size(); i++) { + listPayDraftingGroupSubItemContactsNew.get(i).setOrderNum(i + 1); + listPayDraftingGroupSubItemContactsNew.get(i).setDraftingGroupSubId(draftingGroupSubItemId); + listPayDraftingGroupSubItemContactsNew.get(i).setDraftingGroupId(payDraftingGroupSubItem.getDraftingGroupId()); + } + payDraftingGroupSubItemContactsService.saveBatch(listPayDraftingGroupSubItemContactsNew); + } + payDraftingGroupSubItemService.updateById(payDraftingGroupSubItem); + } + + /** + * 插入企业信息,联系人信息到临时表,更新项目记录 + * + * @param payDraftingGroupSubItem + * @param payDraftingGroupSubItemOld + */ + private void setPayDraftingGroupSubItemEdit(PayDraftingGroupSubItem payDraftingGroupSubItem, PayDraftingGroupSubItem payDraftingGroupSubItemOld) { + if (!Objects.equals(payDraftingGroupSubItemOld.getChargeCompanyTemporaryId(), payDraftingGroupSubItem.getChargeCompanyId())) { + // 企业信息 + PayCompanyManagementTemporary chargeCompanyName = payCompanyManagementTemporaryService.insertCompanyManagementTemporary(payDraftingGroupSubItem.getChargeCompanyId()); + if (Objects.isNull(chargeCompanyName)) { + throw new JeroBootException("企业名称为空!"); + } + payDraftingGroupSubItem.setChargeCompanyTemporaryId(chargeCompanyName.getId()); + payDraftingGroupSubItem.setChargeCompanyTemporaryName(chargeCompanyName.getCompanyName()); + payCompanyManagementTemporaryService.removeById(payDraftingGroupSubItemOld.getChargeCompanyTemporaryId()); + } else { + payDraftingGroupSubItem.setChargeCompanyId(payDraftingGroupSubItemOld.getChargeCompanyId()); + } + // 企业联系人信息 + List payDraftingGroupSubItemContactsList = payDraftingGroupSubItem.getPayDraftingGroupSubItemContactsList(); + if (!CollectionUtils.isEmpty(payDraftingGroupSubItemContactsList)) { + // 删除临时表历史记录 + if (!CollectionUtils.isEmpty(payDraftingGroupSubItemOld.getPayDraftingGroupSubItemContactsList())) { + List list = payDraftingGroupSubItemOld.getPayDraftingGroupSubItemContactsList().stream().map(PayDraftingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); + payContactsManagementTemporaryService.removeByIds(list); + } + // 删除联系人记录 + LambdaUpdateWrapper updatePayDraftingGroupSubItemContacts = new LambdaUpdateWrapper<>(); + updatePayDraftingGroupSubItemContacts.eq(PayDraftingGroupSubItemContacts::getDraftingGroupSubId, payDraftingGroupSubItem.getId()); + payDraftingGroupSubItemContactsService.remove(updatePayDraftingGroupSubItemContacts); + // 新增 + for (int i = 0; i < payDraftingGroupSubItemContactsList.size(); i++) { + // 企业联系人 + PayContactsManagementTemporary contactsName = payContactsManagementTemporaryService.insertContactsManagementTemporary(payDraftingGroupSubItemContactsList.get(i).getContactsId()); + if (Objects.isNull(contactsName)) { + throw new JeroBootException("企业联系人" + (i + 1) + "名称为空!"); + } + payDraftingGroupSubItemContactsList.get(i).setContactsTemporaryId(contactsName.getId()); + payDraftingGroupSubItemContactsList.get(i).setContactsTemporaryName(contactsName.getName()); + } + } + } + + /** + * excel导入 + * + * @param request + */ + @Override + public void importExcel(HttpServletRequest request) { + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + String draftGroupId; + try { + draftGroupId = multipartRequest.getParameter("draftGroupId"); + }catch (Exception e){ + log.error("获取起草组id异常",e); + throw new JeroBootException("起草组id不能为空 !"); + } + if(StringUtils.isBlank(draftGroupId)){ + throw new JeroBootException("起草组id不能为空 !"); + } + StringBuilder msg = new StringBuilder(); + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + // 校验文件是否为excel + if(!ImportExcelUtil.checkExcelFile(file)){ + throw new JeroBootException("请导入excel文件!"); + } + ImportParams params = new ImportParams(); + params.setTitleRows(1); + params.setHeadRows(1); + try { + Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), PayDraftingGroupSubItem.class, params); + if(!t){ + throw new JeroBootException("文件格式有误,请下载模板后上传!"); + } + } catch (Exception e) { + e.printStackTrace(); + throw new JeroBootException("文件格式有误,请下载模板后上传!"); + } + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), PayDraftingGroupSubItem.class, params); + if(!CollectionUtils.isEmpty(list)){ + // 校验重复成员的集合 + List listCompanyAndContacts = new ArrayList<>(); + // 获取excel中的企业名称 + List listCompanyName = list.stream().map(PayDraftingGroupSubItem::getChargeCompanyTemporaryName).collect(Collectors.toList()); + // 获取excel企业信息 + LambdaQueryWrapper companyWrapper = new LambdaQueryWrapper<>(); + companyWrapper.in(PayCompanyManagement::getCompanyName,listCompanyName); + List listCompanyInfo = payCompanyManagementService.list(companyWrapper); + List listContactsName = new ArrayList<>(); + // 获取excel中联系人1名称 + List listContactsName1 = list.stream().map(PayDraftingGroupSubItem::getContactsNameOne).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName1)){ + listContactsName.addAll(listContactsName1); + } + // 获取excel中联系人2名称 + List listContactsName2 = list.stream().map(PayDraftingGroupSubItem::getContactsNameTwo).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName2)){ + listContactsName.addAll(listContactsName2); + } + // 获取excel中联系人3名称 + List listContactsName3 = list.stream().map(PayDraftingGroupSubItem::getContactsNameThree).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName3)){ + listContactsName.addAll(listContactsName3); + } + // 获取excel中联系人4名称 + List listContactsName4 = list.stream().map(PayDraftingGroupSubItem::getContactsNameFour).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName4)){ + listContactsName.addAll(listContactsName4); + } + // 获取excel中联系人5名称 + List listContactsName5 = list.stream().map(PayDraftingGroupSubItem::getContactsNameFive).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName5)){ + listContactsName.addAll(listContactsName5); + } + // 获取excel中联系人6名称 + List listContactsName6 = list.stream().map(PayDraftingGroupSubItem::getContactsNameSix).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName6)){ + listContactsName.addAll(listContactsName6); + } + // 获取excel中联系人7名称 + List listContactsName7 = list.stream().map(PayDraftingGroupSubItem::getContactsNameSeven).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName7)){ + listContactsName.addAll(listContactsName7); + } + // 获取excel中联系人8名称 + List listContactsName8 = list.stream().map(PayDraftingGroupSubItem::getContactsNameEight).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName8)){ + listContactsName.addAll(listContactsName8); + } + // 获取excel中联系人9名称 + List listContactsName9 = list.stream().map(PayDraftingGroupSubItem::getContactsNameNine).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName9)){ + listContactsName.addAll(listContactsName9); + } + // 获取excel中联系人10名称 + List listContactsName10 = list.stream().map(PayDraftingGroupSubItem::getContactsNameTen).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listContactsName10)){ + listContactsName.addAll(listContactsName10); + } + // 获取excel联系人信息 + LambdaQueryWrapper contactsWrapper = new LambdaQueryWrapper<>(); + contactsWrapper.in(PayContactsManagement::getName,listContactsName); + List listContactsInfo = payContactsManagementService.list(contactsWrapper); + + // 获取起草组信息 + PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(draftGroupId); + if(Objects.isNull(payDraftingGroup)){ + msg.append("起草组不存在 !"); + } + if(StringUtils.isBlank(msg)) { + // 获取工作组成员 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(PayDraftingGroupSubItem::getDraftingGroupId, draftGroupId); + List listData = payDraftingGroupSubItemService.list(query); + list.forEach(p -> { + p.setDraftingGroupId(draftGroupId); + int count = list.indexOf(p); + // 校验企业名称 + List listCompany = new ArrayList<>(); + if (StringUtils.isBlank(p.getChargeCompanyTemporaryName())) { + msg.append("第").append(count + 3).append("行:企业名称不能为空,请修改。
"); + } else { + // 通过企业名称获取企业id + listCompany = listCompanyInfo.stream().filter(item -> + Objects.equals(item.getCompanyName(), p.getChargeCompanyTemporaryName())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(listCompany)) { + msg.append("第").append(count + 3).append("行:企业名称不存在,请修改。
"); + } else { + p.setChargeCompanyId(listCompany.get(0).getId()); + } + } + // 校验工作组成员单位是否已存在(是否重复) + if (!StringUtils.isBlank(p.getChargeCompanyId())) { + List listDateNew = listData.stream().filter(item -> Objects.equals(p.getChargeCompanyId(), item.getChargeCompanyId())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(listDateNew)) { + msg.append("第").append(count + 3).append("行:工作组成员单位已存在,请修改。
"); + } + } + // 校验重复 + List listPayDraftingGroupSubItemContacts = checkRepeat(p,msg,count,listCompany,listContactsInfo); + p.setPayDraftingGroupSubItemContactsList(listPayDraftingGroupSubItemContacts); + // 校验成员唯一性 + List listCompanyAndContactsNew = listCompanyAndContacts.stream().filter(item -> Objects.equals(p.getChargeCompanyTemporaryName(), item.getChargeCompanyTemporaryName())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(listCompanyAndContactsNew)) { + msg.append("第").append(count + 3).append("行:工作组成员单位重复出现,请修改。
"); + } + listCompanyAndContacts.add(p); + // 校验字段值 + StringBuilder s = ValidUtil.validateExcel(p, (count + 3)); + if (!StringUtils.isBlank(s)) { + msg.append(s); + } + }); + if (StringUtils.isBlank(msg)) { + // 拷贝企业,联系人 + list.forEach(this::setPayDraftingGroupSubItemAdd); + // 更新数据 + payDraftingGroupSubItemService.saveBatch(list); + list.forEach(p->{ + String draftingGroupSubItemId = p.getId(); + List listPayDraftingGroupSubItemContacts = p.getPayDraftingGroupSubItemContactsList(); + if(!CollectionUtils.isEmpty(listPayDraftingGroupSubItemContacts)){ + for (int i = 0; i < listPayDraftingGroupSubItemContacts.size(); i++) { + listPayDraftingGroupSubItemContacts.get(i).setDraftingGroupId(p.getDraftingGroupId()); + listPayDraftingGroupSubItemContacts.get(i).setDraftingGroupSubId(draftingGroupSubItemId); + listPayDraftingGroupSubItemContacts.get(i).setOrderNum(i + 1); + } + payDraftingGroupSubItemContactsService.saveBatch(listPayDraftingGroupSubItemContacts); + } + }); + } + } + } + }catch (Exception e){ + log.error(e.getMessage(),e); + throw new JeroBootException("文件导入失败!"); + } finally { + try { + file.getInputStream().close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + if(!StringUtils.isBlank(msg)){ + throw new JeroBootException(msg.toString()); + } + } + } + + /** + * 验证重复 + * @param p + * @param msg + * @param count 行数 + * @param listCompany 企业集合 + * @param listContactsInfo 联系人集合 + * @return + */ + private List checkRepeat(PayDraftingGroupSubItem p, StringBuilder msg, int count, List listCompany, List listContactsInfo) { + List list = new ArrayList<>(); + HashMap map = new HashMap<>(); + if(!StringUtils.isBlank(p.getContactsNameOne())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameOne(),1,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + }else{ + msg.append("第").append(count + 3).append("行:企业联系人1不能为空,请修改。
"); + } + + if(!StringUtils.isBlank(p.getContactsNameTwo())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameTwo(),2,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + if(!StringUtils.isBlank(p.getContactsNameThree())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameThree(),3,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + if(!StringUtils.isBlank(p.getContactsNameFour())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameFour(),4,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + if(!StringUtils.isBlank(p.getContactsNameFive())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameFive(),5,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + if(!StringUtils.isBlank(p.getContactsNameSix())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameSix(),6,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + if(!StringUtils.isBlank(p.getContactsNameSeven())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameSeven(),7,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + if(!StringUtils.isBlank(p.getContactsNameEight())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameEight(),8,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + if(!StringUtils.isBlank(p.getContactsNameNine())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameNine(),9,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + if(!StringUtils.isBlank(p.getContactsNameTen())){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = setContactsId(msg,p.getContactsNameTen(),10,count,listCompany,listContactsInfo,map); + list.add(payDraftingGroupSubItemContacts); + } + return list; + } + + private PayDraftingGroupSubItemContacts setContactsId(StringBuilder msg,String name,int num,int count,List listCompany,List listContactsInfo,HashMap map){ + PayDraftingGroupSubItemContacts payDraftingGroupSubItemContacts = new PayDraftingGroupSubItemContacts(); + if(map.containsKey(name)){ + int c = map.get(name); + msg.append("第").append(count + 3).append("行:企业联系人").append(c).append("与企业联系人").append(num).append("重复,请修改。
"); + }else{ + map.put(name,num); + } + if (!CollectionUtils.isEmpty(listCompany)) { + // 通过联系人获取联系人id + List listContacts = listContactsInfo.stream().filter(item -> + Objects.equals(item.getName(), name) + && Objects.equals(item.getCompanyId(), listCompany.get(0).getId())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(listContacts)) { + msg.append("第").append(count + 3).append("行:该企业下不存在企业联系人").append(num).append(",请修改。
"); + } else { + payDraftingGroupSubItemContacts.setContactsId(listContacts.get(0).getId()); + } + } + return payDraftingGroupSubItemContacts; + } +} \ No newline at end of file diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/vo/PayDraftingGroupSubItemExcel.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/vo/PayDraftingGroupSubItemExcel.java new file mode 100644 index 00000000..89a8e75e --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/vo/PayDraftingGroupSubItemExcel.java @@ -0,0 +1,257 @@ +package com.jero.drafting.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.math.BigDecimal; + + +@Data +public class PayDraftingGroupSubItemExcel implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 临时成员单位 + */ + @Excel(name = "成员单位", width = 15) + @ApiModelProperty(value = "临时成员单位") + private String chargeCompanyTemporaryName; + + /** + * 备注 + */ + @Excel(name = "备注", width = 15) + @ApiModelProperty(value = "备注") + private String remarks; + /** + * 企业联系人1名称 + */ + @Excel(name = "企业联系人1", width = 15) + @ApiModelProperty(value = "企业联系人1名称") + private String contactsNameOne; + + /** + * 企业联系人1手机号 + */ + @Excel(name = "企业联系人1手机号", width = 17) + private String contactsPhoneOne; + + /** + * 企业联系人1邮箱 + */ + @Excel(name = "企业联系人1邮箱", width = 15) + private String contactsEmailOne; + + /** + * 联系人1备注 + */ + @Excel(name = "联系人1备注", width = 15) + @ApiModelProperty(value = "联系人1备注") + private String remarksOne; + /** + * 企业联系人2名称 + */ + @Excel(name = "企业联系人2", width = 15) + @ApiModelProperty(value = "企业联系人2名称") + private String contactsNameTwo; + /** + * 企业联系人2手机号 + */ + @Excel(name = "企业联系人2手机号", width = 17) + private String contactsPhoneTwo; + /** + * 企业联系人2邮箱 + */ + @Excel(name = "企业联系人2邮箱", width = 15) + private String contactsEmailTwo; + /** + * 联系人2备注 + */ + @Excel(name = "联系人2备注", width = 15) + @ApiModelProperty(value = "联系人2备注") + private String remarksTwo; + /** + * 企业联系人3名称 + */ + @Excel(name = "企业联系人3", width = 15) + @ApiModelProperty(value = "企业联系人3名称") + private String contactsNameThree; + /** + * 企业联系人3手机号 + */ + @Excel(name = "企业联系人3手机号", width = 17) + private String contactsPhoneThree; + /** + * 企业联系人3邮箱 + */ + @Excel(name = "企业联系人3邮箱", width = 15) + private String contactsEmailThree; + /** + * 联系人3备注 + */ + @Excel(name = "联系人3备注", width = 15) + @ApiModelProperty(value = "联系人3备注") + private String remarksThree; + /** + * 企业联系人4名称 + */ + @Excel(name = "企业联系人4", width = 15) + @ApiModelProperty(value = "企业联系人4名称") + private String contactsNameFour; + /** + * 企业联系人4手机号 + */ + @Excel(name = "企业联系人4手机号", width = 17) + private String contactsPhoneFour; + /** + * 企业联系人4邮箱 + */ + @Excel(name = "企业联系人4邮箱", width = 15) + private String contactsEmailFour; + /** + * 联系人4备注 + */ + @Excel(name = "联系人4备注", width = 15) + @ApiModelProperty(value = "联系人4备注") + private String remarksFour; + /** + * 企业联系人5名称 + */ + @Excel(name = "企业联系人5", width = 15) + @ApiModelProperty(value = "企业联系人5名称") + private String contactsNameFive; + /** + * 企业联系人5手机号 + */ + @Excel(name = "企业联系人5手机号", width = 17) + private String contactsPhoneFive; + /** + * 企业联系人5邮箱 + */ + @Excel(name = "企业联系人5邮箱", width = 15) + private String contactsEmailFive; + /** + * 联系人5备注 + */ + @Excel(name = "联系人5备注", width = 15) + @ApiModelProperty(value = "联系人5备注") + private String remarksFive; + /** + * 企业联系人6名称 + */ + @Excel(name = "企业联系人6", width = 15) + @ApiModelProperty(value = "企业联系人6名称") + private String contactsNameSix; + /** + * 企业联系人6手机号 + */ + @Excel(name = "企业联系人6手机号", width = 17) + private String contactsPhoneSix; + /** + * 企业联系人6邮箱 + */ + @Excel(name = "企业联系人6邮箱", width = 15) + private String contactsEmailSix; + /** + * 联系人6备注 + */ + @Excel(name = "联系人6备注", width = 15) + @ApiModelProperty(value = "联系人6备注") + private String remarksSix; + /** + * 企业联系人7名称 + */ + @Excel(name = "企业联系人7", width = 15) + @ApiModelProperty(value = "企业联系人7名称") + private String contactsNameSeven; + /** + * 企业联系人7手机号 + */ + @Excel(name = "企业联系人7手机号", width = 17) + private String contactsPhoneSeven; + /** + * 企业联系人7邮箱 + */ + @Excel(name = "企业联系人7邮箱", width = 15) + private String contactsEmailSeven; + /** + * 联系人7备注 + */ + @Excel(name = "联系人7备注", width = 15) + @ApiModelProperty(value = "联系人7备注") + private String remarksSeven; + /** + * 企业联系人8名称 + */ + @Excel(name = "企业联系人8", width = 15) + @ApiModelProperty(value = "企业联系人8名称") + private String contactsNameEight; + /** + * 企业联系人8手机号 + */ + @Excel(name = "企业联系人8手机号", width = 17) + private String contactsPhoneEight; + /** + * 企业联系人8邮箱 + */ + @Excel(name = "企业联系人8邮箱", width = 15) + private String contactsEmailEight; + /** + * 联系人8备注 + */ + @Excel(name = "联系人8备注", width = 15) + @ApiModelProperty(value = "联系人8备注") + private String remarksEight; + /** + * 企业联系人9名称 + */ + @Excel(name = "企业联系人9", width = 15) + @ApiModelProperty(value = "企业联系人9名称") + private String contactsNameNine; + /** + * 企业联系人9手机号 + */ + @Excel(name = "企业联系人9手机号", width = 17) + private String contactsPhoneNine; + /** + * 企业联系人9邮箱 + */ + @Excel(name = "企业联系人9邮箱", width = 15) + private String contactsEmailNine; + /** + * 联系人9备注 + */ + @Excel(name = "联系人9备注", width = 15) + @ApiModelProperty(value = "联系人9备注") + private String remarksNine; + /** + * 企业联系人10名称 + */ + @Excel(name = "企业联系人10", width = 15) + @ApiModelProperty(value = "企业联系人10名称") + private String contactsNameTen; + /** + * 企业联系人10手机号 + */ + @Excel(name = "企业联系人10手机号", width = 17) + private String contactsPhoneTen; + /** + * 企业联系人10邮箱 + */ + @Excel(name = "企业联系人10邮箱", width = 15) + private String contactsEmailTen; + /** + * 联系人10备注 + */ + @Excel(name = "联系人10备注", width = 15) + @ApiModelProperty(value = "联系人10备注") + private String remarksTen; + + @Excel(name = "标签名称", width = 15) + @ApiModelProperty(value = "标签") + private String label; +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/drafting/vo/PayDraftingGroupVo.java b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/vo/PayDraftingGroupVo.java new file mode 100644 index 00000000..af998ed1 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/drafting/vo/PayDraftingGroupVo.java @@ -0,0 +1,29 @@ +package com.jero.drafting.vo; + +import com.jero.drafting.entity.PayDraftingGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class PayDraftingGroupVo extends PayDraftingGroup { + /** + * 打包(1:是,0:否) + */ + private String pack; + /** + * 项目id + */ + private String projectId; + /** + * 当前登录人是否可以操作(1为可操作,2为不可操作) + */ + private Integer checkoutOperation; + + /** + * 工作组名称 + */ + private String workingGroupName; +} diff --git a/jero-boot-single-startup/src/main/resources/application-dev.yml b/jero-boot-single-startup/src/main/resources/application-dev.yml index 75ce7650..f9b4c0fd 100644 --- a/jero-boot-single-startup/src/main/resources/application-dev.yml +++ b/jero-boot-single-startup/src/main/resources/application-dev.yml @@ -158,7 +158,7 @@ spring: min-idle: 0 #最小等待连接中的数量,设 0 为没有限制 shutdown-timeout: 100ms # password: hzwlsoft.com - password: 123456 +# password: 123456 # port: 4780 port: 6379