Commit a3739ee8 authored by hanfeng's avatar hanfeng

Merge branch 'master_activity-hf' into base-modify

# Conflicts:
#	ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseUserMemberExportBiz.java
#	xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/DailyVehicleOrderStatistics.java
parents adfddf09 cf1d0e48
...@@ -58,4 +58,10 @@ public class WalletDetailListDTO { ...@@ -58,4 +58,10 @@ public class WalletDetailListDTO {
@ApiModelProperty(value = "操作时间", hidden = true ) @ApiModelProperty(value = "操作时间", hidden = true )
private Long crtTime; private Long crtTime;
@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "来源人")
private String sourceUserName;
} }
...@@ -83,6 +83,7 @@ public class AppUserDTO { ...@@ -83,6 +83,7 @@ public class AppUserDTO {
private String memberName; private String memberName;
//图标 //图标
private String icon; private String icon;
private String bigIcon;
private Integer memberNo; private Integer memberNo;
private Long cardLeave; private Long cardLeave;
private Integer isBind; private Integer isBind;
......
...@@ -49,6 +49,13 @@ public class WalletDetailAdminVo { ...@@ -49,6 +49,13 @@ public class WalletDetailAdminVo {
@ApiModelProperty(value = "操作时间", hidden = true ) @ApiModelProperty(value = "操作时间", hidden = true )
private Long crtTime; private Long crtTime;
@ApiModelProperty(value = "来源")
private String sourceName; private String sourceName;
@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "来源人")
private String sourceUserName;
} }
...@@ -281,7 +281,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> { ...@@ -281,7 +281,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
BigDecimal balnece=sumDto.getBalance(); BigDecimal balnece=sumDto.getBalance();
//到账金额 //到账金额
BigDecimal realAmount=amount; BigDecimal realAmount=amount;
if (amount.compareTo(realAmount)>0){ if ((realAmount.add(commission)).compareTo(balnece)>0){
realAmount=balnece.subtract(commission); realAmount=balnece.subtract(commission);
} }
log.info("-----提现申请-----proceduReates==="+sumDto.getProceduReates()+"----commission===="+commission+"---realAmount==="+realAmount); log.info("-----提现申请-----proceduReates==="+sumDto.getProceduReates()+"----commission===="+commission+"---realAmount==="+realAmount);
......
...@@ -153,6 +153,7 @@ public class AppUserController extends CommonBaseController{ ...@@ -153,6 +153,7 @@ public class AppUserController extends CommonBaseController{
if (memberLevel!=null){ if (memberLevel!=null){
String icon=memberLevel.getIcon(); String icon=memberLevel.getIcon();
userDTO.setIcon(icon); userDTO.setIcon(icon);
userDTO.setBigIcon(memberLevel.getBigIcon());
} }
} }
} }
......
...@@ -75,7 +75,8 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba ...@@ -75,7 +75,8 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
} }
@PutMapping("/update") @PutMapping("/update")
public void updateMemberBaseInfo(@RequestBody BaseUserMemberLevel baseUserMemberLevel){ public ObjectRestResponse<Void> updateMemberBaseInfo(@RequestBody BaseUserMemberLevel baseUserMemberLevel){
getBaseBiz().updateMemberBaseInfo(baseUserMemberLevel); getBaseBiz().updateMemberBaseInfo(baseUserMemberLevel);
return ObjectRestResponse.succ();
} }
} }
...@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.*; ...@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
......
...@@ -112,8 +112,7 @@ ...@@ -112,8 +112,7 @@
base_user_member_level ml base_user_member_level ml
on on
ml.level = b.member_level ml.level = b.member_level
where where ml.isdel = 0
ml.isdel=0
) m ) m
on on
l.id = m.user_id l.id = m.user_id
......
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
ausw.price, ausw.price,
ausw.extract, ausw.extract,
ausw.waiting, ausw.waiting,
ausw.title ausw.title,
ausw.order_no,
ausw.sourceUserName
FROM 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}
...@@ -29,7 +31,7 @@ FROM ...@@ -29,7 +31,7 @@ FROM
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
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,au.id,order_no,IFNULL(d.realname,d.nickname) AS `sourceUserName`,price,extract,waiting,title FROM `app_user_selling_water` AS `au` INNER JOIN `app_user_detail` AS `d` ON d.userid=au.source_id) AS `ausw` ON ausw.order_id = wd.cono
ORDER BY `crtTime` DESC ORDER BY `crtTime` DESC
</select> </select>
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
<if test=" userId!=null and userId!=''"> <if test=" userId!=null and userId!=''">
user_id=#{userId}, user_id=#{userId},
</if> </if>
<if test="balance!=null and balance!='' "> <if test="balance!=null ">
balance=#{balance}, balance=#{balance},
</if> </if>
<if test="balance!=null and balance!='' "> <if test="withdrawals!=null and withdrawals!='' ">
withdrawals=#{withdrawals}, withdrawals=#{withdrawals},
</if> </if>
<if test="totalAmount!=null and totalAmount!='' "> <if test="totalAmount!=null and totalAmount!='' ">
......
...@@ -11,6 +11,7 @@ import com.xxfc.platform.im.entity.CustomerService; ...@@ -11,6 +11,7 @@ import com.xxfc.platform.im.entity.CustomerService;
import com.xxfc.platform.im.mapper.CustomerServiceMapper; import com.xxfc.platform.im.mapper.CustomerServiceMapper;
import com.xxfc.platform.im.vo.CustomerServiceVO; import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -54,32 +55,32 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -54,32 +55,32 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
CustomerService customerService = new CustomerService(); CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO, customerService); BeanUtils.copyProperties(customerServiceDTO, customerService);
if (Objects.isNull(customerServiceDTO.getId())){ if (Objects.isNull(customerServiceDTO.getId())) {
customerService.setCreateTime(Instant.now().toEpochMilli()); customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone())); customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone()));
customerService.setIsDel(false); customerService.setIsDel(false);
customerService.setPassword(INIT_PASSWORD); customerService.setPassword(StringUtils.isEmpty(customerServiceDTO.getPassword()) ? INIT_PASSWORD : customerServiceDTO.getPassword().trim().length() > 0 ? customerServiceDTO.getPassword() : INIT_PASSWORD);
Map<String, Object> imMap = new HashMap<>(2); Map<String, Object> imMap = new HashMap<>(2);
imMap.put("telephone", customerServiceDTO.getTelphone()); imMap.put("telephone", customerServiceDTO.getTelphone());
imMap.put("password", INIT_PASSWORD); imMap.put("password", DigestUtils.md5Hex(customerService.getPassword()));
imMap.put("nickname", customerService.getName()); imMap.put("nickname", customerService.getName());
BaseResponse imResponse = userBiz.register(imMap); BaseResponse imResponse = userBiz.register(imMap);
String imResult = imResponse.getMessage(); String imResult = imResponse.getMessage();
JSONObject jsonObject = JSON.parseObject(imResult); JSONObject jsonObject = JSON.parseObject(imResult);
Map<String, Object> data = (Map<String, Object>) jsonObject.get("data"); Map<String, Object> data = (Map<String, Object>) jsonObject.get("data");
Object userId = data.get("userId"); Object userId = data.get("userId");
if (Objects.isNull(userId)) { if (Objects.isNull(userId)) {
throw new BaseException("注册失败"); throw new BaseException("注册失败");
} }
customerService.setImUserId((Integer) userId); customerService.setImUserId((Integer) userId);
mapper.insertSelective(customerService); mapper.insertSelective(customerService);
}else { } else {
customerService.setUpdateTime(Instant.now().toEpochMilli()); customerService.setUpdateTime(Instant.now().toEpochMilli());
if (!StringUtils.isEmpty(customerServiceDTO.getPassword())){ if (!StringUtils.isEmpty(customerServiceDTO.getPassword())) {
userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(),customerServiceDTO.getPassword()); userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(), customerServiceDTO.getPassword());
} }
mapper.updateByPrimaryKeySelective(customerService); mapper.updateByPrimaryKeySelective(customerService);
} }
} }
...@@ -121,24 +122,24 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -121,24 +122,24 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
public void updatePasswordByPhone(String telphone, String password) { public void updatePasswordByPhone(String telphone, String password) {
Example example = new Example(CustomerService.class); Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("telphone",telphone); criteria.andEqualTo("telphone", telphone);
CustomerService customerService = new CustomerService(); CustomerService customerService = new CustomerService();
customerService.setPassword(password); customerService.setPassword(DigestUtils.md5Hex(password));
customerService.setUpdateTime(Instant.now().toEpochMilli()); customerService.setUpdateTime(Instant.now().toEpochMilli());
mapper.updateByExampleSelective(customerService,example); mapper.updateByExampleSelective(customerService, example);
} }
public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) { public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) {
PageDataVO<CustomerServiceVO> dataVO = new PageDataVO<>(); PageDataVO<CustomerServiceVO> dataVO = new PageDataVO<>();
Example example = new Example(CustomerService.class); Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",false); criteria.andEqualTo("isDel", false);
PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page,limit,()->mapper.selectByExample(example)); PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page, limit, () -> mapper.selectByExample(example));
List<CustomerService> data = pageDataVO.getData(); List<CustomerService> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)){ if (CollectionUtils.isEmpty(data)) {
return dataVO; return dataVO;
} }
...@@ -146,22 +147,22 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -146,22 +147,22 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
CustomerServiceVO customerServiceVO; CustomerServiceVO customerServiceVO;
for (CustomerService customerService : data) { for (CustomerService customerService : data) {
customerServiceVO = new CustomerServiceVO(); customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService,customerServiceVO); BeanUtils.copyProperties(customerService, customerServiceVO);
customerServiceVOS.add(customerServiceVO); customerServiceVOS.add(customerServiceVO);
} }
dataVO.setPageSize(pageDataVO.getPageSize()); dataVO.setPageSize(pageDataVO.getPageSize());
dataVO.setPageNum(pageDataVO.getPageNum()); dataVO.setPageNum(pageDataVO.getPageNum());
dataVO.setTotalPage(pageDataVO.getTotalPage()); dataVO.setTotalPage(pageDataVO.getTotalPage());
dataVO.setTotalCount(pageDataVO.getTotalCount()); dataVO.setTotalCount(pageDataVO.getTotalCount());
dataVO.setData(customerServiceVOS); dataVO.setData(customerServiceVOS);
return dataVO; return dataVO;
} }
public CustomerServiceDTO findCustomerServiceById(Long id) { public CustomerServiceDTO findCustomerServiceById(Long id) {
CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO(); CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO();
CustomerService customerService = mapper.selectByPrimaryKey(id); CustomerService customerService = mapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(customerService,customerServiceDTO); BeanUtils.copyProperties(customerService, customerServiceDTO);
return customerServiceDTO; return customerServiceDTO;
} }
} }
package com.xxfc.platform.order.pojo; package com.xxfc.platform.order.pojo;
import lombok.Data; import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -11,7 +12,7 @@ public class HomePageOrderData { ...@@ -11,7 +12,7 @@ public class HomePageOrderData {
*/ */
private BigDecimal totalOrders; private BigDecimal totalOrders;
/** /**
* 退还押金总额 * 未退还退还押金总额
*/ */
private BigDecimal totalOutstandingDeposit; private BigDecimal totalOutstandingDeposit;
...@@ -20,4 +21,13 @@ public class HomePageOrderData { ...@@ -20,4 +21,13 @@ public class HomePageOrderData {
*/ */
private BigDecimal additionalIndemnity; private BigDecimal additionalIndemnity;
@Override
public String toString() {
return "HomePageOrderData{" +
"totalOrders=" + totalOrders +
", totalOutstandingDeposit=" + totalOutstandingDeposit +
", additionalIndemnity=" + additionalIndemnity +
'}';
}
} }
...@@ -47,4 +47,10 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail ...@@ -47,4 +47,10 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
* 创建用户 -1+后台用户id 后台系统 * 创建用户 -1+后台用户id 后台系统
*/ */
String crtUser; String crtUser;
/**
* 用途 1 租车
*/
@ApiModelProperty(hidden = true)
Integer useType = 1;
} }
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -8,12 +9,14 @@ import com.github.wxiaoqi.security.admin.dto.UserMemberDTO; ...@@ -8,12 +9,14 @@ import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
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.admin.feign.dto.UserDTO; import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.context.BaseContextHandler; import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.xxfc.platform.activity.feign.ActivityFeign; import com.xxfc.platform.activity.feign.ActivityFeign;
...@@ -39,6 +42,7 @@ import com.xxfc.platform.universal.feign.MQSenderFeign; ...@@ -39,6 +42,7 @@ import com.xxfc.platform.universal.feign.MQSenderFeign;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode; import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.BookRecordUpdateLog;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.Vehicle; import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense; import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
...@@ -53,12 +57,10 @@ import org.joda.time.format.DateTimeFormatter; ...@@ -53,12 +57,10 @@ import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*; import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
...@@ -72,7 +74,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER; ...@@ -72,7 +74,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
*/ */
@Service @Service
@Slf4j @Slf4j
public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements UserRestInterface {
@Autowired @Autowired
OrderMemberDetailBiz orderMemberDetailBiz; OrderMemberDetailBiz orderMemberDetailBiz;
...@@ -332,6 +334,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { ...@@ -332,6 +334,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> {
dedDetailDTO.setStatusName(detailName); dedDetailDTO.setStatusName(detailName);
} }
/**
* 获取驾驶人驾照
* @param orderPageVo
*/
public void getUserLicense(OrderPageVO orderPageVo) { public void getUserLicense(OrderPageVO orderPageVo) {
OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto(); OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto();
orderVehicleCrosstownDto.setOrderId(orderPageVo.getId()); orderVehicleCrosstownDto.setOrderId(orderPageVo.getId());
...@@ -360,6 +366,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { ...@@ -360,6 +366,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> {
orderPageVo.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto); orderPageVo.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto);
} }
/**
* 获取驾驶人信息
* @param orderPageVo
*/
public void getDriverInfo(OrderPageVO orderPageVo) { public void getDriverInfo(OrderPageVO orderPageVo) {
List<VehicleUserLicense> vehicleUserLicenses = Lists.newArrayList(); List<VehicleUserLicense> vehicleUserLicenses = Lists.newArrayList();
String myDriverIds = orderPageVo.getOrderRentVehicleDetail().getMyDriverIds(); String myDriverIds = orderPageVo.getOrderRentVehicleDetail().getMyDriverIds();
...@@ -387,7 +397,57 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { ...@@ -387,7 +397,57 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> {
orderPageVo.setVehicleUserLicenses(vehicleUserLicenses); orderPageVo.setVehicleUserLicenses(vehicleUserLicenses);
} }
public ObjectRestResponse save(OrderRentVehicleDetail orderRentVehicleDetail) {
if (orderRentVehicleDetail == null || orderRentVehicleDetail.getId() == null) {
return ObjectRestResponse.paramIsEmpty();
}
log.info("更新订单还车地点》》》 orderRentVehicleDetail = {}", orderRentVehicleDetail.toString());
UserDTO userDTO = getAdminUserInfo();
if (userDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
StringBuilder stringBuilder = new StringBuilder();
OrderRentVehicleDetail oldValue = orderRentVehicleBiz.selectById(orderRentVehicleDetail.getId());
if(oldValue == null) {
return ObjectRestResponse.createFailedResult(ResCode.ORDER_IS_NOT_EXIST.getCode(), ResCode.ORDER_IS_NOT_EXIST.getDesc());
}
stringBuilder.append("修改订单和预定记录还车公司成功, 订单ID:");
stringBuilder.append( oldValue.getOrderId());
stringBuilder.append("; 原还车公司ID: ");
stringBuilder.append(oldValue.getEndCompanyId());
stringBuilder.append("; 更新后还车公司ID: ");
stringBuilder.append(orderRentVehicleDetail.getEndCompanyId());
stringBuilder.append("; 操作人ID:");
stringBuilder.append(userDTO.getId());
stringBuilder.append("; 操作人账号:");
stringBuilder.append(userDTO.getUsername());
//添加修改记录实体
BookRecordUpdateLog bookRecordUpdateLog = new BookRecordUpdateLog();
bookRecordUpdateLog.setBookRecordId(oldValue.getBookRecordId());
bookRecordUpdateLog.setOldRetCompanyId(oldValue.getEndCompanyId());
bookRecordUpdateLog.setNewRetCompanyId(orderRentVehicleDetail.getEndCompanyId());
bookRecordUpdateLog.setOperaterId(userDTO.getId());
bookRecordUpdateLog.setOperaterName(userDTO.getName());
bookRecordUpdateLog.setOrderId(oldValue.getOrderId());
bookRecordUpdateLog.setCreateTime(new Date());
BeanUtil.copyProperties(orderRentVehicleDetail, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
oldValue.setEndCompanyId(orderRentVehicleDetail.getEndCompanyId());
orderRentVehicleBiz.updateSelectiveByIdRe(oldValue);
ObjectRestResponse objectRestResponse = vehicleFeign.update(bookRecordUpdateLog);
if (objectRestResponse!= null && objectRestResponse.getRel()) {
log.info(stringBuilder.toString());
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createFailedResult(1355, "修改失败!");
}
/**
* 获取订单详情,包含驾驶人信息,违约金等信息
* @param no
* @return
*/
public ObjectRestResponse<OrderPageVO> getOrderDetail(String no) { public ObjectRestResponse<OrderPageVO> getOrderDetail(String no) {
OrderPageVO orderPageVo = mapper.getOrderDetail(no); OrderPageVO orderPageVo = mapper.getOrderDetail(no);
if (orderPageVo == null) { if (orderPageVo == null) {
...@@ -641,6 +701,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { ...@@ -641,6 +701,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> {
return query; return query;
} }
@Override
public UserFeign getUserFeign() {
return userFeign;
}
/** /**
* 订单查询类 * 订单查询类
*/ */
......
...@@ -20,6 +20,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -20,6 +20,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -63,7 +65,16 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta ...@@ -63,7 +65,16 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
orderStatistics.setOneDay(accountList.get(0).getOneDay()); orderStatistics.setOneDay(accountList.get(0).getOneDay());
} }
log.info("Members:统计完成"); log.info("Members:统计完成");
if (JudgmentOfExistence(orderStatistics)) {
insertSelectiveRe(orderStatistics); insertSelectiveRe(orderStatistics);
} else {
mapper.updateByExampleSelective(orderStatistics, Example.builder(DailyMembersOrderStatistics.class)
.where(WeekendSqls.<DailyMembersOrderStatistics>custom()
.andEqualTo(DailyMembersOrderStatistics::getOneDay, orderStatistics.getOneDay())
.andEqualTo(DailyMembersOrderStatistics::getBranchCompanyId, orderStatistics.getBranchCompanyId()))
.build());
}
log.info("Members:保存成功"); log.info("Members:保存成功");
} }
...@@ -76,6 +87,22 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta ...@@ -76,6 +87,22 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
} }
} }
/**
* 添加前查询是否存在这条数据
* @param orderStatistic
* @return
*/
private boolean JudgmentOfExistence(DailyMembersOrderStatistics orderStatistic) {
List<DailyMembersOrderStatistics> statistics = selectByExample(Example.builder(DailyMembersOrderStatistics.class)
.where(WeekendSqls.<DailyMembersOrderStatistics>custom()
.andEqualTo(DailyMembersOrderStatistics::getOneDay, orderStatistic.getOneDay())
.andEqualTo(DailyMembersOrderStatistics::getBranchCompanyId, orderStatistic.getBranchCompanyId()))
.build());
if (CollectionUtils.isNotEmpty(statistics)) {
return false;
}
return true;
}
/** /**
* 获取押金和 * 获取押金和
* *
......
...@@ -25,7 +25,7 @@ public class DailyOrderStatisticsBiz extends BaseBiz<DailyOrderStatisticsMapper, ...@@ -25,7 +25,7 @@ public class DailyOrderStatisticsBiz extends BaseBiz<DailyOrderStatisticsMapper,
@Autowired @Autowired
private DailyMembersOrderStatisticsBiz membersStatisticsBiz; private DailyMembersOrderStatisticsBiz membersStatisticsBiz;
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 0/1 * * ?")
public boolean statisticalOrder(){ public boolean statisticalOrder(){
boolean vehicleFlag = vehicleStatisticsBiz.saveDailyVehicleOrderRecord(); boolean vehicleFlag = vehicleStatisticsBiz.saveDailyVehicleOrderRecord();
boolean travelFlag = travelStatisticsBiz.saveDailyTravelOrderRecord(); boolean travelFlag = travelStatisticsBiz.saveDailyTravelOrderRecord();
......
...@@ -7,12 +7,10 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -7,12 +7,10 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum; import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum; import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.entity.DailyTravelOrderStatistics;
import com.xxfc.platform.order.entity.OrderAccount;
import com.xxfc.platform.order.entity.OrderStatistics;
import com.xxfc.platform.order.mapper.DailyTravelOrderStatisticsMapper; import com.xxfc.platform.order.mapper.DailyTravelOrderStatisticsMapper;
import com.xxfc.platform.order.pojo.account.OrderAccountDTO; import com.xxfc.platform.order.pojo.account.OrderAccountDTO;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction; import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
...@@ -27,6 +25,7 @@ import org.springframework.stereotype.Service; ...@@ -27,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
...@@ -116,8 +115,17 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -116,8 +115,17 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
log.info("Travel:统计完成"); log.info("Travel:统计完成");
if (CollectionUtils.isNotEmpty(orderStatistics)) { if (CollectionUtils.isNotEmpty(orderStatistics)) {
for (DailyTravelOrderStatistics orderStatistic : orderStatistics) { for (DailyTravelOrderStatistics orderStatistic : orderStatistics) {
//保存统计 if (JudgmentOfExistence(orderStatistic)) {
insertSelectiveRe(orderStatistic);
insertSelectiveRe(orderStatistic);
} else {
mapper.updateByExampleSelective(orderStatistic, Example.builder(DailyTravelOrderStatistics.class)
.where(WeekendSqls.<DailyTravelOrderStatistics>custom()
.andEqualTo(DailyTravelOrderStatistics::getOneDay, orderStatistic.getOneDay())
.andEqualTo(DailyTravelOrderStatistics::getBranchCompanyId, orderStatistic.getBranchCompanyId()))
.build());
}
} }
} }
log.info("Travel:保存成功"); log.info("Travel:保存成功");
...@@ -129,6 +137,22 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -129,6 +137,22 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
} }
} }
/**
* 添加前查询是否存在这条数据
* @param orderStatistic
* @return
*/
private boolean JudgmentOfExistence(DailyTravelOrderStatistics orderStatistic) {
List<DailyTravelOrderStatistics> statistics = selectByExample(Example.builder(DailyTravelOrderStatistics.class)
.where(WeekendSqls.<DailyTravelOrderStatistics>custom()
.andEqualTo(DailyTravelOrderStatistics::getOneDay, orderStatistic.getOneDay())
.andEqualTo(DailyTravelOrderStatistics::getBranchCompanyId, orderStatistic.getBranchCompanyId()))
.build());
if (CollectionUtils.isNotEmpty(statistics)) {
return false;
}
return true;
}
private List<DailyTravelOrderStatistics> getDailyTravelOrderStatistics() { private List<DailyTravelOrderStatistics> getDailyTravelOrderStatistics() {
//获取当天所有订单账目 //获取当天所有订单账目
List<OrderAccountDTO> accountList = accountBiz.getOrderAccountByOrderType(OrderTypeEnum.TOUR.getCode(), day); List<OrderAccountDTO> accountList = accountBiz.getOrderAccountByOrderType(OrderTypeEnum.TOUR.getCode(), day);
...@@ -197,7 +221,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -197,7 +221,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyTravelOrderStatistics orderStatistics) { private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyTravelOrderStatistics orderStatistics) {
ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList(); ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList();
for (Integer key : map.keySet()) { for (Integer key : map.keySet()) {
if (!key.equals(RefundTypeEnum.ORDER_FUND.getCode())) { if (!key.equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) {
arrayList.addAll(map.get(key)); arrayList.addAll(map.get(key));
} }
} }
...@@ -210,10 +234,8 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -210,10 +234,8 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
add(DeductionTypeEnum.VIOLATE_CANCEL.getCode()); add(DeductionTypeEnum.VIOLATE_CANCEL.getCode());
}}); }});
orderStatistics.setDefaultMoney(bigDecimal); orderStatistics.setDefaultMoney(bigDecimal);
//订单退还总额 //订单退还总额
orderStatistics.setReturnGmv(orderStatistics.getGmv().subtract(bigDecimal)); orderStatistics.setReturnGmv(orderStatistics.getGmv().subtract(bigDecimal));
} }
} }
} }
...@@ -222,7 +244,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -222,7 +244,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
private DailyTravelOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) { private DailyTravelOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) {
DailyTravelOrderStatistics orderStatistics = new DailyTravelOrderStatistics(); DailyTravelOrderStatistics orderStatistics = new DailyTravelOrderStatistics();
List<OrderAccountDTO> orderAccountDTOS = map.get(RefundTypeEnum.ORDER_FUND.getCode()); List<OrderAccountDTO> orderAccountDTOS = map.get(AccountTypeEnum.IN_ORDER_PAY.getCode());
if (CollectionUtils.isNotEmpty(orderAccountDTOS)) { if (CollectionUtils.isNotEmpty(orderAccountDTOS)) {
ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS); ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS);
...@@ -276,9 +298,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -276,9 +298,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
*/ */
private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) { private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) {
ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList(); ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList();
for (OrderAccountDetail orderAccountDetail : orderAccountDetails) { orderAccountDetails.parallelStream().map(OrderAccountDetail::getDeductions).forEach(e->arrayList.addAll(e));
arrayList.addAll(orderAccountDetail.getDeductions());
}
return arrayList; return arrayList;
} }
...@@ -286,14 +306,14 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -286,14 +306,14 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
/** /**
* 根据type获取对应的金额总和 * 根据type获取对应的金额总和
* *
* @param OrderAccountDeduction * @param list
* @param type 金额类型 * @param type 金额类型
* @return * @return
*/ */
private BigDecimal get(List<OrderAccountDeduction> OrderAccountDeduction, List<Integer> type) { private BigDecimal get(List<OrderAccountDeduction> list, List<Integer> type) {
return OrderAccountDeduction.parallelStream() return list.parallelStream()
.filter(el -> el.getType().equals(type)) .filter(el ->type.contains(el.getType()))
.map(com.xxfc.platform.order.pojo.account.OrderAccountDeduction::getAmount) .map(OrderAccountDeduction::getAmount)
.reduce(BigDecimal.ZERO,BigDecimal::add); .reduce(BigDecimal.ZERO,BigDecimal::add);
} }
......
...@@ -4,9 +4,10 @@ import cn.hutool.json.JSONUtil; ...@@ -4,9 +4,10 @@ import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum; import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum; import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum; import com.xxfc.platform.order.entity.DailyOrderStatistics;
import com.xxfc.platform.order.entity.DailyVehicleOrderStatistics; import com.xxfc.platform.order.entity.DailyVehicleOrderStatistics;
import com.xxfc.platform.order.entity.OrderAccount; import com.xxfc.platform.order.entity.OrderAccount;
import com.xxfc.platform.order.entity.OrderStatistics; import com.xxfc.platform.order.entity.OrderStatistics;
...@@ -23,6 +24,9 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -23,6 +24,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.common.example.UpdateByExampleSelectiveMapper;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
...@@ -208,15 +212,15 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -208,15 +212,15 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
/** /**
* 根据type获取对应的金额总和 * 根据type获取对应的金额总和
* *
* @param OrderAccountDeduction * @param list
* @param types 金额类型 * @param types 金额类型
* @return * @return
*/ */
private BigDecimal get(List<OrderAccountDeduction> OrderAccountDeduction, List<Integer> types) { private BigDecimal get(List<OrderAccountDeduction> list, List<Integer> types) {
return OrderAccountDeduction.parallelStream() return list.parallelStream()
.filter(el -> types.contains(el)) .filter(el -> types.contains(el.getType()))
.map(com.xxfc.platform.order.pojo.account.OrderAccountDeduction::getAmount) .map(OrderAccountDeduction::getAmount)
.reduce(BigDecimal.ZERO,BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
} }
...@@ -238,11 +242,11 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -238,11 +242,11 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
/** /**
* 统计订单并保存到数据库当中 * 统计订单并保存到数据库当中
*
* @return * @return
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean saveDailyVehicleOrderRecord() { public boolean saveDailyVehicleOrderRecord() {
try { try {
//获取每日订单统计 //获取每日订单统计
List<DailyVehicleOrderStatistics> orderStatistics = getDailyVehicleOrderRecord(); List<DailyVehicleOrderStatistics> orderStatistics = getDailyVehicleOrderRecord();
...@@ -250,20 +254,43 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -250,20 +254,43 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
if (CollectionUtils.isNotEmpty(orderStatistics)) { if (CollectionUtils.isNotEmpty(orderStatistics)) {
for (DailyVehicleOrderStatistics orderStatistic : orderStatistics) { for (DailyVehicleOrderStatistics orderStatistic : orderStatistics) {
//保存统计 //保存统计
insertSelectiveRe(orderStatistic); if (JudgmentOfExistence(orderStatistic)) {
insertSelectiveRe(orderStatistic);
} else {
mapper.updateByExampleSelective(orderStatistic, Example.builder(DailyVehicleOrderStatistics.class)
.where(WeekendSqls.<DailyVehicleOrderStatistics>custom()
.andEqualTo(DailyVehicleOrderStatistics::getOneDay, orderStatistic.getOneDay())
.andEqualTo(DailyVehicleOrderStatistics::getBranchCompanyId, orderStatistic.getBranchCompanyId()))
.build());
}
} }
} }
log.info("Vehicle:保存成功"); log.info("Vehicle:保存成功");
return true; return true;
} catch (Exception e) { } catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
log.error("Vehicle:"+e.getMessage()); log.error("Vehicle:" + e.getMessage());
return false;
}
}
private boolean JudgmentOfExistence(DailyVehicleOrderStatistics orderStatistic) {
List<DailyVehicleOrderStatistics> statistics = selectByExample(Example.builder(DailyVehicleOrderStatistics.class)
.where(WeekendSqls.<DailyVehicleOrderStatistics>custom()
.andEqualTo(DailyVehicleOrderStatistics::getOneDay, orderStatistic.getOneDay())
.andEqualTo(DailyVehicleOrderStatistics::getBranchCompanyId, orderStatistic.getBranchCompanyId()))
.build());
if (CollectionUtils.isNotEmpty(statistics)) {
return false; return false;
} }
return true;
} }
/** /**
* 获取所有分公司每日统计记录 * 获取所有分公司每日统计记录
*
* @return * @return
*/ */
private List<DailyVehicleOrderStatistics> getDailyVehicleOrderRecord() { private List<DailyVehicleOrderStatistics> getDailyVehicleOrderRecord() {
...@@ -321,6 +348,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -321,6 +348,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
/** /**
* 获取该分公司的统计数据 * 获取该分公司的统计数据
*
* @param map * @param map
* @return * @return
*/ */
...@@ -342,7 +370,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -342,7 +370,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyVehicleOrderStatistics orderStatistics) { private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyVehicleOrderStatistics orderStatistics) {
ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList(); ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList();
for (Integer key : map.keySet()) { for (Integer key : map.keySet()) {
if (!key.equals(RefundTypeEnum.ORDER_FUND.getCode())) { if (!key.equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) {
arrayList.addAll(map.get(key)); arrayList.addAll(map.get(key));
} }
} }
...@@ -357,22 +385,22 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -357,22 +385,22 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
orderStatistics.setRefundSecurityDeposit(refundSecurityDeposit); orderStatistics.setRefundSecurityDeposit(refundSecurityDeposit);
List<OrderAccountDeduction> OrderAccountDeductions = gettDeductions(orderAccountDetail); List<OrderAccountDeduction> OrderAccountDeductions = gettDeductions(orderAccountDetail);
//获取违章总额 //获取违章总额
orderStatistics.setViolationMoney(get(OrderAccountDeductions, new ArrayList<Integer>(){{ orderStatistics.setViolationMoney(get(OrderAccountDeductions, new ArrayList<Integer>() {{
add(DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getCode()); add(DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getCode());
}})); }}));
//获取损坏赔偿总额 //获取损坏赔偿总额
orderStatistics.setCompensation(get(OrderAccountDeductions,new ArrayList<Integer>(){{ orderStatistics.setCompensation(get(OrderAccountDeductions, new ArrayList<Integer>() {{
add(DeductionTypeEnum.DAMAGES.getCode()); add(DeductionTypeEnum.DAMAGES.getCode());
}} )); }}));
//获取违约总额 //获取违约总额
ArrayList<Integer> types = Lists.newArrayList(); ArrayList<Integer> types = Lists.newArrayList();
types.add(DeductionTypeEnum.VIOLATE_ADVANCE.getCode()); types.add(DeductionTypeEnum.VIOLATE_ADVANCE.getCode());
types.add(DeductionTypeEnum.VIOLATE_CANCEL.getCode()); types.add(DeductionTypeEnum.VIOLATE_CANCEL.getCode());
types.add(DeductionTypeEnum.VIOLATE_DELAY.getCode()); types.add(DeductionTypeEnum.VIOLATE_DELAY.getCode());
orderStatistics.setDefaultMoney(get(OrderAccountDeductions,types)); orderStatistics.setDefaultMoney(get(OrderAccountDeductions, types));
//消费金额 //消费金额
orderStatistics.setTotalExpenditure(get(OrderAccountDeductions,new ArrayList<Integer>(){{ orderStatistics.setTotalExpenditure(get(OrderAccountDeductions, new ArrayList<Integer>() {{
add(DeductionTypeEnum.CONSUME.getCode()); add(DeductionTypeEnum.CONSUME.getCode());
}})); }}));
} }
...@@ -387,7 +415,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -387,7 +415,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
*/ */
private DailyVehicleOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) { private DailyVehicleOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) {
DailyVehicleOrderStatistics orderStatistics = new DailyVehicleOrderStatistics(); DailyVehicleOrderStatistics orderStatistics = new DailyVehicleOrderStatistics();
List<OrderAccountDTO> orderAccountDTOS = map.get(RefundTypeEnum.ORDER_FUND.getCode()); List<OrderAccountDTO> orderAccountDTOS = map.get(AccountTypeEnum.IN_ORDER_PAY.getCode());
if (CollectionUtils.isNotEmpty(orderAccountDTOS)) { if (CollectionUtils.isNotEmpty(orderAccountDTOS)) {
ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS); ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS);
...@@ -437,9 +465,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -437,9 +465,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
*/ */
private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) { private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) {
ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList(); ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList();
for (OrderAccountDetail orderAccountDetail : orderAccountDetails) { orderAccountDetails.parallelStream().map(OrderAccountDetail::getDeductions).forEach(e -> arrayList.addAll(e));
arrayList.addAll(orderAccountDetail.getDeductions());
}
return arrayList; return arrayList;
} }
......
...@@ -384,6 +384,12 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -384,6 +384,12 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString(); String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString();
refundDesc += handleDedRefundDesc; refundDesc += handleDedRefundDesc;
refundDesc += ")"; refundDesc += ")";
//还车扣除款 剩余的 钱,再减去违章预备金
oad.getDeductions().add(
initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, OrderAccountDeduction.ORIGIN_DEPOSIT)
);
refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), AccountTypeEnum.OUT_PART_DEPOSIT, oad); refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), AccountTypeEnum.OUT_PART_DEPOSIT, oad);
//修改押金退还记录状态 //修改押金退还记录状态
...@@ -417,11 +423,6 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -417,11 +423,6 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
updateBaseOrder.setExtraAmount(inProgressVO.getExtraAmount()); updateBaseOrder.setExtraAmount(inProgressVO.getExtraAmount());
baseOrderBiz.updateSelectiveByIdReT(updateBaseOrder, Boolean.TRUE); baseOrderBiz.updateSelectiveByIdReT(updateBaseOrder, Boolean.TRUE);
//还车扣除款 剩余的 钱,再减去违章预备金
oad.getDeductions().add(
initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, OrderAccountDeduction.ORIGIN_DEPOSIT)
);
//生成额外的费用明细 //生成额外的费用明细
csv.setConsumeAmount(inProgressVO.getConsumeAmount()); csv.setConsumeAmount(inProgressVO.getConsumeAmount());
csv.setModelAmount(orderItem.getUnitPrice()); csv.setModelAmount(orderItem.getUnitPrice());
......
...@@ -53,8 +53,10 @@ public class OrderStatisticsBiz extends BaseBiz<OrderStatisticsMapper, OrderStat ...@@ -53,8 +53,10 @@ public class OrderStatisticsBiz extends BaseBiz<OrderStatisticsMapper, OrderStat
setAdditionalIndemnity(vehicle.getTotalCompensation() setAdditionalIndemnity(vehicle.getTotalCompensation()
.add(vehicle.getTotalForfeit()) .add(vehicle.getTotalForfeit())
.add(vehicle.getTotalDefaultMoney()) .add(vehicle.getTotalDefaultMoney())
.add(vehicle.getTotalExpenditure().subtract(vehicle.getTotalGmv()).add(vehicle.getTotalReturnGmv())) .add(vehicle.getTotalExpenditure().subtract(vehicle.getTotalGmv()).add(vehicle.getTotalReturnGmv())));
); setTotalOutstandingDeposit(vehicle.getTotalSecurityDeposit()
.subtract(vehicle.getTotalRefundSecurityDeposit())
.subtract(getAdditionalIndemnity()));
}}; }};
orderStatistics.add(data); orderStatistics.add(data);
} }
...@@ -66,12 +68,13 @@ public class OrderStatisticsBiz extends BaseBiz<OrderStatisticsMapper, OrderStat ...@@ -66,12 +68,13 @@ public class OrderStatisticsBiz extends BaseBiz<OrderStatisticsMapper, OrderStat
setAdditionalIndemnity(tour.getTotalDefaultMoney()); setAdditionalIndemnity(tour.getTotalDefaultMoney());
}}; }};
orderStatistics.add(data); orderStatistics.add(data);
} }
OrderStatistics member = membersBiz.findAll(companyId); OrderStatistics member = membersBiz.findAll(companyId);
if (vehicle != null) { if (vehicle != null) {
HomePageOrderData data = new HomePageOrderData() {{ HomePageOrderData data = new HomePageOrderData() {{
setTotalOrders(member.getTotalGmv()); setTotalOrders(member.getTotalGmv());
}}; }};
orderStatistics.add(data); orderStatistics.add(data);
} }
......
...@@ -172,7 +172,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -172,7 +172,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
OrderRentVehicleDetail orderRentVehicleDetail = orderRentVehicleBiz.selectById(baseOrder.getDetailId()); OrderRentVehicleDetail orderRentVehicleDetail = orderRentVehicleBiz.selectById(baseOrder.getDetailId());
if (orderVehicleCrosstownDto.getType() == CrosstownTypeEnum.DEPARTURE.getCode()) { if (orderVehicleCrosstownDto.getType() == CrosstownTypeEnum.DEPARTURE.getCode()) {
boolean flag = getTodayTime(orderRentVehicleDetail.getEndTime()); boolean flag = getTodayTime(orderRentVehicleDetail.getStartTime());
if (!flag) { if (!flag) {
return ObjectRestResponse.createFailedResult(3502, "今日不是交车日期"); return ObjectRestResponse.createFailedResult(3502, "今日不是交车日期");
} }
...@@ -433,9 +433,16 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -433,9 +433,16 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
public boolean getTodayTime(Long time) { public boolean getTodayTime(Long time) {
long current = System.currentTimeMillis(); long current = System.currentTimeMillis();
if (current <= (time / (1000 * 3600 * 24) * (1000 * 3600 * 24) - TimeZone.getDefault().getRawOffset()) + 24 * 60 * 60 * 1000 - 1) { if (current <= (getDayStart(time) + 24 * 60 * 60 * 1000 - 1) && current >= getDayStart(time)) {
return true; return true;
} }
return false; return false;
} }
public static Long getDayStart(Long time) {
long current = time;
long zero = current / (1000 * 3600 * 24) * (1000 * 3600 * 24) - TimeZone.getDefault().getRawOffset();
return zero;
}
} }
package com.xxfc.platform.order.biz.inner; package com.xxfc.platform.order.biz.inner;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
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.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
...@@ -10,11 +12,10 @@ import com.xxfc.platform.app.entity.Cofig; ...@@ -10,11 +12,10 @@ import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.feign.ConfigFeign; import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.order.biz.OrderAccountBiz; import com.xxfc.platform.order.biz.OrderAccountBiz;
import com.xxfc.platform.order.biz.OrderRefundBiz; import com.xxfc.platform.order.biz.OrderRefundBiz;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum; import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundStatusEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.universal.constant.DictionaryKey; import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.dto.SmsTemplateDTO; import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.entity.Dictionary; import com.xxfc.platform.universal.entity.Dictionary;
...@@ -425,9 +426,24 @@ public class OrderMsgBiz { ...@@ -425,9 +426,24 @@ public class OrderMsgBiz {
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
setAccountType(AccountTypeEnum.OUT_PART_DEPOSIT.getCode()); setAccountType(AccountTypeEnum.OUT_PART_DEPOSIT.getCode());
}}); }});
originalAmount = orvd.getDeposit();
violateAmount = orderAccount.getDeductAmount(); OrderAccountDetail oad = JSONUtil.toBean(orderAccount.getAccountDetail(), OrderAccountDetail.class);
//BeanUtil.toBean(orderAccount.getAccountDetail(), OrderAccountDetail.class);
OrderAccountDeduction trafficDeduction = new OrderAccountDeduction() {{
setAmount(BigDecimal.ZERO);
}};
//违章保证金
for(OrderAccountDeduction deductionTemp : oad.getDeductions()) {
if(deductionTemp.getType().equals(DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP.getCode())) {
trafficDeduction = deductionTemp;
}
}
//(原押金 - 违章保证金 )+ 订单退款金额
originalAmount = oad.getOriginDepositAmount().subtract(trafficDeduction.getAmount()).add(oad.getOrderAmount());
//退款金额
refundAmount = orderAccount.getAccountAmount(); refundAmount = orderAccount.getAccountAmount();
// 扣款 = originalAmount - refundAmount
violateAmount = originalAmount.subtract(refundAmount);
residueAmount = orvd.getReturnPayResidue(); residueAmount = orvd.getReturnPayResidue();
}else if(RefundStatusEnum.REFUND_DEPOSIT.getCode().equals(baseOrder.getRefundStatus())){ }else if(RefundStatusEnum.REFUND_DEPOSIT.getCode().equals(baseOrder.getRefundStatus())){
smstype = SmsTemplateDTO.REFUND_B; smstype = SmsTemplateDTO.REFUND_B;
......
...@@ -359,6 +359,13 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -359,6 +359,13 @@ public class BackStageOrderController extends CommonBaseController implements Us
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@PostMapping("/updateEndCompany")
@ResponseBody
public ObjectRestResponse updateEndCompany(@RequestBody OrderRentVehicleDetail orderRentVehicleDetail) {
return baseOrderBiz.save(orderRentVehicleDetail);
}
@Data @Data
public static class ChangeVehicleDTO { public static class ChangeVehicleDTO {
String no; String no;
......
...@@ -74,6 +74,8 @@ public class OrderRentVehicleController extends CommonBaseController { ...@@ -74,6 +74,8 @@ public class OrderRentVehicleController extends CommonBaseController {
bo.setAppUserDTO(userFeign.userDetailById(dto.getAppUserId()).getData()); bo.setAppUserDTO(userFeign.userDetailById(dto.getAppUserId()).getData());
bo.setCrtUser("-1"+ BaseContextHandler.getUserID()); bo.setCrtUser("-1"+ BaseContextHandler.getUserID());
//设置-1表示查询所有的车
bo.setUseType(-1);
orderRentVehicleService.createOrder(bo); orderRentVehicleService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder()); return ObjectRestResponse.succ(bo.getOrder());
} }
......
...@@ -110,6 +110,7 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz ...@@ -110,6 +110,7 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
companyId = null; companyId = null;
} }
//只统计租车订单
if (TYPE_VEHICLE.equals(type)) { if (TYPE_VEHICLE.equals(type)) {
OrderStatistics vehicle = vehicleBiz.findAll(companyId); OrderStatistics vehicle = vehicleBiz.findAll(companyId);
return ObjectRestResponse.succ(new HomePageOrderData() {{ return ObjectRestResponse.succ(new HomePageOrderData() {{
...@@ -119,15 +120,21 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz ...@@ -119,15 +120,21 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
.add(vehicle.getTotalDefaultMoney()) .add(vehicle.getTotalDefaultMoney())
.add(vehicle.getTotalExpenditure().subtract(vehicle.getTotalGmv().subtract(vehicle.getTotalReturnGmv()))) .add(vehicle.getTotalExpenditure().subtract(vehicle.getTotalGmv().subtract(vehicle.getTotalReturnGmv())))
); );
setTotalOutstandingDeposit(vehicle.getTotalSecurityDeposit()
.subtract(vehicle.getTotalRefundSecurityDeposit())
.subtract(getAdditionalIndemnity()));
}}); }});
} }
//只统计会租车订单
if (TYPE_TOUR.equals(type)) { if (TYPE_TOUR.equals(type)) {
OrderStatistics tour = TravelBiz.findAll(companyId); OrderStatistics tour = TravelBiz.findAll(companyId);
return ObjectRestResponse.succ(new HomePageOrderData() {{ return ObjectRestResponse.succ(new HomePageOrderData() {{
setTotalOrders(tour.getTotalGmv().subtract(tour.getTotalReturnGmv())); setTotalOrders(tour.getTotalGmv().subtract(tour.getTotalReturnGmv()));
setAdditionalIndemnity(tour.getTotalDefaultMoney()); setAdditionalIndemnity(tour.getTotalDefaultMoney());
}}); }});
} }
//只统计会员定案
if (TYPE_MEMBER.equals(type)) { if (TYPE_MEMBER.equals(type)) {
OrderStatistics member = membersBiz.findAll(companyId); OrderStatistics member = membersBiz.findAll(companyId);
return ObjectRestResponse.succ(new HomePageOrderData() {{ return ObjectRestResponse.succ(new HomePageOrderData() {{
...@@ -136,6 +143,7 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz ...@@ -136,6 +143,7 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
}}); }});
} }
//所有订单
if (TYPE_TOTAL.equals(type)) { if (TYPE_TOTAL.equals(type)) {
return ObjectRestResponse.succ(baseBiz.getTotalOrder(companyId)); return ObjectRestResponse.succ(baseBiz.getTotalOrder(companyId));
} }
...@@ -167,7 +175,7 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz ...@@ -167,7 +175,7 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
List<BaseUserMemberLevel> memberLevels = userFeign.levels(); List<BaseUserMemberLevel> memberLevels = userFeign.levels();
List<MembersOrderDto> list = baseBiz.getMemberOrderStatistics(memberLevels, query); List<MembersOrderDto> list = baseBiz.getMemberOrderStatistics(memberLevels, query);
List<HashMap<Object, Object>> rows =baseBiz.getRows(list,memberLevels); List<HashMap<Object, Object>> rows = baseBiz.getRows(list, memberLevels);
// 一次性写出内容,使用默认样式,强制输出标题 // 一次性写出内容,使用默认样式,强制输出标题
writer.write(rows, true); writer.write(rows, true);
......
...@@ -459,6 +459,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -459,6 +459,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rentVehicleBookDTO.setOrderNo(detail.getOrder().getNo()); rentVehicleBookDTO.setOrderNo(detail.getOrder().getNo());
rentVehicleBookDTO.setNumberPlate(numberPlate); rentVehicleBookDTO.setNumberPlate(numberPlate);
rentVehicleBookDTO.setStatus(status); rentVehicleBookDTO.setStatus(status);
rentVehicleBookDTO.setUseType(detail.getUseType());
if(null != detail.getAccompanyItems()) { if(null != detail.getAccompanyItems()) {
rentVehicleBookDTO.setSelectedAccItem(detail.getAccompanyItems().parallelStream().collect(Collectors.toMap(OrderAccompanyDTO::getId, OrderAccompanyDTO::getNum))); rentVehicleBookDTO.setSelectedAccItem(detail.getAccompanyItems().parallelStream().collect(Collectors.toMap(OrderAccompanyDTO::getId, OrderAccompanyDTO::getNum)));
} }
......
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.OrderApplication; import com.xxfc.platform.order.OrderApplication;
import com.xxfc.platform.order.biz.DailyOrderStatisticsBiz; import com.xxfc.platform.order.biz.DailyOrderStatisticsBiz;
import com.xxfc.platform.order.biz.OrderStatisticsBiz;
import com.xxfc.platform.order.pojo.HomePageOrderData;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -19,6 +26,9 @@ public class ServiceTest { ...@@ -19,6 +26,9 @@ public class ServiceTest {
@Autowired @Autowired
private DailyOrderStatisticsBiz dailyOrderStatisticsBiz; private DailyOrderStatisticsBiz dailyOrderStatisticsBiz;
@Autowired
private OrderStatisticsBiz statisticsBiz;
@Test @Test
public void testSchedu(){ public void testSchedu(){
...@@ -26,4 +36,10 @@ public class ServiceTest { ...@@ -26,4 +36,10 @@ public class ServiceTest {
dailyOrderStatisticsBiz.statisticalOrder(); dailyOrderStatisticsBiz.statisticalOrder();
} }
@Test
public void test(){
HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null);
System.out.println(totalOrder);
}
} }
...@@ -99,15 +99,9 @@ public class ActivityBiz extends BaseBiz<ActivityMapper, Activity> { ...@@ -99,15 +99,9 @@ public class ActivityBiz extends BaseBiz<ActivityMapper, Activity> {
try { try {
activity.setCrtTime(System.currentTimeMillis()); activity.setCrtTime(System.currentTimeMillis());
activity.setIsDel(0); activity.setIsDel(0);
if (activity.getIsOpenBm() == null) {
activity.setIsOpenBm(0);
}
if (activity.getIsPublish() == null) { if (activity.getIsPublish() == null) {
activity.setIsPublish(0); activity.setIsPublish(0);
} }
if (activity.getIsShow() == null) {
activity.setIsShow(0);
}
mapper.insertSelective(activity); mapper.insertSelective(activity);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -288,4 +288,23 @@ public class ActivityBmBiz extends BaseBiz<ActivityBmMapper, ActivityBm> { ...@@ -288,4 +288,23 @@ public class ActivityBmBiz extends BaseBiz<ActivityBmMapper, ActivityBm> {
return ObjectRestResponse.succ(subscribe); return ObjectRestResponse.succ(subscribe);
} }
//获取用户信息
public ObjectRestResponse getUserInfo(Integer parentId,HttpServletRequest request){
JSONObject obj =new JSONObject();
obj.put("pId",0);
obj.put("name","");
User user=userBiz.getSession(request);
if (user!=null){
obj.put("pId",user.getId());
obj.put("name",user.getNickName());
}
if (parentId!=null&&parentId>0){
user=userBiz.selectById(parentId);
if (user!=null){
obj.put("name",user.getNickName());
}
}
return ObjectRestResponse.succ(obj);
}
} }
...@@ -97,7 +97,7 @@ public class UserBiz extends BaseBiz<UserMapper, User> { ...@@ -97,7 +97,7 @@ public class UserBiz extends BaseBiz<UserMapper, User> {
log.info("----code为空---"); log.info("----code为空---");
throw new BaseException(ResultCode.FAILED_CODE, Sets.newSet("code为空")); throw new BaseException(ResultCode.FAILED_CODE, Sets.newSet("code为空"));
} }
String openid = "oXDd91N8Rwijd3gscAND9TO77a2I"; String openid = "oXDd91MppH9i5F7xzPwigiMj--5w";
/*String access_token = null; /*String access_token = null;
try { try {
JSONObject jsonData = weixinService.getAccessToken(code); JSONObject jsonData = weixinService.getAccessToken(code);
...@@ -138,7 +138,7 @@ public class UserBiz extends BaseBiz<UserMapper, User> { ...@@ -138,7 +138,7 @@ public class UserBiz extends BaseBiz<UserMapper, User> {
throw new BaseException(ResultCode.FAILED_CODE, Sets.newSet("redis的报名信息activityId---为空")); throw new BaseException(ResultCode.FAILED_CODE, Sets.newSet("redis的报名信息activityId---为空"));
} }
User userInfo=new User(); User userInfo=new User();
String nickName = "小雨";//userinfo_json.getString("nickname"); String nickName = "苹果呀";//userinfo_json.getString("nickname");
String headimgurl = "http://thirdwx.qlogo.cn/mmopen/4eFHvhmOX6XuiaG6ib7wxkLa8AwMLFIbW9BSJ7EmwC3kRMUdgCrobdRUbhjMXbkY7aBc2CazjXFJiap5ianMH6yQnH2UQ4TfkXJw/132";//userinfo_json.getString("headimgurl"); String headimgurl = "http://thirdwx.qlogo.cn/mmopen/4eFHvhmOX6XuiaG6ib7wxkLa8AwMLFIbW9BSJ7EmwC3kRMUdgCrobdRUbhjMXbkY7aBc2CazjXFJiap5ianMH6yQnH2UQ4TfkXJw/132";//userinfo_json.getString("headimgurl");
String sex ="2"; //userinfo_json.getString("sex"); String sex ="2"; //userinfo_json.getString("sex");
if (StringUtils.isBlank(sex)){ if (StringUtils.isBlank(sex)){
...@@ -209,4 +209,6 @@ public class UserBiz extends BaseBiz<UserMapper, User> { ...@@ -209,4 +209,6 @@ public class UserBiz extends BaseBiz<UserMapper, User> {
} }
...@@ -61,5 +61,10 @@ public class AuthActivityController extends BaseController<ActivityBmBiz,Activit ...@@ -61,5 +61,10 @@ public class AuthActivityController extends BaseController<ActivityBmBiz,Activit
return activityBmBiz.checkSubscribe(request); return activityBmBiz.checkSubscribe(request);
} }
@GetMapping("app/unauth/userInfo")
public ObjectRestResponse userInfo(Integer pId,HttpServletRequest request){
return activityBmBiz.getUserInfo(pId,request);
}
} }
...@@ -42,23 +42,24 @@ public class WeixinController { ...@@ -42,23 +42,24 @@ public class WeixinController {
@Value("${wx.url}") @Value("${wx.url}")
private String url; private String url;
;
@RequestMapping(value ="/app/unauth/wxLogin",method = RequestMethod.GET) @RequestMapping(value ="/app/unauth/wxLogin",method = RequestMethod.GET)
@IgnoreUserToken @IgnoreUserToken
public String index(@RequestParam(value = "redirec_url",defaultValue = "")String redirec_url, public String wxLogin(@RequestParam(value = "callback",defaultValue = "")String redirec_url){
@RequestParam(value = "key",defaultValue = "")String key){ if (StringUtils.isBlank(redirec_url)){
log.info("-----微信wxLogin---redirec_url=="+redirec_url+"-----key===="+key);
if (StringUtils.isBlank(redirec_url)||StringUtils.isBlank(key)){
redirec_url=""; redirec_url="";
} }
log.info("-----微信wxLogin---redirec_url=="+redirec_url);
try { try {
String encrypt_curr_url = Base64.encode(redirec_url.getBytes("utf-8")); String encrypt_curr_url = Base64.encode(redirec_url.getBytes("utf-8"));
encrypt_curr_url+=","+key;
redirec_url=url+"?" + WECHAT_AUTOLOGIN_CALLBACKURL_KEY+ "=" + encrypt_curr_url; redirec_url=url+"?" + WECHAT_AUTOLOGIN_CALLBACKURL_KEY+ "=" + encrypt_curr_url;
String oauth_api=weixinService.getAuthorize(redirec_url); String oauth_api=redirec_url+"&code=111";//weixinService.getAuthorize(redirec_url);
return String.format("redirect:"+oauth_api); log.info("-----微信wxLogin---oauth_api=="+redirec_url);
return String.format("redirect:"+oauth_api);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
log.info("网络异常===" + e.getMessage()); log.info("网络异常===" + e.getMessage());
...@@ -76,6 +77,8 @@ public class WeixinController { ...@@ -76,6 +77,8 @@ public class WeixinController {
public String getUserInformation(String code, String callback, HttpServletRequest request) { public String getUserInformation(String code, String callback, HttpServletRequest request) {
log.info("-----微信回调userInfo---code=="+code+"----redirec_url==="+callback); log.info("-----微信回调userInfo---code=="+code+"----redirec_url==="+callback);
try { try {
callback =new String(Base64.decode(callback), "utf-8");
log.info("-----微信回调----callback==="+callback);
String [] params=callback.split(","); String [] params=callback.split(",");
String key=null; String key=null;
if (params.length>1){ if (params.length>1){
...@@ -84,16 +87,20 @@ public class WeixinController { ...@@ -84,16 +87,20 @@ public class WeixinController {
} }
params=callback.split("_"); params=callback.split("_");
Integer activityId=0; Integer activityId=0;
String auto=null;
if (params.length>1){ if (params.length>1){
callback=params[0]; callback=params[0];
activityId=Integer.parseInt(params[1]); activityId=Integer.parseInt(params[1]);
auto="1";
} }
log.info("-----微信回调userInfo---key=="+key+"----activityId==="+activityId+"----callback==="+callback); log.info("-----微信回调userInfo---key=="+key+"----activityId==="+activityId+"----callback==="+callback);
userBiz.authUser(code,key,activityId,request); userBiz.authUser(code,key,activityId,request);
//callback =new String(Base64.decode(callback), "utf-8");
if (StringUtils.isNotBlank(key)){ if (StringUtils.isNotBlank(key)){
callback+="&key="+key; callback+="&key="+key;
} }
if (StringUtils.isNotBlank(auto)&&callback.contains("summitDetail.html")){
callback+="&a=1";
}
log.info("callback===" + callback); log.info("callback===" + callback);
return String.format("redirect:"+callback); return String.format("redirect:"+callback);
}catch (Exception e){ }catch (Exception e){
......
...@@ -70,6 +70,7 @@ public class WeixinService { ...@@ -70,6 +70,7 @@ public class WeixinService {
public JSONObject getBaseUserInfo(String openid){ public JSONObject getBaseUserInfo(String openid){
String url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + tokenService.getAccessTokenStr() + "&openid=" + openid + "&lang=zh_CN"; String url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + tokenService.getAccessTokenStr() + "&openid=" + openid + "&lang=zh_CN";
String result = HttpRequestUtil.httpGet(url); String result = HttpRequestUtil.httpGet(url);
log.info("---result===="+result);
JSONObject data = JSON.parseObject(result); JSONObject data = JSON.parseObject(result);
return data; return data;
} }
......
...@@ -184,7 +184,7 @@ public class SummitActivityBiz extends BaseBiz<SummitActivityMapper, SummitActiv ...@@ -184,7 +184,7 @@ public class SummitActivityBiz extends BaseBiz<SummitActivityMapper, SummitActiv
criteria.andEqualTo("isShow", 1); criteria.andEqualTo("isShow", 1);
//位置 //位置
criteria.andIn("location", Arrays.asList(location, 0)); criteria.andIn("location", Arrays.asList(location, 0));
criteria.andGreaterThan("endTime", Instant.now().toEpochMilli()); // criteria.andGreaterThan("endTime", Instant.now().toEpochMilli());
List<SummitActivity> summitActivities = mapper.selectByExample(example); List<SummitActivity> summitActivities = mapper.selectByExample(example);
......
...@@ -55,7 +55,7 @@ public class SummitActivityController { ...@@ -55,7 +55,7 @@ public class SummitActivityController {
@GetMapping("/list") @GetMapping("/list")
public ObjectRestResponse<PageDataVO<SummitActivityVo>> findSummitActivityWithPage(@RequestParam(value = "page", defaultValue = "1", required = false) Integer page, public ObjectRestResponse<PageDataVO<SummitActivityVo>> findSummitActivityWithPage(@RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
@RequestParam(value = "limit", defaultValue = "6", required = false) Integer limit, @RequestParam(value = "limit", defaultValue = "6", required = false) Integer limit,
@RequestParam(value = "location", defaultValue = "0", required = false) Integer location, @RequestParam(value = "location", defaultValue = "1", required = false) Integer location,
@RequestParam(value = "title",required = false) String title) { @RequestParam(value = "title",required = false) String title) {
PageDataVO<SummitActivityVo> pageDataVO = summitActivityBiz.findSummitActivityWithPage(page, limit,location,title); PageDataVO<SummitActivityVo> pageDataVO = summitActivityBiz.findSummitActivityWithPage(page, limit,location,title);
return ObjectRestResponse.succ(pageDataVO); return ObjectRestResponse.succ(pageDataVO);
......
...@@ -67,7 +67,7 @@ public class AliYunSmsBiz { ...@@ -67,7 +67,7 @@ public class AliYunSmsBiz {
public static final String TEMPLATE_ID_CANCEL_E = "SMS_173345667"; public static final String TEMPLATE_ID_CANCEL_E = "SMS_173345667";
//租车押金退还 22 //租车押金退还 22
//public static final String TEMPLATE_ID_FINISH_A = "460772"; //public static final String TEMPLATE_ID_FINISH_A = "460772";
public static final String TEMPLATE_ID_FINISH_A = "SMS_173340710"; public static final String TEMPLATE_ID_FINISH_A = "SMS_175240587";
//违章押金退还 23 //违章押金退还 23
//public static final String TEMPLATE_ID_FINISH_B = "460773"; //public static final String TEMPLATE_ID_FINISH_B = "460773";
public static final String TEMPLATE_ID_FINISH_B = "SMS_173340712"; public static final String TEMPLATE_ID_FINISH_B = "SMS_173340712";
......
package com.xxfc.platform.vehicle.entity;
import lombok.Data;
import java.util.Date;
import javax.persistence.*;
@Data
@Table(name = "book_record_update_log")
public class BookRecordUpdateLog {
@Id
private Integer id;
/**
* 订单ID
*/
@Column(name = "order_id")
private Integer orderId;
/**
* 预定记录ID
*/
@Column(name = "book_record_id")
private Long bookRecordId;
/**
* 原还车公司ID
*/
@Column(name = "old_ret_company_id")
private Integer oldRetCompanyId;
/**
* 新还车公司ID
*/
@Column(name = "new_ret_company_id")
private Integer newRetCompanyId;
/**
* 操作人ID
*/
@Column(name = "operater_id")
private Integer operaterId;
/**
* 操作人姓名
*/
@Column(name = "operater_name")
private String operaterName;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
}
\ No newline at end of file
...@@ -10,6 +10,7 @@ import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO; ...@@ -10,6 +10,7 @@ import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo; import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo; import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO; import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO;
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.*;
...@@ -163,4 +164,8 @@ public interface VehicleFeign { ...@@ -163,4 +164,8 @@ public interface VehicleFeign {
@GetMapping("/vehicleInfo/findVehicleIds") @GetMapping("/vehicleInfo/findVehicleIds")
List<String> findbyPlateNumberAndVehicleCod(@RequestParam(value = "plateNumber") String plateNumber,@RequestParam(value = "vehicleCode") String vehicleCode); List<String> findbyPlateNumberAndVehicleCod(@RequestParam(value = "plateNumber") String plateNumber,@RequestParam(value = "vehicleCode") String vehicleCode);
@RequestMapping(value = "/vehicleInfo/bookRecord/update", method = RequestMethod.POST)
public ObjectRestResponse update(@RequestBody BookRecordUpdateLog bookRecordUpdateLog);
} }
...@@ -91,6 +91,12 @@ public class RentVehicleBookDTO extends PageParam { ...@@ -91,6 +91,12 @@ public class RentVehicleBookDTO extends PageParam {
@ApiModelProperty("扩展结束时间") @ApiModelProperty("扩展结束时间")
String endDateExtend; String endDateExtend;
/**
* 用途 1 租车
*/
@ApiModelProperty(hidden = true)
Integer useType = 1;
public void setBookStartDate(String bookStartDate) { public void setBookStartDate(String bookStartDate) {
this.bookStartDate = bookStartDate; this.bookStartDate = bookStartDate;
//首次设置 //首次设置
......
...@@ -57,6 +57,12 @@ public class UsableVeicleDTO extends PageParam { ...@@ -57,6 +57,12 @@ public class UsableVeicleDTO extends PageParam {
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
Integer withoutRecordWhere = 1; Integer withoutRecordWhere = 1;
/**
* 用途 1 租车
*/
@ApiModelProperty(hidden = true)
Integer useType = 1;
public void setStartDateTamp(Long startDateTamp) { public void setStartDateTamp(Long startDateTamp) {
this.startDateTamp = startDateTamp; this.startDateTamp = startDateTamp;
this.startDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startDateTamp), ZoneOffset.ofHours(8))); this.startDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startDateTamp), ZoneOffset.ofHours(8)));
......
package com.xxfc.platform.vehicle.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.entity.BookRecordUpdateLog;
import com.xxfc.platform.vehicle.mapper.BookRecordUpdateLogMapper;
import org.springframework.stereotype.Service;
@Service
public class BookRecordUpdateLogBiz extends BaseBiz<BookRecordUpdateLogMapper, BookRecordUpdateLog> {
public ObjectRestResponse save(BookRecordUpdateLog bookRecordUpdateLog) {
BookRecordUpdateLog oldValue = mapper.selectOne(bookRecordUpdateLog);
if (oldValue != null) {
return ObjectRestResponse.succ();
}
insertSelectiveRe(bookRecordUpdateLog);
return ObjectRestResponse.succ();
}
}
...@@ -1249,6 +1249,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1249,6 +1249,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
} }
public PageDataVO<Vehicle> searchUsableVehicle(RentVehicleBookDTO dto) { public PageDataVO<Vehicle> searchUsableVehicle(RentVehicleBookDTO dto) {
//设置-1表示查询所有的车 由于null json序列化不会赋值过来
if(-1 == dto.getUseType()) {
dto.setUseType(null);
}
Map<String, Object> params = BeanUtil.beanToMap(dto); Map<String, Object> params = BeanUtil.beanToMap(dto);
List<String> notBookedDates = Lists.newArrayList(); List<String> notBookedDates = Lists.newArrayList();
if (StringUtils.isNotBlank(dto.getBookEndDate()) && if (StringUtils.isNotBlank(dto.getBookEndDate()) &&
......
...@@ -78,6 +78,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -78,6 +78,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
@Autowired @Autowired
VehicleDepartureService vehicleDepartureService; VehicleDepartureService vehicleDepartureService;
@Autowired
BookRecordUpdateLogBiz bookRecordUpdateLogBiz;
@Override @Override
public UserFeign getUserFeign() { public UserFeign getUserFeign() {
return userFeign; return userFeign;
...@@ -324,6 +327,21 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -324,6 +327,21 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
return vehicleBookRecordVos; return vehicleBookRecordVos;
} }
public ObjectRestResponse update(BookRecordUpdateLog bookRecordUpdateLog) {
VehicleBookRecord vehicleBookRecord = selectById(bookRecordUpdateLog.getBookRecordId());
if(vehicleBookRecord != null) {
vehicleBookRecord.setRetCompany(bookRecordUpdateLog.getNewRetCompanyId());
int a = updateSelectiveByIdRe(vehicleBookRecord);
log.info(vehicleBookRecord.toString());
if(a <= 0) {
return ObjectRestResponse.createDefaultFail();
}
return bookRecordUpdateLogBiz.save(bookRecordUpdateLog);
} else {
return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_BOOK_RECORD_IS_NOT_EXIST.getCode(), ResCode.VEHICLE_BOOK_RECORD_IS_NOT_EXIST.getDesc());
}
}
public ObjectRestResponse<List<VehicleBookRecordVo>> selectByIds(List<Long> ids) { public ObjectRestResponse<List<VehicleBookRecordVo>> selectByIds(List<Long> ids) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("ids", ids); map.put("ids", ids);
......
package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.BookRecordUpdateLog;
import tk.mybatis.mapper.common.Mapper;
public interface BookRecordUpdateLogMapper extends Mapper<BookRecordUpdateLog> {
}
\ No newline at end of file
package com.xxfc.platform.vehicle.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.biz.BookRecordUpdateLogBiz;
import com.xxfc.platform.vehicle.entity.BookRecordUpdateLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/bookRecord")
public class BookRecordUpdateLogController {
@Autowired
BookRecordUpdateLogBiz bookRecordUpdateLogBiz;
@PostMapping(value = "/update")
public ObjectRestResponse save(@RequestBody BookRecordUpdateLog bookRecordUpdateLog) {
return bookRecordUpdateLogBiz.save(bookRecordUpdateLog);
}
}
...@@ -125,6 +125,27 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements ...@@ -125,6 +125,27 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
return ObjectRestResponse.succ(vehicleBiz.searchUsableModel(dto)); return ObjectRestResponse.succ(vehicleBiz.searchUsableModel(dto));
} }
/**
* 后台查询可用车辆(车型)
*
* @param dto
* @return
*/
@ApiOperation("可用车辆查询")
@RequestMapping(value = "/rent/back-stage/usable-vehicle", method = RequestMethod.GET)
@IgnoreUserToken
public ObjectRestResponse<PageDataVO<UsableVehicleModelVO>> rentBgUsableVehicle(UsableVeicleDTO dto) throws Exception {
//根据时间 获得 可用车辆
//结合车型
if (StringUtils.isNotBlank(dto.getCatasStr())) {
dto.setCatas(vehiclePlatCataBiz.groupCatasByParent(dto.getCatasStr()));
}
//设置显示是否有车
dto.setYearNo4Where(Boolean.TRUE);
dto.setUseType(null);
return ObjectRestResponse.succ(vehicleBiz.searchUsableModel(dto));
}
/** /**
* 热门车型 * 热门车型
* *
......
...@@ -20,9 +20,7 @@ import com.xxfc.platform.vehicle.common.CustomIllegalParamException; ...@@ -20,9 +20,7 @@ import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode; import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.constant.VehicleBookRecordStatus; import com.xxfc.platform.vehicle.constant.VehicleBookRecordStatus;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleBookInfo;
import com.xxfc.platform.vehicle.jobhandler.VehicleJobHandler; import com.xxfc.platform.vehicle.jobhandler.VehicleJobHandler;
import com.xxfc.platform.vehicle.pojo.*; import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto; import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
...@@ -38,6 +36,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -38,6 +36,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
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;
...@@ -76,6 +75,10 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -76,6 +75,10 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
@Autowired @Autowired
BranchCompanyBiz branchCompanyBiz; BranchCompanyBiz branchCompanyBiz;
@Autowired
BookRecordUpdateLogBiz bookRecordUpdateLogBiz;
public UserFeign getUserFeign() { public UserFeign getUserFeign() {
return userFeign; return userFeign;
} }
...@@ -304,6 +307,35 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -304,6 +307,35 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
} }
@RequestMapping(value = "/bookRecord/update", method = RequestMethod.POST)
@ApiOperation(value = "修改预定记录还车地点")
public ObjectRestResponse update(@RequestBody BookRecordUpdateLog bookRecordUpdateLog){
return vehicleBookRecordBiz.update(bookRecordUpdateLog);
}
@RequestMapping(value = "/bookRecord/updateById", method = RequestMethod.POST)
@ApiOperation(value = "修改预定记录还车地点")
public ObjectRestResponse updateById(@RequestBody VehicleBookRecord vehicleBookRecord){
VehicleBookRecord oldValue = vehicleBookRecordBiz.selectById(vehicleBookRecord.getId());
UserDTO userDTO = getAdminUserInfo();
if (userDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
if(oldValue != null) {
oldValue.setRetCompany(vehicleBookRecord.getRetCompany());
BookRecordUpdateLog bookRecordUpdateLog = new BookRecordUpdateLog();
bookRecordUpdateLog.setBookRecordId(vehicleBookRecord.getId());
bookRecordUpdateLog.setOldRetCompanyId(vehicleBookRecord.getRetCompany());
bookRecordUpdateLog.setNewRetCompanyId(vehicleBookRecord.getRetCompany());
bookRecordUpdateLog.setOperaterId(userDTO.getId());
bookRecordUpdateLog.setOperaterName(userDTO.getName());
bookRecordUpdateLog.setCreateTime(new Date());
vehicleBookRecordBiz.updateSelectiveByIdRe(vehicleBookRecord);
return bookRecordUpdateLogBiz.save(bookRecordUpdateLog);
} else {
return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_BOOK_RECORD_IS_NOT_EXIST.getCode(), ResCode.VEHICLE_BOOK_RECORD_IS_NOT_EXIST.getDesc());
}
}
@RequestMapping(value = "/bookedRecord", method = RequestMethod.GET) @RequestMapping(value = "/bookedRecord", method = RequestMethod.GET)
@ApiOperation(value = "获取多个预定记录") @ApiOperation(value = "获取多个预定记录")
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<!-- </table>--> <!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>--> <!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>--> <!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table tableName="vehicle_count_record" domainObjectName="VehicleCountRecord"></table> <table tableName="book_record_update_log" domainObjectName="BookRecordUpdateLog"></table>
<!-- <table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>--> <!-- <table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>-->
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xxfc.platform.vehicle.mapper.BookRecordUpdateLogMapper" >
</mapper>
\ No newline at end of file
...@@ -682,7 +682,9 @@ ...@@ -682,7 +682,9 @@
</if> </if>
and v.is_del = 0 and v.is_del = 0
and v.status != 3 and v.status != 3
and v.use_type = 1 <if test="useType != null">
and v.use_type = #{useType}
</if>
and bc.is_del = 0 and bc.is_del = 0
and bc.is_show = 1 and bc.is_show = 1
</where> </where>
......
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