From 2846d1695be6a067136614674555a331ba725385 Mon Sep 17 00:00:00 2001 From: ky <592468495@qq.com> Date: Mon, 25 May 2020 15:12:49 +0800 Subject: [PATCH] p --- .../gszc/controller/PcCustomV2Controller.java | 62 +++++++++++++++++++ .../gszc/controller/PcInvoiceController.java | 4 +- .../controller/PcInvoiceV2Controller.java | 33 ++++++++++ src/main/java/com/gszc/entity/Custom.java | 2 +- .../gszc/service/impl/CustomServiceImpl.java | 61 +++++++++++++++++- .../gszc/service/impl/InvoiceServiceImpl.java | 31 ++++++++-- 6 files changed, 185 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/gszc/controller/PcCustomV2Controller.java create mode 100644 src/main/java/com/gszc/controller/PcInvoiceV2Controller.java diff --git a/src/main/java/com/gszc/controller/PcCustomV2Controller.java b/src/main/java/com/gszc/controller/PcCustomV2Controller.java new file mode 100644 index 0000000..5ee851e --- /dev/null +++ b/src/main/java/com/gszc/controller/PcCustomV2Controller.java @@ -0,0 +1,62 @@ +package com.gszc.controller; + +import com.alibaba.fastjson.JSONObject; +import com.gszc.build.Result; +import com.gszc.build.ResultBuilder; +import com.gszc.service.impl.CustomServiceImpl; +import com.gszc.service.impl.PcUserServiceImpl; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(value = "工商注册 API", tags = {"后台公司api 2.0"}) +@RestController +@RequestMapping("/pc/custom") +public class PcCustomV2Controller { + + @Autowired + CustomServiceImpl customService; + + @Autowired + PcUserServiceImpl pcUserService; + + @PostMapping("/queryCustomCount") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "查看待接单、待认证公司数量", notes = "查看待接单、待认证公司数量") + public Result queryCustomCount() { + + JSONObject customs = customService.queryCustomCount(); + return ResultBuilder.withPayload(customs).build(); + } + + @PostMapping("/pcLogoutCustomList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "已注销列表", notes = "已注销列表") + public Result pcEnableCustomList(Integer pageNum,Integer pageSize) { + + JSONObject customs = customService.pcLogoutCustomList(pageNum,pageSize); + return ResultBuilder.withPayload(customs).build(); + } + + @PostMapping("/pcDeleteCustomList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "已删除列表", notes = "已删除列表") + public Result pcDeleteCustomList(Integer pageNum,Integer pageSize) { + + JSONObject customs = customService.pcDeleteCustomList(pageNum,pageSize); + return ResultBuilder.withPayload(customs).build(); + } + + @PostMapping("/revertCustom") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "删除公司还原", notes = "删除公司还原") + public Result revertCustom(String customId) { + + customService.revertCustom(customId); + return ResultBuilder.success().build(); + } +} diff --git a/src/main/java/com/gszc/controller/PcInvoiceController.java b/src/main/java/com/gszc/controller/PcInvoiceController.java index 3611cb8..f5f0eef 100644 --- a/src/main/java/com/gszc/controller/PcInvoiceController.java +++ b/src/main/java/com/gszc/controller/PcInvoiceController.java @@ -36,9 +36,9 @@ public class PcInvoiceController { @PostMapping("/pcEnableInvoiceList") @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") @ApiOperation(value = "已开票列表", notes = "已开票列表") - public Result pcEnableInvoiceList(Integer pageNum,Integer pageSize,String copycatId) { + public Result pcEnableInvoiceList(Integer pageNum,Integer pageSize,String copycatId,String keyword,Long beginTime,Long endTime) { - JSONObject invoiceList = invoiceService.pcEnableInvoiceList(pageNum,pageSize,copycatId); + JSONObject invoiceList = invoiceService.pcEnableInvoiceList(pageNum,pageSize,copycatId,keyword,beginTime,endTime); return ResultBuilder.withPayload(invoiceList).build(); } diff --git a/src/main/java/com/gszc/controller/PcInvoiceV2Controller.java b/src/main/java/com/gszc/controller/PcInvoiceV2Controller.java new file mode 100644 index 0000000..b0ae75e --- /dev/null +++ b/src/main/java/com/gszc/controller/PcInvoiceV2Controller.java @@ -0,0 +1,33 @@ +package com.gszc.controller; + +import com.alibaba.fastjson.JSONObject; +import com.gszc.build.Result; +import com.gszc.build.ResultBuilder; +import com.gszc.service.impl.InvoiceServiceImpl; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(value = "工商注册 API", tags = {"后台开票api 2.0"}) +@RestController +@RequestMapping("/pc/invoice") +public class PcInvoiceV2Controller { + + @Autowired + InvoiceServiceImpl invoiceService; + + @PostMapping("/queryInvoiceCount") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "查看待开票数量", notes = "查看待开票数量") + public Result queryInvoiceCount(String copycatId) { + + JSONObject customs = invoiceService.queryInvoiceCount(copycatId); + return ResultBuilder.withPayload(customs).build(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/gszc/entity/Custom.java b/src/main/java/com/gszc/entity/Custom.java index cae4322..fdefc7e 100644 --- a/src/main/java/com/gszc/entity/Custom.java +++ b/src/main/java/com/gszc/entity/Custom.java @@ -88,7 +88,7 @@ disable 认证不通过 todo 待接单 logout 已注销 */ - @ApiModelProperty(value = "状态 enable 认证通过 disable 认证不通过 todo 待接单 logout 已注销") + @ApiModelProperty(value = "状态 enable 认证通过 disable 认证不通过 todo 待接单 logout 已注销 delete-已删除") private String statusCode; /** diff --git a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java index af2a3af..2d01dd6 100644 --- a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java @@ -349,7 +349,11 @@ public class CustomServiceImpl extends ServiceImpl impleme } public void deleteCustom(String customId){ - customMapper.deleteById(customId); + Custom custom = new Custom(); + custom.setId(customId); + custom.setModifyDate( new Date()); + custom.setStatusCode("delete"); + customMapper.updateById(custom); } public void logoutCustom(String customId){ @@ -381,4 +385,59 @@ public class CustomServiceImpl extends ServiceImpl impleme jsonObject.put("count",count); return jsonObject; } + + public JSONObject queryCustomCount(){ + Integer todoCount = customMapper.selectCount(new EntityWrapper().eq("status_code", "todo")); + Integer disableCount = customMapper.selectCount(new EntityWrapper().eq("status_code", "disable")); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("todoCount",todoCount); + jsonObject.put("disableCount",disableCount); + return jsonObject; + } + + /** + * 已注销 + * @param pageNum + * @param pageSize + * @return + */ + public JSONObject pcLogoutCustomList(Integer pageNum,Integer pageSize){ + + Integer count = customMapper.selectCount(new EntityWrapper().eq("status_code", "logout")); + List customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "logout").orderBy("create_date", false)); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("count",count); + jsonObject.put("customs",customs); + return jsonObject; + } + + /** + * 已删除 + * @param pageNum + * @param pageSize + * @return + */ + public JSONObject pcDeleteCustomList(Integer pageNum,Integer pageSize){ + + Integer count = customMapper.selectCount(new EntityWrapper().eq("status_code", "delete")); + List customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "delete").orderBy("create_date", false)); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("count",count); + jsonObject.put("customs",customs); + return jsonObject; + } + + /** + * 删除还原 + * @param customId + */ + public void revertCustom(String customId){ + Custom custom = new Custom(); + custom.setId(customId); + custom.setModifyDate( new Date()); + custom.setStatusCode("todo"); + customMapper.updateById(custom); + } } diff --git a/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java b/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java index 51b12b7..896c495 100644 --- a/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java @@ -193,15 +193,21 @@ public class InvoiceServiceImpl extends ServiceImpl impl return jsonObject; } - public JSONObject pcEnableInvoiceList(Integer pageNum, Integer pageSize, String copycatId) { + public JSONObject pcEnableInvoiceList(Integer pageNum, Integer pageSize, String copycatId,String keyword,Long beginTime,Long endTime) { Integer count = null; List invoiceList; if (null == copycatId) { - count = invoiceMapper.selectCount(new EntityWrapper().eq("status_code", "enable")); - invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum - 1) * pageSize, pageSize), new EntityWrapper().eq("status_code", "enable").orderBy("create_date", false)); + List customList = customMapper.selectList(new EntityWrapper().like("company_name",keyword).between("create_date",beginTime,endTime)); + count = invoiceMapper.selectCount(new EntityWrapper().eq("status_code", "enable").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 -> + item.getId() + ).collect(Collectors.toList())).orderBy("create_date", false)); + } else { - List customList = customMapper.selectList(new EntityWrapper().eq("copycat_id", copycatId)); + List customList = customMapper.selectList(new EntityWrapper().eq("copycat_id", copycatId).like("company_name",keyword).between("create_date",beginTime,endTime)); count = invoiceMapper.selectCount(new EntityWrapper().eq("status_code", "enable").in("custom_id", customList.stream().map(item -> item.getId() ).collect(Collectors.toList()))); @@ -253,4 +259,21 @@ public class InvoiceServiceImpl extends ServiceImpl impl return orderTracesByJson; } + public JSONObject queryInvoiceCount(String copycatId) { + + Integer count = null; + + if (null == copycatId) { + count = invoiceMapper.selectCount(new EntityWrapper().eq("status_code", "disable")); + } else { + List customList = customMapper.selectList(new EntityWrapper().eq("copycat_id", copycatId)); + count = invoiceMapper.selectCount(new EntityWrapper().eq("status_code", "disable").in("custom_id", customList.stream().map(item -> + item.getId() + ).collect(Collectors.toList()))); + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("count", count); + return jsonObject; + } + }