Compare commits
No commits in common. "main" and "pre_20251101" have entirely different histories.
main
...
pre_202511
@ -36,19 +36,14 @@ public class DynamicTaskScheduler {
|
||||
|
||||
@PostConstruct
|
||||
public void initTasks() {
|
||||
try {
|
||||
//初始化 start
|
||||
CommentModel commentModel =sxDataService.getCommentModel();
|
||||
DataBaseInfo enabledTask = sxDataService.getDataBaseInfo(commentModel);
|
||||
executeTask(enabledTask.getDataBaseName(),commentModel);
|
||||
//初始化 end
|
||||
refreshTasks();
|
||||
// 每5分钟检查一次数据库更新
|
||||
taskScheduler.scheduleAtFixedRate(this::refreshTasks, Duration.ofHours(1));
|
||||
}catch (Exception e){
|
||||
log.info("系统异常:{}",e.getMessage());
|
||||
}
|
||||
|
||||
//初始化 start
|
||||
CommentModel commentModel =sxDataService.getCommentModel();
|
||||
DataBaseInfo enabledTask = sxDataService.getDataBaseInfo(commentModel);
|
||||
executeTask(enabledTask.getDataBaseName(),commentModel);
|
||||
//初始化 end
|
||||
refreshTasks();
|
||||
// 每5分钟检查一次数据库更新
|
||||
taskScheduler.scheduleAtFixedRate(this::refreshTasks, Duration.ofHours(1));
|
||||
}
|
||||
|
||||
public void refreshTasks() {
|
||||
@ -101,46 +96,13 @@ public class DynamicTaskScheduler {
|
||||
commentModel =sxDataService.getCommentModel();
|
||||
}
|
||||
DataBaseInfo dataBaseInfo=sxDataService.getDataBaseInfo(commentModel);
|
||||
if(dataBaseInfo==null||StringUtils.isEmpty(dataBaseInfo.getUserName())){
|
||||
return;
|
||||
}
|
||||
String refreshTime="";
|
||||
if(ObjectUtil.isNotEmpty(dataBaseInfo.getRefreshTime())){
|
||||
refreshTime=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);
|
||||
commentModel.setSyncTime(DateUtil.formatDateTime(dataBaseInfo.getRefreshTime()));
|
||||
}
|
||||
|
||||
sxDataService.syncStoreData(dataBaseInfo,commentModel);
|
||||
sxDataService.SyncBranchList(dataBaseInfo,commentModel);
|
||||
sxDataService.SyncCategory(dataBaseInfo,commentModel);
|
||||
sxDataService.SyncGoods(dataBaseInfo,commentModel);//todo 暂时同步全部的商品如果后期修改,需要增加服务器的字段
|
||||
try {
|
||||
if(ObjectUtil.isNotEmpty(dataBaseInfo.getShopGapTime())){
|
||||
@ -152,25 +114,9 @@ public class DynamicTaskScheduler {
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(dataBaseInfo.getRefreshTime())){
|
||||
commentModel.setSyncTime(refreshTime);
|
||||
}
|
||||
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);
|
||||
sxDataService.SyncVipList(dataBaseInfo,commentModel);
|
||||
sxDataService.syncAtive(dataBaseInfo,commentModel);
|
||||
sxDataService.syncAtiveShops(dataBaseInfo,commentModel);
|
||||
isRuning=false;
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ public class FileUtils {
|
||||
public static final String okEnd = "ok";//后缀
|
||||
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){
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
@ -96,21 +96,12 @@ public class FileUtils {
|
||||
* @param filePath
|
||||
*/
|
||||
public void writeFile(String filePath,String fileName,String content){
|
||||
FileWriter writer =null;
|
||||
try {
|
||||
writer = new FileWriter(filePath+pathSeparator+fileName,false);
|
||||
FileWriter writer = new FileWriter(filePath+pathSeparator+fileName);
|
||||
writer.write(content);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
log.info("文件写入成功!");
|
||||
} catch (IOException e) {
|
||||
if(writer!=null){
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
log.info("文件写入失败:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
@ -121,7 +112,7 @@ public class FileUtils {
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
public String getFileName(String syncType ,Integer page,String endFix,String fileEndFix){
|
||||
public String getFileName(String syncType ,Integer page,String endFix){
|
||||
String result="";
|
||||
switch (syncType){
|
||||
case "1":
|
||||
@ -139,7 +130,7 @@ public class FileUtils {
|
||||
default:
|
||||
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();
|
||||
File file=fileUtils.createFile("1",1);
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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_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_ACTIVE="/shop/sync/third/syncAtive";//同步活动到服务器
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
@ -75,7 +75,7 @@ public class WebController {
|
||||
//sxDataService.getAppSign();
|
||||
CommentModel commentModel= sxDataService.getCommentModel();
|
||||
DataBaseInfo dataBaseInfo=sxDataService.getDataBaseInfo(commentModel);
|
||||
if(dataBaseInfo==null||StringUtils.isEmpty(dataBaseInfo.getUserName())){
|
||||
if(dataBaseInfo==null){
|
||||
log.error("syncGoods dataBaseInfo is null");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -186,8 +186,8 @@ public class BaseDao {
|
||||
int total=0;
|
||||
Connection connection=getConnection(ip,username,password,portNumber,dataBaseName);
|
||||
try {
|
||||
String sql="select count(1) from t_pub_plan_detail_b d left join t_pub_plan_master t on " +
|
||||
" d.plan_no =t.plan_no %s";
|
||||
String sql="select count(1) from t_pub_plan_detail_b d left join t_pub_plan_master m on " +
|
||||
" d.plan_no =m.plan_no %s";
|
||||
sql=String.format(sql,where);
|
||||
log.info(sql);
|
||||
PreparedStatement ps= connection.prepareStatement(sql);
|
||||
@ -266,7 +266,7 @@ public class BaseDao {
|
||||
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;
|
||||
Connection connection=getConnection(ip,username,password,portNumber,dataBaseName);
|
||||
try {
|
||||
@ -278,18 +278,19 @@ public class BaseDao {
|
||||
" ROW_NUMBER() OVER(PARTITION BY tib.item_no ORDER BY tib.oper_date DESC) AS rn " +
|
||||
" FROM t_im_branch_stock tib\n" +
|
||||
") " +
|
||||
"SELECT count(1) " +
|
||||
// " b.*, " +
|
||||
// " ls.stock_qty, " +
|
||||
// " ls.oper_date " +
|
||||
"SELECT " +
|
||||
" b.*, " +
|
||||
" ls.stock_qty, " +
|
||||
" ls.oper_date " +
|
||||
"FROM ( " +
|
||||
" 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 " +
|
||||
"LEFT JOIN LatestStock ls ON b.item_no = ls.item_no AND ls.rn = 1 %s";
|
||||
sql=String.format(sql,where,stockOperateWhere);
|
||||
"LEFT JOIN LatestStock ls ON b.item_no = ls.item_no AND ls.rn = 1 " +
|
||||
" %s";
|
||||
sql=String.format(sql,where);
|
||||
log.info(sql);
|
||||
PreparedStatement ps= connection.prepareStatement(sql);
|
||||
ResultSet rs=ps.executeQuery();
|
||||
@ -343,8 +344,7 @@ public class BaseDao {
|
||||
return resultDto;
|
||||
}
|
||||
|
||||
public ResultDto baseFindGoodsListJoinPage(String ip, String username, String password,Integer portNumber, String dataBaseName, int pageNo, int pageSize,
|
||||
String where,String stockOperateWhere){
|
||||
public ResultDto baseFindGoodsListJoinPage(String ip, String username, String password,Integer portNumber, String dataBaseName, int pageNo, int pageSize,String where){
|
||||
Connection connection=getConnection(ip,username,password,portNumber,dataBaseName);
|
||||
int start=(pageNo-1)*pageSize+1;
|
||||
int end=pageNo*pageSize;
|
||||
@ -355,76 +355,19 @@ public class BaseDao {
|
||||
" tib.oper_date," +
|
||||
" ROW_NUMBER() OVER(PARTITION BY tib.item_no ORDER BY tib.oper_date DESC) AS rn " +
|
||||
" FROM t_im_branch_stock tib " +
|
||||
"), " +
|
||||
"PagedData As( SELECT " +
|
||||
"ROW_NUMBER() OVER (ORDER BY b.rowId) AS rowIdA, "+//-- 这里重新生成从1开始连续的行号
|
||||
") " +
|
||||
"SELECT " +
|
||||
" b.*, " +
|
||||
" ls.stock_qty, " +
|
||||
" ls.oper_date " +
|
||||
"FROM ( " +
|
||||
" 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 " +
|
||||
"LEFT JOIN LatestStock ls ON b.item_no = ls.item_no AND ls.rn = 1 %s) " +
|
||||
"SELECT * FROM PagedData where rowIdA 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;";
|
||||
"LEFT JOIN LatestStock ls ON b.item_no = ls.item_no AND ls.rn = 1 " +
|
||||
" %s b.rowId BETWEEN %s AND %s ";
|
||||
sql=String.format(sql,where,start,end);
|
||||
log.info(sql);
|
||||
ResultDto resultDto=new ResultDto();
|
||||
|
||||
@ -9,10 +9,8 @@ import com.google.gson.Gson;
|
||||
import com.small.client.Utils.BigDecimalFormatter;
|
||||
import com.small.client.Utils.CommonUtil;
|
||||
import com.small.client.Utils.HttpUtils;
|
||||
import com.small.client.Utils.SqlBuilder;
|
||||
import com.small.client.dto.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -22,8 +20,6 @@ import org.springframework.web.client.RestTemplate;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.*;
|
||||
import java.sql.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
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_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="(" +
|
||||
"select * from( " +
|
||||
" select ROW_NUMBER() OVER( " +
|
||||
@ -127,15 +119,9 @@ public class SxDataDao extends BaseDao{
|
||||
try {
|
||||
while (rs.next()) {
|
||||
sxSyncCategory=new SxSyncCategory();
|
||||
if(StringUtils.isNotEmpty(rs.getString("item_clsname"))){
|
||||
sxSyncCategory.setItem_clsname(rs.getString("item_clsname").trim());//分类名称
|
||||
}
|
||||
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());//分类编码
|
||||
}
|
||||
sxSyncCategory.setItem_clsname(rs.getString("item_clsname"));//分类名称
|
||||
sxSyncCategory.setCls_parent(rs.getString("cls_parent"));//父级编码
|
||||
sxSyncCategory.setItem_clsno(rs.getString("item_clsno"));//分类编码
|
||||
// System.out.printf(rs.getString("item_clsno"));//分类编码
|
||||
// log.info(rs.getString("item_clsname")+"\t");//分类名称
|
||||
//log.info(rs.getString("cls_parent")+"\t");//父级编码
|
||||
@ -184,12 +170,8 @@ public class SxDataDao extends BaseDao{
|
||||
* @return
|
||||
*/
|
||||
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()
|
||||
,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 pageSize
|
||||
*/
|
||||
public List<SxSyncGoods> findBditemInfoListPage(DataBaseInfo dataBaseInfo,int pageNo,int pageSize,boolean isAll){
|
||||
String stockOperateWhere="";
|
||||
if(StringUtils.isNotEmpty(dataBaseInfo.getStockOperateWhere())){
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
public List<SxSyncGoods> findBditemInfoListPage(DataBaseInfo dataBaseInfo,int pageNo,int pageSize){
|
||||
ResultDto resultDto=baseFindGoodsListJoinPage(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName()
|
||||
,pageNo,pageSize,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere());
|
||||
ResultSet rs= resultDto.getResultSet();
|
||||
List<SxSyncGoods> sxSyncGoodses=new ArrayList<>();
|
||||
SxSyncGoods sxSyncGoods=null;
|
||||
@ -245,7 +214,6 @@ public class SxDataDao extends BaseDao{
|
||||
}else {
|
||||
sxSyncGoods.setGross_margin(new BigDecimal("0"));//毛利率
|
||||
}
|
||||
sxSyncGoods.setId(rs.getLong("rowIdA"));
|
||||
sxSyncGoods.setItem_no(rs.getString("item_no"));//货号
|
||||
sxSyncGoods.setItem_subname(rs.getString("item_name"));//商品名称
|
||||
sxSyncGoods.setItem_subno(rs.getString("item_subno"));//商品条码
|
||||
@ -502,21 +470,17 @@ public class SxDataDao extends BaseDao{
|
||||
* @param dataBaseInfo
|
||||
* @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){
|
||||
if(CollectionUtil.isEmpty(map)){
|
||||
log.info("同步数据为空");
|
||||
return;
|
||||
}
|
||||
String brachNo=getLocalBranch(dataBaseInfo);//获取总店铺分仓编号
|
||||
Map<String,ItemInfo> itemInfoMap= findItemInfoList(dataBaseInfo,map);//查询商品信息
|
||||
Connection conn =getConnection(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),
|
||||
Connection conn =getConnection(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),
|
||||
dataBaseInfo.getPassword(), dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName());
|
||||
try {
|
||||
conn.setAutoCommit(false); // 关闭自动提交,开启事务
|
||||
//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 ( " +
|
||||
" SELECT TOP(1) * " +
|
||||
" FROM t_im_branch_stock " +
|
||||
@ -525,36 +489,17 @@ public class SxDataDao extends BaseDao{
|
||||
") " +
|
||||
" UPDATE TopStock " +
|
||||
" SET stock_qty = stock_qty+(?),oper_date=?;";
|
||||
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
try (PreparedStatement ps = conn.prepareStatement(sql)) {
|
||||
int batchSize = 100; // 每批处理1000条
|
||||
int batchSize = 1000; // 每批处理1000条
|
||||
int count = 0;
|
||||
Set<Map.Entry> sme=map.entrySet();
|
||||
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();
|
||||
|
||||
if(stock_qty.compareTo(BigDecimal.ZERO)==0){
|
||||
continue;
|
||||
}
|
||||
ProductQuantityConsumptionDto productQuantityConsumptionDto=pqMap.get(key);
|
||||
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.setString(1, (String) entry.getKey());
|
||||
ps.setDouble(2, stock_qty.doubleValue());
|
||||
ps.setTimestamp(3, timestamp);
|
||||
ps.addBatch(); // 添加至批处理
|
||||
@ -568,15 +513,6 @@ public class SxDataDao extends BaseDao{
|
||||
// 执行剩余未满 batchSize 的批次
|
||||
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
|
||||
.stream()
|
||||
.map(ProductQuantityConsumptionDto::getConsumeId)
|
||||
@ -591,7 +527,7 @@ public class SxDataDao extends BaseDao{
|
||||
if (!HttpUtils.SUCCESSCODE.equals(code)) {
|
||||
throw new Exception("服务器异常");
|
||||
}
|
||||
log.info("库存更新剩余批次更新数: {}", Arrays.toString(remainingCounts));
|
||||
log.info("剩余批次更新数: {}", Arrays.toString(remainingCounts));
|
||||
conn.commit(); // 最终提交事务
|
||||
log.info("批量更新完成,总记录数: {}" , count);
|
||||
//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
|
||||
@ -1351,7 +775,7 @@ public class SxDataDao extends BaseDao{
|
||||
,dataBaseInfo.getPassword()
|
||||
,dataBaseInfo.getDbPort()
|
||||
,dataBaseInfo.getDataBaseName()
|
||||
,T_PUB_PLAN_MASTER +" b"
|
||||
,T_PUB_PLAN_MASTER
|
||||
,PLAN_NO
|
||||
,pageNo
|
||||
,pageSize
|
||||
@ -1471,54 +895,4 @@ public class SxDataDao extends BaseDao{
|
||||
return getTotalSpecShop(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,10 +8,6 @@ import java.util.Date;
|
||||
|
||||
@Data
|
||||
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")
|
||||
private String ip;
|
||||
@ApiModelProperty("用户名")
|
||||
@ -45,22 +41,4 @@ public class DataBaseInfo {
|
||||
|
||||
@ApiModelProperty(value = "间隔时间")
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -23,15 +23,9 @@ public class ProductQuantityConsumptionDto {
|
||||
@ApiModelProperty("商品编号")
|
||||
private String productNumber;
|
||||
|
||||
@ApiModelProperty("商品单价,如果是切割商品要算回来每公斤多少")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("数量(正数表示入库/增加,负数表示出库/减少)")
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ApiModelProperty("订单总额")
|
||||
private BigDecimal saleAmount;
|
||||
|
||||
@ApiModelProperty("消费状态:0-未消费,1-已消费")
|
||||
private Integer status;
|
||||
|
||||
@ -45,7 +39,4 @@ public class ProductQuantityConsumptionDto {
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "下单时间")
|
||||
private Long saleTime;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -71,16 +71,4 @@ public class StoreDbConfig implements Serializable {
|
||||
|
||||
@ApiModelProperty("商品同步间隔时间")
|
||||
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;
|
||||
}
|
||||
|
||||
@ -12,9 +12,6 @@ import java.util.List;
|
||||
@Data
|
||||
public class SxGoosModel {
|
||||
|
||||
@ApiModelProperty(value = "分页编号")
|
||||
private Long rowIdA;
|
||||
|
||||
@ApiModelProperty("商品名称")
|
||||
private String product_name;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -60,7 +60,7 @@ public abstract class SxDataAbstService {
|
||||
* @param allSxSyncCategories 所有分类
|
||||
* @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)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@ -69,41 +69,37 @@ public abstract class SxDataAbstService {
|
||||
SxCategoryModel sxCategoryModel=null;
|
||||
while (iterator.hasNext()){
|
||||
SxSyncCategory sxSyncCategory= iterator.next();
|
||||
try {
|
||||
sxCategoryModel=new SxCategoryModel();
|
||||
sxCategoryModel.setCategory_image(SxDataDao.DEFAULT_IMG);
|
||||
sxCategoryModel.setCategory_name(sxSyncCategory.getItem_clsname());
|
||||
sxCategoryModel.setBrandName(clsBrandMap.get(sxSyncCategory.getItem_clsname()));
|
||||
//寻找父级
|
||||
if(StringUtils.isNotEmpty(sxSyncCategory.getCls_parent())){
|
||||
SxSyncCategory firstNode=getParentNode(allSxSyncCategories,sxSyncCategory.getCls_parent());
|
||||
if(null==firstNode){
|
||||
sxCategoryModel.setFirst_category_name("");
|
||||
sxCategoryModel.setProduct_type(sxCategoryModel.getCategory_name());
|
||||
sxCategoryModels.add(sxCategoryModel);
|
||||
continue;
|
||||
}
|
||||
sxCategoryModel.setParent_name(firstNode.getItem_clsname());//todo 暂时无用
|
||||
//如何存在上级的上级,则上级为第二层,上上及为第一层
|
||||
if(StringUtils.isNotEmpty(firstNode.getCls_parent())) {//还存在上级
|
||||
SxSyncCategory secondNode=getParentNode(allSxSyncCategories,firstNode.getCls_parent());
|
||||
if(null!=secondNode && secondNode.getItem_clsno().equals(firstNode.getCls_parent())){
|
||||
sxCategoryModel.setFirst_category_name(secondNode.getItem_clsname());
|
||||
sxCategoryModel.setSecond_category_name(firstNode.getItem_clsname());
|
||||
}else {
|
||||
sxCategoryModel.setFirst_category_name(firstNode.getItem_clsname());
|
||||
}
|
||||
sxCategoryModel=new SxCategoryModel();
|
||||
sxCategoryModel.setCategory_image(SxDataDao.DEFAULT_IMG);
|
||||
sxCategoryModel.setCategory_name(sxSyncCategory.getItem_clsname());
|
||||
sxCategoryModel.setBrandName(clsBrandMap.get(sxSyncCategory.getItem_clsname()));
|
||||
//寻找父级
|
||||
if(StringUtils.isNotEmpty(sxSyncCategory.getCls_parent())){
|
||||
SxSyncCategory firstNode=getParentNode(allSxSyncCategories,sxSyncCategory.getCls_parent());
|
||||
if(null==firstNode){
|
||||
sxCategoryModel.setFirst_category_name("");
|
||||
sxCategoryModel.setProduct_type(sxCategoryModel.getCategory_name());
|
||||
sxCategoryModels.add(sxCategoryModel);
|
||||
continue;
|
||||
}
|
||||
sxCategoryModel.setParent_name(firstNode.getItem_clsname());//todo 暂时无用
|
||||
//如何存在上级的上级,则上级为第二层,上上及为第一层
|
||||
if(StringUtils.isNotEmpty(firstNode.getCls_parent())) {//还存在上级
|
||||
SxSyncCategory secondNode=getParentNode(allSxSyncCategories,firstNode.getCls_parent());
|
||||
if(null!=secondNode && secondNode.getItem_clsno().equals(firstNode.getCls_parent())){
|
||||
sxCategoryModel.setFirst_category_name(secondNode.getItem_clsname());
|
||||
sxCategoryModel.setSecond_category_name(firstNode.getItem_clsname());
|
||||
}else {
|
||||
sxCategoryModel.setFirst_category_name(firstNode.getItem_clsname());
|
||||
}
|
||||
}else {
|
||||
sxCategoryModel.setFirst_category_name("");
|
||||
sxCategoryModel.setFirst_category_name(firstNode.getItem_clsname());
|
||||
}
|
||||
sxCategoryModel.setProduct_type(sxCategoryModel.getCategory_name());
|
||||
sxCategoryModels.add(sxCategoryModel);
|
||||
}catch (Exception e){
|
||||
log.info("sxSyncCategory:{}",sxSyncCategory);
|
||||
}else {
|
||||
sxCategoryModel.setFirst_category_name("");
|
||||
}
|
||||
sxCategoryModel.setProduct_type(sxCategoryModel.getCategory_name());
|
||||
sxCategoryModels.add(sxCategoryModel);
|
||||
}
|
||||
sxCategoryModels=filterCategories(sxCategoryModels);
|
||||
return sxCategoryModels;
|
||||
@ -136,7 +132,7 @@ public abstract class SxDataAbstService {
|
||||
List<SxSyncCategory> list= sxSyncCategories.stream().filter(cc->
|
||||
cc.getItem_clsno().trim().equals(parentId.trim()))
|
||||
.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;
|
||||
for (SxSyncGoods sxSyncGood:sxSyncGoods){
|
||||
sxGoosModel=new SxGoosModel();
|
||||
sxGoosModel.setRowIdA(sxSyncGood.getId());
|
||||
sxGoosModel.setProduct_name(sxSyncGood.getItem_subname());
|
||||
sxGoosModel.setProduct_number(sxSyncGood.getItem_no().trim());//
|
||||
sxGoosModel.setProduct_barcode(sxSyncGood.getItem_no().trim());//
|
||||
|
||||
@ -63,7 +63,7 @@ public interface SxDataService {
|
||||
* @param commentModel
|
||||
* @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);
|
||||
|
||||
String getCategoryChildren(DataBaseInfo dataBaseInfo,String parentId);
|
||||
|
||||
/**
|
||||
* 校验是否有新的入库
|
||||
* @param dataBaseInfo
|
||||
* @param refreshTime
|
||||
* @return
|
||||
*/
|
||||
boolean isNewShop(DataBaseInfo dataBaseInfo, String refreshTime);
|
||||
|
||||
/**
|
||||
* 刷新同步时间
|
||||
* @return
|
||||
*/
|
||||
void refreshTime(CommentModel commentModel);
|
||||
}
|
||||
|
||||
@ -22,22 +22,31 @@ import com.small.client.service.WebClientService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
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.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StreamUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -133,10 +142,9 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
syncAllGoods(dataBaseInfo, commentModel);
|
||||
break;
|
||||
case "02"://增量 todo test
|
||||
String sycnTime=commentModel.getSyncTime();
|
||||
syncIncrementAddGoods(dataBaseInfo, commentModel);//同步新商品和修改商品
|
||||
syncIncrementStock(dataBaseInfo, commentModel);//同步库存
|
||||
syncFlowPrice(dataBaseInfo, commentModel,sycnTime);//同步调价单
|
||||
syncIncrementAddGoods(dataBaseInfo, commentModel);
|
||||
syncIncrementModifyGoods(dataBaseInfo, commentModel);
|
||||
syncIncrementStock(dataBaseInfo, commentModel);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -309,22 +317,6 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
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
|
||||
@ -332,59 +324,34 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
*/
|
||||
private void syncAllGoods(DataBaseInfo dataBaseInfo, CommentModel commentModel){
|
||||
//String where="where 1=1";
|
||||
String where="where shop.status='1'";
|
||||
String where="where b.status='1'";
|
||||
Integer total =0;
|
||||
boolean isAll=false;
|
||||
String parentId=getAndCacheTree(dataBaseInfo,dataBaseInfo.getCategoryName());//加载缓存用的
|
||||
String fileEndFix="";
|
||||
if(DicEnum.SYNCTYPE_02.getCode().equals(dataBaseInfo.getSyncType())){
|
||||
if (StringUtils.isNotEmpty(dataBaseInfo.getCategoryName())) {
|
||||
//syncGoodsSearchModel.setItemClsno(childrens);
|
||||
String childrens= commonCache.get(CommonCache.CACHE_CATEGROY+parentId);
|
||||
where += " and shop.item_clsno in ('" + childrens + "')";
|
||||
fileEndFix="category";
|
||||
where += " and b.item_clsno in ('" + childrens + "')";
|
||||
}
|
||||
if(StringUtils.isNotEmpty(commentModel.getSyncTime())){
|
||||
where+=" and shop.modify_date>'"+commentModel.getSyncTime()+"' ";
|
||||
where+=" or shop.build_date>'"+commentModel.getSyncTime()+"' ";
|
||||
fileEndFix="modify";
|
||||
where+=" and b.modify_date>'"+commentModel.getSyncTime()+"' ";
|
||||
where+=" or b.build_date>'"+commentModel.getSyncTime()+"' ";
|
||||
}
|
||||
if(StringUtils.isNotEmpty(dataBaseInfo.getOperDate())){
|
||||
String stockOperateWhere=" 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";
|
||||
where+=" and ls.oper_date>'"+dataBaseInfo.getOperDate()+"' ";
|
||||
}
|
||||
dataBaseInfo.setWhere(where);
|
||||
// 记录总数
|
||||
total = sxDataDao.getTBditemInfoJoninTotal(dataBaseInfo);
|
||||
}else {
|
||||
where="where b.status='1'";
|
||||
isAll=true;
|
||||
dataBaseInfo.setWhere(where);
|
||||
total = sxDataDao.getTBditemInfoTotal(dataBaseInfo);
|
||||
where="where shop.status='1'";
|
||||
}
|
||||
if(total==0){
|
||||
log.info("暂无商品同步");
|
||||
return;
|
||||
}
|
||||
//where+=" and";
|
||||
where+=" and";
|
||||
dataBaseInfo.setWhere(where);
|
||||
|
||||
// 总页数
|
||||
@ -398,7 +365,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
Date refreshDate= DateUtil.date(tenMinutesAgo);
|
||||
List<String> folders=new ArrayList<>();
|
||||
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);
|
||||
String jsonString="";
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
@ -407,11 +374,11 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
} catch (JsonProcessingException 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)) {
|
||||
continue;
|
||||
}
|
||||
folders.add(i+"_"+fileEndFix);
|
||||
folders.add(String.valueOf(i));
|
||||
syncCount+=sxSyncGoods.size();
|
||||
}
|
||||
//通知服务器上传cos
|
||||
@ -421,7 +388,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
+"&syncType="+DicEnum.MUAL_1.getCode()
|
||||
+"&refreshDateStr="+refreshDate,
|
||||
JSONUtil.parseArray(folders));
|
||||
log.info("商品总共有{}条数据,同步完成{}条",total,syncCount);
|
||||
log.info("商品分类总共有{}条数据,同步完成{}条",total,syncCount);
|
||||
String code= HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_GOODS_READ
|
||||
+"?appKey="+commentModel.getAppKey()
|
||||
+"&sign="+commentModel.getAppId()
|
||||
@ -441,15 +408,15 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
* @param commentModel
|
||||
* @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();
|
||||
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();
|
||||
fileUtils.writeFile(filePath,fileName,content);
|
||||
String sign=CommonUtil.generateOpenSign(content,commentModel.getAppKey(),commentModel.getAppId());
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增量同步 调价单变化
|
||||
*/
|
||||
private void syncFlowPrice(DataBaseInfo dataBaseInfo, CommentModel commentModel,String sycnTime){
|
||||
dataBaseInfo.setPriceOperatime(sycnTime);
|
||||
commentModel.setSyncTime("");
|
||||
dataBaseInfo.setOperDate("");
|
||||
dataBaseInfo.setStockOperateWhere("");
|
||||
syncAllGoods(dataBaseInfo,commentModel);
|
||||
}
|
||||
|
||||
/**
|
||||
*获取特价商品
|
||||
* @param dataBaseInfo
|
||||
@ -644,10 +600,10 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
log.info("文件下载目录: {}", downloadDirectory);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
// headers.set("User-Agent", "Apifox/1.0.0 (https://apifox.com)");
|
||||
//headers.setAccept(Collections.singletonList(MediaType.ALL)); // 对应 */*
|
||||
// headers.set("Accept-Encoding", "gzip, deflate, br");
|
||||
headers.setAccept(Collections.singletonList(MediaType.ALL)); // 对应 */*
|
||||
headers.set("Accept-Encoding", "gzip, deflate, br");
|
||||
// 可以添加其他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");
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(headers);
|
||||
@ -710,8 +666,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
log.error("文件下载失败:{}",e.getMessage());
|
||||
return null;
|
||||
}
|
||||
File file=new File(downloadDirectory+originalFileName);
|
||||
return file.length()>0?downloadDirectory+originalFileName:null;
|
||||
return downloadDirectory+originalFileName;
|
||||
}
|
||||
|
||||
|
||||
@ -771,10 +726,6 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
dataBaseInfo.setRefreshTime(storeDbConfig.getRefreshTime());
|
||||
dataBaseInfo.setIsTowSync(storeDbConfig.getIsTowSync());
|
||||
dataBaseInfo.setShopGapTime(storeDbConfig.getShopGapTime());
|
||||
dataBaseInfo.setSaleAccount(storeDbConfig.getSaleAccount());
|
||||
dataBaseInfo.setIsSyncActive(storeDbConfig.getIsSyncActive());
|
||||
dataBaseInfo.setIsSyncMember(storeDbConfig.getIsSyncMember());
|
||||
dataBaseInfo.setClientVersion(storeDbConfig.getClientVersion());
|
||||
return dataBaseInfo;
|
||||
}
|
||||
return new DataBaseInfo();
|
||||
@ -786,54 +737,31 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
log.info("不做双向同步数据库");
|
||||
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
|
||||
+"?appKey="+commentModel.getAppKey()
|
||||
+"&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")){
|
||||
// Map map=(Map)jsonObject.get("result");
|
||||
String jsonStr= jsonObject.getStr("result");
|
||||
List<ProductQuantityConsumptionDto> productQuantityConsumptionDtoList =
|
||||
JSONUtil.toList(jsonStr,ProductQuantityConsumptionDto.class);
|
||||
JSONUtil.toList(jsonObject.getStr("result"),ProductQuantityConsumptionDto.class);
|
||||
if(!productQuantityConsumptionDtoList.isEmpty()){
|
||||
Map map = productQuantityConsumptionDtoList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
dto -> dto.getOrderId()+"-"+dto.getProductNumber(),
|
||||
ProductQuantityConsumptionDto::getProductNumber,
|
||||
Collectors.reducing(
|
||||
BigDecimal.ZERO,
|
||||
ProductQuantityConsumptionDto::getQuantity,
|
||||
BigDecimal::add
|
||||
)
|
||||
));
|
||||
Map<String,ProductQuantityConsumptionDto> productQuantityConsumptionDtoMap=new HashMap<>();
|
||||
|
||||
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("无线上流水同步");
|
||||
sxDataDao.updateStoreData(dataBaseInfo,map,productQuantityConsumptionDtoList,commentModel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean syncAtive(DataBaseInfo dataBaseInfo, CommentModel commentModel) {
|
||||
public void syncAtive(DataBaseInfo dataBaseInfo, CommentModel commentModel) {
|
||||
String where="where 1=1";
|
||||
Integer total =0;
|
||||
if(StringUtils.isNotEmpty(commentModel.getSyncTime())){
|
||||
@ -844,7 +772,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
total = sxDataDao.getNewActiveCount(dataBaseInfo);
|
||||
if(total==0){
|
||||
log.info("暂无活动同步");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
// 总页数
|
||||
int pages = CommonUtil.getPagesCount(total, SxDataDao.PAGESIZE);
|
||||
@ -869,7 +797,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
syncCount+=activeDtos.size();
|
||||
}
|
||||
log.info("成功同步活动数据:"+syncCount);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -877,16 +805,13 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
String where="where 1=1";
|
||||
Integer total =0;
|
||||
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()+"') ";
|
||||
}
|
||||
|
||||
dataBaseInfo.setWhere(where);
|
||||
total = sxDataDao.getTotalSpecShop(dataBaseInfo);
|
||||
if(total==0){
|
||||
// HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_REFRESH
|
||||
// +"?appKey="+commentModel.getAppKey()
|
||||
// +"&sign="+commentModel.getAppId(), new JSONArray());
|
||||
log.info("暂无活动商品同步");
|
||||
return;
|
||||
}
|
||||
@ -914,9 +839,9 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
syncCount+=activeDtos.size();
|
||||
}
|
||||
log.info("成功同步活动商品数据:"+syncCount);
|
||||
// HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_REFRESH
|
||||
// +"?appKey="+commentModel.getAppKey()
|
||||
// +"&sign="+commentModel.getAppId(), new JSONArray());
|
||||
HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_REFRESH
|
||||
+"?appKey="+commentModel.getAppKey()
|
||||
+"&sign="+commentModel.getAppId(), new JSONArray());
|
||||
|
||||
}
|
||||
|
||||
@ -930,12 +855,35 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
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
|
||||
public void refreshTime(CommentModel commentModel) {
|
||||
HttpUtils.postData(restTemplate,remoteIp+HttpUtils.URL_SYNC_REFRESH
|
||||
+"?appKey="+commentModel.getAppKey()
|
||||
+"&sign="+commentModel.getAppId(), new JSONArray());
|
||||
// 创建SSL上下文(信任所有证书 - 仅测试环境使用)
|
||||
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
|
||||
.loadTrustMaterial((chain, authType) -> true)
|
||||
.build();
|
||||
|
||||
// 创建HttpClient,配置SSL和重定向
|
||||
CloseableHttpClient httpClient = HttpClients.custom()
|
||||
.setDefaultRequestConfig(config)
|
||||
.setSSLContext(sslContext)
|
||||
.setRedirectStrategy(new LaxRedirectStrategy())
|
||||
.build();
|
||||
|
||||
// 创建请求工厂
|
||||
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
||||
|
||||
return new RestTemplate(factory);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -233,9 +234,9 @@ public class LoginController extends BaseControllerImpl {
|
||||
return CommonResult.success(accountUserBaseService.doAppConnectLogin(bind_name, code));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "商家(代理商)注册与登录")
|
||||
@ApiOperation(value = "商家版注册与登录")
|
||||
@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) {
|
||||
return CommonResult.failed("缺少必要参数!");
|
||||
}
|
||||
@ -244,29 +245,21 @@ public class LoginController extends BaseControllerImpl {
|
||||
String randKey = paramJSON.getStr("rand_key");
|
||||
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("缺少必要参数!");
|
||||
}
|
||||
|
||||
// 检查输入字符是否包含 SQL 注入特征
|
||||
// 检查输入字符是不是包含 sql 注入特征,如果包含不给以通过
|
||||
if (!CommonService.isValidInput(userMobile, randKey, verifyCode)) {
|
||||
return CommonResult.failed(ResultCode.VALIDATE_INPUTS);
|
||||
}
|
||||
|
||||
String cid = paramJSON.getStr("cid");
|
||||
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 = "微信用户一键登录与注册")
|
||||
@RequestMapping(value = "/doWxUserRegisterAndLogin", method = RequestMethod.POST)
|
||||
public CommonResult doWxUserRegisterAndLogin(@RequestBody WxUserInfoReq wxUserInfoReq) {
|
||||
@ -295,14 +288,10 @@ public class LoginController extends BaseControllerImpl {
|
||||
@ApiOperation(value = "忘记密码-更改新密码")
|
||||
@RequestMapping(value = "/edit/forgetPassword", method = RequestMethod.POST)
|
||||
public CommonResult editForgetPassword(@RequestBody JSONObject paramJSON) {
|
||||
// TODO 这个方法肯定有问题,待修改
|
||||
return accountUserBaseService.doMerchSmsRegisterAndLogin(paramJSON.getStr("user_mobile"),
|
||||
paramJSON.getStr("rand_key"),
|
||||
paramJSON.getStr("verify_code"),
|
||||
paramJSON.getInt("user_type"),
|
||||
paramJSON.getStr("cid"),
|
||||
paramJSON.getStr("os_type"),
|
||||
paramJSON.getStr("invite_code"));
|
||||
paramJSON.getStr("cid"), paramJSON.getStr("os_type"));
|
||||
}
|
||||
|
||||
@ApiOperation("退出登录")
|
||||
|
||||
@ -11,7 +11,6 @@ import com.suisung.mall.common.utils.I18nUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -33,7 +32,6 @@ public class AccountBaseUserLevelController {
|
||||
@Autowired
|
||||
private AccountBaseUserLevelService accountBaseUserLevelService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
|
||||
@ -467,11 +467,6 @@ public class AccountController {
|
||||
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)
|
||||
public AccountUserBase findOneAccountUserBase(@RequestBody AccountUserBase accountUserBase) {
|
||||
@ -494,9 +489,4 @@ public class AccountController {
|
||||
return accountUserBindConnectService.getAllBindCount(bindTmpl);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateBatchAccountUserBindConnect", method = RequestMethod.POST)
|
||||
public ThirdApiRes updateBatchAccountUserBindConnect(@RequestBody List<AccountUserBindConnect> accountUserBindConnectList) {
|
||||
return accountUserBindConnectService.updateBatchAccountUserBindConnect(accountUserBindConnectList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -232,17 +231,5 @@ public class AccountUserBaseController extends BaseControllerImpl {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -85,17 +85,5 @@ public class AccountUserBindConnectController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.suisung.mall.account.controller.mobile;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.suisung.mall.account.service.AccountUserBindConnectService;
|
||||
import com.suisung.mall.account.service.WeiXinService;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.service.impl.BaseControllerImpl;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -158,12 +160,4 @@ public class WeiXinController extends BaseControllerImpl {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.suisung.mall.account.listener;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.rabbitmq.client.Channel;
|
||||
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.modules.account.AccountUserInfo;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
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.nio.charset.StandardCharsets;
|
||||
@ -26,9 +23,6 @@ public class DealUserInfoListener {
|
||||
@Autowired
|
||||
private AccountUserInfoService accountUserInfoService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreMemberService shopStoreMemberService;
|
||||
|
||||
@RabbitHandler
|
||||
public void listener(byte[] data, Channel channel, Message message) throws IOException, InterruptedException {
|
||||
// 将byte[]转换为String,然后调用现有的处理逻辑
|
||||
@ -40,17 +34,10 @@ public class DealUserInfoListener {
|
||||
public void listener(String data, Channel channel, Message message) throws IOException, InterruptedException {
|
||||
AccountUserInfo accountUserInfo = JSONUtil.toBean(data, AccountUserInfo.class);
|
||||
// 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 {
|
||||
boolean flag = accountUserInfoService.saveOrUpdate(accountUserInfo);
|
||||
if (flag) {
|
||||
if(accountUserInfo.getStore_id()!=null){
|
||||
shopStoreMemberService.dealStoreMember(accountUserInfo);
|
||||
}
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} else {
|
||||
log.error("消息消费失败,执行dealUserInfo异常,当前用户编号:{}", accountUserInfo.getUser_id());
|
||||
@ -63,5 +50,4 @@ public class DealUserInfoListener {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,9 +3,7 @@ package com.suisung.mall.account.listener;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.rabbitmq.client.Channel;
|
||||
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.modules.store.ShopStoreMemberLevel;
|
||||
import com.suisung.mall.common.pojo.to.UserLevelTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
@ -25,9 +23,6 @@ public class UpgradeUserLevelListener {
|
||||
@Autowired
|
||||
private AccountUserInfoService accountUserInfoService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreMemberLevelService shopStoreMemberLevelService;
|
||||
|
||||
@RabbitHandler
|
||||
public void listener(byte[] data, Channel channel, Message message) throws IOException, InterruptedException {
|
||||
// 将byte[]转换为String,然后调用现有的处理逻辑
|
||||
@ -43,11 +38,6 @@ public class UpgradeUserLevelListener {
|
||||
try {
|
||||
boolean flag = accountUserInfoService.checkUpdateUserLevel(userLevelTO.getUser_id(), userLevelTO.getUser_exp_total(), userLevelTO.getUser_fans_total(), userLevelTO.getUser_spend_total(), 0, 0, 0);
|
||||
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);
|
||||
} else {
|
||||
log.error("消息消费失败,执行upgradeUserLevel异常,当前用户编号:{}", userLevelTO.getUser_id());
|
||||
|
||||
@ -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> {
|
||||
}
|
||||
@ -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> {
|
||||
}
|
||||
@ -4,7 +4,6 @@ import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.modules.account.AccountUserBase;
|
||||
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.res.ThirdApiRes;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
@ -142,13 +141,11 @@ public interface AccountUserBaseService extends IBaseService<AccountUserBase> {
|
||||
* @param user_mobile
|
||||
* @param rand_key 防机器人刷验证码
|
||||
* @param verify_code
|
||||
* @param userType 用户类型:0-普通买家; 1-管理员;2-入驻商家;3-代理商;
|
||||
* @param cid 推送 cid
|
||||
* @param osType 手机系统类型 :1-Android;2-iOS;3-微信小程序;
|
||||
* @param inviteCode 代理商邀请码
|
||||
* @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
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -3,9 +3,7 @@ package com.suisung.mall.account.service;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.suisung.mall.common.modules.account.AccountUserBindConnect;
|
||||
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 java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -87,33 +85,13 @@ public interface AccountUserBindConnectService extends IBaseService<AccountUserB
|
||||
* @param bindType
|
||||
* @param userId
|
||||
* @param userType
|
||||
* @param inviteCode
|
||||
* @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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -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.pay.PayUserResource;
|
||||
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.req.WxUserInfoReq;
|
||||
import com.suisung.mall.common.pojo.res.ThirdApiRes;
|
||||
@ -70,7 +67,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -101,7 +97,7 @@ import static com.suisung.mall.common.utils.I18nUtil._;
|
||||
@Service
|
||||
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);
|
||||
@Autowired
|
||||
private AuthService authService;
|
||||
@ -111,8 +107,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
private SnsService snsService;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopService shopService;
|
||||
@Autowired
|
||||
@ -208,7 +202,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
data.put("key", token);
|
||||
data.put("rid", rid); // 用户角色 rid:0-用户;2-商家;3-门店;9-平台;
|
||||
|
||||
//user_type 用户类型,对应user_base 的 user_is_admin:0-普通用户;1-管理员;2-入驻商家;3-代理商;
|
||||
//user_type 用户类型,对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;
|
||||
String as = bindConnectService.getBind(user_id, BindCode.MOBILE, userDto.getUserType()) == null ? "0" : "1";
|
||||
data.put("as", as); // 是否绑定了手机号 0-否 1-是
|
||||
CookieUtils.setCookie("as", as);
|
||||
@ -255,7 +249,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
public Map<String, Object> getUserInfo(Integer user_id) {
|
||||
QueryWrapper<AccountUserBase> queryWrapper = new QueryWrapper<>();
|
||||
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);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1691,11 +1675,10 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
String verifyCode = (String) userInfo.get("verify_code");
|
||||
String verify_token = (String) userInfo.get("verify_token");
|
||||
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 userType = userIsAdmin; // 用户类型: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-入驻商家;
|
||||
String user_email = (String) userInfo.get("user_email");
|
||||
Integer bind_type = getParameter("bind_type", BindCode.MOBILE);
|
||||
String inviteCode = Convert.toStr("invite_code", "");
|
||||
|
||||
if (StrUtil.isBlank(user_account)) {
|
||||
throw new ApiException(_("请输入账号"));
|
||||
@ -1730,7 +1713,10 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
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(rand_key) && StrUtil.isNotBlank(verifyCode)) {
|
||||
@ -1810,12 +1796,12 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
if (user_base_row != null) {
|
||||
// 检测到 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) {
|
||||
throw new ApiException(_("绑定账号失败"));
|
||||
}
|
||||
return user_base_row;
|
||||
|
||||
// throw new ApiException(_("用户已经存在,请更换用户名"));
|
||||
} else {
|
||||
// 检测到用户尚未注册,立即新增用户基本信息和用户附加信息
|
||||
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_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_state(user_state);
|
||||
user_base_reg_row.setUser_key(user_key);
|
||||
@ -1894,7 +1881,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
|
||||
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) {
|
||||
throw new ApiException(_("绑定账号失败"));
|
||||
}
|
||||
@ -1913,17 +1900,16 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
|
||||
// 远程调用异常忽略掉
|
||||
try {
|
||||
// User_Resource初始化 用户积分
|
||||
if (!payService.initUserPoints(user_id)) {
|
||||
log.error("初始化用户积分失败");
|
||||
// throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
// 初始化用户经验表
|
||||
if (!accountUserInfoService.initUserExperience(user_id)) {
|
||||
log.error("初始化用户经验表失败");
|
||||
// throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
@ -1939,6 +1925,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
addSourceUserId(user_id, user_parent_id);
|
||||
}
|
||||
|
||||
//todo 分享券
|
||||
// 分享券活动id
|
||||
Integer activityId = Convert.toInt(getParameter("activity_id"));
|
||||
if (CheckUtil.isEmpty(activityId) && CheckUtil.isNotEmpty(activity_id)) {
|
||||
@ -1966,7 +1953,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
// 如果是商家首次注册 恭喜您,成功注册了商家账号!您的初始密码为:${password},密码可登录商家版 APP,登录后请尽快修改密码。
|
||||
Map<String, Object> smsArgs = new HashMap<>();
|
||||
smsArgs.put("password", user_password_src);
|
||||
sendSmsMessage(PhoneNumberUtils.cleanPhoneNumber(user_mobile), "SMS_496910525", smsArgs);
|
||||
sendSmsMessage(PhoneNumberUtils.cleanPhoneNumber(user_mobile), "SMS_496910525", smsArgs); // SMS_496910525
|
||||
}
|
||||
|
||||
//初次注册发送消息
|
||||
@ -2969,45 +2956,47 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
* @param user_mobile
|
||||
* @param rand_key 防机器人刷验证码
|
||||
* @param verify_code
|
||||
* @param userType 用户类型:0-普通买家; 1-管理员;2-入驻商家;3-代理商;
|
||||
* @param cid 推送 cid
|
||||
* @param osType 手机系统类型 :1-Android;2-iOS;3-微信小程序;
|
||||
* @param inviteCode 代理商邀请码
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CommonResult doMerchSmsRegisterAndLogin(String user_mobile, String rand_key, String verify_code,
|
||||
Integer userType, String cid, String osType, String inviteCode) {
|
||||
// 参数验证
|
||||
if (StrUtil.hasBlank(user_mobile, rand_key, verify_code)) {
|
||||
public CommonResult doMerchSmsRegisterAndLogin(String user_mobile, String rand_key, String verify_code, String cid, String osType) {
|
||||
// 流程:通过手机号检查是否有绑定关系?没有就直接注册,有就直接登录,返回登录后的所有信息,附加是否已经申请入驻标记?
|
||||
// 商家入驻账号,都是需要手机号绑定的。账号组成:1000000+(数字加法)自增ID,密码随机6位数
|
||||
if (StrUtil.isBlank(user_mobile) || StrUtil.isBlank(verify_code)) {
|
||||
return CommonResult.failed(_("缺少必要参数!"));
|
||||
}
|
||||
|
||||
// 验证手机号格式
|
||||
if (!PhoneNumberUtils.checkPhoneNumber(user_mobile)) {
|
||||
return CommonResult.failed(_("请输入正确的手机号!"));
|
||||
}
|
||||
|
||||
// 验证防刷机制
|
||||
if (!ObjectUtil.equal(user_mobile, rand_key)) {
|
||||
return CommonResult.failed(_("非法数据,请刷新页面重新提交!"));
|
||||
if (StrUtil.isBlank(rand_key)) {
|
||||
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);
|
||||
|
||||
// 验证验证码 (TODO 短信验证码切换到正式平台,记得注释 9999)
|
||||
// TODO 短信验证码切换到正式平台,记得注释 9999
|
||||
if (!checkVerifyCode(verifyMobile, verify_code)) {
|
||||
// 短信验证码
|
||||
return CommonResult.failed(_("验证码错误!"));
|
||||
}
|
||||
|
||||
// 设置默认用户类型
|
||||
userType = ObjectUtil.defaultIfNull(userType, CommonConstant.USER_TYPE_MCH);
|
||||
|
||||
// 找出手机对应的绑定用户,进行绑定登录
|
||||
return doMobileBindLogin(verifyMobile, userType, cid, osType, inviteCode);
|
||||
// 找出手机对应的绑定用户
|
||||
// 是否为手机号注册,密码6位随机数
|
||||
return doMobileBindLogin(verifyMobile, CommonConstant.USER_TYPE_MCH, cid, osType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序一键登录注册接口
|
||||
*
|
||||
@ -3042,7 +3031,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
String mobile = PhoneNumberUtils.convWithIDDCodePhoneNumber(wxUserInfoReq.getPhoneNumber(), iddCode);
|
||||
|
||||
AccountUserBase accountUserBase = getByAccountAndType(mobile, CommonConstant.USER_TYPE_NORMAL);
|
||||
Integer userId = 0;
|
||||
if (accountUserBase == null) {
|
||||
// 检测到用户尚未注册,立即新增用户基本信息和用户附加信息
|
||||
Date today = new Date();
|
||||
@ -3075,7 +3063,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
return CommonResult.failed(_("微信注册账号失败!"));
|
||||
}
|
||||
|
||||
userId = accountUserBase.getUser_id();
|
||||
Integer userId = accountUserBase.getUser_id();
|
||||
|
||||
AccountUserLogin user_login_reg_row = new AccountUserLogin();
|
||||
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));
|
||||
|
||||
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 的情况
|
||||
@ -3213,17 +3171,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
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)入驻商家手机号绑定登录
|
||||
*
|
||||
* @param user_mobile 带+86的中国号码
|
||||
* @param userType 用户类型:0-普通用户;1-管理员;2-入驻商户;3-代理商
|
||||
* @param userType 用户类型:0-普通用户;1-管理员;2-入驻商户
|
||||
* @param cid 推送 cid
|
||||
* @param osType 手机系统类型 :1-Android;2-iOS;3-微信小程序;
|
||||
* @param inviteCode 代理商的邀请码(商家注册时才用);
|
||||
* @return
|
||||
*/
|
||||
public CommonResult doMobileBindLogin(String user_mobile, Integer userType, String cid, String osType, String inviteCode) {
|
||||
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) {
|
||||
public CommonResult doMobileBindLogin(String user_mobile, Integer userType, String cid, String osType) {
|
||||
if (StrUtil.isBlank(user_mobile) || userType == null) {
|
||||
return CommonResult.failed("缺少必要参数!");
|
||||
}
|
||||
|
||||
// 检查输入字符是否包含 SQL 注入特征
|
||||
// 检查输入字符是不是包含 sql 注入特征,如果包含不给以通过
|
||||
if (!CommonService.isValidInput(user_mobile, cid, osType)) {
|
||||
return CommonResult.failed(ResultCode.VALIDATE_INPUTS);
|
||||
}
|
||||
|
||||
AccountUserBase accountUserBase;
|
||||
// 查询绑定手机的商家账号
|
||||
AccountUserBindConnect bind_row = accountUserBindConnectService.getBindByBindId(user_mobile, BindCode.MOBILE, userType);
|
||||
AccountUserBase accountUserBase;
|
||||
if (bind_row != null) {
|
||||
// 已绑定账号的情况
|
||||
// 已经注册账号的,绑定了手机的情况,
|
||||
Integer user_id = bind_row.getUser_id();
|
||||
accountUserBase = get(user_id);
|
||||
if (accountUserBase == null) {
|
||||
return CommonResult.failed("获取不到用户信息!");
|
||||
}
|
||||
|
||||
} else {
|
||||
// 手机号码未绑定,注册新账号
|
||||
// 手机号码未绑定的情况,直接去注册一个账号
|
||||
Map<String, Object> userInfo = new HashMap<>();
|
||||
userInfo.put("user_account", user_mobile);
|
||||
userInfo.put("user_mobile", user_mobile);
|
||||
userInfo.put("user_is_admin", userType); // 商家或代理商入驻注册
|
||||
|
||||
String user_password = StrUtil.isNotBlank(regPwd) ? regPwd :
|
||||
com.suisung.mall.common.utils.StringUtils.random(6, com.suisung.mall.common.utils.StringUtils.RandomType.STRING);
|
||||
|
||||
userInfo.put("user_is_admin", userType); // 商家入驻注册
|
||||
// 随机数明文密码
|
||||
String user_password = com.suisung.mall.common.utils.StringUtils.random(6, com.suisung.mall.common.utils.StringUtils.RandomType.STRING);
|
||||
userInfo.put("user_password", user_password);
|
||||
userInfo.put("is_admin", userType); // 商家入驻注册
|
||||
userInfo.put("invite_code", StrUtil.isNotBlank(inviteCode) ? inviteCode : ""); // 商家注册代理商的邀请码
|
||||
|
||||
// 注:注册商家账号,都是需要手机号绑定的。
|
||||
accountUserBase = register(userInfo);
|
||||
if (accountUserBase == null) {
|
||||
throw new ApiException(_("账号注册失败!"));
|
||||
}
|
||||
}
|
||||
|
||||
// 构建登录参数
|
||||
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_secret", AuthConstant.AUTHORITY_MOBILE_SECRET);
|
||||
@ -3337,164 +3267,17 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
params.put("username", accountUserBase.getUser_account());
|
||||
params.put("password", "");
|
||||
params.put("user_mobile", user_mobile);
|
||||
params.put("is_merch", CommonConstant.USER_TYPE_MCH.equals(userType) ? "1" : "2"); // 是否为商家入驻 1-是;其他-否
|
||||
params.put("is_agent", CommonConstant.USER_TYPE_AGENT.equals(userType) ? "1" : "2"); // 是否为代理商入驻 1-是;其他-否
|
||||
params.put("is_merch", "1"); // 是否为商家入驻 1-是;其他-否
|
||||
|
||||
if (StrUtil.isNotBlank(cid)) {
|
||||
params.put("cid", cid); // 个推客户端Id
|
||||
params.put("os_type", osType); // 个推客系统类别 1-Android;2-iOS;3-微信小程序;
|
||||
params.put("os_type", osType);// 个推客系统类别 1-Android;2-iOS;3-微信小程序;
|
||||
// logger.info("推送参数2 cid:{}, osType:{}", cid, osType);
|
||||
}
|
||||
|
||||
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
|
||||
public Map<String, Object> doAppConnectLogin(String bind_name, String code) {
|
||||
String id_prefix = "";
|
||||
@ -4020,23 +3803,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
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,给商家账户创立公司员工账号和权限)
|
||||
|
||||
@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
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.update.UpdateWrapper;
|
||||
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.ResultCode;
|
||||
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.feignService.ShopService;
|
||||
import com.suisung.mall.common.modules.account.AccountUserBase;
|
||||
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.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.StringUtils;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -52,7 +43,6 @@ import java.util.*;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUserBindConnectMapper, AccountUserBindConnect> implements AccountUserBindConnectService {
|
||||
|
||||
@Autowired
|
||||
@ -61,12 +51,6 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
||||
@Autowired
|
||||
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
|
||||
*
|
||||
@ -597,14 +435,13 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
||||
/**
|
||||
* 初始化账户用户绑定信息
|
||||
*
|
||||
* @param bindId 绑定ID
|
||||
* @param bindType 绑定类型
|
||||
* @param userId 用户ID
|
||||
* @param userType 用户类型
|
||||
* @param inviteCode 代理商邀请码
|
||||
* @param bindId 绑定ID
|
||||
* @param bindType 绑定类型
|
||||
* @param userId 用户ID
|
||||
* @param userType 用户类型
|
||||
* @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
|
||||
if (StrUtil.isBlank(bindId)
|
||||
|| ObjectUtil.isNull(bindType)
|
||||
@ -626,7 +463,7 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
||||
.eq("user_id", userId)
|
||||
.eq("bind_active", CommonConstant.Enable).orderByAsc("bind_time");
|
||||
|
||||
AccountUserBindConnect existingBindConnect = getOne(queryWrapper, false);
|
||||
AccountUserBindConnect existingBindConnect = findOne(queryWrapper);
|
||||
if (existingBindConnect != null) {
|
||||
log.info("账户用户绑定信息已存在,bindId={}, bindType={}, userId={}, userType={}", bindId, bindType, userId, userType);
|
||||
return existingBindConnect;
|
||||
@ -644,7 +481,6 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
||||
newBindConnect.setBind_token_ttl(0);
|
||||
newBindConnect.setBind_level(0);
|
||||
newBindConnect.setBind_vip(0);
|
||||
newBindConnect.setInvite_code(inviteCode); // 代理商邀请码
|
||||
|
||||
// log.debug("准备创建新的账户用户绑定信息: {}", JSONUtil.toJsonStr(newBindConnect));
|
||||
|
||||
@ -669,25 +505,24 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
||||
}
|
||||
|
||||
@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.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("bind_active", CommonConstant.Enable)
|
||||
.eq("bind_tmpl", bindTmpl)
|
||||
.gt("send_number", 0)
|
||||
.eq("bind_tmpl",bindTmpl)
|
||||
.orderByAsc("bind_time");
|
||||
return this.lists(queryWrapper, pageNum, pageSize).getRecords();
|
||||
return this.lists(queryWrapper,pageNum,pageSize).getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAllBindCount(String bindTmpl) {
|
||||
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("bind_active", CommonConstant.Enable)
|
||||
.eq("bind_tmpl", bindTmpl)
|
||||
.eq("bind_tmpl",bindTmpl)
|
||||
.orderByAsc("bind_time");
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
@ -702,46 +537,42 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
||||
// log.info("错误信息--{}",e.getMessage());
|
||||
// }
|
||||
log.info("jsonObject:{}", jsonObject);
|
||||
String openId = jsonObject.getStr("FromUserName");//用户openid
|
||||
String openId=jsonObject.getStr("FromUserName");//用户openid
|
||||
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("bind_openid", openId)
|
||||
queryWrapper.eq("bind_openid",openId)
|
||||
.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);
|
||||
List<AccountUserBindConnect> accountUserBindConnectList = list(queryWrapper);
|
||||
List<AccountUserBindConnect> accountUserBindConnectList= list(queryWrapper);
|
||||
if (!accountUserBindConnectList.isEmpty()) {
|
||||
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectList.get(0);
|
||||
JSONArray jsonArray = null;
|
||||
JSONObject object = null;
|
||||
AccountUserBindConnect accountUserBindConnect=accountUserBindConnectList.get(0);
|
||||
JSONArray jsonArray=null;
|
||||
JSONObject object= null;
|
||||
try {
|
||||
jsonArray = jsonObject.getJSONArray("List");
|
||||
} catch (RuntimeException runtimeException) {
|
||||
jsonArray= jsonObject.getJSONArray("List");
|
||||
}catch (RuntimeException runtimeException){
|
||||
log.info("单个模板");
|
||||
object = jsonObject.getJSONObject("List");
|
||||
object=jsonObject.getJSONObject("List");
|
||||
}
|
||||
UpdateWrapper<AccountUserBindConnect> updateWrapper = new UpdateWrapper<>();
|
||||
if (jsonArray != null) {
|
||||
object = (JSONObject) jsonArray.get(0);
|
||||
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
|
||||
if (SubscribeStatusString.equals("accept")) {
|
||||
String mapKey = RedisConstant.SUB_SEND_CACHE + accountUserBindConnect.getUser_id();
|
||||
redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE, mapKey, 1);
|
||||
object= (JSONObject) jsonArray.get(0);
|
||||
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
|
||||
if(SubscribeStatusString.equals("accept")){
|
||||
accountUserBindConnect.setBind_tmpl(templateId);
|
||||
getUpdateWrapper(updateWrapper, accountUserBindConnect);
|
||||
}
|
||||
} else {
|
||||
}else {
|
||||
assert object != null;
|
||||
String templateId = object.getStr("TemplateId");//模板id
|
||||
String SubscribeStatusString = object.getStr("SubscribeStatusString");
|
||||
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);
|
||||
String templateId= object.getStr("TemplateId");//模板id
|
||||
String SubscribeStatusString= object.getStr("SubscribeStatusString");
|
||||
if(StringUtils.isNotEmpty(SubscribeStatusString)&&SubscribeStatusString.equals("accept")){
|
||||
accountUserBindConnect.setBind_tmpl(templateId);
|
||||
getUpdateWrapper(updateWrapper, accountUserBindConnect);
|
||||
} else {
|
||||
String ErrorStatus = object.getStr("ErrorStatus");
|
||||
if (ErrorStatus.equals("success")) {
|
||||
}else {
|
||||
String ErrorStatus=object.getStr("ErrorStatus");
|
||||
if(ErrorStatus.equals("success")){
|
||||
log.info("消息推送成功给用户,不需要操作");
|
||||
return;
|
||||
}
|
||||
@ -751,21 +582,18 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 封装相同参数的调用方法
|
||||
*
|
||||
* @param updateWrapper
|
||||
* @param accountUserBindConnect
|
||||
*/
|
||||
private void getUpdateWrapper(UpdateWrapper<AccountUserBindConnect> updateWrapper,
|
||||
AccountUserBindConnect accountUserBindConnect) {
|
||||
updateWrapper.set("bind_tmpl", accountUserBindConnect.getBind_tmpl());
|
||||
updateWrapper.eq("bind_id", accountUserBindConnect.getBind_id());
|
||||
updateWrapper.eq("bind_type", accountUserBindConnect.getBind_type());
|
||||
updateWrapper.eq("user_id", accountUserBindConnect.getUser_id());
|
||||
updateWrapper.eq("user_type", accountUserBindConnect.getUser_type());
|
||||
updateWrapper.set("send_number", accountUserBindConnect.getSend_number());
|
||||
updateWrapper.set("bind_tmpl",accountUserBindConnect.getBind_tmpl());
|
||||
updateWrapper.eq("bind_id",accountUserBindConnect.getBind_id());
|
||||
updateWrapper.eq("bind_type",accountUserBindConnect.getBind_type());
|
||||
updateWrapper.eq("user_id",accountUserBindConnect.getUser_id());
|
||||
updateWrapper.eq("user_type",accountUserBindConnect.getUser_type());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@ import com.suisung.mall.common.feignService.PayService;
|
||||
import com.suisung.mall.common.feignService.ShopService;
|
||||
import com.suisung.mall.common.modules.account.*;
|
||||
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.utils.CSVUtils;
|
||||
import com.suisung.mall.common.utils.CheckUtil;
|
||||
@ -81,10 +80,6 @@ public class AccountUserInfoServiceImpl extends BaseServiceImpl<AccountUserInfoM
|
||||
@Autowired
|
||||
private PayService payService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreMemberLevelService shopStoreMemberLevelService;
|
||||
|
||||
|
||||
/**
|
||||
* 实名认证页面
|
||||
*
|
||||
@ -162,6 +157,7 @@ public class AccountUserInfoServiceImpl extends BaseServiceImpl<AccountUserInfoM
|
||||
@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) {
|
||||
AccountBaseUserLevel level_row = null;
|
||||
|
||||
if (CheckUtil.isNotEmpty(user_exp_total)) {
|
||||
// 需要设置经验值,设置为0否则忽略不计
|
||||
QueryWrapper<AccountBaseUserLevel> levelQueryWrapper = new QueryWrapper<>();
|
||||
@ -182,7 +178,7 @@ public class AccountUserInfoServiceImpl extends BaseServiceImpl<AccountUserInfoM
|
||||
// 需要设置经验值,设置为0否则忽略不计
|
||||
QueryWrapper<AccountBaseUserLevel> levelQueryWrapper = new QueryWrapper<>();
|
||||
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);
|
||||
}
|
||||
|
||||
@ -435,11 +431,8 @@ public class AccountUserInfoServiceImpl extends BaseServiceImpl<AccountUserInfoM
|
||||
|
||||
@Override
|
||||
public List<Map> getUser(List<Integer> user_ids) {
|
||||
QueryWrapper<AccountUserBase> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("user_id", 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);
|
||||
List<AccountUserBase> user_base_rows = accountUserBaseService.gets(user_ids);
|
||||
List<Map> user_info_rows = Convert.toList(Map.class, gets(user_ids));
|
||||
|
||||
for (Map user_info_row : user_info_rows) {
|
||||
Integer user_id = (Integer) user_info_row.get("user_id");
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -99,7 +99,7 @@ logging:
|
||||
suisung:
|
||||
mall:
|
||||
account:
|
||||
mapper: info
|
||||
mapper: debug
|
||||
sun:
|
||||
mail: error
|
||||
baomidou: error
|
||||
|
||||
@ -4,6 +4,6 @@
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
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>
|
||||
</mapper>
|
||||
|
||||
@ -1,19 +1,13 @@
|
||||
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.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.Router;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -44,18 +38,6 @@ public class AdminBaseMenuController {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
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.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.utils.ContextUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.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.List;
|
||||
@ -42,11 +43,15 @@ public class AdminBaseProtocolController {
|
||||
*/
|
||||
@ApiOperation(value = "基础通信协议表-分页列表查询", notes = "基础通信协议表-分页列表查询")
|
||||
@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 = "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
|
||||
*/
|
||||
@ApiOperation(value = "基础通信协议表-编辑", notes = "基础通信协议表-编辑")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public CommonResult edit(@RequestBody AdminBaseProtocol adminBaseProtocol) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminBaseProtocolService.editAdminBaseProtocol(adminBaseProtocol);
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
public CommonResult edit(AdminBaseProtocol adminBaseProtocol) {
|
||||
boolean flag = adminBaseProtocolService.edit(adminBaseProtocol);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
@ -86,13 +87,9 @@ public class AdminBaseProtocolController {
|
||||
* @return
|
||||
*/
|
||||
@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) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminBaseProtocolService.deleteBatchByIds(Arrays.asList(cmd_ids.split(",")));
|
||||
boolean flag = adminBaseProtocolService.removeByIds(Arrays.asList(cmd_ids.split(",")));
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
@ -114,25 +111,10 @@ public class AdminBaseProtocolController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "基础通信协议表-新增", notes = "基础通信协议表-新增")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult add(@RequestBody AdminBaseProtocol adminBaseProtocol) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminBaseProtocolService.addAdminBaseProtocol(adminBaseProtocol);
|
||||
@RequestMapping(value = "/add", method = RequestMethod.PUT)
|
||||
public CommonResult add(AdminBaseProtocol adminBaseProtocol) {
|
||||
boolean flag = adminBaseProtocolService.save(adminBaseProtocol);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,15 +1,11 @@
|
||||
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.metadata.IPage;
|
||||
import com.suisung.mall.admin.service.AdminRightsBaseService;
|
||||
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.ElTree;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -44,7 +40,7 @@ public class AdminRightsBaseController {
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -分页列表查询", notes = "权限表 -分页列表查询")
|
||||
@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 = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
||||
@ -55,21 +51,6 @@ public class AdminRightsBaseController {
|
||||
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数据
|
||||
@ -97,12 +78,8 @@ public class AdminRightsBaseController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -编辑", notes = "权限表 -编辑")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public CommonResult edit(@RequestBody AdminRightsBase adminRightsBase) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
public CommonResult edit(AdminRightsBase adminRightsBase) {
|
||||
boolean flag = adminRightsBaseService.edit(adminRightsBase);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
@ -117,10 +94,6 @@ public class AdminRightsBaseController {
|
||||
@ApiOperation(value = "权限表 -通过rights_id删除", notes = "权限表 -通过rights_id删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
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);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
@ -132,12 +105,8 @@ public class AdminRightsBaseController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -批量删除", notes = "权限表 -批量删除")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public CommonResult deleteBatch(String rights_ids) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
|
||||
public CommonResult deleteBatch(@RequestParam(name = "rights_ids") String rights_ids) {
|
||||
boolean flag = this.adminRightsBaseService.remove(Arrays.asList(rights_ids.split(",")));
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
@ -151,13 +120,6 @@ public class AdminRightsBaseController {
|
||||
@ApiOperation(value = "权限表 -新增", notes = "权限表 -编辑")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
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);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
@ -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.utils.I18nUtil;
|
||||
import com.suisung.mall.common.utils.LogUtil;
|
||||
import com.suisung.mall.common.utils.UploadUtil;
|
||||
import com.suisung.mall.common.utils.VideoUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -170,9 +169,6 @@ public class OssServiceImpl implements OssService {
|
||||
* @return
|
||||
*/
|
||||
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);
|
||||
String url = null;
|
||||
@ -252,7 +248,7 @@ public class OssServiceImpl implements OssService {
|
||||
tempFile.delete();
|
||||
logger.info("临时文件已删除: {}", uploadPath);
|
||||
}
|
||||
|
||||
|
||||
// 同时删除可能创建的封面文件
|
||||
String coverPath = uploadPath.replace("." + VideoUtil.getVideoFormat(uploadPath), ".jpg");
|
||||
File coverFile = new File(coverPath);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
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.modules.admin.AdminBaseMenu;
|
||||
import com.suisung.mall.common.modules.admin.Router;
|
||||
@ -33,6 +32,4 @@ public interface AdminBaseMenuService extends IBaseService<AdminBaseMenu> {
|
||||
CommonResult saveAdminBaseMenu(AdminBaseMenu adminBaseMenu);
|
||||
|
||||
CommonResult updateAdminBaseMenu(AdminBaseMenu adminBaseMenu);
|
||||
|
||||
IPage<AdminBaseMenu> treePage(AdminBaseMenu adminBaseMenu, Integer pageNum, Integer pageSize);
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
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.core.web.service.IBaseService;
|
||||
|
||||
@ -22,17 +21,4 @@ public interface AdminBaseProtocolService extends IBaseService<AdminBaseProtocol
|
||||
* 初始化资源角色规则
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
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.ElTree;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
@ -22,9 +21,4 @@ public interface AdminRightsBaseService extends IBaseService<AdminRightsBase> {
|
||||
* 获取tree数据
|
||||
*/
|
||||
List<ElTree> tree();
|
||||
|
||||
/**
|
||||
* 获取tree数据
|
||||
*/
|
||||
IPage<AdminRightsBase> treePage(AdminRightsBase adminRightsBase, Integer pageNum, Integer pageSize);
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class AdminAppMarketUpdateServiceImpl extends BaseServiceImpl<AdminAppMar
|
||||
QueryWrapper<AdminAppMarketUpdate> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("market_id", marketId).eq("status", CommonConstant.Enable).orderByDesc("version_key");
|
||||
|
||||
AdminAppMarketUpdate adminAppMarketUpdate = getOne(queryWrapper, false);
|
||||
AdminAppMarketUpdate adminAppMarketUpdate = findOne(queryWrapper);
|
||||
if (adminAppMarketUpdate == null) {
|
||||
return CommonResult.success(null, "没有找到最新版本");
|
||||
}
|
||||
@ -285,6 +285,6 @@ public class AdminAppMarketUpdateServiceImpl extends BaseServiceImpl<AdminAppMar
|
||||
queryWrapper.eq("market_id", marketId).eq("status", CommonConstant.Enable)
|
||||
.eq("package_name", packageName).orderByDesc("version_key");
|
||||
|
||||
return getOne(queryWrapper, false);
|
||||
return findOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.suisung.mall.admin.mapper.AdminBaseMenuMapper;
|
||||
import com.suisung.mall.admin.service.AccountBaseConfigService;
|
||||
@ -871,16 +870,6 @@ public class AdminBaseMenuServiceImpl extends BaseServiceImpl<AdminBaseMenuMappe
|
||||
|
||||
@Override
|
||||
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)) {
|
||||
return CommonResult.failed("新增失败");
|
||||
}
|
||||
@ -889,61 +878,12 @@ public class AdminBaseMenuServiceImpl extends BaseServiceImpl<AdminBaseMenuMappe
|
||||
|
||||
@Override
|
||||
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)) {
|
||||
return CommonResult.failed("更新失败");
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否为平台
|
||||
|
||||
@ -3,30 +3,18 @@ package com.suisung.mall.admin.service.impl;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.service.AdminBaseMenuService;
|
||||
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.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.AdminRightsBase;
|
||||
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.impl.BaseServiceImpl;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.validator.internal.util.stereotypes.Lazy;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
@ -50,17 +38,6 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
|
||||
@Autowired
|
||||
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
|
||||
*/
|
||||
@Override
|
||||
public boolean addAdminBaseProtocol(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("已存在相同的路由");
|
||||
}
|
||||
public boolean add(AdminBaseProtocol adminBaseProtocol) {
|
||||
boolean flag = save(adminBaseProtocol);
|
||||
initResourceRolesMap();
|
||||
return flag;
|
||||
@ -89,83 +58,25 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean editAdminBaseProtocol(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("已存在相同的路由");
|
||||
}
|
||||
public boolean edit(AdminBaseProtocol adminBaseProtocol) {
|
||||
boolean flag = updateById(adminBaseProtocol);
|
||||
initResourceRolesMap();
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据cmd_id批量删除
|
||||
* @param adminBaseProtocolIds
|
||||
* 根据cmd_id删除
|
||||
*
|
||||
* @param cmd_id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteBatchByIds(List<String> adminBaseProtocolIds) {
|
||||
boolean flag = removeBatchByIds(adminBaseProtocolIds);
|
||||
public boolean remove(Serializable cmd_id) {
|
||||
boolean flag = super.remove(cmd_id);
|
||||
initResourceRolesMap();
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 对比两个数组是否有相同元素
|
||||
*
|
||||
|
||||
@ -2,16 +2,11 @@ package com.suisung.mall.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.service.AccountBaseConfigService;
|
||||
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.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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -53,59 +48,6 @@ public class AdminRightsBaseServiceImpl extends BaseServiceImpl<AdminRightsBaseM
|
||||
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
|
||||
*
|
||||
|
||||
@ -10,8 +10,8 @@ import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.exception.ApiUserException;
|
||||
import com.suisung.mall.common.modules.cms.CmsArticleComment;
|
||||
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.common.utils.I18nUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -48,13 +48,13 @@ public class CmsArticleCommentHelpfulServiceImpl extends BaseServiceImpl<CmsArti
|
||||
queryWrapper.eq("user_id", user.getId());
|
||||
queryWrapper.eq("article_id", cmsArticleCommentHelpful.getArticle_id());
|
||||
|
||||
CmsArticleCommentHelpful dbArticleCommentHelpful = getOne(queryWrapper, false);
|
||||
CmsArticleCommentHelpful dbArticleCommentHelpful = findOne(queryWrapper);
|
||||
|
||||
QueryWrapper<CmsArticleComment> commentQueryWrapper = new QueryWrapper<>();
|
||||
commentQueryWrapper.eq("comment_id", cmsArticleCommentHelpful.getComment_id());
|
||||
commentQueryWrapper.eq("article_id", cmsArticleCommentHelpful.getArticle_id());
|
||||
commentQueryWrapper.eq("user_id", user.getId());
|
||||
CmsArticleComment dbArticleComment = cmsArticleCommentService.getOne(commentQueryWrapper, false);
|
||||
CmsArticleComment dbArticleComment = cmsArticleCommentService.findOne(commentQueryWrapper);
|
||||
|
||||
if (null == dbArticleCommentHelpful) {
|
||||
cmsArticleCommentHelpful.setUser_id(user.getId());
|
||||
|
||||
@ -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 "系统繁忙,请稍后再试";
|
||||
}
|
||||
@ -15,8 +15,8 @@ public class StateCode {
|
||||
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_EXP = 10; // 普通快递
|
||||
public static final int DELIVERY_TYPE_IN_STORE_SERVICE = 15; // 店铺配送(运费 0 元)
|
||||
public static final int DELIVERY_TYPE_SAME_CITY = 16;//同城配送
|
||||
public static final int DELIVERY_TYPE_IN_STORE_SERVICE = 15; // 店铺配送
|
||||
public static final int DELIVERY_TYPE_SAME_CITY = 16;//顺丰同城配送
|
||||
|
||||
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_EXP, "普通快递");
|
||||
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_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 {
|
||||
DELIVERY_TIME_NOT_TIMER.put(1, I18nUtil._("不限时段"));
|
||||
DELIVERY_TIME_NOT_TIMER.put(15, I18nUtil._("上午"));
|
||||
|
||||
@ -30,11 +30,6 @@ public class AuthConstant {
|
||||
*/
|
||||
public static final String MCH_CLIENT_ID = "mch-app";
|
||||
|
||||
/**
|
||||
* 商家版移动端client_id
|
||||
*/
|
||||
public static final String AGENT_CLIENT_ID = "agent-app";
|
||||
|
||||
/**
|
||||
* 微信client_ID
|
||||
*/
|
||||
|
||||
@ -20,12 +20,11 @@ public class CommonConstant {
|
||||
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_ADMIN = 1;
|
||||
public static final Integer USER_TYPE_MCH = 2;
|
||||
public static final Integer USER_TYPE_AGENT = 3;
|
||||
|
||||
// 国际电话区号
|
||||
public static final String IDD_ZH_CN = "+86"; //中国
|
||||
@ -111,12 +110,6 @@ public class CommonConstant {
|
||||
//秒杀活动订阅消息模板id
|
||||
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-按可分账金额;
|
||||
public static final int SeparateCalcMode_TotalAmt = 1;
|
||||
public static final int SeparateCalcMode_CanSeparateAmt = 2;
|
||||
@ -133,27 +126,10 @@ public class CommonConstant {
|
||||
public static final Integer Order_Booking_State_YY = 2;
|
||||
|
||||
// 预约下单从当前时间延迟的最小分钟数(单位分钟),不能低于35分钟
|
||||
public final static Integer MIN_DELAY_MINUTES_FOR_BOOKING_ORDER = 50;
|
||||
public final static Integer MIN_DELAY_MINUTES_FOR_BOOKING_ORDER = 46;
|
||||
|
||||
// 预约订单创建提前分钟数(用于提前创建顺丰订单)
|
||||
// public final static Integer MIN_DELAY_MINUTES_FOR_SF_EXPRESS_ORDER = 35;
|
||||
|
||||
|
||||
// 店铺营业状态: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;
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@ public class MqConstant {
|
||||
public static final Integer FAILURE = 2; // 消息消费失败更改状态
|
||||
public static final Integer DELIVERED = 3; // 消息重试消费成功更改状态
|
||||
public static final Integer MAX_COUNT = 3; // 消息重新投递最大重试次数
|
||||
|
||||
public static final String SHOP_EXCHANGE = "shop-event-exchange"; // SHOP服务交换机
|
||||
public static final String ACCOUNT_EXCHANGE = "account-event-exchange"; // ACCOUNT服务交换机
|
||||
public static final String PAY_EXCHANGE = "pay-event-exchange"; // PAY服务交换机
|
||||
|
||||
@ -44,13 +44,4 @@ public class RedisConstant {
|
||||
// 预约订单任务新增键
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.suisung.mall.common.constant.AuthConstant;
|
||||
import com.suisung.mall.common.constant.CommonConstant;
|
||||
import com.suisung.mall.common.utils.CheckUtil;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -24,7 +23,7 @@ public class UserDto implements Serializable {
|
||||
private String user_password;
|
||||
private String user_nickname;
|
||||
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 List<String> roles;
|
||||
// 服务端返回rid 角色编号: 0-用户;2-商家;3-门店;9-平台;
|
||||
@ -32,8 +31,6 @@ public class UserDto implements Serializable {
|
||||
private Integer site_id = 0; //分站编号
|
||||
private String store_id;
|
||||
private String chain_id;
|
||||
private Integer user_is_admin;//用户类型:对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;3-代理商;
|
||||
private String invite_code; // 代理商邀请码
|
||||
|
||||
/**
|
||||
* 用户角色是平台
|
||||
@ -94,41 +91,18 @@ public class UserDto implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 代理商端
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isAgent() {
|
||||
return ObjectUtil.equal(client_id, AuthConstant.AGENT_CLIENT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户类型:对应user_base 的 user_is_admin:0-普通用户;1-管理员;2-入驻商家;3-代理商;
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
// public Integer getUserType() {
|
||||
// Integer user_type = CommonConstant.USER_TYPE_NORMAL; // 用户类型,对应user_base 的 user_is_admin:0-普通用户;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_admin:0-普通用户;1-管理员;2-入驻商家;3-代理商;
|
||||
* 获取用户类型:对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Integer getUserType() {
|
||||
// 用户类型,对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;
|
||||
return CheckUtil.isNotEmpty(this.user_is_admin) ? this.user_is_admin : CommonConstant.USER_TYPE_NORMAL;
|
||||
Integer user_type = CommonConstant.USER_TYPE_NORMAL; // 用户类型,对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;
|
||||
if (isAdmin()) {
|
||||
user_type = CommonConstant.USER_TYPE_ADMIN;
|
||||
} else if (isMerchant()) {
|
||||
user_type = CommonConstant.USER_TYPE_MCH;
|
||||
}
|
||||
|
||||
return user_type;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import com.suisung.mall.common.pojo.output.TimelineOutput;
|
||||
import com.suisung.mall.common.pojo.res.ThirdApiRes;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -279,15 +278,6 @@ public interface AccountService {
|
||||
@PostMapping(value = "/admin/account/accountController/saveBatchAccountInfo")
|
||||
ThirdApiRes saveBatchAccountInfo(@RequestBody List<AccountUserInfo> accountUserInfoList);
|
||||
|
||||
/**
|
||||
* 批量保存accountUserLogin
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/admin/account/accountController/saveBatchAccountUserLogin")
|
||||
ThirdApiRes saveBatchAccountUserLogin(@RequestBody List<AccountUserLogin> accountUserLoginList);
|
||||
|
||||
|
||||
/**
|
||||
* 批量保存accountInfo
|
||||
*
|
||||
@ -313,37 +303,4 @@ public interface AccountService {
|
||||
|
||||
@GetMapping(value = "/admin/account/accountController/getAllBindCount")
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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.product.ShopProductBase;
|
||||
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 org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
@ -32,7 +35,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 认证服务远程调用
|
||||
*/
|
||||
@FeignClient(value = "mall-shop")
|
||||
@FeignClient("mall-shop")
|
||||
public interface ShopService {
|
||||
|
||||
@PostMapping(value = "/admin/shop/shopController/deletePlantformUserByUid")
|
||||
@ -323,31 +326,5 @@ public interface ShopService {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ public class AccountBaseUserLevel implements Serializable {
|
||||
private Integer user_level_fans_team;
|
||||
|
||||
@ApiModelProperty(value = "累计消费")
|
||||
private BigDecimal user_level_spend;
|
||||
private Integer user_level_spend;
|
||||
|
||||
@ApiModelProperty(value = "升级产品SPU编号(DOT)")
|
||||
private String user_level_product_id;
|
||||
|
||||
@ -101,17 +101,11 @@ public class AccountUserBindConnect implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "新增时间")
|
||||
private Date created_at;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updated_at;
|
||||
|
||||
@ApiModelProperty(value = "允许通知的消息通知模板id")
|
||||
private String bind_tmpl;
|
||||
|
||||
@ApiModelProperty(value = "剩余订阅次数")
|
||||
private Integer send_number;
|
||||
|
||||
@ApiModelProperty(value = "(商家的)代理商的邀请码")
|
||||
private String invite_code;
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.suisung.mall.common.modules.account;
|
||||
|
||||
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.suisung.mall.common.annotation.OssMedia;
|
||||
@ -120,14 +119,5 @@ public class AccountUserInfo implements Serializable {
|
||||
@ApiModelProperty(value = "渠道编码")
|
||||
private Integer ucc_id;
|
||||
|
||||
/**
|
||||
* 同步会员到店铺会员,与消息队列UserLevelTO关联
|
||||
*/
|
||||
@ApiModelProperty(value = "店铺id")
|
||||
@TableField(exist = false)
|
||||
private Integer store_id;
|
||||
|
||||
@ApiModelProperty(value = "店铺名称")
|
||||
@TableField(exist = false)
|
||||
private String store_name;
|
||||
}
|
||||
|
||||
@ -56,20 +56,8 @@ public class ShopActivityCutprice implements Serializable {
|
||||
@ApiModelProperty(value = "砍价人数")
|
||||
private Integer ac_num;
|
||||
|
||||
@ApiModelProperty(value = "砍价过期时间戳")
|
||||
private Long expired_at;
|
||||
|
||||
@ApiModelProperty(value = "用户砍价订单状态:1-砍价已完成下单;2-砍价未下单已取消;3-砍价助力进行中;4-砍价过期失效;6-砍价助力已完成待下单;")
|
||||
private Integer state;
|
||||
|
||||
@Version
|
||||
@ApiModelProperty(value = "乐观锁")
|
||||
private Integer version;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updated_at;
|
||||
|
||||
@ApiModelProperty(value = "大转盘次数")
|
||||
private Integer lottery_num;
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
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.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -50,14 +52,5 @@ public class ShopActivityCutpriceHistory implements Serializable {
|
||||
@ApiModelProperty(value = "砍价编号")
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.suisung.mall.common.modules.admin;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
@ -12,7 +11,6 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -107,7 +105,5 @@ public class AdminBaseMenu implements Serializable {
|
||||
@ApiModelProperty(value = "允许关闭(BOOL):0-禁止;1-允许")
|
||||
private Integer menu_close;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "节点子集")
|
||||
private List<AdminBaseMenu> children;
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.suisung.mall.common.modules.admin;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
@ -11,7 +10,6 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -63,11 +61,5 @@ public class AdminBaseProtocol implements Serializable {
|
||||
@ApiModelProperty(value = "请求地址")
|
||||
private String path;
|
||||
|
||||
//平台权限id和名称
|
||||
@TableField(exist = false)
|
||||
private Map<Integer,String> adminRightBaseMap;
|
||||
|
||||
//店铺权限id和名称
|
||||
@TableField(exist = false)
|
||||
private Map<Integer,String> shopStoreEmployeeRightsBaseMap;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.suisung.mall.common.modules.admin;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
@ -11,7 +10,6 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -49,7 +47,5 @@ public class AdminRightsBase implements Serializable {
|
||||
@ApiModelProperty(value = "功能开启:跟设置config_key")
|
||||
private String menu_func;
|
||||
|
||||
@ApiModelProperty(value = "节点子集")
|
||||
@TableField(exist = false)
|
||||
private List<AdminRightsBase> children;
|
||||
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
package com.suisung.mall.common.modules.esign;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
@ -55,18 +54,12 @@ public class EsignPlatformInfo implements Serializable {
|
||||
@ApiModelProperty(value = "平台方营业执照上的经营内容")
|
||||
private String license_content;
|
||||
|
||||
@ApiModelProperty(value = "代理商执照的省/市/区,如:广东省/深圳市/福田区")
|
||||
@ApiModelProperty(value = "代理商的省/市/区,如:广东省/深圳市/福田区")
|
||||
private String license_area;
|
||||
|
||||
@ApiModelProperty(value = "代理商营业执照的省id/市id/区id,如:11000/11100/11101")
|
||||
@ApiModelProperty(value = "代理商的省id/市id/区id,如:11000/11100/11101")
|
||||
private String license_district_id;
|
||||
|
||||
@ApiModelProperty(value = "期望代理的省/市/区,如:广东省/深圳市/福田区")
|
||||
private String agent_area;
|
||||
|
||||
@ApiModelProperty(value = "期望代理的省id/市id/区id,如:11000/11100/11101")
|
||||
private String agent_district_id;
|
||||
|
||||
@ApiModelProperty(value = "平台方营业执照公司详细地址")
|
||||
private String license_address;
|
||||
|
||||
@ -121,10 +114,6 @@ public class EsignPlatformInfo implements Serializable {
|
||||
@ApiModelProperty(value = "邀请码,后期跟收益有关")
|
||||
private String invite_code;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "代理商邀请链接")
|
||||
private String invite_url;
|
||||
|
||||
@ApiModelProperty(value = "县级市代理商设定的配送费(单位:分)")
|
||||
private Integer shipping_fee;
|
||||
|
||||
@ -134,12 +123,9 @@ public class EsignPlatformInfo implements Serializable {
|
||||
@ApiModelProperty(value = "分账比例值,取值范围:[0.01,1.00]")
|
||||
private BigDecimal split_ratio;
|
||||
|
||||
@ApiModelProperty(value = "状态:0-未申请过;1-已审核通过;2-审核未通过;3-待审中;")
|
||||
@ApiModelProperty(value = "记录状态:1-有效;2-无效;")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "审核代理商备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "创建人用户ID")
|
||||
private String created_by;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -11,7 +11,6 @@ import lombok.NoArgsConstructor;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@ -21,7 +20,7 @@ import java.util.List;
|
||||
@ApiModel(value = "商品库的商品", description = "商品库的商品表")
|
||||
public class LibraryProduct implements Serializable {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@ApiModelProperty(value = "商品ID", example = "1001")
|
||||
private Long id;
|
||||
|
||||
@ -29,11 +28,7 @@ public class LibraryProduct implements Serializable {
|
||||
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "商品简称,作为匹配关键字", example = "小米12 Pro")
|
||||
private String sname;
|
||||
|
||||
@ApiModelProperty(value = "商品标题", example = "小米12 Pro")
|
||||
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "条形码/Barcode", example = "6923450657713")
|
||||
@ -41,11 +36,9 @@ public class LibraryProduct implements Serializable {
|
||||
private String barcode;
|
||||
|
||||
@ApiModelProperty(value = "第一级分类", example = "生鲜")
|
||||
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private String category_1st;
|
||||
|
||||
@ApiModelProperty(value = "第二级分类", example = "牛肉")
|
||||
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private String category_2nd;
|
||||
|
||||
@ApiModelProperty(value = "商品分类", example = "牛肉")
|
||||
@ -69,6 +62,7 @@ public class LibraryProduct implements Serializable {
|
||||
@ApiModelProperty(value = "商品卖点", example = "绿色有机")
|
||||
private String selling_point;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "商品介绍", example = "商品介绍")
|
||||
private String intro;
|
||||
|
||||
@ -98,11 +92,4 @@ public class LibraryProduct implements Serializable {
|
||||
@ApiModelProperty(value = "更新时间", example = "2023-01-02 15:30:00")
|
||||
@TableField(value = "updated_at")
|
||||
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;
|
||||
}
|
||||
@ -9,7 +9,6 @@
|
||||
package com.suisung.mall.common.modules.library;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
@ -35,16 +34,13 @@ public class LibraryProductImage implements Serializable {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "商品ID", position = 2, example = "1001")
|
||||
@TableField(value = "product_id")
|
||||
private Long productId;
|
||||
|
||||
@ApiModelProperty(value = "图片地址", position = 3,
|
||||
example = "/media/images/product/1001.jpg")
|
||||
@TableField(value = "image_url")
|
||||
private String imageUrl;
|
||||
|
||||
@ApiModelProperty(value = "是否主图 1-主图 0-副图", position = 4, example = "1")
|
||||
@TableField(value = "is_main")
|
||||
private Boolean isMain;
|
||||
|
||||
@ApiModelProperty(value = "排序值,越小越前面", position = 5, example = "10")
|
||||
@ -54,10 +50,8 @@ public class LibraryProductImage implements Serializable {
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", position = 7, example = "2023-01-01 12:30:00")
|
||||
@TableField(value = "created_at")
|
||||
private Date createdAt;
|
||||
|
||||
@ApiModelProperty(value = "更新时间", position = 8, example = "2023-01-01 13:15:00")
|
||||
@TableField(value = "updated_at")
|
||||
private Date updatedAt;
|
||||
}
|
||||
@ -42,9 +42,6 @@ public class MchOrderInfoDTO implements Serializable {
|
||||
// 物流轨迹信息(物流,已发货的才有数据)
|
||||
@ApiModelProperty(value = "物流轨迹信息")
|
||||
Map<String, Object> logistics_traces;
|
||||
|
||||
// 退款订单详情
|
||||
MchReturnOrderDetailDTO return_order_detail;
|
||||
|
||||
// 订单信息
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
@ -98,12 +95,16 @@ public class MchOrderInfoDTO implements Serializable {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
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.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -65,22 +67,5 @@ public class ShopPageApp implements Serializable {
|
||||
@ApiModelProperty(value = "是否使用(BOOL):0-否;1-是")
|
||||
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;
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -136,9 +135,5 @@ public class ShopPageBase implements Serializable {
|
||||
@ApiModelProperty(value = "信息发布(BOOL):0-否;1-是")
|
||||
private Integer page_message;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date created_at;
|
||||
|
||||
@ApiModelProperty(value = "最后更新时间")
|
||||
private Date updated_at;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public class ShopProductImage implements Serializable {
|
||||
@ApiModelProperty(value = "规格值")
|
||||
private String color_name;
|
||||
|
||||
@ApiModelProperty(value = "商品主图,0是编辑空图片,1是同步空图片")
|
||||
@ApiModelProperty(value = "商品主图")
|
||||
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private String item_image_default;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -9,7 +9,6 @@
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
@ -97,9 +96,6 @@ public class ShopMchEntry implements Serializable {
|
||||
@ApiModelProperty(value = "入驻商家店铺门面环境图片的存储路径", required = true)
|
||||
private String environment_image;
|
||||
|
||||
@ApiModelProperty(value = "收银台照片", required = true)
|
||||
private String checkstand_image;
|
||||
|
||||
@ApiModelProperty(value = "入驻主体类型,企业或个人:1-企业;2-个人;", required = true)
|
||||
private Integer entity_type;
|
||||
|
||||
@ -187,9 +183,6 @@ public class ShopMchEntry implements Serializable {
|
||||
@ApiModelProperty(value = "结算账户⾏号", required = true)
|
||||
private String openning_bank_code;
|
||||
|
||||
@ApiModelProperty(value = "开户许可证(银行对公开户证明)")
|
||||
private String opening_permit_image;
|
||||
|
||||
@ApiModelProperty(value = "结算账户清算⾏号")
|
||||
private String clearing_bank_code;
|
||||
|
||||
@ -265,13 +258,6 @@ public class ShopMchEntry implements Serializable {
|
||||
@ApiModelProperty(value = "是否绑定分账接收方:1-是;2-否;")
|
||||
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:有效")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -79,9 +79,9 @@ public class ShopStoreActivityBase implements Serializable {
|
||||
@TableField(updateStrategy = NOT_EMPTY)
|
||||
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}}]}")
|
||||
@TableField(updateStrategy = NOT_EMPTY, fill = FieldFill.INSERT_UPDATE)
|
||||
private String activity_rule = "{}";
|
||||
@ApiModelProperty(value = "活动规则(json):不检索{rule_id:{}, rule_id:{}}")
|
||||
@TableField(updateStrategy = NOT_EMPTY)
|
||||
private String activity_rule;
|
||||
|
||||
@ApiModelProperty(value = "参与类型(ENUM):1-免费参与;2-积分参与;3-购买参与")
|
||||
@TableField(updateStrategy = NOT_EMPTY)
|
||||
@ -119,6 +119,7 @@ public class ShopStoreActivityBase implements Serializable {
|
||||
@TableField(updateStrategy = NOT_EMPTY)
|
||||
private Integer activity_share_num;
|
||||
|
||||
@Version
|
||||
@ApiModelProperty(value = "乐观锁")
|
||||
private Integer version;
|
||||
|
||||
@ -126,22 +127,4 @@ public class ShopStoreActivityBase implements Serializable {
|
||||
@TableField(updateStrategy = NOT_EMPTY)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -80,12 +80,9 @@ public class ShopStoreBase implements Serializable {
|
||||
@ApiModelProperty(value = "店铃声开关:1-开启;2-关闭;")
|
||||
private Integer ringtone_is_enable;
|
||||
|
||||
@ApiModelProperty(value = "店铺营业状态:1-开业营业中(且在营业时间内);12-开业打烊中(但在营业时间外);2-停业中;3-开业(或活动)筹备中;")
|
||||
@ApiModelProperty(value = "店铺营业状态:1-营业中;2-已打烊;")
|
||||
private Integer store_biz_state;
|
||||
|
||||
@ApiModelProperty(value = "开业(活动)筹备日期 yyyy-MM-dd")
|
||||
private Date store_biz_opening_date;
|
||||
|
||||
@ApiModelProperty(value = "上级店铺编号:创建店铺决定,所属分销商-不可更改! 佣金公平性考虑")
|
||||
private Integer shop_parent_id;
|
||||
|
||||
@ -141,9 +138,6 @@ public class ShopStoreBase implements Serializable {
|
||||
@ApiModelProperty(value = "店铺统一的打包费, 0-10元范围")
|
||||
private BigDecimal packing_fee;
|
||||
|
||||
@ApiModelProperty(value = "分店所属总店 Id,一般分店有值,总店为0")
|
||||
private Integer parent_id;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "新增时间")
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
@ -11,7 +10,6 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -49,7 +47,5 @@ public class ShopStoreEmployeeRightsBase implements Serializable {
|
||||
@ApiModelProperty(value = "功能开启:跟设置config_key")
|
||||
private String menu_func;
|
||||
|
||||
@ApiModelProperty(value = "节点子集")
|
||||
@TableField(exist = false)
|
||||
private List<ShopStoreEmployeeRightsBase> children;
|
||||
|
||||
}
|
||||
|
||||
@ -126,9 +126,6 @@ public class ShopStoreInfo implements Serializable {
|
||||
@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 = "新增时间")
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
package com.suisung.mall.common.modules.store;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ -16,47 +17,38 @@ import java.util.Date;
|
||||
@Accessors(chain = true)
|
||||
@TableName("shop_store_member")
|
||||
@ApiModel(value = "ShopStoreMember", description = "店铺会员表")
|
||||
public class ShopStoreMember implements Serializable {
|
||||
@TableId(value ="store_member_id", type = IdType.AUTO)
|
||||
public class ShopStoreMember {
|
||||
@TableId(value = "store_member_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "店铺会员ID", example = "10001")
|
||||
private Long store_member_id;
|
||||
private Integer storeMemberId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID", example = "20001")
|
||||
@TableField(value = "user_id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "店铺ID", example = "30001")
|
||||
@TableField(value = "store_id")
|
||||
private Integer storeId;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
@TableField(value = "user_account")
|
||||
private String userAccount;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
@TableField(value = "user_nickname")
|
||||
private String userNickname;
|
||||
|
||||
@ApiModelProperty(value = "店铺名称", example = "旗舰店")
|
||||
@TableField(value = "store_name")
|
||||
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 = "创建时间")
|
||||
@TableField(value = "create_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private Date createdAt;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@TableField(value = "update_time")
|
||||
@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;
|
||||
private Date updatedAt;
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
package com.suisung.mall.common.modules.store;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@ -17,74 +17,26 @@ import java.util.Date;
|
||||
@Accessors(chain = true)
|
||||
@TableName("shop_store_member_level")
|
||||
@ApiModel(value = "ShopStoreMemberLevel", description = "店铺会员等级表")
|
||||
public class ShopStoreMemberLevel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "store_member_level_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "主表id", example = "1")
|
||||
private Integer store_member_level_id;
|
||||
|
||||
public class ShopStoreMemberLevel {
|
||||
@TableId(value = "user_level_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "等级编号", example = "1")
|
||||
@TableField(value = "user_level_id")
|
||||
private Integer userLevelId;
|
||||
|
||||
@ApiModelProperty(value = "等级名称", example = "黄金会员")
|
||||
@TableField(value = "user_level_name")
|
||||
private String userLevelName;
|
||||
|
||||
@ApiModelProperty(value = "累计消费额度", example = "1000.00")
|
||||
@TableField(value = "user_level_spend")
|
||||
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")
|
||||
@TableField(value = "user_level_rate")
|
||||
private BigDecimal userLevelRate;
|
||||
|
||||
@ApiModelProperty(value = "等级修改时间")
|
||||
@TableField(value = "user_level_time")
|
||||
private Date userLevelTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField(value = "create_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private Date createdAt;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@TableField(value = "update_time")
|
||||
@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;
|
||||
private Date updatedAt;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -43,18 +43,12 @@ public class ShopStoreSameCityTransportBase implements Serializable {
|
||||
@TableId(value = "transport_base_id", type = IdType.AUTO)
|
||||
private Long transport_base_id;
|
||||
|
||||
@ApiModelProperty(value = "平台配送费设置?1-是;2-否")
|
||||
private Integer is_platform;
|
||||
|
||||
@ApiModelProperty(value = "店铺ID")
|
||||
private Long store_id;
|
||||
|
||||
@ApiModelProperty(value = "顺丰同城(第三方)店铺ID")
|
||||
private String shop_id;
|
||||
|
||||
@ApiModelProperty(value = "顺丰平台商家Id (用于县级代理商创建店铺的)")
|
||||
private String supplier_id;
|
||||
|
||||
@ApiModelProperty(value = "店铺主营商品分类ID")
|
||||
private Integer business_type;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -28,18 +28,10 @@ public class ProductQuantityConsumption {
|
||||
@ApiModelProperty("商品编号")
|
||||
private String productNumber;
|
||||
|
||||
@TableField(value = "unit_price", updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty("商品单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("数量(正数表示入库/增加,负数表示出库/减少)")
|
||||
@TableField(value = "quantity",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ApiModelProperty("订单总额")
|
||||
@TableField(value = "sale_amount",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private BigDecimal saleAmount;
|
||||
|
||||
@ApiModelProperty("消费状态:0-未消费,1-已消费")
|
||||
@TableField(value = "status",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private Integer status;
|
||||
@ -48,7 +40,7 @@ public class ProductQuantityConsumption {
|
||||
@ApiModelProperty("店铺ID")
|
||||
private Integer storeId;
|
||||
|
||||
@TableField(value = "create_time",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@TableField(value = "update_time",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty("创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
@ -57,8 +49,4 @@ public class ProductQuantityConsumption {
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(value = "sale_time",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "下单时间")
|
||||
private Long saleTime;
|
||||
}
|
||||
|
||||
@ -126,24 +126,4 @@ public class StoreDbConfig implements Serializable {
|
||||
@TableField(value = "shop_gap_time",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@NotBlank(message = "商品同步间隔时间不能为空")
|
||||
private String shopGapTime;
|
||||
|
||||
@TableField(value = "sale_account",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "营业员账号")
|
||||
private String saleAccount;
|
||||
|
||||
@TableField(value = "is_sync_active",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "是否同步活动(0:否,1:是)")
|
||||
private String isSyncActive;
|
||||
|
||||
@TableField(value = "is_sync_member",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "是否同步会员(0:否,1:是)")
|
||||
private String isSyncMember;
|
||||
|
||||
@TableField(value = "automatic",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "默认次日补全库存(思迅同步时配置)")
|
||||
private Integer automatic;
|
||||
|
||||
@TableField(value = "client_version",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "客户端版本:1商云10,2商瑞9.7,3商祺")
|
||||
private String clientVersion;
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
package com.suisung.mall.common.modules.sync;
|
||||
|
||||
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;
|
||||
|
||||
@Data
|
||||
@TableName("sycn_store_data")
|
||||
@ApiModel("商品同步数据")
|
||||
public class SyncStoreData implements Serializable {
|
||||
@TableId(value = "sync_store_data_id", type = IdType.INPUT)
|
||||
@ApiModelProperty("主键ID")
|
||||
private String syncStoreDataId;
|
||||
|
||||
@TableField("store_id")
|
||||
@ApiModelProperty("店铺ID")
|
||||
private String storeId;
|
||||
|
||||
@TableField("content")
|
||||
@ApiModelProperty("同步文本内容")
|
||||
private String content;
|
||||
|
||||
@TableField("file_name")
|
||||
@ApiModelProperty("文件名称")
|
||||
private String fileName;
|
||||
|
||||
@TableField("folder")
|
||||
@ApiModelProperty("文件路径")
|
||||
private String folder;
|
||||
|
||||
@TableField("file_path")
|
||||
@ApiModelProperty("文件全路径")
|
||||
private String filePath;
|
||||
|
||||
@TableField("status")
|
||||
@ApiModelProperty("处理状态0:未处理,1:已处理")
|
||||
private String status;
|
||||
|
||||
@TableField("create_time")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -75,10 +75,4 @@ public class ShopUserVoucher implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "到期使用时间")
|
||||
private Date voucher_start_date;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date created_at;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updated_at;
|
||||
}
|
||||
|
||||
@ -26,18 +26,7 @@ public class LibraryProductDTO implements Serializable {
|
||||
private String keywords;
|
||||
private String thumb;
|
||||
private BigDecimal price;
|
||||
private String sname;
|
||||
private String title;
|
||||
private String category_1st;
|
||||
private String category_2nd;
|
||||
private String category;
|
||||
private String brand;
|
||||
private String spec;
|
||||
private String made_in;
|
||||
private String weight;
|
||||
private String weight_unit;
|
||||
private String selling_point;
|
||||
private String intro;
|
||||
|
||||
private List<ProductImage> product_image_list;
|
||||
|
||||
/**
|
||||
@ -53,7 +42,7 @@ public class LibraryProductDTO implements Serializable {
|
||||
if (this.product_image_list != null) {
|
||||
for (ProductImage image : this.product_image_list) {
|
||||
if (image != null) {
|
||||
image.imageUrl = addDomainPrefix(imageDomain, image.getImageUrl());
|
||||
image.image_url = addDomainPrefix(imageDomain, image.getImage_url());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,10 +66,9 @@ public class LibraryProductDTO implements Serializable {
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "商品库的商品图片", description = "商品库的商品图片")
|
||||
public static class ProductImage implements Serializable {
|
||||
private Long id;
|
||||
private Long productId;
|
||||
private String imageUrl;
|
||||
private Integer isMain;
|
||||
private Long product_id;
|
||||
private String image_url;
|
||||
private Integer is_main;
|
||||
private Integer seq;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package com.suisung.mall.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.util.Pair;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -30,13 +29,10 @@ import java.math.RoundingMode;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Slf4j
|
||||
public class LklSeparateWithTotalAmountDTO {
|
||||
|
||||
// 商家最低分账比例阈值 20%
|
||||
private static final BigDecimal MIN_MERCHANT_RATIO_THRESHOLD = BigDecimal.valueOf(0.2);
|
||||
// 默认平台比例 1%
|
||||
private static final BigDecimal DEFAULT_PLATFORM_RATIO = BigDecimal.valueOf(0.01);
|
||||
// 常量定义
|
||||
private static final BigDecimal MCH_RATIO_THRESHOLD = new BigDecimal("0.2");
|
||||
|
||||
// 基础金额属性
|
||||
private Integer totalSeparateAmount; // 分账总金额(分)
|
||||
@ -45,7 +41,7 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
private Integer shippingFee; // 配送费(分)
|
||||
|
||||
// 分账比例属性
|
||||
private BigDecimal lklRatio; // 拉卡拉分账比例(如 0.0025=0.025%)
|
||||
private BigDecimal lklRatio; // 拉卡拉分账比例(如 0.0025=0.25%)
|
||||
private BigDecimal mchRatio; // 商户分账比例(如 0.96=96%)
|
||||
private BigDecimal platRatio; // 平台分账比例(如 0.01=1%)
|
||||
private BigDecimal agent1stRatio; // 一级代理商分账比例(如 0.01=1%)
|
||||
@ -57,7 +53,6 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
private Integer platAmount; // 平台分账金额(分)
|
||||
private Integer agent1stAmount; // 一级代理商分账金额(分)
|
||||
private Integer agent2ndAmount; // 二级代理商分账金额(分)
|
||||
private String errMsg; // 错误信息字段
|
||||
|
||||
/**
|
||||
* 测试方法
|
||||
@ -67,75 +62,26 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
// 测试用例1: 所有参与方都参与分账(符合比例要求)
|
||||
System.out.println("=== 测试用例1: 所有参与方都参与分账 ===");
|
||||
LklSeparateWithTotalAmountDTO dto1 = new LklSeparateWithTotalAmountDTO();
|
||||
dto1.setTotalSeparateAmount(800); // 总金额16.96元(1696分)
|
||||
dto1.setTotalSeparateAmount(1696); // 总金额100元(10000分)
|
||||
dto1.setShippingFee(500);
|
||||
// dto1.setRefCanSeparateAmount(1496);
|
||||
dto1.setLklRatio(BigDecimal.valueOf(0.0025)); // 拉卡拉分账比例0.25%
|
||||
dto1.setMchRatio(BigDecimal.valueOf(0.96)); // 商家分账比例94.75%
|
||||
dto1.setPlatRatio(BigDecimal.valueOf(0.04)); // 平台分账比例1%
|
||||
// dto1.setAgent2ndRatio(BigDecimal.valueOf(0.04)); // 二级代理商分账比例4%
|
||||
// dto1.setAgent1stRatio(BigDecimal.valueOf(0.01)); // 一级代理商分账比例1%
|
||||
dto1.setLklRatio(new BigDecimal("0.0025")); // 拉卡拉分账比例0.25%
|
||||
dto1.setMchRatio(new BigDecimal("0.96")); // 商家分账比例94.75%
|
||||
dto1.setPlatRatio(new BigDecimal("0.04")); // 平台分账比例1%
|
||||
// dto1.setAgent2ndRatio(new BigDecimal("0.04")); // 二级代理商分账比例4%
|
||||
// dto1.setAgent1stRatio(new BigDecimal("0.01")); // 一级代理商分账比例1%
|
||||
|
||||
SeparateResult result = dto1.calculateSeparateAmount();
|
||||
if (result.getIsSuccess()) {
|
||||
Pair<Boolean, LklSeparateWithTotalAmountDTO> result = dto1.calculateSeparateAmount();
|
||||
if (result.getFirst()) {
|
||||
System.out.println("分账计算成功:");
|
||||
System.out.println(result.getData());
|
||||
System.out.println(result.getSecond());
|
||||
System.out.println("JSON格式输出:");
|
||||
System.out.println(result.getData().toJSON());
|
||||
System.out.println(result.getSecond().toJSON());
|
||||
} else {
|
||||
System.out.println("分账计算失败");
|
||||
if (result.getErrMsg() != null) {
|
||||
if (result.getSecond() != null) {
|
||||
System.out.println("部分结果:");
|
||||
System.out.println(result.getErrMsg());
|
||||
// 输出错误信息
|
||||
if (result.getErrMsg() != null && !result.getErrMsg().isEmpty()) {
|
||||
System.out.println("错误信息: " + result.getErrMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 测试用例2: 商家分账比例过低的情况
|
||||
System.out.println("\n=== 测试用例2: 商家分账比例过低 ===");
|
||||
LklSeparateWithTotalAmountDTO dto2 = new LklSeparateWithTotalAmountDTO();
|
||||
dto2.setTotalSeparateAmount(10000); // 总金额100元(10000分)
|
||||
dto2.setLklRatio(BigDecimal.valueOf(0.0025)); // 拉卡拉分账比例0.25%
|
||||
dto2.setMchRatio(BigDecimal.valueOf(0.1)); // 商家分账比例过低(10%)
|
||||
dto2.setPlatRatio(BigDecimal.valueOf(0.04)); // 平台分账比例4%
|
||||
|
||||
SeparateResult result2 = dto2.calculateSeparateAmount();
|
||||
if (result2.getIsSuccess()) {
|
||||
System.out.println("分账计算成功:");
|
||||
System.out.println(result2.getData());
|
||||
} else {
|
||||
System.out.println("分账计算失败");
|
||||
if (result2.getData() != null) {
|
||||
System.out.println("部分结果:");
|
||||
System.out.println(result2.getData());
|
||||
// 输出错误信息
|
||||
if (result2.getErrMsg() != null && !result2.getErrMsg().isEmpty()) {
|
||||
System.out.println("错误信息: " + result2.getErrMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 测试用例3: 使用calculateSeparateAmountWithResult方法获取SeparateResult结果
|
||||
System.out.println("\n=== 测试用例3: 使用calculateSeparateAmountWithResult方法获取SeparateResult结果 ===");
|
||||
LklSeparateWithTotalAmountDTO dto3 = new LklSeparateWithTotalAmountDTO();
|
||||
dto3.setTotalSeparateAmount(10000); // 总金额100元(10000分)
|
||||
dto3.setLklRatio(BigDecimal.valueOf(0.0025)); // 拉卡拉分账比例0.25%
|
||||
dto3.setMchRatio(BigDecimal.valueOf(0.8)); // 商家分账比例80%
|
||||
dto3.setPlatRatio(BigDecimal.valueOf(0.04)); // 平台分账比例4%
|
||||
|
||||
LklSeparateWithTotalAmountDTO.SeparateResult separateResult = dto3.calculateSeparateAmountWithResult();
|
||||
|
||||
if (separateResult.getIsSuccess()) {
|
||||
System.out.println("分账计算成功:");
|
||||
System.out.println(separateResult.getData());
|
||||
} else {
|
||||
System.out.println("分账计算失败: " + separateResult.getErrMsg());
|
||||
if (separateResult.getData() != null) {
|
||||
System.out.println("部分结果:");
|
||||
System.out.println(separateResult.getData());
|
||||
System.out.println(result.getSecond());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -143,129 +89,63 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
/**
|
||||
* 执行分账计算逻辑
|
||||
*
|
||||
* @return SeparateResult 包含成功状态、分账结果和错误信息的包装类
|
||||
* @return Pair<Boolean, LklSeparateWithTotalAmountDTO> Boolean表示是否成功,LklSeparateWithTotalAmountDTO为分账结果
|
||||
*/
|
||||
public SeparateResult calculateSeparateAmount() {
|
||||
public Pair<Boolean, LklSeparateWithTotalAmountDTO> calculateSeparateAmount() {
|
||||
try {
|
||||
// 清空之前的错误信息
|
||||
this.errMsg = null;
|
||||
|
||||
// 参数校验
|
||||
Pair<Boolean, String> validateResult = validateInputs();
|
||||
if (!validateResult.getFirst()) {
|
||||
String errorMsg = "分账计算参数异常: " + validateResult.getSecond();
|
||||
log.error(errorMsg);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
}
|
||||
validateInputs();
|
||||
|
||||
// 1. 计算拉卡拉分账金额和可分账金额
|
||||
Pair<Boolean, String> lklResult = calculateLklAmountAndCanSeparateAmount();
|
||||
if (!lklResult.getFirst()) {
|
||||
String errorMsg = "分账计算参数异常: " + lklResult.getSecond();
|
||||
log.error(errorMsg);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
}
|
||||
calculateLklAmountAndCanSeparateAmount();
|
||||
|
||||
// 2. 确定实际可分账金额
|
||||
Pair<Boolean, String> canSeparateResult = determineActualCanSeparateAmount();
|
||||
if (!canSeparateResult.getFirst()) {
|
||||
String errorMsg = "分账计算参数异常: " + canSeparateResult.getSecond();
|
||||
log.error(errorMsg);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
}
|
||||
|
||||
int actualCanSeparateAmount = Integer.parseInt(canSeparateResult.getSecond());
|
||||
int actualCanSeparateAmount = determineActualCanSeparateAmount();
|
||||
|
||||
// 3. 计算各参与方分账比例
|
||||
Pair<Boolean, String> ratioResult = calculateDefaultRatios();
|
||||
if (!ratioResult.getFirst()) {
|
||||
String errorMsg = "分账计算参数异常: " + ratioResult.getSecond();
|
||||
log.error(errorMsg);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
}
|
||||
calculateDefaultRatios();
|
||||
|
||||
// 4. 根据优先级顺序计算各参与方分账金额
|
||||
Pair<Boolean, String> amountResult = calculateAmountsInPriorityOrder(actualCanSeparateAmount);
|
||||
if (!amountResult.getFirst()) {
|
||||
String errorMsg = "分账计算参数异常: " + amountResult.getSecond();
|
||||
log.error(errorMsg);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
}
|
||||
calculateAmountsInPriorityOrder(actualCanSeparateAmount);
|
||||
|
||||
// 5. 校验分账金额总和不能超过总金额
|
||||
Pair<Boolean, String> totalResult = validateSeparateAmountTotal();
|
||||
if (!totalResult.getFirst()) {
|
||||
String errorMsg = "分账计算参数异常: " + totalResult.getSecond();
|
||||
log.error(errorMsg);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
}
|
||||
validateSeparateAmountTotal();
|
||||
|
||||
// 6. 根据指定规则调整各参与方分账金额
|
||||
Pair<Boolean, String> adjustResult = adjustAmountsWithLklAmount();
|
||||
if (!adjustResult.getFirst()) {
|
||||
String errorMsg = "分账计算参数异常: " + adjustResult.getSecond();
|
||||
log.error(errorMsg);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
}
|
||||
// 6. 计算商家实际分账比例
|
||||
calculateActualMchRatio();
|
||||
|
||||
// 7. 计算商家实际分账比例
|
||||
Pair<Boolean, String> mchResult = calculateActualMchRatio();
|
||||
if (!mchResult.getFirst()) {
|
||||
String errorMsg = "分账计算参数异常: " + mchResult.getSecond();
|
||||
log.error(errorMsg);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
}
|
||||
|
||||
return SeparateResult.success(this);
|
||||
return Pair.of(true, this);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// 参数校验异常,返回false和当前对象
|
||||
String errorMsg = "分账计算参数异常: " + e.getMessage();
|
||||
log.error(errorMsg, e);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
System.err.println("分账计算参数异常: " + e.getMessage());
|
||||
return Pair.of(false, this);
|
||||
} catch (Exception e) {
|
||||
// 其他异常,返回false和null
|
||||
String errorMsg = "分账计算异常: " + e.getMessage();
|
||||
log.error(errorMsg, e);
|
||||
this.errMsg = errorMsg;
|
||||
return SeparateResult.failure(errorMsg);
|
||||
System.err.println("分账计算异常: " + e.getMessage());
|
||||
return Pair.of(false, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验必要参数
|
||||
*
|
||||
* @return Pair<Boolean, String> Boolean表示是否成功,String为错误信息
|
||||
* @throws IllegalArgumentException 当参数不合法时抛出异常
|
||||
*/
|
||||
private Pair<Boolean, String> validateInputs() {
|
||||
private void validateInputs() {
|
||||
// 校验totalSeparateAmount必须为有效值且大于0
|
||||
if (totalSeparateAmount == null || totalSeparateAmount <= 0) {
|
||||
return Pair.of(false, "分账计算:总分账金额必须大于0");
|
||||
throw new IllegalArgumentException("分账计算缺少必要参数或参数不合法");
|
||||
}
|
||||
|
||||
// 校验必要参数
|
||||
if (lklRatio == null || lklRatio.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return Pair.of(false, "分账计算:拉卡拉分账比例必须大于0");
|
||||
}
|
||||
|
||||
if (mchRatio == null || mchRatio.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return Pair.of(false, "分账计算:商户分账比例必须大于0");
|
||||
if (lklRatio == null || mchRatio == null) {
|
||||
throw new IllegalArgumentException("分账计算缺少必要参数");
|
||||
}
|
||||
|
||||
// 校验shippingFee不能大于等于totalSeparateAmount
|
||||
if (shippingFee != null && shippingFee > 0 && shippingFee >= totalSeparateAmount) {
|
||||
return Pair.of(false, "分账计算:配送费用不能大于等于总金额");
|
||||
if (shippingFee != null && shippingFee >= totalSeparateAmount) {
|
||||
throw new IllegalArgumentException("配送费不能大于等于总金额");
|
||||
}
|
||||
|
||||
return Pair.of(true, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -273,17 +153,19 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
* 拉卡拉分账金额 = 总金额 * 拉卡拉分账比例(四舍五入)
|
||||
* 可分账金额 = 总金额 - 拉卡拉分账金额
|
||||
*
|
||||
* @return Pair<Boolean, String> Boolean表示是否成功,String为错误信息
|
||||
* @throws IllegalArgumentException 当计算出的分账金额为负数时抛出异常
|
||||
*/
|
||||
private Pair<Boolean, String> calculateLklAmountAndCanSeparateAmount() {
|
||||
private void calculateLklAmountAndCanSeparateAmount() {
|
||||
// 拉卡拉分账金额 = 总金额 * 拉卡拉分账比例(四舍五入)
|
||||
lklAmount = lklRatio.multiply(BigDecimal.valueOf(totalSeparateAmount))
|
||||
lklAmount = lklRatio.multiply(new BigDecimal(totalSeparateAmount))
|
||||
.setScale(0, RoundingMode.HALF_UP)
|
||||
.intValue();
|
||||
|
||||
// 校验拉卡拉分账金额不能为负数
|
||||
if (lklAmount < 0) {
|
||||
return Pair.of(false, "拉卡拉分账金额计算异常");
|
||||
// 记录详细日志
|
||||
System.err.println("拉卡拉分账金额计算结果为负数: " + lklAmount);
|
||||
throw new IllegalArgumentException("拉卡拉分账金额计算异常");
|
||||
}
|
||||
|
||||
// 可分账金额 = 总金额 - 拉卡拉分账金额
|
||||
@ -291,10 +173,10 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
|
||||
// 校验可分账金额不能为负数
|
||||
if (canSeparateAmount < 0) {
|
||||
return Pair.of(false, "可分账金额计算异常");
|
||||
// 记录详细日志
|
||||
System.err.println("可分账金额计算结果为负数: " + canSeparateAmount);
|
||||
throw new IllegalArgumentException("可分账金额计算异常");
|
||||
}
|
||||
|
||||
return Pair.of(true, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -302,9 +184,10 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
* 实际可分账金额A: 如果refCanSeparateAmount有效则使用,否则使用canSeparateAmount
|
||||
* 实际可分账金额B = 实际可分账金额A - 配送费(如果配送费有效)
|
||||
*
|
||||
* @return Pair<Boolean, String> Boolean表示是否成功,String为错误信息
|
||||
* @return 实际可分账金额
|
||||
* @throws IllegalArgumentException 当实际可分账金额为负数时抛出异常
|
||||
*/
|
||||
private Pair<Boolean, String> determineActualCanSeparateAmount() {
|
||||
private int determineActualCanSeparateAmount() {
|
||||
// 实际可分账金额A: 如果refCanSeparateAmount有效则使用,否则使用canSeparateAmount
|
||||
int actualCanSeparateAmountA = (refCanSeparateAmount != null && refCanSeparateAmount > 0)
|
||||
? refCanSeparateAmount : canSeparateAmount;
|
||||
@ -317,24 +200,23 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
|
||||
// 校验实际可分账金额不能为负数
|
||||
if (actualCanSeparateAmountB < 0) {
|
||||
return Pair.of(false, "实际可分账金额计算异常");
|
||||
// 记录详细日志
|
||||
System.err.println("实际可分账金额计算结果为负数: " + actualCanSeparateAmountB);
|
||||
throw new IllegalArgumentException("实际可分账金额计算异常");
|
||||
}
|
||||
|
||||
return Pair.of(true, String.valueOf(actualCanSeparateAmountB));
|
||||
return actualCanSeparateAmountB;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算各参与方分账比例
|
||||
*
|
||||
* @return Pair<Boolean, String> Boolean表示是否成功,String为错误信息
|
||||
* 如果平台比例无效,设置默认值0.01
|
||||
*/
|
||||
private Pair<Boolean, String> calculateDefaultRatios() {
|
||||
private void calculateDefaultRatios() {
|
||||
// 如果平台比例无效,设置默认值0.01
|
||||
if (platRatio == null || platRatio.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
platRatio = DEFAULT_PLATFORM_RATIO;
|
||||
platRatio = new BigDecimal("0.01");
|
||||
}
|
||||
|
||||
return Pair.of(true, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -343,31 +225,41 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
* 商家获得所有剩余金额
|
||||
*
|
||||
* @param actualCanSeparateAmount 实际可分账金额
|
||||
* @return Pair<Boolean, String> Boolean表示是否成功,String为错误信息
|
||||
* @throws IllegalArgumentException 当计算出的分账金额为负数或分账金额超过可用金额时抛出异常
|
||||
*/
|
||||
private Pair<Boolean, String> calculateAmountsInPriorityOrder(int actualCanSeparateAmount) {
|
||||
private void calculateAmountsInPriorityOrder(int actualCanSeparateAmount) {
|
||||
// 重置所有分账金额
|
||||
platAmount = 0;
|
||||
agent1stAmount = 0;
|
||||
agent2ndAmount = 0;
|
||||
mchAmount = 0;
|
||||
|
||||
// 1. 计算拉卡拉分账金额(拉卡拉一定参与分账)
|
||||
lklAmount = lklRatio.multiply(new BigDecimal(totalSeparateAmount))
|
||||
.setScale(0, RoundingMode.HALF_UP)
|
||||
.intValue();
|
||||
|
||||
// 校验拉卡拉分账金额不能为负数
|
||||
if (lklAmount < 0) {
|
||||
throw new IllegalArgumentException("拉卡拉分账金额计算异常");
|
||||
}
|
||||
|
||||
// 2. 校验实际可分账金额不能小于0
|
||||
if (actualCanSeparateAmount < 0) {
|
||||
return Pair.of(false, "实际可分账金额不能小于0");
|
||||
throw new IllegalArgumentException("实际可分账金额不能为负数");
|
||||
}
|
||||
|
||||
// 3. 初始化剩余金额为实际可分账金额
|
||||
int remainingAmount = actualCanSeparateAmount;
|
||||
|
||||
// 4. 计算平台分账金额(平台一定参与分账)
|
||||
platAmount = platRatio.multiply(BigDecimal.valueOf(totalSeparateAmount))
|
||||
platAmount = platRatio.multiply(new BigDecimal(totalSeparateAmount))
|
||||
.setScale(0, RoundingMode.HALF_UP)
|
||||
.intValue();
|
||||
|
||||
// 校验平台分账金额不能为负数
|
||||
if (platAmount < 0) {
|
||||
return Pair.of(false, "平台分账金额不能小于0");
|
||||
throw new IllegalArgumentException("平台分账金额计算异常");
|
||||
}
|
||||
|
||||
// 确保不超过剩余金额
|
||||
@ -386,13 +278,13 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
// 优先级:平台 -> 二级代理商 -> 一级代理商
|
||||
if (isAgent2ndParticipate) {
|
||||
// 计算二级代理商分账金额
|
||||
agent2ndAmount = agent2ndRatio.multiply(BigDecimal.valueOf(totalSeparateAmount))
|
||||
agent2ndAmount = agent2ndRatio.multiply(new BigDecimal(totalSeparateAmount))
|
||||
.setScale(0, RoundingMode.HALF_UP)
|
||||
.intValue();
|
||||
|
||||
// 校验二级代理商分账金额不能为负数
|
||||
if (agent2ndAmount < 0) {
|
||||
return Pair.of(false, "二级代理商分账金额不能小于0");
|
||||
throw new IllegalArgumentException("二级代理商分账金额计算异常");
|
||||
}
|
||||
|
||||
// 确保不超过剩余金额
|
||||
@ -404,13 +296,13 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
|
||||
if (isAgent1stParticipate) {
|
||||
// 计算一级代理商分账金额
|
||||
agent1stAmount = agent1stRatio.multiply(BigDecimal.valueOf(totalSeparateAmount))
|
||||
agent1stAmount = agent1stRatio.multiply(new BigDecimal(totalSeparateAmount))
|
||||
.setScale(0, RoundingMode.HALF_UP)
|
||||
.intValue();
|
||||
|
||||
// 校验一级代理商分账金额不能为负数
|
||||
if (agent1stAmount < 0) {
|
||||
return Pair.of(false, "一级代理商分账金额不能小于0");
|
||||
throw new IllegalArgumentException("一级代理商分账金额计算异常");
|
||||
}
|
||||
|
||||
// 确保不超过剩余金额
|
||||
@ -425,109 +317,48 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
|
||||
// 校验商家分账金额不能为负数
|
||||
if (mchAmount < 0) {
|
||||
return Pair.of(false, "商家分账金额不能小于0");
|
||||
}
|
||||
|
||||
return Pair.of(true, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定规则调整各参与方分账金额
|
||||
* 如果拉卡拉分账金额lklAmount>0:
|
||||
* 1. 如果agent2ndAmount>0 且大于lklAmount, 则agent2ndAmount=agent2ndAmount-lklAmount,mchAmount=mchAmount+lklAmount
|
||||
* 2. 如果agent2ndAmount<=0 但 agent1stAmount>0 且大于lklAmount, 则agent1stAmount=agent1stAmount-lklAmount,mchAmount=mchAmount+lklAmount
|
||||
* 3. 如果agent2ndAmount<=0 且 agent1stAmount<=0,但 platAmount>0 且大于等于lklAmount, 则 platAmount=platAmount-lklAmount,mchAmount=mchAmount+lklAmount
|
||||
*
|
||||
* @return Pair<Boolean, String> Boolean表示是否成功,String为错误信息
|
||||
*/
|
||||
private Pair<Boolean, String> adjustAmountsWithLklAmount() {
|
||||
try {
|
||||
// 只有当拉卡拉分账金额大于0时才执行调整逻辑
|
||||
if (lklAmount != null && lklAmount > 0) {
|
||||
int adjustment = lklAmount; // 需要调整的金额
|
||||
|
||||
// 情况1: 如果agent2ndAmount>0 且大于lklAmount
|
||||
if (agent2ndAmount != null && agent2ndAmount > 0 && agent2ndAmount > adjustment) {
|
||||
agent2ndAmount -= adjustment;
|
||||
mchAmount += adjustment;
|
||||
log.debug("调整二级代理商分账金额: 减少{},商家分账金额增加{}", adjustment, adjustment);
|
||||
}
|
||||
// 情况2: 如果agent2ndAmount<=0 但 agent1stAmount>0 且大于lklAmount
|
||||
else if ((agent2ndAmount == null || agent2ndAmount <= 0) &&
|
||||
agent1stAmount != null && agent1stAmount > 0 && agent1stAmount > adjustment) {
|
||||
agent1stAmount -= adjustment;
|
||||
mchAmount += adjustment;
|
||||
log.debug("调整一级代理商分账金额: 减少{},商家分账金额增加{}", adjustment, adjustment);
|
||||
}
|
||||
// 情况3: 如果agent2ndAmount<=0 且 agent1stAmount<=0,但 platAmount>0 且大于等于lklAmount
|
||||
else if ((agent2ndAmount == null || agent2ndAmount <= 0) &&
|
||||
(agent1stAmount == null || agent1stAmount <= 0) &&
|
||||
platAmount != null && platAmount > 0 && platAmount >= adjustment) {
|
||||
platAmount -= adjustment;
|
||||
mchAmount += adjustment;
|
||||
log.debug("调整平台分账金额: 减少{},商家分账金额增加{}", adjustment, adjustment);
|
||||
}
|
||||
// 其他情况不作调整
|
||||
else {
|
||||
log.debug("不满足调整条件,无需调整各参与方分账金额");
|
||||
}
|
||||
}
|
||||
|
||||
return Pair.of(true, "");
|
||||
} catch (Exception e) {
|
||||
return Pair.of(false, "调整分账金额时发生异常: " + e.getMessage());
|
||||
throw new IllegalArgumentException("商家分账金额计算异常");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算商家实际分账比例
|
||||
*
|
||||
* @return Pair<Boolean, String> Boolean表示是否成功,String为错误信息
|
||||
* @throws IllegalArgumentException 当商家实际分账比例低于阈值时抛出异常
|
||||
*/
|
||||
private Pair<Boolean, String> calculateActualMchRatio() {
|
||||
if (totalSeparateAmount != null && totalSeparateAmount > 0 && mchAmount != null && mchAmount >= 0) {
|
||||
private void calculateActualMchRatio() {
|
||||
if (totalSeparateAmount != null && totalSeparateAmount > 0 && mchAmount != null) {
|
||||
// 计算实际比例,保留6位小数
|
||||
mchRatio = BigDecimal.valueOf(mchAmount)
|
||||
.divide(BigDecimal.valueOf(totalSeparateAmount), 6, RoundingMode.HALF_UP);
|
||||
mchRatio = new BigDecimal(mchAmount)
|
||||
.divide(new BigDecimal(totalSeparateAmount), 6, RoundingMode.HALF_UP);
|
||||
|
||||
// 如果计算出的实际比例低于阈值,打印日志并返回错误
|
||||
if (mchRatio.compareTo(MIN_MERCHANT_RATIO_THRESHOLD) < 0) {
|
||||
String errorMsg = String.format("警告: 商家实际分账比例低于阈值,当前比例: %s,阈值: %s",
|
||||
mchRatio.toPlainString(), MIN_MERCHANT_RATIO_THRESHOLD.toPlainString());
|
||||
log.warn(errorMsg);
|
||||
return Pair.of(false, errorMsg);
|
||||
// 如果计算出的实际比例低于阈值,打印日志并抛出异常
|
||||
if (mchRatio.compareTo(MCH_RATIO_THRESHOLD) < 0) {
|
||||
System.err.println("警告: 商家实际分账比例低于阈值,当前比例: " + mchRatio + ",阈值: " + MCH_RATIO_THRESHOLD);
|
||||
throw new IllegalArgumentException("商家分账低于阈值");
|
||||
}
|
||||
}
|
||||
|
||||
return Pair.of(true, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验分账金额总和不能超过总金额
|
||||
*
|
||||
* @return Pair<Boolean, String> Boolean表示是否成功,String为错误信息
|
||||
* @throws IllegalArgumentException 当分账金额总和超过总金额时抛出异常
|
||||
*/
|
||||
private Pair<Boolean, String> validateSeparateAmountTotal() {
|
||||
long totalAmount = getValueOrZero(lklAmount) +
|
||||
getValueOrZero(platAmount) +
|
||||
getValueOrZero(agent2ndAmount) +
|
||||
getValueOrZero(agent1stAmount) +
|
||||
getValueOrZero(mchAmount);
|
||||
private void validateSeparateAmountTotal() {
|
||||
int totalAmount = 0;
|
||||
totalAmount += (lklAmount != null ? lklAmount : 0);
|
||||
totalAmount += (platAmount != null ? platAmount : 0);
|
||||
totalAmount += (agent2ndAmount != null ? agent2ndAmount : 0);
|
||||
totalAmount += (agent1stAmount != null ? agent1stAmount : 0);
|
||||
totalAmount += (mchAmount != null ? mchAmount : 0);
|
||||
|
||||
if (totalAmount > getValueOrZero(totalSeparateAmount)) {
|
||||
String errorMsg = String.format("分账金额总和(%d)超过总金额(%d)",
|
||||
totalAmount, getValueOrZero(totalSeparateAmount));
|
||||
return Pair.of(false, errorMsg);
|
||||
if (totalAmount > totalSeparateAmount) {
|
||||
// 记录详细日志
|
||||
System.err.println("分账金额总和超过总金额,分账金额总和: " + totalAmount + ",总金额: " + totalSeparateAmount);
|
||||
throw new IllegalArgumentException("分账金额总和超过总金额");
|
||||
}
|
||||
|
||||
return Pair.of(true, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全获取Integer值,避免空指针
|
||||
*/
|
||||
private int getValueOrZero(Integer value) {
|
||||
return value != null ? value : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -561,110 +392,22 @@ public class LklSeparateWithTotalAmountDTO {
|
||||
* @return JSON格式字符串
|
||||
*/
|
||||
public String toJSON() {
|
||||
StringBuilder sb = new StringBuilder("{");
|
||||
appendJsonField(sb, "totalSeparateAmount", totalSeparateAmount);
|
||||
appendJsonField(sb, "canSeparateAmount", canSeparateAmount);
|
||||
appendJsonField(sb, "refCanSeparateAmount", refCanSeparateAmount);
|
||||
appendJsonField(sb, "shippingFee", shippingFee);
|
||||
appendJsonField(sb, "lklRatio", lklRatio);
|
||||
appendJsonField(sb, "mchRatio", mchRatio);
|
||||
appendJsonField(sb, "platRatio", platRatio);
|
||||
appendJsonField(sb, "agent1stRatio", agent1stRatio);
|
||||
appendJsonField(sb, "agent2ndRatio", agent2ndRatio);
|
||||
appendJsonField(sb, "lklAmount", lklAmount);
|
||||
appendJsonField(sb, "mchAmount", mchAmount);
|
||||
appendJsonField(sb, "platAmount", platAmount);
|
||||
appendJsonField(sb, "agent1stAmount", agent1stAmount);
|
||||
appendJsonField(sb, "agent2ndAmount", agent2ndAmount);
|
||||
// 移除最后的逗号并添加结束括号
|
||||
if (sb.charAt(sb.length() - 1) == ',') {
|
||||
sb.setLength(sb.length() - 1);
|
||||
}
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
String sb = "{" +
|
||||
"\"totalSeparateAmount\":" + totalSeparateAmount + "," +
|
||||
"\"canSeparateAmount\":" + canSeparateAmount + "," +
|
||||
"\"refCanSeparateAmount\":" + refCanSeparateAmount + "," +
|
||||
"\"shippingFee\":" + shippingFee + "," +
|
||||
"\"lklRatio\":" + (lklRatio != null ? "\"" + lklRatio + "\"" : "null") + "," +
|
||||
"\"mchRatio\":" + (mchRatio != null ? "\"" + mchRatio + "\"" : "null") + "," +
|
||||
"\"platRatio\":" + (platRatio != null ? "\"" + platRatio + "\"" : "null") + "," +
|
||||
"\"agent1stRatio\":" + (agent1stRatio != null ? "\"" + agent1stRatio + "\"" : "null") + "," +
|
||||
"\"agent2ndRatio\":" + (agent2ndRatio != null ? "\"" + agent2ndRatio + "\"" : "null") + "," +
|
||||
"\"lklAmount\":" + lklAmount + "," +
|
||||
"\"mchAmount\":" + mchAmount + "," +
|
||||
"\"platAmount\":" + platAmount + "," +
|
||||
"\"agent1stAmount\":" + agent1stAmount + "," +
|
||||
"\"agent2ndAmount\":" + agent2ndAmount +
|
||||
"}";
|
||||
return sb;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加JSON字段的辅助方法
|
||||
*/
|
||||
private void appendJsonField(StringBuilder sb, String fieldName, Object fieldValue) {
|
||||
sb.append("\"").append(fieldName).append("\":");
|
||||
if (fieldValue instanceof BigDecimal) {
|
||||
sb.append("\"").append(fieldValue).append("\"");
|
||||
} else if (fieldValue == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(fieldValue);
|
||||
}
|
||||
sb.append(",");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分账计算结果(包含错误信息)
|
||||
*
|
||||
* @return SeparateResult 包含成功状态、分账结果和错误信息的包装类
|
||||
*/
|
||||
public SeparateResult getSeparateResult() {
|
||||
return new SeparateResult(Boolean.TRUE, this, this.errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行分账计算逻辑
|
||||
*
|
||||
* @return SeparateResult 包含成功状态、分账结果和错误信息的包装类
|
||||
*/
|
||||
public SeparateResult calculateSeparateAmountWithResult() {
|
||||
return calculateSeparateAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分账计算结果包装类
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
public static class SeparateResult {
|
||||
private Boolean isSuccess;
|
||||
private LklSeparateWithTotalAmountDTO data;
|
||||
private String errMsg = ""; // 默认值为空字符串,保证不为null
|
||||
|
||||
public SeparateResult() {
|
||||
}
|
||||
|
||||
public SeparateResult(Boolean isSuccess, LklSeparateWithTotalAmountDTO data, String errMsg) {
|
||||
this.isSuccess = isSuccess;
|
||||
this.data = data;
|
||||
this.errMsg = errMsg != null ? errMsg : ""; // 确保不为null
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建成功结果
|
||||
*
|
||||
* @param data 分账数据
|
||||
* @return SeparateResult
|
||||
*/
|
||||
public static SeparateResult success(LklSeparateWithTotalAmountDTO data) {
|
||||
return new SeparateResult(Boolean.TRUE, data, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建失败结果
|
||||
*
|
||||
* @param errMsg 错误信息
|
||||
* @return SeparateResult
|
||||
*/
|
||||
public static SeparateResult failure(String errMsg) {
|
||||
return new SeparateResult(Boolean.FALSE, null, errMsg != null ? errMsg : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建部分成功结果(带错误信息的成功)
|
||||
*
|
||||
* @param data 分账数据
|
||||
* @param errMsg 错误信息
|
||||
* @return SeparateResult
|
||||
*/
|
||||
public static SeparateResult partialSuccess(LklSeparateWithTotalAmountDTO data, String errMsg) {
|
||||
return new SeparateResult(Boolean.TRUE, data, errMsg != null ? errMsg : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
package com.suisung.mall.common.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 新增主店的分店的请求DTO实体类
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "新增主店的分店的请求DTO实体类", description = "新增主店的分店的请求DTO实体类")
|
||||
public class MainStoreBranchReqDTO implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主店店铺 ID
|
||||
*/
|
||||
private Integer parent_store_id;
|
||||
|
||||
/**
|
||||
* 登录手机号
|
||||
*/
|
||||
private String login_mobile;
|
||||
|
||||
/**
|
||||
* 登录密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 分店名称
|
||||
*/
|
||||
private String store_name;
|
||||
|
||||
/**
|
||||
* 分店联系人
|
||||
*/
|
||||
private String contact_name;
|
||||
|
||||
/**
|
||||
* 分店联系人手机号
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 门头图片
|
||||
*/
|
||||
private String front_facade_image;
|
||||
|
||||
/**
|
||||
* 环境图片
|
||||
*/
|
||||
private String environment_image;
|
||||
|
||||
/**
|
||||
* 分店地址
|
||||
*/
|
||||
private String store_address;
|
||||
|
||||
/**
|
||||
* 分店经度
|
||||
*/
|
||||
private String store_longitude;
|
||||
|
||||
/**
|
||||
* 分店纬度
|
||||
*/
|
||||
private String store_latitude;
|
||||
|
||||
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
package com.suisung.mall.common.pojo.dto;
|
||||
|
||||
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.math.BigDecimal;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "OrderDeliveryInfoDTO", description = "计算订单内部配送费参数实体类")
|
||||
public class OrderCacDeliveryFeeDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "订单ID")
|
||||
private String order_id;
|
||||
|
||||
@ApiModelProperty(value = "店铺ID")
|
||||
private Integer store_id;
|
||||
|
||||
@ApiModelProperty(value = "配送方式Id")
|
||||
private Integer delivery_type_id;
|
||||
|
||||
@ApiModelProperty(value = "订单商品金额")
|
||||
private BigDecimal order_product_amount;
|
||||
|
||||
@ApiModelProperty(value = "订单支付金额")
|
||||
private BigDecimal order_payment_amount;
|
||||
|
||||
@ApiModelProperty(value = "订单折扣金额")
|
||||
private BigDecimal order_discount_amount;
|
||||
|
||||
@ApiModelProperty(value = "订单重量(克)")
|
||||
private Integer order_weight_gram;
|
||||
|
||||
@ApiModelProperty(value = "配送地址经度")
|
||||
private String da_longitude;
|
||||
|
||||
@ApiModelProperty(value = "配送地址纬度")
|
||||
private String da_latitude;
|
||||
}
|
||||
@ -17,7 +17,6 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ -26,39 +25,29 @@ import java.util.List;
|
||||
@ApiModel(value = "同城配送基础设置DTO", description = "同城配送基础设置DTO")
|
||||
public class ShopStoreSameCityTransportBaseDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "店铺同城快递运费设置(起送条件+优惠条件)")
|
||||
private List<ShopStoreSameCityTransport> transportList;
|
||||
|
||||
public List<ShopStoreSameCityTransport> transportList;
|
||||
@ApiModelProperty(value = "店铺同城快递基础运费设置")
|
||||
private ShopStoreSameCityTransportBase transportBase;
|
||||
ShopStoreSameCityTransportBase transportBase;
|
||||
|
||||
public void rebuildTransportList() {
|
||||
if (this.transportBase == null || this.transportList == null || this.transportList.isEmpty()) {
|
||||
if (this.transportBase == null || this.transportList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 缓存基础设置的属性值,避免在循环中重复调用getter方法
|
||||
Long transportBaseId = this.transportBase.getTransport_base_id();
|
||||
Long storeId = this.transportBase.getStore_id();
|
||||
Integer updatedBy = this.transportBase.getUpdated_by();
|
||||
Date updatedAt = this.transportBase.getUpdated_at();
|
||||
|
||||
for (ShopStoreSameCityTransport transport : this.transportList) {
|
||||
transport.setTransport_base_id(transportBaseId);
|
||||
transport.setStore_id(storeId);
|
||||
transport.setUpdated_by(updatedBy);
|
||||
transport.setUpdated_at(updatedAt);
|
||||
transport.setTransport_base_id(this.transportBase.getTransport_base_id());
|
||||
transport.setUpdated_by(this.transportBase.getUpdated_by());
|
||||
transport.setUpdated_at(this.transportBase.getUpdated_at());
|
||||
transport.setStore_id(this.transportBase.getStore_id());
|
||||
|
||||
// 设置创建时间相关字段
|
||||
if (transport.getCreated_by() == null && updatedBy != null) {
|
||||
transport.setCreated_by(updatedBy);
|
||||
if (transport.getCreated_by() == null && transport.getUpdated_by() != null) {
|
||||
transport.setCreated_by(transport.getUpdated_by());
|
||||
}
|
||||
|
||||
if (transport.getCreated_at() == null && updatedAt != null) {
|
||||
transport.setCreated_at(updatedAt);
|
||||
if (transport.getCreated_at() == null && transport.getUpdated_at() != null) {
|
||||
transport.setCreated_at(transport.getUpdated_at());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user