From d4c77a504a902ee30ae7a55f31fa7d6ed1d7827f Mon Sep 17 00:00:00 2001 From: ky <592468495@qq.com> Date: Tue, 28 Apr 2020 15:27:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 +- src/main/java/com/gszc/conf/ShiroConfig.java | 1 + .../com/gszc/controller/CountController.java | 2 +- .../com/gszc/controller/LoginController.java | 88 +++++---- .../gszc/controller/MiniCustomController.java | 4 +- .../gszc/controller/PcCustomController.java | 130 +++++++++++++ .../gszc/controller/PcInvoiceController.java | 62 ++++++ .../com/gszc/controller/PcUserController.java | 60 ++++++ .../com/gszc/controller/UploadController.java | 41 ++++ .../java/com/gszc/entity/CustomSupport.java | 5 +- src/main/java/com/gszc/entity/Invoice.java | 9 + .../java/com/gszc/entity/InvoiceHeader.java | 9 + src/main/java/com/gszc/entity/PcUser.java | 9 + .../java/com/gszc/entity/ReceiveAddress.java | 6 + .../gszc/service/ICustomSupportService.java | 16 -- .../gszc/service/IInvoiceHeaderService.java | 16 -- .../com/gszc/service/IMiniUserService.java | 16 -- .../java/com/gszc/service/LoginService.java | 46 ++++- .../gszc/service/impl/CustomServiceImpl.java | 181 +++++++++++++++++- .../impl/CustomSupportServiceImpl.java | 20 -- .../impl/InvoiceHeaderServiceImpl.java | 20 -- .../gszc/service/impl/InvoiceServiceImpl.java | 23 +++ .../service/impl/MiniUserServiceImpl.java | 20 -- .../gszc/service/impl/PcUserServiceImpl.java | 36 ++++ .../java/com/gszc/util/SendTemplateSMS.java | 46 +++++ 25 files changed, 717 insertions(+), 157 deletions(-) create mode 100644 src/main/java/com/gszc/controller/PcCustomController.java create mode 100644 src/main/java/com/gszc/controller/PcInvoiceController.java create mode 100644 src/main/java/com/gszc/controller/PcUserController.java create mode 100644 src/main/java/com/gszc/controller/UploadController.java delete mode 100644 src/main/java/com/gszc/service/ICustomSupportService.java delete mode 100644 src/main/java/com/gszc/service/IInvoiceHeaderService.java delete mode 100644 src/main/java/com/gszc/service/IMiniUserService.java delete mode 100644 src/main/java/com/gszc/service/impl/CustomSupportServiceImpl.java delete mode 100644 src/main/java/com/gszc/service/impl/InvoiceHeaderServiceImpl.java delete mode 100644 src/main/java/com/gszc/service/impl/MiniUserServiceImpl.java create mode 100644 src/main/java/com/gszc/util/SendTemplateSMS.java diff --git a/pom.xml b/pom.xml index 6d34b36..afabe4a 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.gszc - server + gszc 1.0.0-SNAPSHOT war @@ -190,9 +190,15 @@ 2.2 + + com.cloopen + java-sms-sdk + 1.0.1 + + gszc org.springframework.boot diff --git a/src/main/java/com/gszc/conf/ShiroConfig.java b/src/main/java/com/gszc/conf/ShiroConfig.java index 0447aa0..7b8e8d9 100644 --- a/src/main/java/com/gszc/conf/ShiroConfig.java +++ b/src/main/java/com/gszc/conf/ShiroConfig.java @@ -38,6 +38,7 @@ public class ShiroConfig { Map filterChainDefinitionMap = new LinkedHashMap(); // 配置不会被拦截的链接 顺序判断 filterChainDefinitionMap.put("/login/**", "anon"); + filterChainDefinitionMap.put("/*/**Count", "anon"); //前后端带login登录的或者其他登录的通通放行 filterChainDefinitionMap.put("/**/login/**", "anon"); filterChainDefinitionMap.put("/**.js", "anon"); diff --git a/src/main/java/com/gszc/controller/CountController.java b/src/main/java/com/gszc/controller/CountController.java index 5a43c45..954ac97 100644 --- a/src/main/java/com/gszc/controller/CountController.java +++ b/src/main/java/com/gszc/controller/CountController.java @@ -51,7 +51,7 @@ public class CountController { * @return */ @PostMapping("/PITCount") - @ApiOperation(value = "增值税计算器", notes = "个人所得税计算器") + @ApiOperation(value = "个人所得税计算器", notes = "个人所得税计算器") @ApiImplicitParams({ @ApiImplicitParam(name = "type", value = "(1-个税 2-生产经营个税)", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "produceType", value = "生产经营方式(1-核定征收 2-累进税率),不是生产经营不用填写", dataType = "string", paramType = "query"), diff --git a/src/main/java/com/gszc/controller/LoginController.java b/src/main/java/com/gszc/controller/LoginController.java index 098954b..1cd7d84 100644 --- a/src/main/java/com/gszc/controller/LoginController.java +++ b/src/main/java/com/gszc/controller/LoginController.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.gszc.build.Result; import com.gszc.build.ResultBuilder; import com.gszc.entity.MiniUser; +import com.gszc.entity.PcUser; import com.gszc.service.LoginService; import com.gszc.service.MiniAppService; import com.gszc.util.JwtUtils; @@ -75,25 +76,6 @@ public class LoginController { return ResultBuilder.withPayload(miniUser).build(); } - -// @RequestMapping("/") -// public void a(HttpServletRequest request, HttpServletResponse response) throws Exception { -// //消息来源可靠性验证 -// String signature = request.getParameter("signature");// 微信加密签名 -// String timestamp = request.getParameter("timestamp");// 时间戳 -// String nonce = request.getParameter("nonce"); // 随机数 -// String echostr = request.getParameter("echostr");//成为开发者验证 -// //确认此次GET请求来自微信服务器,原样返回echostr参数内容,则接入生效,成为开发者成功,否则接入失败 -// System.out.println(); -// response.getWriter().println(request.getParameter("echostr")); -// } -// -// -// public void post(HttpServletRequest request, HttpServletResponse response) throws Exception { -// // TODO 消息的接收、处理、响应 -// } -// -// /** * 小程序测试登录 * @@ -129,34 +111,64 @@ public class LoginController { @ApiImplicitParam(name = "password", value = "密码", dataType = "string", paramType = "query") }) public Result login(String username, String password, HttpServletResponse response) { - boolean login = loginService.login(username, password); - if (login) { + + PcUser pcUser = loginService.login(username, password); + if (null!=pcUser) { Cookie cookie = new Cookie("username", username); cookie.setMaxAge(60 * 60); cookie.setPath("/"); response.addCookie(cookie); String sign = JwtUtils.sign(username, password,"pcUser"); + JSONObject result = new JSONObject(); + result.put("token",sign); + pcUser.setPassword(null); + result.put("user",pcUser); + return ResultBuilder.withPayload(result).build(); + } else { + return ResultBuilder.error("登录失败").build(); + } + } + + /** + * pc端手机验证码发送 + * + * @return + */ + @PostMapping("/sendCode") + @ApiImplicitParams({ + @ApiImplicitParam(name = "phone", value = "手机号码", dataType = "string", paramType = "query"), + }) + public Result sendCode(String phone) { + boolean sendCode = loginService.sendCode(phone); + if (sendCode) { + return ResultBuilder.success().build(); + } else { + return ResultBuilder.error("登录失败").build(); + } + } + + /** + * pc端手机验证码登录 + * + * @return + */ + @PostMapping("/phoneLogin") + @ApiImplicitParams({ + @ApiImplicitParam(name = "phone", value = "手机号码", dataType = "string", paramType = "query"), + @ApiImplicitParam(name = "code", value = "验证码", dataType = "string", paramType = "query") + }) + public Result phoneLogin(String phone, String code, HttpServletResponse response) { + PcUser pcUser = loginService.phoneLogin(phone, code); + if (null!=pcUser) { + Cookie cookie = new Cookie("username", pcUser.getLoginName()); + cookie.setMaxAge(60 * 60); + cookie.setPath("/"); + response.addCookie(cookie); + String sign = JwtUtils.sign(pcUser.getLoginName(), pcUser.getPassword(),"pcUser"); return ResultBuilder.withPayload(sign).build(); } else { return ResultBuilder.error("登录失败").build(); } } -// -// @PostMapping("/getOpenid") -// public Result getOpenid(String code) { -// -// JSONObject token = loginService.getToken(code); -// String sign = JwtUtils.sign(token.getString("openid"), token.getString("openid")); -// return ResultBuilder.withPayload(sign).build(); -// } -// -// @PostMapping("/getUser") -// @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") -// public Result getUser(HttpServletRequest request){ -// String token = request.getHeader("token"); -// String username = JwtUtils.getUsername(token); -// WxUser user = loginService.getUser(username); -// return ResultBuilder.withPayload(user).build(); -// } } diff --git a/src/main/java/com/gszc/controller/MiniCustomController.java b/src/main/java/com/gszc/controller/MiniCustomController.java index adfec32..2a4bbb0 100644 --- a/src/main/java/com/gszc/controller/MiniCustomController.java +++ b/src/main/java/com/gszc/controller/MiniCustomController.java @@ -34,7 +34,7 @@ public class MiniCustomController { @PostMapping("/invoiceCustomList") @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") - @ApiOperation(value = "可开票公司列表", notes = "公司注册") + @ApiOperation(value = "可开票公司列表", notes = "可开票公司列表") public Result invoiceCustomList(String userId) { List customs = customService.invoiceCustomList(userId); @@ -43,7 +43,7 @@ public class MiniCustomController { @PostMapping("/customList") @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") - @ApiOperation(value = "注册公司列表", notes = "公司注册") + @ApiOperation(value = "注册公司列表", notes = "注册公司列表") public Result customList(String userId) { List customs = customService.customList(userId); diff --git a/src/main/java/com/gszc/controller/PcCustomController.java b/src/main/java/com/gszc/controller/PcCustomController.java new file mode 100644 index 0000000..eb0093e --- /dev/null +++ b/src/main/java/com/gszc/controller/PcCustomController.java @@ -0,0 +1,130 @@ +package com.gszc.controller; + +import com.alibaba.fastjson.JSONObject; +import com.gszc.build.Result; +import com.gszc.build.ResultBuilder; +import com.gszc.entity.Custom; +import com.gszc.entity.Invoice; +import com.gszc.entity.PcUser; +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; + +import java.util.List; + +@Api(value = "工商注册 API", tags = {"后台公司api"}) +@RestController +@RequestMapping("/pc/custom") +public class PcCustomController { + + @Autowired + CustomServiceImpl customService; + + @Autowired + PcUserServiceImpl pcUserService; + + @PostMapping("/pcTodoCustomList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "待接单列表", notes = "待接单列表") + public Result pcTodoCustomList(Integer pageNum,Integer pageSize) { + + List customs = customService.pcTodoCustomList(pageNum,pageSize); + return ResultBuilder.withPayload(customs).build(); + } + + @PostMapping("/pcDisableCustomList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "待认证列表", notes = "待认证列表") + public Result pcDisableCustomList(Integer pageNum,Integer pageSize) { + + List customs = customService.pcDisableCustomList(pageNum,pageSize); + return ResultBuilder.withPayload(customs).build(); + } + + @PostMapping("/pcEnableCustomList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "已认证列表", notes = "已认证列表") + public Result pcEnableCustomList(Integer pageNum,Integer pageSize) { + + List customs = customService.pcEnableCustomList(pageNum,pageSize); + return ResultBuilder.withPayload(customs).build(); + } + + @PostMapping("/pcUserList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "跟单员列表", notes = "跟单员列表") + public Result pcUserList() { + + List pcUsers = pcUserService.userList(); + return ResultBuilder.withPayload(pcUsers).build(); + } + + @PostMapping("/doCustom") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "接单", notes = "接单") + public Result doCustom(String customId,String userId) { + + customService.doCustom(customId,userId); + return ResultBuilder.success().build(); + } + + @PostMapping("/changeCopycat") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "修改接单员", notes = "修改接单员") + public Result changeCopycat(String customId,String userId) { + + customService.changeCopycat(customId,userId); + return ResultBuilder.success().build(); + } + + @PostMapping("/customNotice") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "跟进备注", notes = "跟进备注") + public Result customNotice(String customId, String notice, String noticeContent) { + + customService.customNotice(customId,notice,noticeContent); + return ResultBuilder.success().build(); + } + + @PostMapping("/enableCustom") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "认证公司", notes = "认证公司") + public Result enableCustom(String customId, String businessLicense, String socialCreditCode,Long serviceBeginDate,Long serviceEndDate) { + + customService.enableCustom(customId,businessLicense,socialCreditCode,serviceBeginDate,serviceEndDate); + return ResultBuilder.success().build(); + } + + @PostMapping("/customDetail") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "注册公司详情", notes = "注册公司详情") + public Result customDetail(String customId) { + + JSONObject jsonObject = customService.customDetail(customId); + return ResultBuilder.withPayload(jsonObject).build(); + } + + @PostMapping("/enableCustomDetail") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "已认证公司详情", notes = "已认证公司详情") + public Result enableCustomDetail(String customId) { + + JSONObject jsonObject = customService.enableCustomDetail(customId); + return ResultBuilder.withPayload(jsonObject).build(); + } + + @PostMapping("/enableCustomDetailInvoiceList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "已认证公司详情开票记录", notes = "已认证公司详情开票记录") + public Result enableCustomDetailInvoiceList(String customId,Integer pageNum,Integer pageSize) { + + List invoiceList = customService.enableCustomDetailInvoiceList(customId, pageNum, pageSize); + return ResultBuilder.withPayload(invoiceList).build(); + } +} diff --git a/src/main/java/com/gszc/controller/PcInvoiceController.java b/src/main/java/com/gszc/controller/PcInvoiceController.java new file mode 100644 index 0000000..4b38513 --- /dev/null +++ b/src/main/java/com/gszc/controller/PcInvoiceController.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.entity.Invoice; +import com.gszc.entity.InvoiceHeader; +import com.gszc.service.impl.InvoiceServiceImpl; +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.*; + +import javax.validation.Valid; +import java.util.List; + +@Api(value = "工商注册 API", tags = {"后台开票api"}) +@RestController +@RequestMapping("/pc/invoice") +public class PcInvoiceController { + + @Autowired + InvoiceServiceImpl invoiceService; + + @PostMapping("/pcDisableInvoiceList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "待开票列表", notes = "待开票列表") + public Result pcDisableInvoiceList(Integer pageNum,Integer pageSize) { + + List invoiceList = invoiceService.pcDisableInvoiceList(pageNum,pageSize); + return ResultBuilder.withPayload(invoiceList).build(); + } + + @PostMapping("/pcEnableInvoiceList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "已开票列表", notes = "已开票列表") + public Result pcEnableInvoiceList(Integer pageNum,Integer pageSize) { + + List invoiceList = invoiceService.pcEnableInvoiceList(pageNum,pageSize); + return ResultBuilder.withPayload(invoiceList).build(); + } + + @PostMapping("/invoiceDetail") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "开票详情", notes = "开票详情") + public Result invoiceDetail(String invoiceId) { + + JSONObject jsonObject = invoiceService.invoiceDetail(invoiceId); + return ResultBuilder.withPayload(jsonObject).build(); + } + + @PostMapping("/invoiceConfirm") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "开票确认", notes = "开票确认") + public Result invoiceConfirm(String invoiceId,String trackingCompany,String trackingCode,String trackingImg) { + + invoiceService.invoiceConfirm(invoiceId,trackingCompany,trackingCode,trackingImg); + return ResultBuilder.success().build(); + } + +} diff --git a/src/main/java/com/gszc/controller/PcUserController.java b/src/main/java/com/gszc/controller/PcUserController.java new file mode 100644 index 0000000..3c400f4 --- /dev/null +++ b/src/main/java/com/gszc/controller/PcUserController.java @@ -0,0 +1,60 @@ +package com.gszc.controller; + +import com.gszc.build.Result; +import com.gszc.build.ResultBuilder; +import com.gszc.entity.PcUser; +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.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.List; + +@Api(value = "工商注册 API", tags = {"后台用户api"}) +@RestController +@RequestMapping("/pc/user") +public class PcUserController { + + @Autowired + PcUserServiceImpl pcUserService; + + @PostMapping("/pcUserList") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "跟单员列表", notes = "跟单员列表") + public Result pcUserList() { + List pcUsers = pcUserService.userList(); + return ResultBuilder.withPayload(pcUsers).build(); + } + + @PostMapping("/addPcUser") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "增加跟单员", notes = "增加跟单员") + public Result addPcUser(@ModelAttribute @Valid PcUser pcUser) { + pcUserService.addUser(pcUser); + return ResultBuilder.success().build(); + } + + @PostMapping("/updateUser") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "编辑跟单员", notes = "编辑跟单员") + public Result updateUser(@ModelAttribute @Valid PcUser pcUser) { + pcUserService.updateUser(pcUser); + return ResultBuilder.success().build(); + } + + @PostMapping("/deleteUser") + @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header") + @ApiOperation(value = "删除跟单员", notes = "删除跟单员") + public Result deleteUser(String pcUserId) { + pcUserService.deleteUser(pcUserId); + return ResultBuilder.success().build(); + } + + +} diff --git a/src/main/java/com/gszc/controller/UploadController.java b/src/main/java/com/gszc/controller/UploadController.java new file mode 100644 index 0000000..61d2141 --- /dev/null +++ b/src/main/java/com/gszc/controller/UploadController.java @@ -0,0 +1,41 @@ +package com.gszc.controller; + +import com.gszc.build.Result; +import com.gszc.build.ResultBuilder; +import com.gszc.service.CountService; +import com.gszc.util.OssUtil; +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; + +import java.math.BigDecimal; + +@Api(value = "工商注册 API", tags = {"上传图片api"}) +@RestController +@RequestMapping("/upload") +public class UploadController { + + @Autowired + OssUtil ossUtil; + + @PostMapping("/VATCount") + @ApiOperation(value = "增值税计算器", notes = "增值税计算器") + @ApiImplicitParams({ + @ApiImplicitParam(name = "companyType", value = "公司类型(1-有限公司 2-个独、合伙企业)", dataType = "string", paramType = "query"), + @ApiImplicitParam(name = "invoiceType", value = "开票类型(1-普通发票 2-专用发票)", dataType = "string", paramType = "query"), + @ApiImplicitParam(name = "specialInvoiceType", value = "专票类型(1-服务业 2-商业),不是专票不用填写", dataType = "string", paramType = "query"), + @ApiImplicitParam(name = "money", value = "开票金额", dataType = "string", paramType = "query"), + }) + public Result VATCount(String imageName,String invoiceType,String specialInvoiceType,double money) { + +// ossUtil.putObjectForImage(); + return ResultBuilder.withPayload("").build(); + } + + +} diff --git a/src/main/java/com/gszc/entity/CustomSupport.java b/src/main/java/com/gszc/entity/CustomSupport.java index f36e8e1..4774190 100644 --- a/src/main/java/com/gszc/entity/CustomSupport.java +++ b/src/main/java/com/gszc/entity/CustomSupport.java @@ -49,14 +49,15 @@ individualBusiness 个体工商户经营者 @ApiModelProperty(value = "名称") private String name; - + @ApiModelProperty(value = "身份证号码") private String idCardCode; /** * 持股比例 */ + @ApiModelProperty(value = "持股比例") private BigDecimal shareholdingRatio; - + @ApiModelProperty(value = "营业执照") private String businessLicense; private LocalDateTime createDate; diff --git a/src/main/java/com/gszc/entity/Invoice.java b/src/main/java/com/gszc/entity/Invoice.java index 3f6d089..5b770e1 100644 --- a/src/main/java/com/gszc/entity/Invoice.java +++ b/src/main/java/com/gszc/entity/Invoice.java @@ -5,6 +5,7 @@ import java.time.LocalDateTime; import java.io.Serializable; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -29,21 +30,28 @@ public class Invoice implements Serializable { private String customId; + @ApiModelProperty(value = "开票金额") private BigDecimal money; /** * 开票类目 */ + @ApiModelProperty(value = "开票类目") private String invoiceCategory; + @ApiModelProperty(value = "开票类型") private String invoiceType; + @ApiModelProperty(value = "发票抬头") private String invoiceHeaderId; + @ApiModelProperty(value = "备注") private String remark; + @ApiModelProperty(value = "银行流水") private String bank; + @ApiModelProperty(value = "合同凭证") private String contract; private String trackingCompany; @@ -56,5 +64,6 @@ public class Invoice implements Serializable { private LocalDateTime modifyDate; + private String statusCode; } diff --git a/src/main/java/com/gszc/entity/InvoiceHeader.java b/src/main/java/com/gszc/entity/InvoiceHeader.java index 3425427..b2e2d39 100644 --- a/src/main/java/com/gszc/entity/InvoiceHeader.java +++ b/src/main/java/com/gszc/entity/InvoiceHeader.java @@ -4,6 +4,7 @@ import java.time.LocalDateTime; import java.io.Serializable; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -26,22 +27,30 @@ public class InvoiceHeader implements Serializable { private String id; + @ApiModelProperty(value = "公司名称") private String companyName; + @ApiModelProperty(value = "税号") private String taxCode; private String telephone; + @ApiModelProperty(value = "注册地址") private String registerAddress; + @ApiModelProperty(value = "开户银行") private String bankName; + @ApiModelProperty(value = "银行账号") private String bankAccount; + @ApiModelProperty(value = "收件人") private String receiver; + @ApiModelProperty(value = "收件地址") private String receiveAddress; + @ApiModelProperty(value = "收件电话") private String receiveTelephone; private LocalDateTime createDate; diff --git a/src/main/java/com/gszc/entity/PcUser.java b/src/main/java/com/gszc/entity/PcUser.java index 9055816..ad1dabc 100644 --- a/src/main/java/com/gszc/entity/PcUser.java +++ b/src/main/java/com/gszc/entity/PcUser.java @@ -2,6 +2,9 @@ package com.gszc.entity; import java.time.LocalDateTime; import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -14,6 +17,7 @@ import lombok.experimental.Accessors; * @author ky * @since 2020-04-27 */ +@ApiModel @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @@ -23,14 +27,19 @@ public class PcUser implements Serializable { private String id; + @ApiModelProperty(value = "姓名") private String name; + @ApiModelProperty(value = "电话") private String telephone; + @ApiModelProperty(value = "所属部门") private String department; + @ApiModelProperty(value = "登录账号") private String loginName; + @ApiModelProperty(value = "密码") private String password; private LocalDateTime createDate; diff --git a/src/main/java/com/gszc/entity/ReceiveAddress.java b/src/main/java/com/gszc/entity/ReceiveAddress.java index 80a1c92..cf65898 100644 --- a/src/main/java/com/gszc/entity/ReceiveAddress.java +++ b/src/main/java/com/gszc/entity/ReceiveAddress.java @@ -4,6 +4,7 @@ import java.time.LocalDateTime; import java.io.Serializable; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -26,14 +27,19 @@ public class ReceiveAddress implements Serializable { private String id; + @ApiModelProperty(value = "收件人姓名") private String name; + @ApiModelProperty(value = "手机号") private String telephone; + @ApiModelProperty(value = "所在地区") private String region; + @ApiModelProperty(value = "详细地址") private String address; + @ApiModelProperty(value = "是否默认") private Boolean isDefault; private LocalDateTime createDate; diff --git a/src/main/java/com/gszc/service/ICustomSupportService.java b/src/main/java/com/gszc/service/ICustomSupportService.java deleted file mode 100644 index 1d18db7..0000000 --- a/src/main/java/com/gszc/service/ICustomSupportService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.gszc.service; - -import com.baomidou.mybatisplus.service.IService; -import com.gszc.entity.CustomSupport; - -/** - *

- * 服务类 - *

- * - * @author ky - * @since 2020-04-27 - */ -public interface ICustomSupportService extends IService { - -} diff --git a/src/main/java/com/gszc/service/IInvoiceHeaderService.java b/src/main/java/com/gszc/service/IInvoiceHeaderService.java deleted file mode 100644 index 9f38f7e..0000000 --- a/src/main/java/com/gszc/service/IInvoiceHeaderService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.gszc.service; - -import com.baomidou.mybatisplus.service.IService; -import com.gszc.entity.InvoiceHeader; - -/** - *

- * 发票抬头 服务类 - *

- * - * @author ky - * @since 2020-04-27 - */ -public interface IInvoiceHeaderService extends IService { - -} diff --git a/src/main/java/com/gszc/service/IMiniUserService.java b/src/main/java/com/gszc/service/IMiniUserService.java deleted file mode 100644 index 42e3da8..0000000 --- a/src/main/java/com/gszc/service/IMiniUserService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.gszc.service; - -import com.baomidou.mybatisplus.service.IService; -import com.gszc.entity.MiniUser; - -/** - *

- * 服务类 - *

- * - * @author ky - * @since 2020-04-27 - */ -public interface IMiniUserService extends IService { - -} diff --git a/src/main/java/com/gszc/service/LoginService.java b/src/main/java/com/gszc/service/LoginService.java index 4341fce..06fa6ec 100644 --- a/src/main/java/com/gszc/service/LoginService.java +++ b/src/main/java/com/gszc/service/LoginService.java @@ -3,6 +3,7 @@ package com.gszc.service; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.gszc.entity.PcUser; import com.gszc.mapper.PcUserMapper; +import com.gszc.util.SendTemplateSMS; import okhttp3.OkHttpClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,6 +11,7 @@ import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Random; @Service public class LoginService { @@ -17,6 +19,8 @@ public class LoginService { @Autowired PcUserMapper pcUserMapper; + Map codeMap = new HashMap<>(); + OkHttpClient client = new OkHttpClient(); /** * 登录 @@ -25,15 +29,55 @@ public class LoginService { * @param password * @return */ - public boolean login(String username, String password) { + public PcUser login(String username, String password) { List pcUsers = pcUserMapper.selectList(new EntityWrapper().eq("login_name", username).eq("password", password)); // List backendUsers = backendUserMapper.selectByExample(example); if (pcUsers.size() == 0) { throw new RuntimeException("该用户不存在或密码错误"); } + return pcUsers.get(0); + } + + /** + * 发送手机验证码 + * + * @return + */ + public boolean sendCode(String phone) { + List pcUsers = pcUserMapper.selectList(new EntityWrapper().eq("telephone", phone)); + if (pcUsers.size() == 0) { + throw new RuntimeException("该用户不存在"); + } + String code = String.format("%04d",new Random().nextInt(9999)); + //todo 发送手机短信 + + SendTemplateSMS sendTemplateSMS = new SendTemplateSMS(); + try { + Map map = sendTemplateSMS.SendCustomMobileCode(phone, code); + System.out.println("-------------短信发送返回信息:"+map); + } catch (Exception e) { + e.printStackTrace(); + } + codeMap.put(phone,code); return true; } + + /** + * 手机登录 + * + * @return + */ + public PcUser phoneLogin(String phone, String code) { + + if(codeMap.get(phone).equals(code)){ + List pcUsers = pcUserMapper.selectList(new EntityWrapper().eq("telephone", phone)); + return pcUsers.get(0); + }else{ + throw new RuntimeException("验证码错误"); + } + + } // public JSONObject getToken(String code){ // // Request.Builder reqBuild = new Request.Builder(); diff --git a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java index bcd5304..198306a 100644 --- a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java @@ -3,16 +3,20 @@ package com.gszc.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.gszc.entity.Custom; -import com.gszc.entity.CustomSupport; -import com.gszc.mapper.CustomMapper; -import com.gszc.mapper.CustomSupportMapper; +import com.gszc.entity.*; +import com.gszc.mapper.*; import com.gszc.service.ICustomService; +import org.apache.ibatis.session.RowBounds; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; +import java.time.Instant; import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Calendar; +import java.util.Date; import java.util.List; import java.util.UUID; @@ -34,11 +38,27 @@ public class CustomServiceImpl extends ServiceImpl impleme @Autowired CustomSupportMapper customSupportMapper; + @Autowired + MiniUserMapper miniUserMapper; + + @Autowired + ReceiveAddressServiceImpl receiveAddressService; + + @Autowired + PcUserMapper pcUserMapper; + + @Autowired + InvoiceMapper invoiceMapper; + + @Autowired + InvoiceHeaderMapper invoiceHeaderMapper; + public void customRegister(Custom custom,List customSupports){ String uuid = UUID.randomUUID().toString(); custom.setId(uuid); custom.setCreateDate(LocalDateTime.now()); custom.setModifyDate(LocalDateTime.now()); + custom.setStatusCode("todo"); customMapper.insert(custom); if(customSupports.size()>0){ for(CustomSupport customSupport:customSupports){ @@ -52,6 +72,11 @@ public class CustomServiceImpl extends ServiceImpl impleme } } + /** + * 用户可开票(已认证)公司 + * @param userId + * @return + */ public List invoiceCustomList(String userId){ List customs = customMapper.selectList(new EntityWrapper().eq("mini_user_id", userId).eq("status_code","enable")); return customs; @@ -70,4 +95,152 @@ public class CustomServiceImpl extends ServiceImpl impleme jsonObject.put("customSupports",customSupports); return jsonObject; } + + /** + * 待接单 + * @param pageNum + * @param pageSize + * @return + */ + public List pcTodoCustomList(Integer pageNum,Integer pageSize){ + + List customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "todo")); + return customs; + } + + /** + * 待认证 + * @param pageNum + * @param pageSize + * @return + */ + public List pcDisableCustomList(Integer pageNum,Integer pageSize){ + + List customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "disable")); + return customs; + } + + /** + * 已认证 + * @param pageNum + * @param pageSize + * @return + */ + public List pcEnableCustomList(Integer pageNum,Integer pageSize){ + + List customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "enable")); + return customs; + } + + /** + * 接单 + * @param customId + * @param userId + */ + public void doCustom(String customId,String userId){ + + Custom custom = new Custom(); + custom.setId(customId); + custom.setModifyDate(LocalDateTime.now()); + custom.setCopycatId(userId); + custom.setStatusCode("disable"); + customMapper.updateById(custom); + } + + /** + * 修改接单员 + * @param customId + * @param userId + */ + public void changeCopycat(String customId,String userId){ + + Custom custom = new Custom(); + custom.setId(customId); + custom.setModifyDate(LocalDateTime.now()); + custom.setCopycatId(userId); + customMapper.updateById(custom); + } + + /** + * 跟进备注 + * @param customId + */ + public void customNotice(String customId, String notice, String noticeContent){ + + Custom custom = new Custom(); + custom.setId(customId); + custom.setModifyDate(LocalDateTime.now()); + custom.setNotice(notice); + custom.setNoticeContent(noticeContent); + customMapper.updateById(custom); + } + + /** + * 认证 + * @param customId + */ + public void enableCustom(String customId, String businessLicense, String socialCreditCode,Long serviceBeginDate,Long serviceEndDate){ + + Custom custom = new Custom(); + custom.setId(customId); + custom.setModifyDate(LocalDateTime.now()); + custom.setBusinessLicense(businessLicense); + custom.setSocialCreditCode(socialCreditCode); + custom.setStatusCode("enable"); + Instant serviceBeginDateIn = Instant.ofEpochMilli(serviceBeginDate); + Instant serviceEndDateIn = Instant.ofEpochMilli(serviceEndDate); + ZoneId zone = ZoneId.systemDefault(); + custom.setServiceBeginDate(LocalDateTime.ofInstant(serviceBeginDateIn, zone)); + custom.setServiceEndDate(LocalDateTime.ofInstant(serviceEndDateIn, zone)); + customMapper.updateById(custom); + } + + public JSONObject enableCustomDetail(String customId){ + JSONObject jsonObject = new JSONObject(); + Custom custom = customMapper.selectById(customId); + String miniUserId = custom.getMiniUserId(); + MiniUser miniUser = miniUserMapper.selectById(miniUserId); + List receiveAddressList = receiveAddressService.addressList(miniUserId); + String copycatId = custom.getCopycatId(); + PcUser pcUser = pcUserMapper.selectById(copycatId); + + jsonObject.put("custom",custom); + jsonObject.put("miniUser",miniUser); + jsonObject.put("receiveAddressList",receiveAddressList); + jsonObject.put("pcUser",pcUser); + + + //年度 + Calendar c = Calendar.getInstance(); + c.setTime(new Date()); + c.add(Calendar.YEAR, -1); + Date y = c.getTime(); + List yearInvoiceList = invoiceMapper.selectList(new EntityWrapper().eq("custom_id", customId).ge("create_date", y)); + //月度 + c.setTime(new Date()); + c.add(Calendar.MONTH, -1); + Date m = c.getTime(); + List monthInvoiceList = invoiceMapper.selectList(new EntityWrapper().eq("custom_id", customId).ge("create_date", m)); + + BigDecimal yearMoney = new BigDecimal("0"); + BigDecimal monthMoney = new BigDecimal("0"); + for(Invoice invoice:yearInvoiceList){ + BigDecimal money = invoice.getMoney(); + yearMoney.add(money); + } + for(Invoice invoice:monthInvoiceList){ + BigDecimal money = invoice.getMoney(); + monthMoney.add(money); + } + jsonObject.put("yearMoney",yearMoney); + jsonObject.put("monthMoney",monthMoney); + jsonObject.put("yearCount",yearInvoiceList.size()); + return jsonObject; + } + + public List enableCustomDetailInvoiceList(String customId,Integer pageNum,Integer pageSize){ + + List invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("custom_id", customId)); + return invoiceList; + } } diff --git a/src/main/java/com/gszc/service/impl/CustomSupportServiceImpl.java b/src/main/java/com/gszc/service/impl/CustomSupportServiceImpl.java deleted file mode 100644 index 4542a32..0000000 --- a/src/main/java/com/gszc/service/impl/CustomSupportServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.gszc.service.impl; - -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.gszc.entity.CustomSupport; -import com.gszc.mapper.CustomSupportMapper; -import com.gszc.service.ICustomSupportService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author ky - * @since 2020-04-27 - */ -@Service -public class CustomSupportServiceImpl extends ServiceImpl implements ICustomSupportService { - -} diff --git a/src/main/java/com/gszc/service/impl/InvoiceHeaderServiceImpl.java b/src/main/java/com/gszc/service/impl/InvoiceHeaderServiceImpl.java deleted file mode 100644 index 7ff720d..0000000 --- a/src/main/java/com/gszc/service/impl/InvoiceHeaderServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.gszc.service.impl; - -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.gszc.entity.InvoiceHeader; -import com.gszc.mapper.InvoiceHeaderMapper; -import com.gszc.service.IInvoiceHeaderService; -import org.springframework.stereotype.Service; - -/** - *

- * 发票抬头 服务实现类 - *

- * - * @author ky - * @since 2020-04-27 - */ -@Service -public class InvoiceHeaderServiceImpl extends ServiceImpl implements IInvoiceHeaderService { - -} diff --git a/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java b/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java index 15957d2..0be7e6d 100644 --- a/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java @@ -9,6 +9,7 @@ import com.gszc.entity.InvoiceHeader; import com.gszc.mapper.InvoiceHeaderMapper; import com.gszc.mapper.InvoiceMapper; import com.gszc.service.IInvoiceService; +import org.apache.ibatis.session.RowBounds; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -96,4 +97,26 @@ public class InvoiceServiceImpl extends ServiceImpl impl return invoiceHeader; } + public List pcDisableInvoiceList(Integer pageNum,Integer pageSize){ + List invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "disable").orderBy("create_date",false)); + return invoiceList; + } + + public List pcEnableInvoiceList(Integer pageNum,Integer pageSize){ + List invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "enable").orderBy("create_date",false)); + return invoiceList; + } + + public void invoiceConfirm(String invoiceId,String trackingCompany,String trackingCode,String trackingImg){ + Invoice invoice = new Invoice(); + invoice.setId(invoiceId); + invoice.setStatusCode("enable"); + invoice.setModifyDate(LocalDateTime.now()); + + invoice.setTrackingCompany(trackingCompany); + invoice.setTrackingCode(trackingCode); + invoice.setTrackingImg(trackingImg); + invoiceMapper.updateById(invoice); + } + } diff --git a/src/main/java/com/gszc/service/impl/MiniUserServiceImpl.java b/src/main/java/com/gszc/service/impl/MiniUserServiceImpl.java deleted file mode 100644 index 55367bf..0000000 --- a/src/main/java/com/gszc/service/impl/MiniUserServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.gszc.service.impl; - -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.gszc.entity.MiniUser; -import com.gszc.mapper.MiniUserMapper; -import com.gszc.service.IMiniUserService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author ky - * @since 2020-04-27 - */ -@Service -public class MiniUserServiceImpl extends ServiceImpl implements IMiniUserService { - -} diff --git a/src/main/java/com/gszc/service/impl/PcUserServiceImpl.java b/src/main/java/com/gszc/service/impl/PcUserServiceImpl.java index 992735f..8af4ff5 100644 --- a/src/main/java/com/gszc/service/impl/PcUserServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/PcUserServiceImpl.java @@ -1,10 +1,18 @@ package com.gszc.service.impl; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.gszc.entity.Custom; import com.gszc.entity.PcUser; import com.gszc.mapper.PcUserMapper; import com.gszc.service.IPcUserService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.UUID; /** *

@@ -15,6 +23,34 @@ import org.springframework.stereotype.Service; * @since 2020-04-27 */ @Service +@Transactional public class PcUserServiceImpl extends ServiceImpl implements IPcUserService { + @Autowired + PcUserMapper pcUserMapper; + + public List userList(){ + List pcUsers = pcUserMapper.selectList(new EntityWrapper().eq("type", "user")); + return pcUsers; + } + + public void addUser(PcUser pcUser){ + String uuid = UUID.randomUUID().toString(); + pcUser.setId(uuid); + pcUser.setCreateDate(LocalDateTime.now()); + pcUser.setModifyDate(LocalDateTime.now()); + pcUser.setType("user"); + pcUserMapper.insert(pcUser); + } + + public void updateUser(PcUser pcUser){ + + pcUser.setModifyDate(LocalDateTime.now()); + pcUserMapper.updateById(pcUser); + } + + public void deleteUser(String pcUserId){ + + pcUserMapper.deleteById(pcUserId); + } } diff --git a/src/main/java/com/gszc/util/SendTemplateSMS.java b/src/main/java/com/gszc/util/SendTemplateSMS.java new file mode 100644 index 0000000..d254400 --- /dev/null +++ b/src/main/java/com/gszc/util/SendTemplateSMS.java @@ -0,0 +1,46 @@ +package com.gszc.util; + +import com.cloopen.rest.sdk.CCPRestSmsSDK; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + + +public class SendTemplateSMS { + + + String UserKey="8a216da8719c20ad0171be9be06311a6,d5e3bb1b940b4a1e967e4f046f430d3c,8a216da8719c20ad0171be9be0c711ad,590330"; + + public Map SendCustomMobileCode(String phone, String code) throws Exception { + HashMap result = null; + + CCPRestSmsSDK restAPI = new CCPRestSmsSDK(); +// CCPRestSDK restAPI = new CCPRestSDK(); + restAPI.init("app.cloopen.com", "8883");// 初始化服务器地址和端口,格式如下,服务器地址不需要写https:// + restAPI.setAccount("8a216da8719c20ad0171be9be06311a6", "d5e3bb1b940b4a1e967e4f046f430d3c");// 初始化主帐号和主帐号TOKEN + restAPI.setAppId("8a216da8719c20ad0171be9be0c711ad");// 初始化应用ID + result = restAPI.sendTemplateSMS(phone,"590330" ,new String[]{code}); + + System.out.println("SDKTestSendTemplateSMS result=" + result); + + if("000000".equals(result.get("statusCode"))){ + //正常返回输出data包体信息(map) + HashMap data = (HashMap) result.get("data"); + Set keySet = data.keySet(); + for(String key:keySet){ + Object object = data.get(key); + System.out.println(key +" = "+object); + } + }else{ + //异常返回输出错误码和错误信息 + System.out.println("错误码=" + result.get("statusCode") +" 错误信息= "+result.get("statusMsg")); + } + return result; + } + + public static void main(String[] args) throws Exception { + SendTemplateSMS sm = new SendTemplateSMS(); +// sm.SendCustomMobileCode("13248036501"); + } +}