master
ky 6 years ago
parent aea75f3476
commit d4c77a504a

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gszc</groupId>
<artifactId>server</artifactId>
<artifactId>gszc</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
@ -190,9 +190,15 @@
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.cloopen</groupId>
<artifactId>java-sms-sdk</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<finalName>gszc</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>

@ -38,6 +38,7 @@ public class ShiroConfig {
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
// 配置不会被拦截的链接 顺序判断
filterChainDefinitionMap.put("/login/**", "anon");
filterChainDefinitionMap.put("/*/**Count", "anon");
//前后端带login登录的或者其他登录的通通放行
filterChainDefinitionMap.put("/**/login/**", "anon");
filterChainDefinitionMap.put("/**.js", "anon");

@ -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"),

@ -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();
// }
}

@ -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<Custom> 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<Custom> customs = customService.customList(userId);

@ -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<Custom> 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<Custom> 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<Custom> 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<PcUser> 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<Invoice> invoiceList = customService.enableCustomDetailInvoiceList(customId, pageNum, pageSize);
return ResultBuilder.withPayload(invoiceList).build();
}
}

@ -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<Invoice> 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<Invoice> 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();
}
}

@ -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<PcUser> 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();
}
}

@ -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();
}
}

@ -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;

@ -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;
}

@ -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;

@ -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;

@ -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;

@ -1,16 +0,0 @@
package com.gszc.service;
import com.baomidou.mybatisplus.service.IService;
import com.gszc.entity.CustomSupport;
/**
* <p>
*
* </p>
*
* @author ky
* @since 2020-04-27
*/
public interface ICustomSupportService extends IService<CustomSupport> {
}

@ -1,16 +0,0 @@
package com.gszc.service;
import com.baomidou.mybatisplus.service.IService;
import com.gszc.entity.InvoiceHeader;
/**
* <p>
*
* </p>
*
* @author ky
* @since 2020-04-27
*/
public interface IInvoiceHeaderService extends IService<InvoiceHeader> {
}

@ -1,16 +0,0 @@
package com.gszc.service;
import com.baomidou.mybatisplus.service.IService;
import com.gszc.entity.MiniUser;
/**
* <p>
*
* </p>
*
* @author ky
* @since 2020-04-27
*/
public interface IMiniUserService extends IService<MiniUser> {
}

@ -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<String,String> 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<PcUser> pcUsers = pcUserMapper.selectList(new EntityWrapper<PcUser>().eq("login_name", username).eq("password", password));
// List<BackendUser> backendUsers = backendUserMapper.selectByExample(example);
if (pcUsers.size() == 0) {
throw new RuntimeException("该用户不存在或密码错误");
}
return pcUsers.get(0);
}
/**
*
*
* @return
*/
public boolean sendCode(String phone) {
List<PcUser> pcUsers = pcUserMapper.selectList(new EntityWrapper<PcUser>().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<String, Object> 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<PcUser> pcUsers = pcUserMapper.selectList(new EntityWrapper<PcUser>().eq("telephone", phone));
return pcUsers.get(0);
}else{
throw new RuntimeException("验证码错误");
}
}
// public JSONObject getToken(String code){
//
// Request.Builder reqBuild = new Request.Builder();

@ -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<CustomMapper, Custom> 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<CustomSupport> 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<CustomMapper, Custom> impleme
}
}
/**
*
* @param userId
* @return
*/
public List<Custom> invoiceCustomList(String userId){
List<Custom> customs = customMapper.selectList(new EntityWrapper<Custom>().eq("mini_user_id", userId).eq("status_code","enable"));
return customs;
@ -70,4 +95,152 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
jsonObject.put("customSupports",customSupports);
return jsonObject;
}
/**
*
* @param pageNum
* @param pageSize
* @return
*/
public List<Custom> pcTodoCustomList(Integer pageNum,Integer pageSize){
List<Custom> customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper<Custom>().eq("status_code", "todo"));
return customs;
}
/**
*
* @param pageNum
* @param pageSize
* @return
*/
public List<Custom> pcDisableCustomList(Integer pageNum,Integer pageSize){
List<Custom> customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper<Custom>().eq("status_code", "disable"));
return customs;
}
/**
*
* @param pageNum
* @param pageSize
* @return
*/
public List<Custom> pcEnableCustomList(Integer pageNum,Integer pageSize){
List<Custom> customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper<Custom>().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<ReceiveAddress> 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<Invoice> yearInvoiceList = invoiceMapper.selectList(new EntityWrapper<Invoice>().eq("custom_id", customId).ge("create_date", y));
//月度
c.setTime(new Date());
c.add(Calendar.MONTH, -1);
Date m = c.getTime();
List<Invoice> monthInvoiceList = invoiceMapper.selectList(new EntityWrapper<Invoice>().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<Invoice> enableCustomDetailInvoiceList(String customId,Integer pageNum,Integer pageSize){
List<Invoice> invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper<Invoice>().eq("custom_id", customId));
return invoiceList;
}
}

@ -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;
/**
* <p>
*
* </p>
*
* @author ky
* @since 2020-04-27
*/
@Service
public class CustomSupportServiceImpl extends ServiceImpl<CustomSupportMapper, CustomSupport> implements ICustomSupportService {
}

@ -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;
/**
* <p>
*
* </p>
*
* @author ky
* @since 2020-04-27
*/
@Service
public class InvoiceHeaderServiceImpl extends ServiceImpl<InvoiceHeaderMapper, InvoiceHeader> implements IInvoiceHeaderService {
}

@ -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<InvoiceMapper, Invoice> impl
return invoiceHeader;
}
public List<Invoice> pcDisableInvoiceList(Integer pageNum,Integer pageSize){
List<Invoice> invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper<Invoice>().eq("status_code", "disable").orderBy("create_date",false));
return invoiceList;
}
public List<Invoice> pcEnableInvoiceList(Integer pageNum,Integer pageSize){
List<Invoice> invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper<Invoice>().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);
}
}

@ -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;
/**
* <p>
*
* </p>
*
* @author ky
* @since 2020-04-27
*/
@Service
public class MiniUserServiceImpl extends ServiceImpl<MiniUserMapper, MiniUser> implements IMiniUserService {
}

@ -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;
/**
* <p>
@ -15,6 +23,34 @@ import org.springframework.stereotype.Service;
* @since 2020-04-27
*/
@Service
@Transactional
public class PcUserServiceImpl extends ServiceImpl<PcUserMapper, PcUser> implements IPcUserService {
@Autowired
PcUserMapper pcUserMapper;
public List<PcUser> userList(){
List<PcUser> pcUsers = pcUserMapper.selectList(new EntityWrapper<PcUser>().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);
}
}

@ -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<String, Object> SendCustomMobileCode(String phone, String code) throws Exception {
HashMap<String, Object> 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<String,Object> data = (HashMap<String, Object>) result.get("data");
Set<String> 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");
}
}
Loading…
Cancel
Save