Commit f733c9a4 authored by hanfeng's avatar hanfeng

Merge remote-tracking branch 'origin/master'

parents 6679062c d2da464f
......@@ -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);
//上线绑定
......
......@@ -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;
}
......@@ -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());
......
......@@ -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