Commit c4128cf8 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents f73c4893 d666fd8c
...@@ -18,7 +18,7 @@ import lombok.NoArgsConstructor; ...@@ -18,7 +18,7 @@ import lombok.NoArgsConstructor;
public class CustomerServiceDTO { public class CustomerServiceDTO {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String id; private Long id;
/** /**
* 客服名称 * 客服名称
......
package com.xxfc.platform.im.model; package com.xxfc.platform.im.entity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.mongodb.morphia.annotations.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field; import org.springframework.data.mongodb.core.mapping.Field;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Table;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
...@@ -18,11 +23,15 @@ import org.springframework.data.mongodb.core.mapping.Field; ...@@ -18,11 +23,15 @@ import org.springframework.data.mongodb.core.mapping.Field;
@Builder(toBuilder = true) @Builder(toBuilder = true)
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Entity
@Table(name = "customer_service")
@Document(collection = "customer_service") @Document(collection = "customer_service")
public class CustomerService { public class CustomerService {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
private String id; @javax.persistence.Id
@GeneratedValue(generator = "JDBC")
private Long id;
/** /**
* 客服名称 * 客服名称
*/ */
...@@ -35,21 +44,25 @@ public class CustomerService { ...@@ -35,21 +44,25 @@ public class CustomerService {
* App id * App id
*/ */
@Field("app_user_id") @Field("app_user_id")
@Column(name = "app_user_id")
private Integer appUserId; private Integer appUserId;
/** /**
* im id * im id
*/ */
@Field("im_user_id") @Field("im_user_id")
@Column(name = "im_user_id")
private Integer imUserId; private Integer imUserId;
/** /**
* 区域id * 区域id
*/ */
@Field("area_id") @Field("area_id")
@Column(name = "area_id")
private Integer areaId; private Integer areaId;
/** /**
* 区域名称 * 区域名称
*/ */
@Field("area_name") @Field("area_name")
@Column(name = "area_name")
private String areaName; private String areaName;
/** /**
* 问候语句 * 问候语句
...@@ -63,16 +76,23 @@ public class CustomerService { ...@@ -63,16 +76,23 @@ public class CustomerService {
* 客服电话 * 客服电话
*/ */
private String telphone; private String telphone;
/**
* 登录密码
*/
private String password;
/** /**
* 是事删除 true:删除状态 1:正常 * 是事删除 true:删除状态 1:正常
*/ */
@Field("is_del") @Field("is_del")
@Column(name = "is_del")
private Boolean isDel; private Boolean isDel;
@Field("create_time") @Field("create_time")
@Column(name = "create_time")
private Long createTime; private Long createTime;
@Field("update_time") @Field("update_time")
@Column(name = "update_time")
private Long updateTime; private Long updateTime;
} }
...@@ -20,7 +20,7 @@ import java.io.Serializable; ...@@ -20,7 +20,7 @@ import java.io.Serializable;
public class CustomerServiceVO implements Serializable { public class CustomerServiceVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String id; private Long id;
/** /**
* 客服名称 * 客服名称
......
package com.xxfc.platform.im.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.xxfc.platform.im.dto.CustomerServiceDTO;
import com.xxfc.platform.im.entity.CustomerService;
import com.xxfc.platform.im.model.User;
import com.xxfc.platform.im.repos.CustomerServiceRepository;
import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
import static org.springframework.data.mongodb.core.query.Query.query;
import static org.springframework.data.mongodb.core.query.Update.update;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/5 9:49
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CustomerServiceMGBiz {
private final static String INIT_PASSWORD="12345678";
private final static String NICK_PRE_NAME="XXKF";
private final CustomerServiceRepository customerServiceRepository;
private final MongoTemplate mongoTemplate;
private final UserBiz userBiz;
public CustomerServiceVO findById(String id){
CustomerServiceVO customerServiceVO = new CustomerServiceVO();
customerServiceRepository.findById(id).ifPresent(customerService -> {
BeanUtils.copyProperties(customerService,customerServiceVO);
});
Map<Integer, User> imMap = userBiz.findAllByImUserIds(Arrays.asList(customerServiceVO.getImUserId()));
User user = imMap.get(customerServiceVO.getImUserId());
customerServiceVO.setPassword(user.getPassword());
return customerServiceVO;
}
/**
* 添加客服
* @param customerServiceDTO
*/
public void addCustomerService(CustomerServiceDTO customerServiceDTO){
CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO,customerService);
customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s",NICK_PRE_NAME,customerServiceDTO.getTelphone()));
customerService.setIsDel(false);
Map<String,Object> imMap = new HashMap<>(2);
imMap.put("telephone",customerServiceDTO.getTelphone());
imMap.put("password",INIT_PASSWORD);
imMap.put("nickname",customerService.getName());
BaseResponse imResponse = userBiz.register(imMap);
String imResult = imResponse.getMessage();
JSONObject jsonObject = JSON.parseObject(imResult);
Map<String,Object> data = (Map<String, Object>) jsonObject.get("data");
Object userId = data.get("userId");
if (Objects.isNull(userId)){
throw new BaseException("注册失败");
}
customerService.setImUserId((Integer)userId);
customerServiceRepository.save(customerService);
}
/**
* 1: mongoTemplate.find(Query.query(Criteria.where("isDel").is(false)), CustomerService.class);
*
* 2. customerServiceRepository.findByIsDelEquals(false);
* @return
*/
public List<CustomerServiceVO> findAll() {
List<CustomerServiceVO> customerServiceVOS = new ArrayList<>();
CustomerService customer_service = new CustomerService();
Example<CustomerService> customerServiceExample = Example.of(customer_service, ExampleMatcher.matchingAll());
List<CustomerService> customerServices = customerServiceRepository.findAll(customerServiceExample);
CustomerServiceVO customerServiceVO;
if (CollectionUtils.isNotEmpty(customerServices)){
List<Integer> imUserIds = customerServices.stream().map(CustomerService::getImUserId).collect(Collectors.toList());
Map<Integer, User> imMap = userBiz.findAllByImUserIds(imUserIds);
for (CustomerService customerService : customerServices) {
customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService,customerServiceVO);
User user = imMap.get(customerService.getImUserId());
if (Objects.nonNull(user)){
customerServiceVO.setPassword(user.getPassword());
}
customerServiceVOS.add(customerServiceVO);
}
}
return customerServiceVOS;
}
/**
* 删除客服
* @param id
* @param imUserId
*/
public void updateCustomerServiceIsDelToTrue(String id,Integer imUserId){
Query query = query(Criteria.where("_id").is(id));
Update update = update("is_del", true).set("update_time",Instant.now().toEpochMilli());
mongoTemplate.updateFirst(query, update, Map.class, "customer_service");
userBiz.deleteById(imUserId);
}
}
package com.xxfc.platform.im.mapper;
import com.xxfc.platform.im.entity.CustomerService;
import tk.mybatis.mapper.common.Mapper;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/9 9:55
*/
public interface CustomerServiceMapper extends Mapper<CustomerService> {
}
package com.xxfc.platform.im.repos; package com.xxfc.platform.im.repos;
import com.xxfc.platform.im.model.CustomerService; import com.xxfc.platform.im.entity.CustomerService;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query; import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.im.rest; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.im.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.im.biz.CustomerServiceBiz; import com.xxfc.platform.im.biz.CustomerServiceBiz;
import com.xxfc.platform.im.biz.CustomerServiceMGBiz;
import com.xxfc.platform.im.vo.CustomerServiceVO; import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,16 +23,19 @@ import java.util.List; ...@@ -22,16 +23,19 @@ import java.util.List;
@RequiredArgsConstructor(onConstructor = @__(@Autowired)) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/app/unauth/customer_service") @RequestMapping("/app/unauth/customer_service")
public class CustomerServiceController { public class CustomerServiceController {
private final CustomerServiceMGBiz customerServiceMGBiz;
private final CustomerServiceBiz customerServiceBiz; private final CustomerServiceBiz customerServiceBiz;
@GetMapping("/list") @GetMapping("/list")
public ObjectRestResponse<List<CustomerServiceVO>> findAll(){ public ObjectRestResponse<List<CustomerServiceVO>> findAll(){
// List<CustomerServiceVO> customerServiceVOS = customerServiceMGBiz.findAll();
List<CustomerServiceVO> customerServiceVOS = customerServiceBiz.findAll(); List<CustomerServiceVO> customerServiceVOS = customerServiceBiz.findAll();
return ObjectRestResponse.succ(customerServiceVOS); return ObjectRestResponse.succ(customerServiceVOS);
} }
@GetMapping("/{id}") @GetMapping("/{id}")
public ObjectRestResponse<CustomerServiceVO> findById(@PathVariable(value = "id") String id){ public ObjectRestResponse<CustomerServiceVO> findById(@PathVariable(value = "id") Long id){
// CustomerServiceVO customerServiceVO = customerServiceMGBiz.findById(id);
CustomerServiceVO customerServiceVO = customerServiceBiz.findById(id); CustomerServiceVO customerServiceVO = customerServiceBiz.findById(id);
return ObjectRestResponse.succ(customerServiceVO); return ObjectRestResponse.succ(customerServiceVO);
} }
......
package com.xxfc.platform.im.rest.admin; package com.xxfc.platform.im.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.im.biz.CustomerServiceBiz; import com.xxfc.platform.im.biz.CustomerServiceBiz;
import com.xxfc.platform.im.biz.CustomerServiceMGBiz;
import com.xxfc.platform.im.biz.UserBiz; import com.xxfc.platform.im.biz.UserBiz;
import com.xxfc.platform.im.dto.CustomerServiceDTO; import com.xxfc.platform.im.dto.CustomerServiceDTO;
import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -19,13 +22,28 @@ import org.springframework.web.bind.annotation.*; ...@@ -19,13 +22,28 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/admin/customer_service") @RequestMapping("/admin/customer_service")
public class CustomerServiceAdminController { public class CustomerServiceAdminController {
private final CustomerServiceMGBiz customerServiceMGBiz;
private final CustomerServiceBiz customerServiceBiz; private final CustomerServiceBiz customerServiceBiz;
private final UserBiz userBiz; private final UserBiz userBiz;
@GetMapping("/page")
public ObjectRestResponse<PageDataVO<CustomerServiceVO>> findCustomerServiceWithPage(@RequestParam(value = "page") Integer page,
@RequestParam(value = "limit") Integer limit) {
PageDataVO<CustomerServiceVO> pageDataVO = customerServiceBiz.findCustomerServiceWithPage(page,limit);
return ObjectRestResponse.succ(pageDataVO);
}
@GetMapping("/{id}")
public ObjectRestResponse<CustomerServiceDTO> findCustomerService(@PathVariable(value = "id") Long id){
CustomerServiceDTO customerServiceDTO = customerServiceBiz.findCustomerServiceById(id);
return ObjectRestResponse.succ(customerServiceDTO);
}
@PostMapping("/add") @PostMapping("/add")
public ObjectRestResponse<Void> addCustomerService(@RequestBody CustomerServiceDTO customerServiceDTO){ public ObjectRestResponse<Void> addCustomerService(@RequestBody CustomerServiceDTO customerServiceDTO){
// customerServiceMGBiz.addCustomerService(customerServiceDTO);
customerServiceBiz.addCustomerService(customerServiceDTO); customerServiceBiz.addCustomerService(customerServiceDTO);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -34,12 +52,14 @@ public class CustomerServiceAdminController { ...@@ -34,12 +52,14 @@ public class CustomerServiceAdminController {
public ObjectRestResponse<Void> updateCustomerService(@PathVariable(value = "telphone") String telphone, public ObjectRestResponse<Void> updateCustomerService(@PathVariable(value = "telphone") String telphone,
@PathVariable(value = "password") String password){ @PathVariable(value = "password") String password){
userBiz.updatePasswordByPhone(telphone,password); userBiz.updatePasswordByPhone(telphone,password);
customerServiceBiz.updatePasswordByPhone(telphone,password);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@DeleteMapping("/delete/{id}/{imUserId}") @DeleteMapping("/delete/{id}/{imUserId}")
public ObjectRestResponse<Void> deleteCustomerService(@PathVariable(value = "id") String id, public ObjectRestResponse<Void> deleteCustomerService(@PathVariable(value = "id") Long id,
@PathVariable(value = "imUserId") Integer imUserId){ @PathVariable(value = "imUserId") Integer imUserId){
// customerServiceMGBiz.updateCustomerServiceIsDelToTrue(id,imUserId);
customerServiceBiz.updateCustomerServiceIsDelToTrue(id,imUserId); customerServiceBiz.updateCustomerServiceIsDelToTrue(id,imUserId);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
...@@ -121,6 +121,11 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -121,6 +121,11 @@ public class BackStageOrderController extends CommonBaseController implements Us
dto.setCompanyIds(companyIds); dto.setCompanyIds(companyIds);
} }
if (StringUtils.isNotEmpty(dto.getPlateNumber())){
List<String> vehicleIds = vehicleFeign.findbyPlateNumber(dto.getPlateNumber().trim());
dto.setVehicleIds(vehicleIds);
}
Query query = new Query(dto); Query query = new Query(dto);
PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.listOrder(query.getSuper())); PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.listOrder(query.getSuper()));
List<OrderListVo> list = pageDataVO.getData(); List<OrderListVo> list = pageDataVO.getData();
......
...@@ -309,6 +309,13 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -309,6 +309,13 @@ public class BaseOrderController extends CommonBaseController implements UserRes
private String phone; private String phone;
private List<String> vehicleIds;
/**
* 车牌号
*/
private String plateNumber;
@ApiModelProperty("当前页码") @ApiModelProperty("当前页码")
Integer page; Integer page;
@ApiModelProperty("每页限制") @ApiModelProperty("每页限制")
......
...@@ -142,6 +142,11 @@ ...@@ -142,6 +142,11 @@
and (r.start_time between #{startTime} and #{endTime} and (r.start_time between #{startTime} and #{endTime}
or t.start_time between #{startTime} and #{endTime}) or t.start_time between #{startTime} and #{endTime})
</if> </if>
<if test="vehicleIds != null and vehicleIds.size() > 0">
AND r.vehicle_id IN <foreach collection="vehicleIds" item="vehicleId" open="(" close=")" separator=",">
#{vehicleId}
</foreach>
</if>
<if test="companyIds != null and companyIds.size > 0"> <if test="companyIds != null and companyIds.size > 0">
and (r.start_company_id in and (r.start_company_id in
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> <foreach collection="companyIds" item="id" open="(" separator="," close=")">
......
...@@ -36,7 +36,16 @@ ...@@ -36,7 +36,16 @@
LEFT JOIN tour_good_site s ON v.site_id=s.id LEFT JOIN tour_good_site s ON v.site_id=s.id
LEFT JOIN tour_good g ON v.good_id=g.id LEFT JOIN tour_good g ON v.good_id=g.id
LEFT JOIN tour_good_spe_price p ON v.spe_id=p.id LEFT JOIN tour_good_spe_price p ON v.spe_id=p.id
WHERE s.company_id=#{companyId} and v.status=#{orderStatus} and p.start_time=#{travelDate} ORDER BY s.depart_time ) as `goodOrder` WHERE <![CDATA[`total_person`<>0]]>
<if test='companyId !=null'>
and s.company_id=#{companyId}
</if>
<if test="orderStatus!=null">
and v.status=#{orderStatus}
</if>
<if test="travelDate!=null">
and p.start_time=#{travelDate}
</if> ORDER BY s.depart_time ) as `goodOrder`
</select> </select>
<!-- 获取旅游路线id--> <!-- 获取旅游路线id-->
<select id="getGoodList" resultType="com.xxfc.platform.tour.vo.TourVerificationInfoVo"> <select id="getGoodList" resultType="com.xxfc.platform.tour.vo.TourVerificationInfoVo">
......
...@@ -115,7 +115,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -115,7 +115,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
// if (articleList.size() > HOME_PAGE_NUMBER) { // if (articleList.size() > HOME_PAGE_NUMBER) {
// return articleList.subList(0, HOME_PAGE_NUMBER); // return articleList.subList(0, HOME_PAGE_NUMBER);
// } else { // } else {
return articleList; return articleList;
// } // }
// } // }
} }
...@@ -138,13 +138,12 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -138,13 +138,12 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
article.setType(0); article.setType(0);
} }
<<<<<<< HEAD
if (article.getStatus()==1){
article.setAddTime(new Date());
=======
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) { if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo"); throw new BaseException("必须设置seo");
>>>>>>> 13151cd28becd80af54c5e67901b2f7c3e67a966 }
if (article.getStatus()==1){
article.setAddTime(new Date());
} }
article.setCreTime(new Date()); article.setCreTime(new Date());
mapper.insertSelective(article); mapper.insertSelective(article);
...@@ -171,9 +170,9 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -171,9 +170,9 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateSelectiveByIdRe(Article article){ public int updateSelectiveByIdRe(Article article){
article.setUpdTime(new Date()); article.setUpdTime(new Date());
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) { if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo"); throw new BaseException("必须设置seo");
} }
return mapper.updateByPrimaryKeySelective(article); return mapper.updateByPrimaryKeySelective(article);
} }
...@@ -189,7 +188,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -189,7 +188,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
article.setUpdTime(new Date()); article.setUpdTime(new Date());
article.setAddTime(new Date()); article.setAddTime(new Date());
article.setStatus(1); article.setStatus(1);
return mapper.updateByPrimaryKeySelective(article); return mapper.updateByPrimaryKeySelective(article);
} }
/** /**
......
...@@ -16,6 +16,9 @@ import lombok.extern.slf4j.Slf4j; ...@@ -16,6 +16,9 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service @Service
@Slf4j @Slf4j
...@@ -196,12 +199,23 @@ public class SmsService { ...@@ -196,12 +199,23 @@ public class SmsService {
JSONObject jsonParams=new JSONObject(); JSONObject jsonParams=new JSONObject();
for (int i=0;i<params.length;i++){ for (int i=0;i<params.length;i++){
String para=params[i]; String para=params[i];
if (para.contains("【")){ if (StringUtils.isNotBlank(para)){
para=para.replaceAll("【",""); if (para.contains("【")){
} para=para.replaceAll("【","");
if (para.contains("】")){ }
para=para.replaceAll("】",""); if (para.contains("】")){
para=para.replaceAll("】","");
}
if (para.length()>20){
if (isNumeric(para)){
para.substring(0,20);
}else {
para=para.substring(0,18);
para+="..";
}
}
} }
jsonParams.put(param+(i+1),para); jsonParams.put(param+(i+1),para);
} }
sendTemplate(PhoneNumbers,jsonParams.toJSONString(),templateCode); sendTemplate(PhoneNumbers,jsonParams.toJSONString(),templateCode);
...@@ -216,12 +230,24 @@ public class SmsService { ...@@ -216,12 +230,24 @@ public class SmsService {
JSONObject jsonParams=new JSONObject(); JSONObject jsonParams=new JSONObject();
for (int i=0;i<params.length;i++){ for (int i=0;i<params.length;i++){
String para=params[i]; String para=params[i];
if (para.contains("【")){ if (StringUtils.isNotBlank(para)){
para=para.replaceAll("【",""); if (para.contains("【")){
} para=para.replaceAll("【","");
if (para.contains("】")){ }
para=para.replaceAll("】",""); if (para.contains("】")){
para=para.replaceAll("】","");
}
if (para.length()>20){
if (isNumeric(para)){
para.substring(0,20);
}else {
para=para.substring(0,18);
para+="..";
}
}
} }
if (i>3){ if (i>3){
jsonParams.put(param+(i+2),para); jsonParams.put(param+(i+2),para);
}else { }else {
...@@ -236,11 +262,26 @@ public class SmsService { ...@@ -236,11 +262,26 @@ public class SmsService {
} }
/**
* 是否是数字
* @param str
* @return
*/
public static boolean isNumeric(String str){
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(str);
if( !isNum.matches() ){
return false;
}
return true;
}
public static void main(String[] args) throws ClientException, InterruptedException { public static void main(String[] args) throws ClientException, InterruptedException {
SmsService smsService=new SmsService(); SmsService smsService=new SmsService();
//发短信 //发短信
String[] params={"1","2","3","2019-08-29","【松山湖】"}; String[] params={"1","2","3","2019-08-29","【松山湖】"};
SmsService.sendTemplateToJson("13612688539,13265487972",params,"SMS_169904346"); SmsService.sendTemplateToJson("13612688539",params,"SMS_169904346");
/*System.out.println("短信接口返回的数据----------------"); /*System.out.println("短信接口返回的数据----------------");
System.out.println("Code=" + response.getCode()); System.out.println("Code=" + response.getCode());
System.out.println("Message=" + response.getMessage()); System.out.println("Message=" + response.getMessage());
......
...@@ -149,4 +149,7 @@ public interface VehicleFeign { ...@@ -149,4 +149,7 @@ public interface VehicleFeign {
*/ */
@GetMapping("/cata/add/getCatasByIds/{ids}") @GetMapping("/cata/add/getCatasByIds/{ids}")
public ObjectRestResponse<List<VehiclePlatCata>> getCatasByIds(@PathVariable("ids") String ids); public ObjectRestResponse<List<VehiclePlatCata>> getCatasByIds(@PathVariable("ids") String ids);
@GetMapping("/vehicleInfo/findwith_plate_number")
List<String> findbyPlateNumber(@RequestParam(value = "plateNumber") String plateNumber);
} }
package com.xxfc.platform.vehicle.biz; package com.xxfc.platform.vehicle.biz;
import com.ace.cache.annotation.CacheClear;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil; import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.entity.*; import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.mapper.BranchCompanyStockInfoMapper; import com.xxfc.platform.vehicle.mapper.BranchCompanyStockInfoMapper;
import com.xxfc.platform.vehicle.mapper.CompanyBaseMapper; import com.xxfc.platform.vehicle.mapper.CompanyBaseMapper;
...@@ -192,6 +194,7 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> { ...@@ -192,6 +194,7 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
//设置基础信息 //设置基础信息
@CacheClear(pre = RedisKey.BRANCH_COMPANY_CACHE)
public ObjectRestResponse updCompany(CompanyVo companyVo){ public ObjectRestResponse updCompany(CompanyVo companyVo){
if (companyVo==null|| StringUtils.isBlank(companyVo.getCompanyName())|| StringUtils.isBlank(companyVo.getName())|| if (companyVo==null|| StringUtils.isBlank(companyVo.getCompanyName())|| StringUtils.isBlank(companyVo.getName())||
companyVo.getZoneId()==null||companyVo.getZoneId()==0|| companyVo.getAddrProvince()==null||companyVo.getAddrProvince()==0 companyVo.getZoneId()==null||companyVo.getZoneId()==0|| companyVo.getAddrProvince()==null||companyVo.getAddrProvince()==0
......
...@@ -1446,4 +1446,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1446,4 +1446,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
public List<String> findExistVehicleIds() { public List<String> findExistVehicleIds() {
return mapper.findExistVehicleIds(); return mapper.findExistVehicleIds();
} }
public List<String> findVehicleIdsByPlateNumber(String plateNumber) {
List<String> vehicleIds = Lists.newArrayList();
Example example = new Example(Vehicle.class);
Example.Criteria criteria = example.createCriteria();
criteria.andLike("numberPlate",String.format("%%%s%%",plateNumber.trim()));
List<Vehicle> vehicles = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(vehicles)){
return vehicleIds;
}
return vehicles.stream().map(Vehicle::getId).collect(Collectors.toList());
}
} }
...@@ -517,4 +517,9 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -517,4 +517,9 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
public ObjectRestResponse checkBookHourInfo() { public ObjectRestResponse checkBookHourInfo() {
return vehicleBookHourInfoBiz.checkBookHourInfo(); return vehicleBookHourInfoBiz.checkBookHourInfo();
} }
@GetMapping("/findwith_plate_number")
List<String> findbyPlateNumber(@RequestParam(value = "plateNumber") String plateNumber){
return vehicleBiz.findVehicleIdsByPlateNumber(plateNumber);
}
} }
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