Commit 026f9ad9 authored by jiaorz's avatar jiaorz

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

parents b3aa4c3b 846a5515
......@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.admin.biz.MenuBiz;
import com.github.wxiaoqi.security.admin.biz.UserBiz;
import com.github.wxiaoqi.security.admin.entity.Menu;
import com.github.wxiaoqi.security.admin.entity.User;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.rpc.service.PermissionService;
import com.github.wxiaoqi.security.admin.vo.FrontUser;
import com.github.wxiaoqi.security.admin.vo.GroupUsers;
......@@ -124,9 +125,20 @@ public class UserController extends CommonBaseController {
if (StringUtils.isBlank(state)){
state="0,1";
}
if (StringUtils.isBlank(token)){
token=userAuthConfig.getToken(request);
}
return permissionService.getMenusByUsername(token,state);
}
@RequestMapping(value = "/front/house/menus", method = RequestMethod.GET)
public ObjectRestResponse getMenus(String state) throws Exception {
if (StringUtils.isBlank(state)){
state="0,2";
}
return ObjectRestResponse.succ(permissionService.getMenusByUsername(userAuthConfig.getToken(request),state));
}
@RequestMapping(value = "/front/menu/all", method = RequestMethod.GET)
public @ResponseBody
List<Menu> getAllMenus() throws Exception {
......
......@@ -96,6 +96,10 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
PageDataVO<CampsiteShopPageDTO> pageDataVO = PageDataVO.pageInfo(campsiteShopFindDTO.getPage(), campsiteShopFindDTO.getLimit(), () -> mapper.findAllCampsiteShopsByTypeOrCode(campsiteShopFindDTO.getType(),campsiteShopFindDTO.getAddrProvince(),campsiteShopFindDTO.getAddrCity()));
List<CampsiteShopPageDTO> campsiteShopPageDTOS = pageDataVO.getData();
if (CollectionUtils.isEmpty(campsiteShopPageDTOS)) {
campsiteShopPageDataVO.setPageNum(campsiteShopFindDTO.getPage());
campsiteShopPageDataVO.setTotalCount(0L);
campsiteShopPageDataVO.setTotalPage(0);
campsiteShopPageDataVO.setPageSize(campsiteShopFindDTO.getLimit());
campsiteShopPageDataVO.setData(Collections.EMPTY_LIST);
return campsiteShopPageDataVO;
}
......
......@@ -37,12 +37,28 @@
<!--根据类型查询全部-->
<select id="findAllCampsiteShopsByTypeOrCode" resultType="com.xxfc.platform.campsite.dto.CampsiteShopPageDTO">
select cs.id as `id`,cs.name as `name`,cs.logo as `logo`,cs.url as `url`,cs.province_name as `provinceName`,cs.city_name as `cityName`,cs.service_phone as `phone`,cs.alt
cs.longitude as `longitude`,cs.latitude as `latitude`,`address` as `address`,cs.hot as `hot`,cs.crt_time as `crtTime`,cs.concat as `concat`,ct.id as `storeId`,ct.name as `storeTypeName`
FROM `campsite_shop_tag` cst
left JOIN `campsite_shop` cs on cst.shop_id=cs.id
left JOIN `campsite_tag` ct on cst.tag_id=ct.id
where cs.sale_state=1 and cs.is_del=0
SELECT
cs.id AS `id`,
cs. NAME AS `name`,
cs.logo AS `logo`,
cs.url AS `url`,
cs.province_name AS `provinceName`,
cs.city_name AS `cityName`,
cs.service_phone AS `phone`,
cs.longitude AS `longitude`,
cs.latitude AS `latitude`,
cs.`address` AS `address`,
cs.hot AS `hot`,
cs.crt_time AS `crtTime`,
cs.concat AS `concat`,
REPLACE(GROUP_CONCAT( DISTINCT ct.`name` ),',','|') AS `storeTypeName`
FROM campsite_shop cs
LEFT JOIN campsite_shop_tag cst ON cs.id = cst.shop_id
LEFT JOIN campsite_tag ct ON cst.tag_id = ct.id
WHERE
cs.sale_state = 1
AND cs.is_del = 0
<if test="typeId!=null">
and cst.tag_id=#{typeId}
</if>
......@@ -52,6 +68,7 @@
<if test="cityCode != null">
and `city`=#{cityCode}
</if>
GROUP BY cs.id
order by `crtTime` DESC
</select>
......
......@@ -15,6 +15,8 @@ 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;
......@@ -68,13 +70,12 @@ public class CustomerServiceBiz {
CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO,customerService);
customerService.setCreateTime(Instant.now().toEpochMilli());
String password = new BCryptPasswordEncoder(UserConstant.PW_ENCORDER_SALT).encode(INIT_PASSWORD);
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",password);
imMap.put("password",INIT_PASSWORD);
imMap.put("nickname",customerService.getName());
BaseResponse imResponse = userBiz.register(imMap);
String imResult = imResponse.getMessage();
......@@ -88,10 +89,19 @@ public class CustomerServiceBiz {
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<>();
// List<CustomerService> customerServices = mongoTemplate.find(Query.query(Criteria.where("isDel").is(false)), CustomerService.class);
List<CustomerService> customerServices = customerServiceRepository.findByIsDelEquals(false);
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());
......@@ -117,7 +127,7 @@ public class CustomerServiceBiz {
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());
UpdateResult customer_service = mongoTemplate.updateFirst(query, update, Map.class, "customer_service");
mongoTemplate.updateFirst(query, update, Map.class, "customer_service");
userBiz.deleteById(imUserId);
}
}
......@@ -8,8 +8,10 @@ import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.vo.ImiVo;
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.im.dto.CommentVo;
import com.xxfc.platform.im.dto.PraiseVo;
import com.xxfc.platform.im.dto.QuestionParamDto;
import com.xxfc.platform.im.model.Comment;
import com.xxfc.platform.im.model.Msg;
import com.xxfc.platform.im.model.Praise;
......@@ -38,6 +40,9 @@ public class MsgBiz {
@Autowired
UserBiz userBiz;
@Autowired
ImQuestionBiz imQuestionBiz;
/**
* 获取消息列表
*
......@@ -139,6 +144,11 @@ public class MsgBiz {
if(type != null) {
ids.add(type);
}
if(type != null && type == 5) {
QuestionParamDto questionParamDto = new QuestionParamDto();
questionParamDto.setUserId(Long.parseLong(userId + ""));
return imQuestionBiz.getList(questionParamDto);
}
Query query = new Query(Criteria.where("body.type").in(ids));
query.addCriteria(Criteria.where("userId").is(userId));
int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size();
......@@ -148,7 +158,7 @@ public class MsgBiz {
List<MsgVo> msgVoList = replaceMsgResult(msgList);
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(msgVoList);
goodPageInfo.setPageSize(totalSize%limit == 0 ?totalSize/limit : totalSize/limit + 1);
return ObjectRestResponse.succ(goodPageInfo);
return ObjectRestResponse.succ(PageDataVO.pageInfo(goodPageInfo));
}
......
......@@ -257,7 +257,6 @@ public class UserBiz {
*/
public void updatePasswordByPhone(String telphone,String password){
Query query = Query.query(Criteria.where("phone").is(telphone));
password = new BCryptPasswordEncoder(UserConstant.PW_ENCORDER_SALT).encode(password);
Update update = Update.update("password", password);
mongoTemplate.updateFirst(query,update,Map.class,"user");
}
......
package com.xxfc.platform.im.repos;
import com.xxfc.platform.im.model.CustomerService;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import com.xxfc.platform.im.model.CustomerService;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.List;
/**
* @author libin
......@@ -17,10 +19,13 @@ public interface CustomerServiceRepository extends MongoRepository<CustomerServi
/**
* 查询客服
* @param isDel 删除状态
* * @param isDel 删除状态
* @return
*/
List<CustomerService> findByIsDelEquals(Boolean isDel);
List<CustomerService> findByIsDel(Boolean isDel);
// @Query(value = "{'is_del':?0}",fields ="{'telphone':1}",sort = "{'create_time':-1}")
@Query(value = "{'is_del':?#{[0]}}",fields ="{'name':1}",sort = "{'create_time':-1}")
List<CustomerService> findByIsDelState(Boolean isDel);
}
......@@ -106,7 +106,7 @@ public class Article {
private Integer status;
@Column(name ="type")
@Column(name = "type")
@ApiModelProperty(value = "文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网")
private Integer type;
......@@ -114,7 +114,7 @@ public class Article {
* 创建时间
*/
@Column(name = "cre_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date creTime;
......@@ -123,7 +123,7 @@ public class Article {
* 修改时间
*/
@Column(name = "upd_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updTime;
......@@ -132,11 +132,24 @@ public class Article {
* 上架时间
*/
@Column(name = "add_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "上架时间")
private Date addTime;
@ApiModelProperty("seo*html标签优化")
private String alt;
@Column(name = "tag_title")
@ApiModelProperty("title标签内容")
private String tagTitle;
@Column(name = "keywords")
@ApiModelProperty("title标签内容")
private String keywords;
@Column(name = "description")
@ApiModelProperty("description")
private String description;
}
......@@ -3,6 +3,7 @@ package com.xxfc.platform.uccn.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.uccn.comstnt.UrlType;
import com.xxfc.platform.uccn.entity.Article;
import com.xxfc.platform.uccn.mapper.ArticleMapper;
......@@ -64,7 +65,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
if (UrlType.OFFICIAL_WEBSITE.getCode().equals(urlType)) {
criteria.andEqualTo("status", 1);
}
return mapper.selectOneByExample(example);
Article article = mapper.selectOneByExample(example);
return article;
}
......@@ -118,6 +120,10 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
// }
}
/**
* 添加文章
* @param article
*/
@Transactional(rollbackFor = Exception.class)
public void add(Article article) {
if (article == null) {
......@@ -131,11 +137,25 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
if (article.getType() == null) {
article.setType(0);
}
<<<<<<< HEAD
if (article.getStatus()==1){
article.setAddTime(new Date());
=======
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo");
>>>>>>> 13151cd28becd80af54c5e67901b2f7c3e67a966
}
article.setCreTime(new Date());
mapper.insertSelective(article);
}
/**
* 后台文章列表
* @param query
* @return
*/
public PageInfo findAll(ArticleQuery query) {
PageHelper.startPage(query.getPage(),query.getLimit());
Example exa = Example.builder(Article.class).where(
......@@ -147,13 +167,22 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return PageInfo.of(articles);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int updateSelectiveByIdRe(Article article){
article.setUpdTime(new Date());
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo");
}
return mapper.updateByPrimaryKeySelective(article);
}
/**
* 上架
* @param id
* @return
*/
public int putaway(Integer id) {
Article article = new Article();
article.setId(id);
......@@ -163,6 +192,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return mapper.updateByPrimaryKeySelective(article);
}
/**
* 下架
* @param id
* @return
*/
public int soldOut(Integer id) {
Article article = new Article();
article.setId(id);
......@@ -171,6 +205,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return mapper.updateByPrimaryKeySelective(article);
}
/**
* 删除
* @param id
* @return
*/
public int remove(Integer id) {
Article article = new Article();
article.setId(id);
......
......@@ -64,6 +64,7 @@ public class VehicleModelController extends CommonBaseController {
@GetMapping(value = "/findVehicleModelPage")
@IgnoreUserToken
public ObjectRestResponse<PageDataVO<VehicleModelVo>> findVehicleModelPageUnauthfind(VehicleModelQueryCondition vmqc) {
vmqc.setNotInIds("67");
ObjectRestResponse<PageDataVO<VehicleModelVo>> objectRestResponse = vehicleFeign.findVehicleModelPageUnauthfind(vmqc);
PageDataVO<VehicleModelVo> pageDataVOs = objectRestResponse.getData();
pageDataVOs.getData().forEach( v -> {
......
......@@ -76,7 +76,7 @@
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.7</version>
<version>3.3.9</version>
</dependency>
<dependency>
<groupId>cn.jpush.api</groupId>
......
package com.xxfc.platform.universal.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* 消息推送表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-05-28 16:17:42
*/
@Data
@Table(name = "message_push")
public class MessagePush implements Serializable {
private static final long serialVersionUID = 1L;
//
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("")
private Integer id;
@ApiModelProperty(value = "1-手动推送;2-系统自动推送")
private Integer type;
@Column(name = "send_type")
@ApiModelProperty(value = "系统发送类型:1-支付完成")
private Integer sendType;
@ApiModelProperty(value = "通知标题")
private String title;
@ApiModelProperty(value = "通知内容")
private String alert;
@ApiModelProperty(value = "通知栏样式类型:1-大文本;2-文本条目;3-大图片")
private Integer style;
@Column(name = "big_text")
@ApiModelProperty(value = "大文本通知栏样式")
private String bigText;
@ApiModelProperty(value = "文本条目通知栏样式")
private String inbox;
@Column(name = "big_pic_path")
@ApiModelProperty(value = "大图片通知栏样式")
private String bigPicPath;
@ApiModelProperty(value = "指定跳转页面")
private String intent;
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除")
private Integer isDel;
}
......@@ -2,22 +2,35 @@ package com.xxfc.platform.universal.biz;
import cn.jiguang.common.ClientConfig;
import cn.jiguang.common.ServiceHelper;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Options;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.Notification;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.universal.service.SmsService;
import com.xxfc.platform.universal.utils.CCPRestSmsUtils;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.xxfc.platform.universal.entity.MessagePush;
import com.xxfc.platform.universal.mapper.MessagePushMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
@Service
@Slf4j
public class JPushBiz {
public class JPushBiz extends BaseBiz<MessagePushMapper, MessagePush> {
@Value("${universal.MASTER_SECRET}")
......@@ -25,6 +38,8 @@ public class JPushBiz {
@Value("${universal.APP_KEY}")
private String APP_KEY;
public static final String ALERT = "Test from API Example - alert";
//推送给所有平台设备
public ObjectRestResponse jpushToAllPlat(String title){
ClientConfig clientConfig = ClientConfig.getInstance();
......@@ -48,5 +63,179 @@ public class JPushBiz {
}
}
//推送给所有平台设备
public ObjectRestResponse jpushToAllPlat1(){
ClientConfig clientConfig = ClientConfig.getInstance();
final JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY, null, clientConfig);
PushPayload payload = buildPushObject_android_newly_support();
try {
PushResult result = jpushClient.sendPush(payload);
log.debug("\n推送结果:"+result);
return ObjectRestResponse.succ();
} catch (APIConnectionException e) {
// Connection error, should retry later
log.debug("\nConnection error, should retry later"+e);
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,e.getMessage());
} catch (APIRequestException e) {
// Should review the error, and fix the request
log.debug("\nShould review the error, and fix the request"+ e);
log.debug("\nHTTP Status: " + e.getStatus());
log.debug("\nError Code: " + e.getErrorCode());
log.debug("\nError Message: " + e.getErrorMessage());
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,e.getMessage());
}
}
public static PushPayload buildPushObject_android_newly_support() {
JsonObject inbox = new JsonObject();
inbox.add("line1", new JsonPrimitive("line1 string"));
inbox.add("line2", new JsonPrimitive("line2 string"));
inbox.add("contentTitle", new JsonPrimitive("title string"));
inbox.add("summaryText", new JsonPrimitive("+3 more"));
JsonObject intent = new JsonObject();
intent.add("url", new JsonPrimitive("intent:#Intent;component=com.jiguang.push/com.example.jpushdemo.SettingActivity;end"));
Notification notification = Notification.newBuilder()
.addPlatformNotification(AndroidNotification.newBuilder()
.setAlert("测试通知内容")
.setBigPicPath("https://xxtest.upyuns.com/image/app/oyI48qqcy3m38iCFffFc3UeZLcm1s3.png")
.setBigText("long text")
.setBuilderId(1)
.setCategory("CATEGORY_SOCIAL")
.setInbox(inbox)
.setStyle(3)
.setTitle("测试通知标题")
.setPriority(1)
.setLargeIcon("https://xxtest.upyuns.com/image/admin/stock.jpg")
.setIntent(intent)
.build())
.build();
return PushPayload.newBuilder()
.setPlatform(Platform.all())
.setAudience(Audience.all())
.setNotification(notification)
.setOptions(Options.newBuilder()
.setApnsProduction(true)
.setSendno(ServiceHelper.generateSendno())
.build())
.build();
}
//推送
public ObjectRestResponse jpushToAlias(Integer id,String userIds){
ClientConfig clientConfig = ClientConfig.getInstance();
final JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY, null, clientConfig);
PushPayload payload = buildPushObject_android_id(id,userIds);
if (payload==null){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"参数无效");
}
try {
PushResult result = jpushClient.sendPush(payload);
log.debug("\n推送结果:"+result);
return ObjectRestResponse.succ();
} catch (APIConnectionException e) {
// Connection error, should retry later
log.debug("\nConnection error, should retry later"+e);
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,e.getMessage());
} catch (APIRequestException e) {
// Should review the error, and fix the request
log.debug("\nShould review the error, and fix the request"+ e);
log.debug("\nHTTP Status: " + e.getStatus());
log.debug("\nError Code: " + e.getErrorCode());
log.debug("\nError Message: " + e.getErrorMessage());
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,e.getMessage());
}
}
public PushPayload buildPushObject_android_id(Integer id,String userIds) {
Example example =new Example(MessagePush.class);
example.createCriteria().andEqualTo("id",id).andEqualTo("isDel",0);
MessagePush messagePush=mapper.selectOneByExample(example);
if (messagePush==null||messagePush.getType()==null){
log.info("无有效数据--id=="+id);
return null;
}
Audience audience=Audience.all();
if (messagePush.getType()==2){
if (StringUtils.isBlank(userIds)){
log.info("无有效数据--type=="+messagePush.getType()+"------userId=="+userIds);
return null;
}
audience=Audience.alias(userIds);
}
JsonObject intent = new JsonObject();
if (StringUtils.isNotBlank(messagePush.getIntent())){
intent= getJsonObject(messagePush.getIntent());
}
Notification notification = Notification.newBuilder()
.addPlatformNotification(AndroidNotification.newBuilder()
.setAlert(messagePush.getAlert())
.setBigPicPath(messagePush.getBigPicPath())
.setBigText(messagePush.getBigText())
.setBuilderId(1)
.setCategory("CATEGORY_SOCIAL")
.setInbox(messagePush.getInbox())
.setStyle(messagePush.getStyle())
.setTitle(messagePush.getTitle())
.setPriority(1)
.setIntent(intent)
.build())
.build();
return PushPayload.newBuilder()
.setPlatform(Platform.all())
.setAudience(audience)
.setNotification(notification)
.setOptions(Options.newBuilder()
.setApnsProduction(true)
.setSendno(ServiceHelper.generateSendno())
.build())
.build();
}
//字符串转JsonObject
public JsonObject getJsonObject(String json){
Gson g = new Gson();
return g.fromJson(json, JsonObject.class);
}
//编辑推送内容
public ObjectRestResponse updMessagePush(MessagePush messagePush){
Integer id= messagePush.getId();
if (id==null){
insertSelective(messagePush);
}else {
updateSelectiveById(messagePush);
}
return ObjectRestResponse.succ();
}
//删除推送内容
public ObjectRestResponse delMessagePush(MessagePush messagePush){
messagePush.setIsDel(1);
updateSelectiveById(messagePush);
return ObjectRestResponse.succ();
}
//获取列表
public ObjectRestResponse getList(Integer page,Integer limit,String title,Integer type){
Example example =new Example(MessagePush.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
if (StringUtils.isNotBlank(title)){
criteria.andLike("title","%"+title+"%");
}
if (type!=null&&type!=0){
criteria.andEqualTo("type",type);
}
return ObjectRestResponse.succ(PageDataVO.pageInfo(page, limit, ()->mapper.selectByExample(example)));
}
}
......@@ -5,6 +5,7 @@ package com.xxfc.platform.universal.controller;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.universal.biz.JPushBiz;
import com.xxfc.platform.universal.entity.MessagePush;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -27,5 +28,42 @@ public class JPushController {
return jPushBiz.jpushToAllPlat(title);
}
@RequestMapping(value = "/app/unauth/alls", method = RequestMethod.GET) //匹配的是href中的download请求
public ObjectRestResponse alls() throws Exception {
return jPushBiz.jpushToAllPlat1();
}
@RequestMapping(value = "/stype", method = RequestMethod.GET)
public ObjectRestResponse stype(@RequestParam(value = "id",defaultValue = "0") Integer id,
@RequestParam(value = "userIds",defaultValue = "") String userIds) throws Exception {
return jPushBiz.jpushToAlias(id,userIds);
}
@RequestMapping(value = "/addMessagePush", method = RequestMethod.POST)
public ObjectRestResponse addMessagePush(@RequestBody MessagePush messagePush){
return jPushBiz.updMessagePush(messagePush);
}
@RequestMapping(value = "/udpMessagePush", method = RequestMethod.POST)
public ObjectRestResponse udpMessagePush(@RequestBody MessagePush messagePush){
return jPushBiz.updMessagePush(messagePush);
}
@RequestMapping(value = "/del", method = RequestMethod.POST)
public ObjectRestResponse delMessagePush(@RequestBody MessagePush messagePush){
return jPushBiz.delMessagePush(messagePush);
}
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ObjectRestResponse getList(@RequestParam(value = "page",defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "10") Integer limit,
@RequestParam(value = "title",defaultValue = "") String title,
@RequestParam(value = "type",defaultValue = "0") Integer type){
return jPushBiz.getList(page,limit,title,type);
}
}
package com.xxfc.platform.universal.mapper;
import com.xxfc.platform.universal.entity.MessagePush;
import tk.mybatis.mapper.common.Mapper;
/**
* 消息推送表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-05-28 16:17:42
*/
public interface MessagePushMapper extends Mapper<MessagePush> {
}
......@@ -30,6 +30,8 @@ public class VehicleModelQueryCondition {
private Integer status;
@ApiModelProperty("分类逗号分割")
String catasStr;
@ApiModelProperty("排除的车型id")
String notInIds;
@ApiModelProperty(value = "分类列表", hidden = true)
Map<Integer, List<VehiclePlatCata>> catas;
}
......@@ -3,6 +3,7 @@ package com.xxfc.platform.vehicle.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.common.RestResponse;
......@@ -10,6 +11,7 @@ import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.mapper.BranchCompanyStockInfoMapper;
import com.xxfc.platform.vehicle.mapper.CompanyBaseMapper;
import com.xxfc.platform.vehicle.mapper.SysRegionMapper;
import com.xxfc.platform.vehicle.pojo.AddOrUpdateVehicleVo;
import com.xxfc.platform.vehicle.pojo.dto.CompanyBaseDetailDTO;
import com.xxfc.platform.vehicle.pojo.vo.CompanyBaseVo;
import com.xxfc.platform.vehicle.pojo.vo.CompanyVo;
......@@ -26,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
@Service
@Slf4j
......@@ -47,6 +50,9 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
@Autowired
AreaBiz areaBiz;
@Autowired
VehicleBiz vehicleBiz;
@Value("${branchCompanyPic.url}")
private String companyUrl;
......@@ -85,6 +91,47 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
return ObjectRestResponse.succ();
}
//临时数据同步4(添加车辆)
public ObjectRestResponse synchro4() throws Exception{
List<BranchCompany> list= branchCompanyBiz.selectListAll();
if (list.size()>0){
int num=1;
for (BranchCompany branchCompany:list){
List<AddOrUpdateVehicleVo> addOrUpdateVehicleVoList=new ArrayList<>();
for (int i=1;i<6;i++){
String numberPlate="测试"+getNumberPlate(num);
AddOrUpdateVehicleVo vehicleVo=new AddOrUpdateVehicleVo();
vehicleVo.setCode(Integer.parseInt(RandomUtil.getRandomStr(4)));
vehicleVo.setNumberPlate(numberPlate);
vehicleVo.setStatus(1);
vehicleVo.setBrand(5);
vehicleVo.setUseType(1);
vehicleVo.setModelId(67);
vehicleVo.setSubordinateBranch(branchCompany.getId());
vehicleVo.setMaintenanceMileage(3000);
vehicleVo.setParkBranchCompanyId(branchCompany.getId());
vehicleVo.setTravelStatus(3);
addOrUpdateVehicleVoList.add(vehicleVo);
num++;
log.info("----成功---num=="+num+"---numberPlate==="+numberPlate);
}
vehicleBiz.add(addOrUpdateVehicleVoList);
}
}
return ObjectRestResponse.succ();
}
public String getNumberPlate(int number){
String str=number+"";
char[] ary1 = str.toCharArray();
char[] ary2 = {'0','0','0','0'};
System.arraycopy(ary1, 0, ary2, ary2.length-ary1.length, ary1.length);
String result = new String(ary2);
return result;
}
//临时数据同步2
public ObjectRestResponse synchro2(){
List<BranchCompany> list= branchCompanyBiz.selectListAll();
......
......@@ -21,8 +21,8 @@ public class CompanyController extends BaseController<CompanyBaseBiz> {
@ApiOperation("同步分公司信息")
@PostMapping("synchro")
public ObjectRestResponse<String> synchro() {
return baseBiz.synchro();
public ObjectRestResponse synchro()throws Exception {
return baseBiz.synchro4();
}
@ApiOperation("同步分公司地址")
......
......@@ -46,6 +46,13 @@
</foreach>
) > 0
</if>
<if test="notInIds != null">
and vmqc.id not in (
<foreach collection="notInIds.split(',')" item="noIdItem" index="noIdIndex">
#{noIdItem}
</foreach>
)
</if>
ORDER BY vmqc.id ASC
</select>
......
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