Commit d47f6428 authored by zhangc's avatar zhangc

Merge branch 'dm_dev' of http://gitlab.ioubuy.cn/yaobenzhang/dm_project into dm_dev

 Conflicts:
	pom.xml
parents bd0af079 4e952e04
package com.jz.common.utils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.ParseException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.jz.common.utils.HttpClientPool.getHttpClient;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.common.utils
* @PROJECT_NAME: jz-dm-parent
* @NAME: HttpsUtils
* @DATE: 2021-1-3/0:29
* @DAY_NAME_SHORT: 周日
* @Description:
**/
@Slf4j
public class HttpsUtilsTest {
public static final String JSON_CONTENT_FORM = "application/json; charset=utf-8";
public static final String CONTENT_FORM = "application/x-www-form-urlencoded;charset=UTF-8";
/**
* Post请求表单提交
* @param url 请求路径
* @param params 请求参数
* @param headers 请求头
* @return
*/
public static String submitPost(String url, JSONObject params, Map<String, String> headers) {
CloseableHttpClient httpClient = getHttpClient();
String body = null;
CloseableHttpResponse response = null;
try {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-type",JSON_CONTENT_FORM );
if (null != headers && headers.size() > 0) {
for (Map.Entry<String, String> e : headers.entrySet()) {
httpPost.addHeader(e.getKey(), e.getValue());
}
}
if (StringUtils.isNotBlank(params.toString())) {
httpPost.setEntity(new StringEntity(params.toString(), Consts.UTF_8));
}
response = httpClient.execute(httpPost);
body = getBody(response.getEntity());
log.info("请求:" + url + "---->返回结果:" + body);
} catch (IOException e) {
log.error("请求:" + url + "--->异常", e);
} finally {
try {// 释放链接
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return body;
}
/**
* Post请求表单提交
*
* @param url 请求路径
* @param params 请求参数
* @return
*/
public static String submitPost(String url, String params) {
CloseableHttpClient httpClient = getHttpClient();
String body = null;
CloseableHttpResponse response = null;
try {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-type",JSON_CONTENT_FORM );
if (StringUtils.isNotBlank(params)) {
httpPost.setEntity(new StringEntity(params, Consts.UTF_8));
}
response = httpClient.execute(httpPost);
System.out.println(response);
body = getBody(response.getEntity());
log.info("请求:" + url + "---->返回结果:" + body);
} catch (IOException e) {
log.error("请求:" + url + "--->异常", e);
} finally {
try {// 释放链接
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return body;
}
/**
* 验证码实时校验
* 无需cookie和referer时请求接口
*
* @param params 入参
* @param baseUrl 发送请求的URL
* @return URL 所代表远程资源的响应结果
*/
public static String doGet(String baseUrl, Map<String, String> params) {
CloseableHttpClient httpClient = getHttpClient();
CloseableHttpResponse response = null;
String body = null;
try {
List<String> mapList = new ArrayList<>();
if (params != null) {
for (Map.Entry<String, String> entry : params.entrySet()) {
mapList.add(entry.getKey() + "=" + entry.getValue());
}
}
if (CollectionUtils.isNotEmpty(mapList)) {
baseUrl = baseUrl + "?";
String paramsStr = StringUtils.join(mapList, "&");
baseUrl = baseUrl + paramsStr;
}
HttpGet httpGet = new HttpGet(baseUrl);
response = httpClient.execute(httpGet);
body = getBody(response.getEntity());
log.info("获取请求结果为:" + body);
} catch (Exception e) {
log.warn("请求接口时-->" + baseUrl + "发生异常:", e);
} finally {
try {
response.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return body;
}
/**
* 验证码实时校验
* 无需cookie和referer时请求接口
* @param baseUrl 发送请求的URL
* @param params 请求参数
* @return URL 所代表远程资源的响应结果
*/
public static String doGet(String baseUrl,Map<String, String> params, Map<String, String> headers) {
CloseableHttpClient httpClient = getHttpClient();
CloseableHttpResponse response = null;
String body = null;
try {
List<String> mapList = new ArrayList<>();
if (params != null) {
for (Map.Entry<String, String> entry : params.entrySet()) {
mapList.add(entry.getKey() + "=" + entry.getValue());
}
}
if (CollectionUtils.isNotEmpty(mapList)) {
baseUrl = baseUrl + "?";
String paramsStr = StringUtils.join(mapList, "&");
baseUrl = baseUrl + paramsStr;
}
HttpGet httpGet = new HttpGet(baseUrl);
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> e : headers.entrySet()) {
httpGet.addHeader(e.getKey(), e.getValue());
}
}
response = httpClient.execute(httpGet);
body = getBody(response.getEntity());
log.info("获取请求结果为:" + body);
} catch (Exception e) {
log.warn("请求接口时-->" + baseUrl + "发生异常:", e);
} finally {
try {
response.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return body;
}
/**
* 获取图片二维码
*
* @param url
* @throws IOException
*/
public static CloseableHttpResponse doGetImg(String url) {
CloseableHttpClient httpClient = getHttpClient();
CloseableHttpResponse response=null;
HttpGet httpGet = new HttpGet(url);
try {
response = httpClient.execute(httpGet);
} catch (IOException e) {
log.error("发起http request异常:{}", e);
}
return response;
}
/**
* 获取图片二维码
*
* @param url
* @throws IOException
*/
public static HttpEntity doGetImg(String url, Map<String, String> headers) {
CloseableHttpClient httpClient = getHttpClient();
CloseableHttpResponse response = null;
HttpGet httpGet = new HttpGet(url);
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> e : headers.entrySet()) {
httpGet.addHeader(e.getKey(), e.getValue());
}
}
try {
response = httpClient.execute(httpGet);
} catch (IOException e) {
log.error("发起http request异常:{}", e);
}
return response.getEntity();
}
public static String getBody(HttpEntity entity) throws ParseException, IOException {
String body = "";
if (entity != null) {
// 按指定编码转换结果实体为String类型
body = EntityUtils.toString(entity, Consts.UTF_8);
}
EntityUtils.consume(entity);
return body;
}
}
......@@ -153,7 +153,7 @@ public class Md5 {
return Md5.encrypt(query.toString(), secret);
}
public static void main(String[] args) {
System.out.println(encrypt("200128008012abc@123", ""));
}
// public static void main(String[] args) {
// System.out.println(encrypt("200128008012abc@123", ""));
// }
}
......@@ -4,75 +4,75 @@ import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
/**
* @ClassName: 短信发送工具类
* @Author: Carl
* @Date: 2020/12/1
* @Version:
*/
public class SMSUtils {
public static final String VALIDATE_CODE = "SMS_205878938";//发送短信验证码模板编码 模版CODE
public static final String ORDER_NOTICE = "SMS_159771588";//体检预约成功通知
private static final String SIGN_NAEM = "万家数据商城";// 短信的签名
private static final String PARAMETER_NAME="code";
private static final String ACCESS_KEY="LTAI4GKPoTkrT6n2fSV7ePEG"; //你的AccessKey ID
private static final String SECRET_KEY="k8HcW3TxZzGxAetEpyDInZehip9MAE"; //你的AccessKey Secret
// public static void main(String[] args) throws ClientException {
// SMSUtils.sendShortMessage(VALIDATE_CODE,"19979232865","55555555");
// }
/**
*
* @param templateCode
* @param phoneNumbers
* @param param
* @throws
*/
public static void sendShortMessage(String templateCode,String phoneNumbers,String param) throws Exception{
// 设置超时时间-可自行调整
public static void main(String[] args) {
sendMessage(loginTemplate, ValidateCodeUtils.generateValidateCode(6),"18279617424");
}
// 你的签名
private static final String msgSign = "万家数据商城";
//模版CODE
// public static final String orderTemplate = "SMS_198667732";
// public static final String registerTemplate = "SMS_198672338";
public static final String loginTemplate = "SMS_205878938";
// AK,AKS
private static final String accessKeyId = "LTAI4GKPoTkrT6n2fSV7ePEG";
private static final String accessKeySecret = "k8HcW3TxZzGxAetEpyDInZehip9MAE";
// 阿里云发送验证码短信
public static void sendMessage (String template, Integer code, String toPhoneNumber) {
//设置超时时间-可自行调整
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
// 初始化ascClient需要的几个参数
final String product = "Dysmsapi";// 短信API产品名称(短信产品名固定,无需修改)
final String domain = "dysmsapi.aliyuncs.com";// 短信API产品域名(接口地址固定,无需修改)
// 替换成你的AK
final String accessKeyId = "LTAIak3CfAehK7cE";// 你的accessKeyId,参考本文档步骤2
final String accessKeySecret = "zsykwhTIFa48f8fFdU06GOKjHWHel4";// 你的accessKeySecret,参考本文档步骤2
// 初始化ascClient,暂时不支持多region(请勿修改)
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEY, SECRET_KEY);
//初始化ascClient需要的几个参数
final String product = "Dysmsapi";//短信API产品名称(短信产品名固定,无需修改)
final String domain = "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改)
//替换成你的AK
//初始化ascClient,暂时不支持多region(请勿修改)
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId,
accessKeySecret);
try {
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
} catch (ClientException e) {
e.printStackTrace();
}
IAcsClient acsClient = new DefaultAcsClient(profile);
// 组装请求对象
//组装请求对象
SendSmsRequest request = new SendSmsRequest();
// 使用post提交
request.setMethod(MethodType.POST);
// 必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
request.setPhoneNumbers(phoneNumbers);
// 必填:短信签名-可在短信控制台中找到
request.setSignName(SIGN_NAEM);
// 必填:短信模板-可在短信控制台中找到
request.setTemplateCode(templateCode);
// 可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
// 友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
//request.setTemplateParam("{\"code\":\""+param+"\"}");
request.setTemplateParam(String.format("{\"%s\":\"%s\"}",PARAMETER_NAME,param));
// 可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
// request.setSmsUpExtendCode("90997");
// 可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
// request.setOutId("yourOutId");
// 请求失败这里会抛ClientException异常
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
if (sendSmsResponse.getCode() != null && sendSmsResponse.getCode().equals("OK")) {
// 请求成功
System.out.println("请求成功");
}else{
System.out.println(sendSmsResponse.getMessage());
//使用post提交
request.setMethod(MethodType.GET);
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式;发送国际/港澳台消息时,接收号码格式为国际区号+号码,如“85200000000”
request.setPhoneNumbers(toPhoneNumber);
//必填:短信签名-可在短信控制台中找到
request.setSignName(msgSign);
//必填:短信模板-可在短信控制台中找到,发送国际/港澳台消息时,请使用国际/港澳台短信模版
request.setTemplateCode(template);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
//友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
//参考:request.setTemplateParam("{\"变量1\":\"值1\",\"变量2\":\"值2\",\"变量3\":\"值3\"}")
request.setTemplateParam("{\"code\":\""+code+"\"}");
//可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
//request.setSmsUpExtendCode("90997");
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
request.setOutId("yourOutId");
//请求失败这里会抛ClientException异常
SendSmsResponse sendSmsResponse = null;
try {
sendSmsResponse = acsClient.getAcsResponse(request);
} catch (ClientException e) {
e.printStackTrace();
}
if(sendSmsResponse.getCode() != null && sendSmsResponse.getCode().equals("OK")) {
//请求成功
}
}
}
......@@ -74,10 +74,10 @@
</dependency>
<!-- spring boot 和mybatis -->
<dependency>
<!--<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
</dependency>-->
<!-- mybatis plus -->
<dependency>
......@@ -125,6 +125,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
</dependency>
<!-- common公共模块 -->
<dependency>
<groupId>com.jz.common</groupId>
......@@ -132,6 +136,10 @@
<version>1.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
</dependencies>
......
package com.jz.dm.mall;
import com.jz.common.utils.HttpsUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
......@@ -21,8 +22,10 @@ public class Application {
}
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
// @Bean
// public HttpsUtils httpsUtils() {
// return new HttpsUtils();
// }
}
......@@ -21,10 +21,10 @@ import java.sql.SQLException;
* @Date: 2018/8/16 16:49
* @Description: 主数据源配置类
*/
@Configuration
//@Configuration
// 前缀为primary.datasource.druid的配置信息
@ConfigurationProperties(prefix = "spring.datasource")
@MapperScan(basePackages = DatabaseConfig.PACKAGE, sqlSessionFactoryRef = "sqlSessionFactory")
//@ConfigurationProperties(prefix = "spring.datasource")
//@MapperScan(basePackages = DatabaseConfig.PACKAGE, sqlSessionFactoryRef = "sqlSessionFactory")
public class DatabaseConfig {
/**
......
package com.jz.dm.mall.config.mybatisPlusConfig;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
import org.mybatis.spring.annotation.MapperScan;
......@@ -29,6 +30,14 @@ public class MybatisPlusConfig {
paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
return paginationInterceptor;
}
@Bean
ConfigurationCustomizer mybatisConfigurationCustomizer() {
return new ConfigurationCustomizer() {
@Override
public void customize(org.apache.ibatis.session.Configuration configuration) {
configuration.addInterceptor(new com.github.pagehelper.PageInterceptor());
}
};
}
}
......@@ -115,10 +115,16 @@ public class MallCustomerController extends BaseController {
return new Result(false, "密码修改失败", StatusCode.ERROR);
}
// @PostMapping(value = "/upPassword")
// @ApiModelProperty(value = "忘记密码")
// public Result upPassword(@RequestBody CustomerRequest customer) throws Exception {
// mallCustomerService.upPassword(customer);
// return new Result(true, "密码修改成功", StatusCode.OK);
// }
@PostMapping("/getMenu")
@ApiOperation(value = "商城--角色展示菜单", notes = "用户角色展示菜单")
public Result getMenu(@RequestParam(name = "userId") Long userId,
@RequestParam(name = "roleId") Long roleId) {
Result menu = mallCustomerService.getMenu(userId, roleId);
if (!StringUtils.isEmpty(menu)) {
menu.setMsg("查询菜单成功!");
menu.setCode(StatusCode.OK);
return menu;
}
return new Result(false, "查询菜单失败!", StatusCode.ERROR);
}
}
\ No newline at end of file
......@@ -3,13 +3,15 @@ package com.jz.dm.mall.moduls.controller.customer;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.utils.Result;
import com.jz.common.utils.SMSUtils;
import com.jz.common.utils.StatusCode;
import com.jz.common.utils.ValidateCodeUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -43,19 +45,13 @@ public class ValidateCodeController {
// 通过手机号从redis获取验证码
String codeInRedis = (String) redisTemplate.opsForValue().get(key);
if (!StringUtils.isEmpty(codeInRedis)) {
return new Result(false, "验证码已发送,请注意查收!", StatusCode.ERROR);
}else {
// 生成验证码
String code = ValidateCodeUtils.generateValidateCode(6) + "";
// 发送
try {
// SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code);
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "验证码发送失败!", StatusCode.ERROR);
}
// 存入redis, 有效期为5分钟
if (codeInRedis!=null && !codeInRedis.equals("")) {
// redis中的验证码还未过期
return new Result(false,"验证码发送失败!", StatusCode.ERROR);
} else {
// redis中无此手机号的验证码,发送验证码
Integer code = ValidateCodeUtils.generateValidateCode(6);
SMSUtils.sendMessage(SMSUtils.loginTemplate,code, telephone);
redisTemplate.opsForValue().set(key,code,5, TimeUnit.MINUTES);
return new Result(true, "验证码发送成功!", StatusCode.OK);
}
......@@ -69,25 +65,19 @@ public class ValidateCodeController {
*/
@GetMapping("/send4Code")
@ApiOperation(value = "修改密码发送验证码")
public Result send4Code(@RequestParam(value = "telephone") String telephone) {
public Result send4Code(@RequestParam(value = "telephone") String telephone) throws Exception{
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// 通过手机号从redis获取验证码
String codeInRedis = (String) redisTemplate.opsForValue().get(key);
if (!StringUtils.isEmpty(codeInRedis)) {
return new Result(false, "验证码已发送,请注意查收!", StatusCode.ERROR);
if (codeInRedis!=null && !codeInRedis.equals("")) {
// redis中的验证码还未过期
return new Result(false,"验证码发送失败!", StatusCode.ERROR);
} else {
// 生成验证码
String code = ValidateCodeUtils.generateValidateCode(6) + "";
// 发送
try {
// SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code);
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "验证码发送失败!", StatusCode.ERROR);
}
// 存入redis, 有效期为5分钟
redisTemplate.opsForValue().set(key, code, 5, TimeUnit.MINUTES);
// redis中无此手机号的验证码,发送验证码
Integer code = ValidateCodeUtils.generateValidateCode(6);
SMSUtils.sendMessage(SMSUtils.loginTemplate,code, telephone);
redisTemplate.opsForValue().set(key,code,5, TimeUnit.MINUTES);
return new Result(true, "验证码发送成功!", StatusCode.OK);
}
}
......
package com.jz.dm.mall.moduls.controller.file;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.service.PictureService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/** * @ClassName:
* @Author: Carl
* @Date: 2021/1/12
* @Version:
*/
@RestController
@Api(tags = "图片处理")
public class PictureController {
@Autowired
private PictureService pictureService;
@PostMapping("/uploadPicture")
@ApiOperation(value = "图片上传")
@ResponseBody
public Result uploadPicture(MultipartFile file,
@RequestParam(name = "params") String params) {
// Map<String, Object> paramer = dataGoodsService.uploadPicture(file);
Result result = pictureService.uploadPicture(file, params);
return result;
}
@GetMapping("/downloadPicture")
@ApiOperation(value = "图片下载")
public Result downloadPicture(@RequestParam(name = "url") String url, HttpServletResponse response) {
Result result = pictureService.downloadPicture(url, response);
return result;
}
}
......@@ -7,6 +7,7 @@ import com.jz.dm.mall.moduls.service.DataGoodsCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -27,12 +28,14 @@ public class DataGoodsCategoryController extends BaseController {
*/
@Autowired
private DataGoodsCategoryService categoryService;
@GetMapping(value = "/findCategory/{pid}")
@ApiOperation(value = "查询数据商品分类", notes = "查询父类下的商品分类")
public Result findCategory(@PathVariable(value = "pid") Long pid) {
// categoryService.findCateGory
return null;
@GetMapping(value = "/findCategory")
@ApiOperation(value = "查询数据商品分类", notes = "查询所有的商品分类")
public Result findCategory() {
Result result = categoryService.findCategory();
if (StringUtils.isEmpty(result)) {
return Result.of_error("查询失败!");
}
return result;
}
}
\ No newline at end of file
......@@ -2,9 +2,11 @@ package com.jz.dm.mall.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 数据商品分类(行业)(TDataGoodsCategory)实体类
......@@ -14,6 +16,7 @@ import java.util.Date;
*/
@TableName("t_data_goods_category")
@ApiModel
@Data
public class DataGoodsCategory implements Serializable {
private static final long serialVersionUID = -54881838919746328L;
/**
......@@ -44,60 +47,7 @@ public class DataGoodsCategory implements Serializable {
private String delFlag;
public Long getCategoryId() {
return categoryId;
}
private List<DataGoodsCategory> children;
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getIfChild() {
return ifChild;
}
public void setIfChild(String ifChild) {
this.ifChild = ifChild;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/14
* @Version:
*/
@TableName("t_mall_menu")
@ApiModel
@Data
public class MallMenu implements Serializable {
private static final long serialVersionUID = -6052333871675767623L;
/**
* 菜单ID
*/
@TableId(value = "menu_id",type = IdType.AUTO)
private Long menuId;
/**
* 菜单名称
*/
@ApiModelProperty(value = "菜单名称")
private String menuName;
/**
* 菜单路径
*/
@ApiModelProperty(value = "菜单路径url")
private String url;
/**
* 父级id
*/
@ApiModelProperty(value = "父级id")
private Long parentId;
/**
* 是否为子节点:Y是,N否
*/
@ApiModelProperty(value = "是否为子节点:Y是,N否")
private String ifChild;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date creTime;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private Long crePerson;
/**
* 删除标识:Y删除,N未删除
*/
@ApiModelProperty(value = "删除标识:Y删除,N未删除")
private String delFlag;
private List<MallMenu> children;
}
......@@ -3,6 +3,8 @@ package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.entity.DataGoodsCategory;
import java.util.List;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表数据库访问层
......@@ -13,4 +15,5 @@ import com.jz.dm.mall.moduls.entity.DataGoodsCategory;
public interface DataGoodsCategoryDao extends BaseMapper<DataGoodsCategory> {
List<DataGoodsCategory> selectByList();
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
import com.jz.dm.mall.moduls.entity.FinanceCustomerBalance;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
/**
* 商城企业客户资产(TFinanceCustomerAssets)表数据库访问层
......@@ -26,8 +28,6 @@ public interface FinanceCustomerAssetsDao extends BaseMapper<FinanceCustomerAsse
FinanceCustomerAssets findById(@Param("assetsId")Long assetsId);
void updateAssets(FinanceCustomerAssets assets);
// 修改金额
......
......@@ -3,9 +3,11 @@ package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto;
import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.dm.mall.moduls.entity.MallMenu;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
......@@ -60,4 +62,13 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
*/
int updatePassword(MallCustomer customer);
/**
* 根据用户id,角色id查找菜单
* @param userId
* @param roleId
* @return
*/
List<MallMenu> getMenu(@Param("userId") Long userId,
@Param("roleId") Long roleId);
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.common.utils.Result;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表服务接口
*
......@@ -9,4 +11,6 @@ package com.jz.dm.mall.moduls.service;
public interface DataGoodsCategoryService {
Result findCategory();
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto;
import com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest;
import com.jz.dm.mall.moduls.entity.MallCustomer;
......@@ -56,6 +57,14 @@ public interface MallCustomerService {
*/
MallCustomer selectByUser(Long customerId);
/**
* 根据用户id,姐角色id查找菜单
* @param userId
* @param roleId
* @return
*/
Result getMenu(Long userId, Long roleId);
// /**
// * 忘记密码
// * @param customer
......
package com.jz.dm.mall.moduls.service;
import com.jz.common.utils.Result;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/12
* @Version:
*/
public interface PictureService {
/**
* 图片上传
* @param file
* @return
*/
Result uploadPicture(MultipartFile file, String params);
/**
* 图片下载
* @param url
* @return
*/
Result downloadPicture(String url, HttpServletResponse response);
}
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.entity.DataGoodsCategory;
import com.jz.dm.mall.moduls.mapper.DataGoodsCategoryDao;
import com.jz.dm.mall.moduls.service.DataGoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表服务实现类
*
......@@ -15,6 +21,39 @@ import org.springframework.stereotype.Service;
@Service("dataGoodsCategoryService")
public class DataGoodsCategoryServiceImpl implements DataGoodsCategoryService {
@Autowired
private DataGoodsCategoryDao tDataGoodsCategoryDao;
private DataGoodsCategoryDao categoryDao;
/**
* 查询所有的商品分类
*
* @return
*/
@Override
public Result findCategory() {
//1、查出所有分类
List<DataGoodsCategory> entities = categoryDao.selectByList();
// 找到所有的一级分类
List<DataGoodsCategory> level1Menus = entities.stream().filter(categoryEntity -> categoryEntity.getParentId() == 0 && categoryEntity.getIfChild().equals("N")
// categoryEntity ->
// categoryEntity.getParentId() == 0 && categoryEntity.getIfChild().equals("N")
).map((menu)->{
menu.setChildren(getChildrens(menu,entities));
return menu;
}).collect(Collectors.toList());
return Result.of_success(ResultMsg.SUCCESS, level1Menus);
}
private List<DataGoodsCategory> getChildrens(DataGoodsCategory root,List<DataGoodsCategory> all) {
List<DataGoodsCategory> children = all.stream().filter(categoryEntity -> {
return categoryEntity.getParentId() == root.getCategoryId() && categoryEntity.getIfChild().equals("Y");
}).map(categoryEntity -> {
//1、找到子菜单,同时递归调用
categoryEntity.setChildren(getChildrens(categoryEntity, all));
return categoryEntity;
}).collect(Collectors.toList());
return children;
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import com.jz.common.constant.Constants;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.enums.AuditStatusEnum;
import com.jz.common.utils.CommonsUtil;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.finance.bean.*;
import com.jz.dm.mall.moduls.entity.FinanceCashOut;
......@@ -59,6 +60,18 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean uptAccountMoney(FinanceCustomerBalanceRequest customerBalanceRequest) throws Exception {
if (customerBalanceRequest.getAssetsId() != null && StringUtils.isNotEmpty(customerBalanceRequest.getBalanceMoney().toString())) {
// 商城企业客户资产表 冻结金额
FinanceCustomerAssets assets = financeCustomerAssetsDao.findById(customerBalanceRequest.getAssetsId());
BigDecimal frozenMoney = assets.getFrozenMoney();
if (frozenMoney.compareTo(BigDecimal.ZERO) > -1) {
// 添加冻结金额
BigDecimal add = frozenMoney.add(customerBalanceRequest.getBalanceMoney());
assets.setFrozenMoney(add);
assets.setUptPerson(getUser().getCustomerId() + "");
assets.setUptTime(DateUtils.getToday());
financeCustomerAssetsDao.updateMoney(assets);
}
//1.充值记录表中加数据
FinanceCustomerBalance financeCustomerBalance = new FinanceCustomerBalance();
financeCustomerBalance.setAssetsId(customerBalanceRequest.getAssetsId());//企业资产id
......@@ -71,6 +84,9 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
int len = financeCustomerAssetsDao.addCoustomerCzMoney(financeCustomerBalance);
return len > 0;
}
return false;
}
@Override
public FinanceCashOutDto getCashOutAuditStutas(Map map) throws Exception {
......@@ -117,14 +133,15 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
if (useMoney != null && cashOutMoney != null) {
if (useMoney.compareTo(cashOutMoney) > -1) { //可用大于等于提现
useMoney = useMoney.subtract(cashOutMoney); //可用 减去 提现
BigDecimal djMoney = new BigDecimal(dto.getFrozenMoney().toString()); //冻结金额
// 冻结金额必须大于等于0
if (djMoney.compareTo(BigDecimal.ZERO) > -1) {
djMoney = djMoney.add(cashOutMoney); //累计冻结金额
//修改企业资产 金额
FinanceCustomerAssets assets = new FinanceCustomerAssets();
assets.setUptTime(new Date());
assets.setUptPerson(getUser().getCustomerId()+ "");
assets.setUptPerson(getUser().getCustomerId() + "");
assets.setUseMoney(useMoney);
assets.setFrozenMoney(djMoney);
assets.setTotalMoney(useMoney);
......@@ -141,6 +158,8 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
return result;
}
}
return Result.error("金额小于0!");
}
return result;
}
......
......@@ -56,7 +56,7 @@ public class LogInfoServiceImpl implements LogInfoService {
public PageInfoResponse<PlatformLog> getMallUserLogInfo(LogInfoQueryReq req, HttpServletRequest request) {
PageInfoResponse<PlatformLog> pageInfoResponse = new PageInfoResponse<>();
//MallCustomerApiDto currentUser = CurrentUser.getCurrentUser(request);
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("user_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
// System.out.println(currentUser.getCustomerName());
if (null == currentUser) {
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
......
......@@ -3,13 +3,16 @@ package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.bean.MallCustomerApiDto;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultMsg;
import com.jz.common.enums.UserTypeEnum;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.SessionUtils;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto;
import com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest;
import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.dm.mall.moduls.entity.MallMenu;
import com.jz.dm.mall.moduls.mapper.MallCustomerDao;
import com.jz.dm.mall.moduls.service.MallCustomerService;
......@@ -18,10 +21,9 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.xml.crypto.Data;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
......@@ -62,6 +64,7 @@ public class MallCustomerServiceImpl implements MallCustomerService {
request.getSession().setAttribute("mallCustomer", mallCustomerApiDto);
// 存入到redis
redisTemplate.opsForValue().set("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER, mallCustomerApiDto, 3, TimeUnit.DAYS);
}
return mallCustomer;
......@@ -167,16 +170,41 @@ public class MallCustomerServiceImpl implements MallCustomerService {
return mallCustomer;
}
// /**
// * 忘记密码
// *
// * @param customer
// */
// @Override
// public void upPassword(CustomerRequest customer) {
// // 通过手机号判断是否注册过
//
// }
/**
* 根据用户id,姐角色id查找菜单
*
* @param userId
* @param roleId
* @return
*/
@Override
public Result getMenu(Long userId, Long roleId) {
//查询用户拥有的角色
List<MallMenu> entities = tMallCustomerDao.getMenu(userId, roleId);
// 找到所有的一级分类
List<MallMenu> level1Menus = entities.stream().filter(sysMenuEntity ->
sysMenuEntity.getParentId() == 0 && sysMenuEntity.getIfChild().equals("N")
).map((menu)->{
menu.setChildren(getChildrens(menu,entities));
return menu;
}).collect(Collectors.toList());
return Result.of_success(ResultMsg.SUCCESS, level1Menus);
}
private List<MallMenu> getChildrens(MallMenu sysMenu,List<MallMenu> all) {
List<MallMenu> children = all.stream().filter(sysMenuEntity -> {
return sysMenuEntity.getParentId() == sysMenu.getMenuId() && sysMenuEntity.getIfChild().equals("Y");
}).map(sysMenuEntity -> {
//1、找到子菜单,同时递归调用
sysMenuEntity.setChildren(getChildrens(sysMenuEntity, all));
return sysMenuEntity;
}).collect(Collectors.toList());
return children;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.MallCustomerApiDto;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.HttpsUtils;
import com.jz.common.utils.HttpsUtilsTest;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.bean.*;
import com.jz.dm.mall.moduls.entity.Order;
import com.jz.dm.mall.moduls.mapper.OrderDao;
import com.jz.dm.mall.moduls.service.OrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -43,8 +40,8 @@ public class OrderServiceImpl implements OrderService {
@Autowired
private OrderDao orderDao;
@Autowired
private HttpsUtils httpsUtils;
//@Autowired
//private HttpsUtils httpsUtils;
@Autowired
private RedisTemplate redisTemplate;
......@@ -134,8 +131,8 @@ public class OrderServiceImpl implements OrderService {
//调用gatway
JSONObject object = new JSONObject();
object.put("authCode",req.getGoodsToken());
String s = httpsUtils.submitPost(gatewayUpSalt, object.toString());
object.put("id",req.getId());
String s = HttpsUtilsTest.submitPost(gatewayUpSalt, object.toString());
//处理返回的参数
JSONObject params = JSONObject.parseObject(s);
if (!params.get("code").equals(200) || org.springframework.util.StringUtils.isEmpty(params.get("data"))) {
......
......@@ -54,8 +54,8 @@ public class PayServiceImpl implements PayService {
@Autowired
private FinanceTradeFlowDao financeTradeFlowDao;
@Autowired
private HttpsUtils httpsUtils;
//@Autowired
//private HttpsUtils httpsUtils;
@Value("${domain.gatewayGetAuth}")
private String gatewayGetAuth;
......@@ -125,6 +125,7 @@ public class PayServiceImpl implements PayService {
// 获取企业资产信息
FinanceCustomerAssets assets = financeCustomerAssetsDao.findById(payDto.getAssetsId());
// Long q = financeCustomerAssetsDao.findByOne(l);
// 可用金额减去支付金额
BigDecimal bigDecimal = new BigDecimal(assets.getUseMoney()+ "");
BigDecimal bigDecima2 = new BigDecimal(payDto.getDataPrice()+ "");
......@@ -150,7 +151,7 @@ public class PayServiceImpl implements PayService {
apiReq.setOrgType("OUT"); // TODO
apiReq.setUserId(payDto.getCustomerId() + "");
String post = httpsUtils.submitPost(gatewayGetAuth, JSON.toJSONString(apiReq));
String post = HttpsUtilsTest.submitPost(gatewayGetAuth, JSON.toJSONString(apiReq));
System.out.println(post);
JSONObject params = JSONObject.parseObject(post);
if (!params.get("code").equals(200) || StringUtils.isEmpty(params.get("data"))){
......
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.utils.FtpUtil;
import com.jz.common.utils.RandomUtil;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.dm.mall.moduls.service.PictureService;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/12
* @Version:
*/
@Service("pictureService")
public class PictureServiceImpl implements PictureService {
@Value("${ftp.url}")
private String ftpUrl;
@Value("${ftp.port}")
private Integer port;
@Value("${ftp.username}")
private String username;
@Value("${ftp.password}")
private String password;
/**
* 图片上传
*
* @param file
* @return
*/
@Override
public Result uploadPicture(MultipartFile file, String params) {
Result result = new Result();
if (file.getSize() > 10240000) {
return Result.of_error("图片格式太大,不能超过10MB!");
}
// 获取图片名称
String originalFilename = file.getOriginalFilename();
// 获取图片扩展名
String extensionName = originalFilename.substring(originalFilename.lastIndexOf("."));
// 重新命名图片
String picture = RandomUtil.getStringRandom(16) + extensionName;
// 上传图片
try {
String filePath = "";
if (params.equals("logo")) {
filePath = "/picture/logo";
}else if (params.equals("businessLicense")) {
filePath = "/picture/businessLicense";
}
boolean flag = FtpUtil.uploadFile(ftpUrl, port, username, password, "/", filePath, picture, file.getInputStream());
if (flag) {
String url = "/manage/downloadPicture?url=" + filePath + "/" + picture;
result.setData(url);
result.setMsg("图片上传成功!");
}else {
result.setMsg("图片上传失败!");
result.setCode(StatusCode.ERROR);
}
} catch (IOException e) {
e.printStackTrace();
result.setMsg("图片上传失败!");
result.setCode(StatusCode.ERROR);
}
return result;
}
/**
* 图片下载
*
* @param url
* @return
*/
@Override
public Result downloadPicture(String url, HttpServletResponse response) {
Result result = new Result();
FTPClient ftp = new FTPClient();
String catalog = url.substring(url.lastIndexOf("=")+ 1);
String remotePath = catalog.substring(0, catalog.lastIndexOf("/") + 1);
String furl = url.substring(url.lastIndexOf("/") +1);
String suffix = catalog.substring(catalog.lastIndexOf("."));
try {
int reply;
ftp.connect(ftpUrl, port);
// 登录
ftp.login(username, password);
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
}
ftp.enterLocalPassiveMode();
// 到FTP服务器目录
ftp.changeWorkingDirectory(remotePath);
InputStream in = ftp.retrieveFileStream(furl);
ServletOutputStream outputStream = response.getOutputStream();
int len = 0;
byte[] buffer = new byte[1024];
while ((len = in.read(buffer)) != -1) {
outputStream.write(buffer, 0, len);
}
// byte[] bytes = sos.toByteArray();
response.setHeader("Content-Disposition", "attachment;filename="+suffix);
IOUtils.copy(in, outputStream);
in.close();
outputStream.close();
ftp.logout();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (ftp.isConnected()) {
try {
ftp.disconnect();
} catch (Exception ioe) {
}
}
}
return result;
}
}
......@@ -12,10 +12,10 @@ management:
spring:
profiles: test
datasource:
url: jdbc:mysql://rm-wz9n399q2avsy3k6m4o.mysql.rds.aliyuncs.com:3306/wj-mkt-project?characterEncoding=utf8&useSSL=false
url: jdbc:mysql://192.168.1.140:3307/wj-mkt-project?characterEncoding=utf8&useSSL=false
driverClassName: com.mysql.jdbc.Driver
username: root
password: I%ou$buy!ok
username: dmp
password: Ioubuy123
type: com.alibaba.druid.pool.DruidDataSource
#监控统计拦截的filters
filters: stat
......@@ -45,7 +45,7 @@ spring:
public-key: rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq
redis:
# database: 0
# host: 47.115.53.1
# host: 127.0.0.1
# port: 6379
# password: 123456
# timeout: 5000
......@@ -57,11 +57,12 @@ spring:
- 192.168.1.146:6382
- 192.168.1.146:6383
- 192.168.1.146:6384
session:
store-type: redis
#mybatis的配置
mybatis:
#配置mapper.xml文件所在路径
mapper-locations: classpath:mapperconf/*.xml
mapper-locations: classpath:mapper.*/*.xml
#配置映射类所在的包名
type-aliases-package: com.jz.dm.mall.moduls.entity
......@@ -70,4 +71,11 @@ logging:
com.jz.dm.mall: debug
domain:
apigateway: http://47.115.53.1:8088/api/auth/mall-user-auth-api
\ No newline at end of file
gatewayGetAuth: http://47.115.53.1:8088/api/auth/mall-user-auth-api
gatewayUpSalt: http://47.115.53.1:8088/api/auth/reset-salt
ftp:
url: 192.168.1.141
port: 21
username: ftpuser
password: 9zDatacn
\ No newline at end of file
......@@ -176,8 +176,8 @@
t1.head_portrait_url as headPortraitUrl,
t3.assets_id as assetsId
from t_mall_customer t1
left join t_department t2 on t1.department_id=t2.department_id
left join t_finance_customer_assets t3 on t3.department_id=t2.department_id
INNER JOIN t_department t2 ON t1.department_id = t2.department_id
INNER JOIN t_finance_customer_assets t3 ON t3.department_id = t2.department_id
where 1=1 and t1.del_flag='N' and customer_account = #{username};
</select>
......@@ -192,8 +192,8 @@
t1.head_portrait_url as headPortraitUrl,
t3.assets_id as assetsId
from t_mall_customer t1
left join t_department t2 on t1.department_id=t2.department_id
left join t_finance_customer_assets t3 on t3.department_id=t2.department_id
INNER JOIN t_department t2 ON t1.department_id = t2.department_id
INNER JOIN t_finance_customer_assets t3 ON t3.department_id = t2.department_id
where 1=1 and t1.del_flag='N' and customer_phone = #{username}
</select>
......@@ -239,4 +239,21 @@
</set>
where customer_id = #{customerId}
</update>
<select id="getMenu" resultType="com.jz.dm.mall.moduls.entity.MallMenu">
select
c.role_name AS roleName,
c.role_id AS roleId,
e.menu_id AS menuId,
e.menu_name AS menuName,
e.parent_id AS parentId,
e.url as url,
e.if_child as ifChild
from t_mall_customer a
inner join t_mall_user_role b on a.customer_id=b.customer_id
inner join t_mall_role c on c.role_id=b.role_id
inner join t_mall_role_menu d on d.role_id=c.role_id
inner join t_mall_menu e on e.menu_id=d.menu_id
where a.customer_id=#{userId} and c.role_id = #{roleId}
</select>
</mapper>
\ No newline at end of file
......@@ -153,7 +153,7 @@
</update>
<!--添加一条充值记录-->
<insert id="addCoustomerCzMoney" keyProperty="cashOutId" useGeneratedKeys="true">
<insert id="addCoustomerCzMoney" keyProperty="customerBalanceId" useGeneratedKeys="true">
insert into t_finance_customer_balance(assets_id, balance_money, remark, cre_time, cre_person, audit_status)
values (#{assetsId}, #{balanceMoney}, #{remark}, #{creTime}, #{crePerson}, #{auditStatus})
</insert>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.mall.moduls.mapper.DataGoodsCategoryDao">
<mapper namespace="com.jz.dm.mall.moduls.mapper.DataGoodsCategoryDao">
<resultMap type="com.jz.dm.mall.moduls.entity.DataGoodsCategory" id="TDataGoodsCategoryMap">
<result property="categoryId" column="category_id" jdbcType="INTEGER"/>
......@@ -118,4 +118,10 @@
delete from t_data_goods_category where category_id = #{categoryId}
</delete>
<select id="selectByList" resultMap="TDataGoodsCategoryMap">
select
category_id, category_name, parent_id, if_child
from t_data_goods_category
where del_flag = 'N'
</select>
</mapper>
\ No newline at end of file
......@@ -145,6 +145,10 @@
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
</dependency>
<!--阿里云服务器短信平台-->
<dependency>
<groupId>com.aliyun</groupId>
......@@ -156,6 +160,73 @@
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/**</exclude>
<exclude>xls/**</exclude>
<exclude>conf/**</exclude>
<exclude>emails/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/**</include>
<include>xls/**</include>
<include>conf/**</include>
<include>emails/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.8.RELEASE</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<!-- 过滤后缀为pem、pfx的证书文件 -->
<nonFilteredFileExtensions>
<nonFilteredFileExtension>p12</nonFilteredFileExtension>
<nonFilteredFileExtension>pem</nonFilteredFileExtension>
<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.jz.manage;
import com.jz.common.utils.HttpsUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
@EnableTransactionManagement
......@@ -22,9 +19,9 @@ public class manageApplication {
SpringApplication.run(manageApplication.class, args);
}
@Bean
public HttpsUtils restTemplate() {
return new HttpsUtils();
}
// @Bean
// public HttpsUtils restTemplate() {
// return new HttpsUtils();
// }
}
package com.jz.manage.moduls.controller.finance;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jz.common.bean.BasePageBean;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
......@@ -118,20 +119,21 @@ public class PlatformTradeFlowInfoController extends BaseController {
*/
@PostMapping(value = "/cashOutList")
@ApiOperation(value = "提现管理--分页列表", notes = "分页列表")
public PageInfoResponse<CashOutListDto> getFinanceCashOutList(@RequestBody CashOutListRequest cashOutListRequest, HttpServletRequest httpRequest) throws Exception {
PageInfoResponse<CashOutListDto> pageInfo = new PageInfoResponse<CashOutListDto>();
Map map = new HashMap();
public Result<IPage<CashOutListDto>> getFinanceCashOutList(@RequestBody CashOutListRequest cashOutListRequest, HttpServletRequest httpRequest) throws Exception {
/*PageInfoResponse<CashOutListDto> pageInfo = new PageInfoResponse<CashOutListDto>();
Map map = new HashMap();*/
//从session中获取平台用户id
//SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser");
//map.put("userId", user.getUserId());
try {
return Result.of_success(platformTradeFlowInfoService.findListFinanceCashOut(cashOutListRequest, httpRequest));
/* try {
pageInfo = platformTradeFlowInfoService.findListFinanceCashOut(cashOutListRequest, httpRequest);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}*/
// return pageInfo;
}
/**
......
......@@ -36,6 +36,17 @@ public class CashOutListRequest extends BasePageBean {
@ApiModelProperty(value = "提现时间")
private String casOutTime;
@ApiModelProperty(value = "企业名/提现描述")
private String key;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getDepartmentName() {
return departmentName;
}
......
package com.jz.manage.moduls.controller.finance.platForm;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
......@@ -39,13 +41,13 @@ public class TradeDetilRequest extends BasePageBean {
private String orderMethod;
@ApiModelProperty(value = "创建时间")
private Date creTime;
private String creTime;
public Date getCreTime() {
public String getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
public void setCreTime(String creTime) {
this.creTime = creTime;
}
......
package com.jz.manage.moduls.controller.sys;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.entity.SysMenu;
import com.jz.manage.moduls.entity.SysUser;
import com.jz.manage.moduls.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* 平台系统用户表(TSysUser)表控制层
......@@ -31,8 +36,15 @@ public class SysUserController extends BaseController {
private SysUserService sysUserService;
@PostMapping("/getMenu")
public Result getMenu(@RequestParam(name = "userId") Long userId) {
List<SysMenu> list = sysUserService.selectByMenu(userId);
return new Result(true, "成功!", 200, list);
@ApiOperation(value = "平台--角色展示菜单", notes = "暂时不使用")
public Result getMenu(@RequestParam(name = "userId") Long userId,
@RequestParam(name = "roleId") Long roleId) {
Result menu = sysUserService.getMenu(userId, roleId);
if (!StringUtils.isEmpty(menu)) {
menu.setMsg("查询菜单成功!");
menu.setCode(StatusCode.OK);
return menu;
}
return new Result(false, "查询菜单失败!", StatusCode.ERROR);
}
}
\ No newline at end of file
......@@ -3,10 +3,10 @@ package com.jz.manage.moduls.controller.sys;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.utils.Result;
import com.jz.common.utils.SMSUtils;
import com.jz.common.utils.StatusCode;
import com.jz.common.utils.ValidateCodeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -32,21 +32,15 @@ public class ValidateCodeController {
// 通过手机号从redis获取验证码
String codeInRedis = (String) redisTemplate.opsForValue().get(key);
if (!StringUtils.isEmpty(codeInRedis)) {
return new Result(false, "验证码已发送,请注意查收!");
}else {
// 生成验证码
String code = ValidateCodeUtils.generateValidateCode(6) + "";
// 发送
try {
SMSUtils.sendShortMessage(SMSUtils.VALIDATE_CODE, telephone, code);
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "验证码发送失败!");
}
// 存入redis, 有效期为5分钟
if (codeInRedis!=null && !codeInRedis.equals("")) {
// redis中的验证码还未过期
return new Result(false,"验证码发送失败!", StatusCode.ERROR);
} else {
// redis中无此手机号的验证码,发送验证码
Integer code = ValidateCodeUtils.generateValidateCode(6);
SMSUtils.sendMessage(SMSUtils.loginTemplate,code, telephone);
redisTemplate.opsForValue().set(key,code,5, TimeUnit.MINUTES);
return new Result(true, "验证码发送成功!");
return new Result(true, "验证码发送成功!", StatusCode.OK);
}
}
}
......@@ -48,7 +48,7 @@ public class DataGoodsCategory implements Serializable {
private String delFlag;
private List<DataGoodsCategory> Children;
private List<DataGoodsCategory> children;
}
\ No newline at end of file
package com.jz.manage.moduls.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.PlatformTradeFlowInfo;
import com.jz.manage.moduls.controller.finance.platForm.*;
......@@ -22,7 +25,9 @@ public interface PlatformTradeFlowInfoDao extends BaseMapper<PlatformTradeFlowIn
List<TradeDetilDto> findListFinanceTradeDetil(Map param) throws Exception;
List<CashOutListDto> findListFinanceCashOut(Map param) throws Exception;
List<CashOutListDto> findListFinanceCashOut(QueryWrapper queryWrapper) throws Exception;
CashOutInfoDto queryCashOutByid(@Param("cashOutId") String cashOutId) throws Exception;
IPage<CashOutListDto> list(IPage<CashOutListDto> page, @Param("ew") Wrapper<CashOutListDto> query);
}
\ No newline at end of file
......@@ -17,7 +17,9 @@ import java.util.Map;
public interface SysUserDao extends BaseMapper<SysUser> {
List<Map> getUserRoleByAccount(@Param("account") String account);
List<Map> getUserRoleByAccount(@Param("userId") Long userId,
@Param("roleId") Long roleId);
List<SysMenu> selectBuMenu(@Param("userId") Long userId);
List<SysMenu> getMenu(@Param("userId") Long userId,
@Param("roleId") Long roleId);
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsListDto;
import com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsListRequest;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
import org.springframework.web.multipart.MultipartFile;
/**
* 数据商品(DataGoods)表服务接口
......
package com.jz.manage.moduls.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jz.common.bean.BasePageBean;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.utils.Result;
......@@ -23,7 +24,7 @@ public interface PlatformTradeFlowInfoService {
PageInfoResponse<TradeDetilDto> findListFinanceTradeDetil(TradeDetilRequest tradeDetilRequest, HttpServletRequest httpRequest) throws Exception;
PageInfoResponse<CashOutListDto> findListFinanceCashOut(CashOutListRequest cashOutListRequest, HttpServletRequest httpRequest) throws Exception;
IPage<CashOutListDto> findListFinanceCashOut(CashOutListRequest cashOutListRequest, HttpServletRequest httpRequest) throws Exception;
CashOutInfoDto queryCashOutByid(String cashOutId) throws Exception;
......
......@@ -2,6 +2,7 @@ package com.jz.manage.moduls.service;
import com.jz.common.entity.SysUser;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.entity.SysMenu;
import javax.servlet.http.HttpServletRequest;
......@@ -23,7 +24,7 @@ public interface SysUserService {
SysUser selectByPhone(String telephone, HttpServletRequest request);
Map<String,Object> getUserRoleByAccount(String account);
Map<String,Object> getUserRoleByAccount(Long userId, Long roleId);
List<SysMenu> selectByMenu(Long id);
Result getMenu(Long userId, Long roleId);
}
\ No newline at end of file
package com.jz.manage.moduls.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.entity.DataGoodsCategory;
......@@ -9,10 +8,8 @@ import com.jz.manage.moduls.service.DataGoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
......@@ -41,12 +38,6 @@ public class DataGoodsCategoryServiceImpl implements DataGoodsCategoryService {
categoryEntity.getParentId() == 0 && categoryEntity.getIfChild().equals("N")
).map((menu)->{
menu.setChildren(getChildrens(menu,entities));
// for (DataGoodsCategory child : menu.getChildren()) {
// if (child.getChildren().size() == 0 ) {
// return null;
// }
// return menu;
// }
return menu;
}).collect(Collectors.toList());
return Result.of_success(ResultMsg.SUCCESS, level1Menus);
......@@ -64,4 +55,4 @@ public class DataGoodsCategoryServiceImpl implements DataGoodsCategoryService {
return children;
}
}
\ No newline at end of file
}
\ No newline at end of file
......@@ -11,7 +11,6 @@ import com.jz.common.bean.PageInfoResponse;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.Constants;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.entity.DataGoods;
import com.jz.common.utils.*;
......@@ -44,7 +43,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.multipart.MultipartFile;
/**
......@@ -68,8 +66,6 @@ public class DataGoodsServiceImpl implements DataGoodsService {
@Autowired
private DataGoodsApiDao tDataGoodsApiDao;
@Autowired
private HttpsUtils httpsUtils;
@Value("${domain.apigateway}")
private String apiGateway;
......@@ -235,16 +231,6 @@ public class DataGoodsServiceImpl implements DataGoodsService {
}
//
// @Override
// public Result getJoinType(String parentKey) {
// Map headers = new HashMap<>();
// headers.put("Content-type","application/x-www-form-urlencoded;charset=UTF-8");
// String url = "http://127.0.0.1:8088/api/direction/getApiTypeList";
// String s = httpsUtils.submitPost(url,parentKey , headers);
// System.out.println(s);
// return null;
// }
/**
......@@ -306,7 +292,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
apiReq.setApiExample(dataApiUpReq.getReturnDataExample());
String post = httpsUtils.submitPost(apiGateway, JSON.toJSONString(apiReq));
String post = HttpsUtilsTest.submitPost(apiGateway, JSON.toJSONString(apiReq));
JSONObject result = JSON.parseObject(post);
if (!result.get("code").equals(200) || org.springframework.util.StringUtils.isEmpty(result.get("data"))){
return Result.of_error("制作失败!");
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.Constants;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode;
......@@ -18,7 +19,7 @@ import com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto;
import com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest;
import com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest;
import com.jz.manage.moduls.controller.sys.bean.dto.SysUserDto;
import com.jz.manage.moduls.entity.Department;
import com.jz.manage.moduls.entity.FinanceCustomerAssets;
import com.jz.manage.moduls.entity.FinanceCustomerBalance;
......@@ -31,6 +32,7 @@ import com.jz.manage.moduls.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
......@@ -156,7 +158,7 @@ public class DepartmentServiceImpl implements DepartmentService {
* @param
*/
@Override
@Transactional()
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result add(SaveCustomerRequest saveCustomerReq, HttpServletRequest req) {
// 校验信息
Result s = userCheck(saveCustomerReq);
......@@ -164,7 +166,6 @@ public class DepartmentServiceImpl implements DepartmentService {
if (!success) {
return Result.error("添加用户失败!");
}
// SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
SysUserDto userDto = (SysUserDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
// 保存企业信息
......
......@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.Constants;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.enums.AuditStatusEnum;
import com.jz.common.enums.TradeFlowEnum;
import com.jz.common.utils.NumberUtils;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.finance.platForm.BalanceAuditRequest;
import com.jz.manage.moduls.controller.finance.platForm.BalanceInfoDto;
......@@ -23,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -54,6 +58,10 @@ public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalance
@Autowired
private FinanceTradeFlowDao financeTradeFlowDao;
@Autowired
private RedisTemplate redisTemplate;
@Override
public PageInfoResponse<BalanceListDto> findListBalance(BalanceListRequest balanceListRequest, HttpServletRequest httpRequest) throws Exception {
PageInfoResponse<BalanceListDto> pageInfoResponse = new PageInfoResponse<>();
......@@ -99,17 +107,14 @@ public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalance
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> uptBalanceInfoAuditByid(BalanceAuditRequest balanceAuditRequest) throws Exception {
//1.修改充值记录状态
FinanceCustomerBalance balance = new FinanceCustomerBalance();
balance.setAuditStatus(balanceAuditRequest.getAuditStatus());
balance.setRejectReason(balanceAuditRequest.getRejectReason());
balance.setCustomerBalanceId(Long.valueOf(balanceAuditRequest.getCustomerBalanceId()));
//balance.setUptPerson();
balance.setUptPerson(getUserId()+"");
balance.setUptTime(new Date());
int len = financeCustomerBalanceDao.updateById(balance);
if (len > 0) {
logger.info("###########################修改充值审核状态成功####################################");
//2.查询出充值金额 和 账户id
//1.查询出充值金额 和 账户id
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("customer_balance_id", balanceAuditRequest.getCustomerBalanceId());
wrapper.eq("del_flag", "N");
......@@ -118,13 +123,16 @@ public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalance
String balanceMoney = financeCustomerBalance.getBalanceMoney().toString(); //充值金额
BigDecimal balanceMoneyObj = new BigDecimal(balanceMoney);
//3.查询资产金额
//2.查询资产金额
QueryWrapper assetsWrapper = new QueryWrapper();
assetsWrapper.eq("assets_id", assetsId);
wrapper.eq("del_flag", "N");
FinanceCustomerAssets financeCustomerAssets = financeCustomerAssetsDao.selectOne(assetsWrapper);
String frozenMoney = financeCustomerAssets.getFrozenMoney().toString(); // 冻结金额
BigDecimal frozenMoneyObj = new BigDecimal(frozenMoney);
// 冻结金额大于等于充值金额
if (frozenMoney.compareTo(balanceMoney.toString()) > -1) {
// 减去冻结金额
frozenMoneyObj = frozenMoneyObj.subtract(balanceMoneyObj);
if (AuditStatusEnum.YSH.getValue().equals(balanceAuditRequest.getAuditStatus())) {
......@@ -144,21 +152,21 @@ public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalance
saveAssets.setTotalMoney(totalMoneyObj);
saveAssets.setFrozenMoney(frozenMoneyObj);
saveAssets.setUptTime(new Date());
//saveAssets.setUptPerson();
saveAssets.setUptPerson(getUserId()+ "");
financeCustomerAssetsDao.updateById(saveAssets);
logger.info("###########################充值审核通过---更新企业资产成功####################################");
balance.setAuditStatus(balanceAuditRequest.getAuditStatus());
//添加流水记录
FinanceTradeFlow financeTradeFlow = new FinanceTradeFlow();
financeTradeFlow.setCreTime(new Date());
financeTradeFlow.setTradeMoney(balanceMoneyObj);
financeTradeFlow.setAssetsId(assetsId);
financeTradeFlow.setTradeType(TradeFlowEnum.CZ.getValue());
financeTradeFlow.setTradeFlowNumber("123132");
financeTradeFlow.setTradeFlowNumber(NumberUtils.getDealNum());
financeTradeFlow.setBalanceMoney(useMoneyObj);
financeTradeFlow.setDelFlag("N");
//financeTradeFlow.setCashOutId();
//financeTradeFlow.setCrePerson();
// financeTradeFlow.setCashOutId();
financeTradeFlow.setCrePerson(getUserId()+ "");
financeTradeFlowDao.insert(financeTradeFlow);
logger.info("#####################商城提现流水记录添加成功#####################");
}
......@@ -168,13 +176,21 @@ public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalance
saveAssets.setAssetsId(assetsId);
saveAssets.setFrozenMoney(frozenMoneyObj);
saveAssets.setUptTime(new Date());
//saveAssets.setUptPerson();
saveAssets.setUptPerson(getUserId()+ "");
financeCustomerAssetsDao.updateById(saveAssets);
logger.info("###########################充值审核未通过--更新企业资产成功####################################");
balance.setAuditStatus(balanceAuditRequest.getAuditStatus());
}
financeCustomerBalanceDao.updateById(balance);
logger.info("###########################修改充值审核状态成功####################################");
return Result.ok();
} else {
return Result.error("提交失败!");
}else {
throw new RuntimeException("提交失败!");
}
}
public Long getUserId() {
SysUserDto userDto = (SysUserDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
return userDto.getUserId();
}
}
package com.jz.manage.moduls.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BasePageBean;
......@@ -94,6 +97,7 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe
//从session中获取平台用户id
//SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser");
//param.put("userId", user.getUserId());
//数据行业
if (StringUtils.isNotEmpty(tradeDetilRequest.getCategoryId())) {
param.put("categoryId", tradeDetilRequest.getCategoryId());
......@@ -110,7 +114,13 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe
if (StringUtils.isNotEmpty(tradeDetilRequest.getDataName())) {
param.put("dataName", tradeDetilRequest.getDataName());
}
if (StringUtils.isNotEmpty(tradeDetilRequest.getCreTime())) {
String creTime = tradeDetilRequest.getCreTime();
String startTime = creTime.substring(0, 10);
String endTime = creTime.substring(11, 21);
param.put("startTime", startTime + "00:00:00");
param.put("endTime", endTime + "23:59:59");
}
PageHelper.startPage(tradeDetilRequest.getPageNum(), tradeDetilRequest.getPageSize());
List<TradeDetilDto> list = platformTradeFlowInfoDao.findListFinanceTradeDetil(param);
PageInfo<TradeDetilDto> pageInfo = new PageInfo<>(list);
......@@ -122,42 +132,54 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe
}
@Override
public PageInfoResponse<CashOutListDto> findListFinanceCashOut(CashOutListRequest cashOutListRequest, HttpServletRequest httpRequest) throws Exception {
PageInfoResponse<CashOutListDto> pageInfoResponse = new PageInfoResponse<>();
public IPage<CashOutListDto> findListFinanceCashOut(CashOutListRequest cashOutListRequest, HttpServletRequest httpRequest) throws Exception {
Map param = new HashMap();
//从session中获取平台用户id
//SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser");
//param.put("userId", user.getUserId());
//提现描述
if (StringUtils.isNotEmpty(cashOutListRequest.getCasOutTime())) {
param.put("casOutTime", cashOutListRequest.getCasOutTime());
IPage<CashOutListDto> page = new Page<>(cashOutListRequest.getPageNum(), cashOutListRequest.getPageSize());
QueryWrapper<CashOutListDto> query = new QueryWrapper();
if (StringUtils.isNotBlank(cashOutListRequest.getKey())){
query.and(wrapper -> wrapper.like("t3.department_name",cashOutListRequest.getKey())
.or().like("t2.remark",cashOutListRequest.getKey()));
}
//企业名
if (StringUtils.isNotEmpty(cashOutListRequest.getDepartmentName())) {
param.put("departmentName", cashOutListRequest.getDepartmentName());
}
//提现状态
if (StringUtils.isNotEmpty(cashOutListRequest.getAuditStatus())) {
param.put("auditStatus", cashOutListRequest.getAuditStatus());
if (StringUtils.isNotBlank(cashOutListRequest.getAuditStatus())){
query.eq("t2.audit_status",cashOutListRequest.getAuditStatus());
}
//提现时间
if (StringUtils.isNotEmpty(cashOutListRequest.getCasOutTime())) {
String casOutTime = cashOutListRequest.getCasOutTime();
// String[] times = casOutTime.split("-");
String casOutTimeStart = casOutTime.substring(0, 10);
String casOutTimeEnd = casOutTime.substring(11, 21);
param.put("casOutTimeStart", casOutTimeStart + " 00:00:00");
param.put("casOutTimeEnd", casOutTimeEnd + " 23:59:59");
if (StringUtils.isNotBlank(cashOutListRequest.getCasOutTime())){
String casOutTimeStart = cashOutListRequest.getCasOutTime().substring(0, 10);
String casOutTimeEnd = cashOutListRequest.getCasOutTime().substring(11, 21);
query.between("t2.casOutTime", casOutTimeStart, casOutTimeEnd);
}
PageHelper.startPage(cashOutListRequest.getPageNum(), cashOutListRequest.getPageSize());
List<CashOutListDto> list = platformTradeFlowInfoDao.findListFinanceCashOut(param);
PageInfo<CashOutListDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
IPage<CashOutListDto> list= platformTradeFlowInfoDao.list(page, query);
return list;
// //提现描述
// if (StringUtils.isNotEmpty(cashOutListRequest.getCasOutTime())) {
// param.put("casOutTime", cashOutListRequest.getCasOutTime());
// }
// //企业名
// if (StringUtils.isNotEmpty(cashOutListRequest.getDepartmentName())) {
// param.put("departmentName", cashOutListRequest.getDepartmentName());
// }
// //提现状态
// if (StringUtils.isNotEmpty(cashOutListRequest.getAuditStatus())) {
// param.put("auditStatus", cashOutListRequest.getAuditStatus());
// }
// //提现时间
// if (StringUtils.isNotEmpty(cashOutListRequest.getCasOutTime())) {
// String casOutTime = cashOutListRequest.getCasOutTime();
//// String[] times = casOutTime.split("-");
// String casOutTimeStart = casOutTime.substring(0, 10);
// String casOutTimeEnd = casOutTime.substring(11, 21);
// param.put("casOutTimeStart", casOutTimeStart + " 00:00:00");
// param.put("casOutTimeEnd", casOutTimeEnd + " 23:59:59");
// }
// PageHelper.startPage(cashOutListRequest.getPageNum(), cashOutListRequest.getPageSize());
// List<CashOutListDto> list = platformTradeFlowInfoDao.findListFinanceCashOut(query);
// PageInfo<CashOutListDto> pageInfo = new PageInfo<>(list);
//
// pageInfoResponse.setCode(Constants.SUCCESS_CODE);
// pageInfoResponse.setMessage("查询成功");
// pageInfoResponse.setData(pageInfo);
// return pageInfoResponse;
}
@Override
......
......@@ -3,10 +3,13 @@ package com.jz.manage.moduls.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultMsg;
import com.jz.common.entity.SysUser;
import com.jz.common.enums.UserTypeEnum;
import com.jz.common.utils.Result;
import com.jz.common.utils.SessionUtils;
import com.jz.manage.moduls.entity.DataGoodsCategory;
import com.jz.manage.moduls.entity.SysMenu;
import com.jz.manage.moduls.mapper.SysUserDao;
import com.jz.manage.moduls.service.SysUserService;
......@@ -18,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* 平台系统用户表(SysUser)表服务实现类
......@@ -82,11 +86,11 @@ public class SysUserServiceImpl implements SysUserService {
}
@Override
public Map<String, Object> getUserRoleByAccount(String account) {
public Map<String, Object> getUserRoleByAccount(Long userId, Long roleId) {
Set<String> roleSet = new HashSet<>();
Set<String> roleMenuSet = new HashSet<>();
//查询用户拥有的角色
List<Map> list = sysUserDao.getUserRoleByAccount(account);
List<Map> list = sysUserDao.getUserRoleByAccount(userId, roleId);
if (list.size() > 0 && list != null) {
for (Map map : list) {
roleSet.add(map.get("roleName").toString());
......@@ -104,20 +108,32 @@ public class SysUserServiceImpl implements SysUserService {
}
@Override
public List<SysMenu> selectByMenu(Long id) {
List<SysMenu> list = sysUserDao.selectBuMenu(id);
list = sortTree(list, 0L);
return list;
}
public Result getMenu(Long userId, Long roleId) {
private List<SysMenu> sortTree(List<SysMenu> list, Long parentId) {
List<SysMenu> returnList = new ArrayList<>();
for (SysMenu sysMenu : list) {
if (sysMenu.getParentId().equals(parentId)) {
sysMenu.setChildren(sortTree(list, sysMenu.getMenuId()));
returnList.add(sysMenu);
}
//查询用户拥有的角色
List<SysMenu> entities = sysUserDao.getMenu(userId, roleId);
// 找到所有的一级分类
List<SysMenu> level1Menus = entities.stream().filter(sysMenuEntity ->
sysMenuEntity.getParentId() == 0 && sysMenuEntity.getIfChild().equals("N")
).map((menu)->{
menu.setChildren(getChildrens(menu,entities));
return menu;
}).collect(Collectors.toList());
return Result.of_success(ResultMsg.SUCCESS, level1Menus);
}
return returnList;
private List<SysMenu> getChildrens(SysMenu sysMenu,List<SysMenu> all) {
List<SysMenu> children = all.stream().filter(sysMenuEntity -> {
return sysMenuEntity.getParentId() == sysMenu.getMenuId() && sysMenuEntity.getIfChild().equals("Y");
}).map(sysMenuEntity -> {
//1、找到子菜单,同时递归调用
sysMenuEntity.setChildren(getChildrens(sysMenuEntity, all));
return sysMenuEntity;
}).collect(Collectors.toList());
return children;
}
}
\ No newline at end of file
......@@ -12,10 +12,10 @@ management:
spring:
profiles: test
datasource:
url: jdbc:mysql://rm-wz9n399q2avsy3k6m4o.mysql.rds.aliyuncs.com:3306/wj-mkt-project?characterEncoding=utf8&useSSL=false
url: jdbc:mysql://192.168.1.140:3307/wj-mkt-project?characterEncoding=utf8&useSSL=false
driverClassName: com.mysql.jdbc.Driver
username: root
password: I%ou$buy!ok
username: dmp
password: Ioubuy123
type: com.alibaba.druid.pool.DruidDataSource
#监控统计拦截的filters
filters: stat
......@@ -73,3 +73,9 @@ logging:
domain:
apigateway: http://47.115.53.1:8088/api/producer/addDataBankApiInfo
ftp:
url: 192.168.1.141
port: 21
username: ftpuser
password: 9zDatacn
\ No newline at end of file
......@@ -175,7 +175,8 @@
left join t_mall_customer t4 on t4.customer_id=t1.customer_id and t4.del_flag='N'
left join t_department t5 on t5.department_id=t4.department_id and t5.del_flag='N'
where 1=1 and t1.order_status='02' and t1.del_flag='N'
<if test="creTime != null">and date_format(t1.cre_time,'%Y-%m-%d')= #{creTime}</if>
<if test="startTime != null">and t1.cre_time >= #{startTime}</if>
<if test="endTime != null"> and #{startTime} >= t1.cre_time</if>
<if test="departmentName != null">and t5.department_name like concat('%',#{departmentName},'%')</if>
<if test="dataName != null">and t3.data_name like concat('%',#{dataName},'%')</if>
<if test="categoryId != null">and t3.category_id = #{categoryId}</if>
......@@ -217,5 +218,25 @@
left join t_finance_cash_out t2 on t2.assets_id=t1.assets_id and t2.del_flag='N'
where 1=1 and t1.del_flag='N' and t2.cash_out_id = #{cashOutId}
</select>
<select id="list" resultType="com.jz.manage.moduls.controller.finance.platForm.CashOutListDto">
select
t2.cash_out_id as cashOutId,
t2.cash_out_money as cashOutMoney,
t2.cash_out_time as casOutTime,
(case when t2.audit_status='01' then '待审核' when t2.audit_status='02' then '已审核'
when t2.audit_status='03' then '未通过' end) as auditStatus,
t2.remark,
t3.department_name as departmentName
from t_finance_customer_assets t1
inner join t_department t3 on t3.department_id=t1.department_id
inner join t_finance_cash_out t2 on t2.assets_id=t1.assets_id and t2.del_flag='N'
${ew.customSqlSegment}
<!--where 1=1 and t1.del_flag='N'-->
<!--<if test="departmentName != null">and t3.department_name like concat('%',#{departmentName},'%')</if>-->
<!--<if test="remark != null">and t2.remark like concat('%',#{remark},'%')</if>-->
<!--<if test="auditStatus != null">and t2.audit_status = #{auditStatus}</if>-->
<!--<if test="casOutTimeStart != null">and t2.cash_out_time >= #{casOutTimeStart}</if>-->
<!--<if test="casOutTimeEnd != null">and #{casOutTimeEnd} >= t2.cash_out_time</if>-->
</select>
</mapper>
\ No newline at end of file
......@@ -122,6 +122,6 @@
select
category_id, category_name, parent_id, if_child
from t_data_goods_category
where del_flag = "N"
where del_flag = 'N'
</select>
</mapper>
\ No newline at end of file
......@@ -145,23 +145,23 @@
inner join t_sys_role c on c.role_id=b.role_id
inner join t_sys_role_menu d on d.role_id=c.role_id
inner join t_sys_menu e on e.menu_id=d.menu_id
where a.account=#{account}
where a.user_id=#{userId} and c.role_id = #{roleId}
</select>
<select id="selectBuMenu" resultType="com.jz.manage.moduls.entity.SysMenu" parameterType="list">
<select id="getMenu" resultType="com.jz.manage.moduls.entity.SysMenu">
select
t5.menu_id as menuid,
t5.menu_name as menuName,
t5.parent_id as parentId,
t5.url as url,
t5.if_child as ifChild
from
t_sys_user t1
JOIN t_sys_user_role t2 on t1.user_id = t2.user_id
Join t_sys_role t3 on t2.role_id = t3.role_id
JOIN t_sys_role_menu t4 on t3.role_id = t4.role_id
JOIN t_sys_menu t5 on t4.menu_id = t5.menu_id
where t1.user_id = #{userId}
c.role_name AS roleName,
c.role_id AS roleId,
e.menu_id AS menuId,
e.menu_name AS menuName,
e.parent_id AS parentId,
e.url as url,
e.if_child as ifChild
from t_sys_user a
inner join t_sys_user_role b on a.user_id=b.user_id
inner join t_sys_role c on c.role_id=b.role_id
inner join t_sys_role_menu d on d.role_id=c.role_id
inner join t_sys_menu e on e.menu_id=d.menu_id
where a.user_id=#{userId} and c.role_id = #{roleId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment