Commit 4b063f3c authored by libin's avatar libin

Merge remote-tracking branch 'origin/dev' into dev

parents 21947f63 0bae592c
......@@ -247,4 +247,15 @@ public class AuthController {
return authService.checkToken(token);
}
@RequestMapping(value = "/updUsername", method = RequestMethod.POST)
public ObjectRestResponse updUsername(@RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode,
HttpServletRequest request)throws Exception {
log.info(username + "----require updUsername...");
String token = request.getHeader(tokenHeader);
return appAuthService.updUsername(username, mobilecode, token);
}
}
......@@ -5,6 +5,8 @@ import com.github.wxiaoqi.security.api.vo.user.AppUserInfo;
import com.github.wxiaoqi.security.api.vo.user.UserInfo;
import com.github.wxiaoqi.security.auth.configuration.FeignConfiguration;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
......@@ -78,4 +80,8 @@ public interface IUserService {
@PostMapping("/api/app/imi/login")
String loginImiWithToken();
@ApiModelProperty("修改手机号码")
@GetMapping("/api/app/updUsername")
public ObjectRestResponse updUsername(@RequestParam(value = "username") String username, @RequestParam(value = "mobilecode") String mobilecode, @RequestParam(value = "userId",defaultValue = "0") Integer userId);
}
......@@ -6,6 +6,8 @@ import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
public interface AuthService {
String login(JwtAuthenticationRequest authenticationRequest) throws Exception;
ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception;
......@@ -39,4 +41,6 @@ public interface AuthService {
String loginImiWithToken();
ObjectRestResponse checkToken(String token);
ObjectRestResponse updUsername(String username, String mobilecode, String token);
}
......@@ -13,10 +13,13 @@ import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
/**
* @author keliii
*/
......@@ -138,4 +141,27 @@ public class AppAuthServiceImpl implements AuthService {
}
@Override
public ObjectRestResponse updUsername(String username, String mobilecode, String token) {
if (StringUtils.isEmpty(token)){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"token不能为空");
}
try {
IJWTInfo ijwtInfo=jwtTokenUtil.getInfoFromToken(token);
if (ijwtInfo==null){
return ObjectRestResponse.createFailedResult(10009,"token失效");
}
Integer userId= Integer.parseInt(ijwtInfo.getId());
ObjectRestResponse objectRestResponse=userService.updUsername(username,mobilecode,userId);
if (objectRestResponse.getStatus()==ResultCode.SUCCESS_CODE){
token=getToken(username,userId);
objectRestResponse.setData(token);
}
return objectRestResponse;
}catch (Exception e){
e.printStackTrace();
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"操作失败");
}
}
}
......@@ -134,4 +134,27 @@ public class AuthServiceImpl implements AuthService {
}
}
@Override
public ObjectRestResponse updUsername(String username, String mobilecode, String token) {
if (StringUtils.isEmpty(token)){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"token不能为空");
}
try {
IJWTInfo ijwtInfo=jwtTokenUtil.getInfoFromToken(token);
if (ijwtInfo==null){
return ObjectRestResponse.createFailedResult(10009,"token失效");
}
Integer userId= Integer.parseInt(ijwtInfo.getId());
ObjectRestResponse objectRestResponse=userService.updUsername(username,mobilecode,userId);
if (objectRestResponse.getStatus()==ResultCode.SUCCESS_CODE){
token=getToken(username,userId);
objectRestResponse.setData(token);
}
return objectRestResponse;
}catch (Exception e){
e.printStackTrace();
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"操作失败");
}
}
}
......@@ -5,11 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService;
import com.github.wxiaoqi.security.admin.rpc.service.PermissionService;
import com.github.wxiaoqi.security.admin.vo.ImiVo;
import com.github.wxiaoqi.security.api.vo.authority.PermissionInfo;
import com.github.wxiaoqi.security.api.vo.user.AppUserInfo;
import com.github.wxiaoqi.security.api.vo.user.UserInfo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
......@@ -257,15 +255,25 @@ public class AppUserRest {
@ApiModelProperty("检查手机号验证码")
@GetMapping("/unauth/checkMobilecode")
public ObjectRestResponse checkMobilecode(@RequestParam(value = "phone") String phone,
@RequestParam(value = "mobilecode") String mobilecode){
if (StringUtils.isBlank(phone)||StringUtils.isBlank(mobilecode)){
@RequestParam(value = "mobilecode") String mobilecode) {
if (StringUtils.isBlank(phone) || StringUtils.isBlank(mobilecode)) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
String redisKey=appPermissionService.checkCodeByUsername(phone,mobilecode);
if (StringUtils.isBlank(redisKey)){
String redisKey = appPermissionService.checkCodeByUsername(phone, mobilecode);
if (StringUtils.isBlank(redisKey)) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "验证码错误");
}
return ObjectRestResponse.succ();
}
@ApiModelProperty("修改手机号码")
@GetMapping("/updUsername")
public ObjectRestResponse updUsername(@RequestParam(value = "username") String username,
@RequestParam(value = "mobilecode") String mobilecode,
@RequestParam(value = "userId",defaultValue = "0") Integer userId){
return appPermissionService.updUsername(userId,username,mobilecode);
}
......
package com.github.wxiaoqi.security.admin.rpc.service;
import cn.hutool.json.JSONUtil;
import com.ace.cache.annotation.CacheClear;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.biz.*;
import com.github.wxiaoqi.security.admin.constant.RedisKey;
......@@ -1134,4 +1135,26 @@ public class AppPermissionService {
public static final String CITY_NAME = "city";
}
//修改手机号码
public ObjectRestResponse updUsername(Integer userId,String username,String mobileCode){
if (StringUtils.isBlank(username)||StringUtils.isBlank(mobileCode)||userId==0||userId==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"参数不能为空");
}
if (StringUtils.isBlank(checkCodeByUsername(username,mobileCode))){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"验证码错误");
}
log.info("----updUsername----userId==="+userId+"---username==="+username);
// 是否已存在
AppUserLogin user = appUserLoginBiz.checkeUserLogin(username);
if (null != user) {
return ObjectRestResponse.createFailedResult(ResultCode.EXIST_CODE, "用户已存在");
}
AppUserLogin userLogin=new AppUserLogin();
userLogin.setId(userId);
userLogin.setUsername(username);
appUserLoginBiz.disable(userLogin);
return ObjectRestResponse.succ();
}
}
......@@ -19,13 +19,18 @@ import java.util.List;
public class VehicleItemDTO extends OrderItem {
public static final int topNum = 2;
public BigDecimal calculateVehicleUnitPrice(BigDecimal vehicleAmount, BigDecimal metaVehicleAmount, Boolean isSetRealAmount) {
BigDecimal unitPrice = vehicleAmount.divide(new BigDecimal(getCalculateNum()+ ""), 2, RoundingMode.HALF_UP);
BigDecimal metaUnitPrice = metaVehicleAmount.divide(new BigDecimal(getCalculateNum()+ ""), 2, RoundingMode.HALF_UP);
if(isSetRealAmount) {
setRealAmount(vehicleAmount);
}
BigDecimal unitPrice = BigDecimal.ZERO;
BigDecimal metaUnitPrice = BigDecimal.ZERO;
if(getCalculateNum() > 0) {
unitPrice = vehicleAmount.divide(new BigDecimal(getCalculateNum()+ ""), 2, RoundingMode.HALF_UP);
metaUnitPrice = metaVehicleAmount.divide(new BigDecimal(getCalculateNum()+ ""), 2, RoundingMode.HALF_UP);
}
setUnitPrice(unitPrice);
setMetaUnitPrice(metaUnitPrice);
......
......@@ -72,7 +72,7 @@ public class RentDepositJobHandler extends IJobHandler {
@Override
public ReturnT<String> execute(String idLastNumInterval) {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Integer rentDepositAutoRefundTime = new Integer(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_DEPOSIT_AUTO_REFUND_TIME).getDetail());
Long rentDepositAutoRefundTime = new Long(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_DEPOSIT_AUTO_REFUND_TIME).getDetail());
try {
List<BaseOrder> lists = baseOrderBiz.selectByExample(new Example.Builder(BaseOrder.class)
......@@ -80,7 +80,7 @@ public class RentDepositJobHandler extends IJobHandler {
.where(WeekendSqls.<BaseOrder>custom().andEqualTo(BaseOrder::getType, OrderTypeEnum.RENT_VEHICLE.getCode())
.andEqualTo(BaseOrder::getStatus, OrderStatusEnum.ORDER_FINISH.getCode()) //已完成的订单
.andEqualTo(BaseOrder::getRefundStatus, RefundStatusEnum.RESIDUE_ILLEGAL.getCode()) //已归还了部分押金
.andLessThanOrEqualTo(BaseOrder::getCrtTime, DateUtil.date(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60 * 1000)))
.andLessThanOrEqualTo(BaseOrder::getCrtTime, DateUtil.date(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L)))
// .andLike(BaseOrder::getId, "%"+ i)
).build());
......@@ -102,7 +102,7 @@ public class RentDepositJobHandler extends IJobHandler {
setType(crosstownTypeEnum);
}});
if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60 * 1000)) < 0) {
if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L)) < 0) {
OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{
setDetailId(orvd.getId());
setIsDel(SYS_FALSE);
......
......@@ -316,8 +316,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//计算价格
if(vehicleDayNum > 0) {
for(int i = cutDayNum; i < vmcpds.size(); i++) {
vehicleAmount.add(vmcpds.get(i).getPrice());
metaVehicleAmount.add(vmcpds.get(i).getNo_discount_price());
vehicleAmount = vehicleAmount.add(vmcpds.get(i).getPrice());
metaVehicleAmount = metaVehicleAmount.add(vmcpds.get(i).getNo_discount_price());
}
}else {
vehicleOrderItem.setUnitPrice(BigDecimal.ZERO);
......
......@@ -5,7 +5,7 @@ import lombok.Data;
import java.util.Date;
@Data
public class ResultVehicleVo {
public class ResultVehicleVo {
/**
* 主键(uuid)
*/
......@@ -55,6 +55,8 @@ public class ResultVehicleVo {
*/
private String parkBranchCompanyName;
/**
* 目的地分支机构(id)
*/
......@@ -70,6 +72,12 @@ public class ResultVehicleVo {
*/
private Integer useType;
/**
* 用途名称
*/
private String useTypeName;
/**
* 备注信息
*/
......
......@@ -59,4 +59,6 @@ public class VehicleBookRecordQueryVo extends PageParam {
private List<Integer> companyIds;
private String upkeepIds;
private Integer userCompany;
private Integer zoneId;
}
\ No newline at end of file
......@@ -2,11 +2,10 @@ package com.xxfc.platform.vehicle.pojo;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Data
public class VehicleExcelVo {
public class VehicleExcelVo {
/**
......@@ -27,9 +26,9 @@ public class VehicleExcelVo {
/**
*
* 用途名称
*/
private String useType;
private String useTypeName;
/**
......
package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Lists;
......@@ -11,19 +9,20 @@ import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.pojo.ResultVehicleVo;
import com.xxfc.platform.vehicle.pojo.VehicleExcelVo;
import com.xxfc.platform.vehicle.pojo.VehiclePageQueryVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicle> {
@Autowired
......@@ -32,7 +31,7 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
public List<VehicleExcelVo> getByPageNotAllData(VehiclePageQueryVo vehiclePageQueryVo, List<Integer> companyList) throws Exception {
public List getByPageNotAllData(VehiclePageQueryVo vehiclePageQueryVo, List<Integer> companyList) throws Exception {
Map<String, Object> params = PropertyUtils.describe(vehiclePageQueryVo);
//处理预定日期相关参数
vehicleBiz.adjustBookedInfoParam(params, vehiclePageQueryVo);
......@@ -42,10 +41,10 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
params.put("companyList", Arrays.asList(-1));
}
return mapper.getVehicleExcelVoNotAllData(params);
return mapper.getByPageNotAllData(params);
}
public List<VehicleExcelVo> getByPage(VehiclePageQueryVo vehiclePageQueryVo) throws Exception {
public List getByPage(VehiclePageQueryVo vehiclePageQueryVo) throws Exception {
Map<String, Object> params = PropertyUtils.describe(vehiclePageQueryVo);
//处理预定日期相关参数
......@@ -54,10 +53,10 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
if (vehiclePageQueryVo.getModelId() == null) {
params.remove("modelId");
}
return mapper.getVehicleExcelVo(params);
return mapper.getByPage(params);
}
public List<VehicleExcelVo> getList(String vehiclePageQueryVoJson, UserDTO userDTO) {
//getResultVehicleVoList
public List<ResultVehicleVo> getResultVehicleVoList(String vehiclePageQueryVoJson, UserDTO userDTO) {
VehiclePageQueryVo vehiclePageQueryVo = new VehiclePageQueryVo();
try {
if (StringUtils.isNotBlank(vehiclePageQueryVoJson)){
......@@ -75,4 +74,22 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
}
return new ArrayList();
}
public List<VehicleExcelVo> getList(String vehiclePageQueryVoJson, UserDTO userDTO) throws Exception {
List<ResultVehicleVo> resultVehicleVoList = getResultVehicleVoList(vehiclePageQueryVoJson, userDTO);
ArrayList<VehicleExcelVo> arrayList = Lists.newArrayList();
resultVehicleVoList.parallelStream().forEach(result->{
try {
VehicleExcelVo vehicleExcelVo = new VehicleExcelVo();
BeanUtilsBean.getInstance().copyProperties(vehicleExcelVo,result);
arrayList.add(vehicleExcelVo);
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
}
});
return arrayList;
}
}
......@@ -16,9 +16,7 @@ public interface VehicleMapper extends Mapper<Vehicle> {
public List<ResultVehicleVo> getByPageNotAllData(Map<String, Object> params);
List<VehicleExcelVo> getVehicleExcelVo(Map<String, Object> params);
List<VehicleExcelVo> getVehicleExcelVoNotAllData(Map<String, Object> params);
public int updateStatusById(Map<String, Object> params);
......
......@@ -51,7 +51,7 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
writer.addHeaderAlias("numberPlate", "车牌号");
writer.addHeaderAlias("code", "车辆编码");
writer.addHeaderAlias("vehicleType", "车型");
writer.addHeaderAlias("useType", "用途");
writer.addHeaderAlias("useTypeName", "用途");
writer.addHeaderAlias("parkBranchCompanyName", "停靠分公司");
// 一次性写出内容,使用默认样式,强制输出标题
writer.write(rows, true);
......
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