Commit 2a520d98 authored by jiaorz's avatar jiaorz

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

parents 49ccbf04 b62a6bb5
#项目url #项目url
XXMP_URL=https://xxtest.upyuns.com/image XXMP_URL=/image
#token到期时间 #token到期时间
TOKEN_OVER_TIME=604800 TOKEN_OVER_TIME=604800
#itoken到期时间(6天) #itoken到期时间(6天)
......
...@@ -88,6 +88,16 @@ auth: ...@@ -88,6 +88,16 @@ auth:
token-header: x-client-token token-header: x-client-token
id: ace-gate #不填则默认读取spring.application.name id: ace-gate #不填则默认读取spring.application.name
secret: 123456 secret: 123456
servlet:
multipart:
# 启用上传处理,默认是true
enabled: true
# 当上传文件达到20MB的时候进行磁盘写入
file-size-threshold: 20MB
# 设置最大的请求文件的大小
max-request-size: 50MB
# 设置单个文件的最大长度
max-file-size: 50MB
# #
# #
#ribbon: #ribbon:
......
package com.github.wxiaoqi.security.admin.constant;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class AppFormat {
private static final String[] format = {".ipa", ".apk",".pxl"};
private static final Set formatSet= new HashSet(Arrays.asList(format));
public static Set<String> getFormatSet() {
return formatSet;
}
}
...@@ -52,10 +52,10 @@ public class AppUserManageDTO { ...@@ -52,10 +52,10 @@ public class AppUserManageDTO {
*/ */
private Integer source; private Integer source;
/** // /**
* 接收前台时间范围 // * 接收前台时间范围
*/ // */
private String[] registrationDate; // private String[] registrationDate;
} }
...@@ -63,6 +63,13 @@ public class AppUserSellingWater implements Serializable { ...@@ -63,6 +63,13 @@ public class AppUserSellingWater implements Serializable {
@ApiModelProperty(value = "订单号") @ApiModelProperty(value = "订单号")
private String orderNo; private String orderNo;
/**
* 订单号
*/
@Column(name = "order_type")
@ApiModelProperty(value = "1-租车;2-旅游;3-会员;4-营地")
private Integer orderType;
/** /**
* 商品id * 商品id
*/ */
......
...@@ -20,6 +20,11 @@ import lombok.Data; ...@@ -20,6 +20,11 @@ import lombok.Data;
public class MyWalletDetail implements Serializable { public class MyWalletDetail implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final int TYPE_POPULARIZE = 1;
public static final int SOURCE_ACTIVITY = 0;
public static final int ITYPE_IN = 0;
/** /**
* 主键ID * 主键ID
*/ */
...@@ -104,5 +109,4 @@ public class MyWalletDetail implements Serializable { ...@@ -104,5 +109,4 @@ public class MyWalletDetail implements Serializable {
@ApiModelProperty(value = "操作时间", hidden = true ) @ApiModelProperty(value = "操作时间", hidden = true )
private Long crtTime; private Long crtTime;
} }
...@@ -36,4 +36,8 @@ public class AppletWalletVo { ...@@ -36,4 +36,8 @@ public class AppletWalletVo {
*/ */
@ApiModelProperty(value = "今日收益(元)") @ApiModelProperty(value = "今日收益(元)")
private BigDecimal todayAmount; private BigDecimal todayAmount;
@ApiModelProperty(value = "未入账金额")
private BigDecimal unbooked;
} }
...@@ -57,7 +57,7 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -57,7 +57,7 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
List<AppUserManageVo> appUserManageVos = mapper.selectAppUserManage(appUserManageDTO); List<AppUserManageVo> appUserManageVos = mapper.selectAppUserManage(appUserManageDTO);
PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos); PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos);
if (pageInfo.getList()==null||pageInfo.getList().size()==0) { if (pageInfo.getList()==null||pageInfo.getList().size()==0) {
return null; return pageInfo;
} }
List<Integer> Citys = pageInfo.getList().parallelStream().map(AppUserManageVo::getCityCode).collect(Collectors.toList()); List<Integer> Citys = pageInfo.getList().parallelStream().map(AppUserManageVo::getCityCode).collect(Collectors.toList());
HashSet<Integer> set = new HashSet<>(); HashSet<Integer> set = new HashSet<>();
......
...@@ -79,7 +79,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel ...@@ -79,7 +79,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
//永久稳定关系 //永久稳定关系
public void foreverBind(Integer user_id ){ public void foreverBind(Integer user_id ){
AppUserRelation relation=getMyBiz().getRelationByUserId(user_id); AppUserRelation relation=getMyBiz().getRelationByUserId(user_id);
if(relation!=null&&relation.getIsForever()==0){ if(relation!=null&&relation.getIsForever()==0&&relation.getParentId()!=null&&relation.getParentId()>0){
relation.setIsForever(1); relation.setIsForever(1);
getMyBiz().updRelation(relation); getMyBiz().updRelation(relation);
} }
......
...@@ -103,15 +103,18 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -103,15 +103,18 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
Integer parentId = relation.getParentId(); Integer parentId = relation.getParentId();
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---parentId===" + parentId); log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---parentId===" + parentId);
BigDecimal amount = new BigDecimal("0.00");
//商品类型
Integer orderType=0;
for (OrderGoodsDTO goodsDto : goodsDTOList) { for (OrderGoodsDTO goodsDto : goodsDTOList) {
//商品id //商品id
Integer goodId = goodsDto.getGoodId(); Integer goodId = goodsDto.getGoodId();
//商品价格 //商品价格
BigDecimal price = goodsDto.getPrice(); BigDecimal price = goodsDto.getPrice();
//商品类型
Integer type = goodsDto.getType(); orderType = goodsDto.getType();
//商品比例 //商品比例
Integer extract = commissionBiz.getExtract(type, goodId); Integer extract = commissionBiz.getExtract(orderType, goodId);
AppUserVo userVo = detailBiz.getUserInfoById(parentId); AppUserVo userVo = detailBiz.getUserInfoById(parentId);
Integer positionId = 6; Integer positionId = 6;
if (userVo != null) { if (userVo != null) {
...@@ -137,6 +140,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -137,6 +140,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWater.setPositionId(positionId); sellingWater.setPositionId(positionId);
sellingWater.setOrderId(orderId); sellingWater.setOrderId(orderId);
sellingWater.setOrderNo(orderNo); sellingWater.setOrderNo(orderNo);
sellingWater.setOrderType(orderType);
sellingWater.setGoodId(goodId); sellingWater.setGoodId(goodId);
sellingWater.setTitle(goodsDto.getTitle()); sellingWater.setTitle(goodsDto.getTitle());
sellingWater.setImg(goodsDto.getImg()); sellingWater.setImg(goodsDto.getImg());
...@@ -146,8 +150,15 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -146,8 +150,15 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWater.setCommission(commission); sellingWater.setCommission(commission);
insertSelective(sellingWater); insertSelective(sellingWater);
log.info("购买计算用户拥成功----payOrderWater--------userId===" + userId); log.info("购买计算用户拥成功----payOrderWater--------userId===" + userId);
amount = amount.add(commission);
} }
} }
log.info("购买计算用户未入账----payOrderWater--------userId===" + parentId+"----amount===="+amount+"--orderType==="+orderType);
if(orderType==3){
finishOrderWater(orderWaterDTO);
}else if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(parentId,amount,1);
}
} }
//订单完成计算用户拥金 //订单完成计算用户拥金
...@@ -161,14 +172,16 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -161,14 +172,16 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
List<AppUserSellingWater> list = getWaterList(orderId); List<AppUserSellingWater> list = getWaterList(orderId);
BigDecimal amount = new BigDecimal("0.00"); BigDecimal amount = new BigDecimal("0.00");
Integer userId = 0; Integer userId = 0;
Integer orderType=0;
if (list.size() > 0) { if (list.size() > 0) {
for (AppUserSellingWater sellingWater : list) { for (AppUserSellingWater sellingWater : list) {
Integer id = sellingWater.getId(); Integer id = sellingWater.getId();
orderType=sellingWater.getOrderType();
userId = sellingWater.getUserId(); userId = sellingWater.getUserId();
sellingWater.setWaiting(1); sellingWater.setWaiting(1);
updateById(sellingWater); updateById(sellingWater);
BigDecimal commission = sellingWater.getCommission(); BigDecimal commission = sellingWater.getCommission();
log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission); log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission+"----orderType==="+orderType);
amount = amount.add(commission); amount = amount.add(commission);
} }
} }
...@@ -182,6 +195,10 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -182,6 +195,10 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
detail.setCono(orderId); detail.setCono(orderId);
detail.setSource(1); detail.setSource(1);
myWaterBiz.updMyWater(detail); myWaterBiz.updMyWater(detail);
if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,amount,2);
}
} }
} }
...@@ -196,10 +213,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -196,10 +213,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
} }
List<AppUserSellingWater> list = getWaterList(orderId); List<AppUserSellingWater> list = getWaterList(orderId);
BigDecimal amount = new BigDecimal("0.00"); BigDecimal amount = new BigDecimal("0.00");
BigDecimal unbooked = new BigDecimal("0.00");
Integer userId = 0; Integer userId = 0;
Integer orderType=0;
if (list.size() > 0) { if (list.size() > 0) {
for (AppUserSellingWater sellingWater : list) { for (AppUserSellingWater sellingWater : list) {
Integer id = sellingWater.getId(); Integer id = sellingWater.getId();
orderType=sellingWater.getOrderType();
userId = sellingWater.getUserId(); userId = sellingWater.getUserId();
sellingWater.setWaiting(1); sellingWater.setWaiting(1);
updateById(sellingWater); updateById(sellingWater);
...@@ -207,10 +227,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -207,10 +227,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWater.setStatus(1); sellingWater.setStatus(1);
insertSelective(sellingWater); insertSelective(sellingWater);
BigDecimal commission = sellingWater.getCommission(); BigDecimal commission = sellingWater.getCommission();
log.info("订单完成计算用户拥金----refundOrderWater----id====" + id + "---commission==" + commission); log.info("订单完成计算用户拥金----refundOrderWater----id====" + id + "---commission==" + commission+"---orderType===="+orderType);
unbooked=unbooked.add(commission);
} }
} }
log.info("订单完成计算用户拥金----refundOrderWater----orderId====" + orderId + "---amount==" + amount); log.info("订单完成计算用户拥金----refundOrderWater----orderId====" + orderId + "---amount==" + amount+"---unbooked==="+unbooked);
int r = amount.compareTo(BigDecimal.ZERO); int r = amount.compareTo(BigDecimal.ZERO);
//更新钱包 //更新钱包
if (r == 1 && userId > 0) { if (r == 1 && userId > 0) {
...@@ -221,6 +242,9 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -221,6 +242,9 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
detail.setSource(1); detail.setSource(1);
myWaterBiz.updMyWater(detail); myWaterBiz.updMyWater(detail);
} }
if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,unbooked,2);
}
} }
...@@ -247,6 +271,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -247,6 +271,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
SellingWalletPagVo sellingWalletPagVo = new SellingWalletPagVo(); SellingWalletPagVo sellingWalletPagVo = new SellingWalletPagVo();
Example example = new Example(AppUserSellingWater.class); Example example = new Example(AppUserSellingWater.class);
example.setOrderByClause("crt_time DESC");
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
if (waiting != null) { if (waiting != null) {
criteria.andEqualTo("waiting", waiting); criteria.andEqualTo("waiting", waiting);
...@@ -292,6 +317,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -292,6 +317,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
totalIncome = total.subtract(refund); totalIncome = total.subtract(refund);
} }
sellingWaterVos.sort(Comparator.comparing(SellingWalletVo::getCrtTime).reversed());
sellingWalletPagVo.setPageNum(pageNo); sellingWalletPagVo.setPageNum(pageNo);
sellingWalletPagVo.setPageSize(pageSize); sellingWalletPagVo.setPageSize(pageSize);
sellingWalletPagVo.setTotalCount(appUserSellingWaterPageDataVO.getTotalCount().intValue()); sellingWalletPagVo.setTotalCount(appUserSellingWaterPageDataVO.getTotalCount().intValue());
......
...@@ -193,6 +193,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb ...@@ -193,6 +193,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
* @return * @return
*/ */
public BaseUserMemberVO findOneByUserId(Integer userId) { public BaseUserMemberVO findOneByUserId(Integer userId) {
BaseUserMemberVO baseUserMemberVO= mapper.getBaseUserMemberVOByUserId(userId); BaseUserMemberVO baseUserMemberVO= mapper.getBaseUserMemberVOByUserId(userId);
if (baseUserMemberVO!=null) { if (baseUserMemberVO!=null) {
return baseUserMemberVO; return baseUserMemberVO;
...@@ -218,23 +219,38 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb ...@@ -218,23 +219,38 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
BaseUserMember baseUserMember = new BaseUserMember(); BaseUserMember baseUserMember = new BaseUserMember();
BeanUtilsBean.getInstance().copyProperties(baseUserMember,baseUserMemberVO); BeanUtilsBean.getInstance().copyProperties(baseUserMember,baseUserMemberVO);
if (baseUserMembers==null||baseUserMembers.size()==0) { if (baseUserMembers==null||baseUserMembers.size()==0) {
if (baseUserMemberVO.getMemberLevel()==null||baseUserMember.getValidTime()==null) return;
if (baseUserMemberVO.getMemberLevel() == null || baseUserMember.getValidTime() == null ) return;
baseUserMember.setCrtTime(System.currentTimeMillis()); baseUserMember.setCrtTime(System.currentTimeMillis());
baseUserMember.setIsDel(0); baseUserMember.setIsDel(0);
baseUserMember.setPayCount(0); baseUserMember.setPayCount(0);
baseUserMember.setCardLeave(1); baseUserMember.setCardLeave(1);
baseUserMember.setRecentRecharge(System.currentTimeMillis()); baseUserMember.setRecentRecharge(System.currentTimeMillis());
Integer buyCount = baseUserMember.getBuyCount()==null? 0:baseUserMember.getBuyCount(); Integer buyCount = baseUserMember.getBuyCount() == null ? 0 : baseUserMember.getBuyCount();
baseUserMember.setBuyCount(buyCount+1); baseUserMember.setBuyCount(buyCount + 1);
insertSelective(baseUserMember); insertSelective(baseUserMember);
return; return;
}else if (baseUserMembers.size()==1){ }else if (baseUserMembers.size()==1){
if (baseUserMemberVO.getMemberLevel() == null || baseUserMember.getValidTime() == null ){
baseUserMember.setTotalNumber(0);
baseUserMember.setRentFreeDays(0);
}else {
}
baseUserMember.setUpdTime(System.currentTimeMillis()); baseUserMember.setUpdTime(System.currentTimeMillis());
getMyBiz().updateSelectiveById(baseUserMember); baseUserMember.setBuyCount(baseUserMembers.get(0).getBuyCount()+1);
baseUserMember.setId(baseUserMembers.get(0).getId());
mapper.updateByPrimaryKeySelective(baseUserMember);
}else { }else {
throw new BaseException("Member purchase repeat!"); throw new BaseException("Member purchase repeat!");
} }
} }
} }
\ No newline at end of file
...@@ -46,7 +46,11 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> { ...@@ -46,7 +46,11 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
List<MyWallet> wallets = mapper.selectByExample(example); List<MyWallet> wallets = mapper.selectByExample(example);
MyWallet myWallet = wallets.get(0); MyWallet myWallet = wallets.get(0);
BeanUtils.copyProperties(myWallet, appletWalletVo); appletWalletVo.setBalance(myWallet.getBalance()==null?new BigDecimal(0):myWallet.getBalance());
appletWalletVo.setTodayAmount(myWallet.getTodayAmount()==null?new BigDecimal(0):myWallet.getTodayAmount());
appletWalletVo.setTotalAmount(myWallet.getTotalAmount()==null?new BigDecimal(0):myWallet.getTotalAmount());
appletWalletVo.setUnbooked(myWallet.getUnbooked()==null?new BigDecimal(0):myWallet.getUnbooked());
appletWalletVo.setUserId(myWallet.getUserId());
return appletWalletVo; return appletWalletVo;
} }
...@@ -74,6 +78,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> { ...@@ -74,6 +78,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
BigDecimal totalConsumpution = userIdAndTotalConsumptionMap==null?new BigDecimal(0):userIdAndTotalConsumptionMap.get(wallet.getUserId())==null?new BigDecimal(0):userIdAndTotalConsumptionMap.get(wallet.getUserId()); BigDecimal totalConsumpution = userIdAndTotalConsumptionMap==null?new BigDecimal(0):userIdAndTotalConsumptionMap.get(wallet.getUserId())==null?new BigDecimal(0):userIdAndTotalConsumptionMap.get(wallet.getUserId());
BigDecimal withDrawaling = userIdAndWithdrawalingMap==null?new BigDecimal(0):userIdAndWithdrawalingMap.get(wallet.getUserId())==null?new BigDecimal(0):userIdAndWithdrawalingMap.get(wallet.getUserId()); BigDecimal withDrawaling = userIdAndWithdrawalingMap==null?new BigDecimal(0):userIdAndWithdrawalingMap.get(wallet.getUserId())==null?new BigDecimal(0):userIdAndWithdrawalingMap.get(wallet.getUserId());
walletpg.setWithdrawaling(withDrawaling); walletpg.setWithdrawaling(withDrawaling);
walletpg.setWithdrawals(walletpg.getWithdrawals()==null?new BigDecimal(0):walletpg.getWithdrawals());
walletpg.setUnbooked(walletpg.getUnbooked()==null?new BigDecimal(0):walletpg.getUnbooked());
walletpg.setTotalAmount(walletpg.getTodayAmount()==null?new BigDecimal(0):walletpg.getTotalAmount());
walletpg.setTotalConsumption(totalConsumpution); walletpg.setTotalConsumption(totalConsumpution);
walletPageVos.add(walletpg); walletPageVos.add(walletpg);
} }
......
...@@ -41,6 +41,7 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { ...@@ -41,6 +41,7 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("stauts", state); criteria.andEqualTo("stauts", state);
criteria.andEqualTo("userId", userId); criteria.andEqualTo("userId", userId);
example.setOrderByClause("crt_time DESC");
PageDataVO<MyWalletCath> walletCathPage = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example)); PageDataVO<MyWalletCath> walletCathPage = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example));
List<MyWalletCath> walletCaths = walletCathPage.getData(); List<MyWalletCath> walletCaths = walletCathPage.getData();
......
...@@ -19,6 +19,7 @@ import tk.mybatis.mapper.entity.Example; ...@@ -19,6 +19,7 @@ import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -42,6 +43,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet ...@@ -42,6 +43,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
Example example = new Example(MyWalletDetail.class); Example example = new Example(MyWalletDetail.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId",userId); criteria.andEqualTo("userId",userId);
example.setOrderByClause("crt_time DESC");
PageDataVO<MyWalletDetail> walletDetailPageVoPageDataVO = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example)); PageDataVO<MyWalletDetail> walletDetailPageVoPageDataVO = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example));
List<MyWalletDetail> walletDetails = walletDetailPageVoPageDataVO.getData(); List<MyWalletDetail> walletDetails = walletDetailPageVoPageDataVO.getData();
...@@ -84,6 +86,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet ...@@ -84,6 +86,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
walletDetailAdminVos.add(walletDetailAdminVo); walletDetailAdminVos.add(walletDetailAdminVo);
walletDetailAdminVo.setSourceName(StringUtils.isEmpty(detailListDTO.getTitle())?detailListDTO.getActivityName():detailListDTO.getTitle()); walletDetailAdminVo.setSourceName(StringUtils.isEmpty(detailListDTO.getTitle())?detailListDTO.getActivityName():detailListDTO.getTitle());
} }
walletDetailAdminVos.sort(Comparator.comparing(WalletDetailAdminVo::getCrtTime).reversed());
pageDataVO.setPageNum(walletDetailFindDTO.getPage()); pageDataVO.setPageNum(walletDetailFindDTO.getPage());
pageDataVO.setPageSize(walletDetailFindDTO.getLimit()); pageDataVO.setPageSize(walletDetailFindDTO.getLimit());
pageDataVO.setTotalCount(walletDetailPage.getTotalCount()); pageDataVO.setTotalCount(walletDetailPage.getTotalCount());
......
...@@ -72,15 +72,15 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{ ...@@ -72,15 +72,15 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
if (lastTime!=null&&(lastTime==0||isToday(lastTime))){ if (lastTime!=null&&(lastTime==0||isToday(lastTime))){
todayAmount=wallet.getTodayAmount().add(amount); todayAmount=wallet.getTodayAmount().add(amount);
} }
unbooked=wallet.getUnbooked().subtract(unbooked);
} }
unbooked=wallet.getUnbooked().subtract(unbooked);
log.info("---我的钱包入账----userId==="+userId+"----balance===="+balance+"----totalAmount===="+totalAmount+"---todayAmount==="+todayAmount+"---unbooked=="+unbooked); log.info("---我的钱包入账----userId==="+userId+"----balance===="+balance+"----totalAmount===="+totalAmount+"---todayAmount==="+todayAmount+"---unbooked=="+unbooked);
walletDetail.setItype(1); walletDetail.setItype(0);
walletDetail.setBalance(oldBalance); walletDetail.setBalance(oldBalance);
walletDetailBiz.insertSelective(walletDetail); walletDetailBiz.insertSelective(walletDetail);
Long time=System.currentTimeMillis(); Long time=System.currentTimeMillis();
wallet.setBalance(balance); wallet.setBalance(balance);
wallet.setUnbooked(unbooked);
wallet.setTodayAmount(todayAmount); wallet.setTodayAmount(todayAmount);
wallet.setTotalAmount(totalAmount); wallet.setTotalAmount(totalAmount);
wallet.setUnbooked(unbooked); wallet.setUnbooked(unbooked);
...@@ -102,7 +102,7 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{ ...@@ -102,7 +102,7 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
try { try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
date = sdf.parse(sdf.format(new Date())); date = sdf.parse(sdf.format(new Date()));
if (time < date.getTime() && time > date.getTime()) { if (time < (date.getTime()+24*3600*1000) && time > date.getTime()) {
isToday = true; isToday = true;
} }
} catch (ParseException e) { } catch (ParseException e) {
...@@ -111,6 +111,35 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{ ...@@ -111,6 +111,35 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
return isToday; return isToday;
} }
//钱包未入账的处理type1-进;2-出
public void updMyWalletUnbooked(Integer userId,BigDecimal amount,Integer type){
log.info("---钱包未入账的处理updMyWalletUnbooked----userId==="+userId+"----type==="+type);
MyWallet wallet=new MyWallet();
wallet.setUserId(userId);
wallet=selectOne(wallet);
BigDecimal unbooked=new BigDecimal("0.00");
if(wallet==null){
wallet=new MyWallet();
wallet.setUserId(userId);
if (type==1){
unbooked=amount;
}
wallet.setUnbooked(unbooked);
insertSelective(wallet);
}else {
if (type==1){
unbooked=wallet.getUnbooked().add(amount);
}else {
if (wallet.getUnbooked().compareTo(amount)>0){
unbooked=wallet.getUnbooked().subtract(amount);
}
}
log.info("---钱包未入账的处理updMyWalletUnbooked----userId==="+userId+"----unbooked==="+unbooked);
wallet.setUnbooked(unbooked);
updateSelectiveById(wallet);
}
}
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
public int createWalletByUserId(Integer userId){ public int createWalletByUserId(Integer userId){
MyWallet myWallet = new MyWallet(); MyWallet myWallet = new MyWallet();
......
...@@ -28,14 +28,14 @@ public class RabbitAdminConfig extends RabbitCommonConfig { ...@@ -28,14 +28,14 @@ public class RabbitAdminConfig extends RabbitCommonConfig {
static { static {
myQueue = new ArrayList<BindDTO>(){{ myQueue = new ArrayList<BindDTO>(){{
//支付完成后永久绑定关系 //支付完成后永久绑定关系
add(new BindDTO(ORDER_RELATION_QUEUE, ADMIN_TOPIC, KEY_ORDER_PAY)); add(new BindDTO(ORDER_RELATION_QUEUE, ORDER_TOPIC, KEY_ORDER_PAY));
//拥金计算 //拥金计算
add(new BindDTO(ORDER_WATER_QUEUE, ADMIN_TOPIC, KEY_ORDER_PAY)); add(new BindDTO(ORDER_WATER_QUEUE, ORDER_TOPIC, KEY_ORDER_PAY));
add(new BindDTO(ORDER_WATER_QUEUE, ADMIN_TOPIC, KEY_ORDER_FINLISH)); add(new BindDTO(ORDER_WATER_QUEUE, ORDER_TOPIC, KEY_ORDER_FINLISH));
add(new BindDTO(ORDER_WATER_QUEUE, ADMIN_TOPIC, KEY_ORDER_CANCEL)); add(new BindDTO(ORDER_WATER_QUEUE, ORDER_TOPIC, KEY_ORDER_CANCEL));
add(new BindDTO(ORDER_FINLISH_USER_RE_QUEUE, ADMIN_TOPIC, KEY_ORDER_FINLISH)); add(new BindDTO(ORDER_FINLISH_USER_RE_QUEUE, ORDER_TOPIC, KEY_ORDER_FINLISH));
//钱包 //钱包
add(new BindDTO(WALLET_ADD_QUEUE, ADMIN_TOPIC,KEY_WALLET_ADD )); add(new BindDTO(WALLET_ADD_QUEUE, ADMIN_TOPIC, KEY_WALLET_ADD));
}}; }};
} }
} }
......
...@@ -89,7 +89,7 @@ public class WaterMQHandler { ...@@ -89,7 +89,7 @@ public class WaterMQHandler {
setImg(orderMQDTO.getPicture()); setImg(orderMQDTO.getPicture());
setPrice(orderMQDTO.getGoodsAmount()); setPrice(orderMQDTO.getGoodsAmount());
setTitle(orderMQDTO.getName()); setTitle(orderMQDTO.getName());
setType(OrderGoodsDTO.TYPE_RENT); setType(OrderGoodsDTO.TYPE_TOUR);
}}); }});
}} }}
); );
......
...@@ -54,7 +54,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba ...@@ -54,7 +54,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
return null; return null;
} }
@GetMapping("/Manage/getMembers") @GetMapping("/manage/getMembers")
public ObjectRestResponse getMembers(){ public ObjectRestResponse getMembers(){
Example exa = Example.builder(BaseUserMemberLevel.class).where( Example exa = Example.builder(BaseUserMemberLevel.class).where(
WeekendSqls.<BaseUserMemberLevel>custom() WeekendSqls.<BaseUserMemberLevel>custom()
...@@ -66,7 +66,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba ...@@ -66,7 +66,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
@DeleteMapping("/Manage/delMembershipGrade/{id}") @DeleteMapping("/manage/delMembershipGrade/{id}")
public ObjectRestResponse delMembershipGrade(@PathVariable Integer id){ public ObjectRestResponse delMembershipGrade(@PathVariable Integer id){
BaseUserMemberLevel baseUserMemberLevel = new BaseUserMemberLevel(); BaseUserMemberLevel baseUserMemberLevel = new BaseUserMemberLevel();
baseUserMemberLevel.setId(id); baseUserMemberLevel.setId(id);
......
...@@ -2,6 +2,8 @@ package com.github.wxiaoqi.security.admin.rpc; ...@@ -2,6 +2,8 @@ package com.github.wxiaoqi.security.admin.rpc;
import com.ace.cache.annotation.Cache; import com.ace.cache.annotation.Cache;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService; import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService;
import com.github.wxiaoqi.security.admin.rpc.service.PermissionService; import com.github.wxiaoqi.security.admin.rpc.service.PermissionService;
import com.github.wxiaoqi.security.admin.vo.ImiVo; import com.github.wxiaoqi.security.admin.vo.ImiVo;
...@@ -16,6 +18,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -16,6 +18,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig; import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -40,6 +43,8 @@ public class AppUserRest { ...@@ -40,6 +43,8 @@ public class AppUserRest {
@Autowired @Autowired
private UserAuthConfig userAuthConfig; private UserAuthConfig userAuthConfig;
@Autowired
private AppUserLoginBiz appUserLoginBiz;
// @Cache(key="permission") // @Cache(key="permission")
// @RequestMapping(value = "/permissions", method = RequestMethod.GET) // @RequestMapping(value = "/permissions", method = RequestMethod.GET)
...@@ -235,4 +240,19 @@ public class AppUserRest { ...@@ -235,4 +240,19 @@ public class AppUserRest {
public ImiVo findUserInfoByImiId(@PathVariable(value = "imiId") Integer imiId){ public ImiVo findUserInfoByImiId(@PathVariable(value = "imiId") Integer imiId){
return appPermissionService.findUserInoByImiId(imiId); return appPermissionService.findUserInoByImiId(imiId);
} }
@ApiModelProperty("检查手机号是否注册过")
@GetMapping("/unauth/check")
public ObjectRestResponse check(@RequestParam(value = "phone") String phone){
if (StringUtils.isBlank(phone)){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
AppUserLogin rsUserLogin = appUserLoginBiz.checkeUserLogin(phone);
if (rsUserLogin == null){
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "手机号未注册");
}
return ObjectRestResponse.succ();
}
} }
...@@ -199,6 +199,7 @@ public class AppPermissionService { ...@@ -199,6 +199,7 @@ public class AppPermissionService {
userRedisTemplate.expire(redisLockKey, 5, TimeUnit.MINUTES);//5分钟内过期 userRedisTemplate.expire(redisLockKey, 5, TimeUnit.MINUTES);//5分钟内过期
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
return JsonResultUtil.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常"); return JsonResultUtil.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
} }
return JsonResultUtil.createSuccessResultWithObj(result); return JsonResultUtil.createSuccessResultWithObj(result);
...@@ -363,6 +364,7 @@ public class AppPermissionService { ...@@ -363,6 +364,7 @@ public class AppPermissionService {
* 自动登录type;1-app;2-小程序 * 自动登录type;1-app;2-小程序
*/ */
public JSONObject autoLogin(Integer userid, String username, String headimgurl, String nickname,String code,String activityCode,Integer type) { public JSONObject autoLogin(Integer userid, String username, String headimgurl, String nickname,String code,String activityCode,Integer type) {
log.info("-----------autoLogin----code==="+code+"----activityCode===="+activityCode);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
AppUserVo userVo = appUserDetailBiz.getUserInfoById(userid); AppUserVo userVo = appUserDetailBiz.getUserInfoById(userid);
if (userVo != null) { if (userVo != null) {
...@@ -389,6 +391,7 @@ public class AppPermissionService { ...@@ -389,6 +391,7 @@ public class AppPermissionService {
//更新登录时间 和 ip //更新登录时间 和 ip
String clientIp = getIp(); String clientIp = getIp();
appUserLoginBiz.updateLoginInfo(userid, clientIp); appUserLoginBiz.updateLoginInfo(userid, clientIp);
log.info("-----------autoLogin----type==="+type);
if(type!=null&&type==1){ if(type!=null&&type==1){
try { try {
Integer parentId=0; Integer parentId=0;
...@@ -401,6 +404,7 @@ public class AppPermissionService { ...@@ -401,6 +404,7 @@ public class AppPermissionService {
} }
//活动消息 //活动消息
Integer state=userVo.getState(); Integer state=userVo.getState();
log.info("-----------autoLogin----state==="+state);
if(state!=null&&state==1){ if(state!=null&&state==1){
if(userVo.getInviterAccount()==null||userVo.getInviterAccount()==0){ if(userVo.getInviterAccount()==null||userVo.getInviterAccount()==0){
userVo.setInviterAccount(parentId); userVo.setInviterAccount(parentId);
......
...@@ -95,11 +95,7 @@ ...@@ -95,11 +95,7 @@
) m ) m
on on
l.id = m.user_id l.id = m.user_id
where 1=1 where 1=1
<if test="mobile !=null"> <if test="mobile !=null">
and l.username like CONCAT('%',#{mobile},'%') and l.username like CONCAT('%',#{mobile},'%')
</if> </if>
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
<select id="selectByLeaderId" resultType="com.github.wxiaoqi.security.admin.entity.AppUserRelation"> <select id="selectByLeaderId" resultType="com.github.wxiaoqi.security.admin.entity.AppUserRelation">
select `parent_id` as `parentId`,`user_id`as `userId`,`bind_time` as `bindTime` from `app_user_relation` where `parent_id`=#{leaderId} and `is_del`=0 select `parent_id` as `parentId`,`user_id`as `userId`,`bind_time` as `bindTime` from `app_user_relation` where `parent_id`=#{leaderId} and `is_del`=0 order by `bind_time` DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -4,13 +4,15 @@ ...@@ -4,13 +4,15 @@
<select id="accquireIncomeByMemberIds" resultType="com.github.wxiaoqi.security.admin.bo.UserIncomeBo"> <select id="accquireIncomeByMemberIds" resultType="com.github.wxiaoqi.security.admin.bo.UserIncomeBo">
SELECT DISTINCT SELECT DISTINCT
`source_id`as userId, `source_id`as userId,
(( SELECT SUM(commission) FROM `app_user_selling_water` WHERE source_id=ausw.source_id AND `status` = 0 AND `waiting` = 1 ) (( SELECT SUM(commission) FROM `app_user_selling_water` WHERE source_id=ausw.source_id AND `status` = 0 AND
- ( SELECT SUM(commission) FROM `app_user_selling_water` WHERE source_id=ausw.source_id AND `status` = 1 AND `waiting` = 1 )) as `income` `waiting` = 1 )
FROM - ( SELECT SUM(commission) FROM `app_user_selling_water` WHERE source_id=ausw.source_id AND `status` = 1 AND
`waiting` = 1 )) as `income`
FROM
`app_user_selling_water` as ausw `app_user_selling_water` as ausw
WHERE WHERE
source_id in source_id in
<foreach collection="memberIds" item="memberId" open="(" close=")" separator=","> <foreach collection="memberIds" item="memberId" open="(" close=")" separator=",">
#{memberId} #{memberId}
...@@ -18,6 +20,10 @@ WHERE ...@@ -18,6 +20,10 @@ WHERE
</select> </select>
<select id="selectTotalIncomeByUserId" resultType="java.math.BigDecimal"> <select id="selectTotalIncomeByUserId" resultType="java.math.BigDecimal">
SELECT SUM(commission) FROM app_user_selling_water WHERE `user_id`=#{userId} SELECT
( auswu.upIncome - auswd.dowIncome ) AS `income`
FROM
( SELECT SUM( commission ) AS upIncome FROM `app_user_selling_water` WHERE STATUS = 0 AND `user_id` = #{userId} ) AS `auswu`,
( SELECT SUM( commission ) AS `dowIncome` FROM `app_user_selling_water` WHERE STATUS = 1 AND `user_id` = #{userId} ) AS `auswd`;
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if
test="userName != null and userName != ''"> test="userName != null and userName != ''">
WHERE nickname =#{userName} OR realname =#{userName} WHERE nickname =#{userName} OR realname =#{userName}
</if> ) AS `aud` ON aud.userid = aul.id </if> ) AS `aud` ON aud.userid = aul.id order by wc.crt_time DESC
</select> </select>
<select id="findUserWithDrawingByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO"> <select id="findUserWithDrawingByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO">
......
...@@ -23,13 +23,14 @@ FROM ...@@ -23,13 +23,14 @@ FROM
(select id,user_id,source,amount,cono,itype,activity_id,activity_name,`crt_time` FROM `my_wallet_detail` <if test="sourceType != null"> (select id,user_id,source,amount,cono,itype,activity_id,activity_name,`crt_time` FROM `my_wallet_detail` <if test="sourceType != null">
WHERE `source`=#{sourceType} WHERE `source`=#{sourceType}
</if>) AS `wd` </if>) AS `wd`
LEFT JOIN (SELECT id,username FROM `app_user_login`<if test="phone != null and phone != ''"> INNER JOIN (SELECT id,username FROM `app_user_login`<if test="phone != null and phone != ''">
WHERE `username`=#{phone} WHERE `username`=#{phone}
</if>) AS `aul` ON aul.id = wd.user_id </if>) AS `aul` ON aul.id = wd.user_id
LEFT JOIN (SELECT userid,nickname,realname FROM `app_user_detail`<if test="userName != null and userName != ''"> INNER JOIN (SELECT userid,nickname,realname FROM `app_user_detail`<if test="userName != null and userName != ''">
WHERE `nickname`=#{userName} OR `realname`=#{userName} WHERE `nickname`=#{userName} OR `realname`=#{userName}
</if>) AS `aud` ON aud.userid = aul.id </if>) AS `aud` ON aud.userid = aul.id
LEFT JOIN (SELECT DISTINCT order_id,id,price,extract,waiting,title FROM `app_user_selling_water`) AS `ausw` ON ausw.order_id = wd.cono LEFT JOIN (SELECT DISTINCT order_id,id,price,extract,waiting,title FROM `app_user_selling_water`) AS `ausw` ON ausw.order_id = wd.cono
ORDER BY `crtTime` DESC
</select> </select>
<select id="findpersonalConsumptionsByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO"> <select id="findpersonalConsumptionsByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO">
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
w.user_id AS `userId`, w.user_id AS `userId`,
w.balance, w.balance,
w.withdrawals, w.withdrawals,
w.total_amount AS `totalAmount`, (w.total_amount+w.unbooked) AS `totalAmount`,
w.today_amount AS `todayAmount`, w.today_amount AS `todayAmount`,
w.unbooked, w.unbooked,
w.is_frozen AS `isFrozen`, w.is_frozen AS `isFrozen`,
...@@ -65,6 +65,6 @@ FROM ...@@ -65,6 +65,6 @@ FROM
</if> ) AS `aul` ON aul.id = w.user_id </if> ) AS `aul` ON aul.id = w.user_id
INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if test="username != null and username != ''"> INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if test="username != null and username != ''">
WHERE nickname =#{username} OR realname =#{username} WHERE nickname =#{username} OR realname =#{username}
</if> ) AS `aud` ON aud.userid = aul.id </if> ) AS `aud` ON aud.userid = aul.id ORDER BY `totalAmount` DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
package com.xxfc.platform.activity.dto;
import com.xxfc.platform.activity.entity.ActivityPopularizeItem;
import com.xxfc.platform.activity.entity.ActivityPopularizeLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* 用户参与推广活动(邀请有礼)的活动记录的记录(日志)
*
* @author libin
* @email 18178966185@163.com
* @date 2019-07-05 15:23:04
*/
@Data
public class ApLogDTO extends ActivityPopularizeLog {
ActivityPopularizeItem item;
}
package com.xxfc.platform.activity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class AwardDTO {
public static final int CONDITION_INVITE = 1;
/**
* 条件类型 1--邀请
*/
@ApiModelProperty("条件类型 1--邀请")
Integer conditionType;
/**
* 数量
*/
@ApiModelProperty("数量")
Integer num;
/**
* 奖励项
*/
@ApiModelProperty("奖励项")
List<AwardItemDTO> awardItems;
}
\ No newline at end of file
package com.xxfc.platform.activity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AwardItemDTO {
/**
* 奖励类型 1--现金;2--优惠券
*/
@ApiModelProperty("奖励类型")
Integer type;
/**
* 奖励内容(根据类型决定具体填什么,如优惠券就优惠券号)
*/
@ApiModelProperty("奖励")
String award;
}
\ No newline at end of file
...@@ -7,6 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient; ...@@ -7,6 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
/** /**
...@@ -34,7 +35,7 @@ public interface ActivityFeign { ...@@ -34,7 +35,7 @@ public interface ActivityFeign {
@RequestMapping(value = "/user/use", method = RequestMethod.POST) @RequestMapping(value = "/user/use", method = RequestMethod.POST)
public BigDecimal use( public BigDecimal use(
@RequestParam(value = "userId") Integer userId, @RequestParam(value = "userId") Integer userId,
@RequestParam(value = "tickerNo") String tickerNo, @RequestParam(value = "tickerNos") List<String> tickerNos,
@RequestParam(value = "orderNo") String orderNo, @RequestParam(value = "orderNo") String orderNo,
@RequestParam(value = "channel") Integer channel, @RequestParam(value = "channel") Integer channel,
@RequestParam(value = "amount") BigDecimal amount, @RequestParam(value = "amount") BigDecimal amount,
......
package com.xxfc.platform.activity.biz; package com.xxfc.platform.activity.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.dto.RegisterQueueDTO; import com.github.wxiaoqi.security.admin.dto.RegisterQueueDTO;
import com.github.wxiaoqi.security.admin.entity.MyWalletDetail;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.xxfc.platform.activity.dto.ApLogDTO;
import com.xxfc.platform.activity.dto.AwardDTO;
import com.xxfc.platform.activity.entity.ActivityPopularizeLog; import com.xxfc.platform.activity.entity.ActivityPopularizeLog;
import com.xxfc.platform.activity.entity.ActivityPopularizeRelation; import com.xxfc.platform.activity.entity.ActivityPopularizeRelation;
import com.xxfc.platform.activity.entity.ActivityPopularizeUser; import com.xxfc.platform.activity.entity.ActivityPopularizeUser;
import com.xxfc.platform.universal.feign.MQSenderFeign;
import com.xxfc.platform.universal.feign.ThirdFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -13,6 +23,9 @@ import com.xxfc.platform.activity.entity.ActivityPopularize; ...@@ -13,6 +23,9 @@ import com.xxfc.platform.activity.entity.ActivityPopularize;
import com.xxfc.platform.activity.mapper.ActivityPopularizeMapper; import com.xxfc.platform.activity.mapper.ActivityPopularizeMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal;
import java.util.Date;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
...@@ -24,6 +37,7 @@ import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TR ...@@ -24,6 +37,7 @@ import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TR
* @date 2019-07-05 15:23:04 * @date 2019-07-05 15:23:04
*/ */
@Service @Service
@Slf4j
public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,ActivityPopularize> { public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,ActivityPopularize> {
@Autowired @Autowired
...@@ -41,10 +55,15 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti ...@@ -41,10 +55,15 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
@Autowired
MQSenderFeign mqSenderFeign;
public static final String POPULARIZE_0101 = "0101"; public static final String POPULARIZE_0101 = "0101";
public static final String PREFIX = "P"; public static final String PREFIX = "P";
public static final Integer INVITE_ITEMID = 3;
public void handleRegister(RegisterQueueDTO registerQueueDTO) { public void handleRegister(RegisterQueueDTO registerQueueDTO) {
String activityCode = registerQueueDTO.getInParamDTO().getActivityCode().replace(PREFIX, ""); String activityCode = registerQueueDTO.getInParamDTO().getActivityCode().replace(PREFIX, "");
...@@ -53,12 +72,21 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti ...@@ -53,12 +72,21 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
//获取活动code,并且注册来源是app 并且 非普通登录 //获取活动code,并且注册来源是app 并且 非普通登录
if(POPULARIZE_0101.equals(activityCode) if(POPULARIZE_0101.equals(activityCode)
&& !RegisterQueueDTO.SIGN_LOGIN.equals(registerQueueDTO.getSign())) { && !RegisterQueueDTO.SIGN_LOGIN.equals(registerQueueDTO.getSign())) {
//查询出活动 //查询出活动
ActivityPopularize activityPopularize = popularizeBiz.selectOne(new ActivityPopularize(){{ ActivityPopularize activityPopularize = popularizeBiz.selectOne(new ActivityPopularize(){{
setCode(activityCode); setCode(activityCode);
}}); }});
Date now = DateUtil.date();
Date start = DateUtil.date(activityPopularize.getStartTime());
Date end = DateUtil.date(activityPopularize.getEndTime());
//判断是否活动超时
if(now.before(start) || now.after(end)) {
log.error("不在活动范围内 入参Json:"+ JSONUtil.toJsonStr(registerQueueDTO));
return;
}
Integer majorUserId = Integer.valueOf(appUserDTO.getInviterAccount()); Integer majorUserId = Integer.valueOf(appUserDTO.getInviterAccount());
//添加活动关系 //添加活动关系
...@@ -68,15 +96,15 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti ...@@ -68,15 +96,15 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
setMinorUserId(appUserDTO.getUserid()); setMinorUserId(appUserDTO.getUserid());
}}); }});
ActivityPopularizeLog popularizeLog = popularizeLogBiz.selectOne(new ActivityPopularizeLog(){{ ApLogDTO apLogDTO = popularizeLogBiz.selectOneApLogDTO(new ActivityPopularizeLog(){{
setUserId(majorUserId); setUserId(majorUserId);
setItemId(3); setItemId(INVITE_ITEMID);
}}); }});
//生成任务项 //生成任务项
if(null == popularizeLog){ if(null == apLogDTO){
popularizeLogBiz.insertSelectiveRe(new ActivityPopularizeLog(){{ popularizeLogBiz.insertSelectiveRe(new ActivityPopularizeLog(){{
setItemId(3); setItemId(INVITE_ITEMID);
setUserId(majorUserId); setUserId(majorUserId);
setStatus(SYS_FALSE); setStatus(SYS_FALSE);
setPopularizeId(activityPopularize.getId()); setPopularizeId(activityPopularize.getId());
...@@ -91,15 +119,26 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti ...@@ -91,15 +119,26 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
//任务没有完成 //任务没有完成
if(!SYS_TRUE.equals(activityPopularizeUser.getStatus())) { if(!SYS_TRUE.equals(activityPopularizeUser.getStatus())) {
// AwardDTO awardDTO = JSONUtil.toBean(activityPopularize.getValue(), AwardDTO.class);
//检查是否满足奖励 //检查是否满足奖励
if(relationBiz.selectList(new ActivityPopularizeRelation(){{ if(relationBiz.selectList(new ActivityPopularizeRelation(){{
setMajorUserId(appUserDTO.getUserid()); setMajorUserId(majorUserId);
setPopularizeId(activityPopularize.getId()); setPopularizeId(activityPopularize.getId());
}}).size() >= 10) { }}).size() >= 2) {
apLogDTO.setStatus(SYS_TRUE);
popularizeLogBiz.updateSelectiveById(BeanUtil.toBean(apLogDTO, ActivityPopularizeLog.class));
activityPopularizeUser.setStatus(SYS_TRUE); activityPopularizeUser.setStatus(SYS_TRUE);
activityPopularizeUser.setCurrentProgress(apLogDTO.getItem().getProgress());
popularizeUserBiz.updateSelectiveById(activityPopularizeUser); popularizeUserBiz.updateSelectiveById(activityPopularizeUser);
popularizeLog.setStatus(SYS_TRUE); mqSenderFeign.sendMessage(RabbitConstant.ADMIN_TOPIC, RabbitConstant.KEY_WALLET_ADD, JSONUtil.toJsonStr(new MyWalletDetail(){{
popularizeLogBiz.updateSelectiveById(popularizeLog); setAmount(new BigDecimal("50"));
setSource(SOURCE_ACTIVITY);
setUserId(majorUserId);
setActivityId(activityPopularize.getId());
setActivityName(activityPopularize.getName());
setType(TYPE_POPULARIZE);
setItype(ITYPE_IN);
}}));
} }
} }
} }
......
package com.xxfc.platform.activity.biz; package com.xxfc.platform.activity.biz;
import cn.hutool.core.bean.BeanUtil;
import com.xxfc.platform.activity.dto.ApLogDTO;
import com.xxfc.platform.activity.entity.ActivityPopularizeItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.entity.ActivityPopularizeLog; import com.xxfc.platform.activity.entity.ActivityPopularizeLog;
...@@ -15,4 +19,18 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -15,4 +19,18 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/ */
@Service @Service
public class ActivityPopularizeLogBiz extends BaseBiz<ActivityPopularizeLogMapper,ActivityPopularizeLog> { public class ActivityPopularizeLogBiz extends BaseBiz<ActivityPopularizeLogMapper,ActivityPopularizeLog> {
@Autowired
ActivityPopularizeItemBiz activityPopularizeItemBiz;
public ApLogDTO selectOneApLogDTO(ActivityPopularizeLog entity){
ActivityPopularizeLog apl = mapper.selectOne(entity);
if(null != apl) {
ApLogDTO apLogDTO = BeanUtil.toBean(apl, ApLogDTO.class);
apLogDTO.setItem(activityPopularizeItemBiz.selectById(apLogDTO.getItemId()));
return apLogDTO;
}else {
return null;
}
}
} }
\ No newline at end of file
...@@ -93,6 +93,29 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -93,6 +93,29 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
//判断用户是否已领取或无法领取优惠卷
public ObjectRestResponse checkUserCoupon(Integer userId){
ActivityRule rule = ruleBiz.getActity();
if (rule == null) {
log.error("----没有开启的活动----");
return ObjectRestResponse.createFailedResult(101,"无有效活动");
}
Integer activityId = rule.getId();
ActivityUserJoin userJoin = new ActivityUserJoin();
userJoin.setActivityId(activityId);
userJoin.setUserId(userId);
userJoin= selectOne(userJoin);
if (userJoin == null ) {
log.error("----用户没有此参与活动----userId====" + userId);
return ObjectRestResponse.createFailedResult(102,"不是新用户,无法参与此活动");
}
if(userJoin.getStatus()!=0){
log.error("----用户已领取----userId====" + userId);
return ObjectRestResponse.createFailedResult(103,"用户已领取");
}
return ObjectRestResponse.succ();
}
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import com.xxfc.platform.activity.vo.UserCouponVo; ...@@ -11,6 +11,7 @@ import com.xxfc.platform.activity.vo.UserCouponVo;
import com.xxfc.platform.universal.weixin.util.Snowflake; import com.xxfc.platform.universal.weixin.util.Snowflake;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.mapper.UserCouponMapper; import com.xxfc.platform.activity.mapper.UserCouponMapper;
...@@ -147,28 +148,27 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -147,28 +148,27 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return mapper.getUserCoupon(tickerNo); return mapper.getUserCoupon(tickerNo);
} }
//支付后更新优惠卷状态 //支付后更新优惠卷状态:type.1-
public BigDecimal useTickerNo(Integer userId, String TickerNo, String orderNo,Integer channel,BigDecimal amout,Integer type){ public BigDecimal useTickerNo(Integer userId, List<String> tickerNos, String orderNo,Integer channel,BigDecimal amout,Integer type){
BigDecimal couponAmout=new BigDecimal("0.00"); BigDecimal couponAmout=new BigDecimal("0.00");
if(couponAmout.compareTo(amout) >= 0) { if(couponAmout.compareTo(amout) >= 0) {
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
if (userId==null||userId==0||StringUtils.isBlank(TickerNo)){ if (userId==null||userId==0||tickerNos==null||tickerNos.size()==0){
log.error("----参数不能为空"); log.error("----参数不能为空");
return couponAmout; return couponAmout;
} }
Example example=new Example(UserCoupon.class); Example example=new Example(UserCoupon.class);
example.createCriteria().andEqualTo("tickerNo",TickerNo).andEqualTo("isDel",0); example.createCriteria().andIn("tickerNo", tickerNos).andEqualTo("isDel",0);
List<UserCoupon> list=selectByExample(example); List<UserCoupon> list=selectByExample(example);
if(list.size()==0){ if(list.size()==0){
log.error(userId+"----没有可用优惠卷--TickerNo==="+TickerNo); log.error(userId+"----没有可用优惠卷--");
return couponAmout; return couponAmout;
} }
for (UserCoupon userCoupon:list) {
UserCoupon userCoupon=list.get(0);
if(userCoupon!=null&&userCoupon.getIsUse()==1){ if(userCoupon!=null&&userCoupon.getIsUse()==1){
log.error(userId+"----该优惠卷已使用--TickerNo=="+TickerNo); log.error(userId+"----该优惠卷已使用--tickerNo==");
return couponAmout; continue;
} }
if (type==1){ if (type==1){
userCoupon.setIsUse(1); userCoupon.setIsUse(1);
...@@ -176,9 +176,9 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -176,9 +176,9 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
userCoupon.setUseTime(System.currentTimeMillis()); userCoupon.setUseTime(System.currentTimeMillis());
updateSelectiveById(userCoupon); updateSelectiveById(userCoupon);
} }
couponAmout=couponAmout.add(getCouponAmout(userCoupon.getCouponId(),channel,amout));
}
return getCouponAmout(userCoupon.getCouponId(),channel,amout); return couponAmout;
} }
public BigDecimal getCouponAmout(Integer couponId,Integer channel,BigDecimal amout) { public BigDecimal getCouponAmout(Integer couponId,Integer channel,BigDecimal amout) {
...@@ -209,7 +209,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -209,7 +209,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return; return;
} }
Example example=new Example(UserCoupon.class); Example example=new Example(UserCoupon.class);
example.createCriteria().andEqualTo("TickerNo",TickerNo).andEqualTo("isDel",0); example.createCriteria().andEqualTo("tickerNo",TickerNo).andEqualTo("isDel",0);
List<UserCoupon> list=selectByExample(example); List<UserCoupon> list=selectByExample(example);
if(list.size()==0){ if(list.size()==0){
log.error(TickerNo+"----优惠卷不存在"); log.error(TickerNo+"----优惠卷不存在");
......
...@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
@RestController @RestController
@RequestMapping("user") @RequestMapping("user")
...@@ -57,13 +58,13 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -57,13 +58,13 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
@RequestMapping(value = "/use", method = RequestMethod.POST) @RequestMapping(value = "/use", method = RequestMethod.POST)
public BigDecimal use( public BigDecimal use(
@RequestParam(value = "userId",defaultValue ="0" ) Integer userId, @RequestParam(value = "userId",defaultValue ="0" ) Integer userId,
@RequestParam(value = "tickerNo",defaultValue ="" ) String tickerNo, @RequestParam(value = "tickerNos",defaultValue ="" ) List<String> tickerNos,
@RequestParam(value = "orderNo",defaultValue ="" ) String orderNo, @RequestParam(value = "orderNo",defaultValue ="" ) String orderNo,
@RequestParam(value = "channel",defaultValue ="1" ) Integer channel, @RequestParam(value = "channel",defaultValue ="1" ) Integer channel,
@RequestParam(value = "amount",defaultValue ="0.00" ) BigDecimal amount, @RequestParam(value = "amount",defaultValue ="0.00" ) BigDecimal amount,
@RequestParam(value = "type",defaultValue ="1" ) Integer type @RequestParam(value = "type",defaultValue ="1" ) Integer type
) { ) {
return baseBiz.useTickerNo(userId,tickerNo,orderNo,channel,amount,type); return baseBiz.useTickerNo(userId,tickerNos,orderNo,channel,amount,type);
} }
@ApiOperation("优惠卷取消使用") @ApiOperation("优惠卷取消使用")
...@@ -85,6 +86,17 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -85,6 +86,17 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
return joinBiz.receiveCoupn(userId); return joinBiz.receiveCoupn(userId);
} }
@ApiOperation("检查用户是否可领取")
@RequestMapping(value = "/coupon/check", method = RequestMethod.GET)
public ObjectRestResponse check() {
AppUserDTO userInfo = getUserInfo();
Integer userId = userInfo.getUserid();
if (userId == null) {
return ObjectRestResponse.createDefaultFail();
}
return joinBiz.checkUserCoupon(userId);
}
......
...@@ -97,21 +97,19 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> { ...@@ -97,21 +97,19 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public RestResponse uploadDrivingLicense(MultipartFile file) throws IOException { public ObjectRestResponse uploadDrivingLicense(MultipartFile file) throws IOException {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
String dirPathToday = File.separator + now.toString(DEFAULT_DATE_TIME_FORMATTER); String dirPathToday = File.separator + now.toString(DEFAULT_DATE_TIME_FORMATTER);
String redisNoKey = RedisKey.UPLOAD_FILE_NO_PREFIX + now.toString(DEFAULT_DATE_TIME_FORMATTER); // String redisNoKey = RedisKey.UPLOAD_FILE_NO_PREFIX + now.toString(DEFAULT_DATE_TIME_FORMATTER);
// Long no = redisTemplate.opsForValue().increment(redisNoKey); // Long no = redisTemplate.opsForValue().increment(redisNoKey);
// if(no.equals(1L)){ // if(no.equals(1L)){
// redisTemplate.expire(redisNoKey,1, TimeUnit.DAYS); // redisTemplate.expire(redisNoKey,1, TimeUnit.DAYS);
// } // }
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String realFileRelPath = dirPathToday + File.separator+fileName.substring(fileName.lastIndexOf("/")); String realFileRelPath = dirPathToday + File.separator+fileName;
String filePath = uploadPath + realFileRelPath; String filePath = uploadPath + realFileRelPath;
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath)); FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(filePath); return ObjectRestResponse.succ(filePath);
} }
......
package com.xxfc.platform.app.config;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.MultipartConfigElement;
@Configuration
public class FileUploadConfig {
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
// 单个数据大小
factory.setMaxFileSize("51200KB");
/// 总上传数据大小
factory.setMaxRequestSize("51200KB");
return factory.createMultipartConfig();
}
}
package com.xxfc.platform.app.rest; package com.xxfc.platform.app.rest;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.constant.AppFormat;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
...@@ -17,6 +18,7 @@ import com.xxfc.platform.vehicle.constant.ResCode.ResCode; ...@@ -17,6 +18,7 @@ import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Delete;
...@@ -31,29 +33,32 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -31,29 +33,32 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@RestController @RestController
@RequestMapping("version") @RequestMapping("version")
@IgnoreClientToken @IgnoreClientToken
public class AppVersionController extends BaseController<AppVersionBiz,AppVersion> { @Slf4j
//最大上传500MB public class AppVersionController extends BaseController<AppVersionBiz, AppVersion> {
private Long MAX_DRIVING_LICENSE_SIZE =1024*1024*500L; /**
private int id; * 最大上传500MB
*/
private Long MAX_DRIVING_LICENSE_SIZE = 1024 * 1024 * 500L;
@ApiModelProperty("app自动更新") @ApiModelProperty("app自动更新")
@RequestMapping(value ="/app/unauth/info",method = RequestMethod.GET) @RequestMapping(value = "/app/unauth/info", method = RequestMethod.GET)
@IgnoreUserToken @IgnoreUserToken
public ObjectRestResponse info( public ObjectRestResponse info(
@RequestParam(value = "type",defaultValue = "0") Integer type, @RequestParam(value = "type", defaultValue = "0") Integer type,
@RequestParam(value = "version",defaultValue = "") String version, @RequestParam(value = "version", defaultValue = "") String version,
@RequestParam(value = "isH5",defaultValue = "0") Integer isH5 @RequestParam(value = "isH5", defaultValue = "0") Integer isH5
){ ) {
ObjectRestResponse restResponse=null; ObjectRestResponse restResponse = null;
if (isH5!=null&&isH5==1){ if (isH5 != null && isH5 == 1) {
restResponse= baseBiz.getVersionH5(type); restResponse = baseBiz.getVersionH5(type);
}else { } else {
restResponse=baseBiz.getVersion(version,type); restResponse = baseBiz.getVersion(version, type);
} }
return restResponse; return restResponse;
} }
...@@ -61,61 +66,61 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio ...@@ -61,61 +66,61 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
@Override @Override
@ApiOperation("添加") @ApiOperation("添加")
@RequestMapping(value = "/background/add",method = RequestMethod.POST) @RequestMapping(value = "/background/add", method = RequestMethod.POST)
public ObjectRestResponse<AppVersion> add(@RequestBody AppVersion appVersion){ public ObjectRestResponse<AppVersion> add(@RequestBody AppVersion appVersion) {
baseBiz.insertAppVersion(appVersion); baseBiz.insertAppVersion(appVersion);
return new ObjectRestResponse<AppVersion>(); return new ObjectRestResponse<AppVersion>();
} }
@ApiOperation("查询") @ApiOperation("查询一条")
@RequestMapping(value = "/background/getAppVersion/{id}",method = RequestMethod.GET) @RequestMapping(value = "/background/getAppVersion/{id}", method = RequestMethod.GET)
public ObjectRestResponse<AppVersion> getAppVersion(@PathVariable Integer id){ public ObjectRestResponse<AppVersion> getAppVersion(@PathVariable Integer id) {
return ObjectRestResponse.succ(baseBiz.get(id)); return ObjectRestResponse.succ(baseBiz.get(id));
} }
@ApiOperation("查询所有") @ApiOperation("查询所有")
@RequestMapping(value = "/background/getAppVersions",method = RequestMethod.POST) @RequestMapping(value = "/background/getAppVersions", method = RequestMethod.POST)
public ObjectRestResponse<PageInfo<AppVersion>> getAppVersions(@RequestBody appVersionQuery query){ public ObjectRestResponse<PageInfo<AppVersion>> getAppVersions(@RequestBody appVersionQuery query) {
return ObjectRestResponse.succ(baseBiz.getAll(query)); return ObjectRestResponse.succ(baseBiz.getAll(query));
} }
@Override @Override
@ApiOperation("修改") @ApiOperation("修改")
@RequestMapping(value = "/background/update/{id}",method = RequestMethod.PUT) @RequestMapping(value = "/background/update", method = RequestMethod.PUT)
public ObjectRestResponse<AppVersion> update(@RequestBody AppVersion appVersion){ public ObjectRestResponse<AppVersion> update(@RequestBody AppVersion appVersion) {
baseBiz.updateAppVersionById(appVersion); baseBiz.updateAppVersionById(appVersion);
return new ObjectRestResponse<AppVersion>(); return new ObjectRestResponse<AppVersion>();
} }
@ApiOperation("删除") @ApiOperation("删除")
@DeleteMapping(value = "/background/remove/{id}") @DeleteMapping(value = "/background/remove/{id}")
public ObjectRestResponse<AppVersion> remove(@PathVariable Integer id){ public ObjectRestResponse<AppVersion> remove(@PathVariable Integer id) {
baseBiz.remove(id); baseBiz.remove(id);
return new ObjectRestResponse<AppVersion>(); return new ObjectRestResponse<AppVersion>();
} }
@PostMapping(value = "/upload/installationPackage") @PostMapping(value = "/upload/installationPackage")
@ApiOperation(value = "上传app安装包") @ApiOperation(value = "上传app安装包")
public RestResponse uploadInstallationPackage(@RequestParam("file") MultipartFile file) public ObjectRestResponse uploadInstallationPackage(@RequestParam MultipartFile file)
throws Exception { throws Exception {
Assert.notNull(file); //文件类型
String contentType = file.getContentType(); //文件类型 String contentType = file.getContentType();
//// String fileName = file.getOriginalFilename(); //文件名 String name = file.getOriginalFilename();
if (!contentType.equals("apk") && !contentType.equals("ipa")) { String content = name.substring(name.lastIndexOf("."));
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); System.out.println("file.getSize()" + file.getSize());
} System.out.println("content"+content);
if (file.getSize() > MAX_DRIVING_LICENSE_SIZE) { System.out.println("contentType" + contentType);
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); //判断上传的文件格式
if (!judgeFormat(content) || file.getSize() > MAX_DRIVING_LICENSE_SIZE) {
return ObjectRestResponse.createDefaultFail();
} }
return baseBiz.uploadDrivingLicense(file); return baseBiz.uploadDrivingLicense(file);
} }
@IgnoreUserToken @IgnoreUserToken
@GetMapping(value = "/download/installationPackage/{realFileRelPath}") //匹配的是href中的download请求 @GetMapping(value = "/download/installationPackage/{realFileRelPath}") //匹配的是href中的download请求
@ApiOperation(value = "下载app安装包") @ApiOperation(value = "下载app安装包")
...@@ -123,4 +128,22 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio ...@@ -123,4 +128,22 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
return baseBiz.downloadInstallationPackage(realFileRelPath); return baseBiz.downloadInstallationPackage(realFileRelPath);
} }
/**
* 判断上传的文件格式
*
* @param contentType
* @return
*/
private boolean judgeFormat(String contentType) {
if (AppFormat.getFormatSet().size() == 0) {
return true;
}
for (String format : AppFormat.getFormatSet()) {
if (format.equals(contentType)) {
return true;
}
}
return false;
}
} }
\ No newline at end of file
servlet:
multipart:
# 启用上传处理,默认是true
enabled: true
# 当上传文件达到20MB的时候进行磁盘写入
file-size-threshold: 20MB
# 设置最大的请求文件的大小
max-request-size: 50MB
# 设置单个文件的最大长度
max-file-size: 50MB
\ No newline at end of file
...@@ -4,8 +4,8 @@ import java.util.HashMap; ...@@ -4,8 +4,8 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public enum RefundTypeEnum { public enum RefundTypeEnum {
RentVehicle(1, "订单款"), ORDER_FUND(1, "订单款"),
TOUR(2, "押金"), DEPOSIT(2, "押金"),
; ;
/** /**
* 编码 * 编码
......
...@@ -240,6 +240,6 @@ public class BaseOrder implements Serializable { ...@@ -240,6 +240,6 @@ public class BaseOrder implements Serializable {
* 使用的优惠券票号,逗号分割 * 使用的优惠券票号,逗号分割
*/ */
@ApiModelProperty(value = "使用的优惠券票号,逗号分割") @ApiModelProperty(value = "使用的优惠券票号,逗号分割")
@Column(name = "coupon_ticker_no") @Column(name = "coupon_ticker_nos")
private String couponTickerNos; private String couponTickerNos;
} }
...@@ -5,6 +5,7 @@ import javax.persistence.Column; ...@@ -5,6 +5,7 @@ import javax.persistence.Column;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
@Data @Data
...@@ -19,7 +20,7 @@ public class OrderViolation { ...@@ -19,7 +20,7 @@ public class OrderViolation {
* 违章总金额 * 违章总金额
*/ */
@Column(name="price") @Column(name="price")
private Double price; private BigDecimal price;
/** /**
......
...@@ -288,13 +288,8 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -288,13 +288,8 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
tourFeign.stock(otd.getSpePriceId(), otd.getTotalNumber(), TourFeign.STOCK_PLUS); tourFeign.stock(otd.getSpePriceId(), otd.getTotalNumber(), TourFeign.STOCK_PLUS);
} }
OrderMQDTO orderMQDTO = new OrderMQDTO();
orderMQDTO.setOrderMemberDetail(omd);
orderMQDTO.setOrderRentVehicleDetail(orvd);
orderMQDTO.setOrderTourDetail(otd);
//发送队列消息 //发送队列消息
sendQueue(orderMQDTO, OrderMQDTO.ORDER_CANCEL); sendOrderMq(orvd, otd, omd, baseOrder, OrderMQDTO.ORDER_CANCEL);
}else { }else {
throw new BaseException(ResultCode.FAILED_CODE); throw new BaseException(ResultCode.FAILED_CODE);
} }
...@@ -325,12 +320,13 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -325,12 +320,13 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
if(null == depositAmount) { if(null == depositAmount) {
depositAmount = BigDecimal.ZERO; depositAmount = BigDecimal.ZERO;
} }
BigDecimal refundGoodsAmount = calculateRefund(baseOrder.getGoodsAmount(), timeLag, dicParentKey, refundDesc); //商品价格 - 优惠券减免的价格
BigDecimal refundGoodsAmount = calculateRefund(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()), timeLag, dicParentKey, refundDesc);
//退款金额 //退款金额
BigDecimal refundAmount = depositAmount.add(refundGoodsAmount); BigDecimal refundAmount = depositAmount.add(refundGoodsAmount);
//退款子流程: 订单基础,退款描述,退款金额 //退款子流程: 订单基础,退款描述,退款金额
refundSubProcess(baseOrder, refundDesc, refundAmount, RefundTypeEnum.RentVehicle.getCode(), RefundStatusEnum.ALL.getCode()); refundSubProcess(baseOrder, refundDesc, refundAmount, RefundTypeEnum.ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode());
} }
public BigDecimal calculateRefund(BigDecimal goodsAmount, Long timeLag, String dicParentKey, String refundDesc) { public BigDecimal calculateRefund(BigDecimal goodsAmount, Long timeLag, String dicParentKey, String refundDesc) {
...@@ -416,7 +412,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -416,7 +412,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
setOrderId(orderId); setOrderId(orderId);
setRefundTime(System.currentTimeMillis()); setRefundTime(System.currentTimeMillis());
setTradeNo(refundTradeNo); setTradeNo(refundTradeNo);
setRefundType(RefundTypeEnum.RentVehicle.getCode()); setRefundType(RefundTypeEnum.ORDER_FUND.getCode());
}}; }};
orderRefund.setRefundAmount(refundAmount); orderRefund.setRefundAmount(refundAmount);
orderRefund.setRefundDesc(refundDesc); orderRefund.setRefundDesc(refundDesc);
...@@ -498,21 +494,27 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -498,21 +494,27 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
AppUserDTO appUserDTO = userFeign.userDetailById(baseOrder.getUserId()).getData(); AppUserDTO appUserDTO = userFeign.userDetailById(baseOrder.getUserId()).getData();
//处理App用户提醒短信的发送 //处理App用户提醒短信的发送
//orderMsgBiz.handelAppUserMsg(orvd, omd, baseOrder, appUserDTO); orderMsgBiz.handelAppUserMsg(orvd, omd, baseOrder, appUserDTO);
//处理后台用户提醒短信的发送 //处理后台用户提醒短信的发送
orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_PAY); orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_PAY);
sendOrderMq(orvd, otd, omd, baseOrder, OrderMQDTO.ORDER_PAY);
if(OrderTypeEnum.MEMBER.getCode().equals(baseOrder.getType())) {
sendOrderMq(orvd, otd, omd, baseOrder, OrderMQDTO.ORDER_FINISH);
}
}
} else {
log.error(" order has payed , orderNo:{}, tradeNo:{} ", orderNo, tradeNo);
}
}
public void sendOrderMq(OrderRentVehicleDetail orvd, OrderTourDetail otd, OrderMemberDetail omd, BaseOrder baseOrder, Integer sign) {
//发送队列消息 //发送队列消息
OrderMQDTO orderMQDTO = BeanUtil.toBean(baseOrder, OrderMQDTO.class); OrderMQDTO orderMQDTO = BeanUtil.toBean(baseOrder, OrderMQDTO.class);
orderMQDTO.setOrderRentVehicleDetail(orvd); orderMQDTO.setOrderRentVehicleDetail(orvd);
orderMQDTO.setOrderTourDetail(otd); orderMQDTO.setOrderTourDetail(otd);
orderMQDTO.setOrderMemberDetail(omd); orderMQDTO.setOrderMemberDetail(omd);
sendQueue(orderMQDTO, OrderMQDTO.ORDER_PAY); sendQueue(orderMQDTO, sign);
}
} else {
log.error(" order has payed , orderNo:{}, tradeNo:{} ", orderNo, tradeNo);
}
} }
/** /**
...@@ -521,6 +523,18 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -521,6 +523,18 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
* @return * @return
*/ */
public BaseOrder updateSelectiveByIdReT(BaseOrder baseOrder) { public BaseOrder updateSelectiveByIdReT(BaseOrder baseOrder) {
return updateSelectiveByIdReT(baseOrder, false);
}
/**
* 更新(不成功抛异常)
* @param baseOrder
* @return
*/
public BaseOrder updateSelectiveByIdReT(BaseOrder baseOrder, boolean needVersion) {
if(needVersion) {
baseOrder.setVersion(selectById(baseOrder.getId()).getVersion());
}
if(updateSelectiveByIdRe(baseOrder) > 0) { if(updateSelectiveByIdRe(baseOrder) > 0) {
return selectById(baseOrder.getId()); return selectById(baseOrder.getId());
}else { }else {
...@@ -528,6 +542,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -528,6 +542,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
} }
} }
// /**
// * 更新(不成功抛异常)
// * @param baseOrder
// * @return
// */
// public BaseOrder updateSelectiveByIdReT(BaseOrder baseOrder) {
// if(updateSelectiveByIdRe(baseOrder) > 0) {
// return selectById(baseOrder.getId());
// }else {
// throw new BaseException(ResultCode.DB_OPERATION_FAIL_CODE);
// }
// }
public boolean getTodyTime(Long time) { public boolean getTodyTime(Long time) {
Long startTime = getDayStart(); Long startTime = getDayStart();
if(time > startTime && time < startTime + 24 * 60 * 60 * 1000 - 1) { if(time > startTime && time < startTime + 24 * 60 * 60 * 1000 - 1) {
......
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import cn.hutool.json.JSONUtil;
import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.order.entity.OrderRefund; import com.xxfc.platform.order.entity.OrderRefund;
import com.xxfc.platform.order.mapper.OrderRefundMapper; import com.xxfc.platform.order.mapper.OrderRefundMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
/** /**
* 订单退款记录表 * 订单退款记录表
* *
...@@ -15,4 +32,47 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -15,4 +32,47 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/ */
@Service @Service
public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
@Autowired
ThirdFeign thirdFeign;
@Autowired
BaseOrderBiz baseOrderBiz;
@Autowired
OrderRentVehicleBiz orderRentVehicleBiz;
@Autowired
OrderVehicalCrosstownBiz crosstownBiz;
public void refundDeposit(OrderMQDTO orderMQDTO){
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
BigDecimal illegalReserve = new BigDecimal(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.ILLEGAL_RESERVE).getDetail());
//未退还, 进行保留违章预备金 的退还
if(RefundStatusEnum.NONE.getCode().equals(orderMQDTO.getRefundStatus())) {
OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{
setOrderId(orderMQDTO.getId());
setType(CrosstownTypeEnum.TOUR.getCode());
}});
//还车扣除款 剩余的 钱,再减去违章预备金
BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve);
List<DedDetailDTO> dddList = JSONUtil.toBean(crosstown.getDedDetail(), List.class);
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString();
for(DedDetailDTO ddd : dddList) {
refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost();
}
refundDesc += ")";
refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode());
}
}
public void refundTrigger(BaseOrder baseOrder, OrderRentVehicleDetail orvd, BigDecimal residueAmount, BigDecimal refundAmont, String refundDesc, Integer refundStatus) {
//退款子流程: 订单基础,退款描述,退款金额
baseOrderBiz.refundSubProcess(baseOrder, refundDesc, refundAmont, RefundTypeEnum.DEPOSIT.getCode(), refundStatus);
//设置剩余没有返还的钱
orderRentVehicleBiz.updateSelectiveById(new OrderRentVehicleDetail(){{
setId(orvd.getId());
setReturnPayResidue(residueAmount);
}});
}
} }
\ No newline at end of file
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.entity.BaseOrder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.order.entity.OrderTourDetail; import com.xxfc.platform.order.entity.OrderTourDetail;
...@@ -21,7 +24,16 @@ public class OrderTourDetailBiz extends BaseBiz<OrderTourDetailMapper,OrderTourD ...@@ -21,7 +24,16 @@ public class OrderTourDetailBiz extends BaseBiz<OrderTourDetailMapper,OrderTourD
private static Map<Integer, List<Integer>> ChargeOffAble; private static Map<Integer, List<Integer>> ChargeOffAble;
public void ChargeOff() { /**
* 更新(不成功抛异常)
* @param orderTourDetail
* @return
*/
public OrderTourDetail updateSelectiveByIdReT(OrderTourDetail orderTourDetail) {
if(updateSelectiveByIdRe(orderTourDetail) > 0) {
return selectById(orderTourDetail.getId());
}else {
throw new BaseException(ResultCode.DB_OPERATION_FAIL_CODE);
}
} }
} }
\ No newline at end of file
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO; import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
...@@ -9,6 +8,7 @@ import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum; ...@@ -9,6 +8,7 @@ import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.entity.BaseOrder; import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderTourDetail; import com.xxfc.platform.order.entity.OrderTourDetail;
import com.xxfc.platform.order.mapper.OrderTourVerificationMapper; import com.xxfc.platform.order.mapper.OrderTourVerificationMapper;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.OrderTourVerificationVO; import com.xxfc.platform.order.pojo.order.OrderTourVerificationVO;
import com.xxfc.platform.tour.feign.TourFeign; import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo; import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
...@@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.Instant; import java.time.Instant;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -89,25 +92,41 @@ public class OrderTourVerificationBiz{ ...@@ -89,25 +92,41 @@ public class OrderTourVerificationBiz{
} }
// 出发时间 是否已经发车 // 出发时间 是否已经发车
Long departureTime = tourFeign.selectDepartureTimeByStartCompanyIdAndRouteId(tourDetail.getStartCompanyId(),tourDetail.getGoodId()); Date departureDate = tourFeign.selectDepartureDataBySpeId(tourDetail.getSpePriceId());
if (Instant.now().toEpochMilli()<departureTime){ Long departureTime = tourFeign.selectDepartureTimeByStartCompanyIdAndRouteId(tourDetail.getStartCompanyId(), tourDetail.getGoodId());
Integer departureStatus = tourFeign.selectDepartureStatusByVerificationId(verificationId);
LocalTime localDepartureTime = LocalTime.ofSecondOfDay(departureTime);
departureDate.setHours(localDepartureTime.getHour());
departureDate.setMinutes(localDepartureTime.getMinute());
departureDate.setSeconds(localDepartureTime.getSecond());
if (Instant.now().toEpochMilli()<departureDate.toInstant().toEpochMilli()){
return ObjectRestResponse.createFailedResultWithObj(400,"还未到发车时间",0); return ObjectRestResponse.createFailedResultWithObj(400,"还未到发车时间",0);
} }
Integer departureStatus = tourFeign.selectDepartureStatusByVerificationId(verificationId); departureDate.setHours(0);
departureDate.setMinutes(0);
departureDate.setSeconds(0);
Instant seconddayInstant = departureDate.toInstant().plus(1, ChronoUnit.DAYS);
if(Instant.now().toEpochMilli()>seconddayInstant.toEpochMilli()){
return ObjectRestResponse.createFailedResultWithObj(400,"该票已无效",2);
}
if (departureStatus==1){ if (departureStatus==1){
return ObjectRestResponse.createFailedResultWithObj(400,"已经发车",1); return ObjectRestResponse.createFailedResultWithObj(400,"已经发车",1);
} }
baseOrder=new BaseOrder(); baseOrder=new BaseOrder();
baseOrder.setId(orderId); baseOrder.setId(orderId);
baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode()); baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode());
baseOrder.setVersion(version); baseOrder.setVersion(version);
baseOrderBiz.updateSelectiveById(baseOrder); baseOrder = baseOrderBiz.updateSelectiveByIdReT(baseOrder);
tourDetail.setVerificationUser(userDTO.getId()); tourDetail.setVerificationUser(userDTO.getId());
tourDetail.setVerificationName(userDTO.getName()); tourDetail.setVerificationName(userDTO.getName());
tourDetail.setVerificationTime(System.currentTimeMillis()); tourDetail.setVerificationTime(System.currentTimeMillis());
tourDetailBiz.updateSelectiveById(tourDetail); tourDetail = tourDetailBiz.updateSelectiveByIdReT(tourDetail);
tourFeign.updateTourGoodPersonNum(verificationId,"verification_person",total_number); tourFeign.updateTourGoodPersonNum(verificationId,"verification_person",total_number);
baseOrderBiz.sendOrderMq(null,tourDetail,null, baseOrder, OrderMQDTO.ORDER_FINISH);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
...@@ -12,6 +12,7 @@ import com.xxfc.platform.order.entity.OrderRentVehicleDetail; ...@@ -12,6 +12,7 @@ import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.entity.OrderUserLicense; import com.xxfc.platform.order.entity.OrderUserLicense;
import com.xxfc.platform.order.entity.OrderVehicleCrosstown; import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper; import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto; import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.Vehicle; import com.xxfc.platform.vehicle.entity.Vehicle;
...@@ -90,14 +91,7 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -90,14 +91,7 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
if (oldValue .size() == 1) { if (oldValue .size() == 1) {
//已有直接返回 //已有直接返回
//交车完成 设置订单状态为出行中 //交车完成 设置订单状态为出行中
if(baseOrder.getStatus() == 4) {// handleOrderStatus(baseOrder, orderRentVehicleDetail);
//判断交车时间是否是今天
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
} else if(baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
}
OrderVehicleCrosstownDto vehicleCrosstownDto = new OrderVehicleCrosstownDto(); OrderVehicleCrosstownDto vehicleCrosstownDto = new OrderVehicleCrosstownDto();
BeanUtil.copyProperties(oldValue.get(0), vehicleCrosstownDto, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); BeanUtil.copyProperties(oldValue.get(0), vehicleCrosstownDto, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
List<OrderUserLicense> orderUserLicenses = orderUserLicenseBiz.selectByIds(oldValue.get(0).getUserLicenseId()).getData(); List<OrderUserLicense> orderUserLicenses = orderUserLicenseBiz.selectByIds(oldValue.get(0).getUserLicenseId()).getData();
...@@ -115,15 +109,7 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -115,15 +109,7 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
} else if(oldValue .size() <= 0) { } else if(oldValue .size() <= 0) {
getOrderLicense(orderVehicleCrosstownDto); getOrderLicense(orderVehicleCrosstownDto);
orderVehicalCrosstownBiz.insertSelective(orderVehicleCrosstownDto); orderVehicalCrosstownBiz.insertSelective(orderVehicleCrosstownDto);
//交车完成 设置订单状态为出行中 handleOrderStatus(baseOrder, orderRentVehicleDetail);
if(baseOrder.getStatus() == 4) {
//判断是否是今日交车
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
} else if(baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
}
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId()); RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId());
if(restResponse.getData() != null) { if(restResponse.getData() != null) {
orderVehicleCrosstownDto.setVehicleNumberPlat(restResponse.getData().getNumberPlate()); orderVehicleCrosstownDto.setVehicleNumberPlat(restResponse.getData().getNumberPlate());
...@@ -133,6 +119,19 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -133,6 +119,19 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
private void handleOrderStatus(BaseOrder baseOrder, OrderRentVehicleDetail orderRentVehicleDetail) {
//交车完成 设置订单状态为出行中
if (baseOrder.getStatus() == 4) {
//判断是否是今日交车
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
} else if (baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
baseOrderBiz.sendOrderMq(orderRentVehicleDetail, null, null, baseOrder, OrderMQDTO.ORDER_FINISH);
}
}
public void getOrderLicense(OrderVehicleCrosstownDto orderVehicleCrosstownDto) { public void getOrderLicense(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
OrderUserLicense orderUserLicense = new OrderUserLicense(); OrderUserLicense orderUserLicense = new OrderUserLicense();
orderUserLicense.setLicenseIdCard(orderVehicleCrosstownDto.getLicenseIdCard()); orderUserLicense.setLicenseIdCard(orderVehicleCrosstownDto.getLicenseIdCard());
......
...@@ -18,7 +18,7 @@ import java.util.Map; ...@@ -18,7 +18,7 @@ import java.util.Map;
* @date 2019/1/7 * @date 2019/1/7
*/ */
@Configuration @Configuration
public class RabbitUserConfig { public class RabbitDelayConfig {
public static final String ORDER_CANCEL_EXC = "order_cancel_delay_exchange"; public static final String ORDER_CANCEL_EXC = "order_cancel_delay_exchange";
public static final String ORDER_CANCEL_QUE = "order_cancel_delay_queue"; public static final String ORDER_CANCEL_QUE = "order_cancel_delay_queue";
......
package com.xxfc.platform.order.config;
import com.github.wxiaoqi.security.common.config.RabbitCommonConfig;
import com.github.wxiaoqi.security.common.config.rabbit.BindDTO;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
* @author zhoujw
* @date 2019/7/15
*/
@Configuration
public class RabbitOrderConfig extends RabbitCommonConfig {
//优惠券
public static final String ORDER_DEPOSIT_REFUND_QUEUE = "order.deposit.refund.queue";
static {
myQueue = new ArrayList<BindDTO>(){{
add(new BindDTO(ORDER_DEPOSIT_REFUND_QUEUE, ORDER_TOPIC, KEY_ORDER_FINLISH));
}};
}
}
...@@ -2,13 +2,12 @@ package com.xxfc.platform.order.jobhandler; ...@@ -2,13 +2,12 @@ package com.xxfc.platform.order.jobhandler;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.common.util.IntervalUtil; import com.github.wxiaoqi.security.common.util.IntervalUtil;
import com.xxfc.platform.order.biz.BaseOrderBiz; import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.biz.OrderRentVehicleBiz;
import com.xxfc.platform.order.biz.OrderVehicalCrosstownBiz;
import com.xxfc.platform.order.contant.enumerate.*; import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.BaseOrder; import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail; import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.entity.OrderVehicleCrosstown; import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.entity.OrderViolation;
import com.xxfc.platform.order.pojo.DedDetailDTO; import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.universal.constant.DictionaryKey; import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary; import com.xxfc.platform.universal.entity.Dictionary;
...@@ -27,6 +26,7 @@ import java.math.BigDecimal; ...@@ -27,6 +26,7 @@ import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER; import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
/** /**
...@@ -37,7 +37,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER; ...@@ -37,7 +37,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
@JobHandler(value = "rentDepositHandler") @JobHandler(value = "rentDepositHandler")
@Component @Component
@Slf4j @Slf4j
public class RentDepositHandler extends IJobHandler { public class RentDepositJobHandler extends IJobHandler {
@Autowired @Autowired
BaseOrderBiz baseOrderBiz; BaseOrderBiz baseOrderBiz;
...@@ -48,50 +48,51 @@ public class RentDepositHandler extends IJobHandler { ...@@ -48,50 +48,51 @@ public class RentDepositHandler extends IJobHandler {
@Autowired @Autowired
OrderVehicalCrosstownBiz crosstownBiz; OrderVehicalCrosstownBiz crosstownBiz;
@Autowired
OrderViolationBiz orderViolationBiz;
@Autowired
OrderRefundBiz orderRefundBiz;
@Autowired @Autowired
ThirdFeign thirdFeign; ThirdFeign thirdFeign;
@Override @Override
public ReturnT<String> execute(String idLastNumInterval) throws Exception { public ReturnT<String> execute(String idLastNumInterval) throws Exception {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData(); Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
BigDecimal illegalReserve = new BigDecimal(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.ILLEGAL_RESERVE).getDetail()); Integer rentDepositAutoRefundTime = new Integer(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_DEPOSIT_AUTO_REFUND_TIME).getDetail());
try { try {
for(int i = 0; i < 10; i++) { for(int i = 0; i < 10; i++) {
if(IntervalUtil.staticIsInTheInterval(String.valueOf(i), idLastNumInterval)) { if(IntervalUtil.staticIsInTheInterval(String.valueOf(i), idLastNumInterval)) {
//三十天
List<BaseOrder> lists = baseOrderBiz.selectByExample(new Example.Builder(BaseOrder.class) List<BaseOrder> lists = baseOrderBiz.selectByExample(new Example.Builder(BaseOrder.class)
//订单已完成的租车订单 //订单已完成的租车订单
.where(WeekendSqls.<BaseOrder>custom().andEqualTo(BaseOrder::getType, OrderTypeEnum.RENT_VEHICLE) .where(WeekendSqls.<BaseOrder>custom().andEqualTo(BaseOrder::getType, OrderTypeEnum.RENT_VEHICLE)
.andEqualTo(BaseOrder::getStatus, OrderStatusEnum.ORDER_FINISH) .andEqualTo(BaseOrder::getStatus, OrderStatusEnum.ORDER_FINISH) //已完成的订单
.andLike(BaseOrder::getId, "%"+ String.valueOf(i))).build()); .andEqualTo(BaseOrder::getRefundStatus, RefundStatusEnum.RESIDUE_ILLEGAL) //已归还了部分押金
.andLessThanOrEqualTo(BaseOrder::getRefundTime, System.currentTimeMillis() - (rentDepositAutoRefundTime * 60 * 60 * 1000))
.andLike(BaseOrder::getId, "%"+ i)).build());
//处理自动退押金 //处理自动退剩余押金
for(BaseOrder baseOrder : lists) { for(BaseOrder baseOrder : lists) {
OrderRentVehicleDetail orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail() {{ OrderRentVehicleDetail orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail() {{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
}}); }});
//未退还, 进行保留违章预备金 的退还
if(RefundStatusEnum.NONE.getCode().equals(baseOrder.getRefundStatus())) { OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{
OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{ setDetailId(orvd.getId());
setOrderId(baseOrder.getId()); setIsDel(SYS_FALSE);
setType(CrosstownTypeEnum.TOUR.getCode());
}}); }});
BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve);
List<DedDetailDTO> dddList = JSONUtil.toBean(crosstown.getDedDetail(), List.class); //还车扣除款 剩余的 钱,再减去违章预备金
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString(); BigDecimal refundAmont = orvd.getReturnPayResidue().subtract(orderViolation.getPrice());
for(DedDetailDTO ddd : dddList) { String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章扣款:"+ refundAmont.toString();
refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost(); // for(DedDetailDTO ddd : dddList) {
} // refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost();
// }
refundDesc += ")"; refundDesc += ")";
//退款子流程: 订单基础,退款描述,退款金额 orderRefundBiz.refundTrigger(baseOrder, orvd, refundAmont, refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode());
baseOrderBiz.refundSubProcess(baseOrder, refundDesc, refundAmont, RefundTypeEnum.RentVehicle.getCode(), RefundStatusEnum.RESIDUE_ILLEGAL.getCode());
//设置剩余
}else if(RefundStatusEnum.RESIDUE_ILLEGAL.getCode().equals(baseOrder.getRefundStatus())){
//判断是否违章
//扣违章的钱
//baseOrderBiz.refundSubProcess(baseOrder, refundDesc, refundAmont, RefundTypeEnum.RENT_VEHICLE.getCode(), RefundStatusEnum.RESIDUE_ILLEGAL.getCode());
}
// baseOrderBiz.refundSubProcess(baseOrder, refundDesc, refundAmont);
} }
} }
......
...@@ -13,9 +13,8 @@ import org.springframework.stereotype.Component; ...@@ -13,9 +13,8 @@ import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import static com.xxfc.platform.order.config.RabbitUserConfig.ORDER_CANCEL_QUE; import static com.xxfc.platform.order.config.RabbitDelayConfig.ORDER_CANCEL_QUE;
/** /**
* activeMq消费者类 * activeMq消费者类
......
...@@ -7,10 +7,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -7,10 +7,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import static com.xxfc.platform.order.config.RabbitUserConfig.ORDER_CANCEL_EXC; import static com.xxfc.platform.order.config.RabbitDelayConfig.ORDER_CANCEL_EXC;
import static com.xxfc.platform.order.config.RabbitUserConfig.ORDER_CANCEL_KEY; import static com.xxfc.platform.order.config.RabbitDelayConfig.ORDER_CANCEL_KEY;
/** /**
* rabbitMq生产者类 * rabbitMq生产者类
......
package com.xxfc.platform.order.mqhandler;
import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.dto.OrderGoodsDTO;
import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO;
import com.rabbitmq.client.Channel;
import com.xxfc.platform.order.biz.OrderRefundBiz;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.xxfc.platform.order.config.RabbitOrderConfig.ORDER_DEPOSIT_REFUND_QUEUE;
import static com.xxfc.platform.order.pojo.mq.OrderMQDTO.*;
@Component
@Slf4j
public class RefundMQHandler {
@Autowired
OrderRefundBiz orderRefundBiz;
/**
* 佣金
* @param
*/
@RabbitListener(queues = ORDER_DEPOSIT_REFUND_QUEUE)
public void integralHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.execute(new Runnable() {
@Override
public void run() {
try {
String messageId = message.getMessageProperties().getMessageId();
String msg = new String(message.getBody(), "UTF-8");
OrderMQDTO orderMQDTO = JSONUtil.toBean(msg, OrderMQDTO.class);
orderRefundBiz.refundDeposit(orderMQDTO);
executorService.shutdown();
Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
// 手动签收
channel.basicAck(deliveryTag, false);
} catch (Exception e) {
log.info("接收到的消息失败");
try {
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
} catch (IOException i) {
i.printStackTrace();
}
e.printStackTrace();
}
}
});
}
}
...@@ -43,7 +43,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe ...@@ -43,7 +43,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
@RequestMapping(value = "/price/calculate/{type}/{no}", method = RequestMethod.GET) @RequestMapping(value = "/price/calculate/{type}/{no}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@IgnoreClientToken @IgnoreClientToken
public ObjectRestResponse getOrderParam(@PathVariable(value = "no") String type, @PathVariable(value = "no") String no) { public ObjectRestResponse getPriceCalculate(@PathVariable(value = "type") String type, @PathVariable(value = "no") String no) {
checkAppUser(); checkAppUser();
//根据no 查订单 //根据no 查订单
OrderPageVO orderPageVO = baseOrderBiz.pageByParm(new Query(new PageParam(){{ OrderPageVO orderPageVO = baseOrderBiz.pageByParm(new Query(new PageParam(){{
...@@ -59,22 +59,22 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe ...@@ -59,22 +59,22 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
switch (orderTypeEnum) { switch (orderTypeEnum) {
case RENT_VEHICLE: case RENT_VEHICLE:
// orp.setRefundGoodsAmount(baseOrderBiz.calculateRefund(orderPageVO.getGoodsAmount() baseOrderBiz.calculateRefund(orderPageVO.getGoodsAmount()
, System.currentTimeMillis() - orderPageVO.getOrderRentVehicleDetail().getStartTime()
, DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.RENT_REFUND
, "取消订单退款:");
break;
case TOUR:
// String dicParentKey = DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.TOUR_REFUND;
// //不是省外,
// if(SYS_FALSE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
// dicParentKey = DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.TOUR_IN_REFUND;
// }
// orp.setRefundAmount(baseOrderBiz.calculateRefund(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
// , System.currentTimeMillis() - orderPageVO.getOrderRentVehicleDetail().getStartTime() // , System.currentTimeMillis() - orderPageVO.getOrderRentVehicleDetail().getStartTime()
// , DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.RENT_REFUND // , DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.RENT_REFUND
// , "取消订单退款:")); // , "取消订单退款:"));
break; break;
case TOUR:
String dicParentKey = DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.TOUR_REFUND;
//不是省外,
if(SYS_FALSE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
dicParentKey = DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.TOUR_IN_REFUND;
}
orp.setRefundAmount(baseOrderBiz.calculateRefund(orderPageVO.getGoodsAmount()
, System.currentTimeMillis() - orderPageVO.getOrderRentVehicleDetail().getStartTime()
, DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.RENT_REFUND
, "取消订单退款:"));
break;
default: default:
// orp.setRefundAmount(orderPageVO); // orp.setRefundAmount(orderPageVO);
break; break;
......
...@@ -39,6 +39,7 @@ import java.math.BigDecimal; ...@@ -39,6 +39,7 @@ import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum.*; import static com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
...@@ -124,8 +125,6 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -124,8 +125,6 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
@Override @Override
public void handleDetail(RentVehicleBO bo) { public void handleDetail(RentVehicleBO bo) {
//获取可用车辆
acquireVehicle(bo);
//设置订单状态为3 //设置订单状态为3
bo.getOrder().setStatus(OrderStatusEnum.ORDER_UNPAY.getCode()); bo.getOrder().setStatus(OrderStatusEnum.ORDER_UNPAY.getCode());
//设置订单图片 //设置订单图片
...@@ -143,9 +142,12 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -143,9 +142,12 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//如果有使用优惠券,则扣减 //如果有使用优惠券,则扣减
if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) < 0) { if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) < 0) {
activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo().get(0), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE); activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo(), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE);
} }
//获取可用车辆
acquireVehicle(bo);
super.handleDetail(bo); super.handleDetail(bo);
//发送定时取消订单(数据字典设置--5分钟) //发送定时取消订单(数据字典设置--5分钟)
...@@ -244,9 +246,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -244,9 +246,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//优惠券处理 //优惠券处理
//待完成 //待完成
if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) { if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) {
couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo().get(0), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE); couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo(), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE);
if(couponAmount.compareTo(BigDecimal.ZERO) > 0) { if(couponAmount.compareTo(BigDecimal.ZERO) > 0) {
detail.getOrder().setCouponTickerNos(detail.getTickerNo().get(0)); detail.getOrder().setCouponTickerNos(detail.getTickerNo().stream().collect(Collectors.joining(",")));
} }
} }
...@@ -334,8 +336,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -334,8 +336,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
RentVehicleBookDTO rentVehicleBookDTO = BeanUtil.toBean(detail.getBookVehicleVO(), RentVehicleBookDTO.class); RentVehicleBookDTO rentVehicleBookDTO = BeanUtil.toBean(detail.getBookVehicleVO(), RentVehicleBookDTO.class);
rentVehicleBookDTO.setModelId(detail.getModelId()); rentVehicleBookDTO.setModelId(detail.getModelId());
rentVehicleBookDTO.setUserName(BaseContextHandler.getName()); rentVehicleBookDTO.setUserName(BaseContextHandler.getName());
rentVehicleBookDTO.setLiftCompany(detail.getStartCompanyId());
rentVehicleBookDTO.setLiftAddr(detail.getStartAddr());
ObjectRestResponse<VehicleBookRecord> orr = vehicleFeign.rentApplyVehicle(rentVehicleBookDTO); ObjectRestResponse<VehicleBookRecord> orr = vehicleFeign.rentApplyVehicle(rentVehicleBookDTO);
if(! CommonConstants.SYS_JSON_TRUE.equals(orr.getStatus())) { if(!CommonConstants.SYS_JSON_TRUE.equals(orr.getStatus())) {
throw new BaseException(orr.getMessage(), orr.getStatus()); throw new BaseException(orr.getMessage(), orr.getStatus());
} }
detail.setVehicleId(orr.getData().getVehicleId()); detail.setVehicleId(orr.getData().getVehicleId());
......
...@@ -140,7 +140,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -140,7 +140,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//如果有使用优惠券,则扣减 //如果有使用优惠券,则扣减
if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) < 0) { if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) < 0) {
activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo().get(0), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE); activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo(), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE);
} }
super.handleDetail(bo); super.handleDetail(bo);
...@@ -217,9 +217,10 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -217,9 +217,10 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//优惠券处理 //优惠券处理
//待完成 //待完成
if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) { if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) {
couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo().get(0), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE); couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo(), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE);
if(couponAmount.compareTo(BigDecimal.ZERO) > 0) { if(couponAmount.compareTo(BigDecimal.ZERO) > 0) {
detail.getOrder().setCouponTickerNos(detail.getTickerNo().get(0)); detail.getOrder().setCouponTickerNos(detail.getTickerNo()
.stream().collect(Collectors.joining(",")));
} }
} }
......
...@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -100,4 +101,7 @@ public interface TourFeign { ...@@ -100,4 +101,7 @@ public interface TourFeign {
@GetMapping("/tourGood/verfication/departure_status") @GetMapping("/tourGood/verfication/departure_status")
Integer selectDepartureStatusByVerificationId(@RequestParam(value = "verificationId") Integer verificationId); Integer selectDepartureStatusByVerificationId(@RequestParam(value = "verificationId") Integer verificationId);
@GetMapping("/spe/departure_date")
Date selectDepartureDataBySpeId(@RequestParam(value = "speIds") Integer speIds);
} }
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
</dependencies> </dependencies>
<build> <build>
<finalName>xx-tour</finalName>
<plugins> <plugins>
<!-- 此插件用来生成通用mapper的代码 --> <!-- 此插件用来生成通用mapper的代码 -->
<plugin> <plugin>
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.tour.dto.TourSpePriceDTO; import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.entity.TourGoodSpe;
import com.xxfc.platform.tour.entity.TourGoodSpePrice; import com.xxfc.platform.tour.entity.TourGoodSpePrice;
import com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper; import com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper;
import com.xxfc.platform.tour.vo.TourSpePriceVo; import com.xxfc.platform.tour.vo.TourSpePriceVo;
...@@ -15,6 +16,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -15,6 +16,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -101,4 +103,10 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP ...@@ -101,4 +103,10 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP
public void delGoodSpe(Integer goodId, List<Integer> ids){ mapper.delSpe(goodId,ids);} public void delGoodSpe(Integer goodId, List<Integer> ids){ mapper.delSpe(goodId,ids);}
public Date selectDepartureDataBySpeId(Integer speIds) {
TourGoodSpePrice tourGoodSpePrice = new TourGoodSpePrice();
tourGoodSpePrice.setId(speIds);
TourGoodSpePrice spePrice = mapper.selectOne(tourGoodSpePrice);
return spePrice.getStartTime();
}
} }
\ No newline at end of file
...@@ -8,6 +8,8 @@ import com.xxfc.platform.tour.dto.TourSpePriceDTO; ...@@ -8,6 +8,8 @@ import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.vo.TourSpePriceVo; import com.xxfc.platform.tour.vo.TourSpePriceVo;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date;
@RestController @RestController
@RequestMapping("spe") @RequestMapping("spe")
@IgnoreClientToken @IgnoreClientToken
...@@ -32,4 +34,8 @@ public class TourGoodSpeController extends TourBaseController<TourGoodSpeBiz> { ...@@ -32,4 +34,8 @@ public class TourGoodSpeController extends TourBaseController<TourGoodSpeBiz> {
return baseBiz.cutStock(speId,number,type); return baseBiz.cutStock(speId,number,type);
} }
@GetMapping("/departure_date")
public Date selectDepartureDataBySpeId(@RequestParam(value = "speIds")Integer spePriceId){
return baseBiz.selectDepartureDataBySpeId(spePriceId);
}
} }
\ No newline at end of file
...@@ -42,4 +42,9 @@ public class DictionaryKey { ...@@ -42,4 +42,9 @@ public class DictionaryKey {
* 支付价格减低 * 支付价格减低
*/ */
public static final String PAY_DEMOTION = "PAY_DEMOTION"; public static final String PAY_DEMOTION = "PAY_DEMOTION";
/**
* 自动退款保留押金的时间(小时)
*/
public static final String RENT_DEPOSIT_AUTO_REFUND_TIME = "RENT_DEPOSIT_AUTO_REFUND_TIME";
} }
...@@ -14,7 +14,7 @@ public class CCPRestSmsUtils { ...@@ -14,7 +14,7 @@ public class CCPRestSmsUtils {
restAPI.init("app.cloopen.com", "8883"); restAPI.init("app.cloopen.com", "8883");
restAPI.setAccount("8aaf070865e6b6eb0165ecd776700559", restAPI.setAccount("8aaf070865e6b6eb0165ecd776700559",
"3fe5e2f053674f23b029a9a9fc9503f0"); "3fe5e2f053674f23b029a9a9fc9503f0");
restAPI.setAppId("8a216da86812593601684bec10581ab5"); restAPI.setAppId("8a216da86bfdbeb5016c0d2543670a06");
} }
public static Map<String, Object> sendTemplateSMS(String phoneNumbers, String[] params, String templateId) { public static Map<String, Object> sendTemplateSMS(String phoneNumbers, String[] params, String templateId) {
......
...@@ -13,8 +13,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; ...@@ -13,8 +13,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication(scanBasePackages = { @SpringBootApplication(scanBasePackages = {
"com.xxfc.platform", "com.xxfc.platform",
"com.github.wxiaoqi.security.common.handler", "com.github.wxiaoqi.security.common.handler"
"com.github.wxiaoqi.security.common.log"
}) })
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableAceAuthClient @EnableAceAuthClient
......
...@@ -10,21 +10,21 @@ import org.springframework.stereotype.Service; ...@@ -10,21 +10,21 @@ import org.springframework.stereotype.Service;
public class CCPRestSmsBiz{ public class CCPRestSmsBiz{
//租车订单通知(普通用户)1 //租车订单通知(普通用户)1
public static final String TEMPLATE_ID_ORDER = "457270"; public static final String TEMPLATE_ID_ORDER = "458626";
//租车订单短信(会员权益)2 //租车订单短信(会员权益)2
public static final String TEMPLATE_ID_ORDER_MEMBER = "457271"; public static final String TEMPLATE_ID_ORDER_MEMBER = "458625";
//旅游订单短信3 //旅游订单短信3
public static final String TEMPLATE_ID_ORDER_TOUR = "457272"; public static final String TEMPLATE_ID_ORDER_TOUR = "458624";
//加入会员通知4 //加入会员通知4
public static final String TEMPLATE_ID_MEMBER = "457273"; public static final String TEMPLATE_ID_MEMBER = "458623";
//租/还车公司相同(订单支付后立即发送给相关负责人)5 //租/还车公司相同(订单支付后立即发送给相关负责人)5
public static final String TEMPLATE_ID_TAAKE_CAR = "457501"; public static final String TEMPLATE_ID_TAAKE_CAR = "458622";
//租/还车公司不同(发给租车公司负责人,订单支付后发送)6 //租/还车公司不同(发给租车公司负责人,订单支付后发送)6
public static final String TEMPLATE_ID_DIFFERENT_TAAKE_CAR = "457502"; public static final String TEMPLATE_ID_DIFFERENT_TAAKE_CAR = "458621";
// 租/还车公司不同(发给还车公司负责人,订单出车后发))(相同不发)7 // 租/还车公司不同(发给还车公司负责人,订单出车后发))(相同不发)7
public static final String TEMPLATE_ID_ALSO_CAR = "457503"; public static final String TEMPLATE_ID_ALSO_CAR = "458620";
//取消订单8 //取消订单8
public static final String TEMPLATE_ID_CANCEL = "457506"; public static final String TEMPLATE_ID_CANCEL = "458627";
//发送模板消息 //发送模板消息
......
...@@ -77,6 +77,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -77,6 +77,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
log.error("-----参数为空-----------"); log.error("-----参数为空-----------");
return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空"); return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空");
} }
log.error("-----payAmoun======="+payAmount+"------refundAmount======"+refundAmount);
Example example =new Example(OrderPay.class); Example example =new Example(OrderPay.class);
example.createCriteria().andEqualTo("orderNo", order_no).andEqualTo("isDel",0).andEqualTo("status",1); example.createCriteria().andEqualTo("orderNo", order_no).andEqualTo("isDel",0).andEqualTo("status",1);
List<OrderPay> list=payBiz.selectByExample(example); List<OrderPay> list=payBiz.selectByExample(example);
......
...@@ -15,6 +15,8 @@ import com.aliyuncs.profile.IClientProfile; ...@@ -15,6 +15,8 @@ import com.aliyuncs.profile.IClientProfile;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import com.github.wxiaoqi.security.common.util.RandomUtil; import com.github.wxiaoqi.security.common.util.RandomUtil;
...@@ -155,6 +157,62 @@ public class SmsService { ...@@ -155,6 +157,62 @@ public class SmsService {
return false; return false;
} }
public boolean sendTemplate(String PhoneNumbers,String params,String templateCode) throws ClientException {
//可自助调整超时时间
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(PhoneNumbers);
//必填:短信签名-可在短信控制台中找到
request.setSignName(SignName);
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode(templateCode);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam(params);//\"name\":\"Tom\",
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
//request.setSmsUpExtendCode("90997");
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
//request.setOutId("yourOutId");
//hint 此处可能会抛出异常,注意catch
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
log.info("短信接口返回的数据----------------mobile======"+PhoneNumbers+"----templateParam===="+params);
log.info("Code=" + sendSmsResponse.getCode());
log.info("Message=" + sendSmsResponse.getMessage());
log.info("RequestId=" + sendSmsResponse.getRequestId());
log.info("BizId=" + sendSmsResponse.getBizId());
if(sendSmsResponse.getCode() != null && sendSmsResponse.getCode().equals("OK")) {
//请求成功
return true;
}
return false;
}
public String getString(Map<String,Object> params){
if(params!=null){
StringBuilder sb = new StringBuilder("{");
for (Object o : params.keySet()) {
sb.append("\"" + o + "\"" +":"+"\"" + params.get(o) + "\"" +",");
}
sb.replace(sb.length() - 1, sb.length(), "}");
return sb.toString();
}
return null;
}
/* public static QuerySendDetailsResponse querySendDetails(String bizId) throws ClientException { /* public static QuerySendDetailsResponse querySendDetails(String bizId) throws ClientException {
...@@ -188,14 +246,19 @@ public class SmsService { ...@@ -188,14 +246,19 @@ public class SmsService {
} }
*/ */
public static void main(String[] args) throws ClientException, InterruptedException { public static void main(String[] args) throws ClientException, InterruptedException {
SmsService SmsService=new SmsService(); SmsService smsService=new SmsService();
//发短信 //发短信
String response = SmsService.sendSms("15521075918","123456"); Map<String,Object> params=new HashMap<>();
params.put("name","何振");
params.put("code","123456");
params.put("time",5);
params.put("other","何振2");
smsService.sendTemplate("13612688539","123","SMS_171112286");
/*System.out.println("短信接口返回的数据----------------"); /*System.out.println("短信接口返回的数据----------------");
System.out.println("Code=" + response.getCode()); System.out.println("Code=" + response.getCode());
System.out.println("Message=" + response.getMessage()); System.out.println("Message=" + response.getMessage());
System.out.println("RequestId=" + response.getRequestId()); System.out.println("RequestId=" + response.getRequestId());
System.out.println("BizId=" + response.getBizId());*/ System.out.println("BizId=" + response.getBizId());*//*
Thread.sleep(3000L); Thread.sleep(3000L);
/* /*
......
...@@ -53,7 +53,7 @@ public class UploadService { ...@@ -53,7 +53,7 @@ public class UploadService {
String filePath = baseUploadPath + realFileRelPath; String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置 //将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath)); FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
realFileRelPath= SystemConfig.XXMP_URL+realFileRelPath; realFileRelPath=xx_url+SystemConfig.XXMP_URL+realFileRelPath;
return realFileRelPath; return realFileRelPath;
} }
...@@ -80,10 +80,12 @@ public class UploadService { ...@@ -80,10 +80,12 @@ public class UploadService {
file.mkdirs(); file.mkdirs();
} }
realFileRelPath=filePath + "/" + no + ".jpg"; String str="/" + no + ".jpg";
realFileRelPath = realFileRelPath+str;
filePath=filePath +str;
//将文件写入指定位置 //将文件写入指定位置
ImgBase64Util.generateImage(imgFile,realFileRelPath); ImgBase64Util.generateImage(imgFile,filePath);
realFileRelPath= SystemConfig.XXMP_URL+realFileRelPath; realFileRelPath=xx_url+SystemConfig.XXMP_URL+realFileRelPath;
return realFileRelPath; return realFileRelPath;
} }
......
...@@ -5,3 +5,13 @@ logging: ...@@ -5,3 +5,13 @@ logging:
debug debug
com.xxfc.platform.common: com.xxfc.platform.common:
debug debug
servlet:
multipart:
# 启用上传处理,默认是true
enabled: true
# 当上传文件达到20MB的时候进行磁盘写入
file-size-threshold: 20MB
# 设置最大的请求文件的大小
max-request-size: 50MB
# 设置单个文件的最大长度
max-file-size: 50MB
\ No newline at end of file
...@@ -78,4 +78,12 @@ public class BranchCompanyVo { ...@@ -78,4 +78,12 @@ public class BranchCompanyVo {
*/ */
private Integer zoneId; private Integer zoneId;
/**
* 租车客服电话
*/
private String vehiceServicePhone;
/**
* 旅游客服电话
*/
private String tourServicePhone;
} }
\ No newline at end of file
...@@ -9,13 +9,16 @@ ...@@ -9,13 +9,16 @@
<result column="name" property="name" jdbcType="VARCHAR" /> <result column="name" property="name" jdbcType="VARCHAR" />
<result column="branch_type" property="branchType" jdbcType="INTEGER" /> <result column="branch_type" property="branchType" jdbcType="INTEGER" />
<result column="subordinate_branch" property="subordinateBranch" jdbcType="INTEGER" /> <result column="subordinate_branch" property="subordinateBranch" jdbcType="INTEGER" />
<result column="location" property="location" jdbcType="VARCHAR" />
<result column="addr_province" property="addrProvince" jdbcType="INTEGER" /> <result column="addr_province" property="addrProvince" jdbcType="INTEGER" />
<result column="addr_city" property="addrCity" jdbcType="INTEGER" /> <result column="addr_city" property="addrCity" jdbcType="INTEGER" />
<result column="addr_town" property="addrTown" jdbcType="INTEGER" /> <result column="addr_town" property="addrTown" jdbcType="INTEGER" />
<result column="addr_detail" property="addrDetail" jdbcType="VARCHAR" /> <result column="addr_detail" property="addrDetail" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="vehice_service_phone" property="vehiceServicePhone"/>
<result column="tour_service_phone" property="tourServicePhone"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
</resultMap> </resultMap>
<select id="search" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO"> <select id="search" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment