Commit 6c618efb authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents b922fd0b 716a5455
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;
}
}
......@@ -62,6 +62,13 @@ public class AppUserSellingWater implements Serializable {
@Column(name = "order_no")
@ApiModelProperty(value = "订单号")
private String orderNo;
/**
* 订单号
*/
@Column(name = "order_type")
@ApiModelProperty(value = "1-租车;2-旅游;3-会员;4-营地")
private Integer orderType;
/**
* 商品id
......
......@@ -103,15 +103,18 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
Integer parentId = relation.getParentId();
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---parentId===" + parentId);
BigDecimal amount = new BigDecimal("0.00");
//商品类型
Integer orderType=0;
for (OrderGoodsDTO goodsDto : goodsDTOList) {
//商品id
Integer goodId = goodsDto.getGoodId();
//商品价格
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);
Integer positionId = 6;
if (userVo != null) {
......@@ -137,6 +140,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWater.setPositionId(positionId);
sellingWater.setOrderId(orderId);
sellingWater.setOrderNo(orderNo);
sellingWater.setOrderType(orderType);
sellingWater.setGoodId(goodId);
sellingWater.setTitle(goodsDto.getTitle());
sellingWater.setImg(goodsDto.getImg());
......@@ -145,18 +149,16 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWater.setGoodNumber(goodsDto.getGoodNumber());
sellingWater.setCommission(commission);
insertSelective(sellingWater);
log.info("购买计算用户拥成功----payOrderWater--------userId===" + userId+"----type===="+type);
if(type==null){
continue;
}
if(type==3){
finishOrderWater(orderWaterDTO);
}else if(type==2){
myWaterBiz.updMyWalletUnbooked(userId,commission);
}
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);
}
}
//订单完成计算用户拥金
......@@ -170,14 +172,16 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
List<AppUserSellingWater> list = getWaterList(orderId);
BigDecimal amount = new BigDecimal("0.00");
Integer userId = 0;
Integer orderType=0;
if (list.size() > 0) {
for (AppUserSellingWater sellingWater : list) {
Integer id = sellingWater.getId();
orderType=sellingWater.getOrderType();
userId = sellingWater.getUserId();
sellingWater.setWaiting(1);
updateById(sellingWater);
BigDecimal commission = sellingWater.getCommission();
log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission);
log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission+"----orderType==="+orderType);
amount = amount.add(commission);
}
}
......@@ -191,6 +195,10 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
detail.setCono(orderId);
detail.setSource(1);
myWaterBiz.updMyWater(detail);
if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,amount,2);
}
}
}
......@@ -205,10 +213,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
}
List<AppUserSellingWater> list = getWaterList(orderId);
BigDecimal amount = new BigDecimal("0.00");
BigDecimal unbooked = new BigDecimal("0.00");
Integer userId = 0;
Integer orderType=0;
if (list.size() > 0) {
for (AppUserSellingWater sellingWater : list) {
Integer id = sellingWater.getId();
orderType=sellingWater.getOrderType();
userId = sellingWater.getUserId();
sellingWater.setWaiting(1);
updateById(sellingWater);
......@@ -216,10 +227,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWater.setStatus(1);
insertSelective(sellingWater);
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);
//更新钱包
if (r == 1 && userId > 0) {
......@@ -230,6 +242,9 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
detail.setSource(1);
myWaterBiz.updMyWater(detail);
}
if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,unbooked,2);
}
}
......
......@@ -193,6 +193,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
* @return
*/
public BaseUserMemberVO findOneByUserId(Integer userId) {
BaseUserMemberVO baseUserMemberVO= mapper.getBaseUserMemberVOByUserId(userId);
if (baseUserMemberVO!=null) {
return baseUserMemberVO;
......@@ -218,23 +219,38 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
BaseUserMember baseUserMember = new BaseUserMember();
BeanUtilsBean.getInstance().copyProperties(baseUserMember,baseUserMemberVO);
if (baseUserMembers==null||baseUserMembers.size()==0) {
if (baseUserMemberVO.getMemberLevel()==null||baseUserMember.getValidTime()==null) return;
baseUserMember.setCrtTime(System.currentTimeMillis());
baseUserMember.setIsDel(0);
baseUserMember.setPayCount(0);
baseUserMember.setCardLeave(1);
baseUserMember.setRecentRecharge(System.currentTimeMillis());
Integer buyCount = baseUserMember.getBuyCount()==null? 0:baseUserMember.getBuyCount();
baseUserMember.setBuyCount(buyCount+1);
insertSelective(baseUserMember);
return;
if (baseUserMemberVO.getMemberLevel() == null || baseUserMember.getValidTime() == null ) return;
baseUserMember.setCrtTime(System.currentTimeMillis());
baseUserMember.setIsDel(0);
baseUserMember.setPayCount(0);
baseUserMember.setCardLeave(1);
baseUserMember.setRecentRecharge(System.currentTimeMillis());
Integer buyCount = baseUserMember.getBuyCount() == null ? 0 : baseUserMember.getBuyCount();
baseUserMember.setBuyCount(buyCount + 1);
insertSelective(baseUserMember);
return;
}else if (baseUserMembers.size()==1){
baseUserMember.setUpdTime(System.currentTimeMillis());
getMyBiz().updateSelectiveById(baseUserMember);
if (baseUserMemberVO.getMemberLevel() == null || baseUserMember.getValidTime() == null ){
baseUserMember.setIsDel(1);
}else {
baseUserMember.setIsDel(0);
}
baseUserMember.setUpdTime(System.currentTimeMillis());
baseUserMember.setBuyCount(baseUserMembers.get(0).getBuyCount()+1);
baseUserMember.setId(baseUserMembers.get(0).getId());
mapper.updateByPrimaryKeySelective(baseUserMember);
}else {
throw new BaseException("Member purchase repeat!");
}
}
}
\ No newline at end of file
......@@ -72,13 +72,8 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
if (lastTime!=null&&(lastTime==0||isToday(lastTime))){
todayAmount=wallet.getTodayAmount().add(amount);
}
//只有拥金才会未入账
if (wallet.getUnbooked().compareTo(amount)>0&&walletDetail.getSource()!=null&&walletDetail.getSource()==1){
unbooked=wallet.getUnbooked().subtract(amount);
}
}
unbooked=wallet.getUnbooked().subtract(unbooked);
log.info("---我的钱包入账----userId==="+userId+"----balance===="+balance+"----totalAmount===="+totalAmount+"---todayAmount==="+todayAmount+"---unbooked=="+unbooked);
walletDetail.setItype(0);
walletDetail.setBalance(oldBalance);
......@@ -116,18 +111,29 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
return isToday;
}
//钱包未入账的添加
public void updMyWalletUnbooked(Integer userId,BigDecimal amount){
//钱包未入账的处理type1-进;2-出
public void updMyWalletUnbooked(Integer userId,BigDecimal amount,Integer type){
log.info("---钱包未入账的处理----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);
wallet.setUnbooked(amount);
if (type==1){
unbooked=amount;
}
wallet.setUnbooked(unbooked);
insertSelective(wallet);
}else {
BigDecimal unbooked=wallet.getUnbooked().add(amount);
if (type==1){
unbooked=wallet.getUnbooked().add(amount);
}else {
if (wallet.getUnbooked().compareTo(amount)>0){
unbooked=wallet.getUnbooked().subtract(amount);
}
}
wallet.setUnbooked(unbooked);
mapper.updMyWater(wallet);
}
......
......@@ -89,7 +89,7 @@ public class WaterMQHandler {
setImg(orderMQDTO.getPicture());
setPrice(orderMQDTO.getGoodsAmount());
setTitle(orderMQDTO.getName());
setType(OrderGoodsDTO.TYPE_RENT);
setType(OrderGoodsDTO.TYPE_TOUR);
}});
}}
);
......
......@@ -54,7 +54,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
return null;
}
@GetMapping("/Manage/getMembers")
@GetMapping("/manage/getMembers")
public ObjectRestResponse getMembers(){
Example exa = Example.builder(BaseUserMemberLevel.class).where(
WeekendSqls.<BaseUserMemberLevel>custom()
......@@ -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){
BaseUserMemberLevel baseUserMemberLevel = new BaseUserMemberLevel();
baseUserMemberLevel.setId(id);
......
......@@ -95,10 +95,7 @@
) m
on
l.id = m.user_id
where 1=1
and m.is_del=0
<if test="mobile !=null">
and l.username like CONCAT('%',#{mobile},'%')
......@@ -118,6 +115,8 @@
<if test="source !=null">
and d.source = #{source}
</if>
order by l.id ASC
</select>
......
......@@ -97,7 +97,7 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
return ObjectRestResponse.succ();
}
public RestResponse uploadDrivingLicense(MultipartFile file) throws IOException {
public ObjectRestResponse uploadDrivingLicense(MultipartFile file) throws IOException {
DateTime now = DateTime.now();
String dirPathToday = File.separator + now.toString(DEFAULT_DATE_TIME_FORMATTER);
String redisNoKey = RedisKey.UPLOAD_FILE_NO_PREFIX + now.toString(DEFAULT_DATE_TIME_FORMATTER);
......@@ -111,7 +111,7 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
String filePath = uploadPath + realFileRelPath;
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;
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.IgnoreUserToken;
import com.github.wxiaoqi.security.common.exception.BaseException;
......@@ -17,6 +18,7 @@ import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Delete;
......@@ -36,6 +38,7 @@ import java.util.List;
@RestController
@RequestMapping("version")
@IgnoreClientToken
@Slf4j
public class AppVersionController extends BaseController<AppVersionBiz,AppVersion> {
//最大上传500MB
private Long MAX_DRIVING_LICENSE_SIZE =1024*1024*500L;
......@@ -68,7 +71,7 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
}
@ApiOperation("查询")
@ApiOperation("查询一条")
@RequestMapping(value = "/background/getAppVersion/{id}",method = RequestMethod.GET)
public ObjectRestResponse<AppVersion> getAppVersion(@PathVariable Integer id){
return ObjectRestResponse.succ(baseBiz.get(id));
......@@ -82,7 +85,7 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
@Override
@ApiOperation("修改")
@RequestMapping(value = "/background/update/{id}",method = RequestMethod.PUT)
@RequestMapping(value = "/background/update",method = RequestMethod.PUT)
public ObjectRestResponse<AppVersion> update(@RequestBody AppVersion appVersion){
baseBiz.updateAppVersionById(appVersion);
return new ObjectRestResponse<AppVersion>();
......@@ -99,17 +102,17 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
@PostMapping(value = "/upload/installationPackage")
@ApiOperation(value = "上传app安装包")
public RestResponse uploadInstallationPackage(@RequestParam("file") MultipartFile file)
public ObjectRestResponse uploadInstallationPackage(@RequestParam("file") MultipartFile file)
throws Exception {
Assert.notNull(file);
String contentType = file.getContentType(); //文件类型
//// String fileName = file.getOriginalFilename(); //文件名
if (!contentType.equals("apk") && !contentType.equals("ipa")) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
if (file.getSize() > MAX_DRIVING_LICENSE_SIZE) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
//文件类型
String contentType = file.getContentType();
log.debug("contentType"+contentType);
//判断上传的文件格式
if (!judgeFormat(contentType)||file.getSize() > MAX_DRIVING_LICENSE_SIZE) {
return ObjectRestResponse.createDefaultFail();
}
return baseBiz.uploadDrivingLicense(file);
}
......@@ -123,4 +126,21 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
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
# 当上传文件达到1MB的时候进行磁盘写入
file-size-threshold: 20MB
# 设置最大的请求文件的大小
max-request-size: 50MB
# 设置单个文件的最大长度
max-file-size: 50MB
\ No newline at end of file
......@@ -14,7 +14,7 @@ public class CCPRestSmsUtils {
restAPI.init("app.cloopen.com", "8883");
restAPI.setAccount("8aaf070865e6b6eb0165ecd776700559",
"3fe5e2f053674f23b029a9a9fc9503f0");
restAPI.setAppId("8a216da86812593601684bec10581ab5");
restAPI.setAppId("8a216da86bfdbeb5016c0d2543670a06");
}
public static Map<String, Object> sendTemplateSMS(String phoneNumbers, String[] params, String templateId) {
......
......@@ -10,21 +10,21 @@ import org.springframework.stereotype.Service;
public class CCPRestSmsBiz{
//租车订单通知(普通用户)1
public static final String TEMPLATE_ID_ORDER = "457270";
public static final String TEMPLATE_ID_ORDER = "458626";
//租车订单短信(会员权益)2
public static final String TEMPLATE_ID_ORDER_MEMBER = "457271";
public static final String TEMPLATE_ID_ORDER_MEMBER = "458625";
//旅游订单短信3
public static final String TEMPLATE_ID_ORDER_TOUR = "457272";
public static final String TEMPLATE_ID_ORDER_TOUR = "458624";
//加入会员通知4
public static final String TEMPLATE_ID_MEMBER = "457273";
public static final String TEMPLATE_ID_MEMBER = "458623";
//租/还车公司相同(订单支付后立即发送给相关负责人)5
public static final String TEMPLATE_ID_TAAKE_CAR = "457501";
public static final String TEMPLATE_ID_TAAKE_CAR = "458622";
//租/还车公司不同(发给租车公司负责人,订单支付后发送)6
public static final String TEMPLATE_ID_DIFFERENT_TAAKE_CAR = "457502";
public static final String TEMPLATE_ID_DIFFERENT_TAAKE_CAR = "458621";
// 租/还车公司不同(发给还车公司负责人,订单出车后发))(相同不发)7
public static final String TEMPLATE_ID_ALSO_CAR = "457503";
public static final String TEMPLATE_ID_ALSO_CAR = "458620";
//取消订单8
public static final String TEMPLATE_ID_CANCEL = "457506";
public static final String TEMPLATE_ID_CANCEL = "458627";
//发送模板消息
......
......@@ -4,4 +4,14 @@ logging:
com.xxfc.platform.universal:
debug
com.xxfc.platform.common:
debug
\ No newline at end of file
debug
servlet:
multipart:
# 启用上传处理,默认是true
enabled: true
# 当上传文件达到1MB的时候进行磁盘写入
file-size-threshold: 20MB
# 设置最大的请求文件的大小
max-request-size: 50MB
# 设置单个文件的最大长度
max-file-size: 50MB
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment