diff --git a/src/main/java/com/gszc/controller/PcCustomV2Controller.java b/src/main/java/com/gszc/controller/PcCustomV2Controller.java index 10a68d4..4cc2eb8 100644 --- a/src/main/java/com/gszc/controller/PcCustomV2Controller.java +++ b/src/main/java/com/gszc/controller/PcCustomV2Controller.java @@ -63,13 +63,28 @@ public class PcCustomV2Controller { @PostMapping("/updateCustom") @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "custom", value = "公司实体custom", required = true, dataType = "Custom") -// }) @ApiOperation(value = "公司编辑", notes = "公司编辑") @ResponseBody - public Result updateCustom(@ModelAttribute @Valid Custom custom) { - customService.updateCustom(custom); + public Result updateCustom(@ModelAttribute @Valid Custom custom,@ApiParam(name = "customSupports", value = "股东列表", required = true) @RequestBody List customSupports) { + customService.updateCustom(custom,customSupports); + return ResultBuilder.success().build(); + } + + @PostMapping("/revertLogoutCustom") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "注销公司还原", notes = "注销公司还原") + public Result revertLogoutCustom(String customId) { + + customService.revertLogoutCustom(customId); + return ResultBuilder.success().build(); + } + + @PostMapping("/deleteDeleteCustom") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "清理已删除用户", notes = "清理已删除用户") + public Result deleteDeleteCustom(String customId) { + + customService.deleteDeleteCustom(customId); return ResultBuilder.success().build(); } } diff --git a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java index 1700ca3..e255a1b 100644 --- a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java @@ -446,8 +446,39 @@ public class CustomServiceImpl extends ServiceImpl impleme customMapper.updateById(custom); } - public void updateCustom(Custom custom){ + public void updateCustom(Custom custom,List customSupports){ custom.setModifyDate(new Date()); customMapper.updateById(custom); + customSupportMapper.delete(new EntityWrapper().eq("custom_id", custom.getId())); + if(customSupports.size()>0){ + for(CustomSupport customSupport:customSupports){ + String supportId = UUID.randomUUID().toString(); + customSupport.setId(supportId); + customSupport.setCreateDate( new Date()); + customSupport.setModifyDate( new Date()); + customSupport.setCustomId(custom.getId()); + customSupportMapper.insert(customSupport); + } + } + } + + /** + * 注销还原 + * @param customId + */ + public void revertLogoutCustom(String customId){ + Custom custom = new Custom(); + custom.setId(customId); + custom.setModifyDate( new Date()); + custom.setStatusCode("enable"); + customMapper.updateById(custom); + } + + /** + * 物理删除已删除用户 + * @param customId + */ + public void deleteDeleteCustom(String customId){ + customMapper.deleteById(customId); } } diff --git a/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java b/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java index 61a45dc..19f38ec 100644 --- a/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java @@ -201,23 +201,25 @@ public class InvoiceServiceImpl extends ServiceImpl impl Integer count = null; List invoiceList = new ArrayList<>(); + Wrapper invoiceWrapper = new EntityWrapper().eq("status_code", "enable"); + if (null == copycatId) { Wrapper wrapper = new EntityWrapper(); if(null!=keyword){ wrapper.like("company_name",keyword); } if(null!=beginTime){ - wrapper.ge("create_date",new Date(beginTime)); + invoiceWrapper.ge("create_date",new Date(beginTime)); } if(null!=endTime){ - wrapper.le("create_date",new Date(endTime)); + invoiceWrapper.le("create_date",new Date(endTime)); } List customList = customMapper.selectList(wrapper); if (customList.size() != 0) { - count = invoiceMapper.selectCount(new EntityWrapper().eq("status_code", "enable").in("custom_id", customList.stream().map(item -> + count = invoiceMapper.selectCount(invoiceWrapper.in("custom_id", customList.stream().map(item -> item.getId() ).collect(Collectors.toList()))); - invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum - 1) * pageSize, pageSize), new EntityWrapper().eq("status_code", "enable").in("custom_id", customList.stream().map(item -> + invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum - 1) * pageSize, pageSize), invoiceWrapper.in("custom_id", customList.stream().map(item -> item.getId() ).collect(Collectors.toList())).orderBy("create_date", false)); } @@ -228,26 +230,27 @@ public class InvoiceServiceImpl extends ServiceImpl impl wrapper.like("company_name",keyword); } if(null!=beginTime){ - wrapper.ge("create_date",new Date(beginTime)); + invoiceWrapper.ge("create_date",new Date(beginTime)); } if(null!=endTime){ - wrapper.le("create_date",new Date(endTime)); + invoiceWrapper.le("create_date",new Date(endTime)); } List customList = customMapper.selectList(wrapper); if (customList.size() != 0) { - count = invoiceMapper.selectCount(new EntityWrapper().eq("status_code", "enable").in("custom_id", customList.stream().map(item -> + count = invoiceMapper.selectCount(invoiceWrapper.in("custom_id", customList.stream().map(item -> item.getId() ).collect(Collectors.toList()))); - invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum - 1) * pageSize, pageSize), new EntityWrapper().eq("status_code", "enable").in("custom_id", customList.stream().map(item -> + invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum - 1) * pageSize, pageSize), invoiceWrapper.in("custom_id", customList.stream().map(item -> item.getId() ).collect(Collectors.toList())).orderBy("create_date", false)); } } for (Invoice invoice : invoiceList) { String invoiceHeaderId = invoice.getInvoiceHeaderId(); + InvoiceHeader invoiceHeader = invoiceHeaderMapper.selectById(invoiceHeaderId); + String customId = invoice.getCustomId(); Custom custom = customMapper.selectById(customId); - InvoiceHeader invoiceHeader = invoiceHeaderMapper.selectById(invoiceHeaderId); invoice.setCustomName(custom.getCompanyName()); invoice.setInvoiceHeaderName(invoiceHeader.getCompanyName()); if (null != custom.getCopycatId()) { diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index be1011a..f78b26c 100755 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -32,6 +32,7 @@ mybatis-plus: call-setters-on-nulls: true jdbc-type-for-null: VARCHAR cache-enabled: false + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl wx: miniapp: