Commit e2e8ebea authored by zhangc's avatar zhangc

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

parents 0a7b743c 6b616132
......@@ -5,3 +5,4 @@
alter table t_data_goods_api add api_type char(2) NOT NULL COMMENT 'api类型:01制作api,02制作数据包';
alter table t_data_goods_api add target_url varchar(128) DEFAULT NULL COMMENT '目标地址';
alter table t_data_goods_api add api_desc varchar(512) DEFAULT NULL COMMENT '接口描述';
alter table t_platform_log add request_type char(2) NOT NULL COMMENT '请求状态:01成功,02失败';
\ No newline at end of file
package com.jz.common.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/12
* @Version:
*/
public class FtpUtil {
/**
* Description: 向FTP服务器上传文件
* @param host FTP服务器hostname
* @param port FTP服务器端口
* @param username FTP登录账号
* @param password FTP登录密码
* @param basePath FTP服务器基础目录
* @param filePath FTP服务器文件存放路径。例如分日期存放:/2015/01/01。文件的路径为basePath+filePath
* @param filename 上传到FTP服务器上的文件名
* @param input 输入流
* @return 成功返回true,否则返回false
*/
public static boolean uploadFile(String host, int port, String username, String password, String basePath,
String filePath, String filename, InputStream input) {
boolean result = false;
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(host, port);// 连接FTP服务器
// 如果采用默认端口,可以使用ftp.connect(host)的方式直接连接FTP服务器
ftp.login(username, password);// 登录
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
return result;
}
//切换到上传目录
if (!ftp.changeWorkingDirectory(basePath+filePath)) {
//如果目录不存在创建目录
String[] dirs = filePath.split("/");
String tempPath = basePath;
for (String dir : dirs) {
if (null == dir || "".equals(dir)) continue;
tempPath += "/" + dir;
if (!ftp.changeWorkingDirectory(tempPath)) {
if (!ftp.makeDirectory(tempPath)) {
return result;
} else {
ftp.changeWorkingDirectory(tempPath);
}
}
}
}
//设置上传文件的类型为二进制类型
ftp.setFileType(FTP.BINARY_FILE_TYPE);
//上传文件
if (!ftp.storeFile(filename, input)) {
return result;
}
input.close();
ftp.logout();
result = true;
} catch (IOException e) {
e.printStackTrace();
} finally {
if (ftp.isConnected()) {
try {
ftp.disconnect();
} catch (IOException ioe) {
}
}
}
return result;
}
/**
* Description: 从FTP服务器下载文件
* @param host FTP服务器hostname
* @param port FTP服务器端口
* @param username FTP登录账号
* @param password FTP登录密码
* @param remotePath FTP服务器上的相对路径
* @param fileName 要下载的文件名
* @param localPath 下载后保存到本地的路径
* @return
*/
public static boolean downloadFile(String host, int port, String username, String password, String remotePath,
String fileName, String localPath) {
boolean result = false;
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(host, port);
// 如果采用默认端口,可以使用ftp.connect(host)的方式直接连接FTP服务器
ftp.login(username, password);// 登录
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
return result;
}
ftp.changeWorkingDirectory(remotePath);// 转移到FTP服务器目录
FTPFile[] fs = ftp.listFiles();
for (FTPFile ff : fs) {
if (ff.getName().equals(fileName)) {
File localFile = new File(localPath + "/" + ff.getName());
OutputStream is = new FileOutputStream(localFile);
ftp.retrieveFile(ff.getName(), is);
is.close();
}
}
ftp.logout();
result = true;
} catch (IOException e) {
e.printStackTrace();
} finally {
if (ftp.isConnected()) {
try {
ftp.disconnect();
} catch (IOException ioe) {
}
}
}
return result;
}
// public static void main(String[] args) {
// try {
// FileInputStream in=new FileInputStream(new File("D:\\soft\\111.png"));
// boolean flag = uploadFile("192.168.1.141", 21, "ftpuser", "9zDatacn", "/","/2021/01/12", "111.png", in);
//// boolean ftpuser = downloadFile("192.168.1.141", 21, "ftpuser", "9zDatacn", "/2021/01/12/", "111.png", "D:\\soft");
// System.out.println(flag);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
......@@ -3,10 +3,12 @@ package com.jz.dm.mall.moduls.controller.finance;
import com.jz.common.base.BaseController;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsReq;
import com.jz.dm.mall.moduls.service.FinanceCustomerAssetsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
......@@ -27,12 +29,22 @@ public class FinanceCustomerAssetsController extends BaseController {
@Autowired
private FinanceCustomerAssetsService assetsService;
@GetMapping("/findAssets")
@ApiOperation(value = "查询余额是否充足")
public Result findAssets(@RequestParam(name = "assetsId", required = false) Long assetsId,
@RequestParam(name = "datarice", required = false) BigDecimal dataPrice) {
assetsService.findAssets(assetsId,dataPrice);
return null;
@PostMapping("/findAssets")
@ApiOperation(value = "查询余额是否充足-调用接口")
public Result findAssets(@RequestBody @Validated FinanceCustomerAssetsReq req) throws Exception{
Result result = new Result();
try {
result = assetsService.findAssets(req);
}catch (Exception e) {
e.printStackTrace();
}
return result;
}
@PostMapping(value = "/unfreezeMoney")
@ApiOperation(value = "解冻金额-调用接口", notes = "解冻金额扣钱")
public Result unfreezeMoney(@RequestBody @Validated FinanceCustomerAssetsReq req) throws Exception {
Result result = assetsService.unfreezeMoney(req);
return result;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.finance.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/9
* @Version:
*/
@ApiModel(value = "查询余额是否充足请求参数")
@Data
public class FinanceCustomerAssetsReq implements Serializable {
@ApiModelProperty(value = "用户id")
private Long userId;
@ApiModelProperty(value = "资产id")
@NotNull(message = "资产id不能为空")
private Long assetsId;
@ApiModelProperty(value = "价格")
@NotNull(message = "价格不能为空")
private String dataPrice;
@ApiModelProperty(value = "返回状态")
private Boolean callStatus;
}
......@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.controller.goods.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
......@@ -13,6 +14,7 @@ import java.math.BigDecimal;
* @Version:
*/
@ApiModel(value = "商品列表", description = "商品列表参数对象")
@Data
public class DataGoodsListDto {
/**
......@@ -61,7 +63,7 @@ public class DataGoodsListDto {
* 数据商品价格
*/
@ApiModelProperty(value = "数据商品价格")
private String dataPrice;
private BigDecimal dataPrice;
/**
* 价格类型
......@@ -95,108 +97,5 @@ public class DataGoodsListDto {
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDataLabel() {
return dataLabel;
}
public void setDataLabel(String dataLabel) {
this.dataLabel = dataLabel;
}
public String getDataPicture() {
return dataPicture;
}
public void setDataPicture(String dataPicture) {
this.dataPicture = dataPicture;
}
public String getDataPrice() {
return dataPrice;
}
public void setDataPrice(String dataPrice) {
this.dataPrice = dataPrice;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public BigDecimal getYearType() {
return yearType;
}
public void setYearType(BigDecimal yearType) {
this.yearType = yearType;
}
public BigDecimal getSeasonType() {
return seasonType;
}
public void setSeasonType(BigDecimal seasonType) {
this.seasonType = seasonType;
}
public BigDecimal getMonthType() {
return monthType;
}
public void setMonthType(BigDecimal monthType) {
this.monthType = monthType;
}
public BigDecimal getSecondType() {
return secondType;
}
public void setSecondType(BigDecimal secondType) {
this.secondType = secondType;
}
}
......@@ -29,4 +29,7 @@ public interface FinanceCustomerAssetsDao extends BaseMapper<FinanceCustomerAsse
void updateAssets(FinanceCustomerAssets assets);
// 修改金额
void updateMoney(FinanceCustomerAssets assets) throws Exception;
}
\ No newline at end of file
......@@ -58,6 +58,6 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
* 修改密码
* @param map
*/
void updatePassword(Map map);
int updatePassword(MallCustomer customer);
}
\ 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.finance.bean.FinanceCustomerAssetsReq;
import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
import java.math.BigDecimal;
......@@ -14,7 +16,14 @@ public interface FinanceCustomerAssetsService {
/**
* 查询余额是否充足
* @param id
* @param req
*/
FinanceCustomerAssets findAssets(Long id, BigDecimal dataPrice);
Result findAssets(FinanceCustomerAssetsReq req) throws Exception;
/**
* 解冻金额扣钱
* @param req
* @return
*/
Result unfreezeMoney(FinanceCustomerAssetsReq req) throws Exception;
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.base.CurrentUser;
import com.jz.common.bean.MallCustomerApiDto;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.entity.Department;
......@@ -20,6 +21,8 @@ import com.jz.dm.mall.moduls.service.CompanyAuthService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
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;
......@@ -27,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* @author ZC
......@@ -48,7 +52,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
private FinanceCustomerAssetsDao financeCustomerAssetsDao;
@Resource
private MallCustomerDao mallCustomerDao;
@Autowired
private RedisTemplate redisTemplate;
/**
* 添加企业认证
* @param request
......@@ -59,10 +64,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result addCompanyData(CompanyAddReq req, HttpServletRequest request) {
//获取当前用户ID判断当前用户是否已经关联企业
//MallCustomerApiDto currentUser = CurrentUser.getCurrentUser(request);
MallCustomerApiDto currentUser = new MallCustomerApiDto();
currentUser.setCustomerId(1L);
currentUser.setCustomerName("张胜男");
MallCustomerApiDto currentUser = getUser();
if (null == currentUser) {
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
......@@ -95,7 +98,9 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
@Override
public Result selectCompany(String type,HttpServletRequest request) {
// 查询用户判断用户是否认证
MallCustomer currentUser = getCurrentUser(CurrentUser.getCustomerId(request));
// MallCustomer currentUser = getCurrentUser(CurrentUser.getCustomerId(request));
MallCustomerApiDto currentUser = getUser();
if (null == currentUser) {
return Result.error("当前用户信息不存在");
}
......@@ -135,8 +140,10 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
*/
@Override
public Result updateCompanyInfo(CompanyUpdateReq req,HttpServletRequest request) {
Long customerId = CurrentUser.getCustomerId(request);
MallCustomer currentUser = getCurrentUser(customerId);
// Long customerId = CurrentUser.getCustomerId(request);
// MallCustomer currentUser = getCurrentUser(customerId);
MallCustomerApiDto currentUser = getUser();
Long customerId = currentUser.getCustomerId();
if (null == currentUser) {
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
......@@ -160,7 +167,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
*/
@Override
public Result checkCompanyInfo(HttpServletRequest request) {
MallCustomer currentUser = getCurrentUser(CurrentUser.getCustomerId(request));
// MallCustomer currentUser = getCurrentUser(CurrentUser.getCustomerId(request));
MallCustomerApiDto currentUser = getUser();
if (null == currentUser) {
return Result.of_success(ResultMsg.USER_NOT_EXIST);
}
......@@ -204,4 +212,13 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
// throw ResponseException.of_error("更新用户企业信息失败");
//}
}
/**
* 获取当前用户信息
* @return
*/
private MallCustomerApiDto getUser() {
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
return currentUser;
}
}
......@@ -74,6 +74,9 @@ public class DataGoodsServiceImpl implements DataGoodsService {
PageHelper.startPage(dataGoodsListRequest.getPageNum(), dataGoodsListRequest.getPageSize());
List<DataGoodsListDto> list = dataGoodsDao.findList(param);
for (DataGoodsListDto dataGoodsListDto : list) {
dataGoodsListDto.getDataPrice().setScale(3);
}
PageInfo<DataGoodsListDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
......
package com.jz.dm.mall.moduls.service.impl;
import com.baomidou.mybatisplus.extension.api.R;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsReq;
import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
import com.jz.dm.mall.moduls.mapper.FinanceCustomerAssetsDao;
import com.jz.dm.mall.moduls.service.FinanceCustomerAssetsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
/**
* 商城企业客户资产(TFinanceCustomerAssets)表服务实现类
......@@ -24,25 +34,95 @@ public class FinanceCustomerAssetsServiceImpl implements FinanceCustomerAssetsSe
/**
* 查询余额是否充足
*
* @param id
* @param req
*/
@Override
@Async
public FinanceCustomerAssets findAssets(Long id, BigDecimal dataPrice) {
FinanceCustomerAssets assets = assetsDao.findById(id);
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result findAssets(FinanceCustomerAssetsReq req) throws Exception{
if (!StringUtils.isNotEmpty(req.getAssetsId().toString())) {
return Result.of_error("资产id为空,查询失败!");
}
if (!StringUtils.isNotEmpty(req.getDataPrice())) {
return Result.of_error("价格为空,查询失败!");
}
FinanceCustomerAssets assets = assetsDao.findById(req.getAssetsId());
if (assets == null) {
return Result.of_error("查询资产失败!");
}
// 可用金额/冻结金额
BigDecimal useMoney = assets.getUseMoney();
BigDecimal frozenMoney = assets.getFrozenMoney();
// 余额不充足
if(useMoney.compareTo(new BigDecimal(req.getDataPrice())) == -1){
return Result.of_error("余额不足!");
}
// 余额充足
if (useMoney.compareTo(new BigDecimal(req.getDataPrice())) > -1) {
// 冻结金额
useMoney = useMoney.subtract(new BigDecimal(req.getDataPrice()));
frozenMoney = frozenMoney.add(new BigDecimal(req.getDataPrice()));
assets.setUseMoney(useMoney);
assets.setFrozenMoney(frozenMoney);
assets.setTotalMoney(useMoney);
assets.setUptTime(DateUtils.getToday());
assets.setUptPerson(req.getUserId() + "");
assets.setDelFlag("N");
assetsDao.updateMoney(assets);
return Result.of_success("余额充足!");
}
return Result.of_error("查询失败!");
}
if(assets.getUseMoney().compareTo(dataPrice) == -1){
new Thread(new Runnable() {
/**
* 解冻金额扣钱
*
* @param req
* @return
*/
@Override
public void run() {
// 解冻
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result unfreezeMoney(FinanceCustomerAssetsReq req) throws Exception {
Result result = new Result();
if (req.getAssetsId() == null) {
return Result.of_error("资产id为空,扣钱失败!");
}
if (req.getDataPrice() == null || StringUtils.isBlank(req.getDataPrice())) {
return Result.of_error("价格为空,扣钱失败!");
}
FinanceCustomerAssets assets = assetsDao.findById(req.getAssetsId());
if (assets == null) {
return Result.of_error("查询资产失败!");
}
BigDecimal price = new BigDecimal(req.getDataPrice());
if (price.compareTo(BigDecimal.ZERO) < -1) {
return Result.of_error("扣款金额不能为零或负!");
}
BigDecimal useMoney = assets.getUseMoney();
BigDecimal frozenMoney = assets.getFrozenMoney();
if (req.getCallStatus() && useMoney.compareTo(BigDecimal.ZERO) == 1 && price.compareTo(new BigDecimal(req.getDataPrice())) == 1) {
// 扣钱
useMoney = useMoney.subtract(new BigDecimal(req.getDataPrice()));
result.setMessage("扣款成功!");
result.setCode(StatusCode.OK);
}else if(frozenMoney.compareTo(BigDecimal.ZERO) == 1){
// 解冻金额
frozenMoney = frozenMoney.subtract(new BigDecimal(frozenMoney.toString()));
useMoney = useMoney.add(new BigDecimal(assets.getFrozenMoney().toString()));
result.setMessage("解冻成功");
result.setCode(StatusCode.OK);
}else {
result.setMessage("金额不足,请充值!");
result.setCode(StatusCode.ERROR);
}
}).start();
// 更新金额
assets.setFrozenMoney(frozenMoney);
assets.setUseMoney(useMoney);
assets.setTotalMoney(useMoney);
assets.setUptPerson(req.getUserId() + "");
assets.setUptTime(DateUtils.getToday());
assets.setDelFlag("N");
assetsDao.updateMoney(assets);
return result;
}
return null;
}
}
\ No newline at end of file
......@@ -3,8 +3,10 @@ package com.jz.dm.mall.moduls.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BasePageBean;
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.enums.AuditStatusEnum;
import com.jz.common.utils.CommonsUtil;
import com.jz.common.utils.Result;
......@@ -18,6 +20,7 @@ import com.jz.dm.mall.moduls.service.FinanceTradeFlowService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
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;
......@@ -27,6 +30,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* 企业客户交易流水(TFinanceTradeFlow)表服务实现类
......@@ -44,6 +48,9 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
@Autowired
private FinanceCustomerAssetsDao financeCustomerAssetsDao;
@Autowired
private RedisTemplate redisTemplate;
@Override
public FinanceCustomerAssetsDto queryAccountMoneyByMap(Map map) throws Exception {
return financeTradeFlowDao.queryAccountMoneyByMap(map);
......@@ -56,14 +63,12 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
FinanceCustomerBalance financeCustomerBalance = new FinanceCustomerBalance();
financeCustomerBalance.setAssetsId(customerBalanceRequest.getAssetsId());//企业资产id
financeCustomerBalance.setBalanceMoney(customerBalanceRequest.getBalanceMoney()); //充值金额
//financeCustomerBalance.setCrePerson();
financeCustomerBalance.setCrePerson(getUser().getCustomerId()+ "");
financeCustomerBalance.setCreTime(new Date());
financeCustomerBalance.setAuditStatus("01"); //待审核
financeCustomerBalance.setRemark(customerBalanceRequest.getRemark()); //备注
financeCustomerBalance.setDelFlag("N");
int len = financeCustomerAssetsDao.addCoustomerCzMoney(financeCustomerBalance);
/* //2.更新企业资产账户
int len = financeCustomerAssetsDao.uptAccountMoney(financeCustomerBalanceRequest);
//3.在流水记录中添加数据*/
return len > 0;
}
......@@ -94,7 +99,8 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
financeCashOut.setCreTime(new Date()); //创建时间
financeCashOut.setCashOutTime(new Date()); //提现时间
financeCashOut.setAuditStatus(AuditStatusEnum.DSH.getValue()); //待审核
//financeCashOut.setCrePerson();
financeCashOut.setDelFlag("N");
financeCashOut.setCrePerson(getUser().getCustomerId()+ "");
//添加一条提现记录
int len = financeTradeFlowDao.addCashOutMoney(financeCashOut);
......@@ -118,9 +124,10 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
//修改企业资产 金额
FinanceCustomerAssets assets = new FinanceCustomerAssets();
assets.setUptTime(new Date());
//assets.setUptPerson();
assets.setUptPerson(getUser().getCustomerId()+ "");
assets.setUseMoney(useMoney);
assets.setFrozenMoney(djMoney);
assets.setTotalMoney(useMoney);
assets.setAssetsId(assetId);
int lens = financeCustomerAssetsDao.uptAccountMoney(assets);
if (lens == 0) {
......@@ -172,4 +179,9 @@ public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
public MallCustomerApiDto getUser() {
MallCustomerApiDto user = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
return user;
}
}
\ No newline at end of file
......@@ -18,6 +18,7 @@ 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.concurrent.TimeUnit;
......@@ -145,10 +146,12 @@ public class MallCustomerServiceImpl implements MallCustomerService {
public void updatePassword(Long customerId, String password) {
MallCustomer mallCustomer = tMallCustomerDao.findById(customerId);
if (mallCustomer != null) {
Map map = new HashMap();
map.put("password", password);
map.put("customerId", customerId);
tMallCustomerDao.updatePassword(map);
MallCustomer customer = new MallCustomer();
mallCustomer.setPassword(password);
mallCustomer.setUptTime(DateUtils.getToday());
mallCustomer.setUptPerson(mallCustomer.getCustomerId() + "");
mallCustomer.setCustomerId(mallCustomer.getCustomerId());
tMallCustomerDao.updatePassword(customer);
}
}
......
......@@ -21,6 +21,7 @@ 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;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -48,6 +49,8 @@ public class OrderServiceImpl implements OrderService {
@Autowired
private RedisTemplate redisTemplate;
@Value("${domain.gatewayUpSalt}")
private String gatewayUpSalt;
@Override
public PageInfoResponse<OrderDto> findList(OrderRequest order, HttpServletRequest req) throws Exception {
......@@ -130,10 +133,9 @@ public class OrderServiceImpl implements OrderService {
MallCustomerApiDto customer = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
//调用gatway
String url = "http://127.0.0.1:8088/api/auth/reset-salt";
JSONObject object = new JSONObject();
object.put("authCode",req.getGoodsToken());
String s = httpsUtils.submitPost(url, object.toString());
String s = httpsUtils.submitPost(gatewayUpSalt, object.toString());
//处理返回的参数
JSONObject params = JSONObject.parseObject(s);
if (!params.get("code").equals(200) || org.springframework.util.StringUtils.isEmpty(params.get("data"))) {
......
......@@ -57,8 +57,8 @@ public class PayServiceImpl implements PayService {
@Autowired
private HttpsUtils httpsUtils;
@Value("${domain.apigateway}")
private String apiGateway;
@Value("${domain.gatewayGetAuth}")
private String gatewayGetAuth;
/**
* 新增订单
......@@ -150,7 +150,7 @@ public class PayServiceImpl implements PayService {
apiReq.setOrgType("OUT"); // TODO
apiReq.setUserId(payDto.getCustomerId() + "");
String post = httpsUtils.submitPost(apiGateway, JSON.toJSONString(apiReq));
String post = httpsUtils.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.bean.MallCustomerApiDto;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.dm.mall.moduls.mapper.MallCustomerDao;
import com.jz.dm.mall.moduls.service.PersonalUserControllerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* @author ZC
......@@ -24,13 +29,16 @@ import java.util.Date;
@Service("personalUserControllerService")
@Slf4j
public class PersonalUserControllerServiceImpl implements PersonalUserControllerService {
@Autowired
private RedisTemplate redisTemplate;
@Resource
private MallCustomerDao mallCustomerDao;
@Override
public Result getUserInfo() {
Long customId =0L;
MallCustomer mallCustomer = mallCustomerDao.findById(customId);
MallCustomerApiDto user = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
MallCustomer mallCustomer = mallCustomerDao.findById(user.getCustomerId());
if (null == mallCustomer){
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
......@@ -45,8 +53,9 @@ public class PersonalUserControllerServiceImpl implements PersonalUserController
*/
@Override
public Result updateUserPassWard(String oldPassWard, String newPassWard) {
Long customId =0L;
MallCustomer mallCustomer = mallCustomerDao.findById(customId);
MallCustomerApiDto user = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
MallCustomer mallCustomer = mallCustomerDao.findById(user.getCustomerId());
if (null == mallCustomer){
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
......@@ -58,7 +67,7 @@ public class PersonalUserControllerServiceImpl implements PersonalUserController
customer.setPassword(newPassWard);
customer.setUptPerson(mallCustomer.getCustomerName());
customer.setUptTime(new Date());
if (mallCustomerDao.updateById(customer) != 1){
if (mallCustomerDao.updatePassword(customer) != 1){
return Result.of_error(ResultMsg.UPDATE_FAIL);
}
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
......
......@@ -193,4 +193,32 @@
</set>
where assets_id = #{assetsId}
</insert>
<insert id="updateMoney" parameterType="com.jz.dm.mall.moduls.entity.FinanceCustomerAssets">
update t_finance_customer_assets
<set>
<if test="departmentId != null">
department_id = #{departmentId},
</if>
<if test="useMoney != null">
use_money = #{useMoney},
</if>
<if test="frozenMoney != null">
frozen_money = #{frozenMoney},
</if>
<if test="totalMoney != null">
total_money = #{totalMoney},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
where assets_id = #{assetsId}
</insert>
</mapper>
\ No newline at end of file
......@@ -223,7 +223,20 @@
AND del_flag ='N'
</select>
<update id="updatePassword" parameterType="map">
update t_mall_customer set password =#{password} where customer_id = #{customerId};
update t_mall_customer
<set>
<if test="password != null and password != ''">
password = #{password},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="uptPerson != null">
upt_person = #{uptPerson},
</if>
</set>
where customer_id = #{customerId}
</update>
</mapper>
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.jz.manage.moduls.controller.customer.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName:
......@@ -10,6 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
* @Version:
*/
@ApiModel(value = "企业详细信息返回参数")
@Data
public class CompanyDetailsDto {
@ApiModelProperty(value = "企业id")
......@@ -31,83 +33,13 @@ public class CompanyDetailsDto {
private String businessLicense;
@ApiModelProperty(value = "统一社会信用代码")
private String unifredCreditCode;
private String unifiedCreditCode;
@ApiModelProperty(value = "银行卡号")
private String bankCardNubmer;
private String bankCardNumber;
@ApiModelProperty(value = "开户行地址")
private String bankAddress;
private String bankName;
public Long getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Long departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerPhone() {
return customerPhone;
}
public void setCustomerPhone(String customerPhone) {
this.customerPhone = customerPhone;
}
public String getRegisteredAddress() {
return registeredAddress;
}
public void setRegisteredAddress(String registeredAddress) {
this.registeredAddress = registeredAddress;
}
public String getBusinessLicense() {
return businessLicense;
}
public void setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
}
public String getUnifredCreditCode() {
return unifredCreditCode;
}
public void setUnifredCreditCode(String unifredCreditCode) {
this.unifredCreditCode = unifredCreditCode;
}
public String getBankCardNubmer() {
return bankCardNubmer;
}
public void setBankCardNubmer(String bankCardNubmer) {
this.bankCardNubmer = bankCardNubmer;
}
public String getBankAddress() {
return bankAddress;
}
public void setBankAddress(String bankAddress) {
this.bankAddress = bankAddress;
}
}
package com.jz.manage.moduls.controller.file;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.service.PictureService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
/** * @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) {
// Map<String, Object> paramer = dataGoodsService.uploadPicture(file);
Result result = pictureService.uploadPicture(file);
return result;
}
@GetMapping("/downloadPicture")
@ApiOperation(value = "图片下载")
public Result downloadPicture(@RequestParam(name = "url") String url, HttpServletResponse response) {
String host = "192.168.1.141";
int port = 21;
String username ="ftpuser";
String password = "9zDatacn";
FTPClient ftp = new FTPClient();
String remotePath = url.substring(0, url.lastIndexOf("/")+1);
String ftpUrl = url.substring(url.lastIndexOf("/") +1);
try {
int reply;
ftp.connect(host, port);
// 登录
ftp.login(username, password);
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
}
ftp.enterLocalPassiveMode();
// 到FTP服务器目录
ftp.changeWorkingDirectory("/2021/1/12/");
InputStream in = ftp.retrieveFileStream(ftpUrl);
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="+".jpg");
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) {
}
}
}
Result result = new Result();
return result;
}
}
......@@ -20,6 +20,9 @@ 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 java.util.Map;
/**
* 数据商品(dataGoods)表控制层
......@@ -152,4 +155,5 @@ public class DataGoodsController extends BaseController {
}
return result;
}
}
\ No newline at end of file
......@@ -124,4 +124,8 @@ public class DataApiUpReq implements Serializable {
@ApiModelProperty(value = "接入类型:对应字典表key",required = true)
@NotNull(message = "接入类型不能为空")
public String joinType;
@ApiModelProperty(value = "是否分页")
@NotNull(message = "是否分页不能为空")
public String page;
}
......@@ -28,7 +28,7 @@ public class MakeDataBankApiReq implements Serializable {
@ApiModelProperty(value = "传输方式(1为HTTPS,2为HTTP)",required = true)
@NotNull(message = "传输方式不能为空")
public String apiProtocl;
public String apiProtocl; // TODO 改成transMode;
@ApiModelProperty(value = "加密方式0 无,1:MD5 2:RSA",required = true)
@NotNull(message = "加密方式不能为空")
......@@ -43,9 +43,11 @@ public class MakeDataBankApiReq implements Serializable {
public String outputType;
@ApiModelProperty(value = "是否分页 page", required = true)
// @NotNull(message = "分页不能为空")
public String page;
@NotNull(message = "分页不能为空")
public Boolean page;
@ApiModelProperty(value = "请求用户")
public String user;
@ApiModelProperty(value = "接口描述",required = false)
public String apiDesc;
......@@ -84,5 +86,6 @@ public class MakeDataBankApiReq implements Serializable {
//@NotNull(message = "文件id不能为空")
public Long fileId;
@ApiModelProperty(value = "reqType")
public String reqType;
}
......@@ -2,14 +2,18 @@ package com.jz.manage.moduls.controller.sys;
import com.jz.common.utils.Result;
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 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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 平台系统用户表(TSysUser)表控制层
*
......@@ -25,4 +29,10 @@ public class SysUserController extends BaseController {
*/
@Autowired
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);
}
}
\ No newline at end of file
......@@ -103,7 +103,7 @@ public class DataGoodsApi implements Serializable {
*/
private String versionNumber;
private String apiType;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
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.math.BigDecimal;
......@@ -17,6 +18,7 @@ import java.util.Date;
*/
@TableName("t_platform_Log")
@ApiModel
@Data
public class PlatformLog implements Serializable {
private static final long serialVersionUID = 112371340504875570L;
/**
......@@ -128,180 +130,6 @@ public class PlatformLog implements Serializable {
@TableField(exist = false)
private String customerName;
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public Long getPlatformLogId() {
return platformLogId;
}
public void setPlatformLogId(Long platformLogId) {
this.platformLogId = platformLogId;
}
public String getRequestIp() {
return requestIp;
}
public void setRequestIp(String requestIp) {
this.requestIp = requestIp;
}
public String getCallerId() {
return callerId;
}
public void setCallerId(String callerId) {
this.callerId = callerId;
}
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getRequestParams() {
return requestParams;
}
public void setRequestParams(String requestParams) {
this.requestParams = requestParams;
}
public String getReturnParams() {
return returnParams;
}
public void setReturnParams(String returnParams) {
this.returnParams = returnParams;
}
public String getRequestUrl() {
return requestUrl;
}
public void setRequestUrl(String requestUrl) {
this.requestUrl = requestUrl;
}
public Date getRequestTime() {
return requestTime;
}
public void setRequestTime(Date requestTime) {
this.requestTime = requestTime;
}
public String getServiceType() {
return serviceType;
}
public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}
public String getDataGoodsType() {
return dataGoodsType;
}
public void setDataGoodsType(String dataGoodsType) {
this.dataGoodsType = dataGoodsType;
}
public String getDownloadAddress() {
return downloadAddress;
}
public void setDownloadAddress(String downloadAddress) {
this.downloadAddress = downloadAddress;
}
public BigDecimal getDataPrice() {
return dataPrice;
}
public void setDataPrice(BigDecimal dataPrice) {
this.dataPrice = dataPrice;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public Long getTotalTimes() {
return totalTimes;
}
public void setTotalTimes(Long totalTimes) {
this.totalTimes = totalTimes;
}
public Long getUsedTimes() {
return usedTimes;
}
public void setUsedTimes(Long usedTimes) {
this.usedTimes = usedTimes;
}
public Long getRemainTimes() {
return remainTimes;
}
public void setRemainTimes(Long remainTimes) {
this.remainTimes = remainTimes;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
@ApiModelProperty(value = "请求状态:01成功,02失败")
private String requestType;
}
\ No newline at end of file
......@@ -5,9 +5,11 @@ 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;
/**
* 功能菜单(SysMenu)实体类
......@@ -17,6 +19,7 @@ import java.util.Date;
*/
@TableName("t_sys_menu")
@ApiModel
@Data
public class SysMenu implements Serializable {
private static final long serialVersionUID = 256732259347445947L;
/**
......@@ -60,69 +63,7 @@ public class SysMenu implements Serializable {
@ApiModelProperty(value = "删除标识:Y删除,N未删除")
private String delFlag;
private List<SysMenu> children;
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
public String getMenuName() {
return menuName;
}
public void setMenuName(String menuName) {
this.menuName = menuName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
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 Long getCrePerson() {
return crePerson;
}
public void setCrePerson(Long crePerson) {
this.crePerson = crePerson;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.SysUser;
import com.jz.manage.moduls.entity.SysMenu;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -17,4 +18,6 @@ public interface SysUserDao extends BaseMapper<SysUser> {
List<Map> getUserRoleByAccount(@Param("account") String account);
List<SysMenu> selectBuMenu(@Param("userId") Long userId);
}
\ No newline at end of file
......@@ -12,6 +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)表服务接口
......@@ -68,5 +69,7 @@ public interface DataGoodsService {
Result editStatus(Long goodsId, Long statusId);
// Result getJoinType(String parentKey);
}
\ No newline at end of file
package com.jz.manage.moduls.service;
import com.jz.common.utils.Result;
import org.springframework.web.multipart.MultipartFile;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/12
* @Version:
*/
public interface PictureService {
/**
* 图片上传
* @param file
* @return
*/
Result uploadPicture(MultipartFile file);
/**
* 图片下载
* @param url
* @return
*/
Result downloadPicture(String url);
}
......@@ -2,8 +2,10 @@ package com.jz.manage.moduls.service;
import com.jz.common.entity.SysUser;
import com.jz.manage.moduls.entity.SysMenu;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
......@@ -22,4 +24,6 @@ public interface SysUserService {
SysUser selectByPhone(String telephone, HttpServletRequest request);
Map<String,Object> getUserRoleByAccount(String account);
List<SysMenu> selectByMenu(Long id);
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ 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.*;
......@@ -29,10 +30,8 @@ import com.jz.manage.moduls.mapper.DataGoodsDao;
import com.jz.manage.moduls.service.DataGoodsService;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
......@@ -45,6 +44,7 @@ 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;
/**
......@@ -233,6 +233,8 @@ public class DataGoodsServiceImpl implements DataGoodsService {
}
return Result.of_error(ResultMsg.UPDATE_FAIL);
}
//
// @Override
// public Result getJoinType(String parentKey) {
......@@ -271,7 +273,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
if (!StringUtils.isNotEmpty(dataApiUpReq.getEncryMode())) {
return Result.error("加密方式不能为空!");
}
// 调用getway获取apikey
// 调用gateway获取apiKey
MakeDataBankApiReq apiReq = new MakeDataBankApiReq();
apiReq.setApiType(dataApiUpReq.getApiType());
apiReq.setApiDesc(dataApiUpReq.getApiDesc());
......@@ -282,7 +284,8 @@ public class DataGoodsServiceImpl implements DataGoodsService {
apiReq.setApiUrl(dataApiUpReq.getApiUrl());
apiReq.setJoinType(dataApiUpReq.getJoinType());
apiReq.setOutputType(dataApiUpReq.getReturnType());
// apiReq.setPage(); // TODO
apiReq.setPage(false); //TODO
apiReq.setReqType("DAY"); // TODO
apiReq.setFileId(1L);
// apiReq.setTimeout(dataApiUpReq.getOverTime() + "");
for (DataGoodsApiParams params : dataApiUpReq.getInboxParam()) {
......@@ -339,6 +342,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
DataGoodsApi dataGoodsApi = new DataGoodsApi();
dataGoodsApi.setDataGoodsId(dataGoodsId);
dataGoodsApi.setApiType(dataApiUpReq.getApiType());
dataGoodsApi.setCreTime(DateUtils.getToday());
dataGoodsApi.setCrePerson(user.getUserId() + "");
dataGoodsApi.setEncryMode("MD5");
......
......@@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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.exception.ResponseException;
......@@ -28,6 +29,7 @@ import com.jz.manage.moduls.mapper.FinanceCustomerBalanceDao;
import com.jz.manage.moduls.mapper.MallCustomerDao;
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.Transactional;
import org.springframework.util.StringUtils;
......@@ -57,6 +59,9 @@ public class DepartmentServiceImpl implements DepartmentService {
@Autowired
private FinanceCustomerBalanceDao financeCustomerBalanceDao;
@Autowired
private RedisTemplate redisTemplate;
/**
* 条件查询企业审核信息列表
*
......@@ -125,7 +130,9 @@ public class DepartmentServiceImpl implements DepartmentService {
// throw ResponseException.of(ResultCode.FAILURE, "已审核!不用在审核!");
// }
// 从session获取平台用户id
SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
// SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
SysUserDto sysUser = (SysUserDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
// 更新信息: 将企业审核状态改为已审核,企业信息更新
department.setAuditStatus("02");
department.setAuditPerson(sysUser.getUserId() + "");
......@@ -157,7 +164,9 @@ public class DepartmentServiceImpl implements DepartmentService {
if (!success) {
return Result.error("添加用户失败!");
}
SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
// SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
SysUserDto userDto = (SysUserDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
// 保存企业信息
Long departmentId = saveCompany(saveCustomerReq, req);
if (departmentId != null) {
......@@ -169,7 +178,7 @@ public class DepartmentServiceImpl implements DepartmentService {
mallCustomer.setPassword(saveCustomerReq.getPassword());
mallCustomer.setCreTime(DateUtils.getToday());
mallCustomer.setCustomerPoint(0L);
mallCustomer.setCrePerson(sysUser.getUserId()+"");
mallCustomer.setCrePerson(userDto.getUserId()+"");
mallCustomer.setDelFlag("N");
mallCustomerDao.insert(mallCustomer);
......@@ -219,7 +228,9 @@ public class DepartmentServiceImpl implements DepartmentService {
*/
private Long saveCompany(SaveCustomerRequest saveCustomerReq, HttpServletRequest req) {
Department department = new Department();
SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
// SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
SysUserDto sysUser = (SysUserDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
// 添加创建人/创建时间
department.setCrePerson(sysUser.getUserId() + "");
department.setCreTime(DateUtils.getToday());
......@@ -236,6 +247,8 @@ public class DepartmentServiceImpl implements DepartmentService {
department.setTelephone(saveCustomerReq.getTelephone());
// 已审核
department.setAuditStatus("02");
department.setAuditTime(DateUtils.getToday());
department.setCreTime(DateUtils.getToday());
tDepartmentDao.insert(department);
return department.getDepartmentId();
}
......
package com.jz.manage.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.manage.moduls.service.PictureService;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/12
* @Version:
*/
@Service("pictureService")
public class PictureServiceImpl implements PictureService {
/**
* 图片上传
*
* @param file
* @return
*/
@Override
public Result uploadPicture(MultipartFile file) {
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 {
boolean flag = FtpUtil.uploadFile("192.168.1.141", 21, "ftpuser", "9zDatacn", "/", "/2021/1/12", picture, file.getInputStream());
if (flag) {
String url = "/manage/downloadPicture" + "/2021/1/12" + "/" + 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) {
String ftpUrl = url.substring(url.lastIndexOf("/") +1);
Result result = new Result();
try{
boolean flag = FtpUtil.downloadFile("192.168.1.141", 21, "ftpuser", "9zDatacn", "/2021/1/12/", ftpUrl, "");
if (flag) {
result.setMsg("下载成功!");
}else {
result.setMsg("下载失败!");
}
}catch (Exception e) {
e.printStackTrace();
result.setMsg("下载失败!");
result.setCode(StatusCode.ERROR);
}
return result;
}
}
......@@ -144,9 +144,11 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe
//提现时间
if (StringUtils.isNotEmpty(cashOutListRequest.getCasOutTime())) {
String casOutTime = cashOutListRequest.getCasOutTime();
String[] times = casOutTime.split("-");
param.put("casOutTimeStart", times[0] + "00:00:00");
param.put("casOutTimeEnd", times[1] + "23:59:59");
// 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(param);
......
......@@ -7,6 +7,7 @@ import com.jz.common.entity.SysUser;
import com.jz.common.enums.UserTypeEnum;
import com.jz.common.utils.SessionUtils;
import com.jz.manage.moduls.entity.SysMenu;
import com.jz.manage.moduls.mapper.SysUserDao;
import com.jz.manage.moduls.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -53,8 +54,8 @@ public class SysUserServiceImpl implements SysUserService {
SessionUtils.setUserCurrent("sysUser", sysUserDto, request);
// 存入到redis
redisTemplate.opsForValue().set("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS, sysUserDto, 3, TimeUnit.DAYS);
SysUserDto userDto = (SysUserDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
System.out.println(userDto);
// SysUserDto userDto = (SysUserDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
}
return sysUser;
}
......@@ -101,4 +102,22 @@ public class SysUserServiceImpl implements SysUserService {
userInfo.put("roleMenuSet", roleMenuSet);
return userInfo;
}
@Override
public List<SysMenu> selectByMenu(Long id) {
List<SysMenu> list = sysUserDao.selectBuMenu(id);
list = sortTree(list, 0L);
return list;
}
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);
}
}
return returnList;
}
}
\ No newline at end of file
......@@ -319,7 +319,7 @@
t1.registered_address AS registeredAddress,
t1.business_license AS businessLicense,
t1.unified_credit_code AS unifiedCreditCode,
t1.bank_address AS bankAddress,
t1.bank_name AS bankName,
t1.bank_card_number AS bankCardNumber,
(CASE
WHEN t1.audit_status = '01' THEN
......
......@@ -13,6 +13,7 @@
<result property="requestUrl" column="request_url" jdbcType="VARCHAR"/>
<result property="requestTime" column="request_time" jdbcType="TIMESTAMP"/>
<result property="serviceType" column="service_type" jdbcType="VARCHAR"/>
<result property="requestType" column="request_type" jdbcType="VARCHAR"/>
<result property="dataGoodsType" column="data_goods_type" jdbcType="VARCHAR"/>
<result property="downloadAddress" column="download_address" jdbcType="VARCHAR"/>
<result property="dataPrice" column="data_price" jdbcType="NUMERIC"/>
......@@ -32,7 +33,7 @@
t1.request_time AS requestTime,t1.service_type AS serviceType,t1.data_goods_type AS dataGoodsType,t1.download_address AS downloadAddress,
t1.data_price AS dataPrice,t1.price_type AS priceType,t1.total_times AS totalTimes,t1.used_times AS usedTimes,t1.remain_times AS remainTimes,
t1.caller_type AS callerType,t1.start_time AS startTime,t1.end_time AS endTime,t1.cre_time AS creTime,t1.cre_person AS crePerson,
t1.upt_time AS uptTime,t1.upt_person AS uptPerson,t1.del_flag AS delFlag
t1.upt_time AS uptTime,t1.upt_person AS uptPerson,t1.del_flag AS delFlag,t1.request_type as requestType
</sql>
<select id="listMallLogInfo" resultType="com.jz.manage.moduls.entity.PlatformLog">
SELECT <include refid="allFiled"/>, t2.customer_name as customerName
......
......@@ -147,4 +147,21 @@
inner join t_sys_menu e on e.menu_id=d.menu_id
where a.account=#{account}
</select>
<select id="selectBuMenu" resultType="com.jz.manage.moduls.entity.SysMenu" parameterType="list">
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}
</select>
</mapper>
\ No newline at end of file
package com.jz.manage;
import com.jz.manage.moduls.service.DataGoodsService;
import com.jz.manage.moduls.service.SysUserService;
import com.jz.manage.moduls.service.TestUserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class manageApplicationTests {
@Autowired
private TestUserService userService;
@Autowired
private SysUserService sysUserService;
@Autowired
private DataGoodsService dataGoodsService;
@Test
public void contextLoads() {
}
@Test
public void aa() {
System.out.print(userService.getTest().toString());
userService.getTest();
}
@Test
public void getUserRoleByAccount() throws Exception {
//DataApiUpReq dataApiUpReq = new DataApiUpReq();
//dataApiUpReq.setApiName("华为");
//dataApiUpReq.setRequestType("的撒旦");
//dataApiUpReq.setApiUrl("http://localhost/dataGoods/uploadApi");
//dataApiUpReq.setReturnDataExample("dadasdadafaf");
//dataApiUpReq.setApiKey("5");
//dataApiUpReq.setEncryMode("MD5");
//dataApiUpReq.setTransMode("http");
//dataApiUpReq.setApiFunction("fafafaffaf");
//dataApiUpReq.setVersionNumber("1.0");
//dataApiUpReq.setPriceType("01");
//dataApiUpReq.setApiType("1");
//dataApiUpReq.setApiDesc("fafsafafasff");
//dataApiUpReq.setDataPicture("http://wx4.sinaimg.cn/bmiddle/006GJQvhly1gkx4ezwcr4j328g28g1kx.jpg");
//dataApiUpReq.setYearType(BigDecimal.valueOf(1));
//List<DataGoodsApiParams> paramsList = new ArrayList<>();
//for (DataGoodsApiParams params : paramsList) {
// params.setParamsDiff("01");
// params.setParamsName("xiaomi");
// params.setParamsType("哒哒哒");
// params.setCreTime(DateUtils.getToday());
//}
//dataApiUpReq.setParamsList(paramsList);
//dataGoodsService.uploadApi(dataApiUpReq);
}
}
......@@ -127,17 +127,6 @@
<!-- ***************************************************************** -->
<dependency>
<groupId>org.apache.flume</groupId>
<artifactId>flume-ng-core</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.flume.flume-ng-clients</groupId>
<artifactId>flume-ng-log4jappender</artifactId>
<version>1.5.0</version>
</dependency>
<!-- Netty -->
<dependency>
<groupId>io.netty</groupId>
......@@ -155,43 +144,43 @@
<version>${netty-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring-security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring-security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring-security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>${spring-security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
<version>${spring-security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring-security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>${spring.security.oauth.version}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.security</groupId>-->
<!--<artifactId>spring-security-core</artifactId>-->
<!--<version>${spring-security-version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.security</groupId>-->
<!--<artifactId>spring-security-web</artifactId>-->
<!--<version>${spring-security-version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.security</groupId>-->
<!--<artifactId>spring-security-taglibs</artifactId>-->
<!--<version>${spring-security-version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.security</groupId>-->
<!--<artifactId>spring-security-acl</artifactId>-->
<!--<version>${spring-security-version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.security</groupId>-->
<!--<artifactId>spring-security-crypto</artifactId>-->
<!--<version>${spring-security-version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.security</groupId>-->
<!--<artifactId>spring-security-config</artifactId>-->
<!--<version>${spring-security-version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.security.oauth</groupId>-->
<!--<artifactId>spring-security-oauth2</artifactId>-->
<!--<version>${spring.security.oauth.version}</version>-->
<!--</dependency>-->
<!-- 统一配置 -->
<dependency>
<groupId>com.baidu.disconf</groupId>
......@@ -252,4 +241,5 @@
</plugin>
</plugins>
</build>
</project>
\ 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