Commit ede6a6d5 authored by hanfeng's avatar hanfeng

Merge branch 'base-modify' of http://10.5.52.3/youjj/cloud-platform into base-modify

parents ce85df6c 35df6a5b
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.ace.cache.parser.impl;
import com.ace.cache.constants.CacheScope;
import com.ace.cache.parser.IKeyGenerator;
import com.ace.cache.parser.IUserKeyGenerator;
import com.ace.cache.utils.ReflectionUtils;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class DefaultKeyGenerator extends IKeyGenerator {
@Autowired(
required = false
)
private IUserKeyGenerator userKeyGenerator;
public DefaultKeyGenerator() {
}
public String buildKey(String key, CacheScope scope, Class<?>[] parameterTypes, Object[] arguments) {
boolean isFirst = true;
if (key.indexOf("{") > 0) {
key = key.replace("{", ":{");
Pattern pattern = Pattern.compile("\\d+\\.?[\\w]*");
Matcher matcher = pattern.matcher(key);
while(matcher.find()) {
String tmp = matcher.group();
String[] express = matcher.group().split("\\.");
String i = express[0];
int index = Integer.parseInt(i) - 1;
Object value = arguments[index];
if (parameterTypes[index].isAssignableFrom(List.class)) {
List result = (List)arguments[index];
if(null != result) {
value = result.get(0);
}
}
if (value == null || value.equals("null")) {
value = "";
}
if (express.length > 1) {
String field = express[1];
value = ReflectionUtils.getFieldValue(value, field);
}
if (isFirst) {
key = key.replace("{" + tmp + "}", value.toString());
} else {
key = key.replace("{" + tmp + "}", "_" + value.toString());
}
}
}
return key;
}
public IUserKeyGenerator getUserKeyGenerator() {
return this.userKeyGenerator;
}
}
......@@ -11,6 +11,7 @@ import com.github.wxiaoqi.security.admin.vo.InviteMemberVo;
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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.aop.framework.AopContext;
......@@ -33,6 +34,7 @@ import java.util.stream.Collectors;
* @date 2019-07-03 16:36:44
*/
@Service
@Slf4j
public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRelation> {
@Autowired
......@@ -56,6 +58,10 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
* @param parentId
*/
public void bindRelation(Integer userId,Integer parentId,Integer type){
if (userId==parentId){
log.info("----userId==="+userId+"----parentId===="+parentId+"----自己不能成为自己的上线");
return;
}
AppUserRelation relation=getMyBiz().getRelationByUserId(parentId);
if(relation==null){
relation=new AppUserRelation();
......@@ -265,9 +271,14 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
}
public void deleteByMemberIds(Collection<Integer> userIds) {
Example example = new Example(AppUserRelation.class);
Example example = new Example(AppUserRelation.class);
Example.Criteria criteria = example.createCriteria();
criteria.andIn("userId",userIds);
criteria.andIn("parentId",userIds);
mapper.deleteByExample(example);
Example example2 = new Example(AppUserRelation.class);
Example.Criteria criteria1 = example2.createCriteria();
criteria1.andIn("userId",userIds);
mapper.deleteByExample(example2);
}
}
\ No newline at end of file
......@@ -16,9 +16,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -26,6 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.List;
/**
......@@ -72,19 +71,20 @@ public class UserMemberAdminController {
@ApiOperation("会员excel模板下载")
@GetMapping(value = "/app/unauth/user/excel_model/dowload",produces = "application/vnd.ms-excel")
public ResponseEntity<byte[]> dowloadUserMemberExcelModel(HttpServletResponse response){
// 重置response
response.reset();
response.setCharacterEncoding("utf-8");
// response.setContentType("application/vnd.ms-excel");
@GetMapping(value = "/app/unauth/user/excel_model/dowload")
public ResponseEntity<byte[]> dowloadUserMemberExcelModel(){
response.addHeader("Content-Disposition", "attachment;filename=usermember.xlsx");
HttpHeaders headers = new HttpHeaders();
// headers.add("Content-Disposition","attachment;filename=usermember.xlsx");
// headers.add("Content-Type","application/vnd.ms-excel");
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
headers.setContentDisposition(ContentDisposition.builder("attachment").filename("usermember.xlsx", Charset.forName("UTF-8")).build());
InputStream inputStream = AdminBootstrap.class.getClassLoader().getResourceAsStream("file/usermember.xlsx");
try {
response.setContentLength(inputStream.available());
headers.setContentLength(Long.valueOf(inputStream.available()));
byte[] bytes = IOUtils.toByteArray(inputStream);
return ResponseEntity.ok(bytes);
inputStream.close();
return new ResponseEntity<>(bytes,headers,HttpStatus.OK);
} catch (IOException e) {
e.printStackTrace();
}
......
package com.github.wxiaoqi.security.api.vo.config;
import feign.Logger;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
......@@ -38,6 +36,4 @@ public class HeaderConfig implements RequestInterceptor {
}
}
}
}
......@@ -27,38 +27,43 @@ import java.util.Map;
* @date 2019-06-03 15:57:13
*/
@Service
public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
public class CofigBiz extends BaseBiz<CofigMapper, Cofig> {
public List<Cofig> getConfigByType(List<Integer> list){
return mapper.getAllByType(list);
public List<Cofig> getConfigByType(List<Integer> list) {
Example example = new Example(Cofig.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel", 0);
criteria.andIn("type", list);
return mapper.selectByExample(example);
}
/**
* 修改配置
*
* @param cofig
* @return
*/
@CacheClear(pre = "app:withdrawrule{1.type}")
public int updateConfig(Cofig cofig) {
EntityUtils.setUpdatedInfo(cofig);
return mapper.updateByPrimaryKeySelective(cofig);
return mapper.updateByPrimaryKeySelective(cofig);
}
@Cache(key = "app:withdrawrule:88")
public WithDrawRuleVo getWithDrawRule(){
public WithDrawRuleVo getWithDrawRule() {
WithDrawRuleVo withDrawRuleVo = new WithDrawRuleVo();
Example example = new Example(Cofig.class);
Example example = new Example(Cofig.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("type",88);
criteria.andEqualTo("type", 88);
List<Cofig> cofigs = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(cofigs)){
if (CollectionUtils.isEmpty(cofigs)) {
return withDrawRuleVo;
}
Cofig cofig = cofigs.get(0);
withDrawRuleVo = JSON.parseObject(cofig.getParams(),WithDrawRuleVo.class);
withDrawRuleVo.setDescription(cofig.getValue());
return withDrawRuleVo;
withDrawRuleVo = JSON.parseObject(cofig.getParams(), WithDrawRuleVo.class);
withDrawRuleVo.setDescription(cofig.getValue());
return withDrawRuleVo;
}
public void updateConfigStatus(int id) {
......@@ -72,10 +77,10 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
Query query = new Query(params);
Example example = new Example(Cofig.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
criteria.andEqualTo("isDel", 0);
PageDataVO<Cofig> cofigPage = PageDataVO.pageInfo(query.getPage(), query.getLimit(), () -> mapper.selectByExample(example));
return new TableResultResponse<>(cofigPage.getTotalCount(),cofigPage.getData()) ;
return new TableResultResponse<>(cofigPage.getTotalCount(), cofigPage.getData());
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ public enum ItemTypeEnum {
TOUR_CHILD(202, "旅游儿童"),
TOUR_INSURE(203, "旅游保险"),
MEMBER(301, "会员"),
ACCOMPANY(104, "随车物品"),
;
/**
* 编码
......
......@@ -4,6 +4,9 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
import com.xxfc.platform.vehicle.constant.AccompanyingItemType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -50,10 +53,10 @@ public class OrderItem implements Serializable {
private String name;
/**
* item 类型 1--租车车型 2--车损免赔 3--司机费用 4--旅游项目 5--旅游保险 6--会员
* item 类型 ,详见{@link ItemTypeEnum}
*/
@Column(name = "type")
@ApiModelProperty(value = "item 类型 1--租车车型 2--车损免赔 3--司机费用 4--旅游项目 5--旅游保险 6--会员")
@ApiModelProperty(value = "item 类型 1--租车车型 2--车损免赔 3--司机费用 4--旅游项目 5--旅游保险 6--会员 7--随车物品")
private Integer type;
/**
......@@ -126,6 +129,10 @@ public class OrderItem implements Serializable {
@ApiModelProperty(value = "订单id")
private Integer orderId;
@Column(name = "detail")
@ApiModelProperty(value = "描述、详情")
private String detail;
public Integer getCalculateNum() {
return buyNum - cutNum;
......
package com.xxfc.platform.order.pojo;
import com.xxfc.platform.activity.entity.ActivityPopularizeItem;
import com.xxfc.platform.vehicle.constant.AccompanyingItemType;
import com.xxfc.platform.vehicle.entity.AccompanyingItem;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -8,6 +11,8 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;
@Data
public class AddRentVehicleDTO extends AddOrderCommonDTO{
......@@ -100,6 +105,12 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
@ApiModelProperty(value = "优惠卷卷号")
private String tickerNos;
@ApiModelProperty(value = "随车物品")
private List<String> accompanyStrs;
@ApiModelProperty(value = "随车物品", hidden = true)
private List<OrderAccompanyDTO> accompanyItems;
public void setStartTime(Long startTime) {
this.startTime = startTime;
this.bookStartDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
......@@ -109,4 +120,20 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
this.endTime = endTime;
this.bookEndDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(endTime), ZoneOffset.ofHours(8)));
}
public void setAccompanyStrs(List<String> accompanyStrs) {
this.accompanyStrs = accompanyStrs;
if(null != accompanyStrs) {
this.accompanyItems = this.accompanyStrs.parallelStream().map(str -> {
String[] strs = str.split(",");
if(strs.length < 2) {
return null;
}
OrderAccompanyDTO item = new OrderAccompanyDTO();
item.setId(Integer.valueOf(strs[0]));
item.setNum(Integer.valueOf(strs[1]));
return item;
}).collect(Collectors.toList());
}
}
}
package com.xxfc.platform.order.pojo;
import com.xxfc.platform.vehicle.entity.AccompanyingItem;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class OrderAccompanyDTO {
/**
* 物品id
*/
private Integer id;
/**
* 物品名称
*/
private String name;
/**
* 物品数量
*/
private Integer num;
/**
* 物品单位
*/
private String unit;
/**
* 物品单价
*/
private BigDecimal unitPrice;
/**
* 物品总价
*/
private BigDecimal totalAmount;
}
......@@ -24,4 +24,7 @@ public class OrderAboutParamDTO {
@ApiModelProperty(value = "免赔费用")
private BigDecimal damageSafe;
// @ApiModelProperty(value = "违章保留金")
// private BigDecimal ;
}
\ No newline at end of file
package com.xxfc.platform.order.pojo.order;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderMemberDetail;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.entity.OrderTourDetail;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import lombok.Data;
......@@ -24,8 +21,14 @@ public class OrderPageVO extends BaseOrder {
List<VehicleUserLicense> vehicleUserLicenses;
/**
* 用户名
*/
private String username;
/**
* 车牌
*/
private String vehicalNumberPlat;
private String qrcodeStr;
......@@ -35,8 +38,13 @@ public class OrderPageVO extends BaseOrder {
*/
private BigDecimal illegalReserve;
/**
* 出交车记录
*/
private OrderVehicleCrosstownDto orderVehicleCrosstownDto;
private List<OrderItem> items;
public void setQrcodeStr(String prefix) {
this.qrcodeStr = prefix+ "?"+ TYPE+ getType()+ "&"+ NO+ getNo();
}
......
......@@ -6,6 +6,7 @@ import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.inter.OrderDetail;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.pojo.OrderAccompanyDTO;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.pojo.BookVehicleVO;
import io.swagger.annotations.ApiModelProperty;
......@@ -38,4 +39,7 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
* 订单子项
*/
List<OrderItem> items;
@ApiModelProperty(value = "随车物品", hidden = true)
private List<OrderAccompanyDTO> accompanyItems;
}
......@@ -61,6 +61,7 @@ public class OrderRentVehicleController extends CommonBaseController {
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData());
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())?
StrUtil.splitTrim(vo.getTickerNos(), ","):null);
bo.setAccompanyItems(vo.getAccompanyItems());
orderRentVehicleService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder());
}
......
......@@ -3,6 +3,7 @@ package com.xxfc.platform.order.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
......@@ -23,16 +24,19 @@ import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.OrderTemplate;
import com.xxfc.platform.order.pojo.OrderAccompanyDTO;
import com.xxfc.platform.order.pojo.order.RentVehicleBO;
import com.xxfc.platform.order.pojo.price.RentVehiclePriceVO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.entity.AccompanyingItem;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.RentVehicleBookDTO;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -40,15 +44,13 @@ import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.contant.enumerate.ItemTypeEnum.*;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
@Service
......@@ -154,9 +156,30 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo(), bo.getOrder().getNo(), channel, amount, ActivityFeign.TYPE_USE);
}
//插入随声物品item
Map<String, AccompanyingItemVo> accompanyingItemMap = vehicleFeign.listAccompanyingItem().getData()
.parallelStream().collect(Collectors.toMap(en -> en.getId().toString(), en -> en));
if(null == bo.getAccompanyItems()) {
bo.setAccompanyItems(new ArrayList<OrderAccompanyDTO>());
}
for(OrderAccompanyDTO oad : bo.getAccompanyItems()) {
AccompanyingItemVo aiv = accompanyingItemMap.get(oad.getId().toString());
oad.setName(aiv.getName());
oad.setUnit(aiv.getUnit());
oad.setUnitPrice(aiv.getPrice());
oad.setNum(aiv.getNumber());
oad.setTotalAmount(oad.getUnitPrice().multiply(new BigDecimal(oad.getNum().toString())));
}
//获取可用车辆
acquireVehicle(bo);
OrderItem accompanyItem = orderItemBiz.initOrderItem(BigDecimal.ZERO, 1, "随车物品", null, ACCOMPANY);
accompanyItem.setRealAmount(BigDecimal.ZERO);
accompanyItem.setDetail(JSONUtil.toJsonStr(bo.getAccompanyItems()));
accompanyItem.setOrderId(bo.getOrder().getId());
orderItemBiz.insertSelective(accompanyItem);
super.handleDetail(bo);
//发送定时取消订单(数据字典设置--5分钟)
......@@ -380,6 +403,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rentVehicleBookDTO.setUserName(BaseContextHandler.getName());
rentVehicleBookDTO.setLiftCompany(detail.getStartCompanyId());
rentVehicleBookDTO.setLiftAddr(detail.getStartAddr());
if(null != detail.getAccompanyItems()) {
rentVehicleBookDTO.setSelectedAccItem(detail.getAccompanyItems().parallelStream().collect(Collectors.toMap(OrderAccompanyDTO::getId, OrderAccompanyDTO::getNum)));
}
ObjectRestResponse<VehicleBookRecord> orr = vehicleFeign.rentApplyVehicle(rentVehicleBookDTO);
if(!CommonConstants.SYS_JSON_TRUE.equals(orr.getStatus())) {
throw new BaseException(orr.getMessage(), orr.getStatus());
......
......@@ -192,7 +192,6 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
List<GoodSpePriceDTO> priceDTOList=dto.getPriceDTOS();
List<Integer> prices=new ArrayList<>();
if(siteDTOList.size()>0){
List<Integer> priceIds=new ArrayList<>();
for (GoodSpePriceDTO priceDTO:priceDTOList){
Integer priceId=priceDTO.getId();
TourGoodSpePrice spePrice=new TourGoodSpePrice();
......@@ -228,12 +227,11 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
priceId=spePrice.getId();
}else {
speBiz.updateSelectiveById(spePrice);
priceIds.add(priceId);
}
prices.add(priceId);
}
if(priceIds.size()>0){
speBiz.delGoodSpe(goodId,priceIds);
if(prices.size()>0){
speBiz.delGoodSpe(goodId,prices);
}
}
if(sites.size()>0){
......
......@@ -32,6 +32,39 @@ public class SmsTemplateDTO {
//取消订单
public static final int CANCEL = 8;
//租车(通用)
public static final int PAY_A = 10;
//租车(使用会员权益)
public static final int PAY_B = 11;
//租车内部通知(客服)
public static final int PAY_C = 12;
//租车内部通知(出车人)
public static final int PAY_D = 13;
//租车内部通知(收车人)
public static final int PAY_E = 14;
//旅游(通用)
public static final int PAY_F = 15;
//会员购买(通用)
public static final int PAY_G = 16;
//取消租车(通用)
public static final int CANCEL_A = 17;
//取消租车(使用会员权益)
public static final int CANCEL_B = 18;
//取消租车(通用扣违约金)
public static final int CANCEL_C = 19;
//取消租车(会员权益&扣违)
public static final int CANCEL_D = 20;
//取消租车(出车人)
public static final int CANCEL_E = 21;
//租车押金退还
public static final int FINISH_A = 22;
//违章押金退还
public static final int FINISH_B = 23;
//类型:1-租车订单通知(普通用户),2-租车订单短信(会员权益),3-旅游订单短信,4-加入会员通知
private Integer type;
//手机号码(多个短信逗号隔开)
......
......@@ -23,10 +23,45 @@ public class CCPRestSmsBiz{
public static final String TEMPLATE_ID_DIFFERENT_TAAKE_CAR = "458621";
// 租/还车公司不同(发给还车公司负责人,订单出车后发))(相同不发)7
public static final String TEMPLATE_ID_ALSO_CAR = "458620";
//取消订单8
//取消订单9
public static final String TEMPLATE_ID_CANCEL = "458627";
//租车(通用)10
public static final String TEMPLATE_ID_PAY_A = "460759";
//租车(使用会员权益)11
public static final String TEMPLATE_ID_PAY_B = "460760";
//租车内部通知(客服)12
public static final String TEMPLATE_ID_PAY_C = "460763";
//租车内部通知(出车人)13
public static final String TEMPLATE_ID_PAY_D = "460762";
//租车内部通知(收车人)14
public static final String TEMPLATE_ID_PAY_E = "460764";
//旅游(通用)15
public static final String TEMPLATE_ID_PAY_F = "460765";
//会员购买(通用)16
public static final String TEMPLATE_ID_PAY_G = "460766";
//取消租车(通用)17
public static final String TEMPLATE_ID_CANCEL_A= "460767";
//取消租车(使用会员权益)18
public static final String TEMPLATE_ID_CANCEL_B = "460768";
//取消租车(通用扣违约金)19
public static final String TEMPLATE_ID_CANCEL_C = "460769";
//取消租车(会员权益&扣违 20
public static final String TEMPLATE_ID_CANCEL_D = "460770";
//取消租车(出车人)21
public static final String TEMPLATE_ID_CANCEL_E = "460771";
//租车押金退还 22
public static final String TEMPLATE_ID_FINISH_A = "460772";
//违章押金退还 23
public static final String TEMPLATE_ID_FINISH_B = "460773";
//发送模板消息
public void sendTemplateSMS(Integer type,String phoneNumbers,String[]params){
switch (type){
......@@ -54,6 +89,49 @@ public class CCPRestSmsBiz{
case 8 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL);
break;
case 10 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_A);
break;
case 11:
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_B);
break;
case 12 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_C);
break;
case 13 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_D);
break;
case 14 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_E);
break;
case 15 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_F);
break;
case 16 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_G);
break;
case 17 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_A);
break;
case 18 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_B);
break;
case 19 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_C);
break;
case 20 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_D);
break;
case 21 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_E);
break;
case 22 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_FINISH_A);
break;
case 23 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_FINISH_B);
break;
}
}
......
......@@ -85,6 +85,8 @@ public class RedisKey {
// 随车物品相关key
public static final String ACCOMPANYING_ITEM_CACHE_ALL ="cache:accompanyItem:all";
public static final String ACCOMPANYING_ITEM_CACHE_ALL_APP =ACCOMPANYING_ITEM_CACHE_ALL+ ":app";
/**
* 服务器上传文件序号
......
......@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
......@@ -109,4 +110,8 @@ public interface VehicleFeign {
@GetMapping("/city/corporationCity")
ObjectRestResponse<Set<Integer>> corporationCity( @RequestParam(value = "zoneList") String zoneList,
@RequestParam(value = "companyList") String companyList);
@GetMapping("/accompanyingItem/app/unauth/items")
public RestResponse<List<AccompanyingItemVo>> listAccompanyingItem();
}
......@@ -67,7 +67,7 @@ public class BookVehicleVO {
* 随车物品id以及数量 List<Map<id,数量>>
*/
@ApiModelProperty("随车物品id以及数量 List<Map<id,数量>>")
Map<Integer,Integer> selectedAccItem;
Map<Integer,Integer> selectedAccItem;
/**
* 提车阶段里程数
......
......@@ -4,6 +4,9 @@ import com.github.wxiaoqi.security.common.vo.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class RentVehicleBookDTO extends PageParam {
//根据车型、时间、距离,门店,预定车辆
......@@ -47,4 +50,10 @@ public class RentVehicleBookDTO extends PageParam {
@ApiModelProperty("订单号")
private String orderNo;
/**
* 随车物品id以及数量 List<Map<id,数量>>
*/
@ApiModelProperty("随车物品id以及数量 List<Map<id,数量>>")
Map<Integer,Integer> selectedAccItem;
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package com.xxfc.platform.vehicle.biz;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
......@@ -16,20 +18,30 @@ import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
public class AccompanyingItemBiz extends BaseBiz<AccompanyingItemMapper, AccompanyingItem> {
@Autowired
private RedisTemplate redisTemplate;
@Resource(name = "redisTemplate")
HashOperations itemHashOperations;
private static final String ACCOMPANY_ITEM="accompany:item";
@Cache(key = RedisKey.ACCOMPANYING_ITEM_CACHE_ALL)
public List<AccompanyingItem> getAll(){
......@@ -75,6 +87,7 @@ public class AccompanyingItemBiz extends BaseBiz<AccompanyingItemMapper, Accompa
accompanyingItem.setId(null);
BeanUtils.copyProperties(accompanyingItem,addOrUpdateAccompanyingItem);
Integer effected = mapper.insertSelective(accompanyingItem);
redisTemplate.delete(ACCOMPANY_ITEM);
return RestResponse.suc();
}
......@@ -83,21 +96,40 @@ public class AccompanyingItemBiz extends BaseBiz<AccompanyingItemMapper, Accompa
AccompanyingItem accompanyingItem = new AccompanyingItem();
BeanUtils.copyProperties(accompanyingItem,addOrUpdateAccompanyingItem);
Integer effected = mapper.updateByPrimaryKeySelective(accompanyingItem);
redisTemplate.delete(ACCOMPANY_ITEM);
return RestResponse.suc();
}
@CacheClear(key= RedisKey.ACCOMPANYING_ITEM_CACHE_ALL)
public RestResponse<Integer> del(Integer id){
Integer effected = mapper.deleteByPrimaryKey(id);
redisTemplate.delete(ACCOMPANY_ITEM);
return RestResponse.suc();
}
public List<AccompanyingItemVo> listAllItem(){
public List<AccompanyingItemVo> listAllItem(List<Integer> types){
String typeKey = null;
if (CollectionUtils.isNotEmpty(types)){
typeKey = types.stream().sorted(Integer::compareTo).map(String::valueOf).reduce("",(x, y)-> x+":"+y);
String itemJson = (String) itemHashOperations.get(ACCOMPANY_ITEM,typeKey);
if (!StringUtils.isEmpty(itemJson)){
return JSON.parseObject(itemJson,new TypeReference<List<AccompanyingItemVo>>(){});
}
}
if (CollectionUtils.isEmpty(types)){
typeKey= "all";
String itemJson = (String) itemHashOperations.get(ACCOMPANY_ITEM, typeKey);
if (!StringUtils.isEmpty(itemJson)){
return JSON.parseObject(itemJson,new TypeReference<List<AccompanyingItemVo>>(){});
}
}
List<AccompanyingItemVo> accompanyingItemVos = new ArrayList<>();
Example example = new Example(AccompanyingItem.class);
Example.Criteria criteria = example.createCriteria();
if (CollectionUtils.isNotEmpty(types)){
criteria.andIn("type",types);
}
criteria.andEqualTo("isDel",0);
List<AccompanyingItem> accompanyingItems = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(accompanyingItems)){
......@@ -109,7 +141,7 @@ public class AccompanyingItemBiz extends BaseBiz<AccompanyingItemMapper, Accompa
org.springframework.beans.BeanUtils.copyProperties(item, accompanyingItemVo);
return accompanyingItemVo;
}).sorted(Comparator.comparing(AccompanyingItemVo::getType).thenComparing(AccompanyingItemVo::getRank)).collect(Collectors.toList());
itemHashOperations.put(ACCOMPANY_ITEM,typeKey,JSON.toJSONString(accompanyingItemVoList));
return accompanyingItemVoList;
}
......
......@@ -16,6 +16,7 @@ import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;
/**
......@@ -75,7 +76,13 @@ public class AccompanyingItemController extends BaseController<AccompanyingItemB
@GetMapping("/app/unauth/items")
public RestResponse<List<AccompanyingItemVo>> listAccompanyingItemVo(){
List<AccompanyingItemVo> accompanyingItemVos = baseBiz.listAllItem();
List<AccompanyingItemVo> accompanyingItemVos = baseBiz.listAllItem(Collections.EMPTY_LIST);
return RestResponse.codeAndData(RestResponse.SUC_CODE,accompanyingItemVos);
}
@GetMapping("/app/unauth/type_items")
public RestResponse<List<AccompanyingItemVo>> listAccompanyingItemVoByTypes(@RequestParam(value = "type",required = false) List<Integer> type){
List<AccompanyingItemVo> accompanyingItemVos = baseBiz.listAllItem(type);
return RestResponse.codeAndData(RestResponse.SUC_CODE,accompanyingItemVos);
}
}
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