Commit fbe70d06 authored by libin's avatar libin

Merge remote-tracking branch 'origin/master' into master-member-feture-count

parents 4ddd5aef b332abe2
......@@ -16,6 +16,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -41,6 +42,7 @@ import java.util.stream.Collectors;
@Transactional
@DependsOn("appUserPositionBiz")
@Service
@Slf4j
public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, AppUserPositionTemp> implements InitializingBean {
@Autowired
......@@ -299,4 +301,38 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
}
public void setPostionIdByPhone(String phone){
try {
Example example = new Example(AppUserPositionTemp.class);
example.createCriteria().andEqualTo("phone", phone).andEqualTo("isDel", 0);
List<AppUserPositionTemp> list = selectByExample(example);
if (CollectionUtils.isEmpty(list)){
log.info("----用户无身份----phone==="+phone);
return;
}
AppUserPositionTemp positionTemp=list.get(0);
if (positionTemp.getUserId()>0){
log.info("----用户已存在身份----phone==="+phone);
return;
}
//根据手机号查询userId
AppUserLogin userLogin = loginBiz.checkeUserLogin(phone);
if (userLogin==null) {
log.info("----用户不存在----phone==="+phone);
return;
}
Integer userId=userLogin.getId();
positionTemp.setUserId(userId);
int num=updateSelectiveByIdRe(positionTemp);
if (num>0){
Integer postionId=positionTemp.getPositionId();
log.info("----用户---postionId===="+postionId+"----phone==="+phone);
detailBiz.updateUserPositionByUserId(userId, postionId);
}
}catch (Exception e){
e.printStackTrace();
}
}
}
......@@ -111,6 +111,9 @@ public class AppPermissionService {
@Autowired
private AppUserPhoneNotesBiz notesBiz;
@Autowired
private AppUserPositionTempBiz positionTempBiz;
public AppUserInfo validate(String username, String password) {
AppUserInfo info = new AppUserInfo();
......@@ -331,6 +334,8 @@ public class AppPermissionService {
//创建钱包
walletBiz.createWalletByUserId(appUserLogin.getId());
log.info("注册:创建钱包: " + userid+"---time===="+System.currentTimeMillis()/1000L);
//临时身份绑定
positionTempBiz.setPostionIdByPhone(username);
// 登录结果要做做统一处理
JSONObject data = autoLogin(userid, username, headimgurl, nickname,code,activityCode,1);
......@@ -967,6 +972,8 @@ public class AppPermissionService {
log.error("注册:新增用户详情: " + userid);
//创建钱包
walletBiz.createWalletByUserId(appUserLogin.getId());
//临时身份绑定
positionTempBiz.setPostionIdByPhone(username);
//临时会员绑定
insertUserMemberByUserIdAndPhone(userid, username);
//上线绑定
......
......@@ -159,7 +159,7 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
}
public OrderStatistics findAll(List<Integer> companyIds) {
return mapper.monthOrderTotal(companyIds);
return mapper.monthOrderTotal(companyIds);
}
/**
......
......@@ -46,12 +46,14 @@ public class OrderStatisticsBiz extends BaseBiz<OrderStatisticsMapper, OrderStat
@Autowired
private DailyMembersOrderStatisticsBiz membersStatisticsBiz;
public HomePageOrderData getTotalOrder(List<Integer> companyIds) {
public HomePageOrderData getTotalOrder(List<Integer> companyIds, Integer dataAll) {
HomePageOrderData result = new HomePageOrderData();
ArrayList<HomePageOrderData> list = new ArrayList<>();
list.add(getVehicleHomePageOrderData(companyIds));
list.add(getTourHomePageOrderData(companyIds));
list.add(getMemberHomePageOrderData(companyIds));
if (1==dataAll) {
list.add(getMemberHomePageOrderData(companyIds));
}
result.setTotalOrders(list.stream().map(HomePageOrderData::getTotalOrders).reduce(BigDecimal.ZERO, BigDecimal::add));
result.setTotalOutstandingDeposit(list.stream().map(HomePageOrderData::getTotalOutstandingDeposit).reduce(BigDecimal.ZERO, BigDecimal::add));
result.setAdditionalIndemnity(list.stream().map(HomePageOrderData::getAdditionalIndemnity).reduce(BigDecimal.ZERO, BigDecimal::add));
......
......@@ -18,7 +18,7 @@ public interface DailyMembersOrderStatisticsMapper extends Mapper<DailyMembersOr
Map<String, Object> getTravelGmv(@Param("day") Integer day);
OrderStatistics monthOrderTotal(List<Integer> companyIds);
OrderStatistics monthOrderTotal(List<Integer> list);
......
......@@ -19,5 +19,5 @@ public interface DailyTravelOrderStatisticsMapper extends Mapper<DailyTravelOrde
List<DailyTravelOrderStatistics> getTravelPenalSum(@Param("day") Integer day);
OrderStatistics monthOrderTotal(List<Integer> companyIds);
OrderStatistics monthOrderTotal(List<Integer> list);
}
......@@ -25,5 +25,5 @@ public interface DailyVehicleOrderStatisticsMapper extends Mapper<DailyVehicleOr
List<DailyVehicleOrderStatistics> getViolationMoney(@Param("day") Integer day);
OrderStatistics monthOrderTotal(List<Integer> companyIds);
OrderStatistics monthOrderTotal(@Param("list") List<Integer> list);
}
......@@ -100,7 +100,7 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
UserDTO user = userDTOObjectRestResponse.getData();
List<Integer> companyIds = null;
if (!DATA_AUTHORITY.equals(user.getDataAll())) {
companyIds = vehicleFeign.getCompanyIds().getData();
companyIds = vehicleFeign.getCompanyIds(user.getDataZone(), user.getDataCompany()).getData();
}
//只统计租车订单
if (TYPE_VEHICLE.equals(type)) {
......@@ -111,12 +111,12 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
return ObjectRestResponse.succ(baseBiz.getTourHomePageOrderData(companyIds));
}
//只统计会员订单
if (TYPE_MEMBER.equals(type)) {
if (TYPE_MEMBER.equals(type)||DATA_AUTHORITY.equals(user.getDataAll())) {
return ObjectRestResponse.succ(baseBiz.getMemberHomePageOrderData(companyIds));
}
//所有订单
if (TYPE_TOTAL.equals(type)) {
return ObjectRestResponse.succ(baseBiz.getTotalOrder(companyIds));
return ObjectRestResponse.succ(baseBiz.getTotalOrder(companyIds,user.getDataAll()));
}
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "参数错误!");
} catch (Exception e) {
......
......@@ -22,9 +22,9 @@
daily_members_order_statistics
WHERE
1=1
<if test="companyIds != null and companyIds.size()!=0">
<if test="list != null and list.size()!=0">
and branch_company_id in
<foreach collection="companyIds" index="index" item="companyId" open="(" separator="," close=")" >
<foreach collection="list" index="index" item="companyId" open="(" separator="," close=")" >
#{companyId}
</foreach>
</if>
......
......@@ -58,9 +58,9 @@
daily_travel_order_statistics
WHERE
1=1
<if test="companyIds != null and companyIds.size()!=0">
<if test="list != null and list.size()!=0">
and branch_company_id in
<foreach collection="companyIds" index="index" item="companyId" open="(" separator="," close=")" >
<foreach collection="list" index="index" item="companyId" open="(" separator="," close=")" >
#{companyId}
</foreach>
</if>
......
......@@ -94,9 +94,9 @@
daily_vehicle_order_statistics
WHERE
1=1
<if test="companyIds != null and companyIds.size()!=0">
<if test="list != null and list.size()!=0">
and branch_company_id in
<foreach collection="companyIds" index="index" item="companyId" open="(" separator="," close=")" >
<foreach collection="list" index="index" item="companyId" open="(" separator="," close=")" >
#{companyId}
</foreach>
</if>
......
......@@ -182,4 +182,8 @@ public class VehicleModel implements Serializable {
@Column(name = "img_desc")
@ApiModelProperty("seo*html标签优化")
private String imgDesc;
@Column(name = "app_show")
@ApiModelProperty("是否在App展示")
private Integer appShow;
}
package com.xxfc.platform.vehicle.feign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
......@@ -171,8 +172,8 @@ public interface VehicleFeign {
@RequestMapping(value = "/vehicleInfo/bookRecord/update", method = RequestMethod.POST)
public ObjectRestResponse update(@RequestBody BookRecordUpdateLog bookRecordUpdateLog);
@RequestMapping(value ="/branchCompany/app/unauth/getCompanyIds",method = RequestMethod.GET)
RestResponse<List<Integer>> getCompanyIds();
@GetMapping(value ="/branchCompany/getCompanyIds")
RestResponse<List<Integer>> getCompanyIds(@RequestParam(value = "dataZone")String dataZone ,@RequestParam(value = "dataCompany")String dataCompany);
@GetMapping(value = "/bookRecord/get")
public ObjectRestResponse<List<BookRecordUpdateLog>> get(@RequestParam(value = "bookRecordId")Long bookRecordId);
......
......@@ -413,8 +413,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
return ObjectRestResponse.succ(list);
}
public List<Integer> getCompanyIds() {
UserDTO userDTO = getAdminUserInfo();
return vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
public List<Integer> getCompanyIds(String dataZone ,String dataCompany) {
return vehicleBiz.dataCompany(dataZone, dataCompany);
}
}
......@@ -62,10 +62,12 @@ public class VehicleActiveService {
log.info("出车参数: departureVo = {}", departureVo.toString());
Vehicle vehicle = vehicleBiz.selectById(departureVo.getVehicleId());
if (vehicle == null) {
log.info("出车异常,车辆不存在!");
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc(),
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode());
}
if (StringUtils.isBlank(departureVo.getCheckMan()) || StringUtils.isBlank(departureVo.getCheckManTel())) {
log.error("出车 核销人姓名不能为空!");
throw new BaseException(ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getDesc(),
ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getCode());
}
......@@ -74,7 +76,11 @@ public class VehicleActiveService {
ResCode.VEHICLE_STATUS_IS_NOT_NORMAL.getCode());
}
//添加出车时间过滤 再出车开始时间前一天至结束时间内可以出车,并且预定记录为已审核状态
checkDateInvalid(departureVo);
try {
checkDateInvalid(departureVo);
} catch (BaseException b) {
throw new BaseException(b.getMessage(), b.getStatus());
}
Integer MileageLift = vehicle.getMileageLastUpdate();
Integer MileageLift1 = departureVo.getMileage();
if (MileageLift1 == null) {
......@@ -215,10 +221,6 @@ public class VehicleActiveService {
}
// 写入车辆公里数,还车分公司id
vehicle.setMileageLastUpdate(MileageRest1);
if (vehicleBookRecord != null) {
vehicle.setParkBranchCompanyId(vehicleBookRecord.getRetCompany());
}
// 出车记录
VehicleDepartureLogVo departureLogVo = vehicleDepartureLogMapper.selectByBookRecordId(arrivalVo.getBookRecordId());
......@@ -263,7 +265,7 @@ public class VehicleActiveService {
throw new BaseException(ResCode.VEHICLE_UNBOOK_FAIL.getDesc(), ResCode.VEHICLE_UNBOOK_FAIL.getCode());
}
} catch (Exception e) {
log.info("提前还车失败,bookVehicleVo = {}", bookVehicleVo.toString());
log.error("提前还车失败,bookVehicleVo = {}", bookVehicleVo.toString());
e.printStackTrace();
}
} else if (actualArrivalDate.compareTo(arrivalDate) > 0) {//实际还车时间大于预计还车时间
......@@ -343,6 +345,7 @@ public class VehicleActiveService {
}
}
if (!(startDate.minusDays(1).compareTo(DateTime.now()) <= 0 && DateTime.now().compareTo(endDate) <= 0 && vehicleBookRecord.getStatus() == VehicleBookRecordStatus.APPROVE.getCode() && (list == null || list.size() <= 0))) {
log.error("出车过滤,有正常未还车记录,请按照预定的日期出车");
throw new BaseException(ResCode.VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED.getDesc(),
ResCode.VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED.getCode());
}
......
......@@ -83,6 +83,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
@Autowired
VehicleActiveService vehicleActiveService;
@Autowired
VehicleBiz vehicleBiz;
@Override
public UserFeign getUserFeign() {
return userFeign;
......@@ -252,6 +255,15 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
if(a <= 0) {
return ObjectRestResponse.createDefaultFail();
}
//出行中才修改车辆停靠分公司
VehicleDepartureLogVo vehicleDepartureLogVo = vehicleDepartureService.getByRecordId(vehicleBookRecord.getId());
if (vehicleDepartureLogVo != null && vehicleDepartureLogVo.getState() == 0) {
Vehicle vehicle = vehicleBiz.selectById(vehicleBookRecord.getVehicleId());
if (vehicle != null) {
vehicle.setParkBranchCompanyId(vehicleBookRecord.getRetCompany());
vehicleBiz.updateSelectiveByIdRe(vehicle);
}
}
return bookRecordUpdateLogBiz.save(bookRecordUpdateLog);
} else {
return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_BOOK_RECORD_IS_NOT_EXIST.getCode(), ResCode.VEHICLE_BOOK_RECORD_IS_NOT_EXIST.getDesc());
......
......@@ -221,10 +221,10 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return baseBiz.branchCompans();
}
@RequestMapping(value ="/app/unauth/getCompanyIds",method = RequestMethod.GET)
public RestResponse<List<Integer>> getCompanyIds() {
return RestResponse.suc(baseBiz.getCompanyIds());
@GetMapping(value ="/getCompanyIds")
public RestResponse<List<Integer>> getCompanyIds(@RequestParam(value = "dataZone",defaultValue ="")String dataZone ,@RequestParam(value = "dataCompany")String dataCompany) {
return RestResponse.suc(baseBiz.getCompanyIds(dataZone,dataCompany));
}
}
......@@ -78,6 +78,9 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
@Autowired
BookRecordUpdateLogBiz bookRecordUpdateLogBiz;
@Autowired
VehicleDepartureService vehicleDepartureService;
public UserFeign getUserFeign() {
return userFeign;
......@@ -335,6 +338,14 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
bookRecordUpdateLog.setOperaterId(userDTO.getId());
bookRecordUpdateLog.setOperaterName(userDTO.getName());
bookRecordUpdateLog.setCreateTime(new Date());
VehicleDepartureLogVo vehicleDepartureLogVo = vehicleDepartureService.getByRecordId(oldValue.getId());
if (vehicleDepartureLogVo != null && vehicleDepartureLogVo.getState() == 0) {
Vehicle vehicle = vehicleBiz.selectById(oldValue.getVehicleId());
if (vehicle != null) {
vehicle.setParkBranchCompanyId(oldValue.getRetCompany());
vehicleBiz.updateSelectiveByIdRe(vehicle);
}
}
vehicleBookRecordBiz.updateSelectiveByIdRe(vehicleBookRecord);
return bookRecordUpdateLogBiz.save(bookRecordUpdateLog);
} else {
......
......@@ -18,6 +18,7 @@ import com.xxfc.platform.vehicle.biz.VehicleCataBiz;
import com.xxfc.platform.vehicle.biz.VehicleModelBiz;
import com.xxfc.platform.vehicle.biz.VehiclePlatCataBiz;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.VehicleCata;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.pojo.VModelDetailVO;
......@@ -292,7 +293,20 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
}
}
@ApiOperation("是否在App展示")
@PostMapping(value = "/bg/updateAppShow")
public ObjectRestResponse<VehicleModel> updateAppShow(@RequestBody VehicleModel vehicleModel) {
if (vehicleModel == null || vehicleModel.getId() == null) {
return ObjectRestResponse.paramIsEmpty();
}
VehicleModel oldValue = vehicleModelBiz.selectById(vehicleModel.getId());
if (oldValue == null) {
return ObjectRestResponse.createFailedResult(ResCode.FIND_DATA_NOT_EXIST.getCode(), ResCode.FIND_DATA_NOT_EXIST.getDesc());
}
oldValue.setAppShow(vehicleModel.getAppShow());
vehicleModelBiz.updateByPrimaryKeySelective(oldValue);
return ObjectRestResponse.succ();
}
@ApiOperation("删除")
@DeleteMapping(value = "/app/{id}")
......
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