Compare commits

..

No commits in common. "main" and "20251022" have entirely different histories.

405 changed files with 25925 additions and 70563 deletions

View File

@ -36,19 +36,14 @@ public class DynamicTaskScheduler {
@PostConstruct @PostConstruct
public void initTasks() { public void initTasks() {
try { //初始化 start
//初始化 start CommentModel commentModel =sxDataService.getCommentModel();
CommentModel commentModel =sxDataService.getCommentModel(); DataBaseInfo enabledTask = sxDataService.getDataBaseInfo(commentModel);
DataBaseInfo enabledTask = sxDataService.getDataBaseInfo(commentModel); executeTask(enabledTask.getDataBaseName(),commentModel);
executeTask(enabledTask.getDataBaseName(),commentModel); //初始化 end
//初始化 end refreshTasks();
refreshTasks(); // 每5分钟检查一次数据库更新
// 每5分钟检查一次数据库更新 taskScheduler.scheduleAtFixedRate(this::refreshTasks, Duration.ofHours(1));
taskScheduler.scheduleAtFixedRate(this::refreshTasks, Duration.ofHours(1));
}catch (Exception e){
log.info("系统异常:{}",e.getMessage());
}
} }
public void refreshTasks() { public void refreshTasks() {
@ -101,46 +96,13 @@ public class DynamicTaskScheduler {
commentModel =sxDataService.getCommentModel(); commentModel =sxDataService.getCommentModel();
} }
DataBaseInfo dataBaseInfo=sxDataService.getDataBaseInfo(commentModel); DataBaseInfo dataBaseInfo=sxDataService.getDataBaseInfo(commentModel);
if(dataBaseInfo==null||StringUtils.isEmpty(dataBaseInfo.getUserName())){
return;
}
String refreshTime="";
if(ObjectUtil.isNotEmpty(dataBaseInfo.getRefreshTime())){ if(ObjectUtil.isNotEmpty(dataBaseInfo.getRefreshTime())){
refreshTime=DateUtil.formatDateTime(dataBaseInfo.getRefreshTime()); commentModel.setSyncTime(DateUtil.formatDateTime(dataBaseInfo.getRefreshTime()));
commentModel.setSyncTime(refreshTime);
}
int i=0;
boolean isException=false;
while (i<3){
try {
sxDataService.syncStoreData(dataBaseInfo,commentModel);//同步网上售卖流水
break;
}catch (Exception e){
i++;
try {
Thread.sleep(Long.parseLong("3000"));
} catch (InterruptedException ex) {
log.info(ex.getMessage());
}
if(i==3){
log.info(e.getMessage());
isException=true;
}
}
}
if(isException){
return;
}
if(StringUtils.isNotEmpty(refreshTime)){//有刷新时间证明不是全量需要判断是否有新商品有新商品才同步品牌和分类
if(sxDataService.isNewShop(dataBaseInfo,refreshTime)){
sxDataService.SyncBranchList(dataBaseInfo,commentModel);
sxDataService.SyncCategory(dataBaseInfo,commentModel);
}
}else {
log.info("首次同步,无刷新时间");
sxDataService.SyncBranchList(dataBaseInfo,commentModel);
sxDataService.SyncCategory(dataBaseInfo,commentModel);
} }
sxDataService.syncStoreData(dataBaseInfo,commentModel);
sxDataService.SyncBranchList(dataBaseInfo,commentModel);
sxDataService.SyncCategory(dataBaseInfo,commentModel);
sxDataService.SyncGoods(dataBaseInfo,commentModel);//todo 暂时同步全部的商品如果后期修改需要增加服务器的字段 sxDataService.SyncGoods(dataBaseInfo,commentModel);//todo 暂时同步全部的商品如果后期修改需要增加服务器的字段
try { try {
if(ObjectUtil.isNotEmpty(dataBaseInfo.getShopGapTime())){ if(ObjectUtil.isNotEmpty(dataBaseInfo.getShopGapTime())){
@ -152,25 +114,9 @@ public class DynamicTaskScheduler {
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
if(ObjectUtil.isNotEmpty(dataBaseInfo.getRefreshTime())){ sxDataService.SyncVipList(dataBaseInfo,commentModel);
commentModel.setSyncTime(refreshTime); sxDataService.syncAtive(dataBaseInfo,commentModel);
} sxDataService.syncAtiveShops(dataBaseInfo,commentModel);
if("1".equals(dataBaseInfo.getIsSyncMember())){//同步会员
sxDataService.SyncVipList(dataBaseInfo,commentModel);
}
//同步活动数据判断是否同步活动数据有新活动且有活动数据才同步活动
if("1".equals(dataBaseInfo.getIsSyncActive())){
boolean isNewActives=sxDataService.syncAtive(dataBaseInfo,commentModel);
if(isNewActives){
log.info("---有新增的活动,同步活动商品开始--");
sxDataService.syncAtiveShops(dataBaseInfo,commentModel);
}else {
log.info("---无新增的活动,无需同步活动商品--");
}
}
sxDataService.refreshTime(commentModel);
isRuning=false; isRuning=false;
} }

View File

@ -36,7 +36,7 @@ public class FileUtils {
public static final String okEnd = "ok";//后缀 public static final String okEnd = "ok";//后缀
public static final String txtEnd = "txt";//后缀 public static final String txtEnd = "txt";//后缀
public static String fileFormat = "%s_%s_%s.%s";//good_1 public static String fileFormat = "%s_%s.%s";//good_1
public static String getSyncTypeFlag(String syncType){ public static String getSyncTypeFlag(String syncType){
Calendar calendar=Calendar.getInstance(); Calendar calendar=Calendar.getInstance();
@ -96,21 +96,12 @@ public class FileUtils {
* @param filePath * @param filePath
*/ */
public void writeFile(String filePath,String fileName,String content){ public void writeFile(String filePath,String fileName,String content){
FileWriter writer =null;
try { try {
writer = new FileWriter(filePath+pathSeparator+fileName,false); FileWriter writer = new FileWriter(filePath+pathSeparator+fileName);
writer.write(content); writer.write(content);
writer.flush();
writer.close(); writer.close();
log.info("文件写入成功!"); log.info("文件写入成功!");
} catch (IOException e) { } catch (IOException e) {
if(writer!=null){
try {
writer.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
log.info("文件写入失败:{}", e.getMessage()); log.info("文件写入失败:{}", e.getMessage());
} }
} }
@ -121,7 +112,7 @@ public class FileUtils {
* @param page * @param page
* @return * @return
*/ */
public String getFileName(String syncType ,Integer page,String endFix,String fileEndFix){ public String getFileName(String syncType ,Integer page,String endFix){
String result=""; String result="";
switch (syncType){ switch (syncType){
case "1": case "1":
@ -139,7 +130,7 @@ public class FileUtils {
default: default:
break; break;
} }
return String.format(fileFormat, result,page,fileEndFix,endFix); return String.format(fileFormat, result,page,endFix);
} }
/** /**
@ -179,7 +170,7 @@ public class FileUtils {
FileUtils fileUtils= new FileUtils(); FileUtils fileUtils= new FileUtils();
File file=fileUtils.createFile("1",1); File file=fileUtils.createFile("1",1);
System.out.printf("--"+file.getAbsoluteFile()); System.out.printf("--"+file.getAbsoluteFile());
fileUtils.writeFile(file.getAbsolutePath(),fileUtils.getFileName("1",2,txtEnd,"operate"),"456"); fileUtils.writeFile(file.getAbsolutePath(),fileUtils.getFileName("1",2,txtEnd),"456");
} }
} }

View File

@ -36,8 +36,6 @@ public class HttpUtils {
public static final String URL_SYNC_GET_STOR_DATA_RELEASE="/shop/sync/third/syncStoreDataRelease";//库存同步 public static final String URL_SYNC_GET_STOR_DATA_RELEASE="/shop/sync/third/syncStoreDataRelease";//库存同步
public static final String URL_SYNC_POST_STORE_DATA_RESPONSE="/shop/sync/third/syncStoreDataReleaseResponse";//等待服务器相应消费
public static final String URL_SYNC_GOODS_NOTICE_UPLOAD_TO_OSS="/shop/sync/third/uploudToCos";//通知上传文件到cos public static final String URL_SYNC_GOODS_NOTICE_UPLOAD_TO_OSS="/shop/sync/third/uploudToCos";//通知上传文件到cos
public static final String URL_SYNC_ACTIVE="/shop/sync/third/syncAtive";//同步活动到服务器 public static final String URL_SYNC_ACTIVE="/shop/sync/third/syncAtive";//同步活动到服务器

View File

@ -1,38 +0,0 @@
package com.small.client.Utils;
import java.util.Collection;
import java.util.Iterator;
public class SqlBuilder {
/**
* 构建IN查询条件
* @param fieldName 字段名
* @param values 值集合
* @return IN条件字符串
*/
public static String buildInCondition(String fieldName, Collection<?> values) {
if (values == null || values.isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append(" ").append(fieldName).append(" in (");
Iterator<?> iterator = values.iterator();
while (iterator.hasNext()) {
Object value = iterator.next();
if (value instanceof String) {
sb.append("'").append(value).append("'");
} else {
sb.append(value);
}
if (iterator.hasNext()) {
sb.append(",");
}
}
sb.append(")");
return sb.toString();
}
}

View File

@ -75,7 +75,7 @@ public class WebController {
//sxDataService.getAppSign(); //sxDataService.getAppSign();
CommentModel commentModel= sxDataService.getCommentModel(); CommentModel commentModel= sxDataService.getCommentModel();
DataBaseInfo dataBaseInfo=sxDataService.getDataBaseInfo(commentModel); DataBaseInfo dataBaseInfo=sxDataService.getDataBaseInfo(commentModel);
if(dataBaseInfo==null||StringUtils.isEmpty(dataBaseInfo.getUserName())){ if(dataBaseInfo==null){
log.error("syncGoods dataBaseInfo is null"); log.error("syncGoods dataBaseInfo is null");
return; return;
} }

View File

@ -186,8 +186,8 @@ public class BaseDao {
int total=0; int total=0;
Connection connection=getConnection(ip,username,password,portNumber,dataBaseName); Connection connection=getConnection(ip,username,password,portNumber,dataBaseName);
try { try {
String sql="select count(1) from t_pub_plan_detail_b d left join t_pub_plan_master t on " + String sql="select count(1) from t_pub_plan_detail_b d left join t_pub_plan_master m on " +
" d.plan_no =t.plan_no %s"; " d.plan_no =m.plan_no %s";
sql=String.format(sql,where); sql=String.format(sql,where);
log.info(sql); log.info(sql);
PreparedStatement ps= connection.prepareStatement(sql); PreparedStatement ps= connection.prepareStatement(sql);
@ -266,7 +266,7 @@ public class BaseDao {
return total; return total;
} }
public Integer getBaseGoodsJoinTotal(String ip, String username, String password,Integer portNumber, String dataBaseName,String where,String stockOperateWhere){ public Integer getBaseGoodsJoinTotal(String ip, String username, String password,Integer portNumber, String dataBaseName,String where){
int total=0; int total=0;
Connection connection=getConnection(ip,username,password,portNumber,dataBaseName); Connection connection=getConnection(ip,username,password,portNumber,dataBaseName);
try { try {
@ -278,18 +278,19 @@ public class BaseDao {
" ROW_NUMBER() OVER(PARTITION BY tib.item_no ORDER BY tib.oper_date DESC) AS rn " + " ROW_NUMBER() OVER(PARTITION BY tib.item_no ORDER BY tib.oper_date DESC) AS rn " +
" FROM t_im_branch_stock tib\n" + " FROM t_im_branch_stock tib\n" +
") " + ") " +
"SELECT count(1) " + "SELECT " +
// " b.*, " + " b.*, " +
// " ls.stock_qty, " + " ls.stock_qty, " +
// " ls.oper_date " + " ls.oper_date " +
"FROM ( " + "FROM ( " +
" SELECT " + " SELECT " +
" ROW_NUMBER() OVER(ORDER BY item_clsno,item_no) AS rowId, " + " ROW_NUMBER() OVER(ORDER BY item_clsno) AS rowId, " +
" * " + " * " +
" FROM t_bd_item_info shop %s" + " FROM t_bd_item_info " +
") b " + ") b " +
"LEFT JOIN LatestStock ls ON b.item_no = ls.item_no AND ls.rn = 1 %s"; "LEFT JOIN LatestStock ls ON b.item_no = ls.item_no AND ls.rn = 1 " +
sql=String.format(sql,where,stockOperateWhere); " %s";
sql=String.format(sql,where);
log.info(sql); log.info(sql);
PreparedStatement ps= connection.prepareStatement(sql); PreparedStatement ps= connection.prepareStatement(sql);
ResultSet rs=ps.executeQuery(); ResultSet rs=ps.executeQuery();
@ -343,8 +344,7 @@ public class BaseDao {
return resultDto; return resultDto;
} }
public ResultDto baseFindGoodsListJoinPage(String ip, String username, String password,Integer portNumber, String dataBaseName, int pageNo, int pageSize, public ResultDto baseFindGoodsListJoinPage(String ip, String username, String password,Integer portNumber, String dataBaseName, int pageNo, int pageSize,String where){
String where,String stockOperateWhere){
Connection connection=getConnection(ip,username,password,portNumber,dataBaseName); Connection connection=getConnection(ip,username,password,portNumber,dataBaseName);
int start=(pageNo-1)*pageSize+1; int start=(pageNo-1)*pageSize+1;
int end=pageNo*pageSize; int end=pageNo*pageSize;
@ -355,76 +355,19 @@ public class BaseDao {
" tib.oper_date," + " tib.oper_date," +
" ROW_NUMBER() OVER(PARTITION BY tib.item_no ORDER BY tib.oper_date DESC) AS rn " + " ROW_NUMBER() OVER(PARTITION BY tib.item_no ORDER BY tib.oper_date DESC) AS rn " +
" FROM t_im_branch_stock tib " + " FROM t_im_branch_stock tib " +
"), " + ") " +
"PagedData As( SELECT " + "SELECT " +
"ROW_NUMBER() OVER (ORDER BY b.rowId) AS rowIdA, "+//-- 这里重新生成从1开始连续的行号
" b.*, " + " b.*, " +
" ls.stock_qty, " + " ls.stock_qty, " +
" ls.oper_date " + " ls.oper_date " +
"FROM ( " + "FROM ( " +
" SELECT " + " SELECT " +
" ROW_NUMBER() OVER(ORDER BY item_clsno,item_no) AS rowId ," + " ROW_NUMBER() OVER(ORDER BY item_clsno) AS rowId ," +
" * " + " * " +
" FROM t_bd_item_info shop %s" + " FROM t_bd_item_info\n" +
") b " + ") b " +
"LEFT JOIN LatestStock ls ON b.item_no = ls.item_no AND ls.rn = 1 %s) " + "LEFT JOIN LatestStock ls ON b.item_no = ls.item_no AND ls.rn = 1 " +
"SELECT * FROM PagedData where rowIdA BETWEEN %s AND %s "; " %s b.rowId BETWEEN %s AND %s ";
sql=String.format(sql,where,stockOperateWhere,start,end);
log.info(sql);
ResultDto resultDto=new ResultDto();
ResultSet rs=null;
try {
PreparedStatement ps= connection.prepareStatement(sql);
rs = ps.executeQuery();
} catch (SQLException e) {
log.info("数据库查询异常方法{},异常信息{}","com.suisung.mall.shop.sixun.dao.BaseDao.baseFindListJoinPage",e.getMessage());
throw new RuntimeException(e);
}
resultDto.setResultSet(rs);
resultDto.setConnection(connection);
return resultDto;
}
/**
* 全量查询
* @param ip
* @param username
* @param password
* @param portNumber
* @param dataBaseName
* @param pageNo
* @param pageSize
* @param where
* @param stockOperateWhere
* @return
*/
public ResultDto baseFindAllGoodsListJoinPage(String ip, String username, String password,Integer portNumber, String dataBaseName, int pageNo, int pageSize,
String where,String stockOperateWhere){
Connection connection=getConnection(ip,username,password,portNumber,dataBaseName);
int start=(pageNo-1)*pageSize+1;
int end=pageNo*pageSize;
String sql="SELECT * " +
"FROM (" +
" SELECT " +
" ROW_NUMBER() OVER(ORDER BY shop.item_clsno, shop.item_no) AS rowIdA," +
" shop.*," +
" (\n" +
" SELECT TOP 1 stock_qty " +
" FROM t_im_branch_stock " +
" WHERE item_no = shop.item_no " +
" ORDER BY oper_date DESC " +
" ) as stock_qty,\n" +
" (\n" +
" SELECT TOP 1 oper_date " +
" FROM t_im_branch_stock " +
" WHERE item_no = shop.item_no " +
" ORDER BY oper_date DESC " +
" ) as oper_date " +
" FROM t_bd_item_info shop " +
" %s " +
") t " +
"WHERE rowIdA BETWEEN %s AND %s " +
"ORDER BY rowIdA;";
sql=String.format(sql,where,start,end); sql=String.format(sql,where,start,end);
log.info(sql); log.info(sql);
ResultDto resultDto=new ResultDto(); ResultDto resultDto=new ResultDto();

View File

@ -9,10 +9,8 @@ import com.google.gson.Gson;
import com.small.client.Utils.BigDecimalFormatter; import com.small.client.Utils.BigDecimalFormatter;
import com.small.client.Utils.CommonUtil; import com.small.client.Utils.CommonUtil;
import com.small.client.Utils.HttpUtils; import com.small.client.Utils.HttpUtils;
import com.small.client.Utils.SqlBuilder;
import com.small.client.dto.*; import com.small.client.dto.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -22,8 +20,6 @@ import org.springframework.web.client.RestTemplate;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.sql.*; import java.sql.*;
import java.sql.Date;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -54,10 +50,6 @@ public class SxDataDao extends BaseDao{
//private final static String T_IM_BRANCH_STOCK="t_im_branch_stock";//库存表 //private final static String T_IM_BRANCH_STOCK="t_im_branch_stock";//库存表
private final static String T_BD_BRANCH_INFO="t_bd_branch_info";//仓库表
private final static String T_RM_CASHIER="t_rm_cashier";//小发收银账号
private final static String T_IM_BRANCH_STOCK="(" + private final static String T_IM_BRANCH_STOCK="(" +
"select * from( " + "select * from( " +
" select ROW_NUMBER() OVER( " + " select ROW_NUMBER() OVER( " +
@ -127,15 +119,9 @@ public class SxDataDao extends BaseDao{
try { try {
while (rs.next()) { while (rs.next()) {
sxSyncCategory=new SxSyncCategory(); sxSyncCategory=new SxSyncCategory();
if(StringUtils.isNotEmpty(rs.getString("item_clsname"))){ sxSyncCategory.setItem_clsname(rs.getString("item_clsname"));//分类名称
sxSyncCategory.setItem_clsname(rs.getString("item_clsname").trim());//分类名称 sxSyncCategory.setCls_parent(rs.getString("cls_parent"));//父级编码
} sxSyncCategory.setItem_clsno(rs.getString("item_clsno"));//分类编码
if(StringUtils.isNotEmpty(rs.getString("cls_parent"))){
sxSyncCategory.setCls_parent(rs.getString("cls_parent").trim());//父级编码
}
if(StringUtils.isNotEmpty(rs.getString("item_clsno"))){
sxSyncCategory.setItem_clsno(rs.getString("item_clsno").trim());//分类编码
}
// System.out.printf(rs.getString("item_clsno"));//分类编码 // System.out.printf(rs.getString("item_clsno"));//分类编码
// log.info(rs.getString("item_clsname")+"\t");//分类名称 // log.info(rs.getString("item_clsname")+"\t");//分类名称
//log.info(rs.getString("cls_parent")+"\t");//父级编码 //log.info(rs.getString("cls_parent")+"\t");//父级编码
@ -184,12 +170,8 @@ public class SxDataDao extends BaseDao{
* @return * @return
*/ */
public int getTBditemInfoJoninTotal(DataBaseInfo dataBaseInfo){ public int getTBditemInfoJoninTotal(DataBaseInfo dataBaseInfo){
String stockOperateWhere="";
if(StringUtils.isNotEmpty(dataBaseInfo.getStockOperateWhere())){
stockOperateWhere="where "+dataBaseInfo.getStockOperateWhere();
}
return getBaseGoodsJoinTotal(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName() return getBaseGoodsJoinTotal(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName()
,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere(),stockOperateWhere); ,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere());
} }
/** /**
@ -209,22 +191,9 @@ public class SxDataDao extends BaseDao{
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
*/ */
public List<SxSyncGoods> findBditemInfoListPage(DataBaseInfo dataBaseInfo,int pageNo,int pageSize,boolean isAll){ public List<SxSyncGoods> findBditemInfoListPage(DataBaseInfo dataBaseInfo,int pageNo,int pageSize){
String stockOperateWhere=""; ResultDto resultDto=baseFindGoodsListJoinPage(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName()
if(StringUtils.isNotEmpty(dataBaseInfo.getStockOperateWhere())){ ,pageNo,pageSize,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere());
stockOperateWhere=" where "+dataBaseInfo.getStockOperateWhere();
}
ResultDto resultDto=null;
if(!isAll){
resultDto=baseFindGoodsListJoinPage(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName()
,pageNo,pageSize,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere(),stockOperateWhere);
}else {
resultDto=baseFindAllGoodsListJoinPage(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName()
,pageNo,pageSize,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere(),stockOperateWhere);
}
ResultSet rs= resultDto.getResultSet(); ResultSet rs= resultDto.getResultSet();
List<SxSyncGoods> sxSyncGoodses=new ArrayList<>(); List<SxSyncGoods> sxSyncGoodses=new ArrayList<>();
SxSyncGoods sxSyncGoods=null; SxSyncGoods sxSyncGoods=null;
@ -245,7 +214,6 @@ public class SxDataDao extends BaseDao{
}else { }else {
sxSyncGoods.setGross_margin(new BigDecimal("0"));//毛利率 sxSyncGoods.setGross_margin(new BigDecimal("0"));//毛利率
} }
sxSyncGoods.setId(rs.getLong("rowIdA"));
sxSyncGoods.setItem_no(rs.getString("item_no"));//货号 sxSyncGoods.setItem_no(rs.getString("item_no"));//货号
sxSyncGoods.setItem_subname(rs.getString("item_name"));//商品名称 sxSyncGoods.setItem_subname(rs.getString("item_name"));//商品名称
sxSyncGoods.setItem_subno(rs.getString("item_subno"));//商品条码 sxSyncGoods.setItem_subno(rs.getString("item_subno"));//商品条码
@ -502,21 +470,17 @@ public class SxDataDao extends BaseDao{
* @param dataBaseInfo * @param dataBaseInfo
* @param map * @param map
*/ */
public void updateStoreData(DataBaseInfo dataBaseInfo, Map map,Map<String,ProductQuantityConsumptionDto> pqMap,List<ProductQuantityConsumptionDto> productQuantityConsumptionDtoList, public void updateStoreData(DataBaseInfo dataBaseInfo, Map map,List<ProductQuantityConsumptionDto> productQuantityConsumptionDtoList,
CommentModel commentModel){ CommentModel commentModel){
if(CollectionUtil.isEmpty(map)){ if(CollectionUtil.isEmpty(map)){
log.info("同步数据为空"); log.info("同步数据为空");
return; return;
} }
String brachNo=getLocalBranch(dataBaseInfo);//获取总店铺分仓编号 Connection conn =getConnection(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),
Map<String,ItemInfo> itemInfoMap= findItemInfoList(dataBaseInfo,map);//查询商品信息
Connection conn =getConnection(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),
dataBaseInfo.getPassword(), dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName()); dataBaseInfo.getPassword(), dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName());
try { try {
conn.setAutoCommit(false); // 关闭自动提交开启事务 conn.setAutoCommit(false); // 关闭自动提交开启事务
//String sql = "update t_im_branch_stock set stock_qty= stock_qty+(?),oper_date=? where item_no=?"; //String sql = "update t_im_branch_stock set stock_qty= stock_qty+(?),oper_date=? where item_no=?";
List<RmSaleflow> rmSaleflowList=new ArrayList<>();
List<TRmPayflow> tRmPayflowList=new ArrayList<>();
String sql = "WITH TopStock AS ( " + String sql = "WITH TopStock AS ( " +
" SELECT TOP(1) * " + " SELECT TOP(1) * " +
" FROM t_im_branch_stock " + " FROM t_im_branch_stock " +
@ -525,36 +489,17 @@ public class SxDataDao extends BaseDao{
") " + ") " +
" UPDATE TopStock " + " UPDATE TopStock " +
" SET stock_qty = stock_qty+(?),oper_date=?;"; " SET stock_qty = stock_qty+(?),oper_date=?;";
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
try (PreparedStatement ps = conn.prepareStatement(sql)) { try (PreparedStatement ps = conn.prepareStatement(sql)) {
int batchSize = 100; // 每批处理1000条 int batchSize = 1000; // 每批处理1000条
int count = 0; int count = 0;
Set<Map.Entry> sme=map.entrySet(); Set<Map.Entry> sme=map.entrySet();
for (Map.Entry entry : sme) { for (Map.Entry entry : sme) {
String key=entry.getKey().toString();
String[] splitKey = key.split("-");
if(splitKey.length!=2){
continue;
}
String itemNo = splitKey[1];
BigDecimal stock_qty= (BigDecimal) entry.getValue(); BigDecimal stock_qty= (BigDecimal) entry.getValue();
if(stock_qty.compareTo(BigDecimal.ZERO)==0){ if(stock_qty.compareTo(BigDecimal.ZERO)==0){
continue; continue;
} }
ProductQuantityConsumptionDto productQuantityConsumptionDto=pqMap.get(key); ps.setString(1, (String) entry.getKey());
if(productQuantityConsumptionDto.getSaleAmount().compareTo(BigDecimal.ZERO)==0){
continue;
}
RmSaleflow rmSaleflow = getRmSaleflow(productQuantityConsumptionDto, itemNo, stock_qty);
rmSaleflow= fixRmSaleFlow(rmSaleflow,brachNo,itemInfoMap,dataBaseInfo.getSaleAccount());
TRmPayflow trmPayflow=fixTRmPayflow(rmSaleflow);
rmSaleflowList.add(rmSaleflow);
tRmPayflowList.add(trmPayflow);
ps.setString(1, itemNo);
ps.setDouble(2, stock_qty.doubleValue()); ps.setDouble(2, stock_qty.doubleValue());
ps.setTimestamp(3, timestamp); ps.setTimestamp(3, timestamp);
ps.addBatch(); // 添加至批处理 ps.addBatch(); // 添加至批处理
@ -568,15 +513,6 @@ public class SxDataDao extends BaseDao{
// 执行剩余未满 batchSize 的批次 // 执行剩余未满 batchSize 的批次
int[] remainingCounts = ps.executeBatch(); int[] remainingCounts = ps.executeBatch();
//todo 新增流水
if(dataBaseInfo.getClientVersion().equals(DataBaseInfo.SHANG_YUN)){
updateStoreSaleFlow(conn,rmSaleflowList,tRmPayflowList);
}
if (dataBaseInfo.getClientVersion().equals(DataBaseInfo.SHANG_RUI)){
updateStoreSaleFlowShangRui(conn,rmSaleflowList,tRmPayflowList);
}
List<String> consumIds=productQuantityConsumptionDtoList List<String> consumIds=productQuantityConsumptionDtoList
.stream() .stream()
.map(ProductQuantityConsumptionDto::getConsumeId) .map(ProductQuantityConsumptionDto::getConsumeId)
@ -591,7 +527,7 @@ public class SxDataDao extends BaseDao{
if (!HttpUtils.SUCCESSCODE.equals(code)) { if (!HttpUtils.SUCCESSCODE.equals(code)) {
throw new Exception("服务器异常"); throw new Exception("服务器异常");
} }
log.info("库存更新剩余批次更新数: {}", Arrays.toString(remainingCounts)); log.info("剩余批次更新数: {}", Arrays.toString(remainingCounts));
conn.commit(); // 最终提交事务 conn.commit(); // 最终提交事务
log.info("批量更新完成,总记录数: {}" , count); log.info("批量更新完成,总记录数: {}" , count);
//baseUpdateImBrancStock(dataBaseInfo); //baseUpdateImBrancStock(dataBaseInfo);
@ -612,518 +548,6 @@ public class SxDataDao extends BaseDao{
} }
} }
/**
* 封装对象
* @param productQuantityConsumptionDto
* @param itemNo
* @param stock_qty
* @return
*/
private RmSaleflow getRmSaleflow(ProductQuantityConsumptionDto productQuantityConsumptionDto, String itemNo, BigDecimal stock_qty) {
BigDecimal unitPrice = productQuantityConsumptionDto.getUnitPrice();
RmSaleflow rmSaleflow=new RmSaleflow();
rmSaleflow.setItemNo(itemNo);
rmSaleflow.setSalePrice(unitPrice);
rmSaleflow.setSaleQnty(stock_qty);
BigDecimal saleMoney = unitPrice.multiply(stock_qty).setScale(2, RoundingMode.HALF_UP);
if(saleMoney.compareTo(BigDecimal.ZERO)<0){
saleMoney=saleMoney.multiply(new BigDecimal(-1));
}
rmSaleflow.setSaleMoney(saleMoney);
// rmSaleflow.setSourcePrice(unitPrice);
rmSaleflow.setFlownoRand(productQuantityConsumptionDto.getOrderId());//随机子单号 设置网上订单号
if(null!=productQuantityConsumptionDto.getSaleTime()){
rmSaleflow.setOperDate(new Timestamp(productQuantityConsumptionDto.getSaleTime()));
}else {
rmSaleflow.setOperDate(new Timestamp(System.currentTimeMillis()));
}
return rmSaleflow;
}
/**
* 补充字段
* @param rmSaleflow
* @return
*/
public RmSaleflow fixRmSaleFlow(RmSaleflow rmSaleflow,String branchNo,Map<String,ItemInfo> itemInfoMap,String saleAccount){
//自定义单号 start
rmSaleflow.setFlowId(1);
String orderId=rmSaleflow.getFlownoRand();
String[] orderIdSplits= orderId.split("_");
//String DateStr=DateUtil.format(new java.util.Date(),"yyyyMMdd");
String DateStr=orderIdSplits[1];
String number= String.format("%04d", Integer.valueOf(orderIdSplits[orderIdSplits.length-1]));
String flowNo="99"+DateStr+number;
rmSaleflow.setFlowNo(flowNo);//订单号 todo
//自定义 单号 end
//判断取值 start
rmSaleflow.setSellWay("B");
rmSaleflow.setRetQnty(BigDecimal.ZERO);
if(rmSaleflow.getSaleQnty().compareTo(BigDecimal.ZERO)<0){
rmSaleflow.setSellWay("A");
BigDecimal saleQnty=rmSaleflow.getSaleQnty();//销售数量
rmSaleflow.setSaleQnty(saleQnty);
rmSaleflow.setRetQnty(BigDecimal.ZERO);
}
// BigDecimal saleMoney=rmSaleflow.getSalePrice().multiply(rmSaleflow.getSaleQnty());
// if(rmSaleflow.getSaleQnty().compareTo(BigDecimal.ZERO)<0){
// saleMoney=saleMoney.multiply(new BigDecimal("-1"));
// }
// rmSaleflow.setSaleMoney(saleMoney);
//判断取值 end
//数据库查询取值start todo
ItemInfo itemInfo=itemInfoMap.get(rmSaleflow.getItemNo());
if(itemInfo!=null){
rmSaleflow.setInPrice(itemInfo.getPrice());
rmSaleflow.setSourcePrice(itemInfo.getSalePrice());
}
rmSaleflow.setBranchNo(branchNo);
//数据库查询取值end
//远程配置取值start todo
rmSaleflow.setOperId(saleAccount);
rmSaleflow.setSaleMan(saleAccount);
rmSaleflow.setCounterNo(saleAccount);
//远程配置取值end
//统一默认值 start
rmSaleflow.setNStan(BigDecimal.ZERO);
rmSaleflow.setChrStan("0");
rmSaleflow.setFlownoType("0");
rmSaleflow.setPrefAmt(BigDecimal.ZERO);
rmSaleflow.setComFlag("0");
rmSaleflow.setRemoteFlag("0");
rmSaleflow.setPaysum_flag("0");
rmSaleflow.setKz_flag("1");
//统一默认值 end
return rmSaleflow;
}
/**
* 支付流水赋值
* @return
*/
public TRmPayflow fixTRmPayflow(RmSaleflow rmSaleflow){
TRmPayflow rmPayflow=new TRmPayflow();
rmPayflow.setFlowId(rmSaleflow.getFlowId());
rmPayflow.setFlowNo(rmSaleflow.getFlowNo());
// BigDecimal saleAmount=rmSaleflow.getSalePrice().multiply(rmSaleflow.getSaleQnty()).setScale(2, RoundingMode.HALF_UP);
// if(saleAmount.compareTo(BigDecimal.ZERO)<0){
// saleAmount=saleAmount.multiply(new BigDecimal("-1"));
// }
// rmPayflow.setSaleAmount(saleAmount);
rmPayflow.setSaleAmount(rmSaleflow.getSaleMoney());
rmPayflow.setBranchNo(rmSaleflow.getBranchNo());
rmPayflow.setPayWay("RMB");//人民币
rmPayflow.setSellWay(rmSaleflow.getSellWay());
rmPayflow.setCardNo("");
rmPayflow.setVipNo(null);
rmPayflow.setCoinNo("RMB");//
rmPayflow.setCoinRate(new BigDecimal("1"));//利率
rmPayflow.setPayAmount(rmSaleflow.getSaleMoney());
rmPayflow.setOperDate(rmSaleflow.getOperDate());
rmPayflow.setOperId(rmSaleflow.getOperId());
rmPayflow.setCounterNo(rmSaleflow.getCounterNo());
rmPayflow.setSaleMan(rmSaleflow.getSaleMan());
rmPayflow.setMemo("");
rmPayflow.setVoucherNo("");//退货单号 退货时要填
rmPayflow.setRemoteFlag("0");
rmPayflow.setExchangeFlag("0");
rmPayflow.setShiftNo("");
rmPayflow.setComFlag("0");
rmPayflow.setPosid("01");
rmPayflow.setUptime(null);
rmPayflow.setFlownoRand(rmSaleflow.getFlownoRand());
rmPayflow.setCiceroniNo("0");
rmPayflow.setCiceroniId(null);
rmPayflow.setFlownoType(rmSaleflow.getFlownoType());
rmPayflow.setTransType(null);
rmPayflow.setUpBatchno("");//todo
rmPayflow.setUpVipacc("0");
rmPayflow.setCashNo("00");
if("B".equals(rmSaleflow.getSellWay())){//退货
rmPayflow.setMemo("正常退货");
rmPayflow.setVoucherNo("");//退货单号 退货时要填
rmPayflow.setRemoteFlag("");
rmPayflow.setExchangeFlag("0");
rmPayflow.setUpVipacc(null);
}
return rmPayflow;
}
/**
* 查询商品返回map
* @param dataBaseInfo
* @param map
* @return
*/
public Map<String,ItemInfo> findItemInfoList(DataBaseInfo dataBaseInfo,Map map){
if(CollectionUtil.isEmpty(map)){
return null;
}
Map<String,ItemInfo> resultMap=new HashMap<>();
Set<Map.Entry> sme=map.entrySet();
String where = "where 1=1 and ";
List<String> itemNos = sme.stream()
.map(entry -> {
String key= (String) entry.getKey();
String[] split = key.split("-");
return split[1];
})
.collect(Collectors.toList());
where += SqlBuilder.buildInCondition("item_no", itemNos);
ResultDto resultDto= this.baseFindList(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),
dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName(),T_BD_ITEM_INFO,where);
ResultSet rs= resultDto.getResultSet();
try {
while (rs.next()) {
ItemInfo itemInfo=new ItemInfo();
String itemNo=rs.getString("item_no").trim();
itemInfo.setItemNo(itemNo);//
if(StringUtils.isNotEmpty(rs.getString("item_subno"))){
itemInfo.setItemSubno(rs.getString("item_subno").trim());
}
if(StringUtils.isNotEmpty(rs.getString("item_name"))){
itemInfo.setItemName(rs.getString("item_name").trim());
}
if(StringUtils.isNotEmpty(rs.getString("item_brand"))){
itemInfo.setItemBrand(rs.getString("item_brand").trim());//品牌
}
if(StringUtils.isNotEmpty(rs.getString("price"))){
itemInfo.setPrice(rs.getBigDecimal("price"));//进货价
}
if(StringUtils.isNotEmpty(rs.getString("item_clsno"))){
itemInfo.setItemClsno(rs.getString("item_clsno").trim());
}
if(StringUtils.isNotEmpty(rs.getString("sale_price"))){
itemInfo.setSalePrice(rs.getBigDecimal("sale_price"));
}
resultMap.put(itemNo,itemInfo);
}
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
try {
resultDto.getConnection().close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
return resultMap;
}
/**
* 批量新增销售流水 商云10
* @param conn
* @param rmSaleflowList
*/
public void updateStoreSaleFlow(Connection conn,List<RmSaleflow> rmSaleflowList,List<TRmPayflow> payflowList){
if(CollectionUtil.isEmpty(rmSaleflowList)){
log.info("销售流水记录为空");
return;
}
// Connection conn =getConnection(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),
// dataBaseInfo.getPassword(), dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName());
//try {
//conn.setAutoCommit(false); // 关闭自动提交开启事务
String sql = "INSERT INTO t_rm_saleflow (" +
"flow_id, flow_no, branch_no, item_no, source_price, sale_price, " +
"sale_qnty, sale_money, sell_way, oper_id, sale_man, counter_no, " +
"oper_date, remote_flag, shift_no, com_flag, spec_flag, pref_amt, " +
"in_price, n_stan, chr_stan, posid, uptime, flowno_rand, ret_qnty, " +
"flowno_type, spec_sheet_no, cic_sheet_no" +
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
String sql2 = "INSERT INTO t_rm_payflow (" +
"flow_id, flow_no, sale_amount, branch_no, pay_way, sell_way, " +
"card_no, vip_no, coin_no, coin_rate, pay_amount, oper_date, " +
"oper_id, counter_no, sale_man, memo,remote_flag, " +
"exchange_flag, shift_no, com_flag, uptime, flowno_rand, " +
"ciceroni_no, ciceroni_id, flowno_type, trans_type, up_batchno, " +
"remark, cash_no" +
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
try {
PreparedStatement ps = conn.prepareStatement(sql);//销售流水
PreparedStatement ps2 = conn.prepareStatement(sql2);//资金流水
int batchSize = 10; // 每批处理10条
int count = 0;
for (int i=0;i<rmSaleflowList.size();i++) {
//rmSaleflow start-------------
RmSaleflow rmSaleflow=rmSaleflowList.get(i);
ps.setInt(1,rmSaleflow.getFlowId());
ps.setString(2, rmSaleflow.getFlowNo());
ps.setString(3, rmSaleflow.getBranchNo());
ps.setString(4, rmSaleflow.getItemNo());
ps.setBigDecimal(5, rmSaleflow.getSourcePrice());
ps.setBigDecimal(6, rmSaleflow.getSalePrice());
BigDecimal saleQnty=rmSaleflow.getSaleQnty();
if(saleQnty.compareTo(BigDecimal.ZERO)<0){
saleQnty=saleQnty.multiply(new BigDecimal("-1"));
}
ps.setBigDecimal(7,saleQnty);
ps.setBigDecimal(8, rmSaleflow.getSaleMoney());
ps.setString(9, rmSaleflow.getSellWay());
ps.setString(10, rmSaleflow.getOperId());
ps.setString(11, rmSaleflow.getSaleMan());
ps.setString(12, rmSaleflow.getCounterNo());
ps.setTimestamp(13, rmSaleflow.getOperDate());//OperDate
ps.setString(14, rmSaleflow.getRemoteFlag());
ps.setString(15, "");//ShiftNo
ps.setString(16, rmSaleflow.getComFlag());
ps.setString(17, "");//SpecFlag
ps.setBigDecimal(18, rmSaleflow.getPrefAmt());
ps.setBigDecimal(19, rmSaleflow.getInPrice());
ps.setBigDecimal(20, rmSaleflow.getNStan());
ps.setString(21, rmSaleflow.getChrStan());
ps.setString(22, rmSaleflow.getPosid());
ps.setTimestamp(23, null);//Uptime
ps.setString(24, rmSaleflow.getFlownoRand());
ps.setBigDecimal(25, rmSaleflow.getRetQnty());
ps.setString(26, rmSaleflow.getFlownoType());
ps.setString(27, rmSaleflow.getSpecSheetNo());
ps.setString(28, "");//CicSheetNo
// ps.setString(29, rmSaleflow.getShareCardid());
// ps.setString(30, rmSaleflow.getItemNoFresh());
ps.addBatch(); // 添加至批处理
//rmSaleflow end-------------
//rmPayflow start-------------
TRmPayflow rmPayflow=payflowList.get(i);
//rmPayflow end-------------
ps2.setInt(1,rmPayflow.getFlowId());
ps2.setString(2, rmPayflow.getFlowNo());
ps2.setBigDecimal(3, rmPayflow.getSaleAmount());
ps2.setString(4, rmPayflow.getBranchNo());
ps2.setString(5, rmPayflow.getPayWay());
ps2.setString(6, rmPayflow.getSellWay());
ps2.setString(7, rmPayflow.getCardNo());
ps2.setString(8, rmPayflow.getVipNo());
ps2.setString(9, rmPayflow.getCoinNo());
ps2.setBigDecimal(10, rmPayflow.getCoinRate());
ps2.setBigDecimal(11, rmPayflow.getPayAmount());
ps2.setTimestamp(12, rmPayflow.getOperDate());
ps2.setString(13, rmPayflow.getOperId());//OperDate
ps2.setString(14, rmPayflow.getCounterNo());
ps2.setString(15, rmPayflow.getSaleMan());
ps2.setString(16, rmPayflow.getMemo());
// ps2.setString(17, rmPayflow.getVoucherNo());
ps2.setString(17, rmPayflow.getRemoteFlag());
ps2.setString(18, rmPayflow.getExchangeFlag());
ps2.setString(19, rmPayflow.getShiftNo());
ps2.setString(20, rmPayflow.getComFlag());
//ps2.setString(22, rmPayflow.getPosid());
ps2.setTimestamp(21, null);//Uptime
ps2.setString(22, rmPayflow.getFlownoRand());
ps2.setString(23, rmPayflow.getCiceroniNo());
ps2.setString(24, rmPayflow.getCiceroniId());
ps2.setString(25, rmPayflow.getFlownoType());
ps2.setString(26, rmPayflow.getTransType());
ps2.setString(27, rmPayflow.getUpBatchno());
// ps2.setString(30, rmPayflow.getUpVipacc());
ps2.setString(28, rmPayflow.getRemark());
ps2.setString(29, rmPayflow.getCashNo());
// ps2.setString(33, rmPayflow.getCheckData());
ps2.addBatch(); // 添加至批处理
count++;
if (count % batchSize == 0) {
ps.executeBatch();
ps2.executeBatch();
ps.clearBatch();
ps2.clearBatch();
log.info("已提交批次: {}", count);
}
}
// 执行剩余未满 batchSize 的批次
int[] remainingCounts = ps.executeBatch();
int[] remainingCounts2 = ps2.executeBatch();
log.info("销售流水记录剩余批次更新数: {}", Arrays.toString(remainingCounts));
log.info("支付流水记录剩余批次更新数: {}", Arrays.toString(remainingCounts2));
//conn.commit(); // 最终提交事务
log.info("销售-支付-流水记录批量更新完成,总记录数: {}" , count);
//baseUpdateImBrancStock(dataBaseInfo);
} catch (Exception e) {
// conn.rollback(); // 出错时回滚整个事务
log.info("销售支付流水记录业务失败:: {}", e.getMessage());
throw new RuntimeException("销售支付流水记录业务失败:: {}"+e.getMessage());
}
// } catch (SQLException e) {
// log.info("sql失败: {}", e.getMessage());
// throw new RuntimeException("sql失败: {}"+e.getMessage());
// }
}
/**
* 批量新增销售流水 商瑞9.7
* @param conn
* @param rmSaleflowList
*/
public void updateStoreSaleFlowShangRui(Connection conn,List<RmSaleflow> rmSaleflowList,List<TRmPayflow> payflowList){
if(CollectionUtil.isEmpty(rmSaleflowList)){
log.info("销售流水记录为空");
return;
}
// Connection conn =getConnection(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),
// dataBaseInfo.getPassword(), dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName());
//try {
//conn.setAutoCommit(false); // 关闭自动提交开启事务
String sql = "INSERT INTO t_rm_saleflow (" +
"flow_id, flow_no, branch_no, item_no, source_price, sale_price, " +
"sale_qnty, sale_money, sell_way, oper_id, sale_man, counter_no, " +
"oper_date, remote_flag, shift_no, com_flag, spec_flag, pref_amt, " +
"in_price, n_stan, chr_stan, posid, uptime, " +
"paysum_flag, spec_sheet_no,kz_flag, update_date" +
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?)";
String sql2 = "INSERT INTO t_rm_payflow (" +
"flow_id, flow_no, sale_amount, branch_no, pay_way, sell_way, " +
"card_no, vip_no, coin_no, coin_rate, pay_amount, oper_date, " +
"oper_id, counter_no, sale_man, memo,remote_flag, " +
"exchange_flag, shift_no, com_flag, uptime, " +
"kz_no" +
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
try {
PreparedStatement ps = conn.prepareStatement(sql);//销售流水
PreparedStatement ps2 = conn.prepareStatement(sql2);//资金流水
int batchSize = 10; // 每批处理10条
int count = 0;
for (int i=0;i<rmSaleflowList.size();i++) {
//rmSaleflow start-------------
RmSaleflow rmSaleflow=rmSaleflowList.get(i);
ps.setInt(1,rmSaleflow.getFlowId());
ps.setString(2, rmSaleflow.getFlowNo());
ps.setString(3, rmSaleflow.getBranchNo());
ps.setString(4, rmSaleflow.getItemNo());
ps.setBigDecimal(5, rmSaleflow.getSourcePrice());
ps.setBigDecimal(6, rmSaleflow.getSalePrice());
BigDecimal saleQnty=rmSaleflow.getSaleQnty();
if(saleQnty.compareTo(BigDecimal.ZERO)<0){
saleQnty=saleQnty.multiply(new BigDecimal("-1"));
}
ps.setBigDecimal(7,saleQnty);
ps.setBigDecimal(8, rmSaleflow.getSaleMoney());
ps.setString(9, rmSaleflow.getSellWay());
ps.setString(10, rmSaleflow.getOperId());
ps.setString(11, rmSaleflow.getSaleMan());
ps.setString(12, rmSaleflow.getCounterNo());
ps.setTimestamp(13, rmSaleflow.getOperDate());//OperDate
ps.setString(14, rmSaleflow.getRemoteFlag());
ps.setString(15, "");//ShiftNo
ps.setString(16, rmSaleflow.getComFlag());
ps.setString(17, "");//SpecFlag
ps.setBigDecimal(18, rmSaleflow.getPrefAmt());
ps.setBigDecimal(19, rmSaleflow.getInPrice());
ps.setBigDecimal(20, rmSaleflow.getNStan());
ps.setString(21, rmSaleflow.getChrStan());
ps.setString(22, rmSaleflow.getPosid());
ps.setTimestamp(23, null);//Uptime
// ps.setString(24, rmSaleflow.getFlownoRand());
// ps.setBigDecimal(25, rmSaleflow.getRetQnty());
ps.setString(24, rmSaleflow.getPaysum_flag());//paysum_flag
ps.setString(25, rmSaleflow.getSpecSheetNo());
ps.setString(26, rmSaleflow.getKz_flag());//kz_flag
ps.setTimestamp(27, rmSaleflow.getOperDate());//update_date
// ps.setString(29, rmSaleflow.getShareCardid());
// ps.setString(30, rmSaleflow.getItemNoFresh());
ps.addBatch(); // 添加至批处理
//rmSaleflow end-------------
//rmPayflow start-------------
TRmPayflow rmPayflow=payflowList.get(i);
//rmPayflow end-------------
ps2.setInt(1,rmPayflow.getFlowId());
ps2.setString(2, rmPayflow.getFlowNo());
ps2.setBigDecimal(3, rmPayflow.getSaleAmount());
ps2.setString(4, rmPayflow.getBranchNo());
ps2.setString(5, rmPayflow.getPayWay());
ps2.setString(6, rmPayflow.getSellWay());
ps2.setString(7, rmPayflow.getCardNo());
ps2.setString(8, rmPayflow.getVipNo());
ps2.setString(9, rmPayflow.getCoinNo());
ps2.setBigDecimal(10, rmPayflow.getCoinRate());
ps2.setBigDecimal(11, rmPayflow.getPayAmount());
ps2.setTimestamp(12, rmPayflow.getOperDate());
ps2.setString(13, rmPayflow.getOperId());//OperDate
ps2.setString(14, rmPayflow.getCounterNo());
ps2.setString(15, rmPayflow.getSaleMan());
ps2.setString(16, rmPayflow.getMemo());
// ps2.setString(17, rmPayflow.getVoucherNo());
ps2.setString(17, rmPayflow.getRemoteFlag());
ps2.setString(18, rmPayflow.getExchangeFlag());
ps2.setString(19, rmPayflow.getShiftNo());
ps2.setString(20, rmPayflow.getComFlag());
//ps2.setString(22, rmPayflow.getPosid());
ps2.setTimestamp(21, null);//Uptime
// ps2.setString(22, rmPayflow.getFlownoRand());
// ps2.setString(22, rmPayflow.getCiceroniNo());
// ps2.setString(23, rmPayflow.getCiceroniId());
// ps2.setString(24, rmPayflow.getFlownoType());
// ps2.setString(25, rmPayflow.getTransType());
// ps2.setString(26, rmPayflow.getUpBatchno());
// ps2.setString(30, rmPayflow.getUpVipacc());
ps2.setString(22, rmPayflow.getKz_no());
// ps2.setString(29, rmPayflow.getCashNo());
// ps2.setString(33, rmPayflow.getCheckData());
ps2.addBatch(); // 添加至批处理
count++;
if (count % batchSize == 0) {
ps.executeBatch();
ps2.executeBatch();
ps.clearBatch();
ps2.clearBatch();
log.info("已提交批次: {}", count);
}
}
// 执行剩余未满 batchSize 的批次
int[] remainingCounts = ps.executeBatch();
int[] remainingCounts2 = ps2.executeBatch();
log.info("销售流水记录剩余批次更新数: {}", Arrays.toString(remainingCounts));
log.info("支付流水记录剩余批次更新数: {}", Arrays.toString(remainingCounts2));
//conn.commit(); // 最终提交事务
log.info("销售-支付-流水记录批量更新完成,总记录数: {}" , count);
//baseUpdateImBrancStock(dataBaseInfo);
} catch (Exception e) {
// conn.rollback(); // 出错时回滚整个事务
log.info("销售支付流水记录业务失败:: {}", e.getMessage());
throw new RuntimeException("销售支付流水记录业务失败:: {}"+e.getMessage());
}
// } catch (SQLException e) {
// log.info("sql失败: {}", e.getMessage());
// throw new RuntimeException("sql失败: {}"+e.getMessage());
// }
}
/** /**
*获取促销活动价格 时段特价单 *获取促销活动价格 时段特价单
* @param dataBaseInfo * @param dataBaseInfo
@ -1351,7 +775,7 @@ public class SxDataDao extends BaseDao{
,dataBaseInfo.getPassword() ,dataBaseInfo.getPassword()
,dataBaseInfo.getDbPort() ,dataBaseInfo.getDbPort()
,dataBaseInfo.getDataBaseName() ,dataBaseInfo.getDataBaseName()
,T_PUB_PLAN_MASTER +" b" ,T_PUB_PLAN_MASTER
,PLAN_NO ,PLAN_NO
,pageNo ,pageNo
,pageSize ,pageSize
@ -1471,54 +895,4 @@ public class SxDataDao extends BaseDao{
return getTotalSpecShop(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(), return getTotalSpecShop(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),
dataBaseInfo.getDataBaseName(),where); dataBaseInfo.getDataBaseName(),where);
} }
/**
* 获取本地仓库
* @return
*/
public String getLocalBranch(DataBaseInfo dataBaseInfo){
ResultDto resultDto= this.baseFindList(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),
dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName(),T_BD_BRANCH_INFO,"where property =2 ");
ResultSet rs= resultDto.getResultSet();
String branch_no = "";
try {
while (rs.next()) {
branch_no=rs.getString("branch_no");//
}
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
try {
resultDto.getConnection().close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
return branch_no;
}
/**
* 获取小发账号
* @return
*/
public String getTRmCashier(DataBaseInfo dataBaseInfo,String accountNo){
ResultDto resultDto= this.baseFindList(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),
dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName(),T_RM_CASHIER,"where cashier_id='"+accountNo+"'");
ResultSet rs= resultDto.getResultSet();
String cashier_id = "";
try {
while (rs.next()) {
cashier_id=rs.getString("cashier_id");//
}
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
try {
resultDto.getConnection().close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
return cashier_id;
}
} }

View File

@ -8,10 +8,6 @@ import java.util.Date;
@Data @Data
public class DataBaseInfo { public class DataBaseInfo {
public static final String SHANG_YUN="1";//1 商云10
public static final String SHANG_RUI="2";//2 商瑞9.7
public static final String SHANG_QI="3";//3 商祺
@ApiModelProperty("数据库IP") @ApiModelProperty("数据库IP")
private String ip; private String ip;
@ApiModelProperty("用户名") @ApiModelProperty("用户名")
@ -45,22 +41,4 @@ public class DataBaseInfo {
@ApiModelProperty(value = "间隔时间") @ApiModelProperty(value = "间隔时间")
private String shopGapTime; private String shopGapTime;
@ApiModelProperty(value = "调价时间")
private String priceOperatime;
@ApiModelProperty(value = "库存条件")
private String stockOperateWhere;
@ApiModelProperty(value = "营业员账号")
private String saleAccount;
@ApiModelProperty(value = "是否同步活动(0:否,1:是)")
private String isSyncActive;
@ApiModelProperty(value = "是否同步会员(0:否,1:是)")
private String isSyncMember;
@ApiModelProperty(value = "客户端版本:1商云10,2商瑞9.7,3商祺")
private String clientVersion;
} }

View File

@ -1,50 +0,0 @@
package com.small.client.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ItemInfo {
/**
* 商品货架号
*/
private String itemNo;
/**
* 自定义编号
*/
private String itemSubno;
/**
* 商品名称
*/
private String itemName;
/**
* 商品分类编号
*/
private String itemClsno;
/**
* 商品品牌
*/
private String itemBrand;
/**
* 单位
*/
private String unitNo;
/**
* 进货价格
*/
private BigDecimal price;
/**
* 零售价
*/
private BigDecimal salePrice;
}

View File

@ -23,15 +23,9 @@ public class ProductQuantityConsumptionDto {
@ApiModelProperty("商品编号") @ApiModelProperty("商品编号")
private String productNumber; private String productNumber;
@ApiModelProperty("商品单价,如果是切割商品要算回来每公斤多少")
private BigDecimal unitPrice;
@ApiModelProperty("数量(正数表示入库/增加,负数表示出库/减少)") @ApiModelProperty("数量(正数表示入库/增加,负数表示出库/减少)")
private BigDecimal quantity; private BigDecimal quantity;
@ApiModelProperty("订单总额")
private BigDecimal saleAmount;
@ApiModelProperty("消费状态0-未消费1-已消费") @ApiModelProperty("消费状态0-未消费1-已消费")
private Integer status; private Integer status;
@ -45,7 +39,4 @@ public class ProductQuantityConsumptionDto {
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "下单时间")
private Long saleTime;
} }

View File

@ -1,55 +0,0 @@
package com.small.client.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
@Data
public class RmSaleflow {
private Long comNo;
private Integer flowId;//第几个商品 从1开始算
private String flowNo;//自定义编号
private String branchNo;
private String itemNo;
private BigDecimal sourcePrice;
private BigDecimal salePrice;
private BigDecimal saleQnty;//销售数量
private BigDecimal saleMoney;
private String sellWay;//A销售B退货
private String operId;
private String saleMan;
private String counterNo;
private Timestamp operDate;
private String remoteFlag;
private String shiftNo;
private String comFlag;
private String specFlag;
private BigDecimal prefAmt;
private BigDecimal inPrice;
private BigDecimal nStan;
private String chrStan;
private String posid;
private Date uptime;
private String specSheetNo;
//商云10字段
private String flownoRand;
private BigDecimal retQnty;
private String flownoType;
private String cicSheetNo;
private String shareCardid;
// private String itemNoFresh;
//商瑞9.7字段
private String paysum_flag;
private String voucher_no;
private String pr_spec_sheet_no;
private String ot_spec_sheet_no;
private String ot_spec_pref_amt;
private String item_no_Fresh;
private String kz_flag;
private Timestamp update_date;
}

View File

@ -71,16 +71,4 @@ public class StoreDbConfig implements Serializable {
@ApiModelProperty("商品同步间隔时间") @ApiModelProperty("商品同步间隔时间")
private String shopGapTime; private String shopGapTime;
@ApiModelProperty(value = "营业员账号")
private String saleAccount;
@ApiModelProperty(value = "是否同步活动(0:否,1:是)")
private String isSyncActive;
@ApiModelProperty(value = "是否同步会员(0:否,1:是)")
private String isSyncMember;
@ApiModelProperty(value = "客户端版本:1商云10,2商瑞9.7,3商祺")
private String clientVersion;
} }

View File

@ -12,9 +12,6 @@ import java.util.List;
@Data @Data
public class SxGoosModel { public class SxGoosModel {
@ApiModelProperty(value = "分页编号")
private Long rowIdA;
@ApiModelProperty("商品名称") @ApiModelProperty("商品名称")
private String product_name; private String product_name;

View File

@ -1,181 +0,0 @@
package com.small.client.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
@Data
public class TRmPayflow {
/**
* 流水ID - 主键自增
*/
private Long comNo;
/**
* 编号
*/
private Integer flowId;
/**
* 流水号
*/
private String flowNo;
/**
* 销售金额
*/
private BigDecimal saleAmount;
/**
* 门店编号
*/
private String branchNo;
/**
* 支付方式
*/
private String payWay;
/**
* 销售方式
*/
private String sellWay;
/**
* 卡号
*/
private String cardNo;
/**
* 会员号
*/
private String vipNo;
/**
* 币种
*/
private String coinNo;
/**
* 汇率
*/
private BigDecimal coinRate;
/**
* 支付金额
*/
private BigDecimal payAmount;
/**
* 操作时间
*/
private Timestamp operDate;
/**
* 操作员ID
*/
private String operId;
/**
* 柜台号
*/
private String counterNo;
/**
* 销售员
*/
private String saleMan;
/**
* 备注
*/
private String memo;
/**
* 凭证号
*/
private String voucherNo;
/**
* 远程标志
*/
private String remoteFlag;
/**
* 兑换标志
*/
private String exchangeFlag;
/**
* 班次号
*/
private String shiftNo;
/**
* 完成标志
*/
private String comFlag;
/**
* POS机ID
*/
private String posid;
/**
* 更新时间
*/
private Date uptime;
private String checkData;
/**
*
* 商云10
* **/
/**
* 随机流水号
*/
private String flownoRand;
/**
* 导游编号
*/
private String ciceroniNo;
/**
* 导游ID
*/
private String ciceroniId;
/**
* 流水号类型
*/
private String flownoType;
/**
* 交易类型
*/
private String transType;
/**
* 上传批次号
*/
private String upBatchno;
/**
* 上传会员账户
*/
private String upVipacc;
/**
* 备注
*/
private String remark;
private String cashNo;
//商瑞9.7
private String kz_no;
}

View File

@ -60,7 +60,7 @@ public abstract class SxDataAbstService {
* @param allSxSyncCategories 所有分类 * @param allSxSyncCategories 所有分类
* @return * @return
*/ */
public List<SxCategoryModel> ConVToSxCategoryModel(List<SxSyncCategory> sxSyncCategories,List<SxSyncCategory> allSxSyncCategories, Map<String,String> clsBrandMap) { public List<SxCategoryModel> ConVToSxCategoryModel(List<SxSyncCategory> sxSyncCategories,List<SxSyncCategory> allSxSyncCategories, Map<String,String> clsBrandMap) {
if(CollectionUtil.isEmpty(sxSyncCategories)){ if(CollectionUtil.isEmpty(sxSyncCategories)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -69,41 +69,37 @@ public abstract class SxDataAbstService {
SxCategoryModel sxCategoryModel=null; SxCategoryModel sxCategoryModel=null;
while (iterator.hasNext()){ while (iterator.hasNext()){
SxSyncCategory sxSyncCategory= iterator.next(); SxSyncCategory sxSyncCategory= iterator.next();
try { sxCategoryModel=new SxCategoryModel();
sxCategoryModel=new SxCategoryModel(); sxCategoryModel.setCategory_image(SxDataDao.DEFAULT_IMG);
sxCategoryModel.setCategory_image(SxDataDao.DEFAULT_IMG); sxCategoryModel.setCategory_name(sxSyncCategory.getItem_clsname());
sxCategoryModel.setCategory_name(sxSyncCategory.getItem_clsname()); sxCategoryModel.setBrandName(clsBrandMap.get(sxSyncCategory.getItem_clsname()));
sxCategoryModel.setBrandName(clsBrandMap.get(sxSyncCategory.getItem_clsname())); //寻找父级
//寻找父级 if(StringUtils.isNotEmpty(sxSyncCategory.getCls_parent())){
if(StringUtils.isNotEmpty(sxSyncCategory.getCls_parent())){ SxSyncCategory firstNode=getParentNode(allSxSyncCategories,sxSyncCategory.getCls_parent());
SxSyncCategory firstNode=getParentNode(allSxSyncCategories,sxSyncCategory.getCls_parent()); if(null==firstNode){
if(null==firstNode){ sxCategoryModel.setFirst_category_name("");
sxCategoryModel.setFirst_category_name(""); sxCategoryModel.setProduct_type(sxCategoryModel.getCategory_name());
sxCategoryModel.setProduct_type(sxCategoryModel.getCategory_name()); sxCategoryModels.add(sxCategoryModel);
sxCategoryModels.add(sxCategoryModel); continue;
continue; }
} sxCategoryModel.setParent_name(firstNode.getItem_clsname());//todo 暂时无用
sxCategoryModel.setParent_name(firstNode.getItem_clsname());//todo 暂时无用 //如何存在上级的上级则上级为第二层上上及为第一层
//如何存在上级的上级则上级为第二层上上及为第一层 if(StringUtils.isNotEmpty(firstNode.getCls_parent())) {//还存在上级
if(StringUtils.isNotEmpty(firstNode.getCls_parent())) {//还存在上级 SxSyncCategory secondNode=getParentNode(allSxSyncCategories,firstNode.getCls_parent());
SxSyncCategory secondNode=getParentNode(allSxSyncCategories,firstNode.getCls_parent()); if(null!=secondNode && secondNode.getItem_clsno().equals(firstNode.getCls_parent())){
if(null!=secondNode && secondNode.getItem_clsno().equals(firstNode.getCls_parent())){ sxCategoryModel.setFirst_category_name(secondNode.getItem_clsname());
sxCategoryModel.setFirst_category_name(secondNode.getItem_clsname()); sxCategoryModel.setSecond_category_name(firstNode.getItem_clsname());
sxCategoryModel.setSecond_category_name(firstNode.getItem_clsname());
}else {
sxCategoryModel.setFirst_category_name(firstNode.getItem_clsname());
}
}else { }else {
sxCategoryModel.setFirst_category_name(firstNode.getItem_clsname()); sxCategoryModel.setFirst_category_name(firstNode.getItem_clsname());
} }
}else { }else {
sxCategoryModel.setFirst_category_name(""); sxCategoryModel.setFirst_category_name(firstNode.getItem_clsname());
} }
sxCategoryModel.setProduct_type(sxCategoryModel.getCategory_name()); }else {
sxCategoryModels.add(sxCategoryModel); sxCategoryModel.setFirst_category_name("");
}catch (Exception e){
log.info("sxSyncCategory:{}",sxSyncCategory);
} }
sxCategoryModel.setProduct_type(sxCategoryModel.getCategory_name());
sxCategoryModels.add(sxCategoryModel);
} }
sxCategoryModels=filterCategories(sxCategoryModels); sxCategoryModels=filterCategories(sxCategoryModels);
return sxCategoryModels; return sxCategoryModels;
@ -136,7 +132,7 @@ public abstract class SxDataAbstService {
List<SxSyncCategory> list= sxSyncCategories.stream().filter(cc-> List<SxSyncCategory> list= sxSyncCategories.stream().filter(cc->
cc.getItem_clsno().trim().equals(parentId.trim())) cc.getItem_clsno().trim().equals(parentId.trim()))
.collect(Collectors.toList()); .collect(Collectors.toList());
return CollectionUtil.isNotEmpty(list)?list.get(0):null; return CollectionUtil.isNotEmpty(list)?list.get(0):new SxSyncCategory();
} }
/** /**
@ -152,7 +148,6 @@ public abstract class SxDataAbstService {
SxGoosModel sxGoosModel=null; SxGoosModel sxGoosModel=null;
for (SxSyncGoods sxSyncGood:sxSyncGoods){ for (SxSyncGoods sxSyncGood:sxSyncGoods){
sxGoosModel=new SxGoosModel(); sxGoosModel=new SxGoosModel();
sxGoosModel.setRowIdA(sxSyncGood.getId());
sxGoosModel.setProduct_name(sxSyncGood.getItem_subname()); sxGoosModel.setProduct_name(sxSyncGood.getItem_subname());
sxGoosModel.setProduct_number(sxSyncGood.getItem_no().trim());// sxGoosModel.setProduct_number(sxSyncGood.getItem_no().trim());//
sxGoosModel.setProduct_barcode(sxSyncGood.getItem_no().trim());// sxGoosModel.setProduct_barcode(sxSyncGood.getItem_no().trim());//

View File

@ -63,7 +63,7 @@ public interface SxDataService {
* @param commentModel * @param commentModel
* @return * @return
*/ */
boolean syncAtive(DataBaseInfo dataBaseInfo,CommentModel commentModel); void syncAtive(DataBaseInfo dataBaseInfo,CommentModel commentModel);
/** /**
* 同步活动商品 * 同步活动商品
@ -73,18 +73,4 @@ public interface SxDataService {
void syncAtiveShops(DataBaseInfo dataBaseInfo,CommentModel commentModel); void syncAtiveShops(DataBaseInfo dataBaseInfo,CommentModel commentModel);
String getCategoryChildren(DataBaseInfo dataBaseInfo,String parentId); String getCategoryChildren(DataBaseInfo dataBaseInfo,String parentId);
/**
* 校验是否有新的入库
* @param dataBaseInfo
* @param refreshTime
* @return
*/
boolean isNewShop(DataBaseInfo dataBaseInfo, String refreshTime);
/**
* 刷新同步时间
* @return
*/
void refreshTime(CommentModel commentModel);
} }

View File

@ -22,22 +22,31 @@ import com.small.client.service.WebClientService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.LaxRedirectStrategy;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.util.StreamUtils; import org.springframework.util.StreamUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
import javax.net.ssl.SSLContext;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.time.Instant; import java.time.Instant;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -133,10 +142,9 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
syncAllGoods(dataBaseInfo, commentModel); syncAllGoods(dataBaseInfo, commentModel);
break; break;
case "02"://增量 todo test case "02"://增量 todo test
String sycnTime=commentModel.getSyncTime(); syncIncrementAddGoods(dataBaseInfo, commentModel);
syncIncrementAddGoods(dataBaseInfo, commentModel);//同步新商品和修改商品 syncIncrementModifyGoods(dataBaseInfo, commentModel);
syncIncrementStock(dataBaseInfo, commentModel);//同步库存 syncIncrementStock(dataBaseInfo, commentModel);
syncFlowPrice(dataBaseInfo, commentModel,sycnTime);//同步调价单
break; break;
} }
@ -309,22 +317,6 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
return root; return root;
} }
/**
* 判断是否有新增商品有新增商品才同步分类
* @param dataBaseInfo
* @param refreshTime
* @return
*/
public boolean isNewShop(DataBaseInfo dataBaseInfo, String refreshTime){
String where="where b.status='1' ";
where+=" and ( b.modify_date>'"+refreshTime+"' ";
where+=" or b.build_date>'"+refreshTime+"') ";
dataBaseInfo.setWhere(where);
int total = sxDataDao.getTBditemInfoTotal(dataBaseInfo);
log.info("判断库存数量,库存数量:{}",total);
return total>0;
}
/** /**
*同步所有商品 *同步所有商品
* @param dataBaseInfo * @param dataBaseInfo
@ -332,59 +324,34 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
*/ */
private void syncAllGoods(DataBaseInfo dataBaseInfo, CommentModel commentModel){ private void syncAllGoods(DataBaseInfo dataBaseInfo, CommentModel commentModel){
//String where="where 1=1"; //String where="where 1=1";
String where="where shop.status='1'"; String where="where b.status='1'";
Integer total =0; Integer total =0;
boolean isAll=false;
String parentId=getAndCacheTree(dataBaseInfo,dataBaseInfo.getCategoryName());//加载缓存用的 String parentId=getAndCacheTree(dataBaseInfo,dataBaseInfo.getCategoryName());//加载缓存用的
String fileEndFix="";
if(DicEnum.SYNCTYPE_02.getCode().equals(dataBaseInfo.getSyncType())){ if(DicEnum.SYNCTYPE_02.getCode().equals(dataBaseInfo.getSyncType())){
if (StringUtils.isNotEmpty(dataBaseInfo.getCategoryName())) { if (StringUtils.isNotEmpty(dataBaseInfo.getCategoryName())) {
//syncGoodsSearchModel.setItemClsno(childrens); //syncGoodsSearchModel.setItemClsno(childrens);
String childrens= commonCache.get(CommonCache.CACHE_CATEGROY+parentId); String childrens= commonCache.get(CommonCache.CACHE_CATEGROY+parentId);
where += " and shop.item_clsno in ('" + childrens + "')"; where += " and b.item_clsno in ('" + childrens + "')";
fileEndFix="category";
} }
if(StringUtils.isNotEmpty(commentModel.getSyncTime())){ if(StringUtils.isNotEmpty(commentModel.getSyncTime())){
where+=" and shop.modify_date>'"+commentModel.getSyncTime()+"' "; where+=" and b.modify_date>'"+commentModel.getSyncTime()+"' ";
where+=" or shop.build_date>'"+commentModel.getSyncTime()+"' "; where+=" or b.build_date>'"+commentModel.getSyncTime()+"' ";
fileEndFix="modify";
} }
if(StringUtils.isNotEmpty(dataBaseInfo.getOperDate())){ if(StringUtils.isNotEmpty(dataBaseInfo.getOperDate())){
String stockOperateWhere=" ls.oper_date>'"+dataBaseInfo.getOperDate()+"' "; where+=" and ls.oper_date>'"+dataBaseInfo.getOperDate()+"' ";
dataBaseInfo.setStockOperateWhere(stockOperateWhere);
fileEndFix="operate";
}
if(StringUtils.isNotEmpty(dataBaseInfo.getPriceOperatime())){
where+=" and EXISTS ( " +
" select " +
" shop.item_no " +
" from " +
" t_pc_price_flow_detail tpfd " +
" left join t_pc_price_flow_master tppfm " +
" on " +
" tpfd.sheet_no = tppfm.sheet_no " +
" where " +
" tppfm.valid_flag = '1' " +//有效
" and shop.item_no=tpfd.item_no " +
" and tppfm.oper_date >'"+dataBaseInfo.getPriceOperatime()+"' " +
" )";
fileEndFix="price";
} }
dataBaseInfo.setWhere(where); dataBaseInfo.setWhere(where);
// 记录总数 // 记录总数
total = sxDataDao.getTBditemInfoJoninTotal(dataBaseInfo); total = sxDataDao.getTBditemInfoJoninTotal(dataBaseInfo);
}else { }else {
where="where b.status='1'";
isAll=true;
dataBaseInfo.setWhere(where); dataBaseInfo.setWhere(where);
total = sxDataDao.getTBditemInfoTotal(dataBaseInfo); total = sxDataDao.getTBditemInfoTotal(dataBaseInfo);
where="where shop.status='1'";
} }
if(total==0){ if(total==0){
log.info("暂无商品同步"); log.info("暂无商品同步");
return; return;
} }
//where+=" and"; where+=" and";
dataBaseInfo.setWhere(where); dataBaseInfo.setWhere(where);
// 总页数 // 总页数
@ -398,7 +365,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
Date refreshDate= DateUtil.date(tenMinutesAgo); Date refreshDate= DateUtil.date(tenMinutesAgo);
List<String> folders=new ArrayList<>(); List<String> folders=new ArrayList<>();
for (int i = 1; i <=pages; i++) { for (int i = 1; i <=pages; i++) {
List<SxSyncGoods> sxSyncGoods= sxDataDao.findBditemInfoListPage(dataBaseInfo,i,SxDataDao.PAGESIZE,isAll); List<SxSyncGoods> sxSyncGoods= sxDataDao.findBditemInfoListPage(dataBaseInfo,i,SxDataDao.PAGESIZE);
List<SxGoosModel> sxGoosModelList= CvtToGoosModel(sxSyncGoods,specPriceDtoList); List<SxGoosModel> sxGoosModelList= CvtToGoosModel(sxSyncGoods,specPriceDtoList);
String jsonString=""; String jsonString="";
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
@ -407,11 +374,11 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
String code= writeToFileAndUploud(i,jsonString,commentModel,DicEnum.MUAL_1.getCode(),fileEndFix); String code= writeToFileAndUploud(i,jsonString,commentModel,DicEnum.MUAL_1.getCode());
if (!HttpUtils.SUCCESSCODE.equals(code)) { if (!HttpUtils.SUCCESSCODE.equals(code)) {
continue; continue;
} }
folders.add(i+"_"+fileEndFix); folders.add(String.valueOf(i));
syncCount+=sxSyncGoods.size(); syncCount+=sxSyncGoods.size();
} }
//通知服务器上传cos //通知服务器上传cos
@ -421,7 +388,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
+"&syncType="+DicEnum.MUAL_1.getCode() +"&syncType="+DicEnum.MUAL_1.getCode()
+"&refreshDateStr="+refreshDate, +"&refreshDateStr="+refreshDate,
JSONUtil.parseArray(folders)); JSONUtil.parseArray(folders));
log.info("商品总共有{}条数据,同步完成{}条",total,syncCount); log.info("商品分类总共有{}条数据,同步完成{}条",total,syncCount);
String code= HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_GOODS_READ String code= HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_GOODS_READ
+"?appKey="+commentModel.getAppKey() +"?appKey="+commentModel.getAppKey()
+"&sign="+commentModel.getAppId() +"&sign="+commentModel.getAppId()
@ -441,15 +408,15 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
* @param commentModel * @param commentModel
* @return * @return
*/ */
private String writeToFileAndUploud(Integer page,String content,CommentModel commentModel,String syncType,String fileEndFix){ private String writeToFileAndUploud(Integer page,String content,CommentModel commentModel,String syncType){
FileUtils fileUtils= new FileUtils(); FileUtils fileUtils= new FileUtils();
File file=fileUtils.createFile(syncType,page); File file=fileUtils.createFile(syncType,page);
String fileName=fileUtils.getFileName(syncType,page,FileUtils.txtEnd,fileEndFix); String fileName=fileUtils.getFileName(syncType,page,FileUtils.txtEnd);
String filePath=file.getAbsolutePath(); String filePath=file.getAbsolutePath();
fileUtils.writeFile(filePath,fileName,content); fileUtils.writeFile(filePath,fileName,content);
String sign=CommonUtil.generateOpenSign(content,commentModel.getAppKey(),commentModel.getAppId()); String sign=CommonUtil.generateOpenSign(content,commentModel.getAppKey(),commentModel.getAppId());
commentModel.setSign(sign); commentModel.setSign(sign);
return webClientService.uploudSxData(filePath+FileUtils.pathSeparator+fileName,commentModel,page+"_"+fileEndFix,syncType); return webClientService.uploudSxData(filePath+FileUtils.pathSeparator+fileName,commentModel,page.toString(),syncType);
} }
/** /**
@ -491,17 +458,6 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
syncAllGoods(dataBaseInfo,commentModel); syncAllGoods(dataBaseInfo,commentModel);
} }
/**
* 增量同步 调价单变化
*/
private void syncFlowPrice(DataBaseInfo dataBaseInfo, CommentModel commentModel,String sycnTime){
dataBaseInfo.setPriceOperatime(sycnTime);
commentModel.setSyncTime("");
dataBaseInfo.setOperDate("");
dataBaseInfo.setStockOperateWhere("");
syncAllGoods(dataBaseInfo,commentModel);
}
/** /**
*获取特价商品 *获取特价商品
* @param dataBaseInfo * @param dataBaseInfo
@ -644,10 +600,10 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
log.info("文件下载目录: {}", downloadDirectory); log.info("文件下载目录: {}", downloadDirectory);
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
// headers.set("User-Agent", "Apifox/1.0.0 (https://apifox.com)"); // headers.set("User-Agent", "Apifox/1.0.0 (https://apifox.com)");
//headers.setAccept(Collections.singletonList(MediaType.ALL)); // 对应 */* headers.setAccept(Collections.singletonList(MediaType.ALL)); // 对应 */*
// headers.set("Accept-Encoding", "gzip, deflate, br"); headers.set("Accept-Encoding", "gzip, deflate, br");
// 可以添加其他Apifox可能发送的头部 // 可以添加其他Apifox可能发送的头部
// headers.set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8"); headers.set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8");
headers.set("Connection", "keep-alive"); headers.set("Connection", "keep-alive");
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(headers); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(headers);
@ -710,8 +666,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
log.error("文件下载失败:{}",e.getMessage()); log.error("文件下载失败:{}",e.getMessage());
return null; return null;
} }
File file=new File(downloadDirectory+originalFileName); return downloadDirectory+originalFileName;
return file.length()>0?downloadDirectory+originalFileName:null;
} }
@ -761,7 +716,6 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
DataBaseInfo dataBaseInfo=new DataBaseInfo(); DataBaseInfo dataBaseInfo=new DataBaseInfo();
if(null!=storeDbConfig){ if(null!=storeDbConfig){
dataBaseInfo.setIp(storeDbConfig.getDbIp()); dataBaseInfo.setIp(storeDbConfig.getDbIp());
dataBaseInfo.setUserName(storeDbConfig.getDbUsername());
dataBaseInfo.setPassword(storeDbConfig.getDbPassword()); dataBaseInfo.setPassword(storeDbConfig.getDbPassword());
dataBaseInfo.setDataBaseName(storeDbConfig.getDbName()); dataBaseInfo.setDataBaseName(storeDbConfig.getDbName());
dataBaseInfo.setDbPort(storeDbConfig.getDbPort()); dataBaseInfo.setDbPort(storeDbConfig.getDbPort());
@ -771,10 +725,6 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
dataBaseInfo.setRefreshTime(storeDbConfig.getRefreshTime()); dataBaseInfo.setRefreshTime(storeDbConfig.getRefreshTime());
dataBaseInfo.setIsTowSync(storeDbConfig.getIsTowSync()); dataBaseInfo.setIsTowSync(storeDbConfig.getIsTowSync());
dataBaseInfo.setShopGapTime(storeDbConfig.getShopGapTime()); dataBaseInfo.setShopGapTime(storeDbConfig.getShopGapTime());
dataBaseInfo.setSaleAccount(storeDbConfig.getSaleAccount());
dataBaseInfo.setIsSyncActive(storeDbConfig.getIsSyncActive());
dataBaseInfo.setIsSyncMember(storeDbConfig.getIsSyncMember());
dataBaseInfo.setClientVersion(storeDbConfig.getClientVersion());
return dataBaseInfo; return dataBaseInfo;
} }
return new DataBaseInfo(); return new DataBaseInfo();
@ -786,54 +736,31 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
log.info("不做双向同步数据库"); log.info("不做双向同步数据库");
return; return;
} }
String saleAccount= sxDataDao.getTRmCashier(dataBaseInfo,dataBaseInfo.getSaleAccount());
if(StringUtils.isEmpty(saleAccount)){
log.error("需要配置商城收银人员");
return;
}
JSONObject jsonObject= restTemplate.getForObject(remoteIp+HttpUtils.URL_SYNC_GET_STOR_DATA_RELEASE JSONObject jsonObject= restTemplate.getForObject(remoteIp+HttpUtils.URL_SYNC_GET_STOR_DATA_RELEASE
+"?appKey="+commentModel.getAppKey() +"?appKey="+commentModel.getAppKey()
+"&sign="+commentModel.getAppId(),JSONObject.class); +"&sign="+commentModel.getAppId(),JSONObject.class);
// String jsonStr="[{\"consumeId\":\"1986611923814223873\",\"orderId\":\"DD_20251107_1\",\"productNumber\":\"31011\",\"unitPrice\":10.90,\"quantity\":1.500,\"saleAmount\":16.35,\"status\":0,\"storeId\":78,\"createTime\":\"2025-11-07 01:49:26\",\"updateTime\":\"2025-11-07 01:49:26\"},{\"consumeId\":\"1986611923814223872\",\"orderId\":\"DD_20251107_2\",\"productNumber\":\"6909409023853\",\"unitPrice\":1.00,\"quantity\":1.000,\"saleAmount\":1.00,\"status\":0,\"storeId\":78,\"createTime\":\"2025-11-07 01:49:26\",\"updateTime\":\"2025-11-07 01:49:26\"},{\"consumeId\":\"1986611923814223874\",\"orderId\":\"DD_20251107_1\",\"productNumber\":\"6909409023853\",\"unitPrice\":1.00,\"quantity\":2.000,\"saleAmount\":2.00,\"status\":0,\"storeId\":78,\"createTime\":\"2025-11-07 01:49:26\",\"updateTime\":\"2025-11-07 01:49:26\"}]";
//String jsonObjectStr="{\"error_code\":0,\"error_msg\":\"success\",\"result\":[{\"consumeId\":\"1993254597656690689\",\"orderId\":\"DD_20251125_2\",\"productNumber\":\"10035\",\"unitPrice\":16.00,\"quantity\":-0.500,\"saleAmount\":8.00,\"status\":0,\"storeId\":78,\"createTime\":\"2025-11-25 09:45:03\",\"updateTime\":\"2025-11-25 09:45:03\",\"saleTime\":1764063651000},{\"consumeId\":\"1993254597656690688\",\"orderId\":\"DD_20251125_2\",\"productNumber\":\"6922896008127\",\"unitPrice\":8.80,\"quantity\":-1.000,\"saleAmount\":8.80,\"status\":0,\"storeId\":78,\"createTime\":\"2025-11-25 09:45:03\",\"updateTime\":\"2025-11-25 09:45:03\",\"saleTime\":1764063651000}]}";
// JSONObject jsonObject=JSONUtil.parseObj(jsonObjectStr);
if(null!=jsonObject.get("result")){ if(null!=jsonObject.get("result")){
// Map map=(Map)jsonObject.get("result"); // Map map=(Map)jsonObject.get("result");
String jsonStr= jsonObject.getStr("result");
List<ProductQuantityConsumptionDto> productQuantityConsumptionDtoList = List<ProductQuantityConsumptionDto> productQuantityConsumptionDtoList =
JSONUtil.toList(jsonStr,ProductQuantityConsumptionDto.class); JSONUtil.toList(jsonObject.getStr("result"),ProductQuantityConsumptionDto.class);
if(!productQuantityConsumptionDtoList.isEmpty()){ if(!productQuantityConsumptionDtoList.isEmpty()){
Map map = productQuantityConsumptionDtoList.stream() Map map = productQuantityConsumptionDtoList.stream()
.collect(Collectors.groupingBy( .collect(Collectors.groupingBy(
dto -> dto.getOrderId()+"-"+dto.getProductNumber(), ProductQuantityConsumptionDto::getProductNumber,
Collectors.reducing( Collectors.reducing(
BigDecimal.ZERO, BigDecimal.ZERO,
ProductQuantityConsumptionDto::getQuantity, ProductQuantityConsumptionDto::getQuantity,
BigDecimal::add BigDecimal::add
) )
)); ));
Map<String,ProductQuantityConsumptionDto> productQuantityConsumptionDtoMap=new HashMap<>(); sxDataDao.updateStoreData(dataBaseInfo,map,productQuantityConsumptionDtoList,commentModel);
productQuantityConsumptionDtoList.forEach(productQuantityConsumptionDto -> {
String key=productQuantityConsumptionDto.getOrderId()+"-"+productQuantityConsumptionDto.getProductNumber();
if(null!=productQuantityConsumptionDtoMap.get(key)){
ProductQuantityConsumptionDto oldProductQuantityConsumptionDto=productQuantityConsumptionDtoMap.get(key);
if(productQuantityConsumptionDto.getSaleTime()<oldProductQuantityConsumptionDto.getSaleTime()){
productQuantityConsumptionDtoMap.put(key,productQuantityConsumptionDto);
}
}else {
productQuantityConsumptionDtoMap.put(key,productQuantityConsumptionDto);
}
});
sxDataDao.updateStoreData(dataBaseInfo,map,productQuantityConsumptionDtoMap,productQuantityConsumptionDtoList,commentModel);
}else {
log.info("无线上流水同步");
} }
} }
} }
@Override @Override
public boolean syncAtive(DataBaseInfo dataBaseInfo, CommentModel commentModel) { public void syncAtive(DataBaseInfo dataBaseInfo, CommentModel commentModel) {
String where="where 1=1"; String where="where 1=1";
Integer total =0; Integer total =0;
if(StringUtils.isNotEmpty(commentModel.getSyncTime())){ if(StringUtils.isNotEmpty(commentModel.getSyncTime())){
@ -844,7 +771,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
total = sxDataDao.getNewActiveCount(dataBaseInfo); total = sxDataDao.getNewActiveCount(dataBaseInfo);
if(total==0){ if(total==0){
log.info("暂无活动同步"); log.info("暂无活动同步");
return false; return;
} }
// 总页数 // 总页数
int pages = CommonUtil.getPagesCount(total, SxDataDao.PAGESIZE); int pages = CommonUtil.getPagesCount(total, SxDataDao.PAGESIZE);
@ -869,7 +796,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
syncCount+=activeDtos.size(); syncCount+=activeDtos.size();
} }
log.info("成功同步活动数据:"+syncCount); log.info("成功同步活动数据:"+syncCount);
return true;
} }
@Override @Override
@ -877,16 +804,13 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
String where="where 1=1"; String where="where 1=1";
Integer total =0; Integer total =0;
if(StringUtils.isNotEmpty(commentModel.getSyncTime())){ if(StringUtils.isNotEmpty(commentModel.getSyncTime())){
where+=" and t.oper_date>'"+commentModel.getSyncTime()+"' "; where+=" and m.oper_date>'"+commentModel.getSyncTime()+"' ";
// where+=" or m.oper_date>'"+commentModel.getSyncTime()+"') "; // where+=" or m.oper_date>'"+commentModel.getSyncTime()+"') ";
} }
dataBaseInfo.setWhere(where); dataBaseInfo.setWhere(where);
total = sxDataDao.getTotalSpecShop(dataBaseInfo); total = sxDataDao.getTotalSpecShop(dataBaseInfo);
if(total==0){ if(total==0){
// HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_REFRESH
// +"?appKey="+commentModel.getAppKey()
// +"&sign="+commentModel.getAppId(), new JSONArray());
log.info("暂无活动商品同步"); log.info("暂无活动商品同步");
return; return;
} }
@ -914,9 +838,9 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
syncCount+=activeDtos.size(); syncCount+=activeDtos.size();
} }
log.info("成功同步活动商品数据:"+syncCount); log.info("成功同步活动商品数据:"+syncCount);
// HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_REFRESH HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_REFRESH
// +"?appKey="+commentModel.getAppKey() +"?appKey="+commentModel.getAppKey()
// +"&sign="+commentModel.getAppId(), new JSONArray()); +"&sign="+commentModel.getAppId(), new JSONArray());
} }
@ -930,12 +854,35 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
return map; return map;
} }
/**
* 创建跳过SSL验证的RestTemplate
* 仅用于测试环境生产环境不安全
*/
private RestTemplate createUnsafeRestTemplate() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
// 配置请求参数
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(30000)
.setSocketTimeout(30000)
.setRedirectsEnabled(true)
.setMaxRedirects(10)
.build();
@Override // 创建SSL上下文信任所有证书 - 仅测试环境使用
public void refreshTime(CommentModel commentModel) { SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_REFRESH .loadTrustMaterial((chain, authType) -> true)
+"?appKey="+commentModel.getAppKey() .build();
+"&sign="+commentModel.getAppId(), new JSONArray());
// 创建HttpClient配置SSL和重定向
CloseableHttpClient httpClient = HttpClients.custom()
.setDefaultRequestConfig(config)
.setSSLContext(sslContext)
.setRedirectStrategy(new LaxRedirectStrategy())
.build();
// 创建请求工厂
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient);
return new RestTemplate(factory);
} }
} }

View File

@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.util.Pair; import org.springframework.data.util.Pair;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -233,9 +234,9 @@ public class LoginController extends BaseControllerImpl {
return CommonResult.success(accountUserBaseService.doAppConnectLogin(bind_name, code)); return CommonResult.success(accountUserBaseService.doAppConnectLogin(bind_name, code));
} }
@ApiOperation(value = "商家(代理商)注册与登录") @ApiOperation(value = "商家注册与登录")
@RequestMapping(value = "/doMerchSmsRegisterAndLogin", method = RequestMethod.POST) @RequestMapping(value = "/doMerchSmsRegisterAndLogin", method = RequestMethod.POST)
public CommonResult doMerchSmsRegisterAndLogin(@RequestBody(required = false) JSONObject paramJSON) { public CommonResult doMerchSmsRegisterAndLogin(HttpServletRequest request, @RequestBody JSONObject paramJSON) {
if (paramJSON == null) { if (paramJSON == null) {
return CommonResult.failed("缺少必要参数!"); return CommonResult.failed("缺少必要参数!");
} }
@ -244,29 +245,21 @@ public class LoginController extends BaseControllerImpl {
String randKey = paramJSON.getStr("rand_key"); String randKey = paramJSON.getStr("rand_key");
String verifyCode = paramJSON.getStr("verify_code"); String verifyCode = paramJSON.getStr("verify_code");
if (StrUtil.hasBlank(userMobile, randKey, verifyCode)) { if (StrUtil.isBlank(userMobile) || StrUtil.isBlank(randKey) || StrUtil.isBlank(verifyCode)) {
return CommonResult.failed("缺少必要参数!"); return CommonResult.failed("缺少必要参数!");
} }
// 检查输入字符是否包含 SQL 注入特征 // 检查输入字符是不是包含 sql 注入特征如果包含不给以通过
if (!CommonService.isValidInput(userMobile, randKey, verifyCode)) { if (!CommonService.isValidInput(userMobile, randKey, verifyCode)) {
return CommonResult.failed(ResultCode.VALIDATE_INPUTS); return CommonResult.failed(ResultCode.VALIDATE_INPUTS);
} }
String cid = paramJSON.getStr("cid"); String cid = paramJSON.getStr("cid");
String osType = paramJSON.getStr("os_type"); String osType = paramJSON.getStr("os_type");
// 用户类型:0-普通买家; 1-管理员2-入驻商家3-代理商
Integer userType = paramJSON.getInt("user_type", CommonConstant.USER_TYPE_MCH);
// 修正逻辑当用户类型既不是商家也不是代理商时设置为默认商家类型
if (!CommonConstant.USER_TYPE_MCH.equals(userType) && !CommonConstant.USER_TYPE_AGENT.equals(userType)) {
userType = CommonConstant.USER_TYPE_MCH;
}
String inviteCode = paramJSON.getStr("invite_code", "");
return accountUserBaseService.doMerchSmsRegisterAndLogin(userMobile, randKey, verifyCode, userType, cid, osType, inviteCode); return accountUserBaseService.doMerchSmsRegisterAndLogin(userMobile, randKey, verifyCode, cid, osType);
} }
@ApiOperation(value = "微信用户一键登录与注册") @ApiOperation(value = "微信用户一键登录与注册")
@RequestMapping(value = "/doWxUserRegisterAndLogin", method = RequestMethod.POST) @RequestMapping(value = "/doWxUserRegisterAndLogin", method = RequestMethod.POST)
public CommonResult doWxUserRegisterAndLogin(@RequestBody WxUserInfoReq wxUserInfoReq) { public CommonResult doWxUserRegisterAndLogin(@RequestBody WxUserInfoReq wxUserInfoReq) {
@ -295,14 +288,10 @@ public class LoginController extends BaseControllerImpl {
@ApiOperation(value = "忘记密码-更改新密码") @ApiOperation(value = "忘记密码-更改新密码")
@RequestMapping(value = "/edit/forgetPassword", method = RequestMethod.POST) @RequestMapping(value = "/edit/forgetPassword", method = RequestMethod.POST)
public CommonResult editForgetPassword(@RequestBody JSONObject paramJSON) { public CommonResult editForgetPassword(@RequestBody JSONObject paramJSON) {
// TODO 这个方法肯定有问题待修改
return accountUserBaseService.doMerchSmsRegisterAndLogin(paramJSON.getStr("user_mobile"), return accountUserBaseService.doMerchSmsRegisterAndLogin(paramJSON.getStr("user_mobile"),
paramJSON.getStr("rand_key"), paramJSON.getStr("rand_key"),
paramJSON.getStr("verify_code"), paramJSON.getStr("verify_code"),
paramJSON.getInt("user_type"), paramJSON.getStr("cid"), paramJSON.getStr("os_type"));
paramJSON.getStr("cid"),
paramJSON.getStr("os_type"),
paramJSON.getStr("invite_code"));
} }
@ApiOperation("退出登录") @ApiOperation("退出登录")

View File

@ -11,7 +11,6 @@ import com.suisung.mall.common.utils.I18nUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -33,7 +32,6 @@ public class AccountBaseUserLevelController {
@Autowired @Autowired
private AccountBaseUserLevelService accountBaseUserLevelService; private AccountBaseUserLevelService accountBaseUserLevelService;
@Lazy
@Autowired @Autowired
private AccountService accountService; private AccountService accountService;

View File

@ -467,11 +467,6 @@ public class AccountController {
return accountUserBaseService.saveBatchAccountInfo(accountUserInfoList); return accountUserBaseService.saveBatchAccountInfo(accountUserInfoList);
} }
@RequestMapping(value = "/saveBatchAccountUserLogin", method = RequestMethod.POST)
public ThirdApiRes saveBatchAccountUserLogin(@RequestBody List<AccountUserLogin> accountUserLoginList) {
return accountUserBaseService.saveBatchAccountUserLogin(accountUserLoginList);
}
@RequestMapping(value = "/findOneAccountUserBase", method = RequestMethod.POST) @RequestMapping(value = "/findOneAccountUserBase", method = RequestMethod.POST)
public AccountUserBase findOneAccountUserBase(@RequestBody AccountUserBase accountUserBase) { public AccountUserBase findOneAccountUserBase(@RequestBody AccountUserBase accountUserBase) {
@ -494,9 +489,4 @@ public class AccountController {
return accountUserBindConnectService.getAllBindCount(bindTmpl); return accountUserBindConnectService.getAllBindCount(bindTmpl);
} }
@RequestMapping(value = "/updateBatchAccountUserBindConnect", method = RequestMethod.POST)
public ThirdApiRes updateBatchAccountUserBindConnect(@RequestBody List<AccountUserBindConnect> accountUserBindConnectList) {
return accountUserBindConnectService.updateBatchAccountUserBindConnect(accountUserBindConnectList);
}
} }

View File

@ -31,7 +31,6 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.util.Pair;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -232,17 +231,5 @@ public class AccountUserBaseController extends BaseControllerImpl {
return CommonResult.success(accountUserBaseService.logout()); return CommonResult.success(accountUserBaseService.logout());
} }
@ApiOperation("注册商家账号,项目之间远程调用")
@RequestMapping(value = "/merchant/inner-register", method = RequestMethod.POST)
public Pair<Boolean, String> merchantInnerRegister(@RequestParam("mobile") String mobile, @RequestParam("regPwd") String regPwd) {
return accountUserBaseService.merchantInnerRegister(mobile, regPwd);
}
@ApiOperation("更改分店商家的手机号(仅限于分店,尽量不要更高总店的手机号),项目之间远程调用")
@RequestMapping(value = "/change/merchant/login-mobile", method = RequestMethod.POST)
public Pair<Boolean, String> changeMerchantLoginMobile(@RequestParam("oldMobile") String oldMobile, @RequestParam("newMobile") String newMobile, @RequestParam("password") String password) {
return accountUserBaseService.changeMerchantLoginMobile(oldMobile, newMobile, password);
}
} }

View File

@ -85,17 +85,5 @@ public class AccountUserBindConnectController {
return accountUserBindConnectService.getUserBindConnectUserIdByCondition(bind_id, bind_type, user_type); return accountUserBindConnectService.getUserBindConnectUserIdByCondition(bind_id, bind_type, user_type);
} }
/**
* 检查手机注册的商家是否存在(仅供内部调用)
*
* @param mobile
* @return
*/
@ApiOperation(value = "检查手机注册的商家是否存在(仅供内部调用)", notes = "检查手机注册的商家是否存在(仅供内部调用)")
@RequestMapping(value = "/is-merchant-exists", method = RequestMethod.POST)
public Integer isMerchantExists(@RequestParam(name = "mobile") String mobile) {
return accountUserBindConnectService.isMerchantExists(mobile);
}
} }

View File

@ -1,11 +1,13 @@
package com.suisung.mall.account.controller.mobile; package com.suisung.mall.account.controller.mobile;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.suisung.mall.account.service.AccountUserBindConnectService; import com.suisung.mall.account.service.AccountUserBindConnectService;
import com.suisung.mall.account.service.WeiXinService; import com.suisung.mall.account.service.WeiXinService;
import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.service.impl.BaseControllerImpl; import com.suisung.mall.common.service.impl.BaseControllerImpl;
import com.suisung.mall.common.utils.I18nUtil; import com.suisung.mall.common.utils.I18nUtil;
import com.suisung.mall.common.utils.StringUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -158,12 +160,4 @@ public class WeiXinController extends BaseControllerImpl {
return "fail"; return "fail";
} }
@ApiOperation(value = "同意之后调用函数", notes = "小程序回调")
@RequestMapping(value = "/addPatAccountSendNumber")
public CommonResult addPatAccountSendNumber(@RequestParam(value = "storeId",defaultValue ="0") Integer storeId,
@RequestParam(value = "mobile") String mobile) {
accountUserBindConnectService.saveBindCountSendNumber(storeId,mobile);
return CommonResult.success();
}
} }

View File

@ -3,7 +3,6 @@ package com.suisung.mall.account.listener;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import com.suisung.mall.account.service.AccountUserInfoService; import com.suisung.mall.account.service.AccountUserInfoService;
import com.suisung.mall.account.service.ShopStoreMemberService;
import com.suisung.mall.common.constant.MqConstant; import com.suisung.mall.common.constant.MqConstant;
import com.suisung.mall.common.modules.account.AccountUserInfo; import com.suisung.mall.common.modules.account.AccountUserInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -12,8 +11,6 @@ import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -26,9 +23,6 @@ public class DealUserInfoListener {
@Autowired @Autowired
private AccountUserInfoService accountUserInfoService; private AccountUserInfoService accountUserInfoService;
@Autowired
private ShopStoreMemberService shopStoreMemberService;
@RabbitHandler @RabbitHandler
public void listener(byte[] data, Channel channel, Message message) throws IOException, InterruptedException { public void listener(byte[] data, Channel channel, Message message) throws IOException, InterruptedException {
// 将byte[]转换为String然后调用现有的处理逻辑 // 将byte[]转换为String然后调用现有的处理逻辑
@ -40,17 +34,10 @@ public class DealUserInfoListener {
public void listener(String data, Channel channel, Message message) throws IOException, InterruptedException { public void listener(String data, Channel channel, Message message) throws IOException, InterruptedException {
AccountUserInfo accountUserInfo = JSONUtil.toBean(data, AccountUserInfo.class); AccountUserInfo accountUserInfo = JSONUtil.toBean(data, AccountUserInfo.class);
// String messageId = message.getMessageProperties().getMessageId(); // String messageId = message.getMessageProperties().getMessageId();
log.info("MQ处理活动开始:accountUserInfo:{}", JSONUtil.toJsonStr(accountUserInfo));
// 设置模拟的请求上下文避免RequestContextHolder报错
ServletRequestAttributes reqAttr = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
RequestContextHolder.setRequestAttributes(reqAttr,true);
log.info("reqAttr{}", reqAttr);
try { try {
boolean flag = accountUserInfoService.saveOrUpdate(accountUserInfo); boolean flag = accountUserInfoService.saveOrUpdate(accountUserInfo);
if (flag) { if (flag) {
if(accountUserInfo.getStore_id()!=null){
shopStoreMemberService.dealStoreMember(accountUserInfo);
}
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
} else { } else {
log.error("消息消费失败执行dealUserInfo异常当前用户编号{}", accountUserInfo.getUser_id()); log.error("消息消费失败执行dealUserInfo异常当前用户编号{}", accountUserInfo.getUser_id());
@ -63,5 +50,4 @@ public class DealUserInfoListener {
Thread.sleep(1000); Thread.sleep(1000);
} }
} }
} }

View File

@ -3,9 +3,7 @@ package com.suisung.mall.account.listener;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import com.suisung.mall.account.service.AccountUserInfoService; import com.suisung.mall.account.service.AccountUserInfoService;
import com.suisung.mall.account.service.ShopStoreMemberLevelService;
import com.suisung.mall.common.constant.MqConstant; import com.suisung.mall.common.constant.MqConstant;
import com.suisung.mall.common.modules.store.ShopStoreMemberLevel;
import com.suisung.mall.common.pojo.to.UserLevelTO; import com.suisung.mall.common.pojo.to.UserLevelTO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
@ -25,9 +23,6 @@ public class UpgradeUserLevelListener {
@Autowired @Autowired
private AccountUserInfoService accountUserInfoService; private AccountUserInfoService accountUserInfoService;
@Autowired
private ShopStoreMemberLevelService shopStoreMemberLevelService;
@RabbitHandler @RabbitHandler
public void listener(byte[] data, Channel channel, Message message) throws IOException, InterruptedException { public void listener(byte[] data, Channel channel, Message message) throws IOException, InterruptedException {
// 将byte[]转换为String然后调用现有的处理逻辑 // 将byte[]转换为String然后调用现有的处理逻辑
@ -43,11 +38,6 @@ public class UpgradeUserLevelListener {
try { try {
boolean flag = accountUserInfoService.checkUpdateUserLevel(userLevelTO.getUser_id(), userLevelTO.getUser_exp_total(), userLevelTO.getUser_fans_total(), userLevelTO.getUser_spend_total(), 0, 0, 0); boolean flag = accountUserInfoService.checkUpdateUserLevel(userLevelTO.getUser_id(), userLevelTO.getUser_exp_total(), userLevelTO.getUser_fans_total(), userLevelTO.getUser_spend_total(), 0, 0, 0);
if (flag) { if (flag) {
ShopStoreMemberLevel shopStoreMemberLevel = new ShopStoreMemberLevel();
shopStoreMemberLevel.setUserLevelSpend(userLevelTO.getUser_store_spend_total());
shopStoreMemberLevel.setUserId(userLevelTO.getUser_id());
shopStoreMemberLevel.setStoreId(userLevelTO.getStore_id());
shopStoreMemberLevelService.checkUpdateStoreUserLevel(shopStoreMemberLevel);//店铺会员升级
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
} else { } else {
log.error("消息消费失败执行upgradeUserLevel异常当前用户编号{}", userLevelTO.getUser_id()); log.error("消息消费失败执行upgradeUserLevel异常当前用户编号{}", userLevelTO.getUser_id());

View File

@ -1,9 +0,0 @@
package com.suisung.mall.account.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suisung.mall.common.modules.store.ShopStoreMemberLevel;
import org.springframework.stereotype.Component;
@Component
public interface ShopStoreMemberLevelMapper extends BaseMapper<ShopStoreMemberLevel> {
}

View File

@ -1,9 +0,0 @@
package com.suisung.mall.account.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suisung.mall.common.modules.store.ShopStoreMember;
import org.springframework.stereotype.Repository;
@Repository
public interface ShopStoreMemberMapper extends BaseMapper<ShopStoreMember> {
}

View File

@ -4,7 +4,6 @@ import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.domain.UserDto; import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.modules.account.AccountUserBase; import com.suisung.mall.common.modules.account.AccountUserBase;
import com.suisung.mall.common.modules.account.AccountUserInfo; import com.suisung.mall.common.modules.account.AccountUserInfo;
import com.suisung.mall.common.modules.account.AccountUserLogin;
import com.suisung.mall.common.pojo.req.WxUserInfoReq; import com.suisung.mall.common.pojo.req.WxUserInfoReq;
import com.suisung.mall.common.pojo.res.ThirdApiRes; import com.suisung.mall.common.pojo.res.ThirdApiRes;
import com.suisung.mall.core.web.service.IBaseService; import com.suisung.mall.core.web.service.IBaseService;
@ -142,13 +141,11 @@ public interface AccountUserBaseService extends IBaseService<AccountUserBase> {
* @param user_mobile * @param user_mobile
* @param rand_key 防机器人刷验证码 * @param rand_key 防机器人刷验证码
* @param verify_code * @param verify_code
* @param userType 用户类型:0-普通买家; 1-管理员2-入驻商家3-代理商
* @param cid 推送 cid * @param cid 推送 cid
* @param osType 手机系统类型 1-Android2-iOS3-微信小程序 * @param osType 手机系统类型 1-Android2-iOS3-微信小程序
* @param inviteCode 代理商邀请码
* @return * @return
*/ */
CommonResult doMerchSmsRegisterAndLogin(String user_mobile, String rand_key, String verify_code, Integer userType, String cid, String osType, String inviteCode); CommonResult doMerchSmsRegisterAndLogin(String user_mobile, String rand_key, String verify_code, String cid, String osType);
/** /**
* 微信小程序一键登录注册接口 * 微信小程序一键登录注册接口
@ -299,30 +296,4 @@ public interface AccountUserBaseService extends IBaseService<AccountUserBase> {
* @return * @return
*/ */
ThirdApiRes saveBatchAccountInfo(List<AccountUserInfo> accountUserInfoList); ThirdApiRes saveBatchAccountInfo(List<AccountUserInfo> accountUserInfoList);
/**
* 商家内部注册服务之间调用
*
* @param mobile 商家手机号
* @param regPwd 注册密码
* @return Pair<Boolean, String> 第一个元素表示是否成功第二个元素表示提示信息
*/
Pair<Boolean, String> merchantInnerRegister(String mobile, String regPwd);
/**
* 更改分店商家的手机号(仅限于分店尽量不要更改总店的手机号)项目之间远程调用
*
* @param oldMobile 老的手机号
* @param newMobile 新的手机号
* @param password 新的登录密码可选
* @return Pair<Boolean, String> 操作结果和提示信息true表示成功false表示失败
*/
Pair<Boolean, String> changeMerchantLoginMobile(String oldMobile, String newMobile, String password);
/**
* 批量保存accountInfo
*
* @return
*/
ThirdApiRes saveBatchAccountUserLogin(List<AccountUserLogin> accountUserLoginList);
} }

View File

@ -3,9 +3,7 @@ package com.suisung.mall.account.service;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.suisung.mall.common.modules.account.AccountUserBindConnect; import com.suisung.mall.common.modules.account.AccountUserBindConnect;
import com.suisung.mall.common.pojo.req.WxUserInfoReq; import com.suisung.mall.common.pojo.req.WxUserInfoReq;
import com.suisung.mall.common.pojo.res.ThirdApiRes;
import com.suisung.mall.core.web.service.IBaseService; import com.suisung.mall.core.web.service.IBaseService;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -87,33 +85,13 @@ public interface AccountUserBindConnectService extends IBaseService<AccountUserB
* @param bindType * @param bindType
* @param userId * @param userId
* @param userType * @param userType
* @param inviteCode
* @return * @return
*/ */
AccountUserBindConnect initAccountUserBindConnect(String bindId, Integer bindType, Integer userId, Integer userType, String inviteCode); AccountUserBindConnect initAccountUserBindConnect(String bindId, Integer bindType, Integer userId, Integer userType);
List<AccountUserBindConnect> getAllBindPage(String bindTmpl, Integer pageNum, Integer pageSize); List<AccountUserBindConnect> getAllBindPage(String bindTmpl,Integer pageNum, Integer pageSize);
long getAllBindCount(String bindTmpl); long getAllBindCount(String bindTmpl);
void bindTmplId(JSONObject jsonObject); void bindTmplId(JSONObject jsonObject);
/**
* 检查手机注册的商家是否存在
*
* @param mobile
* @return 1-存在2-不存在3-参数有误
*/
Integer isMerchantExists(String mobile);
void saveBindCountSendNumber(Integer storeId, String mobile);
/**
* 批量保存accountUserBindConnect
*
* @return
*/
ThirdApiRes updateBatchAccountUserBindConnect(List<AccountUserBindConnect> accountUserBindConnectList);
List<AccountUserBindConnect> getAllBindList(AccountUserBindConnect accountUserBindConnect);
} }

View File

@ -1,10 +0,0 @@
package com.suisung.mall.account.service;
import com.suisung.mall.common.modules.store.ShopStoreMemberLevel;
public interface ShopStoreMemberLevelService {
void checkUpdateStoreUserLevel(ShopStoreMemberLevel shopStoreMemberLevel);
}

View File

@ -1,10 +0,0 @@
package com.suisung.mall.account.service;
import com.suisung.mall.common.modules.account.AccountUserInfo;
public interface ShopStoreMemberService {
void dealStoreMember(AccountUserInfo accountUserInfo);
}

View File

@ -50,9 +50,6 @@ import com.suisung.mall.common.modules.distribution.ShopDistributionUser;
import com.suisung.mall.common.modules.distribution.ShopDistributionUserCommission; import com.suisung.mall.common.modules.distribution.ShopDistributionUserCommission;
import com.suisung.mall.common.modules.pay.PayUserResource; import com.suisung.mall.common.modules.pay.PayUserResource;
import com.suisung.mall.common.modules.plantform.ShopPlantformSubsiteUser; import com.suisung.mall.common.modules.plantform.ShopPlantformSubsiteUser;
import com.suisung.mall.common.modules.store.ShopStoreBase;
import com.suisung.mall.common.modules.store.ShopStoreMember;
import com.suisung.mall.common.modules.store.ShopStoreMemberLevel;
import com.suisung.mall.common.pojo.dto.SmsDto; import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.pojo.req.WxUserInfoReq; import com.suisung.mall.common.pojo.req.WxUserInfoReq;
import com.suisung.mall.common.pojo.res.ThirdApiRes; import com.suisung.mall.common.pojo.res.ThirdApiRes;
@ -70,7 +67,6 @@ import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.util.Pair; import org.springframework.data.util.Pair;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -101,7 +97,7 @@ import static com.suisung.mall.common.utils.I18nUtil._;
@Service @Service
public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseMapper, AccountUserBase> implements AccountUserBaseService { public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseMapper, AccountUserBase> implements AccountUserBaseService {
private final String VERIFY_CODE_KEY = RedisConstant.VERIFY_CODE_KEY; //"register:verifyCode:"; private final String VERIFY_CODE_KEY = "register:verifyCode:";
private final Logger logger = LoggerFactory.getLogger(AccountUserBaseServiceImpl.class); private final Logger logger = LoggerFactory.getLogger(AccountUserBaseServiceImpl.class);
@Autowired @Autowired
private AuthService authService; private AuthService authService;
@ -111,8 +107,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
private SnsService snsService; private SnsService snsService;
@Autowired @Autowired
private HttpServletRequest request; private HttpServletRequest request;
@Lazy
@Autowired @Autowired
private ShopService shopService; private ShopService shopService;
@Autowired @Autowired
@ -208,7 +202,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
data.put("key", token); data.put("key", token);
data.put("rid", rid); // 用户角色 rid0-用户;2-商家;3-门店;9-平台; data.put("rid", rid); // 用户角色 rid0-用户;2-商家;3-门店;9-平台;
//user_type 用户类型对应user_base user_is_admin0-普通用户1-管理员2-入驻商家3-代理商 //user_type 用户类型对应user_base is_admin0-普通用户1-管理员2-入驻商家
String as = bindConnectService.getBind(user_id, BindCode.MOBILE, userDto.getUserType()) == null ? "0" : "1"; String as = bindConnectService.getBind(user_id, BindCode.MOBILE, userDto.getUserType()) == null ? "0" : "1";
data.put("as", as); // 是否绑定了手机号 0- 1- data.put("as", as); // 是否绑定了手机号 0- 1-
CookieUtils.setCookie("as", as); CookieUtils.setCookie("as", as);
@ -255,7 +249,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
public Map<String, Object> getUserInfo(Integer user_id) { public Map<String, Object> getUserInfo(Integer user_id) {
QueryWrapper<AccountUserBase> queryWrapper = new QueryWrapper<>(); QueryWrapper<AccountUserBase> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", user_id).select(AccountUserBase.class, info -> !info.getColumn().equals("user_password")); queryWrapper.eq("user_id", user_id).select(AccountUserBase.class, info -> !info.getColumn().equals("user_password"));
AccountUserBase accountUserBase = getOne(queryWrapper, false); AccountUserBase accountUserBase = getOne(queryWrapper);
setIdentityByUser(accountUserBase); setIdentityByUser(accountUserBase);
AccountUserInfo userInfo = accountUserInfoService.get(user_id); AccountUserInfo userInfo = accountUserInfoService.get(user_id);
@ -296,16 +290,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
adminMap.put("user_level_rate", baseUserLevel.getUser_level_rate()); adminMap.put("user_level_rate", baseUserLevel.getUser_level_rate());
} }
String inviteCode = "";
if (CommonConstant.USER_TYPE_AGENT.equals(accountUserBase.getUser_is_admin())) {
AccountUserBindConnect bindConnect = accountUserBindConnectService.getBindByUserId(user_id, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
if (bindConnect != null && StrUtil.isNotBlank(bindConnect.getInvite_code())) {
inviteCode = bindConnect.getInvite_code();
}
}
// 代理商邀请码
adminMap.put("invite_code", inviteCode);
return adminMap; return adminMap;
} }
@ -1691,11 +1675,10 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
String verifyCode = (String) userInfo.get("verify_code"); String verifyCode = (String) userInfo.get("verify_code");
String verify_token = (String) userInfo.get("verify_token"); String verify_token = (String) userInfo.get("verify_token");
String rand_key = (String) userInfo.get("rand_key"); String rand_key = (String) userInfo.get("rand_key");
Integer userIsAdmin = Convert.toInt(userInfo.getOrDefault("user_is_admin", CommonConstant.USER_TYPE_NORMAL)); // 用户类型:0-普通买家; 1-管理员2-入驻商家3-代理商 Integer userIsAdmin = Convert.toInt(userInfo.getOrDefault("user_is_admin", CommonConstant.USER_TYPE_NORMAL)); // 用户类型:0-普通买家; 1-管理员2-入驻商家
Integer userType = userIsAdmin; // 用户类型:0-普通买家; 1-管理员2-入驻商家3-代理商 Integer userType = userIsAdmin; // 用户身份:0-普通买家; 1-管理员2-入驻商家
String user_email = (String) userInfo.get("user_email"); String user_email = (String) userInfo.get("user_email");
Integer bind_type = getParameter("bind_type", BindCode.MOBILE); Integer bind_type = getParameter("bind_type", BindCode.MOBILE);
String inviteCode = Convert.toStr("invite_code", "");
if (StrUtil.isBlank(user_account)) { if (StrUtil.isBlank(user_account)) {
throw new ApiException(_("请输入账号")); throw new ApiException(_("请输入账号"));
@ -1730,7 +1713,10 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
throw new ApiException(_("账号已存在,请用另一账号名注册!")); throw new ApiException(_("账号已存在,请用另一账号名注册!"));
} }
// 有手机参数优先手机注册 // 有手机参数优先手机注册
// if ((StrUtil.isNotBlank(user_mobile))
// || (CheckUtil.isMobile(user_account, user_intl) && StrUtil.equals(user_account, user_mobile))) {
if (StrUtil.isNotBlank(user_mobile) && CheckUtil.isMobile(user_mobile, user_intl)) { if (StrUtil.isNotBlank(user_mobile) && CheckUtil.isMobile(user_mobile, user_intl)) {
if (StrUtil.isNotBlank(rand_key) && StrUtil.isNotBlank(verifyCode)) { if (StrUtil.isNotBlank(rand_key) && StrUtil.isNotBlank(verifyCode)) {
@ -1810,12 +1796,12 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
if (user_base_row != null) { if (user_base_row != null) {
// 检测到 account_user_base 用户已经存在是因为账号没有绑定这时绑定账号即可 // 检测到 account_user_base 用户已经存在是因为账号没有绑定这时绑定账号即可
// 绑定基本关系 // 绑定基本关系
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.initAccountUserBindConnect(user_mobile, bind_type, user_base_row.getUser_id(), userIsAdmin, inviteCode); AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.initAccountUserBindConnect(user_mobile, bind_type, user_base_row.getUser_id(), userIsAdmin);
if (accountUserBindConnect == null) { if (accountUserBindConnect == null) {
throw new ApiException(_("绑定账号失败")); throw new ApiException(_("绑定账号失败"));
} }
return user_base_row; return user_base_row;
// throw new ApiException(_("用户已经存在,请更换用户名"));
} else { } else {
// 检测到用户尚未注册立即新增用户基本信息和用户附加信息 // 检测到用户尚未注册立即新增用户基本信息和用户附加信息
String user_nickname = Convert.toStr(userInfo.get("user_nickname"), user_account); String user_nickname = Convert.toStr(userInfo.get("user_nickname"), user_account);
@ -1830,6 +1816,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
// 密码加盐加密 // 密码加盐加密
user_password = SecureUtil.md5(user_salt + SecureUtil.md5(user_password)); user_password = SecureUtil.md5(user_salt + SecureUtil.md5(user_password));
user_base_reg_row.setUser_password(user_password); user_base_reg_row.setUser_password(user_password);
// user_base_reg_row.setUser_password((BCrypt.hashpw(user_password)));
user_base_reg_row.setUser_nickname(user_nickname); user_base_reg_row.setUser_nickname(user_nickname);
user_base_reg_row.setUser_state(user_state); user_base_reg_row.setUser_state(user_state);
user_base_reg_row.setUser_key(user_key); user_base_reg_row.setUser_key(user_key);
@ -1894,7 +1881,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
if (addUserBindConnect) { if (addUserBindConnect) {
// 初始化绑用户定关系 // 初始化绑用户定关系
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.initAccountUserBindConnect(user_mobile, bind_type, user_id, userIsAdmin, inviteCode); AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.initAccountUserBindConnect(user_mobile, bind_type, user_id, userIsAdmin);
if (accountUserBindConnect == null) { if (accountUserBindConnect == null) {
throw new ApiException(_("绑定账号失败")); throw new ApiException(_("绑定账号失败"));
} }
@ -1913,17 +1900,16 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
throw new ApiException(ResultCode.FAILED); throw new ApiException(ResultCode.FAILED);
} }
// 远程调用异常忽略掉 // 远程调用异常忽略掉
try { try {
// User_Resource初始化 用户积分 // User_Resource初始化 用户积分
if (!payService.initUserPoints(user_id)) { if (!payService.initUserPoints(user_id)) {
log.error("初始化用户积分失败");
// throw new ApiException(ResultCode.FAILED); // throw new ApiException(ResultCode.FAILED);
} }
// 初始化用户经验表 // 初始化用户经验表
if (!accountUserInfoService.initUserExperience(user_id)) { if (!accountUserInfoService.initUserExperience(user_id)) {
log.error("初始化用户经验表失败");
// throw new ApiException(ResultCode.FAILED); // throw new ApiException(ResultCode.FAILED);
} }
@ -1939,6 +1925,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
addSourceUserId(user_id, user_parent_id); addSourceUserId(user_id, user_parent_id);
} }
//todo 分享券
// 分享券活动id // 分享券活动id
Integer activityId = Convert.toInt(getParameter("activity_id")); Integer activityId = Convert.toInt(getParameter("activity_id"));
if (CheckUtil.isEmpty(activityId) && CheckUtil.isNotEmpty(activity_id)) { if (CheckUtil.isEmpty(activityId) && CheckUtil.isNotEmpty(activity_id)) {
@ -1963,10 +1950,10 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
} }
if (StrUtil.isNotBlank(user_mobile) && userIsAdmin.equals(CommonConstant.USER_TYPE_MCH)) { if (StrUtil.isNotBlank(user_mobile) && userIsAdmin.equals(CommonConstant.USER_TYPE_MCH)) {
// 如果是商家首次注册 恭喜您成功注册了商家账号您的初始密码为${password}密码可登录商家 APP登录后请尽快修改密码 // 如果是商家首次注册 SMS_481085172 发送短信通知用户告知用户随机密码您已成功注册密码${password}密码可用于登录商家APP登录后请尽快修改密码
Map<String, Object> smsArgs = new HashMap<>(); Map<String, Object> smsArgs = new HashMap<>();
smsArgs.put("password", user_password_src); smsArgs.put("password", user_password_src);
sendSmsMessage(PhoneNumberUtils.cleanPhoneNumber(user_mobile), "SMS_496910525", smsArgs); sendSmsMessage(PhoneNumberUtils.cleanPhoneNumber(user_mobile), "SMS_481085172", smsArgs);
} }
//初次注册发送消息 //初次注册发送消息
@ -2969,45 +2956,47 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
* @param user_mobile * @param user_mobile
* @param rand_key 防机器人刷验证码 * @param rand_key 防机器人刷验证码
* @param verify_code * @param verify_code
* @param userType 用户类型:0-普通买家; 1-管理员2-入驻商家3-代理商
* @param cid 推送 cid * @param cid 推送 cid
* @param osType 手机系统类型 1-Android2-iOS3-微信小程序 * @param osType 手机系统类型 1-Android2-iOS3-微信小程序
* @param inviteCode 代理商邀请码
* @return * @return
*/ */
@Override @Override
public CommonResult doMerchSmsRegisterAndLogin(String user_mobile, String rand_key, String verify_code, public CommonResult doMerchSmsRegisterAndLogin(String user_mobile, String rand_key, String verify_code, String cid, String osType) {
Integer userType, String cid, String osType, String inviteCode) { // 流程通过手机号检查是否有绑定关系没有就直接注册有就直接登录返回登录后的所有信息附加是否已经申请入驻标记
// 参数验证 // 商家入驻账号都是需要手机号绑定的账号组成1000000+(数字加法)自增ID密码随机6位数
if (StrUtil.hasBlank(user_mobile, rand_key, verify_code)) { if (StrUtil.isBlank(user_mobile) || StrUtil.isBlank(verify_code)) {
return CommonResult.failed(_("缺少必要参数!")); return CommonResult.failed(_("缺少必要参数!"));
} }
// 验证手机号格式
if (!PhoneNumberUtils.checkPhoneNumber(user_mobile)) { if (!PhoneNumberUtils.checkPhoneNumber(user_mobile)) {
return CommonResult.failed(_("请输入正确的手机号!")); return CommonResult.failed(_("请输入正确的手机号!"));
} }
// 验证防刷机制 if (StrUtil.isBlank(rand_key)) {
if (!ObjectUtil.equal(user_mobile, rand_key)) { return CommonResult.failed(_("程序非法请求, 检测验证码键值!"));
return CommonResult.failed(_("非法数据,请刷新页面重新提交!")); }
if (StrUtil.isBlank(verify_code)) {
return CommonResult.failed(_("请输入验证码!"));
}
// rmk 为什么随机数和手机号一致
if (ObjectUtil.notEqual(user_mobile, rand_key)) {
return CommonResult.failed(_("非法数据,或者提交超时,请刷新页面重新提交!"));
} }
String verifyMobile = PhoneNumberUtils.convZhPhoneNumber(user_mobile); String verifyMobile = PhoneNumberUtils.convZhPhoneNumber(user_mobile);
// TODO 短信验证码切换到正式平台,记得注释 9999
// 验证验证码 (TODO 短信验证码切换到正式平台,记得注释 9999)
if (!checkVerifyCode(verifyMobile, verify_code)) { if (!checkVerifyCode(verifyMobile, verify_code)) {
// 短信验证码
return CommonResult.failed(_("验证码错误!")); return CommonResult.failed(_("验证码错误!"));
} }
// 设置默认用户类型 // 找出手机对应的绑定用户
userType = ObjectUtil.defaultIfNull(userType, CommonConstant.USER_TYPE_MCH); // 是否为手机号注册密码6位随机数
return doMobileBindLogin(verifyMobile, CommonConstant.USER_TYPE_MCH, cid, osType);
// 找出手机对应的绑定用户进行绑定登录
return doMobileBindLogin(verifyMobile, userType, cid, osType, inviteCode);
} }
/** /**
* 微信小程序一键登录注册接口 * 微信小程序一键登录注册接口
* *
@ -3042,7 +3031,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
String mobile = PhoneNumberUtils.convWithIDDCodePhoneNumber(wxUserInfoReq.getPhoneNumber(), iddCode); String mobile = PhoneNumberUtils.convWithIDDCodePhoneNumber(wxUserInfoReq.getPhoneNumber(), iddCode);
AccountUserBase accountUserBase = getByAccountAndType(mobile, CommonConstant.USER_TYPE_NORMAL); AccountUserBase accountUserBase = getByAccountAndType(mobile, CommonConstant.USER_TYPE_NORMAL);
Integer userId = 0;
if (accountUserBase == null) { if (accountUserBase == null) {
// 检测到用户尚未注册立即新增用户基本信息和用户附加信息 // 检测到用户尚未注册立即新增用户基本信息和用户附加信息
Date today = new Date(); Date today = new Date();
@ -3075,7 +3063,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
return CommonResult.failed(_("微信注册账号失败!")); return CommonResult.failed(_("微信注册账号失败!"));
} }
userId = accountUserBase.getUser_id(); Integer userId = accountUserBase.getUser_id();
AccountUserLogin user_login_reg_row = new AccountUserLogin(); AccountUserLogin user_login_reg_row = new AccountUserLogin();
user_login_reg_row.setUser_id(userId); user_login_reg_row.setUser_id(userId);
@ -3157,36 +3145,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
args.put("register_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(today)); args.put("register_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(today));
messageService.sendNoticeMsg(userId, 0, message_id, args); messageService.sendNoticeMsg(userId, 0, message_id, args);
} else {
userId = accountUserBase.getUser_id();
}
//店铺会员如果从店铺进去 则生成店铺会员需要传入店铺id
if (com.suisung.mall.common.utils.StringUtils.isNotEmpty(wxUserInfoReq.getStoreId())) {
ShopStoreMember params = new ShopStoreMember();
params.setUserId(accountUserBase.getUser_id());
params.setStoreId(Convert.toInt(wxUserInfoReq.getStoreId()));
List<ShopStoreMember> shopStoreMembers = shopService.findShopStoreMemberList(params);
ShopStoreBase shopStoreBase = shopService.getShopStoreBase(Convert.toInt(wxUserInfoReq.getStoreId()));
if (shopStoreMembers.isEmpty() && shopStoreBase != null) {
ShopStoreMember shopStoreMember = new ShopStoreMember();
shopStoreMember.setStoreName(shopStoreBase.getStore_name());
shopStoreMember.setStoreId(shopStoreBase.getStore_id());
shopStoreMember.setUserId(userId);
shopStoreMember.setBind_openid(wxUserInfoReq.getOpenId());
shopStoreMember.setUserNickname(accountUserBase.getUser_nickname());
shopStoreMember.setUserAccount(accountUserBase.getUser_account());
ShopStoreMember saveShopStoreMember = shopService.saveShopStoreMember(shopStoreMember);
ShopStoreMemberLevel shopStoreMemberLevel = getShopStoreMemberLevel(shopStoreBase, saveShopStoreMember);
shopStoreMemberLevel.setUserId(userId);
shopService.saveShopStoreMemberLevel(shopStoreMemberLevel);
} else {
ShopStoreMember updateShopStoreMember = shopStoreMembers.get(0);
if (com.suisung.mall.common.utils.StringUtils.isNotEmpty(updateShopStoreMember.getBind_openid())) {
updateShopStoreMember.setBind_openid(wxUserInfoReq.getOpenId());
shopService.saveShopStoreMember(updateShopStoreMember);
}
}
} }
// accountUserBase == null 的情况 // accountUserBase == null 的情况
@ -3213,17 +3171,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
return login(params); return login(params);
} }
private ShopStoreMemberLevel getShopStoreMemberLevel(ShopStoreBase shopStoreBase, ShopStoreMember shopStoreMember) {
ShopStoreMemberLevel shopStoreMemberLevel = new ShopStoreMemberLevel();
shopStoreMemberLevel.setStoreId(shopStoreBase.getStore_id());
shopStoreMemberLevel.setStoreMemberId(shopStoreMember.getStore_member_id());
shopStoreMemberLevel.setUserLevelName("v1");
shopStoreMemberLevel.setUserLevelId(1001);
shopStoreMemberLevel.setMemberLevelId(1001);
shopStoreMemberLevel.setMemberLevelName("v1");
return shopStoreMemberLevel;
}
/** /**
* 手机号登陆操作 * 手机号登陆操作
@ -3268,67 +3215,50 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
* 商家版app入驻商家手机号绑定登录 * 商家版app入驻商家手机号绑定登录
* *
* @param user_mobile +86的中国号码 * @param user_mobile +86的中国号码
* @param userType 用户类型0-普通用户1-管理员2-入驻商户3-代理商 * @param userType 用户类型0-普通用户1-管理员2-入驻商户
* @param cid 推送 cid * @param cid 推送 cid
* @param osType 手机系统类型 1-Android2-iOS3-微信小程序 * @param osType 手机系统类型 1-Android2-iOS3-微信小程序
* @param inviteCode 代理商的邀请码商家注册时才用
* @return * @return
*/ */
public CommonResult doMobileBindLogin(String user_mobile, Integer userType, String cid, String osType, String inviteCode) { public CommonResult doMobileBindLogin(String user_mobile, Integer userType, String cid, String osType) {
return doMobileBindLogin(user_mobile, "", userType, cid, osType, inviteCode);
}
/**
* 商家版app入驻商家手机号绑定登录
*
* @param user_mobile
* @param regPwd 注册用途
* @param userType 用户类型:0-普通买家; 1-管理员2-入驻商家3-代理商
* @param cid
* @param osType
* @return
*/
public CommonResult doMobileBindLogin(String user_mobile, String regPwd, Integer userType, String cid, String osType, String inviteCode) {
if (StrUtil.isBlank(user_mobile) || userType == null) { if (StrUtil.isBlank(user_mobile) || userType == null) {
return CommonResult.failed("缺少必要参数!"); return CommonResult.failed("缺少必要参数!");
} }
// 检查输入字符是否包含 SQL 注入特征 // 检查输入字符是不是包含 sql 注入特征如果包含不给以通过
if (!CommonService.isValidInput(user_mobile, cid, osType)) { if (!CommonService.isValidInput(user_mobile, cid, osType)) {
return CommonResult.failed(ResultCode.VALIDATE_INPUTS); return CommonResult.failed(ResultCode.VALIDATE_INPUTS);
} }
AccountUserBase accountUserBase;
// 查询绑定手机的商家账号 // 查询绑定手机的商家账号
AccountUserBindConnect bind_row = accountUserBindConnectService.getBindByBindId(user_mobile, BindCode.MOBILE, userType); AccountUserBindConnect bind_row = accountUserBindConnectService.getBindByBindId(user_mobile, BindCode.MOBILE, userType);
AccountUserBase accountUserBase;
if (bind_row != null) { if (bind_row != null) {
// 绑定账号的情况 // 已经注册账号的绑定了手机的情况
Integer user_id = bind_row.getUser_id(); Integer user_id = bind_row.getUser_id();
accountUserBase = get(user_id); accountUserBase = get(user_id);
if (accountUserBase == null) { if (accountUserBase == null) {
return CommonResult.failed("获取不到用户信息!"); return CommonResult.failed("获取不到用户信息!");
} }
} else { } else {
// 手机号码未绑定注册新账号 // 手机号码未绑定的情况直接去注册一个账号
Map<String, Object> userInfo = new HashMap<>(); Map<String, Object> userInfo = new HashMap<>();
userInfo.put("user_account", user_mobile); userInfo.put("user_account", user_mobile);
userInfo.put("user_mobile", user_mobile); userInfo.put("user_mobile", user_mobile);
userInfo.put("user_is_admin", userType); // 商家或代理商入驻注册 userInfo.put("user_is_admin", userType); // 商家入驻注册
// 随机数明文密码
String user_password = StrUtil.isNotBlank(regPwd) ? regPwd : String user_password = com.suisung.mall.common.utils.StringUtils.random(6, com.suisung.mall.common.utils.StringUtils.RandomType.STRING);
com.suisung.mall.common.utils.StringUtils.random(6, com.suisung.mall.common.utils.StringUtils.RandomType.STRING);
userInfo.put("user_password", user_password); userInfo.put("user_password", user_password);
userInfo.put("is_admin", userType); // 商家入驻注册 userInfo.put("is_admin", userType); // 商家入驻注册
userInfo.put("invite_code", StrUtil.isNotBlank(inviteCode) ? inviteCode : ""); // 商家注册代理商的邀请码
// 注册商家账号都是需要手机号绑定的
accountUserBase = register(userInfo); accountUserBase = register(userInfo);
if (accountUserBase == null) { if (accountUserBase == null) {
throw new ApiException(_("账号注册失败!")); throw new ApiException(_("账号注册失败!"));
} }
} }
// 构建登录参数
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("client_id", CommonConstant.USER_TYPE_MCH.equals(userType) ? AuthConstant.MCH_CLIENT_ID : AuthConstant.MOBILE_CLIENT_ID); params.put("client_id", CommonConstant.USER_TYPE_MCH.equals(userType) ? AuthConstant.MCH_CLIENT_ID : AuthConstant.MOBILE_CLIENT_ID);
params.put("client_secret", AuthConstant.AUTHORITY_MOBILE_SECRET); params.put("client_secret", AuthConstant.AUTHORITY_MOBILE_SECRET);
@ -3337,164 +3267,17 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
params.put("username", accountUserBase.getUser_account()); params.put("username", accountUserBase.getUser_account());
params.put("password", ""); params.put("password", "");
params.put("user_mobile", user_mobile); params.put("user_mobile", user_mobile);
params.put("is_merch", CommonConstant.USER_TYPE_MCH.equals(userType) ? "1" : "2"); // 是否为商家入驻 1-其他- params.put("is_merch", "1"); // 是否为商家入驻 1-其他-
params.put("is_agent", CommonConstant.USER_TYPE_AGENT.equals(userType) ? "1" : "2"); // 是否为代理商入驻 1-其他-
if (StrUtil.isNotBlank(cid)) { if (StrUtil.isNotBlank(cid)) {
params.put("cid", cid); // 个推客户端Id params.put("cid", cid); // 个推客户端Id
params.put("os_type", osType); // 个推客系统类别 1-Android2-iOS;3-微信小程序 params.put("os_type", osType);// 个推客系统类别 1-Android2-iOS;3-微信小程序
// logger.info("推送参数2 cid:{} osType{}", cid, osType);
} }
return login(params); return login(params);
} }
/**
* 商家内部注册服务之间调用
*
* @param mobile 商家手机号
* @param regPwd 注册明文密码
* @return Pair<Boolean, String> 第一个元素表示是否成功第二个元素表示提示信息
*/
@Override
public Pair<Boolean, String> merchantInnerRegister(String mobile, String regPwd) {
log.info("商家内部注册开始,手机号: {}", mobile);
// 1. 参数校验
if (StrUtil.isBlank(mobile)) {
log.warn("商家内部注册失败:手机号为空");
return Pair.of(false, "手机号不能为空");
}
try {
// 2. 转换手机号格式添加国家区号
String convertedMobile = PhoneNumberUtils.convZhPhoneNumber(mobile);
// 3. 检查手机号是否已注册为商家
Integer isExists = accountUserBindConnectService.isMerchantExists(convertedMobile);
if (CommonConstant.Enable.equals(isExists)) {
log.warn("商家内部注册失败:手机号已注册,手机号: {}", convertedMobile);
return Pair.of(false, "该手机号已注册!");
}
// 4. 执行手机号绑定登录注册商家账号
CommonResult result = doMobileBindLogin(convertedMobile, regPwd, CommonConstant.USER_TYPE_MCH, null, null, "");
// 5. 检查注册结果
if (result == null || result.getCode() != ResultCode.SUCCESS.getCode()) {
String errorMsg = result != null ? result.getMsg() : "注册结果为空";
log.error("商家账号注册失败:{},手机号: {}", errorMsg, convertedMobile);
return Pair.of(false, "商家账号注册失败:" + errorMsg);
}
log.info("商家内部注册成功,手机号: {}", convertedMobile);
return Pair.of(true, "商家注册成功");
} catch (Exception e) {
log.error("商家内部注册异常,手机号: {}", mobile, e);
return Pair.of(false, "商家注册失败:" + e.getMessage());
}
}
/**
* 更改分店商家的手机号(仅限于分店尽量不要更改总店的手机号)项目之间远程调用
*
* @param oldMobile 老的手机号
* @param newMobile 新的手机号
* @param password 新的登录密码可选
* @return Pair<Boolean, String> 操作结果和提示信息true表示成功false表示失败
*/
@Override
public Pair<Boolean, String> changeMerchantLoginMobile(String oldMobile, String newMobile, String password) {
log.debug("开始更改商家登录手机号,老手机号:{},新手机号:{},是否需要设置密码:{}", oldMobile, newMobile, StrUtil.isNotBlank(password));
try {
// 验证输入参数
if (StrUtil.isBlank(oldMobile) || StrUtil.isBlank(newMobile)) {
log.warn("手机号参数为空,老手机号:{},新手机号:{}", oldMobile, newMobile);
return Pair.of(false, "手机号不能为空");
}
// 格式化手机号添加国际区号
String formattedOldMobile = PhoneNumberUtils.convZhPhoneNumber(oldMobile);
String formattedNewMobile = PhoneNumberUtils.convZhPhoneNumber(newMobile);
log.debug("格式化后的手机号:老:{} 新:{}", formattedOldMobile, formattedNewMobile);
// 查询老手机号是否绑定商家账号
AccountUserBindConnect bindConnect = bindConnectService.getBindByBindId(formattedOldMobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
if (bindConnect == null) {
log.warn("该老手机号未绑定商家账号,手机号:{}", formattedOldMobile);
return Pair.of(false, "该老手机号未绑定商家账号,无法进行更换");
}
// 获取用户信息
Integer userId = bindConnect.getUser_id();
log.debug("绑定记录中的用户ID{}", userId);
AccountUserBase userBase = get(userId);
if (userBase == null) {
log.warn("用户信息不存在用户ID{}", userId);
return Pair.of(false, "用户信息不存在,无法进行更换");
}
// 验证用户确实是商家类型
if (!userBase.getUser_is_admin().equals(CommonConstant.USER_TYPE_MCH)) {
log.warn("该账号不是商家账号用户ID{},用户类型:{}", userId, userBase.getUser_is_admin());
return Pair.of(false, "该账号不是商家账号,无法进行更换");
}
// 检查目标手机号是否已被其他商家账号使用
AccountUserBase existingNewUser = getByAccountAndType(formattedNewMobile, CommonConstant.USER_TYPE_MCH);
if (existingNewUser != null && !existingNewUser.getUser_id().equals(userId)) {
log.warn("目标手机号已被其他商家账号使用,手机号:{}用户ID{}", formattedNewMobile, existingNewUser.getUser_id());
return Pair.of(false, "该手机号已被其他商家账号使用");
}
// 检查新手机号是否已被其他商家绑定
AccountUserBindConnect newBindConnect = bindConnectService.getBindByBindId(formattedNewMobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
if (newBindConnect != null && !newBindConnect.getUser_id().equals(userId)) {
log.warn("该新手机号已被其他商家账号绑定,手机号:{}用户ID{}", formattedNewMobile, newBindConnect.getUser_id());
return Pair.of(false, "该手机号已被其他商家账号绑定");
}
// 更新用户账号为新手机号
log.debug("开始更新用户账号信息用户ID{},新手机号:{}", userId, formattedNewMobile);
userBase.setUser_account(formattedNewMobile);
// 如果提供了密码则更新密码
if (StrUtil.isNotBlank(password)) {
log.debug("需要更新用户密码");
String user_salt = IdUtil.simpleUUID();
String encryptedPassword = SecureUtil.md5(user_salt + SecureUtil.md5(password));
userBase.setUser_password(encryptedPassword);
userBase.setUser_salt(user_salt);
}
// 更新用户基础信息
boolean updateUserResult = saveOrUpdate(userBase);
if (!updateUserResult) {
log.error("更新用户账号信息失败用户ID{}", userId);
return Pair.of(false, "更新用户账号信息失败");
}
// 更新绑定表中的bind_id为新手机号
log.debug("开始更新绑定信息原绑定ID{}新绑定ID{}", bindConnect.getBind_id(), formattedNewMobile);
bindConnect.setBind_id(formattedNewMobile);
boolean updateBindResult = accountUserBindConnectService.saveOrUpdate(bindConnect);
if (!updateBindResult) {
log.error("更新绑定信息失败绑定ID{}", formattedNewMobile);
return Pair.of(false, "更新绑定信息失败");
}
log.info("更换商家登录手机号成功用户ID{},新手机号:{}", userId, formattedNewMobile);
return Pair.of(true, "更换商家登录手机号成功");
} catch (Exception e) {
log.error("更改商家登录手机号过程中发生异常,老手机号:{},新手机号:{}", oldMobile, newMobile, e);
return Pair.of(false, "系统异常:" + e.getMessage());
}
}
@Override @Override
public Map<String, Object> doAppConnectLogin(String bind_name, String code) { public Map<String, Object> doAppConnectLogin(String bind_name, String code) {
String id_prefix = ""; String id_prefix = "";
@ -4020,23 +3803,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
return new ThirdApiRes().fail(250, "保存异常"); return new ThirdApiRes().fail(250, "保存异常");
} }
@Override
public ThirdApiRes saveBatchAccountUserLogin(List<AccountUserLogin> accountUserLoginList) {
boolean result = false;
if (!accountUserLoginList.isEmpty()) {
try {
result = accountUserLoginService.saveBatch(accountUserLoginList, accountUserLoginList.size());
} catch (Exception e) {
throw new RuntimeException("保存AccountUserLogin报错" + e.getMessage());
}
}
if (result) {
return new ThirdApiRes().success("成功");
}
return new ThirdApiRes().fail(250, "保存异常");
}
/** /**
* 检查并修复商户店铺信息 * 检查并修复商户店铺信息
* 重要补偿机制检查修复商户入驻店铺信息(商家账号关联入驻店铺Id给商家账户创立公司员工账号和权限) * 重要补偿机制检查修复商户入驻店铺信息(商家账号关联入驻店铺Id给商家账户创立公司员工账号和权限)

View File

@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.suisung.mall.account.mapper.AccountUserBindConnectMapper; import com.suisung.mall.account.mapper.AccountUserBindConnectMapper;
@ -15,18 +14,11 @@ import com.suisung.mall.account.service.AccountUserInfoService;
import com.suisung.mall.common.api.BindCode; import com.suisung.mall.common.api.BindCode;
import com.suisung.mall.common.api.ResultCode; import com.suisung.mall.common.api.ResultCode;
import com.suisung.mall.common.constant.CommonConstant; import com.suisung.mall.common.constant.CommonConstant;
import com.suisung.mall.common.constant.RedisConstant;
import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.exception.ApiException; import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.feignService.ShopService;
import com.suisung.mall.common.modules.account.AccountUserBase; import com.suisung.mall.common.modules.account.AccountUserBase;
import com.suisung.mall.common.modules.account.AccountUserBindConnect; import com.suisung.mall.common.modules.account.AccountUserBindConnect;
import com.suisung.mall.common.modules.account.AccountUserInfo; import com.suisung.mall.common.modules.account.AccountUserInfo;
import com.suisung.mall.common.modules.store.ShopStoreMember;
import com.suisung.mall.common.pojo.req.WxUserInfoReq; import com.suisung.mall.common.pojo.req.WxUserInfoReq;
import com.suisung.mall.common.pojo.res.ThirdApiRes;
import com.suisung.mall.common.utils.CheckUtil;
import com.suisung.mall.common.utils.ContextUtil;
import com.suisung.mall.common.utils.I18nUtil; import com.suisung.mall.common.utils.I18nUtil;
import com.suisung.mall.common.utils.StringUtils; import com.suisung.mall.common.utils.StringUtils;
import com.suisung.mall.common.utils.phone.PhoneNumberUtils; import com.suisung.mall.common.utils.phone.PhoneNumberUtils;
@ -34,7 +26,6 @@ import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -52,7 +43,6 @@ import java.util.*;
*/ */
@Slf4j @Slf4j
@Service @Service
@Transactional
public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUserBindConnectMapper, AccountUserBindConnect> implements AccountUserBindConnectService { public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUserBindConnectMapper, AccountUserBindConnect> implements AccountUserBindConnectService {
@Autowired @Autowired
@ -61,12 +51,6 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
@Autowired @Autowired
private AccountUserBaseService accountUserBaseService; private AccountUserBaseService accountUserBaseService;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private ShopService shopService;
/** /**
* 获取有效绑定 * 获取有效绑定
* *
@ -383,152 +367,6 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
} }
} }
/**
* 检查手机注册的商家是否存在
*
* @param mobile
* @return 1-已存在 2-不存在 3-格式错误
*/
@Override
public Integer isMerchantExists(String mobile) {
log.debug("检查商家是否存在,手机号: {}", mobile);
if (StrUtil.isBlank(mobile)) {
log.warn("手机号为空,无法检查商家是否存在");
return 3;
}
try {
String convertedMobile = PhoneNumberUtils.convZhPhoneNumber(mobile);
if (CheckUtil.isEmpty(convertedMobile)) {
log.warn("手机号格式无效: {}", mobile);
return 3;
}
// 使用正确的绑定类型检查手机号
LambdaQueryWrapper<AccountUserBindConnect> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AccountUserBindConnect::getBind_id, convertedMobile)
.eq(AccountUserBindConnect::getBind_type, BindCode.MOBILE) // 1-手机号
.eq(AccountUserBindConnect::getUser_type, CommonConstant.USER_TYPE_MCH) // 2-入驻商家
.eq(AccountUserBindConnect::getBind_active, CommonConstant.Enable)
.orderByAsc(AccountUserBindConnect::getBind_time)
.select(AccountUserBindConnect::getUser_id);
log.debug("执行查询,转换后的手机号: {}, 查询条件: {}", convertedMobile, queryWrapper.getSqlSegment());
AccountUserBindConnect accountUserBindConnect = getOne(queryWrapper);
if (accountUserBindConnect == null || CheckUtil.isEmpty(accountUserBindConnect.getUser_id())) {
log.info("未找到手机号绑定的商家记录,手机号: {}", convertedMobile);
return 2;
}
Integer userId = accountUserBindConnect.getUser_id();
log.debug("找到用户ID: {}", userId);
AccountUserBase accountUserBase = accountUserBaseService.get(userId);
if (accountUserBase == null) {
log.warn("用户基础信息不存在用户ID: {}", userId);
return 2;
}
log.info("商家存在用户ID: {}", userId);
return 1;
} catch (Exception e) {
log.error("查询商家绑定信息时发生异常,手机号: {}", mobile, e);
return null;
}
}
@Override
public void saveBindCountSendNumber(Integer storeId, String mobile) {
if (storeId == null) {
return;
}
UserDto userDto = ContextUtil.getCurrentUser();
assert userDto != null;
Integer userId = userDto.getId();
String mapKey = RedisConstant.SUB_SEND_CACHE + userId;
//redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE,mapKey, 1);//todo 删除
if (redisTemplate.opsForHash().get(RedisConstant.SUB_SEND_CACHE, mapKey) != null) {
Integer integer = (Integer) redisTemplate.opsForHash().get(RedisConstant.SUB_SEND_CACHE, mapKey);
if (integer != null && integer > 0) {
if (storeId > 0) { //店铺推送订阅
ShopStoreMember params = new ShopStoreMember();
params.setUserId(userId);
params.setStoreId(storeId);
List<ShopStoreMember> shopStoreMemberList = shopService.findShopStoreMemberList(params);
if (shopStoreMemberList != null && !shopStoreMemberList.isEmpty()) {
ShopStoreMember shopStoreMember = shopStoreMemberList.get(0);
shopStoreMember.setSend_number(shopStoreMember.getSend_number() + 1);
ShopStoreMember resultShopStoreMember = shopService.saveShopStoreMember(shopStoreMember);
if (resultShopStoreMember.getStore_member_id() != null) {
redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE, mapKey, -1);//店铺扣除一次
}
}
} else {//平台推送订阅
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("bind_id", "+86" + mobile)//+86的
.eq("bind_type", BindCode.MOBILE)
.eq("user_type", 0)
.eq("user_id", userId)
.eq("bind_active", CommonConstant.Enable)
.orderByAsc("bind_time");
List<AccountUserBindConnect> accountUserBindConnectList = list(queryWrapper);
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectList.get(0);
if (accountUserBindConnectList.isEmpty()) {
return;
}
UpdateWrapper<AccountUserBindConnect> updateWrapper = new UpdateWrapper<>();
accountUserBindConnect.setSend_number(accountUserBindConnect.getSend_number() + 1);
getUpdateWrapper(updateWrapper, accountUserBindConnect);
if (update(updateWrapper)) {
redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE, mapKey, -1);//店铺扣除一次
}
}
}
}
}
@Override
public ThirdApiRes updateBatchAccountUserBindConnect(List<AccountUserBindConnect> accountUserBindConnectList) {
boolean result = false;
if (!accountUserBindConnectList.isEmpty()) {
UpdateWrapper<AccountUserBindConnect> updateWrapper = new UpdateWrapper<>();
try {
for (AccountUserBindConnect accountUserBindConnect : accountUserBindConnectList) {
updateWrapper.set("send_number", accountUserBindConnect.getSend_number());
updateWrapper.eq("bind_id", accountUserBindConnect.getBind_id());
updateWrapper.eq("user_id", accountUserBindConnect.getUser_id());
updateWrapper.eq("bind_type", accountUserBindConnect.getBind_type());
updateWrapper.eq("user_type", accountUserBindConnect.getUser_type());
this.update(updateWrapper);
}
} catch (Exception e) {
throw new RuntimeException("保存AccountUserBindConnect报错" + e.getMessage());
}
}
if (result) {
return new ThirdApiRes().success("成功");
}
return new ThirdApiRes().fail(250, "保存异常");
}
@Override
public List<AccountUserBindConnect> getAllBindList(AccountUserBindConnect accountUserBindConnect) {
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("bind_id", accountUserBindConnect.getBind_id());
queryWrapper.eq("bind_type", BindCode.MOBILE)
.eq("user_type", 0)
.eq("user_id", accountUserBindConnect.getUser_id())
.orderByAsc("bind_time");
return this.list(queryWrapper);
}
/** /**
* 用户绑定手机号和openid * 用户绑定手机号和openid
* *
@ -597,14 +435,13 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
/** /**
* 初始化账户用户绑定信息 * 初始化账户用户绑定信息
* *
* @param bindId 绑定ID * @param bindId 绑定ID
* @param bindType 绑定类型 * @param bindType 绑定类型
* @param userId 用户ID * @param userId 用户ID
* @param userType 用户类型 * @param userType 用户类型
* @param inviteCode 代理商邀请码
* @return 账户用户绑定连接对象如果初始化失败则返回null * @return 账户用户绑定连接对象如果初始化失败则返回null
*/ */
public AccountUserBindConnect initAccountUserBindConnect(String bindId, Integer bindType, Integer userId, Integer userType, String inviteCode) { public AccountUserBindConnect initAccountUserBindConnect(String bindId, Integer bindType, Integer userId, Integer userType) {
// 1. 校验入参任何一个为空直接返回null // 1. 校验入参任何一个为空直接返回null
if (StrUtil.isBlank(bindId) if (StrUtil.isBlank(bindId)
|| ObjectUtil.isNull(bindType) || ObjectUtil.isNull(bindType)
@ -626,7 +463,7 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
.eq("user_id", userId) .eq("user_id", userId)
.eq("bind_active", CommonConstant.Enable).orderByAsc("bind_time"); .eq("bind_active", CommonConstant.Enable).orderByAsc("bind_time");
AccountUserBindConnect existingBindConnect = getOne(queryWrapper, false); AccountUserBindConnect existingBindConnect = findOne(queryWrapper);
if (existingBindConnect != null) { if (existingBindConnect != null) {
log.info("账户用户绑定信息已存在bindId={}, bindType={}, userId={}, userType={}", bindId, bindType, userId, userType); log.info("账户用户绑定信息已存在bindId={}, bindType={}, userId={}, userType={}", bindId, bindType, userId, userType);
return existingBindConnect; return existingBindConnect;
@ -644,7 +481,6 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
newBindConnect.setBind_token_ttl(0); newBindConnect.setBind_token_ttl(0);
newBindConnect.setBind_level(0); newBindConnect.setBind_level(0);
newBindConnect.setBind_vip(0); newBindConnect.setBind_vip(0);
newBindConnect.setInvite_code(inviteCode); // 代理商邀请码
// log.debug("准备创建新的账户用户绑定信息: {}", JSONUtil.toJsonStr(newBindConnect)); // log.debug("准备创建新的账户用户绑定信息: {}", JSONUtil.toJsonStr(newBindConnect));
@ -669,25 +505,24 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
} }
@Override @Override
public List<AccountUserBindConnect> getAllBindPage(String bindTmpl, Integer pageNum, Integer pageSize) { public List<AccountUserBindConnect> getAllBindPage(String bindTmpl,Integer pageNum, Integer pageSize) {
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>(); QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.select("bind_id,bind_type,user_id,user_type"); queryWrapper.select("bind_id,bind_type,user_id,user_type");
queryWrapper.in("bind_type", Arrays.asList(BindCode.MOBILE, BindCode.WEIXIN_XCX)) queryWrapper.in("bind_type", Arrays.asList(BindCode.MOBILE,BindCode.WEIXIN_XCX))
.eq("user_type", CommonConstant.USER_TYPE_NORMAL) .eq("user_type", CommonConstant.USER_TYPE_NORMAL)
.eq("bind_active", CommonConstant.Enable) .eq("bind_active", CommonConstant.Enable)
.eq("bind_tmpl", bindTmpl) .eq("bind_tmpl",bindTmpl)
.gt("send_number", 0)
.orderByAsc("bind_time"); .orderByAsc("bind_time");
return this.lists(queryWrapper, pageNum, pageSize).getRecords(); return this.lists(queryWrapper,pageNum,pageSize).getRecords();
} }
@Override @Override
public long getAllBindCount(String bindTmpl) { public long getAllBindCount(String bindTmpl) {
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>(); QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.in("bind_type", Arrays.asList(BindCode.MOBILE, BindCode.WEIXIN_XCX)) queryWrapper.in("bind_type", Arrays.asList(BindCode.MOBILE,BindCode.WEIXIN_XCX))
.eq("user_type", CommonConstant.USER_TYPE_NORMAL) .eq("user_type", CommonConstant.USER_TYPE_NORMAL)
.eq("bind_active", CommonConstant.Enable) .eq("bind_active", CommonConstant.Enable)
.eq("bind_tmpl", bindTmpl) .eq("bind_tmpl",bindTmpl)
.orderByAsc("bind_time"); .orderByAsc("bind_time");
return this.count(queryWrapper); return this.count(queryWrapper);
} }
@ -702,46 +537,42 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
// log.info("错误信息--{}",e.getMessage()); // log.info("错误信息--{}",e.getMessage());
// } // }
log.info("jsonObject:{}", jsonObject); log.info("jsonObject:{}", jsonObject);
String openId = jsonObject.getStr("FromUserName");//用户openid String openId=jsonObject.getStr("FromUserName");//用户openid
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>(); QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("bind_openid", openId) queryWrapper.eq("bind_openid",openId)
.eq("user_type", CommonConstant.USER_TYPE_NORMAL) .eq("user_type", CommonConstant.USER_TYPE_NORMAL)
.in("bind_type", Arrays.asList(1, 15)) .in("bind_type",Arrays.asList(1,15))
.eq("bind_active", CommonConstant.Enable); .eq("bind_active", CommonConstant.Enable);
List<AccountUserBindConnect> accountUserBindConnectList = list(queryWrapper); List<AccountUserBindConnect> accountUserBindConnectList= list(queryWrapper);
if (!accountUserBindConnectList.isEmpty()) { if (!accountUserBindConnectList.isEmpty()) {
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectList.get(0); AccountUserBindConnect accountUserBindConnect=accountUserBindConnectList.get(0);
JSONArray jsonArray = null; JSONArray jsonArray=null;
JSONObject object = null; JSONObject object= null;
try { try {
jsonArray = jsonObject.getJSONArray("List"); jsonArray= jsonObject.getJSONArray("List");
} catch (RuntimeException runtimeException) { }catch (RuntimeException runtimeException){
log.info("单个模板"); log.info("单个模板");
object = jsonObject.getJSONObject("List"); object=jsonObject.getJSONObject("List");
} }
UpdateWrapper<AccountUserBindConnect> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<AccountUserBindConnect> updateWrapper = new UpdateWrapper<>();
if (jsonArray != null) { if (jsonArray != null) {
object = (JSONObject) jsonArray.get(0); object= (JSONObject) jsonArray.get(0);
String templateId = object.getStr("TemplateId");//模板id String templateId= object.getStr("TemplateId");//模板id
String SubscribeStatusString = object.getStr("SubscribeStatusString");//订阅结果accept接收reject拒收参考地址https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html#%E8%AE%A2%E9%98%85%E6%B6%88%E6%81%AF%E8%AF%AD%E9%9F%B3%E6%8F%90%E9%86%92 String SubscribeStatusString= object.getStr("SubscribeStatusString");//订阅结果accept接收reject拒收参考地址https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html#%E8%AE%A2%E9%98%85%E6%B6%88%E6%81%AF%E8%AF%AD%E9%9F%B3%E6%8F%90%E9%86%92
if (SubscribeStatusString.equals("accept")) { if(SubscribeStatusString.equals("accept")){
String mapKey = RedisConstant.SUB_SEND_CACHE + accountUserBindConnect.getUser_id();
redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE, mapKey, 1);
accountUserBindConnect.setBind_tmpl(templateId); accountUserBindConnect.setBind_tmpl(templateId);
getUpdateWrapper(updateWrapper, accountUserBindConnect); getUpdateWrapper(updateWrapper, accountUserBindConnect);
} }
} else { }else {
assert object != null; assert object != null;
String templateId = object.getStr("TemplateId");//模板id String templateId= object.getStr("TemplateId");//模板id
String SubscribeStatusString = object.getStr("SubscribeStatusString"); String SubscribeStatusString= object.getStr("SubscribeStatusString");
if (StringUtils.isNotEmpty(SubscribeStatusString) && SubscribeStatusString.equals("accept")) { if(StringUtils.isNotEmpty(SubscribeStatusString)&&SubscribeStatusString.equals("accept")){
String mapKey = RedisConstant.SUB_SEND_CACHE + accountUserBindConnect.getUser_id();
redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE, mapKey, 1);
accountUserBindConnect.setBind_tmpl(templateId); accountUserBindConnect.setBind_tmpl(templateId);
getUpdateWrapper(updateWrapper, accountUserBindConnect); getUpdateWrapper(updateWrapper, accountUserBindConnect);
} else { }else {
String ErrorStatus = object.getStr("ErrorStatus"); String ErrorStatus=object.getStr("ErrorStatus");
if (ErrorStatus.equals("success")) { if(ErrorStatus.equals("success")){
log.info("消息推送成功给用户,不需要操作"); log.info("消息推送成功给用户,不需要操作");
return; return;
} }
@ -751,21 +582,18 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
} }
} }
/** /**
* 封装相同参数的调用方法 * 封装相同参数的调用方法
*
* @param updateWrapper * @param updateWrapper
* @param accountUserBindConnect * @param accountUserBindConnect
*/ */
private void getUpdateWrapper(UpdateWrapper<AccountUserBindConnect> updateWrapper, private void getUpdateWrapper(UpdateWrapper<AccountUserBindConnect> updateWrapper,
AccountUserBindConnect accountUserBindConnect) { AccountUserBindConnect accountUserBindConnect) {
updateWrapper.set("bind_tmpl", accountUserBindConnect.getBind_tmpl()); updateWrapper.set("bind_tmpl",accountUserBindConnect.getBind_tmpl());
updateWrapper.eq("bind_id", accountUserBindConnect.getBind_id()); updateWrapper.eq("bind_id",accountUserBindConnect.getBind_id());
updateWrapper.eq("bind_type", accountUserBindConnect.getBind_type()); updateWrapper.eq("bind_type",accountUserBindConnect.getBind_type());
updateWrapper.eq("user_id", accountUserBindConnect.getUser_id()); updateWrapper.eq("user_id",accountUserBindConnect.getUser_id());
updateWrapper.eq("user_type", accountUserBindConnect.getUser_type()); updateWrapper.eq("user_type",accountUserBindConnect.getUser_type());
updateWrapper.set("send_number", accountUserBindConnect.getSend_number());
} }
} }

View File

@ -23,7 +23,6 @@ import com.suisung.mall.common.feignService.PayService;
import com.suisung.mall.common.feignService.ShopService; import com.suisung.mall.common.feignService.ShopService;
import com.suisung.mall.common.modules.account.*; import com.suisung.mall.common.modules.account.*;
import com.suisung.mall.common.modules.distribution.ShopDistributionPlantformUser; import com.suisung.mall.common.modules.distribution.ShopDistributionPlantformUser;
import com.suisung.mall.common.modules.store.ShopStoreMemberLevel;
import com.suisung.mall.common.modules.user.ShopUserExpHistory; import com.suisung.mall.common.modules.user.ShopUserExpHistory;
import com.suisung.mall.common.utils.CSVUtils; import com.suisung.mall.common.utils.CSVUtils;
import com.suisung.mall.common.utils.CheckUtil; import com.suisung.mall.common.utils.CheckUtil;
@ -81,10 +80,6 @@ public class AccountUserInfoServiceImpl extends BaseServiceImpl<AccountUserInfoM
@Autowired @Autowired
private PayService payService; private PayService payService;
@Autowired
private ShopStoreMemberLevelService shopStoreMemberLevelService;
/** /**
* 实名认证页面 * 实名认证页面
* *
@ -162,6 +157,7 @@ public class AccountUserInfoServiceImpl extends BaseServiceImpl<AccountUserInfoM
@Override @Override
public boolean checkUpdateUserLevel(Integer user_id, BigDecimal user_exp_total, Integer user_fans_total, BigDecimal user_spend_total, Integer user_store_total, Integer user_fans_vip_total, Integer user_fans_team_total) { public boolean checkUpdateUserLevel(Integer user_id, BigDecimal user_exp_total, Integer user_fans_total, BigDecimal user_spend_total, Integer user_store_total, Integer user_fans_vip_total, Integer user_fans_team_total) {
AccountBaseUserLevel level_row = null; AccountBaseUserLevel level_row = null;
if (CheckUtil.isNotEmpty(user_exp_total)) { if (CheckUtil.isNotEmpty(user_exp_total)) {
// 需要设置经验值设置为0否则忽略不计 // 需要设置经验值设置为0否则忽略不计
QueryWrapper<AccountBaseUserLevel> levelQueryWrapper = new QueryWrapper<>(); QueryWrapper<AccountBaseUserLevel> levelQueryWrapper = new QueryWrapper<>();
@ -182,7 +178,7 @@ public class AccountUserInfoServiceImpl extends BaseServiceImpl<AccountUserInfoM
// 需要设置经验值设置为0否则忽略不计 // 需要设置经验值设置为0否则忽略不计
QueryWrapper<AccountBaseUserLevel> levelQueryWrapper = new QueryWrapper<>(); QueryWrapper<AccountBaseUserLevel> levelQueryWrapper = new QueryWrapper<>();
levelQueryWrapper.le("user_level_spend", user_spend_total) levelQueryWrapper.le("user_level_spend", user_spend_total)
.gt("user_level_spend", "0.00").orderByDesc("user_level_spend"); .gt("user_level_spend", 0).orderByDesc("user_level_spend");
level_row = accountBaseUserLevelService.findOne(levelQueryWrapper); level_row = accountBaseUserLevelService.findOne(levelQueryWrapper);
} }
@ -435,11 +431,8 @@ public class AccountUserInfoServiceImpl extends BaseServiceImpl<AccountUserInfoM
@Override @Override
public List<Map> getUser(List<Integer> user_ids) { public List<Map> getUser(List<Integer> user_ids) {
QueryWrapper<AccountUserBase> queryWrapper = new QueryWrapper<>(); List<AccountUserBase> user_base_rows = accountUserBaseService.gets(user_ids);
queryWrapper.in("user_id", user_ids); List<Map> user_info_rows = Convert.toList(Map.class, gets(user_ids));
List<AccountUserBase> user_base_rows = accountUserBaseService.list(queryWrapper);
//List<AccountUserBase> user_base_rows = accountUserBaseService.gets(user_ids);
List<Map> user_info_rows = Convert.toList(Map.class, user_base_rows);
for (Map user_info_row : user_info_rows) { for (Map user_info_row : user_info_rows) {
Integer user_id = (Integer) user_info_row.get("user_id"); Integer user_id = (Integer) user_info_row.get("user_id");

View File

@ -1,90 +0,0 @@
package com.suisung.mall.account.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suisung.mall.account.mapper.AccountBaseUserLevelMapper;
import com.suisung.mall.account.mapper.ShopStoreMemberLevelMapper;
import com.suisung.mall.account.service.ShopStoreMemberLevelService;
import com.suisung.mall.common.modules.account.AccountBaseUserLevel;
import com.suisung.mall.common.modules.store.ShopStoreMemberLevel;
import com.suisung.mall.common.utils.CheckUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
* 店铺会员-会员等级
* </p>
*/
@Service
@Slf4j
public class ShopStoreMemberLevelServiceImpl implements ShopStoreMemberLevelService {
@Autowired
private ShopStoreMemberLevelMapper shopStoreMemberLevelMapper;
@Autowired
private AccountBaseUserLevelMapper accountBaseUserLevelMapper;
@Override
public void checkUpdateStoreUserLevel(ShopStoreMemberLevel shopStoreMemberLevel) {
log.info("MQ店铺会员升级开始shopStoreMemberLevel:{}", shopStoreMemberLevel);
int maxAttempts = 3; // 最多尝试3次
int currentAttempt = 0;
boolean success = false;
while (currentAttempt < maxAttempts && !success) {
success = dealStoreUserLevel(shopStoreMemberLevel);
if (!success) {
currentAttempt++;
if (currentAttempt < maxAttempts) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
log.error("线程被中断,重试终止", e);
Thread.currentThread().interrupt();
break;
}
}
}
}
if (!success) {
log.error("店铺会员升级失败,已达到最大重试次数");
}
}
private boolean dealStoreUserLevel(ShopStoreMemberLevel shopStoreMemberLevel){
if(shopStoreMemberLevel.getUserLevelSpend()!=null && shopStoreMemberLevel.getStoreId()!=null && shopStoreMemberLevel.getUserId()!=null){//店铺消费
//查找会员再更新店铺会员等级 todo
QueryWrapper<ShopStoreMemberLevel> params = new QueryWrapper<>();
params.eq("user_id", shopStoreMemberLevel.getUserId());
params.eq("store_id", shopStoreMemberLevel.getStoreId());
List<ShopStoreMemberLevel> shopStoreMemberLevels= shopStoreMemberLevelMapper.selectList(params);
if(shopStoreMemberLevels!=null && !shopStoreMemberLevels.isEmpty()) {
ShopStoreMemberLevel updateShopStoreMemberLevel = shopStoreMemberLevels.get(0);
BigDecimal storeSpend = NumberUtil.add(updateShopStoreMemberLevel.getUserLevelSpend(), shopStoreMemberLevel.getUserLevelSpend());//店铺会员总消费
QueryWrapper<AccountBaseUserLevel> levelQueryWrapper = new QueryWrapper<>();
levelQueryWrapper.le("user_level_spend", storeSpend)
.gt("user_level_spend", "0.00").orderByDesc("user_level_spend");
AccountBaseUserLevel level_row = accountBaseUserLevelMapper.selectOne(levelQueryWrapper);
updateShopStoreMemberLevel.setUserLevelSpend(storeSpend);
if (level_row != null && CheckUtil.isNotEmpty(level_row.getUser_level_id())) {
Integer user_level_id = level_row.getUser_level_id();
String user_level_name = level_row.getUser_level_name();
updateShopStoreMemberLevel.setUserLevelId(user_level_id);
updateShopStoreMemberLevel.setUserLevelName(user_level_name);
updateShopStoreMemberLevel.setMemberLevelId(user_level_id);
updateShopStoreMemberLevel.setMemberLevelName(user_level_name);
}
shopStoreMemberLevelMapper.updateById(updateShopStoreMemberLevel);
}else {
return false;
}
}
return true;
}
}

View File

@ -1,101 +0,0 @@
package com.suisung.mall.account.service.impl;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suisung.mall.account.mapper.AccountUserBindConnectMapper;
import com.suisung.mall.account.mapper.AccountUserInfoMapper;
import com.suisung.mall.account.mapper.ShopStoreMemberLevelMapper;
import com.suisung.mall.account.mapper.ShopStoreMemberMapper;
import com.suisung.mall.account.service.ShopStoreMemberService;
import com.suisung.mall.common.api.BindCode;
import com.suisung.mall.common.modules.account.AccountUserBindConnect;
import com.suisung.mall.common.modules.account.AccountUserInfo;
import com.suisung.mall.common.modules.store.ShopStoreMember;
import com.suisung.mall.common.modules.store.ShopStoreMemberLevel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 店铺会员-店铺会员
* </p>
*/
@Service
@Slf4j
public class ShopStoreMemberServiceImpl implements ShopStoreMemberService {
@Autowired
private ShopStoreMemberMapper shopStoreMemberMapper;
@Autowired
private AccountUserBindConnectMapper accountUserBindConnectMapper;
@Autowired
private ShopStoreMemberLevelMapper shopStoreMemberLevelMapper;
@Autowired
private AccountUserInfoMapper accountUserInfoMapper;
@Override
public void dealStoreMember(AccountUserInfo accountUserInfo){
AccountUserInfo updateAccountUserInfo= accountUserInfoMapper.selectById(accountUserInfo.getUser_id());
log.info("dealStoreMember-MQ处理店铺会员开始:accountUserInfo:{}", JSONUtil.toJsonStr(accountUserInfo));
if(null!=accountUserInfo.getStore_id()){
log.info("MQ处理店铺会员开始:accountUserInfo:{}", JSONUtil.toJsonStr(accountUserInfo));
Integer store_id = accountUserInfo.getStore_id();
Integer user_id = accountUserInfo.getUser_id();
QueryWrapper<ShopStoreMember> params=new QueryWrapper<>();
params.eq("store_id",store_id);
params.eq("user_id",user_id);
List<ShopStoreMember> shopStoreMembers= shopStoreMemberMapper.selectList(params);
if(shopStoreMembers.isEmpty()){
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
String bind_id= updateAccountUserInfo.getUser_mobile();
if(!bind_id.contains("+86")){
bind_id="+86"+ updateAccountUserInfo.getUser_mobile();
}
queryWrapper.eq("bind_id", bind_id);
queryWrapper.eq("bind_type", BindCode.MOBILE)
.eq("user_type", 0)
.eq("user_id", user_id)
.orderByAsc("bind_time");
List<AccountUserBindConnect> accountUserBindConnectList = accountUserBindConnectMapper.selectList(queryWrapper);
if (!accountUserBindConnectList.isEmpty()){
AccountUserBindConnect accountUserBindConnect= accountUserBindConnectList.get(0);
ShopStoreMember shopStoreMember = new ShopStoreMember();
shopStoreMember.setStoreName(accountUserInfo.getStore_name());
shopStoreMember.setStoreId(store_id);
shopStoreMember.setUserId(user_id);
shopStoreMember.setBind_openid(accountUserBindConnect.getBind_openid());
shopStoreMember.setUserNickname(accountUserBindConnect.getBind_nickname());
shopStoreMember.setUserAccount(accountUserBindConnect.getBind_id());
shopStoreMemberMapper.insert(shopStoreMember);
ShopStoreMemberLevel shopStoreMemberLevel = getShopStoreMemberLevel(store_id, shopStoreMember);
shopStoreMemberLevel.setUserId(user_id);
shopStoreMemberLevelMapper.insert(shopStoreMemberLevel);
}
}
}
}
/**
* 店铺会员初始化信息
* @param storeId
* @param shopStoreMember
* @return
*/
private ShopStoreMemberLevel getShopStoreMemberLevel(Integer storeId, ShopStoreMember shopStoreMember) {
ShopStoreMemberLevel shopStoreMemberLevel=new ShopStoreMemberLevel();
shopStoreMemberLevel.setStoreId(storeId);
shopStoreMemberLevel.setStoreMemberId(shopStoreMember.getStore_member_id());
shopStoreMemberLevel.setUserLevelName("v1");
shopStoreMemberLevel.setUserLevelId(1001);
shopStoreMemberLevel.setMemberLevelId(1001);
shopStoreMemberLevel.setMemberLevelName("v1");
return shopStoreMemberLevel;
}
}

View File

@ -99,7 +99,7 @@ logging:
suisung: suisung:
mall: mall:
account: account:
mapper: info mapper: debug
sun: sun:
mail: error mail: error
baomidou: error baomidou: error

View File

@ -4,6 +4,6 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
bind_id bind_id
, bind_type, user_id, bind_time, bind_nickname, bind_icon, bind_gender, bind_vip, bind_level, bind_client_id, bind_country, bind_province, bind_city, bind_county, bind_code, bind_openid, bind_unionid, bind_access_token, bind_expires_in, bind_refresh_token, bind_token_ttl, bind_active, invite_code, created_at, updated_at , bind_type, user_id, bind_time, bind_nickname, bind_icon, bind_gender, bind_vip, bind_level, bind_client_id, bind_country, bind_province, bind_city, bind_county, bind_code, bind_openid, bind_unionid, bind_access_token, bind_expires_in, bind_refresh_token, bind_token_ttl, bind_active, created_at, updated_at
</sql> </sql>
</mapper> </mapper>

View File

@ -1,19 +1,13 @@
package com.suisung.mall.admin.controller.admin; package com.suisung.mall.admin.controller.admin;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.suisung.mall.admin.service.AdminBaseMenuService; import com.suisung.mall.admin.service.AdminBaseMenuService;
import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.modules.admin.AdminBaseMenu; import com.suisung.mall.common.modules.admin.AdminBaseMenu;
import com.suisung.mall.common.modules.admin.Router; import com.suisung.mall.common.modules.admin.Router;
import com.suisung.mall.common.utils.ContextUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@ -44,18 +38,6 @@ public class AdminBaseMenuController {
return CommonResult.success(routers); return CommonResult.success(routers);
} }
/**
* 获取用户权限目录信息
*
* @param
* @return
*/
@RequestMapping(value = "/treePage", method = RequestMethod.GET)
public IPage<AdminBaseMenu> getRouterList(AdminBaseMenu adminBaseMenu, @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
return adminBaseMenuService.treePage(adminBaseMenu,pageNum,pageSize);
}
/** /**
* 获取所有菜单配置 * 获取所有菜单配置
* *
@ -101,22 +83,6 @@ public class AdminBaseMenuController {
return adminBaseMenuService.updateAdminBaseMenu(adminBaseMenu); return adminBaseMenuService.updateAdminBaseMenu(adminBaseMenu);
} }
/**
* 批量删除
*
* @param menu_ids
* @return
*/
@ApiOperation(value = "权限表 -批量删除", notes = "权限表 -批量删除")
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
public CommonResult deleteBatch(String menu_ids) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
boolean flag = adminBaseMenuService.remove(Arrays.asList(menu_ids.split(",")));
return CommonResult.success(flag);
}
} }

View File

@ -1,16 +1,17 @@
package com.suisung.mall.admin.controller.admin; package com.suisung.mall.admin.controller.admin;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.suisung.mall.admin.service.AdminBaseProtocolService; import com.suisung.mall.admin.service.AdminBaseProtocolService;
import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.modules.admin.AdminBaseProtocol; import com.suisung.mall.common.modules.admin.AdminBaseProtocol;
import com.suisung.mall.common.utils.ContextUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -42,11 +43,15 @@ public class AdminBaseProtocolController {
*/ */
@ApiOperation(value = "基础通信协议表-分页列表查询", notes = "基础通信协议表-分页列表查询") @ApiOperation(value = "基础通信协议表-分页列表查询", notes = "基础通信协议表-分页列表查询")
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
public CommonResult list(AdminBaseProtocol adminBaseProtocol, public CommonResult list(@RequestParam(name = "queryWrapper", required = false) AdminBaseProtocol adminBaseProtocol,
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
return CommonResult.success(adminBaseProtocolService.getPageAdminBaseProtocol(adminBaseProtocol, pageNum, pageSize)); QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByAsc("cmd_id");
IPage<AdminBaseProtocol> pageList = adminBaseProtocolService.lists(queryWrapper, pageNum, pageSize);
return CommonResult.success(pageList);
} }
/** /**
@ -56,13 +61,9 @@ public class AdminBaseProtocolController {
* @return * @return
*/ */
@ApiOperation(value = "基础通信协议表-编辑", notes = "基础通信协议表-编辑") @ApiOperation(value = "基础通信协议表-编辑", notes = "基础通信协议表-编辑")
@RequestMapping(value = "/edit", method = RequestMethod.PUT) @RequestMapping(value = "/edit", method = RequestMethod.POST)
public CommonResult edit(@RequestBody AdminBaseProtocol adminBaseProtocol) { public CommonResult edit(AdminBaseProtocol adminBaseProtocol) {
UserDto userDto= ContextUtil.getCurrentUser(); boolean flag = adminBaseProtocolService.edit(adminBaseProtocol);
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
boolean flag = adminBaseProtocolService.editAdminBaseProtocol(adminBaseProtocol);
return CommonResult.success(flag); return CommonResult.success(flag);
} }
@ -86,13 +87,9 @@ public class AdminBaseProtocolController {
* @return * @return
*/ */
@ApiOperation(value = "基础通信协议表-批量删除", notes = "基础通信协议表-批量删除") @ApiOperation(value = "基础通信协议表-批量删除", notes = "基础通信协议表-批量删除")
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) @RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
public CommonResult deleteBatch(@RequestParam(name = "cmd_ids") String cmd_ids) { public CommonResult deleteBatch(@RequestParam(name = "cmd_ids") String cmd_ids) {
UserDto userDto= ContextUtil.getCurrentUser(); boolean flag = adminBaseProtocolService.removeByIds(Arrays.asList(cmd_ids.split(",")));
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
boolean flag = adminBaseProtocolService.deleteBatchByIds(Arrays.asList(cmd_ids.split(",")));
return CommonResult.success(flag); return CommonResult.success(flag);
} }
@ -114,25 +111,10 @@ public class AdminBaseProtocolController {
* @return * @return
*/ */
@ApiOperation(value = "基础通信协议表-新增", notes = "基础通信协议表-新增") @ApiOperation(value = "基础通信协议表-新增", notes = "基础通信协议表-新增")
@RequestMapping(value = "/add", method = RequestMethod.POST) @RequestMapping(value = "/add", method = RequestMethod.PUT)
public CommonResult add(@RequestBody AdminBaseProtocol adminBaseProtocol) { public CommonResult add(AdminBaseProtocol adminBaseProtocol) {
UserDto userDto= ContextUtil.getCurrentUser(); boolean flag = adminBaseProtocolService.save(adminBaseProtocol);
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
boolean flag = adminBaseProtocolService.addAdminBaseProtocol(adminBaseProtocol);
return CommonResult.success(flag); return CommonResult.success(flag);
} }
/**
* 根据id查出路由主要是显示平台权限名称和店铺权限名称
* @param cmd_id
* @return
*/
@ApiOperation(value = "基础通信协议表-查找单个协议", notes = "基础通信协议表-查找单个协议")
@RequestMapping(value = "/getOneById", method = RequestMethod.GET)
public CommonResult getOneById(@RequestParam(name = "cmd_id") Integer cmd_id) {
return CommonResult.success(adminBaseProtocolService.getOneByCmId(cmd_id));
}
} }

View File

@ -1,15 +1,11 @@
package com.suisung.mall.admin.controller.admin; package com.suisung.mall.admin.controller.admin;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.suisung.mall.admin.service.AdminRightsBaseService; import com.suisung.mall.admin.service.AdminRightsBaseService;
import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.modules.admin.AdminRightsBase; import com.suisung.mall.common.modules.admin.AdminRightsBase;
import com.suisung.mall.common.modules.admin.ElTree; import com.suisung.mall.common.modules.admin.ElTree;
import com.suisung.mall.common.utils.ContextUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -44,7 +40,7 @@ public class AdminRightsBaseController {
*/ */
@ApiOperation(value = "权限表 -分页列表查询", notes = "权限表 -分页列表查询") @ApiOperation(value = "权限表 -分页列表查询", notes = "权限表 -分页列表查询")
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
public CommonResult list(AdminRightsBase adminRightsBase, public CommonResult list(@RequestParam(name = "queryWrapper", required = false) AdminRightsBase adminRightsBase,
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
@ -55,21 +51,6 @@ public class AdminRightsBaseController {
return CommonResult.success(pageList); return CommonResult.success(pageList);
} }
/**
* 树形分页列表查询
* @param adminRightsBase
* @param pageNum
* @param pageSize
* @return
*/
@ApiOperation(value = "权限表 -树形分页列表查询", notes = "权限表 -树形分页列表查询")
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
public IPage<AdminRightsBase> treeList(AdminRightsBase adminRightsBase,
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
return adminRightsBaseService.treePage(adminRightsBase, pageNum, pageSize);
}
/** /**
* 获取tree数据 * 获取tree数据
@ -97,12 +78,8 @@ public class AdminRightsBaseController {
* @return * @return
*/ */
@ApiOperation(value = "权限表 -编辑", notes = "权限表 -编辑") @ApiOperation(value = "权限表 -编辑", notes = "权限表 -编辑")
@RequestMapping(value = "/edit", method = RequestMethod.PUT) @RequestMapping(value = "/edit", method = RequestMethod.POST)
public CommonResult edit(@RequestBody AdminRightsBase adminRightsBase) { public CommonResult edit(AdminRightsBase adminRightsBase) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
boolean flag = adminRightsBaseService.edit(adminRightsBase); boolean flag = adminRightsBaseService.edit(adminRightsBase);
return CommonResult.success(flag); return CommonResult.success(flag);
} }
@ -117,10 +94,6 @@ public class AdminRightsBaseController {
@ApiOperation(value = "权限表 -通过rights_id删除", notes = "权限表 -通过rights_id删除") @ApiOperation(value = "权限表 -通过rights_id删除", notes = "权限表 -通过rights_id删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST) @RequestMapping(value = "/delete", method = RequestMethod.POST)
public CommonResult delete(@RequestParam(name = "rights_id") String rights_id) { public CommonResult delete(@RequestParam(name = "rights_id") String rights_id) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
boolean flag = adminRightsBaseService.remove(rights_id); boolean flag = adminRightsBaseService.remove(rights_id);
return CommonResult.success(flag); return CommonResult.success(flag);
} }
@ -132,12 +105,8 @@ public class AdminRightsBaseController {
* @return * @return
*/ */
@ApiOperation(value = "权限表 -批量删除", notes = "权限表 -批量删除") @ApiOperation(value = "权限表 -批量删除", notes = "权限表 -批量删除")
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) @RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
public CommonResult deleteBatch(String rights_ids) { public CommonResult deleteBatch(@RequestParam(name = "rights_ids") String rights_ids) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
boolean flag = this.adminRightsBaseService.remove(Arrays.asList(rights_ids.split(","))); boolean flag = this.adminRightsBaseService.remove(Arrays.asList(rights_ids.split(",")));
return CommonResult.success(flag); return CommonResult.success(flag);
} }
@ -151,13 +120,6 @@ public class AdminRightsBaseController {
@ApiOperation(value = "权限表 -新增", notes = "权限表 -编辑") @ApiOperation(value = "权限表 -新增", notes = "权限表 -编辑")
@RequestMapping(value = "/add", method = RequestMethod.POST) @RequestMapping(value = "/add", method = RequestMethod.POST)
public CommonResult add(@RequestBody AdminRightsBase adminRightsBase) { public CommonResult add(@RequestBody AdminRightsBase adminRightsBase) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
if(ObjectUtil.isEmpty(adminRightsBase.getRights_parent_id())){
adminRightsBase.setRights_parent_id(0);
}
boolean flag = adminRightsBaseService.save(adminRightsBase); boolean flag = adminRightsBaseService.save(adminRightsBase);
return CommonResult.success(flag); return CommonResult.success(flag);
} }

View File

@ -30,7 +30,6 @@ import com.suisung.mall.common.pojo.dto.OssCallbackResultDTO;
import com.suisung.mall.common.pojo.dto.OssPolicyResultDTO; import com.suisung.mall.common.pojo.dto.OssPolicyResultDTO;
import com.suisung.mall.common.utils.I18nUtil; import com.suisung.mall.common.utils.I18nUtil;
import com.suisung.mall.common.utils.LogUtil; import com.suisung.mall.common.utils.LogUtil;
import com.suisung.mall.common.utils.UploadUtil;
import com.suisung.mall.common.utils.VideoUtil; import com.suisung.mall.common.utils.VideoUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -170,9 +169,6 @@ public class OssServiceImpl implements OssService {
* @return * @return
*/ */
public Map upload(MultipartFile file, UserDto user, String dir, String uploadPath, String uploadName, String fileName) { public Map upload(MultipartFile file, UserDto user, String dir, String uploadPath, String uploadName, String fileName) {
// 如果是图片先压缩图片再上传到 cos 对象存储
file = UploadUtil.compressImageIfNeeded(file, 2048);
// 创建临时文件 // 创建临时文件
creTempFile(file, dir, uploadName); creTempFile(file, dir, uploadName);
String url = null; String url = null;
@ -252,7 +248,7 @@ public class OssServiceImpl implements OssService {
tempFile.delete(); tempFile.delete();
logger.info("临时文件已删除: {}", uploadPath); logger.info("临时文件已删除: {}", uploadPath);
} }
// 同时删除可能创建的封面文件 // 同时删除可能创建的封面文件
String coverPath = uploadPath.replace("." + VideoUtil.getVideoFormat(uploadPath), ".jpg"); String coverPath = uploadPath.replace("." + VideoUtil.getVideoFormat(uploadPath), ".jpg");
File coverFile = new File(coverPath); File coverFile = new File(coverPath);

View File

@ -1,7 +1,6 @@
package com.suisung.mall.admin.service; package com.suisung.mall.admin.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.modules.admin.AdminBaseMenu; import com.suisung.mall.common.modules.admin.AdminBaseMenu;
import com.suisung.mall.common.modules.admin.Router; import com.suisung.mall.common.modules.admin.Router;
@ -33,6 +32,4 @@ public interface AdminBaseMenuService extends IBaseService<AdminBaseMenu> {
CommonResult saveAdminBaseMenu(AdminBaseMenu adminBaseMenu); CommonResult saveAdminBaseMenu(AdminBaseMenu adminBaseMenu);
CommonResult updateAdminBaseMenu(AdminBaseMenu adminBaseMenu); CommonResult updateAdminBaseMenu(AdminBaseMenu adminBaseMenu);
IPage<AdminBaseMenu> treePage(AdminBaseMenu adminBaseMenu, Integer pageNum, Integer pageSize);
} }

View File

@ -1,7 +1,6 @@
package com.suisung.mall.admin.service; package com.suisung.mall.admin.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.suisung.mall.common.modules.admin.AdminBaseProtocol; import com.suisung.mall.common.modules.admin.AdminBaseProtocol;
import com.suisung.mall.core.web.service.IBaseService; import com.suisung.mall.core.web.service.IBaseService;
@ -22,17 +21,4 @@ public interface AdminBaseProtocolService extends IBaseService<AdminBaseProtocol
* 初始化资源角色规则 * 初始化资源角色规则
*/ */
Map<String, List<String>> initResourceRolesMap(); Map<String, List<String>> initResourceRolesMap();
/**
* 分页查询路由
*/
IPage<AdminBaseProtocol> getPageAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol,Integer pageNum,Integer pageSize);
boolean addAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol);
boolean editAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol);
boolean deleteBatchByIds(List<String> adminBaseProtocolIds);
AdminBaseProtocol getOneByCmId(Integer cmId);
} }

View File

@ -1,7 +1,6 @@
package com.suisung.mall.admin.service; package com.suisung.mall.admin.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.suisung.mall.common.modules.admin.AdminRightsBase; import com.suisung.mall.common.modules.admin.AdminRightsBase;
import com.suisung.mall.common.modules.admin.ElTree; import com.suisung.mall.common.modules.admin.ElTree;
import com.suisung.mall.core.web.service.IBaseService; import com.suisung.mall.core.web.service.IBaseService;
@ -22,9 +21,4 @@ public interface AdminRightsBaseService extends IBaseService<AdminRightsBase> {
* 获取tree数据 * 获取tree数据
*/ */
List<ElTree> tree(); List<ElTree> tree();
/**
* 获取tree数据
*/
IPage<AdminRightsBase> treePage(AdminRightsBase adminRightsBase, Integer pageNum, Integer pageSize);
} }

View File

@ -94,7 +94,7 @@ public class AdminAppMarketUpdateServiceImpl extends BaseServiceImpl<AdminAppMar
QueryWrapper<AdminAppMarketUpdate> queryWrapper = new QueryWrapper<>(); QueryWrapper<AdminAppMarketUpdate> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("market_id", marketId).eq("status", CommonConstant.Enable).orderByDesc("version_key"); queryWrapper.eq("market_id", marketId).eq("status", CommonConstant.Enable).orderByDesc("version_key");
AdminAppMarketUpdate adminAppMarketUpdate = getOne(queryWrapper, false); AdminAppMarketUpdate adminAppMarketUpdate = findOne(queryWrapper);
if (adminAppMarketUpdate == null) { if (adminAppMarketUpdate == null) {
return CommonResult.success(null, "没有找到最新版本"); return CommonResult.success(null, "没有找到最新版本");
} }
@ -285,6 +285,6 @@ public class AdminAppMarketUpdateServiceImpl extends BaseServiceImpl<AdminAppMar
queryWrapper.eq("market_id", marketId).eq("status", CommonConstant.Enable) queryWrapper.eq("market_id", marketId).eq("status", CommonConstant.Enable)
.eq("package_name", packageName).orderByDesc("version_key"); .eq("package_name", packageName).orderByDesc("version_key");
return getOne(queryWrapper, false); return findOne(queryWrapper);
} }
} }

View File

@ -5,7 +5,6 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.suisung.mall.admin.mapper.AdminBaseMenuMapper; import com.suisung.mall.admin.mapper.AdminBaseMenuMapper;
import com.suisung.mall.admin.service.AccountBaseConfigService; import com.suisung.mall.admin.service.AccountBaseConfigService;
@ -871,16 +870,6 @@ public class AdminBaseMenuServiceImpl extends BaseServiceImpl<AdminBaseMenuMappe
@Override @Override
public CommonResult saveAdminBaseMenu(AdminBaseMenu adminBaseMenu) { public CommonResult saveAdminBaseMenu(AdminBaseMenu adminBaseMenu) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("没有权限");
}
if(ObjectUtil.isEmpty(adminBaseMenu.getMenu_parent_id())){
adminBaseMenu.setMenu_parent_id(0);
}
if(ObjectUtil.isEmpty(adminBaseMenu.getMenu_time())){
adminBaseMenu.setMenu_time(new Date());
}
if (!save(adminBaseMenu)) { if (!save(adminBaseMenu)) {
return CommonResult.failed("新增失败"); return CommonResult.failed("新增失败");
} }
@ -889,61 +878,12 @@ public class AdminBaseMenuServiceImpl extends BaseServiceImpl<AdminBaseMenuMappe
@Override @Override
public CommonResult updateAdminBaseMenu(AdminBaseMenu adminBaseMenu) { public CommonResult updateAdminBaseMenu(AdminBaseMenu adminBaseMenu) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("没有权限");
}
if(ObjectUtil.isEmpty(adminBaseMenu.getMenu_time())){
adminBaseMenu.setMenu_time(new Date());
}
if (!edit(adminBaseMenu)) { if (!edit(adminBaseMenu)) {
return CommonResult.failed("更新失败"); return CommonResult.failed("更新失败");
} }
return CommonResult.success("更新成功"); return CommonResult.success("更新成功");
} }
@Override
public IPage<AdminBaseMenu> treePage(AdminBaseMenu adminBaseMenu, Integer pageNum, Integer pageSize) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("没有权限");
}
QueryWrapper<AdminBaseMenu> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("menu_id");
if(adminBaseMenu!=null){
if(StringUtils.isNotEmpty(adminBaseMenu.getMenu_name())){
queryWrapper.like("menu_name", adminBaseMenu.getMenu_name());
}
}
queryWrapper.eq("menu_parent_id",0);
IPage<AdminBaseMenu> pageList = this.lists(queryWrapper, pageNum, pageSize);
List<AdminBaseMenu> adminBaseMenus= pageList.getRecords();
adminBaseMenus=buildAdminBaseMenuTree(adminBaseMenus,0);
pageList.setRecords(adminBaseMenus);
return pageList;
}
/**
* 递归构建tree
*
* @param bases
* @param pid
* @return
*/
public List<AdminBaseMenu> buildAdminBaseMenuTree(List<AdminBaseMenu> bases, Integer pid) {
List<AdminBaseMenu> tree = new ArrayList<>();
bases.forEach(s -> {
if (s.getMenu_parent_id().intValue() == pid.intValue()) {
QueryWrapper<AdminBaseMenu> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("menu_parent_id", s.getMenu_id());
long countAdminRightsBase=this.count(queryWrapper);
if(countAdminRightsBase>0){
s.setChildren(buildAdminBaseMenuTree(this.list(queryWrapper), s.getMenu_id()));
}
tree.add(s);
}
});
return tree;
}
/** /**
* 校验是否为平台 * 校验是否为平台

View File

@ -3,30 +3,18 @@ package com.suisung.mall.admin.service.impl;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.suisung.mall.admin.mapper.AdminBaseProtocolMapper; import com.suisung.mall.admin.mapper.AdminBaseProtocolMapper;
import com.suisung.mall.admin.service.AdminBaseMenuService;
import com.suisung.mall.admin.service.AdminBaseProtocolService; import com.suisung.mall.admin.service.AdminBaseProtocolService;
import com.suisung.mall.admin.service.AdminRightsBaseService;
import com.suisung.mall.admin.service.AdminRightsGroupService; import com.suisung.mall.admin.service.AdminRightsGroupService;
import com.suisung.mall.common.constant.AuthConstant; import com.suisung.mall.common.constant.AuthConstant;
import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.feignService.ShopService;
import com.suisung.mall.common.modules.admin.AdminBaseMenu;
import com.suisung.mall.common.modules.admin.AdminBaseProtocol; import com.suisung.mall.common.modules.admin.AdminBaseProtocol;
import com.suisung.mall.common.modules.admin.AdminRightsBase;
import com.suisung.mall.common.modules.admin.AdminRightsGroup; import com.suisung.mall.common.modules.admin.AdminRightsGroup;
import com.suisung.mall.common.modules.store.ShopStoreEmployeeRightsBase;
import com.suisung.mall.common.utils.ContextUtil;
import com.suisung.mall.core.web.service.RedisService; import com.suisung.mall.core.web.service.RedisService;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.hibernate.validator.internal.util.stereotypes.Lazy;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.*;
@ -50,17 +38,6 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@Lazy
@Autowired
private AdminRightsBaseService adminRightsBaseService;
@Autowired
private ShopService shopService;
@Lazy
@Autowired
private AdminBaseMenuService adminBaseMenuService;
/** /**
* 插入数据 * 插入数据
* *
@ -68,15 +45,7 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
* @return * @return
*/ */
@Override @Override
public boolean addAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol) { public boolean add(AdminBaseProtocol adminBaseProtocol) {
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("ctl",adminBaseProtocol.getCtl());
queryWrapper.eq("met",adminBaseProtocol.getMet());
queryWrapper.eq("mdu",adminBaseProtocol.getMdu());
List<AdminBaseProtocol> adminBaseProtocolList=this.list(queryWrapper);
if(!adminBaseProtocolList.isEmpty()){
throw new ApiException("已存在相同的路由");
}
boolean flag = save(adminBaseProtocol); boolean flag = save(adminBaseProtocol);
initResourceRolesMap(); initResourceRolesMap();
return flag; return flag;
@ -89,83 +58,25 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
* @return * @return
*/ */
@Override @Override
public boolean editAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol) { public boolean edit(AdminBaseProtocol adminBaseProtocol) {
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("ctl",adminBaseProtocol.getCtl());
queryWrapper.eq("met",adminBaseProtocol.getMet());
queryWrapper.eq("mdu",adminBaseProtocol.getMdu());
List<AdminBaseProtocol> adminBaseProtocolList=this.list(queryWrapper);
if(!adminBaseProtocolList.isEmpty()){
throw new ApiException("已存在相同的路由");
}
boolean flag = updateById(adminBaseProtocol); boolean flag = updateById(adminBaseProtocol);
initResourceRolesMap(); initResourceRolesMap();
return flag; return flag;
} }
/** /**
* 根据cmd_id批量删除 * 根据cmd_id删除
* @param adminBaseProtocolIds *
* @param cmd_id
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) public boolean remove(Serializable cmd_id) {
public boolean deleteBatchByIds(List<String> adminBaseProtocolIds) { boolean flag = super.remove(cmd_id);
boolean flag = removeBatchByIds(adminBaseProtocolIds);
initResourceRolesMap(); initResourceRolesMap();
return flag; return flag;
} }
@Override
public AdminBaseProtocol getOneByCmId(Integer cmId) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("cmd_id",cmId);
List<AdminBaseProtocol> adminBaseProtocolList=this.list(queryWrapper);
if(adminBaseProtocolList.isEmpty()){
throw new ApiException("不存在通信协议");
}
AdminBaseProtocol adminBaseProtocol=adminBaseProtocolList.get(0);
String rigthsIds= adminBaseProtocol.getRights_id();
if(StringUtils.isNotBlank(rigthsIds)){
QueryWrapper<AdminBaseMenu> adminBaseMenuQuery = new QueryWrapper<>();
adminBaseMenuQuery.eq("menu_url_path",adminBaseProtocol.getPath());
List<AdminBaseMenu> adminBaseMenuList= adminBaseMenuService.list(adminBaseMenuQuery);
if(adminBaseMenuList.isEmpty()){
throw new ApiException("需要配置菜单");
}
List<String> rightsIdList= Arrays.asList(rigthsIds.split(","));
List<Integer> rightsIdsIntList=new ArrayList<>();
rightsIdList.forEach(s->rightsIdsIntList.add(Integer.parseInt(s)));
QueryWrapper<AdminRightsBase> adminRightsBaseQuery = new QueryWrapper<>();
adminRightsBaseQuery.in("rights_id",rightsIdsIntList);
List<AdminRightsBase> adminRightsBaseList= adminRightsBaseService.list(adminRightsBaseQuery);
AdminBaseMenu adminBaseMenu=adminBaseMenuList.get(0);
if(!adminRightsBaseList.isEmpty()){
adminRightsBaseList= adminRightsBaseList.stream().filter(s->s.getRights_name().equals(adminBaseMenu.getMenu_name())).collect(Collectors.toList());
Map<Integer,String> adminRightBaseMap=adminRightsBaseList.stream().collect(
Collectors.toMap(AdminRightsBase::getRights_id,
AdminRightsBase::getRights_name));
adminBaseProtocol.setAdminRightBaseMap(adminRightBaseMap);
}
QueryWrapper<ShopStoreEmployeeRightsBase> shopStoreEmployeeRightsBasesQuery = new QueryWrapper<>();
shopStoreEmployeeRightsBasesQuery.in("rights_id",rightsIdsIntList);
List<ShopStoreEmployeeRightsBase> shopStoreEmployeeRightsBases= shopService.queryByRightsIds(rigthsIds);
if(!shopStoreEmployeeRightsBases.isEmpty()){
shopStoreEmployeeRightsBases= shopStoreEmployeeRightsBases.stream().filter(s->s.getRights_name().equals(adminBaseMenu.getMenu_name())).collect(Collectors.toList());
Map<Integer,String> shopStoreEmployeeRightsBaseMap=shopStoreEmployeeRightsBases.stream().collect(
Collectors.toMap(ShopStoreEmployeeRightsBase::getRights_id,
ShopStoreEmployeeRightsBase::getRights_name));
adminBaseProtocol.setShopStoreEmployeeRightsBaseMap(shopStoreEmployeeRightsBaseMap);
}
}
return adminBaseProtocol;
}
@Override @Override
public Map<String, List<String>> initResourceRolesMap() { public Map<String, List<String>> initResourceRolesMap() {
// 资源-分组信息 // 资源-分组信息
@ -197,28 +108,6 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
} }
@Override
public IPage<AdminBaseProtocol> getPageAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol, Integer pageNum, Integer pageSize) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("权限不足");
}
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByAsc("cmd_id");
if(adminBaseProtocol!=null){
if(StringUtils.isNotBlank(adminBaseProtocol.getComment())){
queryWrapper.like("comment", adminBaseProtocol.getComment());
}
if(StringUtils.isNotBlank(adminBaseProtocol.getCtl())){
queryWrapper.like("ctl", adminBaseProtocol.getCtl());
}
}
return this.lists(queryWrapper, pageNum, pageSize);
}
/** /**
* 对比两个数组是否有相同元素 * 对比两个数组是否有相同元素
* *

View File

@ -2,16 +2,11 @@ package com.suisung.mall.admin.service.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.suisung.mall.admin.mapper.AdminRightsBaseMapper; import com.suisung.mall.admin.mapper.AdminRightsBaseMapper;
import com.suisung.mall.admin.service.AccountBaseConfigService; import com.suisung.mall.admin.service.AccountBaseConfigService;
import com.suisung.mall.admin.service.AdminRightsBaseService; import com.suisung.mall.admin.service.AdminRightsBaseService;
import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.modules.admin.AdminRightsBase; import com.suisung.mall.common.modules.admin.AdminRightsBase;
import com.suisung.mall.common.modules.admin.ElTree; import com.suisung.mall.common.modules.admin.ElTree;
import com.suisung.mall.common.utils.ContextUtil;
import com.suisung.mall.common.utils.StringUtils;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -53,59 +48,6 @@ public class AdminRightsBaseServiceImpl extends BaseServiceImpl<AdminRightsBaseM
return BuildTree(list, 0); return BuildTree(list, 0);
} }
@Override
public IPage<AdminRightsBase> treePage(AdminRightsBase adminRightsBase, Integer pageNum, Integer pageSize) {
UserDto userDto= ContextUtil.getCurrentUser();
if(userDto.getRole_id()!=9){
throw new ApiException("没有权限");
}
QueryWrapper<AdminRightsBase> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByAsc("rights_id");
if(adminRightsBase!=null){
if(StringUtils.isNotEmpty(adminRightsBase.getRights_name())){
queryWrapper.like("rights_name", adminRightsBase.getRights_name());
}
}
queryWrapper.eq("rights_parent_id",0);
IPage<AdminRightsBase> pageList = this.lists(queryWrapper, pageNum, pageSize);
List<AdminRightsBase> adminRightsBases= pageList.getRecords();
adminRightsBases=buildAdminRightBaseTree(adminRightsBases,0);
pageList.setRecords(adminRightsBases);
return pageList;
}
/**
* 递归构建tree
*
* @param bases
* @param pid
* @return
*/
public List<AdminRightsBase> buildAdminRightBaseTree(List<AdminRightsBase> bases, Integer pid) {
List<AdminRightsBase> tree = new ArrayList<>();
bases.forEach(s -> {
if (s.getRights_parent_id().intValue() == pid.intValue()) {
AdminRightsBase adminRightsBase=new AdminRightsBase();
adminRightsBase.setRights_id(s.getRights_id());
adminRightsBase.setRights_name(s.getRights_name());
adminRightsBase.setRights_parent_id(s.getRights_parent_id());
adminRightsBase.setRights_order(s.getRights_order());
adminRightsBase.setRights_remark(s.getRights_remark());
adminRightsBase.setMenu_func(s.getMenu_func());
// adminRightsBase.setChildren(buildAdminRightBaseTree(bases, s.getRights_id()));
QueryWrapper<AdminRightsBase> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("rights_parent_id", s.getRights_id());
long countAdminRightsBase=this.count(queryWrapper);
if(countAdminRightsBase>0){
adminRightsBase.setChildren(buildAdminRightBaseTree(this.list(queryWrapper), s.getRights_id()));
}
tree.add(adminRightsBase);
}
});
return tree;
}
/** /**
* 递归构建tree * 递归构建tree
* *

View File

@ -10,8 +10,8 @@ import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.exception.ApiUserException; import com.suisung.mall.common.exception.ApiUserException;
import com.suisung.mall.common.modules.cms.CmsArticleComment; import com.suisung.mall.common.modules.cms.CmsArticleComment;
import com.suisung.mall.common.modules.cms.CmsArticleCommentHelpful; import com.suisung.mall.common.modules.cms.CmsArticleCommentHelpful;
import com.suisung.mall.common.utils.I18nUtil;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.common.utils.I18nUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -48,13 +48,13 @@ public class CmsArticleCommentHelpfulServiceImpl extends BaseServiceImpl<CmsArti
queryWrapper.eq("user_id", user.getId()); queryWrapper.eq("user_id", user.getId());
queryWrapper.eq("article_id", cmsArticleCommentHelpful.getArticle_id()); queryWrapper.eq("article_id", cmsArticleCommentHelpful.getArticle_id());
CmsArticleCommentHelpful dbArticleCommentHelpful = getOne(queryWrapper, false); CmsArticleCommentHelpful dbArticleCommentHelpful = findOne(queryWrapper);
QueryWrapper<CmsArticleComment> commentQueryWrapper = new QueryWrapper<>(); QueryWrapper<CmsArticleComment> commentQueryWrapper = new QueryWrapper<>();
commentQueryWrapper.eq("comment_id", cmsArticleCommentHelpful.getComment_id()); commentQueryWrapper.eq("comment_id", cmsArticleCommentHelpful.getComment_id());
commentQueryWrapper.eq("article_id", cmsArticleCommentHelpful.getArticle_id()); commentQueryWrapper.eq("article_id", cmsArticleCommentHelpful.getArticle_id());
commentQueryWrapper.eq("user_id", user.getId()); commentQueryWrapper.eq("user_id", user.getId());
CmsArticleComment dbArticleComment = cmsArticleCommentService.getOne(commentQueryWrapper, false); CmsArticleComment dbArticleComment = cmsArticleCommentService.findOne(commentQueryWrapper);
if (null == dbArticleCommentHelpful) { if (null == dbArticleCommentHelpful) {
cmsArticleCommentHelpful.setUser_id(user.getId()); cmsArticleCommentHelpful.setUser_id(user.getId());

View File

@ -1,39 +0,0 @@
package com.suisung.mall.common.annotation;
import java.lang.annotation.*;
import java.util.concurrent.TimeUnit;
/**
* 分布式锁注解
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DistributedLock {
/**
* 锁的key支持SpEL表达式,下面是示例
* key = "'ACCOUNT_LOCK:' + #batchSize", // 使用SpEL表达式锁key包含参数
* public List<Integer> getBatchUserAccountBaseId(int batchSize)
*/
String key();
/**
* 等待时间默认0-不等待
*/
long waitTime() default 0;
/**
* 锁持有时间默认30秒-1表示使用看门狗机制
*/
long leaseTime() default 30;
/**
* 时间单位默认秒
*/
TimeUnit timeUnit() default TimeUnit.SECONDS;
/**
* 获取锁失败时的错误消息
*/
String errorMsg() default "系统繁忙,请稍后再试";
}

View File

@ -15,8 +15,8 @@ public class StateCode {
public static final int DELIVERY_TYPE_AIR_FREIGHT = 4; //货运空运水运铁路运输公路运输 public static final int DELIVERY_TYPE_AIR_FREIGHT = 4; //货运空运水运铁路运输公路运输
public static final int DELIVERY_TYPE_SELF_PICK_UP = 5; // 自提运费 0 public static final int DELIVERY_TYPE_SELF_PICK_UP = 5; // 自提运费 0
public static final int DELIVERY_TYPE_EXP = 10; // 普通快递 public static final int DELIVERY_TYPE_EXP = 10; // 普通快递
public static final int DELIVERY_TYPE_IN_STORE_SERVICE = 15; // 店铺配送运费 0 public static final int DELIVERY_TYPE_IN_STORE_SERVICE = 15; // 店铺配送
public static final int DELIVERY_TYPE_SAME_CITY = 16;//同城配送 public static final int DELIVERY_TYPE_SAME_CITY = 16;//顺丰同城配送
public static final Map<Integer, String> DELIVERY_TYPE_MAP = new HashMap() { public static final Map<Integer, String> DELIVERY_TYPE_MAP = new HashMap() {
{ {
@ -27,7 +27,7 @@ public class StateCode {
put(DELIVERY_TYPE_SELF_PICK_UP, "到店自提"); put(DELIVERY_TYPE_SELF_PICK_UP, "到店自提");
put(DELIVERY_TYPE_EXP, "普通快递"); put(DELIVERY_TYPE_EXP, "普通快递");
put(DELIVERY_TYPE_IN_STORE_SERVICE, "店铺配送"); put(DELIVERY_TYPE_IN_STORE_SERVICE, "店铺配送");
put(DELIVERY_TYPE_SAME_CITY, "顺丰同城配送"); put(DELIVERY_TYPE_SAME_CITY, "顺丰同城");
} }
}; };
@ -450,11 +450,6 @@ public class StateCode {
public static final int SF_ORDER_STATUS_EXCEPTION = 91; public static final int SF_ORDER_STATUS_EXCEPTION = 91;
public static final int SF_ORDER_STATUS_CANCELING = 31; public static final int SF_ORDER_STATUS_CANCELING = 31;
// 退款状态:0-是无退款;1-是部分退款;2-是全部退款
public static final int ORDER_REFUND_STATUS_NO = 0;
public static final int ORDER_REFUND_STATUS_PART = 1;
public static final int ORDER_REFUND_STATUS_ALL = 2;
static { static {
DELIVERY_TIME_NOT_TIMER.put(1, I18nUtil._("不限时段")); DELIVERY_TIME_NOT_TIMER.put(1, I18nUtil._("不限时段"));
DELIVERY_TIME_NOT_TIMER.put(15, I18nUtil._("上午")); DELIVERY_TIME_NOT_TIMER.put(15, I18nUtil._("上午"));

View File

@ -30,11 +30,6 @@ public class AuthConstant {
*/ */
public static final String MCH_CLIENT_ID = "mch-app"; public static final String MCH_CLIENT_ID = "mch-app";
/**
* 商家版移动端client_id
*/
public static final String AGENT_CLIENT_ID = "agent-app";
/** /**
* 微信client_ID * 微信client_ID
*/ */

View File

@ -20,12 +20,11 @@ public class CommonConstant {
public static final Integer Delivery_Amount_Comput_Type_Payment = 3; public static final Integer Delivery_Amount_Comput_Type_Payment = 3;
/** /**
* 用户类型:0-普通买家; 1-管理员2-入驻商家3-代理商 * 用户类型0-普通用户1-管理员2-入驻商户
*/ */
public static final Integer USER_TYPE_NORMAL = 0; public static final Integer USER_TYPE_NORMAL = 0;
public static final Integer USER_TYPE_ADMIN = 1; public static final Integer USER_TYPE_ADMIN = 1;
public static final Integer USER_TYPE_MCH = 2; public static final Integer USER_TYPE_MCH = 2;
public static final Integer USER_TYPE_AGENT = 3;
// 国际电话区号 // 国际电话区号
public static final String IDD_ZH_CN = "+86"; //中国 public static final String IDD_ZH_CN = "+86"; //中国
@ -111,12 +110,6 @@ public class CommonConstant {
//秒杀活动订阅消息模板id //秒杀活动订阅消息模板id
public static final String BIND_SUB_TMPL_SKILL = "kiDj_hSF_ASwD-Dlgxnypi6IJBQZ12a-hEpd3zZ-Uxc"; public static final String BIND_SUB_TMPL_SKILL = "kiDj_hSF_ASwD-Dlgxnypi6IJBQZ12a-hEpd3zZ-Uxc";
//平台首页
public static final String INDEX_PLAFT_PAGE = "pages/index/index";
//店铺首页
public static final String INDEX_STORE_PAGE = "pagesub/index/store";
//分账计算方式1-按总金额2-按可分账金额 //分账计算方式1-按总金额2-按可分账金额
public static final int SeparateCalcMode_TotalAmt = 1; public static final int SeparateCalcMode_TotalAmt = 1;
public static final int SeparateCalcMode_CanSeparateAmt = 2; public static final int SeparateCalcMode_CanSeparateAmt = 2;
@ -128,32 +121,4 @@ public class CommonConstant {
public static final Integer Agent_Level_2nd = 2; public static final Integer Agent_Level_2nd = 2;
// 订单配送预约状态1-立即配送2-预约配送
public static final Integer Order_Booking_State_LJ = 1;
public static final Integer Order_Booking_State_YY = 2;
// 预约下单从当前时间延迟的最小分钟数单位分钟不能低于35分钟
public final static Integer MIN_DELAY_MINUTES_FOR_BOOKING_ORDER = 50;
// 店铺营业状态1-开业营业中且在营业时间内12-开业打烊中但在营业时间外2-停业中3-开业或活动筹备中
// 1-开业营业中且在营业时间内
public final static Integer Store_Biz_State_Opening = 1;
// 12-开业打烊中但在营业时间外
public final static Integer Store_Biz_State_Opening2 = 12;
//2-停业中
public final static Integer Store_Biz_State_Closed = 2;
//3-开业(活动)筹备中
public final static Integer Store_Biz_State_PreActivity = 3;
//用户砍价订单状态1-砍价已完成下单
public static final Integer CutPrice_Order_State_Finished = 1;
//2-砍价未下单已取消
public static final Integer CutPrice_Order_State_Canceled = 2;
//3-砍价助力进行中
public static final Integer CutPrice_Order_State_ING = 3;
//4-砍价过期失效
public static final Integer CutPrice_Order_State_Expired = 4;
//6-砍价助力已完成待下单
public static final Integer CutPrice_Order_State_CutFinished = 6;
} }

View File

@ -14,7 +14,6 @@ public class MqConstant {
public static final Integer FAILURE = 2; // 消息消费失败更改状态 public static final Integer FAILURE = 2; // 消息消费失败更改状态
public static final Integer DELIVERED = 3; // 消息重试消费成功更改状态 public static final Integer DELIVERED = 3; // 消息重试消费成功更改状态
public static final Integer MAX_COUNT = 3; // 消息重新投递最大重试次数 public static final Integer MAX_COUNT = 3; // 消息重新投递最大重试次数
public static final String SHOP_EXCHANGE = "shop-event-exchange"; // SHOP服务交换机 public static final String SHOP_EXCHANGE = "shop-event-exchange"; // SHOP服务交换机
public static final String ACCOUNT_EXCHANGE = "account-event-exchange"; // ACCOUNT服务交换机 public static final String ACCOUNT_EXCHANGE = "account-event-exchange"; // ACCOUNT服务交换机
public static final String PAY_EXCHANGE = "pay-event-exchange"; // PAY服务交换机 public static final String PAY_EXCHANGE = "pay-event-exchange"; // PAY服务交换机

View File

@ -41,16 +41,4 @@ public class RedisConstant {
// 您有新的订单来了 // 您有新的订单来了
public static final String New_Order_Push_Flag_Key = ConstantRedis.Cache_NameSpace + "new:order:comimg:"; public static final String New_Order_Push_Flag_Key = ConstantRedis.Cache_NameSpace + "new:order:comimg:";
// 预约订单任务新增键
public static final String Order_Booking_Task_Key = ConstantRedis.Cache_NameSpace + "new:order:booking:task:";
public static final String VERIFY_CODE_KEY = "register:verifyCode:";
// 拉卡拉合同是否强制签署
public static final String LKL_EC_REPEAT_SIGN = "lkl:ec:repeat:sign:";
// 微信同意记录
public static final String SUB_SEND_CACHE = "sub:send:cache";
} }

View File

@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.suisung.mall.common.constant.AuthConstant; import com.suisung.mall.common.constant.AuthConstant;
import com.suisung.mall.common.constant.CommonConstant; import com.suisung.mall.common.constant.CommonConstant;
import com.suisung.mall.common.utils.CheckUtil;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -24,7 +23,7 @@ public class UserDto implements Serializable {
private String user_password; private String user_password;
private String user_nickname; private String user_nickname;
private Integer user_state; private Integer user_state;
private String client_id; // 客户端 后台管理-admin-app移动端-mobile-app入驻商家移动端-mch-app代理商端-agent-app private String client_id; // 客户端 后台管理-admin-app移动端-mobile-app入驻商家移动端-mch-app
private String user_salt; private String user_salt;
private List<String> roles; private List<String> roles;
// 服务端返回rid 角色编号: 0-用户;2-商家;3-门店;9-平台; // 服务端返回rid 角色编号: 0-用户;2-商家;3-门店;9-平台;
@ -32,8 +31,6 @@ public class UserDto implements Serializable {
private Integer site_id = 0; //分站编号 private Integer site_id = 0; //分站编号
private String store_id; private String store_id;
private String chain_id; private String chain_id;
private Integer user_is_admin;//用户类型对应user_base is_admin0-普通用户1-管理员2-入驻商家3-代理商
private String invite_code; // 代理商邀请码
/** /**
* 用户角色是平台 * 用户角色是平台
@ -94,41 +91,18 @@ public class UserDto implements Serializable {
} }
/** /**
* 代理商端 * 获取用户类型对应user_base is_admin0-普通用户1-管理员2-入驻商家
*
* @return
*/
public boolean isAgent() {
return ObjectUtil.equal(client_id, AuthConstant.AGENT_CLIENT_ID);
}
/**
* 获取用户类型对应user_base user_is_admin0-普通用户1-管理员2-入驻商家3-代理商
*
* @return
*/
// public Integer getUserType() {
// Integer user_type = CommonConstant.USER_TYPE_NORMAL; // 用户类型对应user_base user_is_admin0-普通用户1-管理员2-入驻商家3-代理商
// if (isAdmin()) {
// user_type = CommonConstant.USER_TYPE_ADMIN;
// } else if (isMerchant()) {
// user_type = CommonConstant.USER_TYPE_MCH;
// } else if (isAgent()) {
// user_type = CommonConstant.USER_TYPE_AGENT;
// } else {
// user_type = CommonConstant.USER_TYPE_NORMAL;
// }
//
// return user_type;
// }
/**
* 获取用户类型对应user_base user_is_admin0-普通用户1-管理员2-入驻商家3-代理商
* *
* @return * @return
*/ */
public Integer getUserType() { public Integer getUserType() {
// 用户类型对应user_base is_admin0-普通用户1-管理员2-入驻商家 Integer user_type = CommonConstant.USER_TYPE_NORMAL; // 用户类型对应user_base is_admin0-普通用户1-管理员2-入驻商家
return CheckUtil.isNotEmpty(this.user_is_admin) ? this.user_is_admin : CommonConstant.USER_TYPE_NORMAL; if (isAdmin()) {
user_type = CommonConstant.USER_TYPE_ADMIN;
} else if (isMerchant()) {
user_type = CommonConstant.USER_TYPE_MCH;
}
return user_type;
} }
} }

View File

@ -7,7 +7,6 @@ import com.suisung.mall.common.pojo.output.TimelineOutput;
import com.suisung.mall.common.pojo.res.ThirdApiRes; import com.suisung.mall.common.pojo.res.ThirdApiRes;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.data.util.Pair;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -279,15 +278,6 @@ public interface AccountService {
@PostMapping(value = "/admin/account/accountController/saveBatchAccountInfo") @PostMapping(value = "/admin/account/accountController/saveBatchAccountInfo")
ThirdApiRes saveBatchAccountInfo(@RequestBody List<AccountUserInfo> accountUserInfoList); ThirdApiRes saveBatchAccountInfo(@RequestBody List<AccountUserInfo> accountUserInfoList);
/**
* 批量保存accountUserLogin
*
* @return
*/
@PostMapping(value = "/admin/account/accountController/saveBatchAccountUserLogin")
ThirdApiRes saveBatchAccountUserLogin(@RequestBody List<AccountUserLogin> accountUserLoginList);
/** /**
* 批量保存accountInfo * 批量保存accountInfo
* *
@ -313,37 +303,4 @@ public interface AccountService {
@GetMapping(value = "/admin/account/accountController/getAllBindCount") @GetMapping(value = "/admin/account/accountController/getAllBindCount")
long getAllBindCount(@RequestParam(name = "bindTmpl") String bindTmpl); long getAllBindCount(@RequestParam(name = "bindTmpl") String bindTmpl);
/**
* 批量更新保存accountUserBindConnect
*
* @return
*/
@PostMapping(value = "/admin/account/accountController/updateBatchAccountUserBindConnect")
ThirdApiRes updateBatchAccountUserBindConnect(@RequestBody List<AccountUserBindConnect> accountUserBindConnectList);
/**
* 检查手机注册的商家是否存在(仅供内部调用)
*
* @param mobile
* @return
*/
@RequestMapping(value = "/admin/account/account-user-bind-connect/is-merchant-exists", method = RequestMethod.POST)
Integer isMerchantExists(@RequestParam(name = "mobile") String mobile);
/**
* 服务间注册商家账号项目之间远程调用
*/
@RequestMapping(value = "/admin/account/account-user-base/merchant/inner-register", method = RequestMethod.POST)
Pair<Boolean, String> merchantInnerRegister(@RequestParam("mobile") String mobile, @RequestParam("regPwd") String regPwd);
/**
* 服务间注册商家账号项目之间远程调用
*/
@RequestMapping(value = "/admin/account/account-user-base/merchant/inner-register", method = RequestMethod.POST)
Pair<Boolean, String> changeMerchantLoginMobile(@RequestParam("oldMobile") String oldMobile, @RequestParam("newMobile") String newMobile, @RequestParam("password") String password);
} }

View File

@ -18,7 +18,10 @@ import com.suisung.mall.common.modules.pay.dto.ItemActivityInfoDTO;
import com.suisung.mall.common.modules.plantform.ShopPlantformSubsiteUser; import com.suisung.mall.common.modules.plantform.ShopPlantformSubsiteUser;
import com.suisung.mall.common.modules.product.ShopProductBase; import com.suisung.mall.common.modules.product.ShopProductBase;
import com.suisung.mall.common.modules.product.ShopProductIndex; import com.suisung.mall.common.modules.product.ShopProductIndex;
import com.suisung.mall.common.modules.store.*; import com.suisung.mall.common.modules.store.ShopStoreBase;
import com.suisung.mall.common.modules.store.ShopStoreEmployee;
import com.suisung.mall.common.modules.store.ShopStoreEmployeeKefu;
import com.suisung.mall.common.modules.store.ShopStoreEmployeeRightsGroup;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@ -32,7 +35,7 @@ import java.util.Map;
/** /**
* 认证服务远程调用 * 认证服务远程调用
*/ */
@FeignClient(value = "mall-shop") @FeignClient("mall-shop")
public interface ShopService { public interface ShopService {
@PostMapping(value = "/admin/shop/shopController/deletePlantformUserByUid") @PostMapping(value = "/admin/shop/shopController/deletePlantformUserByUid")
@ -323,31 +326,5 @@ public interface ShopService {
BigDecimal getOrderShippingFee(@RequestParam(name = "order_id") String order_id); BigDecimal getOrderShippingFee(@RequestParam(name = "order_id") String order_id);
/**
* 获取店铺的内部运费 shopping_fee_inner 远程调用用途
*
* @param order_id
* @return
*/
@ApiOperation(value = "获取店铺的内部运费 shopping_fee_inner", notes = "获取店铺的内部运费 shopping_fee_inner (远程调用用途)")
@RequestMapping(value = "/admin/shop/shop-store-info/shopping-fee-inner", method = RequestMethod.POST)
Integer storeShoppingFeeInner(@RequestParam(name = "order_id") String order_id);
@GetMapping(value = "/admin/shop/shop-store-employee-rights-base/queryByRightsIds")
List<ShopStoreEmployeeRightsBase> queryByRightsIds(@RequestParam(name = "rights_ids") String rights_ids);
@PostMapping(value = "/admin/shop/shop-store-member/saveShopStoreMember")
ShopStoreMember saveShopStoreMember(@RequestBody ShopStoreMember shopStoreMember);
@PostMapping(value = "/admin/shop/shop-store-member/findShopStoreMemberList")
List<ShopStoreMember> findShopStoreMemberList(@RequestBody ShopStoreMember shopStoreMember);
@PostMapping(value = "/admin/shop/shop-store-member-lever/saveShopStoreMemberLevel")
CommonResult saveShopStoreMemberLevel(@RequestBody ShopStoreMemberLevel shopStoreMemberLevel);
@PostMapping(value = "/admin/shop/shop-store-member-lever/findShopStoreMemberLevelList")
List<ShopStoreMemberLevel> findShopStoreMemberLevelList(@RequestBody ShopStoreMemberLevel shopStoreMemberLevel);
} }

View File

@ -53,7 +53,7 @@ public class AccountBaseUserLevel implements Serializable {
private Integer user_level_fans_team; private Integer user_level_fans_team;
@ApiModelProperty(value = "累计消费") @ApiModelProperty(value = "累计消费")
private BigDecimal user_level_spend; private Integer user_level_spend;
@ApiModelProperty(value = "升级产品SPU编号(DOT)") @ApiModelProperty(value = "升级产品SPU编号(DOT)")
private String user_level_product_id; private String user_level_product_id;

View File

@ -101,17 +101,11 @@ public class AccountUserBindConnect implements Serializable {
@ApiModelProperty(value = "新增时间") @ApiModelProperty(value = "新增时间")
private Date created_at; private Date created_at;
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
private Date updated_at; private Date updated_at;
@ApiModelProperty(value = "允许通知的消息通知模板id") @ApiModelProperty(value = "允许通知的消息通知模板id")
private String bind_tmpl; private String bind_tmpl;
@ApiModelProperty(value = "剩余订阅次数")
private Integer send_number;
@ApiModelProperty(value = "(商家的)代理商的邀请码")
private String invite_code;
} }

View File

@ -1,7 +1,6 @@
package com.suisung.mall.common.modules.account; package com.suisung.mall.common.modules.account;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.suisung.mall.common.annotation.OssMedia; import com.suisung.mall.common.annotation.OssMedia;
@ -120,14 +119,5 @@ public class AccountUserInfo implements Serializable {
@ApiModelProperty(value = "渠道编码") @ApiModelProperty(value = "渠道编码")
private Integer ucc_id; private Integer ucc_id;
/**
* 同步会员到店铺会员与消息队列UserLevelTO关联
*/
@ApiModelProperty(value = "店铺id")
@TableField(exist = false)
private Integer store_id;
@ApiModelProperty(value = "店铺名称")
@TableField(exist = false)
private String store_name;
} }

View File

@ -56,20 +56,8 @@ public class ShopActivityCutprice implements Serializable {
@ApiModelProperty(value = "砍价人数") @ApiModelProperty(value = "砍价人数")
private Integer ac_num; private Integer ac_num;
@ApiModelProperty(value = "砍价过期时间戳")
private Long expired_at;
@ApiModelProperty(value = "用户砍价订单状态1-砍价已完成下单2-砍价未下单已取消3-砍价助力进行中4-砍价过期失效6-砍价助力已完成待下单;")
private Integer state;
@Version @Version
@ApiModelProperty(value = "乐观锁") @ApiModelProperty(value = "乐观锁")
private Integer version; private Integer version;
@ApiModelProperty(value = "更新时间")
private Date updated_at;
@ApiModelProperty(value = "大转盘次数")
private Integer lottery_num;
} }

View File

@ -1,6 +1,8 @@
package com.suisung.mall.common.modules.activity; package com.suisung.mall.common.modules.activity;
import com.baomidou.mybatisplus.annotation.*; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -50,14 +52,5 @@ public class ShopActivityCutpriceHistory implements Serializable {
@ApiModelProperty(value = "砍价编号") @ApiModelProperty(value = "砍价编号")
private Integer ac_id; private Integer ac_id;
@ApiModelProperty(value = "摇骰子次数")
private Integer lottery_num;
@ApiModelProperty(value = "骰子点数")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private Integer alh_point;
@ApiModelProperty(value = "转盘前砍掉的价格")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private BigDecimal ach_price_pre;
} }

View File

@ -1,7 +1,6 @@
package com.suisung.mall.common.modules.admin; package com.suisung.mall.common.modules.admin;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -12,7 +11,6 @@ import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* <p> * <p>
@ -107,7 +105,5 @@ public class AdminBaseMenu implements Serializable {
@ApiModelProperty(value = "允许关闭(BOOL):0-禁止;1-允许") @ApiModelProperty(value = "允许关闭(BOOL):0-禁止;1-允许")
private Integer menu_close; private Integer menu_close;
@TableField(exist = false)
@ApiModelProperty(value = "节点子集")
private List<AdminBaseMenu> children;
} }

View File

@ -1,7 +1,6 @@
package com.suisung.mall.common.modules.admin; package com.suisung.mall.common.modules.admin;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -11,7 +10,6 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map;
/** /**
* <p> * <p>
@ -63,11 +61,5 @@ public class AdminBaseProtocol implements Serializable {
@ApiModelProperty(value = "请求地址") @ApiModelProperty(value = "请求地址")
private String path; private String path;
//平台权限id和名称
@TableField(exist = false)
private Map<Integer,String> adminRightBaseMap;
//店铺权限id和名称
@TableField(exist = false)
private Map<Integer,String> shopStoreEmployeeRightsBaseMap;
} }

View File

@ -1,7 +1,6 @@
package com.suisung.mall.common.modules.admin; package com.suisung.mall.common.modules.admin;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -11,7 +10,6 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* <p> * <p>
@ -49,7 +47,5 @@ public class AdminRightsBase implements Serializable {
@ApiModelProperty(value = "功能开启:跟设置config_key") @ApiModelProperty(value = "功能开启:跟设置config_key")
private String menu_func; private String menu_func;
@ApiModelProperty(value = "节点子集")
@TableField(exist = false)
private List<AdminRightsBase> children;
} }

View File

@ -9,7 +9,6 @@
package com.suisung.mall.common.modules.esign; package com.suisung.mall.common.modules.esign;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -55,18 +54,12 @@ public class EsignPlatformInfo implements Serializable {
@ApiModelProperty(value = "平台方营业执照上的经营内容") @ApiModelProperty(value = "平台方营业执照上的经营内容")
private String license_content; private String license_content;
@ApiModelProperty(value = "代理商执照的省/市/区,如:广东省/深圳市/福田区") @ApiModelProperty(value = "代理商的省/市/区,如:广东省/深圳市/福田区")
private String license_area; private String license_area;
@ApiModelProperty(value = "代理商营业执照的省id/市id/区id11000/11100/11101") @ApiModelProperty(value = "代理商的省id/市id/区id11000/11100/11101")
private String license_district_id; private String license_district_id;
@ApiModelProperty(value = "期望代理的省/市/区,如:广东省/深圳市/福田区")
private String agent_area;
@ApiModelProperty(value = "期望代理的省id/市id/区id11000/11100/11101")
private String agent_district_id;
@ApiModelProperty(value = "平台方营业执照公司详细地址") @ApiModelProperty(value = "平台方营业执照公司详细地址")
private String license_address; private String license_address;
@ -121,10 +114,6 @@ public class EsignPlatformInfo implements Serializable {
@ApiModelProperty(value = "邀请码,后期跟收益有关") @ApiModelProperty(value = "邀请码,后期跟收益有关")
private String invite_code; private String invite_code;
@TableField(exist = false)
@ApiModelProperty(value = "代理商邀请链接")
private String invite_url;
@ApiModelProperty(value = "县级市代理商设定的配送费(单位:分)") @ApiModelProperty(value = "县级市代理商设定的配送费(单位:分)")
private Integer shipping_fee; private Integer shipping_fee;
@ -134,12 +123,9 @@ public class EsignPlatformInfo implements Serializable {
@ApiModelProperty(value = "分账比例值,取值范围:[0.01,1.00]") @ApiModelProperty(value = "分账比例值,取值范围:[0.01,1.00]")
private BigDecimal split_ratio; private BigDecimal split_ratio;
@ApiModelProperty(value = "状态:0-未申请过1-已审核通过2-审核未通过3-待审中") @ApiModelProperty(value = "记录状态:1-有效2-无效")
private Integer status; private Integer status;
@ApiModelProperty(value = "审核代理商备注")
private String remark;
@ApiModelProperty(value = "创建人用户ID") @ApiModelProperty(value = "创建人用户ID")
private String created_by; private String created_by;

View File

@ -155,9 +155,6 @@ public class LklOrderDraw {
@ApiModelProperty(value = "异步通知地址", example = "https://api.example.com/notify") @ApiModelProperty(value = "异步通知地址", example = "https://api.example.com/notify")
private String notify_url; private String notify_url;
@ApiModelProperty(value = "接口请求报文")
private String lkl_req;
/** /**
* 异步通知返回的JSON数据 * 异步通知返回的JSON数据
*/ */

View File

@ -94,9 +94,6 @@ public class LklOrderSeparate {
@ApiModelProperty(value = "处理状态ACCEPTED-已受理, PROCESSING-处理中, FAIL-失败, SUCCESS-成功") @ApiModelProperty(value = "处理状态ACCEPTED-已受理, PROCESSING-处理中, FAIL-失败, SUCCESS-成功")
private String final_status; private String final_status;
@ApiModelProperty(value = "接口请求报文")
private String lkl_req;
@ApiModelProperty(value = "异步通知数据") @ApiModelProperty(value = "异步通知数据")
private String notify_resp; private String notify_resp;

View File

@ -1,42 +0,0 @@
package com.suisung.mall.common.modules.lakala;
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 lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 拉卡拉确认收货通知数据日志
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("lkl_receive_notify_log")
@ApiModel(value = "拉卡拉确认收货通知数据日志", description = "拉卡拉确认收货通知数据日志")
public class LklReceiveNotifyLog {
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "自增 Id", example = "1")
private Long id;
@ApiModelProperty(value = "订单Id")
private String orderId = "";
@ApiModelProperty(value = "通知 JSON 响应数据")
private String respJson;
@ApiModelProperty(value = "使用状态1-被使用过2-未被使用;")
private Integer status = 2;
@ApiModelProperty(value = "创建时间")
private Date createdAt;
@ApiModelProperty(value = "更新时间")
private Date updatedAt;
}

View File

@ -11,7 +11,6 @@ import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
@Data @Data
@Builder @Builder
@ -21,7 +20,7 @@ import java.util.List;
@ApiModel(value = "商品库的商品", description = "商品库的商品表") @ApiModel(value = "商品库的商品", description = "商品库的商品表")
public class LibraryProduct implements Serializable { public class LibraryProduct implements Serializable {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.INPUT)
@ApiModelProperty(value = "商品ID", example = "1001") @ApiModelProperty(value = "商品ID", example = "1001")
private Long id; private Long id;
@ -29,11 +28,7 @@ public class LibraryProduct implements Serializable {
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY) @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private String name; private String name;
@ApiModelProperty(value = "商品简称,作为匹配关键字", example = "小米12 Pro")
private String sname;
@ApiModelProperty(value = "商品标题", example = "小米12 Pro") @ApiModelProperty(value = "商品标题", example = "小米12 Pro")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private String title; private String title;
@ApiModelProperty(value = "条形码/Barcode", example = "6923450657713") @ApiModelProperty(value = "条形码/Barcode", example = "6923450657713")
@ -41,11 +36,9 @@ public class LibraryProduct implements Serializable {
private String barcode; private String barcode;
@ApiModelProperty(value = "第一级分类", example = "生鲜") @ApiModelProperty(value = "第一级分类", example = "生鲜")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private String category_1st; private String category_1st;
@ApiModelProperty(value = "第二级分类", example = "牛肉") @ApiModelProperty(value = "第二级分类", example = "牛肉")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private String category_2nd; private String category_2nd;
@ApiModelProperty(value = "商品分类", example = "牛肉") @ApiModelProperty(value = "商品分类", example = "牛肉")
@ -69,6 +62,7 @@ public class LibraryProduct implements Serializable {
@ApiModelProperty(value = "商品卖点", example = "绿色有机") @ApiModelProperty(value = "商品卖点", example = "绿色有机")
private String selling_point; private String selling_point;
@ApiModelProperty(value = "商品介绍", example = "商品介绍") @ApiModelProperty(value = "商品介绍", example = "商品介绍")
private String intro; private String intro;
@ -98,11 +92,4 @@ public class LibraryProduct implements Serializable {
@ApiModelProperty(value = "更新时间", example = "2023-01-02 15:30:00") @ApiModelProperty(value = "更新时间", example = "2023-01-02 15:30:00")
@TableField(value = "updated_at") @TableField(value = "updated_at")
private Date updatedAt; private Date updatedAt;
// @ApiModelProperty(value = "来源ID", example = "vendor_001")
// @TableField(value = "product_short_name", updateStrategy = FieldStrategy.NOT_EMPTY)
// private String productShortName;
@TableField(exist = false)
private List<LibraryProductImage> product_image_list;
} }

View File

@ -9,7 +9,6 @@
package com.suisung.mall.common.modules.library; package com.suisung.mall.common.modules.library;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -35,16 +34,13 @@ public class LibraryProductImage implements Serializable {
private Long id; private Long id;
@ApiModelProperty(value = "商品ID", position = 2, example = "1001") @ApiModelProperty(value = "商品ID", position = 2, example = "1001")
@TableField(value = "product_id")
private Long productId; private Long productId;
@ApiModelProperty(value = "图片地址", position = 3, @ApiModelProperty(value = "图片地址", position = 3,
example = "/media/images/product/1001.jpg") example = "/media/images/product/1001.jpg")
@TableField(value = "image_url")
private String imageUrl; private String imageUrl;
@ApiModelProperty(value = "是否主图 1-主图 0-副图", position = 4, example = "1") @ApiModelProperty(value = "是否主图 1-主图 0-副图", position = 4, example = "1")
@TableField(value = "is_main")
private Boolean isMain; private Boolean isMain;
@ApiModelProperty(value = "排序值,越小越前面", position = 5, example = "10") @ApiModelProperty(value = "排序值,越小越前面", position = 5, example = "10")
@ -54,10 +50,8 @@ public class LibraryProductImage implements Serializable {
private Integer status; private Integer status;
@ApiModelProperty(value = "创建时间", position = 7, example = "2023-01-01 12:30:00") @ApiModelProperty(value = "创建时间", position = 7, example = "2023-01-01 12:30:00")
@TableField(value = "created_at")
private Date createdAt; private Date createdAt;
@ApiModelProperty(value = "更新时间", position = 8, example = "2023-01-01 13:15:00") @ApiModelProperty(value = "更新时间", position = 8, example = "2023-01-01 13:15:00")
@TableField(value = "updated_at")
private Date updatedAt; private Date updatedAt;
} }

View File

@ -67,9 +67,6 @@ public class ShopOrderBase implements Serializable {
@ApiModelProperty(value = "订单状态(LIST):2011-待订单审核;2013-待财务审核;2020-待配货/待出库审核;2030-待发货;2040-已发货/待收货确认;2060-已完成/已签收;2070-已取消/已作废;") @ApiModelProperty(value = "订单状态(LIST):2011-待订单审核;2013-待财务审核;2020-待配货/待出库审核;2030-待发货;2040-已发货/待收货确认;2060-已完成/已签收;2070-已取消/已作废;")
private Integer order_state_id; private Integer order_state_id;
@ApiModelProperty(value = "异常订单操作流程,0-可操作自行发货1-可操作订单完成2-订单完成不可操作")
private String operate_flag;
// @ApiModelProperty(value = "easy支付id存储") // @ApiModelProperty(value = "easy支付id存储")
// private String easy_pay_id; // private String easy_pay_id;

View File

@ -1,53 +0,0 @@
package com.suisung.mall.common.modules.order;
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 lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 预约订单任务表
* </p>
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("shop_order_booking")
@ApiModel(value = "ShopOrderBooking对象", description = "预约订单任务表")
public class ShopOrderBooking implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增Id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "订单Id")
private String order_id;
@ApiModelProperty(value = "Redis 任务键")
private String task_key;
@ApiModelProperty(value = "执行时间戳(秒)")
private Long run_at;
@ApiModelProperty(value = "预约送达时间戳(秒)")
private Long booking_at;
@ApiModelProperty(value = "状态1-有效任务待执行2-无效(任务已执行);")
private Integer status = 1;
@ApiModelProperty(value = "创建时间")
private Date created_at;
@ApiModelProperty(value = "更改时间")
private Date updated_at;
}

View File

@ -75,7 +75,7 @@ public class ShopOrderInfo implements Serializable {
@ApiModelProperty(value = "下单时间:检索使用") @ApiModelProperty(value = "下单时间:检索使用")
private Long order_time; private Long order_time;
@ApiModelProperty(value = "当前状态的处理时间,一般是确认收货时间") @ApiModelProperty(value = "当前状态的处理时间")
private Long order_deal_time; private Long order_deal_time;
@ApiModelProperty(value = "买家删除(BOOL): 1-是; 0-否") @ApiModelProperty(value = "买家删除(BOOL): 1-是; 0-否")
@ -204,18 +204,6 @@ public class ShopOrderInfo implements Serializable {
@ApiModelProperty(value = "拣货完成时间戳") @ApiModelProperty(value = "拣货完成时间戳")
private Long order_picked_time; private Long order_picked_time;
@ApiModelProperty(value = "订单配送预约状态1-立即配送2-预约配送")
private Integer booking_state;
@ApiModelProperty(value = "预约送达起始时间格式如yyyy-MM-dd HH:mm:ss")
private Date booking_begin_time;
@ApiModelProperty(value = "预约送达截止时间格式如yyyy-MM-dd HH:mm:ss")
private Date booking_end_time;
@ApiModelProperty(value = "预订单到达时间戳(秒)")
private Long booking_at;
@ApiModelProperty(value = "新建时间") @ApiModelProperty(value = "新建时间")
private Date created_at; private Date created_at;

View File

@ -45,13 +45,10 @@ public class ShopOrderItem implements Serializable {
@ApiModelProperty(value = "产品编号") @ApiModelProperty(value = "产品编号")
private Long product_id; private Long product_id;
@ApiModelProperty(value = "货品编号") @ApiModelProperty(value = "货品编号")
private Long item_id; private Long item_id;
@ApiModelProperty(value = "产品条形码(唯一码)")
private String item_barcode;
@ApiModelProperty(value = "商品名称") @ApiModelProperty(value = "商品名称")
private String item_name; private String item_name;

View File

@ -42,9 +42,6 @@ public class MchOrderInfoDTO implements Serializable {
// 物流轨迹信息(物流已发货的才有数据) // 物流轨迹信息(物流已发货的才有数据)
@ApiModelProperty(value = "物流轨迹信息") @ApiModelProperty(value = "物流轨迹信息")
Map<String, Object> logistics_traces; Map<String, Object> logistics_traces;
// 退款订单详情
MchReturnOrderDetailDTO return_order_detail;
// 订单信息 // 订单信息
@ApiModelProperty(value = "订单编号") @ApiModelProperty(value = "订单编号")
@ -96,14 +93,4 @@ public class MchOrderInfoDTO implements Serializable {
private Integer distance; private Integer distance;
@ApiModelProperty(value = "是否禁止退款1-是2-否;") @ApiModelProperty(value = "是否禁止退款1-是2-否;")
private Integer is_deny_return; private Integer is_deny_return;
@ApiModelProperty(value = "异常订单操作流程,0-可操作自行发货1-可操作订单完成2-订单完成不可操作")
private String operate_flag;
@ApiModelProperty(value = "订单配送预约状态1-立即配送2-预约配送")
private Integer booking_state;
@ApiModelProperty(value = "预约送达起始时间格式如yyyy-MM-dd HH:mm:ss")
private Date booking_begin_time;
@ApiModelProperty(value = "预约送达截止时间格式如yyyy-MM-dd HH:mm:ss")
private Date booking_end_time;
@ApiModelProperty(value = "预订单到达时间戳(秒)")
private Long booking_at;
} }

View File

@ -1,193 +0,0 @@
/*
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package com.suisung.mall.common.modules.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "退款单详情主表实体类 对象", description = "商家版退款单详情主表实体类")
public class MchReturnOrderDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "退货单编号")
private String return_id;
@ApiModelProperty(value = "订单编号")
private String order_id;
@ApiModelProperty(value = "买家用户ID")
private Integer buyer_user_id;
@ApiModelProperty(value = "买家店铺ID")
private Integer buyer_store_id;
@ApiModelProperty(value = "退货原因ID")
private Integer return_reason_id;
@ApiModelProperty(value = "退货原因名称")
private String return_reason_name;
@ApiModelProperty(value = "买家退货留言")
private String return_buyer_message;
@ApiModelProperty(value = "店铺ID")
private Integer store_id;
@ApiModelProperty(value = "退货退款金额")
private BigDecimal return_refund_amount;
@ApiModelProperty(value = "退货佣金费用")
private BigDecimal return_commision_fee;
@ApiModelProperty(value = "退货状态ID")
private Integer return_state_id;
@ApiModelProperty(value = "退货状态名称")
private String return_state_name;
@ApiModelProperty(value = "退货联系电话")
private String return_tel;
@ApiModelProperty(value = "退货年份")
private Integer return_year;
@ApiModelProperty(value = "退货月份")
private Integer return_month;
@ApiModelProperty(value = "退货日期")
private Integer return_day;
@ApiModelProperty(value = "退货地址")
private String return_addr;
@ApiModelProperty(value = "退货联系手机")
private Long return_mobile;
@ApiModelProperty(value = "退货联系电话")
private String return_telephone;
@ApiModelProperty(value = "退货联系人姓名")
private String return_contact_name;
@ApiModelProperty(value = "分站ID")
private Integer subsite_id;
@ApiModelProperty(value = "退货申请时间")
private Date return_add_time;
@ApiModelProperty(value = "退货完成时间")
private Date return_finish_time;
@ApiModelProperty(value = "是否已退款(ENUM): 0-未退款; 1-已退款")
private Integer return_is_paid;
@ApiModelProperty(value = "退款渠道代码")
private String return_channel_code;
@ApiModelProperty(value = "退款渠道交易ID")
private String return_channel_trans_id;
@ApiModelProperty(value = "退款渠道处理时间")
private Date return_channel_time;
@ApiModelProperty(value = "退款渠道状态(ENUM): 0-待退; 1-已退; 2-异常")
private Integer return_channel_flag;
@ApiModelProperty(value = "支付交易号")
private String deposit_trade_no;
@ApiModelProperty(value = "支付渠道ID")
private Integer payment_channel_id;
@ApiModelProperty(value = "商家处理留言")
private String return_store_message;
@ApiModelProperty(value = "平台退货状态ID")
private Integer plantform_return_state_id;
@ApiModelProperty(value = "平台退货状态名称")
private String plantform_return_state_name;
@ApiModelProperty(value = "退货类型(ENUM): 0-不用退货; 1-需要退货")
private Integer return_flag;
@ApiModelProperty(value = "申请类型(ENUM): 1-退款申请; 2-退货申请; 3-虚拟退款")
private Integer return_type;
@ApiModelProperty(value = "提交的退货退款金额")
private BigDecimal submit_return_refund_amount;
@ApiModelProperty(value = "订单商品ID列表")
private List<Long> order_item_ids;
@ApiModelProperty(value = "买家用户名")
private String buyer_user_name;
@ApiModelProperty(value = "是否有合同类型")
private Boolean contract_type_ids;
@ApiModelProperty(value = "尝试退款次数")
private Integer try_return_count;
// 收货地址相关信息
@ApiModelProperty(value = "收货省份")
private String da_province;
@ApiModelProperty(value = "收货城市")
private String da_city;
@ApiModelProperty(value = "收货区县")
private String da_county;
@ApiModelProperty(value = "收货详细地址")
private String da_address;
@ApiModelProperty(value = "收货人姓名")
private String da_name;
@ApiModelProperty(value = "收货人手机号")
private String da_mobile;
@ApiModelProperty(value = "收货人电话")
private String da_telephone;
@ApiModelProperty(value = "收货省份ID")
private Integer da_province_id;
@ApiModelProperty(value = "收货城市ID")
private Integer da_city_id;
@ApiModelProperty(value = "收货区县ID")
private Integer da_county_id;
@ApiModelProperty(value = "纬度")
private String da_latitude;
@ApiModelProperty(value = "经度")
private String da_longitude;
// 退款商品列表
@ApiModelProperty(value = "退货商品详情列表")
private List<MchReturnOrderItemDetailDTO> items;
}

View File

@ -1,106 +0,0 @@
/*
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package com.suisung.mall.common.modules.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "退款单商品详情实体对象", description = "退款单商品详情实体类")
public class MchReturnOrderItemDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "退货商品项ID")
private Long order_return_item_id;
@ApiModelProperty(value = "退货单编号")
private String return_id;
@ApiModelProperty(value = "订单商品项ID")
private Long order_item_id;
@ApiModelProperty(value = "订单编号")
private String order_id;
@ApiModelProperty(value = "退货商品数量")
private Integer return_item_num;
@ApiModelProperty(value = "退货商品小计金额")
private BigDecimal return_item_subtotal;
@ApiModelProperty(value = "退货原因ID")
private Integer return_reason_id;
@ApiModelProperty(value = "退货商品备注")
private String return_item_note;
@ApiModelProperty(value = "退货商品图片")
private String return_item_image;
@ApiModelProperty(value = "退货商品状态ID")
private Integer return_state_id;
@ApiModelProperty(value = "退货商品佣金费用")
private BigDecimal return_item_commision_fee;
@ApiModelProperty(value = "退货商品商家备注")
private String return_item_store_remark;
// 关联的订单商品信息
@ApiModelProperty(value = "商品名称")
private String item_name;
@ApiModelProperty(value = "产品名称")
private String product_name;
@ApiModelProperty(value = "货品ID")
private Long item_id;
@ApiModelProperty(value = "订单商品图片")
private String order_item_image;
@ApiModelProperty(value = "单位ID")
private Integer unit_id;
@ApiModelProperty(value = "单位名称")
private String unit_name;
@ApiModelProperty(value = "订单商品单价")
private BigDecimal order_item_unit_price;
@ApiModelProperty(value = "订单商品数量")
private Integer order_item_quantity;
@ApiModelProperty(value = "订单商品总金额")
private BigDecimal order_item_amount;
@ApiModelProperty(value = "订单商品总重量")
private BigDecimal order_item_weight_total;
@ApiModelProperty(value = "订单商品备注")
private String order_item_note;
@ApiModelProperty(value = "商品编号")
private String item_number;
@ApiModelProperty(value = "产品编号")
private String product_number;
}

View File

@ -1,6 +1,8 @@
package com.suisung.mall.common.modules.page; package com.suisung.mall.common.modules.page;
import com.baomidou.mybatisplus.annotation.*; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -65,22 +67,5 @@ public class ShopPageApp implements Serializable {
@ApiModelProperty(value = "是否使用(BOOL):0-否;1-是") @ApiModelProperty(value = "是否使用(BOOL):0-否;1-是")
private Integer app_is_use; private Integer app_is_use;
@ApiModelProperty(value = "模板编号,用于模板市场")
private Integer app_template_id;
@ApiModelProperty(value = "是否收费0否1是")
private String is_pay;
@ApiModelProperty(value = "是否发布0否1是")
private String is_pulish;
@TableField(exist = false)
private String tpl_label;
@ApiModelProperty(value = "市场展示图片,[{'imageUrl:'','description':''}")
private String app_market_images;
@ApiModelProperty(value = "行业类别1超市,2数码家电, 3水果生鲜, 4烘培饮品, 5社区团购, 6时尚美妆, 7婴儿服饰, 8家居, 9汽车, 10酒店旅游, 11鲜花绿植, 12医药健康, 13工业五金, 14节日模板,0其他行业")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private String app_industry;
} }

View File

@ -10,7 +10,6 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* <p> * <p>
@ -136,9 +135,5 @@ public class ShopPageBase implements Serializable {
@ApiModelProperty(value = "信息发布(BOOL):0-否;1-是") @ApiModelProperty(value = "信息发布(BOOL):0-否;1-是")
private Integer page_message; private Integer page_message;
@ApiModelProperty(value = "创建时间")
private Date created_at;
@ApiModelProperty(value = "最后更新时间")
private Date updated_at;
} }

View File

@ -1,6 +1,8 @@
package com.suisung.mall.common.modules.product; package com.suisung.mall.common.modules.product;
import com.baomidou.mybatisplus.annotation.*; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -42,12 +44,10 @@ public class ShopProductImage implements Serializable {
@ApiModelProperty(value = "规格值") @ApiModelProperty(value = "规格值")
private String color_name; private String color_name;
@ApiModelProperty(value = "商品主图,0是编辑空图片1是同步空图片") @ApiModelProperty(value = "商品主图")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private String item_image_default; private String item_image_default;
@ApiModelProperty(value = "副图(DOT)") @ApiModelProperty(value = "副图(DOT)")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private String item_image_other; private String item_image_other;
@ApiModelProperty(value = "DIY背景") @ApiModelProperty(value = "DIY背景")

View File

@ -10,8 +10,6 @@ import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import static com.baomidou.mybatisplus.annotation.FieldStrategy.NOT_EMPTY;
/** /**
* <p> * <p>
* 产品索引表-不读取数据只读主键 * 产品索引表-不读取数据只读主键
@ -35,11 +33,10 @@ public class ShopProductIndex implements Serializable {
private Long product_id; private Long product_id;
@ApiModelProperty(value = "产品名称:店铺平台先在对用表中检索后通过id检索,检索使用") @ApiModelProperty(value = "产品名称:店铺平台先在对用表中检索后通过id检索,检索使用")
@TableField(updateStrategy=NOT_EMPTY)
private String product_name; private String product_name;
@ApiModelProperty(value = "名称索引关键字(DOT)") @ApiModelProperty(value = "名称索引关键字(DOT)")
@TableField(updateStrategy=NOT_EMPTY)
private String product_name_index; private String product_name_index;
@ApiModelProperty(value = "店铺编号") @ApiModelProperty(value = "店铺编号")

View File

@ -56,10 +56,6 @@ public class ShopProductSpecItem implements Serializable {
@TableField(exist=false) @TableField(exist=false)
private BigDecimal itemPrice; private BigDecimal itemPrice;
@ApiModelProperty(value = "市场价")
@TableField(exist=false)
private BigDecimal marketPrice;
@ApiModelProperty(value = "切割后的库存") @ApiModelProperty(value = "切割后的库存")
@TableField(exist=false) @TableField(exist=false)
private BigDecimal itemQuantity; private BigDecimal itemQuantity;

View File

@ -1,53 +0,0 @@
package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 砍价抽奖历史记录DTO
*/
@Data
@TableName("shop_activity_cut_lottery_history")
@ApiModel(value = "ShopActivityCutLotteryHistory", description = "砍价大转盘抽奖历史记录")
public class ShopActivityCutLotteryHistory implements Serializable{
private static final long serialVersionUID = 1L;
@TableId(value = "alh_id", type = IdType.AUTO)
@ApiModelProperty(value = "用户中奖编号", example = "1")
private Long alhId;
@TableField(value ="user_id",updateStrategy = FieldStrategy.NOT_EMPTY)
@ApiModelProperty(value = "用户编号", example = "10001")
private Integer userId;
@TableField(value ="activity_id",updateStrategy = FieldStrategy.NOT_EMPTY)
@ApiModelProperty(value = "活动编号", example = "20001")
private Integer activityId;
@TableField(value ="alh_item_id",updateStrategy = FieldStrategy.NOT_EMPTY)
@ApiModelProperty(value = "抽奖物品编号", example = "30001")
private Integer alhItemId;
@TableField(value ="alh_item_name",updateStrategy = FieldStrategy.NOT_EMPTY)
@ApiModelProperty(value = "抽奖物品名称", example = "iPhone 15 Pro")
private String alhItemName;
@TableField(value = "alh_award_flag",updateStrategy = FieldStrategy.NOT_EMPTY)
@ApiModelProperty(value = "是否中奖:0-未中奖;1-中奖", example = "1")
private Boolean alhAwardFlag;
@TableField(value ="create_time")
@ApiModelProperty(value = "创建时间", example = "2023-12-01 10:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@TableField("update_time")
@ApiModelProperty(value = "更新时间", example = "2023-12-01 10:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -9,7 +9,6 @@
package com.suisung.mall.common.modules.store; package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -97,9 +96,6 @@ public class ShopMchEntry implements Serializable {
@ApiModelProperty(value = "入驻商家店铺门面环境图片的存储路径", required = true) @ApiModelProperty(value = "入驻商家店铺门面环境图片的存储路径", required = true)
private String environment_image; private String environment_image;
@ApiModelProperty(value = "收银台照片", required = true)
private String checkstand_image;
@ApiModelProperty(value = "入驻主体类型企业或个人1-企业2-个人;", required = true) @ApiModelProperty(value = "入驻主体类型企业或个人1-企业2-个人;", required = true)
private Integer entity_type; private Integer entity_type;
@ -187,9 +183,6 @@ public class ShopMchEntry implements Serializable {
@ApiModelProperty(value = "结算账户⾏号", required = true) @ApiModelProperty(value = "结算账户⾏号", required = true)
private String openning_bank_code; private String openning_bank_code;
@ApiModelProperty(value = "开户许可证(银行对公开户证明)")
private String opening_permit_image;
@ApiModelProperty(value = "结算账户清算⾏号") @ApiModelProperty(value = "结算账户清算⾏号")
private String clearing_bank_code; private String clearing_bank_code;
@ -265,13 +258,6 @@ public class ShopMchEntry implements Serializable {
@ApiModelProperty(value = "是否绑定分账接收方1-是2-否;") @ApiModelProperty(value = "是否绑定分账接收方1-是2-否;")
private Integer has_bind_receiver; private Integer has_bind_receiver;
@ApiModelProperty(value = "父入驻id总店入驻id")
private Long parent_id;
@TableField(exist = false)
@ApiModelProperty(value = "代理商邀请码")
private String invite_code;
@ApiModelProperty(value = "该商家入驻记录是否有效0:无效1:有效") @ApiModelProperty(value = "该商家入驻记录是否有效0:无效1:有效")
private Integer status; private Integer status;

View File

@ -1,70 +0,0 @@
/*
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package com.suisung.mall.common.modules.store;
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 lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("shop_mch_entry_branch")
@ApiModel(value = "shop_mch_entry_branch 实体", description = "商家分店拉卡拉商户申请数据")
public class ShopMchEntryBranch implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@TableId(value = "id", type = IdType.INPUT)
private Long id;
@ApiModelProperty(value = "拉卡拉外部(银联)商户号", required = true)
private String lkl_mer_cup_no;
@ApiModelProperty(value = "拉卡拉终端号")
private String lkl_term_no;
@ApiModelProperty(value = "审核关联号", required = true)
private String review_related_id;
@ApiModelProperty(value = "商户登录手机号")
private String login_mobile;
@ApiModelProperty(value = "分店名称")
private String store_name;
@ApiModelProperty(value = "请求拉卡拉参数")
private String lkl_req;
@ApiModelProperty(value = "拉卡拉响应数据")
private String lkl_reps;
@ApiModelProperty(value = "拉卡拉通知响应数据")
private String lkl_notify_reps;
@ApiModelProperty(value = "状态1-已成功2-审核未通过3-未处理4-待审核;")
private Integer status;
@ApiModelProperty(value = "审核状态")
private String status_text;
@ApiModelProperty(value = "商家入驻记录的创建时间")
private Date created_at;
@ApiModelProperty(value = "商家入驻记录的更新时间")
private Date updated_at;
}

View File

@ -79,9 +79,9 @@ public class ShopStoreActivityBase implements Serializable {
@TableField(updateStrategy = NOT_EMPTY) @TableField(updateStrategy = NOT_EMPTY)
private Integer activity_state; private Integer activity_state;
@ApiModelProperty(value = "活动规则(json):不检索{rule_id:{}, rule_id:{}},统一解析规则{\"requirement\":{\"buy\":{\"item\":[1,2,3],\"subtotal\":\"通过计算修正满足的条件\"}},\"rule\":[{\"total\":100,\"max_num\":1,\"item\":{\"1\":1,\"1200\":3}},{\"total\":200,\"max_num\":1,\"item\":{\"1\":1,\"1200\":3}}]}") @ApiModelProperty(value = "活动规则(json):不检索{rule_id:{}, rule_id:{}}")
@TableField(updateStrategy = NOT_EMPTY, fill = FieldFill.INSERT_UPDATE) @TableField(updateStrategy = NOT_EMPTY)
private String activity_rule = "{}"; private String activity_rule;
@ApiModelProperty(value = "参与类型(ENUM):1-免费参与;2-积分参与;3-购买参与") @ApiModelProperty(value = "参与类型(ENUM):1-免费参与;2-积分参与;3-购买参与")
@TableField(updateStrategy = NOT_EMPTY) @TableField(updateStrategy = NOT_EMPTY)
@ -119,6 +119,7 @@ public class ShopStoreActivityBase implements Serializable {
@TableField(updateStrategy = NOT_EMPTY) @TableField(updateStrategy = NOT_EMPTY)
private Integer activity_share_num; private Integer activity_share_num;
@Version
@ApiModelProperty(value = "乐观锁") @ApiModelProperty(value = "乐观锁")
private Integer version; private Integer version;
@ -126,22 +127,4 @@ public class ShopStoreActivityBase implements Serializable {
@TableField(updateStrategy = NOT_EMPTY) @TableField(updateStrategy = NOT_EMPTY)
private String flow_no; private String flow_no;
@ApiModelProperty(value = "在活动时间范围内,用户砍价有效期(小时)")
private Integer cut_hour;
@ApiModelProperty(value = "参与活动商品的总数量(个)")
private Integer product_count;
@ApiModelProperty(value = "规则配置")
@TableField(updateStrategy = NOT_EMPTY)
private String lucky_turn;
@ApiModelProperty(value = "每人限购,0为不限购")
private Integer person_limit;
@ApiModelProperty(value = "每单限购,0为不限购")
private Integer order_limit;
@ApiModelProperty(value = "是否店铺新用户专享1是0否")
private String is_new_person_shop;
} }

View File

@ -80,12 +80,9 @@ public class ShopStoreBase implements Serializable {
@ApiModelProperty(value = "店铃声开关1-开启2-关闭;") @ApiModelProperty(value = "店铃声开关1-开启2-关闭;")
private Integer ringtone_is_enable; private Integer ringtone_is_enable;
@ApiModelProperty(value = "店铺营业状态1-开业营业中且在营业时间内12-开业打烊中但在营业时间外2-停业中3-开业(或活动)筹备中") @ApiModelProperty(value = "店铺营业状态1-营业中2-已打烊")
private Integer store_biz_state; private Integer store_biz_state;
@ApiModelProperty(value = "开业(活动)筹备日期 yyyy-MM-dd")
private Date store_biz_opening_date;
@ApiModelProperty(value = "上级店铺编号:创建店铺决定,所属分销商-不可更改! 佣金公平性考虑") @ApiModelProperty(value = "上级店铺编号:创建店铺决定,所属分销商-不可更改! 佣金公平性考虑")
private Integer shop_parent_id; private Integer shop_parent_id;
@ -141,9 +138,6 @@ public class ShopStoreBase implements Serializable {
@ApiModelProperty(value = "店铺统一的打包费, 0-10元范围") @ApiModelProperty(value = "店铺统一的打包费, 0-10元范围")
private BigDecimal packing_fee; private BigDecimal packing_fee;
@ApiModelProperty(value = "分店所属总店 Id一般分店有值总店为0")
private Integer parent_id;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "新增时间") @ApiModelProperty(value = "新增时间")

View File

@ -1,7 +1,6 @@
package com.suisung.mall.common.modules.store; package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -11,7 +10,6 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* <p> * <p>
@ -49,7 +47,5 @@ public class ShopStoreEmployeeRightsBase implements Serializable {
@ApiModelProperty(value = "功能开启:跟设置config_key") @ApiModelProperty(value = "功能开启:跟设置config_key")
private String menu_func; private String menu_func;
@ApiModelProperty(value = "节点子集")
@TableField(exist = false)
private List<ShopStoreEmployeeRightsBase> children;
} }

View File

@ -3,13 +3,11 @@ package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -123,21 +121,5 @@ public class ShopStoreInfo implements Serializable {
@ApiModelProperty(value = "线下买单折扣:10代表原价") @ApiModelProperty(value = "线下买单折扣:10代表原价")
private BigDecimal store_discount; private BigDecimal store_discount;
@ApiModelProperty(value = "店铺内部运费单位0-使用平台的内部运费;>0 使用店铺的内部运费")
private Integer shopping_fee_inner;
@ApiModelProperty(value = "是否自配送1-是2-否;")
private Integer is_delivery_self;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "新增时间")
private Date created_at;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "最后更新时间")
private Date updated_at;
} }

View File

@ -1,14 +1,15 @@
package com.suisung.mall.common.modules.store; package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Data @Data
@ -16,47 +17,38 @@ import java.util.Date;
@Accessors(chain = true) @Accessors(chain = true)
@TableName("shop_store_member") @TableName("shop_store_member")
@ApiModel(value = "ShopStoreMember", description = "店铺会员表") @ApiModel(value = "ShopStoreMember", description = "店铺会员表")
public class ShopStoreMember implements Serializable { public class ShopStoreMember {
@TableId(value ="store_member_id", type = IdType.AUTO) @TableId(value = "store_member_id", type = IdType.AUTO)
@ApiModelProperty(value = "店铺会员ID", example = "10001") @ApiModelProperty(value = "店铺会员ID", example = "10001")
private Long store_member_id; private Integer storeMemberId;
@ApiModelProperty(value = "用户ID", example = "20001") @ApiModelProperty(value = "用户ID", example = "20001")
@TableField(value = "user_id")
private Integer userId; private Integer userId;
@ApiModelProperty(value = "店铺ID", example = "30001") @ApiModelProperty(value = "店铺ID", example = "30001")
@TableField(value = "store_id")
private Integer storeId; private Integer storeId;
@ApiModelProperty(value = "用户名")
@TableField(value = "user_account")
private String userAccount;
@ApiModelProperty(value = "用户昵称")
@TableField(value = "user_nickname")
private String userNickname;
@ApiModelProperty(value = "店铺名称", example = "旗舰店") @ApiModelProperty(value = "店铺名称", example = "旗舰店")
@TableField(value = "store_name")
private String storeName; private String storeName;
@ApiModelProperty(value = "首次消费时间")
private Date firstPurchaseTime;
@ApiModelProperty(value = "累计消费金额", example = "1500.00")
private BigDecimal totalConsumption;
@ApiModelProperty(value = "最近消费时间")
private Date lastPurchaseTime;
@ApiModelProperty(value = "会员等级ID", example = "2")
private Integer memberLevelId;
@ApiModelProperty(value = "等级名称", example = "铂金会员")
private String memberLevelName;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@TableField(value = "create_time") private Date createdAt;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
@TableField(value = "update_time") private Date updatedAt;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@ApiModelProperty(value = "访问Open编号")
private String bind_openid;
@ApiModelProperty(value = "剩余订阅次数")
private Integer send_number;
@TableField(exist = false)
private ShopStoreMemberLevel shopStoreMemberLevel;
} }

View File

@ -1,14 +1,14 @@
package com.suisung.mall.common.modules.store; package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -17,74 +17,26 @@ import java.util.Date;
@Accessors(chain = true) @Accessors(chain = true)
@TableName("shop_store_member_level") @TableName("shop_store_member_level")
@ApiModel(value = "ShopStoreMemberLevel", description = "店铺会员等级表") @ApiModel(value = "ShopStoreMemberLevel", description = "店铺会员等级表")
public class ShopStoreMemberLevel implements Serializable { public class ShopStoreMemberLevel {
private static final long serialVersionUID = 1L; @TableId(value = "user_level_id", type = IdType.AUTO)
@TableId(value = "store_member_level_id", type = IdType.AUTO)
@ApiModelProperty(value = "主表id", example = "1")
private Integer store_member_level_id;
@ApiModelProperty(value = "等级编号", example = "1") @ApiModelProperty(value = "等级编号", example = "1")
@TableField(value = "user_level_id")
private Integer userLevelId; private Integer userLevelId;
@ApiModelProperty(value = "等级名称", example = "黄金会员") @ApiModelProperty(value = "等级名称", example = "黄金会员")
@TableField(value = "user_level_name")
private String userLevelName; private String userLevelName;
@ApiModelProperty(value = "累计消费额度", example = "1000.00") @ApiModelProperty(value = "累计消费额度", example = "1000.00")
@TableField(value = "user_level_spend")
private BigDecimal userLevelSpend; private BigDecimal userLevelSpend;
@ApiModelProperty(value = "首次消费时间")
@TableField(value = "first_purchase_time",updateStrategy = FieldStrategy.NOT_EMPTY)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date firstPurchaseTime;
@ApiModelProperty(value = "积分")
@TableField(value = "store_points",updateStrategy = FieldStrategy.NOT_EMPTY)
private Integer store_points;
@ApiModelProperty(value = "最近消费时间")
@TableField(value = "last_purchase_time",updateStrategy = FieldStrategy.NOT_EMPTY)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastPurchaseTime;
@ApiModelProperty(value = "会员等级ID", example = "2")
@TableField(value = "member_level_id",updateStrategy = FieldStrategy.NOT_EMPTY)
private Integer memberLevelId;
@ApiModelProperty(value = "等级名称", example = "铂金会员")
@TableField(value = "member_level_name")
private String memberLevelName;
@ApiModelProperty(value = "折扣率百分比", example = "95.00") @ApiModelProperty(value = "折扣率百分比", example = "95.00")
@TableField(value = "user_level_rate")
private BigDecimal userLevelRate; private BigDecimal userLevelRate;
@ApiModelProperty(value = "等级修改时间") @ApiModelProperty(value = "等级修改时间")
@TableField(value = "user_level_time")
private Date userLevelTime; private Date userLevelTime;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@TableField(value = "create_time") private Date createdAt;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
@TableField(value = "update_time") private Date updatedAt;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@ApiModelProperty(value = "店铺id")
@TableField(value = "store_id",updateStrategy = FieldStrategy.NOT_EMPTY)
private Integer storeId;
@TableField(value = "store_member_id")
@ApiModelProperty(value = "店铺会员ID")
private Long storeMemberId;
@ApiModelProperty(value = "用户ID", example = "20001")
@TableField(value = "user_id")
private Integer userId;
} }

View File

@ -1,50 +0,0 @@
package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("shop_store_points_account")
@ApiModel(value = "ShopStorePointsAccount", description = "会员表-积分账户表")
public class ShopStorePointsAccount implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "用户ID")
@TableId(value = "user_id", type = IdType.AUTO)
private String user_id;
@ApiModelProperty(value = "店铺会员id", required = true)
@TableField("store_member_id")
private Integer storeMemberId;
@ApiModelProperty(value = "累计获得积分")
@TableField("total_points")
private Integer totalPoints;
@ApiModelProperty(value = "可用积分")
@TableField("available_points")
private Integer availablePoints;
@ApiModelProperty(value = "冻结积分")
@TableField("frozen_points")
private Integer frozenPoints;
@ApiModelProperty(value = "已过期积分")
@TableField("expired_points")
private Integer expiredPoints;
@ApiModelProperty(value = "最后更新时间", required = true)
@TableField(value = "last_update_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastUpdateTime;
}

View File

@ -1,78 +0,0 @@
package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("shop_store_points_rule")
@ApiModel(value = "ShopStorePointsRuleDTO对象", description = "会员表-积分规则表")
public class ShopStorePointsRule implements Serializable {
@ApiModelProperty(value = "规则ID")
@TableId(value = "rule_id", type = IdType.INPUT)
private String rule_id;
@ApiModelProperty(value = "规则名称", required = true)
@TableField("rule_name")
private String ruleName;
@ApiModelProperty(value = "规则类型1-获取规则 2-过期规则", required = true)
@TableField("rule_type")
private Integer ruleType;
@ApiModelProperty(value = "获取积分数值或比例")
@TableField("points_value")
private Integer pointsValue;
@ApiModelProperty(value = "过期天数(0表示永久有效)")
@TableField("expiry_days")
private Integer expiryDays;
@ApiModelProperty(value = "状态1-启用 0-禁用")
@TableField("status")
private Integer status;
@ApiModelProperty(value = "开始时间")
@TableField("start_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@ApiModelProperty(value = "结束时间")
@TableField("end_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
@ApiModelProperty(value = "新建时间")
@TableField("create_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField("update_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@ApiModelProperty(value = "店铺编号", required = true)
@TableField("store_id")
private Long storeId;
@ApiModelProperty(value = "预警通知0是表示没有预警")
@TableField("warning_day")
private Integer warningDay;
@ApiModelProperty(value = "备注")
@TableField("remark")
private String remark;
}

View File

@ -1,69 +0,0 @@
package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("shop_store_points_transaction")
@ApiModel(value = "ShopStorePointsTransactionDTO对象", description = "会员表-积分流水表")
public class ShopStorePointsTransaction implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "流水ID")
@TableId(value = "transaction_id", type = IdType.AUTO)
private String transaction_id;
@ApiModelProperty(value = "用户编号", required = true)
@TableField("user_id")
private Integer userId;
@ApiModelProperty(value = "店铺会员id", required = true)
@TableField("store_member_id")
private String storeMemberId;
@ApiModelProperty(value = "正数为获得,负数为消耗", required = true)
@TableField("points")
private Integer points;
@ApiModelProperty(value = "交易后余额", required = true)
@TableField("balance_after")
private Integer balanceAfter;
@ApiModelProperty(value = "交易类型1-获取 2-消费 3-过期 4-调整", required = true)
@TableField("transaction_type")
private Integer transactionType;
@ApiModelProperty(value = "流水时间")
@TableField("transaction_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date transactionTime;
@ApiModelProperty(value = "过期日期")
@TableField("expiry_date")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expiryDate;
@ApiModelProperty(value = "来源ID(订单ID等)")
@TableField("source_id")
private String sourceId;
@ApiModelProperty(value = "来源描述")
@TableField("source_desc")
private String sourceDesc;
@ApiModelProperty(value = "备注")
@TableField("remark")
private String remark;
}

View File

@ -43,18 +43,12 @@ public class ShopStoreSameCityTransportBase implements Serializable {
@TableId(value = "transport_base_id", type = IdType.AUTO) @TableId(value = "transport_base_id", type = IdType.AUTO)
private Long transport_base_id; private Long transport_base_id;
@ApiModelProperty(value = "平台配送费设置1-是2-否")
private Integer is_platform;
@ApiModelProperty(value = "店铺ID") @ApiModelProperty(value = "店铺ID")
private Long store_id; private Long store_id;
@ApiModelProperty(value = "顺丰同城第三方店铺ID") @ApiModelProperty(value = "顺丰同城第三方店铺ID")
private String shop_id; private String shop_id;
@ApiModelProperty(value = "顺丰平台商家Id (用于县级代理商创建店铺的)")
private String supplier_id;
@ApiModelProperty(value = "店铺主营商品分类ID") @ApiModelProperty(value = "店铺主营商品分类ID")
private Integer business_type; private Integer business_type;

View File

@ -1,73 +0,0 @@
package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("shop_store_sf_supplier")
@ApiModel(value = "顺丰地区提供商商家ID表", description = "顺丰地区提供商商家ID表")
public class ShopStoreSfSupplier {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@TableId(value = "id", type = IdType.AUTO)
@JsonProperty("id")
private Long id;
@ApiModelProperty(value = "商家Id")
@JsonProperty("supplier_id")
private String supplier_id;
@ApiModelProperty(value = "省份Id")
@JsonProperty("province_id")
private String province_id;
@ApiModelProperty(value = "省份名称")
@JsonProperty("province_name")
private String province_name;
@ApiModelProperty(value = "城市Id")
@JsonProperty("city_id")
private String city_id;
@ApiModelProperty(value = "城市名称")
@JsonProperty("city_name")
private String city_name;
@ApiModelProperty(value = "区域Id")
@JsonProperty("district_id")
private String district_id;
@ApiModelProperty(value = "区域名称")
@JsonProperty("district_name")
private String district_name;
@ApiModelProperty(value = "状态1-有效2-无效;")
@JsonProperty("status")
private Integer status;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@JsonProperty("created_at")
@ApiModelProperty(value = "新建时间")
private Date created_at;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "更新时间")
@JsonProperty("updated_at")
private Date updated_at;
}

View File

@ -81,18 +81,15 @@ public class ProductMapping implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
@TableField(value ="premium_rate",updateStrategy=NOT_EMPTY)
@ApiModelProperty("线上溢价率")
private BigDecimal premiumRate;
/** /**
* 生成唯一键productName + productNumber + storeId * 生成唯一键productName + storeId + specValue + specUnit
*/ */
public String getUniqueKey() { public String getUniqueKey() {
return String.format("%s|%s|%d", return String.format("%s|%d|%s|%s",
productName, productName,
productNumber, storeId,
storeId); specValue.stripTrailingZeros().toPlainString(),
specUnit);
} }
} }

Some files were not shown because too many files have changed in this diff Show More