Commit bcc28dea authored by hezhen's avatar hezhen

Merge branch 'dev-chw' of http://113.105.137.151:22280/youjj/cloud-platform into dev-chw

# Conflicts:
#	xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
parents 606bb93a fbf6bae7
......@@ -110,7 +110,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.5.10</version>
<version>5.4.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
......
......@@ -59,6 +59,12 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
mapper.updateByExampleSelective(target, example);
}
/**
*
* @param where
* @param orderStr " crt_time desc "
* @return
*/
public List<T> selectByWeekend(Function<WeekendSqls<T>, WeekendSqls<T>> where, String orderStr) {
WeekendSqls whereSqls = where.apply(WeekendSqls.<T>custom());
Example.Builder builder = new Example.Builder(entityClass)
......
......@@ -193,6 +193,6 @@ public class BaseMemberLevel implements Serializable {
public static void main(String[] args) {
BaseUserMemberLevel memberLevel = new BaseUserMemberLevel();
System.out.println(JSONUtil.wrap(memberLevel,false));
//System.out.println(JSONUtil.wrap(memberLevel,false));
}
}
......@@ -4,6 +4,8 @@ import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 用户详情信息表
*/
......@@ -98,6 +100,8 @@ public class AppUserDTO {
private Boolean isBindQQ;
//用户上线
private Integer parentId;
//用户上线
private List<Integer> businessCompanyIds;
//用户上线身份id
private Integer parentPositionId;
......
......@@ -254,7 +254,7 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
return new ObjectRestResponse<User>().rel(true).data(user);
}
public ObjectRestResponse userinfoByMobilePhone(String mobilePhone){
public ObjectRestResponse<User> userinfoByMobilePhone(String mobilePhone){
User user = selectOne(new User(){{
setMobilePhone(mobilePhone);
setIsDel(SYS_FALSE);
......
......@@ -78,7 +78,8 @@ public class AppUserController extends CommonBaseController{
@Autowired
private AppUserRelationBiz relationBiz;
@Autowired
private UserBiz userBiz;
@GetMapping("page")
public TableResultResponse list(@RequestParam Map<String, Object> params) {
......@@ -179,6 +180,8 @@ public class AppUserController extends CommonBaseController{
AppUserLogin appUserLogin = appUserLoginBiz.selectById(userid);
userDTO.setIsBindWx(StringUtils.isNotEmpty(appUserLogin.getWxOpenid()));
userDTO.setIsBindQQ(StringUtils.isNotEmpty(appUserLogin.getOpenid()));
ObjectRestResponse<User> objectRestResponse = userBiz.userinfoByMobilePhone(appUserLogin.getUsername());
userDTO.setBusinessCompanyIds(null == objectRestResponse.getData()? null : objectRestResponse.getData().getCompanyIds());
return ObjectRestResponse.succ(userDTO);
}
......
......@@ -2,6 +2,8 @@ package com.xxfc.platform.app.entity.vo;
import lombok.Data;
import javax.persistence.Column;
/**
* @author libin
* @version 1.0
......@@ -32,4 +34,14 @@ public class BannerVo {
* seo html标签优化
*/
private String alt;
/**
* 跳转类型 0--不跳转;1--商品详情页;2--店铺主页;
*/
private Integer jumpType;
/**
* 跳转 商品/店铺 id;
*/
private String jumpId;
}
......@@ -22,9 +22,9 @@ import java.util.List;
@Service
public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
public List<BannerVo> findBannerList(Integer type,Integer location,Integer platform) {
public List<BannerVo> findBannerList(Integer type,Integer location, String multiLocation, Integer platform) {
List<BannerVo> bannerVos = new ArrayList<>();
List<Banner> banners = mapper.findBannerListByType(type,location,platform);
List<Banner> banners = mapper.findBannerListByType(type,location,multiLocation,platform);
banners.forEach(banner -> {
BannerVo bannerVo = new BannerVo();
BeanUtils.copyProperties(banner,bannerVo);
......
......@@ -27,5 +27,5 @@ public interface BannerMapper extends Mapper<Banner> {
List<Banner> findBannerListByType(@Param("type") Integer type,@Param("location") Integer location,@Param("platform") Integer platform);
List<Banner> findBannerListByType(@Param("type") Integer type,@Param("location") Integer location, @Param("multiLocation") String multiLocation, @Param("platform") Integer platform);
}
package com.xxfc.platform.app.rest;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.app.biz.BannerBiz;
import com.xxfc.platform.app.entity.vo.BannerVo;
......@@ -30,13 +31,14 @@ public class BannerController {
* @return
*/
@GetMapping("/app/unauth/findBannerlist")
public ObjectRestResponse findBannerlist(@RequestParam(value = "type") Integer type,
public ObjectRestResponse findBannerlist(@RequestParam(required = false, value = "type") Integer type,
@RequestParam(required = false, value = "location") Integer location,
@RequestParam(required = false, value = "multiLocation") String multiLocation,
@RequestParam(value = "platform",required = false,defaultValue = "0") Integer platform) {
if (type == null) {
if (null == location && StrUtil.isBlank(multiLocation)) {
return ObjectRestResponse.createDefaultFail();
}
List<BannerVo> bannerList = bannerBiz.findBannerList(type, location,platform);
List<BannerVo> bannerList = bannerBiz.findBannerList(type, location, multiLocation, platform);
return ObjectRestResponse.succ(bannerList);
}
}
......@@ -19,10 +19,21 @@
</resultMap>
<select id="findBannerListByType" resultMap="bannerMap">
select * from `banner` where `is_del`=0 and `type`=#{type}
select * from `banner` where `is_del`=0
<if test="type != null">
and `type`=#{type}
</if>
<if test="location != null">
and `location`=#{location}
</if>
<if test="multiLocation != null">
and
(
<foreach collection="multiLocation.split(',')" index="lIndex" item="locationEntity" separator=" or ">
location = #{locationEntity}
</foreach>
)
</if>
<if test="platform != null">
and `platform`=#{platform}
</if>
......
......@@ -77,7 +77,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.5.10</version>
<version>5.4.2</version>
</dependency>
<dependency>
......
......@@ -42,7 +42,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.5.10</version>
<version>5.4.2</version>
</dependency>
</dependencies>
......
......@@ -20,7 +20,7 @@ public class VehicleBookInfo {
/**
* 预定信息所属年月(格式yyyy-MM)
*/
@Column(name = "year_month")
@Column(name = "`year_month`")
private String yearMonth;
/**
......
package com.xxfc.platform.vehicle.pojo;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import lombok.Data;
import java.util.Date;
@Data
public class VehicleBookRecordVO2 extends VehicleBookRecord {
private Date bookStartDate;
private Date bookEndDate;
}
package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
......@@ -41,8 +42,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import com.xxfc.platform.universal.entity.Dictionary;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_FALSE;
......@@ -718,4 +722,16 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
}
return data.subList(fromIndex, toIndex);
}
// public List<VehicleBookRecord> selectByWeekendsOr() {
// WeekendSqls whereSqls = WeekendSqls.<VehicleBookRecord>custom();
// whereSqls.
// Example.Builder builder = new Example.Builder(entityClass)
// .where(whereSqls);
// Example example = builder.build();
// if(StrUtil.isNotBlank(orderStr)) {
// example.setOrderByClause(orderStr);
// }
// return selectByExample(example);
// }
}
......@@ -75,6 +75,9 @@ public interface VehicleMapper extends Mapper<Vehicle> {
List<Integer> goodTypes(@Param("commpanyId") Integer commpanyId);
List<VehicleBookRecordVO2> calendarPriceList(@Param("commpanyId") Integer commpanyId);
@Update("update vehicle set state=#{state} WHERE id=#{vehicleId} ")
int setState(@Param("vehicleId")String vehicleId,@Param("state")Integer state);
}
\ No newline at end of file
......@@ -79,9 +79,9 @@ public class ChwAppVehicleController extends BaseController<VehicleBiz> implemen
@RequestMapping(value = "/vehicleBrand/alls",method = RequestMethod.GET)
@ResponseBody
@IgnoreUserToken
public List<VehicleBrand> all(VehicleBrand vehicleBrand) {
public ObjectRestResponse<List<VehicleBrand>> all(VehicleBrand vehicleBrand) {
vehicleBrand.setIsDel(SYS_FALSE);
return vehicleBrandBiz.selectList(vehicleBrand);
return ObjectRestResponse.succ(vehicleBrandBiz.selectList(vehicleBrand));
}
@ApiOperation("vehicleCategory查询分页")
......@@ -98,9 +98,9 @@ public class ChwAppVehicleController extends BaseController<VehicleBiz> implemen
@RequestMapping(value = "/vehicleCategory/alls",method = RequestMethod.GET)
@ResponseBody
@IgnoreUserToken
public List<VehicleCategory> vehicleCategoryAll(VehicleCategory vehicleCategory) {
public ObjectRestResponse<List<VehicleCategory>> vehicleCategoryAll(VehicleCategory vehicleCategory) {
vehicleCategory.setIsDel(SYS_FALSE);
return vehicleCategoryBiz.selectList(vehicleCategory);
return ObjectRestResponse.succ(vehicleCategoryBiz.selectList(vehicleCategory));
}
}
......@@ -2,7 +2,10 @@ package com.xxfc.platform.vehicle.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.entity.BaseUserMember;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
......@@ -13,18 +16,13 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.VehicleBiz;
import com.xxfc.platform.vehicle.biz.VehicleHolidayPriceInfoBiz;
import com.xxfc.platform.vehicle.biz.VehiclePlatCataBiz;
import com.xxfc.platform.vehicle.biz.*;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.BookType;
import com.xxfc.platform.vehicle.constant.VehicleBookRecordStatus;
import com.xxfc.platform.vehicle.constant.VehicleMemberType;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleCommonPriceInfo;
import com.xxfc.platform.vehicle.entity.VehicleHolidayPriceInfo;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
import com.xxfc.platform.vehicle.pojo.vo.UsableVeicleVO;
......@@ -42,6 +40,7 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
......@@ -72,6 +71,12 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
@Autowired
VehicleBiz vehicleBiz;
@Autowired
VehicleBookRecordBiz vehicleBookRecordBiz;
@Autowired
VehicleBookInfoBiz vehicleBookInfoBiz;
@Autowired
VehicleHolidayPriceInfoBiz vehicleHolidayPriceInfoBiz;
......@@ -408,10 +413,6 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
cn.hutool.core.date.DateTime beginOfStartDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
cn.hutool.core.date.DateTime endOfStartDate = DateUtil.endOfDay(DateUtil.parse(endDate));
//获取基本和周末价格
// VehicleCommonPriceInfo vehicleCommonPriceInfo = vehicleCommonPriceInfoBiz.selectOne(new VehicleCommonPriceInfo(){{
// setCompanyId(companyId);
// setVehicleId(vehicleId);
// }});
Vehicle vehicle = vehicleBiz.selectOne(new Vehicle(){{
setParkBranchCompanyId(companyId);
setId(vehicleId);
......@@ -492,4 +493,67 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
return priceDTOS;
}
@GetMapping(value = "/app/unauth/getDayCalendarPrice")
@IgnoreUserToken
public ObjectRestResponse<List<CalendarPriceChwDTO>> getDayCalendarPrice(DayCalendarDTO dto) {
return ObjectRestResponse.succ(getChwDayCalendarPrice(dto));
}
/**获取价格日历**/
public List<CalendarPriceChwDTO> getChwDayCalendarPrice (DayCalendarDTO dto) {
//根据时间获取预约记录 bookinfo
//转换为月份
String startMonth = StrUtil.subBefore(DateUtil.parseDateTime(dto.startDate).toDateStr(), "-", true);
String endMonth = StrUtil.subBefore(DateUtil.parseDateTime(dto.endDate).toDateStr(), "-", true);
List<VehicleBookInfo> list = vehicleBookInfoBiz.selectByWeekend(w -> {
w
.andEqualTo(VehicleBookInfo::getVehicle, dto.vehicleId)
.andGreaterThanOrEqualTo(VehicleBookInfo::getYearMonth, startMonth)
.andLessThanOrEqualTo(VehicleBookInfo::getYearMonth, endMonth)
;
return w;
}, " `year_month` asc ");
List<CalendarPriceChwDTO> list2 = CollUtil.newArrayList();
list.forEach(info -> {
//月第一天
DateTime firstDay = DateUtil.parseDate(info.getYearMonth()+ "-01");
//月总天数
Integer monthDays = DateUtil.lengthOfMonth(firstDay.month(), firstDay.isLeapYear());
//与运算
String monthStr = NumberUtil.getBinaryStr(info.getBookedDate());
for(int i = 0; i < monthDays; i++) {
int finalI = i;
CalendarPriceChwDTO calendarPriceChwDTO = new CalendarPriceChwDTO(){{
setDateStr(DateUtil.offsetDay(firstDay, finalI).toDateStr());
setAllowRent(SYS_FALSE);
}};
if(i > monthStr.length() || !StrUtil.equalsCharAt(monthStr, monthStr.length() - i - 1, '1')) {
calendarPriceChwDTO.setAllowRent(SYS_TRUE);
}
list2.add(calendarPriceChwDTO);
}
});
return list2;
}
@Data
public static class CalendarPriceChwDTO {
private String dateStr;
private Integer allowRent;
}
@Data
public static class DayCalendarDTO {
String vehicleId;
String startDate;
String endDate;
// Integer userId;
// Integer startCompanyId;
// Integer endCompanyId;
}
}
......@@ -1290,6 +1290,14 @@
on sevbr.vehicle_id = vbrs.vehicle_id and sevbr.min_book_start_date = IFNULL(vbrs.actual_start_date, vbrs.book_start_date) and vbrs.status != 4 and vbrs.status != 6
</sql>
<select id="calendarPriceList" resultType="com.xxfc.platform.vehicle.pojo.VehicleBookRecordVO2">
select *,
if(IFNULL(actual_end_date, book_end_date) &lt; #{startDateExtend}, IFNULL(actual_end_date,book_end_date), null) as book_end_date,
if(IFNULL(actual_start_date, book_start_date) &gt; #{endDateExtend}, IFNULL(actual_start_date, book_start_date), null) as book_start_date
from vehicle_book_record
where status != 4 and status != 6
order by book_start_date asc;
</select>
<select id="selectList" resultType="com.xxfc.platform.vehicle.pojo.vo.VehicleVO" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehicleFindDTO">
......
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