Commit d984b02c authored by 周健威's avatar 周健威

Merge branch 'master' into master-modify-cutAmount

# Conflicts:
#	xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderVehicleCrosstownBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/BaseOrderController.java
#	xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
#	xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleController.java
#	xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookRecordMapper.xml
#	xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
parents fdc1f109 ad49a2c5
......@@ -7,5 +7,10 @@ target/
.settings/
.classpath
ace-modules/ace-tool/src/main/resources/application-dev.yml
**/src/test/
**/src/test
**/logs
xx-order/xx-order-server/logs/**
*.log
logs/**
/src/main/test/**
......@@ -63,7 +63,7 @@ public class RandomUtil
public static void main(String[] args) {
int max = 20;
int n = 20;
int n = 30;
Set<Integer> set = new HashSet<>();
randomSet(max, n, set, n);
for(Integer a : set) {
......
......@@ -37,4 +37,6 @@ public class GoodDataVO{
@ApiModelProperty(value = "纬度")
private Double latitude;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -9,4 +9,6 @@ public class PageParam {
Integer page;
@ApiModelProperty("每页限制")
Integer limit;
}
......@@ -108,9 +108,6 @@ USER_EXIST_CODE=5003
ORG_INSERT_FAILED_CODE=6001
6001=新增组织失败
VEHICLE_NOT_=6001
6001=新增组织失败
ORG_UPDATE_FAILED_CODE=6002
6002=更新组织信息失败
......@@ -216,7 +213,7 @@ BOOKED_FAILED_CODE = 4007
4007=车辆预定失败,请重试!
ONLY_BOOK_FROM_TODAY = 4008
4008=取消或预定时间不能小于当前时间
4008=预定时间不能小于当前时间
ADD_VEHICLE_FAIL = 4009
4009 = 添加车辆失败,请重试
......@@ -228,7 +225,7 @@ DATE_TIME_IS_NULL = 4011
4011 = 预定时间不能为空
ONLY_BOOK_TWO_MONTH = 4012
4012 = 只能预定两月内的车辆
4012 = 最多提前三个月预约
ONLY_UNBOOK_TWO_MONTH = 4013
4013 = 只能取消预定两月内的车辆
......
......@@ -25,6 +25,8 @@ public class Menu {
private String type;
private String state;
private String description;
@Column(name = "crt_time")
......@@ -167,6 +169,20 @@ public class Menu {
this.type = type;
}
/**
* @return state
*/
public String getState() {
return state;
}
/**
* @param state
*/
public void setState(String state) {
this.state = state;
}
/**
* @return description
*/
......
......@@ -131,23 +131,27 @@ public class GroupBiz extends BaseBiz<GroupMapper, Group> {
@CacheClear(keys = {"permission:menu","permission:u","app:permission:u"})
public void modifyAuthorityMenu(int groupId, String[] menus) {
resourceAuthorityMapper.deleteByAuthorityIdAndResourceType(groupId + "", AdminCommonConstant.RESOURCE_TYPE_MENU);
List<Menu> menuList = menuMapper.selectAll();
Map<String, String> map = new HashMap<String, String>();
for (Menu menu : menuList) {
map.put(menu.getId().toString(), menu.getParentId().toString());
}
Set<String> relationMenus = new HashSet<String>();
relationMenus.addAll(Arrays.asList(menus));
ResourceAuthority authority = null;
for (String menuId : menus) {
findParentID(map, relationMenus, menuId);
}
for (String menuId : relationMenus) {
authority = new ResourceAuthority(AdminCommonConstant.AUTHORITY_TYPE_GROUP, AdminCommonConstant.RESOURCE_TYPE_MENU);
authority.setAuthorityId(groupId + "");
authority.setResourceId(menuId);
authority.setParentId("-1");
resourceAuthorityMapper.insertSelective(authority);
if (menus.length>0){
List<Menu> menuList = menuMapper.selectAll();
Map<String, String> map = new HashMap<String, String>();
for (Menu menu : menuList) {
map.put(menu.getId().toString(), menu.getParentId().toString());
}
Set<String> relationMenus = new HashSet<String>();
relationMenus.addAll(Arrays.asList(menus));
ResourceAuthority authority = null;
for (String menuId : menus) {
findParentID(map, relationMenus, menuId);
}
for (String menuId : relationMenus) {
authority = new ResourceAuthority(AdminCommonConstant.AUTHORITY_TYPE_GROUP, AdminCommonConstant.RESOURCE_TYPE_MENU);
authority.setAuthorityId(groupId + "");
authority.setResourceId(menuId);
authority.setParentId("-1");
resourceAuthorityMapper.insertSelective(authority);
}
}
}
......
......@@ -73,11 +73,15 @@ public class GroupController extends BaseController<GroupBiz, Group> {
@RequestMapping(value = "/{id}/authority/menu", method = RequestMethod.PUT)
@ResponseBody
public ObjectRestResponse modifyMenuAuthority(@PathVariable int id, String menuTrees){
String [] menus = menuTrees.split(",");
String [] menus =new String[]{};
if (StringUtils.isNotBlank(menuTrees)){
menus= menuTrees.split(",");
}
baseBiz.modifyAuthorityMenu(id, menus);
return new ObjectRestResponse().rel(true);
}
@RequestMapping(value = "/{id}/authority/menu", method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<List<AuthorityMenuTree>> getMenuAuthority(@PathVariable int id){
......
......@@ -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;
......@@ -120,8 +121,22 @@ public class UserController extends CommonBaseController {
@RequestMapping(value = "/front/menus", method = RequestMethod.GET)
public @ResponseBody
List<MenuTree> getMenusByUsername(String token) throws Exception {
return permissionService.getMenusByUsername(token);
List<MenuTree> getMenusByUsername(String token,String state) throws Exception {
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)
......
......@@ -170,13 +170,14 @@ public class PermissionService {
return frontUser;
}
public List<MenuTree> getMenusByUsername(String token) throws Exception {
public List<MenuTree> getMenusByUsername(String token,String state) throws Exception {
String username = userAuthUtil.getInfoFromToken(token).getUniqueName();
if (username == null) {
return null;
}
User user = userBiz.getUserByUsername(username);
List<Menu> menus = menuBiz.getUserAuthorityMenuByUserId(user.getId());
menus=menus.stream().filter(a->state.contains(a.getState()==null?"1":a.getState())).collect(Collectors.toList());
return getMenuTree(menus,AdminCommonConstant.ROOT);
}
}
......@@ -12,6 +12,7 @@
<result column="href" jdbcType="VARCHAR" property="href"/>
<result column="icon" jdbcType="VARCHAR" property="icon"/>
<result column="type" jdbcType="CHAR" property="type"/>
<result column="state" jdbcType="INTEGER" property="state"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="crt_time" jdbcType="DATE" property="crtTime"/>
<result column="crt_user" jdbcType="VARCHAR" property="crtUser"/>
......
......@@ -110,4 +110,9 @@ public class Banner {
* 平台 0:APP 1:欣欣房车官网 2:滴房车官网
*/
private Integer platform;
/**
* html 标签悬浮显示 seo 需要
*/
private String alt;
}
......@@ -23,4 +23,9 @@ public class BannerVo {
* 跳转链接地址
*/
private String url;
/**
* seo html标签优化
*/
private String alt;
}
......@@ -30,6 +30,7 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
bannerVo.setUrl(banner.getUrl());
bannerVo.setTitle(banner.getTitle());
bannerVo.setId(banner.getId());
bannerVo.setAlt(banner.getAlt());
bannerVos.add(bannerVo);
});
return bannerVos;
......
......@@ -165,4 +165,7 @@ public class CampsiteShopAdminDTO {
@ApiModelProperty(value = "海报背景")
private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -76,4 +76,8 @@ public class CampsiteShopDetailDTO {
@ApiModelProperty(value = "海报背景")
private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -213,4 +213,7 @@ public class CampsiteShop implements Serializable {
@Column(name = "poster_background")
@ApiModelProperty(value = "海报背景")
private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -172,4 +172,7 @@ public class CampsiteShopAdminVO {
@ApiModelProperty(value = "海报背景")
private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -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;
}
......@@ -204,15 +208,16 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
List<String> tagNames = shopIdOfTagsMap.get(campsiteShopAdminPageDTO.getId());
campsiteShopAdminPageDTO.setStoreTypeName(tagNames == null ? new ArrayList<String>() : tagNames);
}
}).sorted(Comparator.comparing(CampsiteShopAdminPageDTO::getHot).reversed().thenComparing(CampsiteShopAdminPageDTO::getCrtTime).reversed()).collect(Collectors.toList());
}).collect(Collectors.toList());
List<CampsiteShopAdminPageVo> campsiteShopAdminPageVos = JSONObject.parseObject(JSONObject.toJSONString(campsiteShopAdminPageDTOS), new TypeReference<List<CampsiteShopAdminPageVo>>() {
});
campsiteShopAdminPageVos.sort(Comparator.comparing(CampsiteShopAdminPageVo::getHot).reversed().thenComparing(Comparator.comparing(CampsiteShopAdminPageVo::getCrtTime).reversed()));
//组装数据
campsiteShopAdminPageDataVos.setTotalPage(campsiteShopAdminpageDTOPageDataVO.getTotalPage());
campsiteShopAdminPageDataVos.setTotalCount(campsiteShopAdminpageDTOPageDataVO.getTotalCount());
campsiteShopAdminPageDataVos.setPageSize(campsiteShopAdminpageDTOPageDataVO.getPageSize());
campsiteShopAdminPageDataVos.setPageNum(campsiteShopAdminpageDTOPageDataVO.getPageNum());
campsiteShopAdminPageDataVos.setData(JSONObject.parseObject(JSONObject.toJSONString(campsiteShopAdminPageDTOS), new TypeReference<List<CampsiteShopAdminPageVo>>() {
}));
campsiteShopAdminPageDataVos.setData(campsiteShopAdminPageVos);
return campsiteShopAdminPageDataVos;
}
......
......@@ -32,16 +32,33 @@
<result property="isDel" column="is_del"/>
<result property="hot" column="hot"/>
<result property="saleState" column="sale_state"/>
<result property="alt" column="alt"/>
</resultMap>
<!--根据类型查询全部-->
<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.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>
......@@ -51,12 +68,13 @@
<if test="cityCode != null">
and `city`=#{cityCode}
</if>
order by `crtTime` DESC
GROUP BY cs.id
order by `hot`DESC,`crt_time` DESC
</select>
<!--首页查询全部-->
<select id="findAllByHome" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude,cs.alt
FROM `campsite_shop` cs
where cs.sale_state=1 and cs.is_del=0
order by cs.hot desc
......@@ -64,7 +82,7 @@
</select>
<select id="findAll" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude,cs.alt
FROM `campsite_shop` cs
where cs.sale_state=1 and cs.is_del=0
order by cs.hot desc
......@@ -73,7 +91,7 @@
<!--根据id查询详情-->
<select id="findCampsiteShopDetailById" resultType="com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO">
select `name` as `name`,`province_name` as `provinceName`,`city_name` as `cityName`,`address` as `address`,`service_phone` as `phone`,`logo` as `logo`,`poster_background` as `posterBackground` ,
`content` as `content`,`configure` as `configure`,`longitude` as `longitude`,`latitude` as `latitude` from `campsite_shop` where `id`=#{id}
`content` as `content`,`configure` as `configure`,`longitude` as `longitude`,`latitude` as `latitude`,`alt` from `campsite_shop` where `id`=#{id}
</select>
<!--根据查询条件分页查询-->
......@@ -93,7 +111,7 @@
<if test="name != null and name != ''">
and `name` like concat('%',#{name},'%')
</if>
ORDER BY `hot` DESC
</select>
<!--根据id更新营地状态-->
......
package com.xxfc.platform.im.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/5 10:35
*/
@Data
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
public class CustomerServiceDTO {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 客服名称
*/
private String name;
/**
* 帐号
*/
private String account;
/**
* 密码
*/
private String password;
/**
* 客服头像
*/
private String icon;
/**
* App id
*/
private Integer appUserId;
/**
* im id
*/
private String imUserId;
/**
* 区域id
*/
private Integer areaId;
/**
* 区域名称
*/
private String areaName;
/**
* 问候语句
*/
private String greeting;
/**
* 客服类型
*/
private Integer type;
/**
* 客服电话
*/
private String telphone;
}
package com.xxfc.platform.im.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
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
* @version 1.0
* @description 客服
* @data 2019/9/5 9:27
*/
@Data
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "customer_service")
@Document(collection = "customer_service")
public class CustomerService {
private static final long serialVersionUID = 1L;
@Id
@javax.persistence.Id
@GeneratedValue(generator = "JDBC")
private Long id;
/**
* 客服名称
*/
private String name;
/**
* 客服头像
*/
private String icon;
/**
* App id
*/
@Field("app_user_id")
@Column(name = "app_user_id")
private Integer appUserId;
/**
* im id
*/
@Field("im_user_id")
@Column(name = "im_user_id")
private Integer imUserId;
/**
* 区域id
*/
@Field("area_id")
@Column(name = "area_id")
private Integer areaId;
/**
* 区域名称
*/
@Field("area_name")
@Column(name = "area_name")
private String areaName;
/**
* 问候语句
*/
private String greeting;
/**
* 客服类型
*/
private Integer type;
/**
* 客服电话
*/
private String telphone;
/**
* 登录密码
*/
private String password;
/**
* 是事删除 true:删除状态 1:正常
*/
@Field("is_del")
@Column(name = "is_del")
private Boolean isDel;
@Field("create_time")
@Column(name = "create_time")
private Long createTime;
@Field("update_time")
@Column(name = "update_time")
private Long updateTime;
}
package com.xxfc.platform.im.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/5 10:37
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class CustomerServiceVO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 客服名称
*/
private String name;
/**
* 密码
*/
private String password;
/**
* 客服头像
*/
private String icon;
/**
* App id
*/
private Integer appUserId;
/**
* im id
*/
private Integer imUserId;
/**
* 区域id
*/
private Integer areaId;
/**
* 区域名称
*/
private String areaName;
/**
* 问候语句
*/
private String greeting;
/**
* 客服类型
*/
private Integer type;
/**
* 客服电话
*/
private String telphone;
private Long createTime;
private Long updateTime;
}
package com.xxfc.platform.im.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.im.dto.CustomerServiceDTO;
import com.xxfc.platform.im.entity.CustomerService;
import com.xxfc.platform.im.mapper.CustomerServiceMapper;
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.stereotype.Service;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;
import java.time.Instant;
import java.util.*;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/5 9:49
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerService> {
private final static String INIT_PASSWORD = "12345678";
private final static String NICK_PRE_NAME = "XXKF";
private final UserBiz userBiz;
public CustomerServiceVO findById(Long id) {
CustomerServiceVO customerServiceVO = new CustomerServiceVO();
CustomerService customerService = mapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(customerService, customerServiceVO);
return customerServiceVO;
}
/**
* 添加客服
*
* @param customerServiceDTO
*/
public void addCustomerService(CustomerServiceDTO customerServiceDTO) {
CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO, customerService);
if (Objects.isNull(customerServiceDTO.getId())){
customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone()));
customerService.setIsDel(false);
customerService.setPassword(INIT_PASSWORD);
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);
mapper.insertSelective(customerService);
}else {
customerService.setUpdateTime(Instant.now().toEpochMilli());
if (!StringUtils.isEmpty(customerServiceDTO.getPassword())){
userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(),customerServiceDTO.getPassword());
}
mapper.updateByPrimaryKeySelective(customerService);
}
}
public List<CustomerServiceVO> findAll() {
List<CustomerServiceVO> customerServiceVOS = new ArrayList<>();
Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel", 0);
List<CustomerService> customerServices = mapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(customerServices)) {
CustomerServiceVO customerServiceVO;
for (CustomerService customerService : customerServices) {
customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService, customerServiceVO);
customerServiceVOS.add(customerServiceVO);
}
}
return customerServiceVOS;
}
/**
* 删除客服
*
* @param id
* @param imUserId
*/
public void updateCustomerServiceIsDelToTrue(Long id, Integer imUserId) {
CustomerService customerService = new CustomerService();
customerService.setId(id);
customerService.setIsDel(true);
customerService.setUpdateTime(Instant.now().toEpochMilli());
mapper.updateByPrimaryKeySelective(customerService);
userBiz.deleteById(imUserId);
}
public void updatePasswordByPhone(String telphone, String password) {
Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("telphone",telphone);
CustomerService customerService = new CustomerService();
customerService.setPassword(password);
customerService.setUpdateTime(Instant.now().toEpochMilli());
mapper.updateByExampleSelective(customerService,example);
}
public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) {
PageDataVO<CustomerServiceVO> dataVO = new PageDataVO<>();
Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",false);
PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page,limit,()->mapper.selectByExample(example));
List<CustomerService> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)){
return dataVO;
}
List<CustomerServiceVO> customerServiceVOS = new ArrayList<>();
CustomerServiceVO customerServiceVO;
for (CustomerService customerService : data) {
customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService,customerServiceVO);
customerServiceVOS.add(customerServiceVO);
}
dataVO.setPageSize(pageDataVO.getPageSize());
dataVO.setPageNum(pageDataVO.getPageNum());
dataVO.setTotalPage(pageDataVO.getTotalPage());
dataVO.setTotalCount(pageDataVO.getTotalCount());
dataVO.setData(customerServiceVOS);
return dataVO;
}
public CustomerServiceDTO findCustomerServiceById(Long id) {
CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO();
CustomerService customerService = mapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(customerService,customerServiceDTO);
return customerServiceDTO;
}
}
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);
}
}
......@@ -8,9 +8,11 @@ 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.mongodb.client.result.DeleteResult;
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;
......@@ -39,6 +41,9 @@ public class MsgBiz {
@Autowired
UserBiz userBiz;
@Autowired
ImQuestionBiz imQuestionBiz;
/**
* 获取消息列表
*
......@@ -124,7 +129,6 @@ public class MsgBiz {
return ObjectRestResponse.succ();
}
public ObjectRestResponse getMsgListByUserId(Integer page, Integer limit, Integer type) {
//获取所有朋友圈
page = page == null ? 1 : page;
......@@ -141,6 +145,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();
......@@ -150,7 +159,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));
}
......
......@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.vo.ImiVo;
import com.github.wxiaoqi.security.common.constant.UserConstant;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.mongodb.client.result.UpdateResult;
import com.xxfc.platform.im.model.User;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -17,6 +19,7 @@ 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.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
......@@ -27,7 +30,10 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Component
@Slf4j
......@@ -229,4 +235,37 @@ public class UserBiz {
return imiVo;
}
/**
*根据 id 批量查询
* @param imUserIds
* @return
*/
public Map<Integer,User> findAllByImUserIds(List<Integer> imUserIds) {
Map<Integer,User> imUserMap = new HashMap<>(imUserIds.size());
List<User> users = mongoTemplate.find(Query.query(Criteria.where("id").in(imUserIds)), User.class);
if (CollectionUtils.isEmpty(users)){
return imUserMap;
}
imUserMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
return imUserMap;
}
/**
* 更新Im 密码
* @param telphone
* @param password
*/
public void updatePasswordByPhone(String telphone,String password){
Query query = Query.query(Criteria.where("phone").is(telphone));
Update update = Update.update("password", password);
mongoTemplate.updateFirst(query,update,Map.class,"user");
}
/**
* 删除 im
* @param imUserId
*/
public void deleteById(Integer imUserId) {
mongoTemplate.remove(Query.query(Criteria.where("id").is(imUserId)),User.class);
}
}
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;
import com.xxfc.platform.im.entity.CustomerService;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/5 10:55
*/
@Repository
public interface CustomerServiceRepository extends MongoRepository<CustomerService,String> {
/**
* 查询客服
* * @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);
}
package com.xxfc.platform.im.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.im.biz.CustomerServiceBiz;
import com.xxfc.platform.im.biz.CustomerServiceMGBiz;
import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/5 10:31
*/
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/app/unauth/customer_service")
public class CustomerServiceController {
private final CustomerServiceMGBiz customerServiceMGBiz;
private final CustomerServiceBiz customerServiceBiz;
@GetMapping("/list")
public ObjectRestResponse<List<CustomerServiceVO>> findAll(){
// List<CustomerServiceVO> customerServiceVOS = customerServiceMGBiz.findAll();
List<CustomerServiceVO> customerServiceVOS = customerServiceBiz.findAll();
return ObjectRestResponse.succ(customerServiceVOS);
}
@GetMapping("/{id}")
public ObjectRestResponse<CustomerServiceVO> findById(@PathVariable(value = "id") Long id){
// CustomerServiceVO customerServiceVO = customerServiceMGBiz.findById(id);
CustomerServiceVO customerServiceVO = customerServiceBiz.findById(id);
return ObjectRestResponse.succ(customerServiceVO);
}
}
package com.xxfc.platform.im.rest.admin;
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.CustomerServiceMGBiz;
import com.xxfc.platform.im.biz.UserBiz;
import com.xxfc.platform.im.dto.CustomerServiceDTO;
import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/5 10:32
*/
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/admin/customer_service")
public class CustomerServiceAdminController {
private final CustomerServiceMGBiz customerServiceMGBiz;
private final CustomerServiceBiz customerServiceBiz;
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")
public ObjectRestResponse<Void> addCustomerService(@RequestBody CustomerServiceDTO customerServiceDTO){
// customerServiceMGBiz.addCustomerService(customerServiceDTO);
customerServiceBiz.addCustomerService(customerServiceDTO);
return ObjectRestResponse.succ();
}
@PutMapping("/update_password/{telphone}/{password}")
public ObjectRestResponse<Void> updateCustomerService(@PathVariable(value = "telphone") String telphone,
@PathVariable(value = "password") String password){
userBiz.updatePasswordByPhone(telphone,password);
customerServiceBiz.updatePasswordByPhone(telphone,password);
return ObjectRestResponse.succ();
}
@DeleteMapping("/delete/{id}/{imUserId}")
public ObjectRestResponse<Void> deleteCustomerService(@PathVariable(value = "id") Long id,
@PathVariable(value = "imUserId") Integer imUserId){
// customerServiceMGBiz.updateCustomerServiceIsDelToTrue(id,imUserId);
customerServiceBiz.updateCustomerServiceIsDelToTrue(id,imUserId);
return ObjectRestResponse.succ();
}
}
......@@ -252,31 +252,31 @@ public class BaseOrder implements Serializable {
@Column(name = "member_level")
private Integer memberLevel;
/**
* 违约金
*/
@ApiModelProperty(value = "违约金")
@Column(name = "violate_amount")
BigDecimal ViolateAmount;
/**
* 赔偿金
*/
@ApiModelProperty(value = "赔偿金")
@Column(name = "damages_amount")
BigDecimal damagesAmount;
/**
* 额外费用
*/
@ApiModelProperty(value = "额外费用")
@Column(name = "extra_amount")
BigDecimal extraAmount;
/**
* 返还的优惠券
*/
@ApiModelProperty(value = "返回的优惠券")
@Column(name = "back_coupon")
String backCoupon;
// /**
// * 违约金
// */
// @ApiModelProperty(value = "违约金")
// @Column(name = "violate_amount")
// BigDecimal ViolateAmount;
//
// /**
// * 赔偿金
// */
// @ApiModelProperty(value = "赔偿金")
// @Column(name = "damages_amount")
// BigDecimal damagesAmount;
//
// /**
// * 额外费用
// */
// @ApiModelProperty(value = "额外费用")
// @Column(name = "extra_amount")
// BigDecimal extraAmount;
//
// /**
// * 返还的优惠券
// */
// @ApiModelProperty(value = "返回的优惠券")
// @Column(name = "back_coupon")
// String backCoupon;
}
......@@ -308,12 +308,12 @@ public class OrderRentVehicleDetail implements Serializable {
@Column(name = "fixed_loss_status")
private Integer fixedLossStatus;
/**
* 返还的免费天数
*/
@ApiModelProperty(value = "返回的免费天数")
@Column(name = "back_free_days")
Integer backFreeDays;
// /**
// * 返还的免费天数
// */
// @ApiModelProperty(value = "返回的免费天数")
// @Column(name = "back_free_days")
// Integer backFreeDays;
@ApiModelProperty(value = "违章金额")
@Column(name = "violate_traffic_amount")
......
......@@ -12,12 +12,11 @@ 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.xxfc.platform.activity.user.UserInfoBiz;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.contant.enumerate.CrosstownTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DepositRefundStatus;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
......@@ -168,6 +167,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
if (baseOrder == null) {
return ObjectRestResponse.createFailedResult(ResCode.ORDER_IS_NOT_EXIST.getCode(), ResCode.ORDER_IS_NOT_EXIST.getDesc());
}
OrderRentVehicleDetail orderRentVehicleDetail = orderRentVehicleBiz.selectById(baseOrder.getDetailId());
if (orderVehicleCrosstownDto.getType() == CrosstownTypeEnum.DEPARTURE.getCode()) {
boolean flag = getTodayTime(orderRentVehicleDetail.getEndTime());
......@@ -198,6 +198,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode(), ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getDesc());
}
}
}
AppUserDTO appUserDTO = userFeign.userDetailById(baseOrder.getUserId()).getData();
//调用车辆管理的出车还车
......
......@@ -29,8 +29,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.HOUR_MINUTE_FORMATTE_HUTOOL;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum.NONE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.*;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
/**
......@@ -472,7 +472,7 @@ public class OrderMsgBiz {
private void handelSmsParamApp(CompanyDetail startCompanyDetail, CompanyDetail endCompanyDetail, OrderRentVehicleDetail orvd, OrderTourDetail otd, OrderMemberDetail omd, BaseOrder baseOrder, List<String> smsParams, AppUserDTO appUserDTO, int paramHandelType) {
switch (paramHandelType) {
case SmsTemplateDTO.PAY_A :
if(0 < appUserDTO.getMemberLevel() ) {
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
......@@ -502,14 +502,14 @@ public class OrderMsgBiz {
smsParams.add(appUserDTO.getRentFreeDays().toString());
break;
case SmsTemplateDTO.CANCEL_A :
if(0 < appUserDTO.getMemberLevel() ) {
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
}
break;
case SmsTemplateDTO.PAY_I :
if(0 < appUserDTO.getMemberLevel() ) {
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
......@@ -517,7 +517,7 @@ public class OrderMsgBiz {
smsParams.add(startCompanyDetail.getAddrDetail());
break;
case SmsTemplateDTO.PAY_J :
if(0 < appUserDTO.getMemberLevel() ) {
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
......@@ -534,7 +534,7 @@ public class OrderMsgBiz {
private void handelDepositSmsParamApp(BigDecimal originalAmount, BigDecimal violateAmount, BigDecimal refundAmount, BigDecimal residueAmount,BaseOrder baseOrder, List<String> smsParams, AppUserDTO appUserDTO, int paramHandelType) {
switch (paramHandelType) {
case SmsTemplateDTO.CANCEL_C :
if(0 < appUserDTO.getMemberLevel() ) {
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
......@@ -549,7 +549,7 @@ public class OrderMsgBiz {
case SmsTemplateDTO.REFUND_A:
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Integer rentDepositAutoRefundTime = new Integer(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_DEPOSIT_AUTO_REFUND_TIME).getDetail());
if(0 < appUserDTO.getMemberLevel() ) {
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
......@@ -562,7 +562,7 @@ public class OrderMsgBiz {
smsParams.add(DateUtil.formatDateTime(DateUtil.date(baseOrder.getRefundTime() + Long.valueOf(rentDepositAutoRefundTime * 60 * 60 * 1000))));
break;
case SmsTemplateDTO.REFUND_B:
if(0 < appUserDTO.getMemberLevel() ) {
if(SYS_TRUE.equals(appUserDTO.getIsMember()) && !NONE.getCode().equals(appUserDTO.getMemberLevel()) ) {
smsParams.add(USER_M+ appUserDTO.getRealname());
}else {
smsParams.add(USER_N+ appUserDTO.getRealname());
......
......@@ -19,5 +19,5 @@ public interface DailyTravelOrderStatisticsMapper extends Mapper<DailyTravelOrde
List<DailyTravelOrderStatistics> getTravelPenalSum(@Param("day") Integer day);
OrderStatistics monthOrderTotal(Integer branchCompanyId);
OrderStatistics monthOrderTotal(@Param("companyId")Integer companyId);
}
......@@ -25,5 +25,5 @@ public interface DailyVehicleOrderStatisticsMapper extends Mapper<DailyVehicleOr
List<DailyVehicleOrderStatistics> getViolationMoney(@Param("day") Integer day);
OrderStatistics monthOrderTotal(Integer companyId);
OrderStatistics monthOrderTotal(@Param("companyId")Integer companyId);
}
......@@ -151,7 +151,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
}
if (orderPageVO.getOrderRentVehicleDetail() != null && orderPageVO.getOrderRentVehicleDetail().getVehicleId() != null) {
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderPageVO.getOrderRentVehicleDetail().getVehicleId());
log.info("获取车辆信息返回消息:{}", restResponse.getMessage());
log.info("获取车辆信息返回消息:{}", restResponse.getData());
if (restResponse.getData() != null) {
orderPageVO.setVehicleNumberPlat(restResponse.getData().getNumberPlate());
}
......
......@@ -52,6 +52,11 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
*/
private final Integer TYPE_TOTAL = 4;
/**
* 数据权限
*/
private final Integer DATA_AUTHORITY=1;
@Autowired
private DailyVehicleOrderStatisticsBiz vehicleBiz;
......@@ -77,6 +82,10 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
UserDTO user = userDTOObjectRestResponse.getData();
Integer companyId = user.getCompanyId();
if (DATA_AUTHORITY.equals(user.getDataAll())){
companyId=null;
}
if (TYPE_VEHICLE.equals(type)) {
OrderStatistics vehicle = vehicleBiz.findAll(companyId);
return ObjectRestResponse.succ(vehicle);
......
......@@ -16,33 +16,37 @@
</select>
<select id="monthOrderTotal" resultType="com.xxfc.platform.order.entity.OrderStatistics">
SELECT
SELECT
IFNULL(sum(gmv),0) as totalGmv
FROM
(
SELECT
ANY_VALUE(id) AS id ,
ANY_VALUE(branch_company_id) AS branch_company_id,
ANY_VALUE(one_day) AS one_day,
ANY_VALUE(gmv) AS gmv,
ANY_VALUE(crt_time) AS crt_time
FROM
daily_members_order_statistics
GROUP BY
one_day,branch_company_id
) m
SELECT
ANY_VALUE(id) AS id ,
ANY_VALUE(branch_company_id) AS branch_company_id,
ANY_VALUE(one_day) AS one_day,
ANY_VALUE(gmv) AS gmv,
ANY_VALUE(crt_time) AS crt_time
FROM
daily_members_order_statistics
GROUP BY
one_day,branch_company_id
) m
WHERE
branch_company_id =#{companyId}
1=1
<if test="companyId != null">
and branch_company_id =#{companyId}
</if>
</select>
<!-- <select id="updateByExampleSelective">-->
<!-- SELECT-->
<!-- IFNULL(sum(gmv),0) as totalGmv-->
<!-- FROM-->
<!-- daily_members_order_statistics-->
<!-- WHERE-->
<!-- branch_company_id =#{companyId}-->
<!-- and-->
<!-- DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),interval 1 day),'%Y-%c')-->
<!-- <select id="updateByExampleSelective">-->
<!-- SELECT-->
<!-- IFNULL(sum(gmv),0) as totalGmv-->
<!-- FROM-->
<!-- daily_members_order_statistics-->
<!-- WHERE-->
<!-- branch_company_id =#{companyId}-->
<!-- and-->
<!-- DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),interval 1 day),'%Y-%c')-->
<!-- </select>-->
<!-- </select>-->
</mapper>
\ No newline at end of file
......@@ -55,31 +55,34 @@
IFNULL(sum(penal_sum) ,0) as totalPenalSum
FROM
(
SELECT
ANY_VALUE(id) AS id,
ANY_VALUE(branch_company_id) AS branch_company_id,
ANY_VALUE(one_day) AS one_day,
ANY_VALUE(gmv) AS gmv,
ANY_VALUE(penal_sum) AS penal_sum,
ANY_VALUE(crt_time) AS crt_time
FROM
daily_travel_order_statistics
GROUP BY
one_day,branch_company_id
) o
SELECT
ANY_VALUE(id) AS id,
ANY_VALUE(branch_company_id) AS branch_company_id,
ANY_VALUE(one_day) AS one_day,
ANY_VALUE(gmv) AS gmv,
ANY_VALUE(penal_sum) AS penal_sum,
ANY_VALUE(crt_time) AS crt_time
FROM
daily_travel_order_statistics
GROUP BY
one_day,branch_company_id
) o
WHERE
branch_company_id =#{companyId}
1=1
<if test="companyId != null">
and branch_company_id =#{companyId}
</if>
</select>
<!-- <select id="updateByExampleSelective">-->
<!-- SELECT-->
<!-- IFNULL(sum(gmv),0) as totalGmv,-->
<!-- IFNULL(sum(penal_sum) ,0) as totalPenalSum-->
<!-- FROM-->
<!-- daily_travel_order_statistics-->
<!-- WHERE-->
<!-- branch_company_id =#{branchCompanyId}-->
<!-- AND-->
<!-- DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%c')-->
<!-- </select>-->
<!-- <select id="updateByExampleSelective">-->
<!-- SELECT-->
<!-- IFNULL(sum(gmv),0) as totalGmv,-->
<!-- IFNULL(sum(penal_sum) ,0) as totalPenalSum-->
<!-- FROM-->
<!-- daily_travel_order_statistics-->
<!-- WHERE-->
<!-- branch_company_id =#{branchCompanyId}-->
<!-- AND-->
<!-- DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%c')-->
<!-- </select>-->
</mapper>
\ No newline at end of file
......@@ -80,6 +80,40 @@
</select>
<!-- 获取赔偿和延期JSON字符串-->
<select id="monthOrderTotal" resultType="com.xxfc.platform.order.entity.OrderStatistics">
SELECT
IFNULL(sum(gmv),0) as totalGmv,
(IFNULL(sum(security_deposit),0)-IFNULL(sum(refund_security_deposit) ,0)) as totalSecurityDeposit,
IFNULL(sum(refund_security_deposit) ,0) as totalRefundSecurityDeposit,
IFNULL(sum(compensation) ,0) as totalCompensation,
IFNULL(sum(forfeit) ,0) as totalForfeit,
IFNULL(sum(penal_sum) ,0) as totalPenalSum,
IFNULL(sum(postpone) ,0) as totalPostpone
FROM
(
SELECT
ANY_VALUE(id) as id,
one_day,
branch_company_id,
ANY_VALUE(gmv) AS gmv,
ANY_VALUE(security_deposit) AS security_deposit,
ANY_VALUE(refund_security_deposit) AS refund_security_deposit,
ANY_VALUE(forfeit) AS forfeit,ANY_VALUE(penal_sum) AS penal_sum,
ANY_VALUE(postpone) AS postpone,ANY_VALUE(crt_time) AS crt_time,
ANY_VALUE(compensation) AS compensation
FROM
daily_vehicle_order_statistics
GROUP BY
one_day,branch_company_id
) a
WHERE
1=1
<if test="companyId != null">
and branch_company_id = #{companyId}
</if>
</select>
<!--违章-->
<select id="getCompensationAndPostpone" resultType="HashMap">
SELECT
v.start_company_id AS branchCompanyId,
......@@ -105,7 +139,7 @@
order by v.start_company_id asc
</select>
<!--违章-->
<select id="getViolationMoney" resultType="com.xxfc.platform.order.entity.DailyVehicleOrderStatistics">
SELECT
d.start_company_id AS branchCompanyId,
......@@ -136,37 +170,6 @@
d.start_company_id
</select>
<select id="monthOrderTotal" resultType="com.xxfc.platform.order.entity.OrderStatistics">
SELECT
IFNULL(sum(gmv),0) as totalGmv,
(IFNULL(sum(security_deposit),0)-IFNULL(sum(refund_security_deposit) ,0)) as totalSecurityDeposit,
IFNULL(sum(refund_security_deposit) ,0) as totalRefundSecurityDeposit,
IFNULL(sum(compensation) ,0) as totalCompensation,
IFNULL(sum(forfeit) ,0) as totalForfeit,
IFNULL(sum(penal_sum) ,0) as totalPenalSum,
IFNULL(sum(postpone) ,0) as totalPostpone
FROM
(
SELECT
ANY_VALUE(id) as id,
one_day,
branch_company_id,
ANY_VALUE(gmv) AS gmv,
ANY_VALUE(security_deposit) AS security_deposit,
ANY_VALUE(refund_security_deposit) AS refund_security_deposit,
ANY_VALUE(forfeit) AS forfeit,ANY_VALUE(penal_sum) AS penal_sum,
ANY_VALUE(postpone) AS postpone,ANY_VALUE(crt_time) AS crt_time,
ANY_VALUE(compensation) AS compensation
FROM
daily_vehicle_order_statistics
GROUP BY
one_day,branch_company_id
) a
WHERE
branch_company_id = #{companyId}
</select>
<!-- <select id="updateByExampleSelective">-->
<!-- SELECT-->
<!-- IFNULL(sum(gmv),0) as totalGmv,-->
......
......@@ -112,4 +112,7 @@ public class TourGoodDTO {
@ApiModelProperty(value = "海报背景")
private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -134,4 +134,7 @@ public class TourGood implements Serializable {
@Column(name = "poster_background")
@ApiModelProperty(value = "海报背景")
private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -129,6 +129,8 @@ public class TourGoodDetailVo {
List<GoodTagDTO> tagDTOS;
private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -36,7 +36,16 @@
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_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>
<!-- 获取旅游路线id-->
<select id="getGoodList" resultType="com.xxfc.platform.tour.vo.TourVerificationInfoVo">
......
package com.xxfc.platform.uccn.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/6 10:47
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class FriendLinkDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 连接地址
*/
private String linkUrl;
/**
* 名称
*/
private String name;
/**
* 简要说明
*/
private String brief;
/**
* 排序
*/
private Integer rank;
/**
* 创建者id
*/
private Integer crtUser;
/**
* 上架状态 上架:true 下架:false
*/
private Boolean onState;
/**
* 平台 1:欣新房车官网 2:滴房车官网 0:无限制
*/
private Integer platform;
}
package com.xxfc.platform.uccn.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/6 12:05
*/
@Data
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
public class FriendLinkFindDTO extends PageParam {
private String name;
private Boolean onState;
}
package com.xxfc.platform.uccn.dto;
import com.xxfc.platform.uccn.entity.Model;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@NoArgsConstructor
public class ModelDto {
private Model parent;
private List<Model> list;
public ModelDto(Model parent, List<Model> list) {
this.parent = parent;
this.list = list;
}
}
package com.xxfc.platform.uccn.dto;
import com.xxfc.platform.uccn.entity.SEO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
@Data
@Api
public class SeoDTO extends SEO {
@Column(name = "modeName")
@ApiModelProperty(value = "模块名称")
private String modelName;
@Column(name = "model_id")
@ApiModelProperty(value = "模块id")
private Integer modelId;
}
......@@ -103,4 +103,7 @@ public class SummitActivitySaveDTO implements Serializable {
@ApiModelProperty(value = "排序")
private Integer rank;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -3,14 +3,12 @@ package com.xxfc.platform.uccn.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import tk.mybatis.mapper.annotation.KeySql;
import tk.mybatis.mapper.code.IdentityDialect;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
......@@ -108,7 +106,7 @@ public class Article {
private Integer status;
@Column(name ="type")
@Column(name = "type")
@ApiModelProperty(value = "文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网")
private Integer type;
......@@ -116,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;
......@@ -125,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;
......@@ -134,9 +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;
}
package com.xxfc.platform.uccn.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author libin
* @version 1.0
* @description 友情连接
* @data 2019/9/6 10:40
*/
@Data
@Entity
@Table(name = "friend_link")
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class FriendLink implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "JDBC")
private Long id;
/**
* 连接地址
*/
@Column(name = "link_url")
private String linkUrl;
/**
* 名称
*/
private String name;
/**
* 简要说明
*/
private String brief;
/**
* 排序
*/
private Integer rank;
/**
* 创建时间
*/
@Column(name = "crt_time")
private Long crtTime;
/**
* 更新时间
*/
@Column(name = "upd_time")
private Long updTime;
/**
* 发布时间
*/
@Column(name = "publish_time")
private Long publishTime;
/**
* 删除状态 true:正常 1:删除
*/
@Column(name = "is_del")
private Boolean isDel;
/**
* 创建者id
*/
@Column(name = "crt_user")
private Integer crtUser;
/**
* 上架状态 上架:true 下架:false
*/
@Column(name = "on_state")
private Boolean onState;
/**
* 平台 1:欣新房车官网 2:滴房车官网 0:无限制
*/
private Integer platform;
}
package com.xxfc.platform.uccn.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javafx.scene.input.Mnemonic;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Data
@Table(name = "model")
@ApiModel(value = "官网模块实体")
@NoArgsConstructor
public class Model implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(value = "主键")
private Integer id;
@Column(name = "parent_id")
@ApiModelProperty(value = "父模块id")
private Integer parentId;
@Column(name = "name")
@ApiModelProperty(value = "模块名称")
private String name;
@Column(name = "level")
@ApiModelProperty(value = "模块等级")
private Integer level;
@Column(name = "cre_time")
@ApiModelProperty(value = " 创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date creTime;
@Column(name = "upd_time")
@ApiModelProperty(value = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updTime;
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除")
private Integer isDel;
@Column(name = "rank")
@ApiModelProperty(value = "排序")
private Integer rank;
public Model(Integer id) {
this.id = id;
}
}
package com.xxfc.platform.uccn.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.util.Date;
@Data
@Table(name = "seo")
@ApiModel(value = "seo列表实体")
@NoArgsConstructor
public class SEO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(value = "主键")
private Integer id;
@Column(name = "model_id")
@ApiModelProperty(value = "模块id")
private Integer modelId;
@Column(name = "title")
@ApiModelProperty(value = "title内容")
private String title;
@Column(name = "keywords")
@ApiModelProperty(value = "关键子")
private String keywords;
@Column(name = "description")
@ApiModelProperty(value = "description内容")
private String description;
@Column(name = "header")
@ApiModelProperty(value = "标题")
private String header;
@Column(name = "cre_time")
@ApiModelProperty(value = " 创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date creTime;
@Column(name = "upd_time")
@ApiModelProperty(value = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updTime;
}
......@@ -241,4 +241,7 @@ public class SummitActivity implements Serializable {
@ApiModelProperty(value = "排序")
private Integer rank;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
package com.xxfc.platform.uccn.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/6 10:53
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class FriendLinkAdminVO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 连接地址
*/
private String linkUrl;
/**
* 名称
*/
private String name;
/**
* 简要说明
*/
private String brief;
/**
* 排序
*/
private Integer rank;
/**
* 创建时间
*/
private Long crtTime;
/**
* 发布时间
*/
private Long publishTime;
/**
* 创建者id
*/
private Integer crtUser;
/**
* 上架状态 上架:true 下架:false
*/
private Boolean onState;
/**
* 平台 1:欣新房车官网 2:滴房车官网 0:无限制
*/
private Integer platform;
}
package com.xxfc.platform.uccn.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/6 10:51
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class FriendLinkVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 连接地址
*/
private String linkUrl;
/**
* 名称
*/
private String name;
/**
* 简要说明
*/
private String brief;
}
package com.xxfc.platform.uccn.vo;
import lombok.Data;
/**
* @author Administrator
*/
@Data
public class ModelQuery {
private Integer page = 1;
private Integer limit = 10;
}
package com.xxfc.platform.uccn.vo;
import com.xxfc.platform.uccn.entity.Model;
import lombok.Data;
import java.util.List;
@Data
public class ModelVo {
private Integer parentId;
private List<Model> list;
}
package com.xxfc.platform.uccn.vo;
import lombok.Data;
/**
* @author Administrator
*/
@Data
public class SEOQuery {
private Integer page = 1;
private Integer limit = 10;
}
package com.xxfc.platform.uccn.vo;
import com.xxfc.platform.uccn.entity.SEO;
import lombok.Data;
@Data
public class SEOVo extends SEO {
}
......@@ -122,4 +122,7 @@ public class SummitActivityAdminVo implements Serializable {
@ApiModelProperty(value = "排序")
private Integer rank;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -83,4 +83,6 @@ public class SummitActivityDetailVo implements Serializable {
@JsonIgnore
private Integer willNum;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -58,4 +58,7 @@ public class SummitActivityVo implements Serializable {
@ApiModelProperty(value = "排序")
@JsonIgnore
private Integer rank;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
package com.xxfc.platform.uccn.vo;
import lombok.Data;
public enum TypeEnum {
VEHICLE(1, "车型"),
TOUR(2, "旅游"),
......
......@@ -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;
}
......@@ -113,11 +115,15 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
// if (articleList.size() > HOME_PAGE_NUMBER) {
// return articleList.subList(0, HOME_PAGE_NUMBER);
// } else {
return articleList;
return articleList;
// }
// }
}
/**
* 添加文章
* @param article
*/
@Transactional(rollbackFor = Exception.class)
public void add(Article article) {
if (article == null) {
......@@ -131,11 +137,24 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
if (article.getType() == null) {
article.setType(0);
}
// if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
// throw new BaseException("必须设置seo");
// }
if (article.getStatus()==1){
article.setAddTime(new Date());
}
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,22 +166,36 @@ 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());
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);
article.setUpdTime(new Date());
article.setAddTime(new Date());
article.setStatus(1);
return mapper.updateByPrimaryKeySelective(article);
return mapper.updateByPrimaryKeySelective(article);
}
/**
* 下架
* @param id
* @return
*/
public int soldOut(Integer id) {
Article article = new Article();
article.setId(id);
......@@ -171,6 +204,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);
......
package com.xxfc.platform.uccn.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.uccn.dto.FriendLinkDTO;
import com.xxfc.platform.uccn.dto.FriendLinkFindDTO;
import com.xxfc.platform.uccn.entity.FriendLink;
import com.xxfc.platform.uccn.mapper.FriendLinkMapper;
import com.xxfc.platform.uccn.vo.FriendLinkAdminVO;
import com.xxfc.platform.uccn.vo.FriendLinkVO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/6 10:57
*/
@Service
public class FriendLinkBiz extends BaseBiz<FriendLinkMapper, FriendLink> {
/**
* 保存编辑
* @param friendLinkDTO
*/
public void saveFriendLink(FriendLinkDTO friendLinkDTO) {
FriendLink friendLink = new FriendLink();
BeanUtils.copyProperties(friendLinkDTO, friendLink);
if (friendLink.getOnState()){
friendLink.setPublishTime(Instant.now().toEpochMilli());
}
if (Objects.isNull(friendLinkDTO.getId())) {
friendLink.setCrtTime(Instant.now().toEpochMilli());
friendLink.setIsDel(false);
mapper.insertSelective(friendLink);
}else {
friendLink.setUpdTime(Instant.now().toEpochMilli());
mapper.updateByPrimaryKeySelective(friendLink);
}
}
/**
* 上下架
* @param id
*/
public void updateFriendLinkOnStateById(Long id,Boolean onState){
FriendLink friendLink = FriendLink.builder().id(id).onState(onState).updTime(Instant.now().toEpochMilli()).build();
if (onState){
friendLink.setPublishTime(Instant.now().toEpochMilli());
}
mapper.updateByPrimaryKeySelective(friendLink);
}
/**
* 删除
* @param id
*/
public void deleteFriendLinkById(Long id){
FriendLink friendLink = FriendLink.builder().id(id).updTime(Instant.now().toEpochMilli()).isDel(true).build();
mapper.updateByPrimaryKeySelective(friendLink);
}
/**
* 根据id查询
* @param id
* @return
*/
public FriendLinkDTO findFriendLinkById(Long id){
FriendLinkDTO friendLinkDTO = FriendLinkDTO.builder().build();
FriendLink friendLink = mapper.selectByPrimaryKey(id);
if (Objects.isNull(friendLink)){
return friendLinkDTO;
}
BeanUtils.copyProperties(friendLink,friendLinkDTO);
return friendLinkDTO;
}
public List<FriendLinkVO> listFriendLinkByPlatform(Integer platform){
List<FriendLinkVO> friendLinkVOS = new ArrayList<>();
Example example = new Example(FriendLink.class);
example.setOrderByClause("rank DESC,publish_time DESC");
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
criteria.andEqualTo("onState",true);
criteria.andIn("platform", Arrays.asList(platform,0));
criteria.andNotEqualTo("linkUrl","");
List<FriendLink> friendLinks = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(friendLinks)){
return friendLinkVOS;
}
friendLinkVOS = JSON.parseObject(JSON.toJSONString(friendLinks), new TypeReference<List<FriendLinkVO>>() {
});
return friendLinkVOS;
}
public PageDataVO<FriendLinkAdminVO> listFriendLinkWithPage(FriendLinkFindDTO friendLinkFindDTO){
PageDataVO<FriendLinkAdminVO> pageDataVO = new PageDataVO<>();
Example example = new Example(FriendLink.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
if (!StringUtils.isEmpty(friendLinkFindDTO.getName())){
criteria.andLike("name",String.format("%%%s%%",friendLinkFindDTO.getName().trim()));
}
if (Objects.nonNull(friendLinkFindDTO.getOnState())){
criteria.andEqualTo("onState",friendLinkFindDTO.getOnState());
}
PageDataVO<FriendLink> friendLinkPageDataVO = PageDataVO.pageInfo(friendLinkFindDTO.getPage(),friendLinkFindDTO.getLimit(),()->mapper.selectByExample(example));
List<FriendLink> data = friendLinkPageDataVO.getData();
if (CollectionUtils.isEmpty(data)){
return pageDataVO;
}
List<FriendLinkAdminVO> friendLinkAdminVOS = new ArrayList<>();
FriendLinkAdminVO friendLinkAdminVO;
for (FriendLink friendLink : data) {
friendLinkAdminVO = new FriendLinkAdminVO();
BeanUtils.copyProperties(friendLink,friendLinkAdminVO);
friendLinkAdminVOS.add(friendLinkAdminVO);
}
pageDataVO.setData(friendLinkAdminVOS);
pageDataVO.setPageSize(friendLinkPageDataVO.getPageSize());
pageDataVO.setPageNum(friendLinkPageDataVO.getPageNum());
pageDataVO.setTotalPage(friendLinkPageDataVO.getTotalPage());
pageDataVO.setTotalCount(friendLinkPageDataVO.getTotalCount());
return pageDataVO;
}
}
package com.xxfc.platform.uccn.biz;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.uccn.dto.ModelDto;
import com.xxfc.platform.uccn.entity.Model;
import com.xxfc.platform.uccn.vo.ModelVo;
import com.xxfc.platform.uccn.mapper.ModelBackgroundMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class ModelBackgroundBiz extends BaseBiz<ModelBackgroundMapper, Model> {
private final Integer BASE_PARENT_ID = 0;
private final Integer NOT_DELETE = 0;
private final Integer level=2;
@Autowired
private ApplicationContext context;
public List<ModelDto> getList() {
List<Model> ModelList = getProxy().getListByParentId(BASE_PARENT_ID);
if (CollectionUtils.isEmpty(ModelList)) {
return new ArrayList<>();
}
return getModelDtos(ModelList);
}
/**
* 获取ModelDto集合
* @param models
* @return
*/
private ArrayList<ModelDto> getModelDtos(List<Model> models) {
ArrayList<ModelDto> modelDtos = new ArrayList<>();
for (Model el : models) {
if (el.getLevel()==3) {
break;
}
List<Model> list = getListByParentId(el.getId());
modelDtos.add(new ModelDto(el, list));
modelDtos.addAll(getModelDtos(list));
}
return modelDtos;
}
/**
* 根据父类id获取所有子类集合
*
* @param parentId
* @return
*/
// @Cache(key = "ModelList{1}")
public List<Model> getListByParentId(Integer parentId) {
Example exa = new Example(Model.class);
Example.Criteria criteria = exa.createCriteria();
criteria.andEqualTo("parentId",parentId).andEqualTo("isDel",NOT_DELETE);
exa.orderBy("rank").asc();
return mapper.selectByExample(exa);
}
/**
* 获取代理对象
*
* @return
*/
private ModelBackgroundBiz getProxy() {
return context.getBean(ModelBackgroundBiz.class);
}
/**
* 修改子模块
*
* @param Modelvo
* @return
*/
// @CacheClear(key = "ModelList{1.Integer}")
public String update(ModelVo Modelvo) {
if (Modelvo==null||Modelvo.getParentId()==null) {
return "无修改数据";
}
Model Model = selectById(Modelvo.getParentId());
if (Model==null||(!Model.getIsDel().equals(NOT_DELETE))||BASE_PARENT_ID.equals(Model.getParentId())) {
return "该标签不能修改";
}
if (CollectionUtils.isNotEmpty(Modelvo.getList())) {
for (Model el : Modelvo.getList()) {
if (el.getId()==null) {
el.setIsDel(NOT_DELETE);
el.setCreTime(new Date());
el.setParentId(Modelvo.getParentId());
if (el.getRank() == null) {
el.setRank(0);
}
mapper.insertSelective(el);
}else {
el.setUpdTime(new Date());
mapper.updateByPrimaryKeySelective(el);
}
}
}
return null;
}
}
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.xxfc.platform.uccn.dto.SeoDTO;
import com.xxfc.platform.uccn.entity.SEO;
import com.xxfc.platform.uccn.mapper.SEOMapper;
import com.xxfc.platform.uccn.vo.SEOQuery;
import com.xxfc.platform.uccn.vo.SEOVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example;
import java.util.Date;
import java.util.List;
/**
* @author Administrator
*/
@Service
@Slf4j
public class SEOBiz extends BaseBiz<SEOMapper, SEO> {
public PageInfo<SeoDTO> getList(SEOQuery query) {
PageHelper.startPage(query.getPage(),query.getLimit());
List<SeoDTO> seodtoList = mapper.getSEODTOList();
return PageInfo.of(seodtoList);
}
@Transactional(rollbackFor = Exception.class)
public boolean update(SEOVo seoVo) {
try {
if (seoVo==null) {
return false;
}
SEO seo = new SEO();
BeanUtilsBean.getInstance().copyProperties(seo,seoVo);
Example example = new Example(SEO.class);
example.createCriteria().andEqualTo("modelId", seo.getModelId());
List<SEO> list = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
seo.setCreTime(new Date());
mapper.insertSelective(seo);
}else if (list.size()==1){
seo.setUpdTime(new Date());
mapper.updateByPrimaryKeySelective(seo);
}else {
log.error("错误!该模块保存有多个seo");
return false;
}
return true;
} catch (Exception e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
}
public SEO getSeoByModelId(Integer modelId) {
SEO seo = new SEO();
seo.setModelId(modelId);
return selectOne(seo);
}
}
......@@ -187,9 +187,7 @@ public class SummitActivityBiz extends BaseBiz<SummitActivityMapper, SummitActiv
if (summitActivities.size() <= num) {
for (SummitActivity summitActivity : summitActivities) {
summitActivityVo = new SummitActivityVo();
summitActivityVo.setId(summitActivity.getId());
summitActivityVo.setBanner(summitActivity.getBanner());
summitActivityVo.setTitle(summitActivity.getTitle());
BeanUtils.copyProperties(summitActivity,summitActivityVo);
summitActivityVos.add(summitActivityVo);
}
} else {
......@@ -198,9 +196,7 @@ public class SummitActivityBiz extends BaseBiz<SummitActivityMapper, SummitActiv
for (Integer i : resultSet) {
summitActivityVo = new SummitActivityVo();
SummitActivity summitActivity = summitActivities.get(i);
summitActivityVo.setId(summitActivity.getId());
summitActivityVo.setBanner(summitActivity.getBanner());
summitActivityVo.setTitle(summitActivity.getTitle());
BeanUtils.copyProperties(summitActivity,summitActivityVo);
summitActivityVos.add(summitActivityVo);
}
}
......
package com.xxfc.platform.uccn.mapper;
import com.xxfc.platform.uccn.entity.FriendLink;
import tk.mybatis.mapper.common.Mapper;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/6 10:58
*/
public interface FriendLinkMapper extends Mapper<FriendLink> {
}
package com.xxfc.platform.uccn.mapper;
import com.xxfc.platform.uccn.entity.Model;
import tk.mybatis.mapper.common.Mapper;
public interface ModelBackgroundMapper extends Mapper<Model> {
}
package com.xxfc.platform.uccn.mapper;
import com.xxfc.platform.uccn.dto.SeoDTO;
import com.xxfc.platform.uccn.entity.SEO;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface SEOMapper extends Mapper<SEO> {
List<SeoDTO> getSEODTOList();
}
package com.xxfc.platform.uccn.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.uccn.biz.FriendLinkBiz;
import com.xxfc.platform.uccn.vo.FriendLinkVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/6 10:59
*/
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/app/unauth/friend_link")
@Api(tags = "友情链接*官网")
public class FriendLinkController {
private final FriendLinkBiz friendLinkBiz;
@ApiOperation("查询链接列表")
@GetMapping("/list")
public ObjectRestResponse<List<FriendLinkVO>> listFriendLink(@RequestParam(value = "platform",required = false,defaultValue = "1") Integer platform){
List<FriendLinkVO> friendLinkVOS = friendLinkBiz.listFriendLinkByPlatform(platform);
return ObjectRestResponse.succ(friendLinkVOS);
}
}
package com.xxfc.platform.uccn.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.uccn.biz.SEOBiz;
import com.xxfc.platform.uccn.entity.SEO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Administrator
*/
@RestController
@RequestMapping("seo")
@Api(tags={"seo后台管理类"})
public class SEOController extends BaseController<SEOBiz, SEO> {
@GetMapping("/app/unauth/officialWebsite/{modelId}")
@ApiOperation(value = "获取官网seo")
@IgnoreUserToken
public ObjectRestResponse getSeoByModelId(@PathVariable Integer modelId){
return ObjectRestResponse.succ(baseBiz.getSeoByModelId(modelId));
}
}
\ No newline at end of file
......@@ -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 -> {
......
package com.xxfc.platform.uccn.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.uccn.biz.FriendLinkBiz;
import com.xxfc.platform.uccn.dto.FriendLinkDTO;
import com.xxfc.platform.uccn.dto.FriendLinkFindDTO;
import com.xxfc.platform.uccn.vo.FriendLinkAdminVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/9/6 10:59
*/
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/admin/friend_link")
@Api(tags = "友情链接*后台")
public class FriendLinkAdminController {
private final FriendLinkBiz friendLinkBiz;
@ApiOperation("分页")
@PostMapping("/page")
public ObjectRestResponse<PageDataVO<FriendLinkAdminVO>> listFriendLinkWithPage(@RequestBody FriendLinkFindDTO friendLinkFindDTO){
PageDataVO<FriendLinkAdminVO> pageDataVO = friendLinkBiz.listFriendLinkWithPage(friendLinkFindDTO);
return ObjectRestResponse.succ(pageDataVO);
}
@ApiOperation("根据id查询")
@GetMapping("/{id}")
public ObjectRestResponse<FriendLinkDTO> findFriendLink(@PathVariable(value = "id") Long id){
FriendLinkDTO friendLinkDTO = friendLinkBiz.findFriendLinkById(id);
return ObjectRestResponse.succ(friendLinkDTO);
}
@ApiOperation("编辑或保存")
@PostMapping("/save")
public ObjectRestResponse<Void> saveFriendLink(@RequestBody FriendLinkDTO friendLinkDTO){
friendLinkBiz.saveFriendLink(friendLinkDTO);
return ObjectRestResponse.succ();
}
@ApiOperation("上下架")
@PutMapping("/on_state/{id}/{state}")
public ObjectRestResponse<Void> updateFriendLinkOnstate(@PathVariable(value = "id") Long id,@PathVariable(value = "state") Boolean state){
friendLinkBiz.updateFriendLinkOnStateById(id,state);
return ObjectRestResponse.succ();
}
@ApiOperation("删除")
@DeleteMapping("/{id}")
public ObjectRestResponse<Void> deleteFriendLink(@PathVariable(value = "id") Long id){
friendLinkBiz.deleteFriendLinkById(id);
return ObjectRestResponse.succ();
}
}
package com.xxfc.platform.uccn.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.uccn.biz.ModelBackgroundBiz;
import com.xxfc.platform.uccn.entity.Model;
import com.xxfc.platform.uccn.vo.ModelVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("Model")
@Api(tags={"Model后台管理类"})
public class ModelBackgroundController extends BaseController<ModelBackgroundBiz, Model> {
@GetMapping("/list")
@ApiOperation(value = "查询模块列表")
public ObjectRestResponse findList(){
return ObjectRestResponse.succ(baseBiz.getList());
}
@PutMapping("/upd")
@ApiOperation(value = "修改模块")
public ObjectRestResponse update(@RequestBody ModelVo modelvo){
String update = baseBiz.update(modelvo);
if (update==null) {
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,update) ;
}
}
package com.xxfc.platform.uccn.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.uccn.biz.SEOBiz;
import com.xxfc.platform.uccn.entity.SEO;
import com.xxfc.platform.uccn.vo.SEOQuery;
import com.xxfc.platform.uccn.vo.SEOVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
/**
* @author Administrator
*/
@RestController
@RequestMapping("seoBackground")
@Api(tags={"seo后台管理类"})
public class SEOBackgroundController extends BaseController<SEOBiz, SEO> {
@PostMapping("/list")
@ApiOperation(value = "查询模块列表")
public ObjectRestResponse findList(@RequestBody SEOQuery query){
return ObjectRestResponse.succ(baseBiz.getList(query));
}
@PutMapping("/upd")
@ApiOperation(value = "修改模块")
public ObjectRestResponse update(@RequestBody SEOVo seoVo){
boolean result = baseBiz.update(seoVo);
if (result) {
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail() ;
}
}
......@@ -4,7 +4,7 @@
<mapper namespace="com.xxfc.platform.uccn.mapper.ArticleMapper">
<select id="getArticleList" resultType="com.xxfc.platform.uccn.entity.Article">
select id, title,epitome,add_time,cover_image from article
select id, title,epitome,add_time,cover_image,`alt` from article
where
is_del=0
and status=1
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.uccn.mapper.SEOMapper">
<select id="getSEODTOList" resultType="com.xxfc.platform.uccn.dto.SeoDTO">
select
m.name as modelName ,
m.id as model_id,
s.id,
s.title as title,
s.keywords as keywords,
s.description as description,
s.header as header
from
model m
left join
seo s
on
m.id= s.model_id
WHERE
m.is_del = 0
ORDER BY
m.`level` ASC
</select>
</mapper>
\ No newline at end of file
......@@ -72,6 +72,17 @@
<artifactId>junrar</artifactId>
<version>0.7</version>
</dependency>
<!-- jpush -->
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.9</version>
</dependency>
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jiguang-common</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
......
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;
}
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.*;
/**
* 极光推送
*/
@RestController
@RequestMapping("jpush")
@IgnoreUserToken
public class JPushController {
@Autowired
JPushBiz jPushBiz;
@RequestMapping(value = "/app/unauth/all", method = RequestMethod.GET) //匹配的是href中的download请求
public ObjectRestResponse sendSms(@RequestParam("title") String title) throws Exception {
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);
}
}
......@@ -61,6 +61,14 @@ public class UploadController{
return JsonResultUtil.createSuccessResultWithObj(uploadService.uploadFile(file,prefix));
}
@RequestMapping(value = "/app/unauth/uploadVideo", method = RequestMethod.POST)
public JSONObject uploadVideo(
@RequestParam("file") MultipartFile file,
@RequestParam(value = "prefix",defaultValue = "app")String prefix
)throws Exception {
return JsonResultUtil.createSuccessResultWithObj(uploadService.uploadFile(file,prefix));
}
@RequestMapping(value = "/app/unauth/admin/upload", method = RequestMethod.POST)
public JSONObject uploads(
@RequestParam("file") MultipartFile file,
......
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> {
}
......@@ -16,6 +16,9 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service
@Slf4j
......@@ -196,12 +199,23 @@ public class SmsService {
JSONObject jsonParams=new JSONObject();
for (int i=0;i<params.length;i++){
String para=params[i];
if (para.contains("【")){
para=para.replaceAll("【","");
}
if (para.contains("】")){
para=para.replaceAll("】","");
if (StringUtils.isNotBlank(para)){
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);
}
sendTemplate(PhoneNumbers,jsonParams.toJSONString(),templateCode);
......@@ -216,13 +230,25 @@ public class SmsService {
JSONObject jsonParams=new JSONObject();
for (int i=0;i<params.length;i++){
String para=params[i];
if (para.contains("【")){
para=para.replaceAll("【","");
}
if (para.contains("】")){
para=para.replaceAll("】","");
if (StringUtils.isNotBlank(para)){
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>2){
jsonParams.put(param+(i+2),para);
}else {
jsonParams.put(param+(i+1),para);
......@@ -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 {
SmsService smsService=new SmsService();
//发短信
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("Code=" + response.getCode());
System.out.println("Message=" + response.getMessage());
......
package com.xxfc.platform.vehicle.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;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
......@@ -164,4 +166,7 @@ public class VehicleModel implements Serializable {
@Column(name = "intro")
@ApiModelProperty(value = "简介")
private String intro;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
package com.xxfc.platform.vehicle.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;
@Data
@Table(name = "vehicle_user_reserve")
public class VehicleUserReserve {
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Integer id;
@Column(name = "user_id")
@ApiModelProperty("用户id")
private Integer userId;
@Column(name = "mode_id")
@ApiModelProperty("车型id")
private Integer modeId;
@ApiModelProperty("预定姓名")
private String name;
@ApiModelProperty("电话")
private String phone;
@Column(name = "start_time")
@ApiModelProperty("开始时间")
private Long startTime;
@Column(name = "end_time")
@ApiModelProperty("结束时间")
private Long endTime;
@Column(name = "addr_province")
@ApiModelProperty("地址-省/直辖市(编码)")
private Integer addrProvince;
@Column(name = "province_name")
@ApiModelProperty("省名称")
private String provinceName;
@Column(name = "addr_city")
@ApiModelProperty("市编号")
private Integer addrCity;
@Column(name = "city_name")
@ApiModelProperty("市名称")
private String cityName;
@Column(name = "company_id")
@ApiModelProperty("分公司id")
private Integer companyId;
@Column(name = "crt_time")
@ApiModelProperty("创建时间")
private Long crtTime;
@Column(name = "upd_time")
@ApiModelProperty("更新时间")
private Long updTime;
@ApiModelProperty("0-未处理;1-处理中;2-已处理")
private Integer status;
@Column(name = "is_del")
@ApiModelProperty("是否删除:0-正常;1-删除")
private Integer isDel;
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ public class VehicleBookRecordQueryVo extends PageParam {
/**
* 车辆编号,0-没有
*/
private Integer vehicleCode;
private Integer code;
/**
* 车牌号,空字符串-没有
......
......@@ -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;
}
......@@ -53,4 +53,7 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
*/
List<VehiclePlatCata> UccnCataList;
@ApiModelProperty("seo*html标签优化")
private String alt;
}
......@@ -9,6 +9,11 @@ import java.util.List;
@Data
public class VehiclePlanDto extends PageParam {
/**
* 车辆编号
*/
private Integer code;
@ApiModelProperty(value = "车辆Id")
private String vehicleId;
......
package com.xxfc.platform.vehicle.pojo.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 12:18
*/
@Data
public class VehicleUserReserveDTO extends PageParam {
}
package com.xxfc.platform.vehicle.pojo.vo;
import com.xxfc.platform.vehicle.entity.VehicleUserReserve;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 12:18
*/
@Data
public class VehicleUserReserveVo extends VehicleUserReserve {
@ApiModelProperty("车型名称")
private String modelName;
}
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.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;
import com.xxfc.platform.vehicle.constant.RedisKey;
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 +30,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 +52,9 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
@Autowired
AreaBiz areaBiz;
@Autowired
VehicleBiz vehicleBiz;
@Value("${branchCompanyPic.url}")
private String companyUrl;
......@@ -85,6 +93,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();
......@@ -145,6 +194,7 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
return ObjectRestResponse.succ();
}
//设置基础信息
@CacheClear(pre = RedisKey.BRANCH_COMPANY_CACHE)
public ObjectRestResponse updCompany(CompanyVo companyVo){
if (companyVo==null|| StringUtils.isBlank(companyVo.getCompanyName())|| StringUtils.isBlank(companyVo.getName())||
companyVo.getZoneId()==null||companyVo.getZoneId()==0|| companyVo.getAddrProvince()==null||companyVo.getAddrProvince()==0
......
......@@ -164,21 +164,21 @@ public class VehicleActiveService {
}
List<VehicleBookRecordVo> vehicleBookRecordVos = vehicleBookRecordBiz.selectByVehicleId(vehicleId);
if (vehicleBookRecordVos != null && vehicleBookRecordVos.size() > 0) {
Iterator<VehicleBookRecordVo> iterator = vehicleBookRecordVos.iterator();
while (iterator.hasNext()) {
VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() != null && vehicleBookRecordVo.getVehicleDepartureLogVo().getState() != 1) { //已经出车
stringBuilder.append("中,使用人:");
stringBuilder.append(vehicleBookRecordVo.getVehicleUsername());
stringBuilder.append(" 使用人电话:");
stringBuilder.append(vehicleBookRecordVo.getVehicleUserPhone());
return stringBuilder.toString();
}
Iterator<VehicleBookRecordVo> iterator = vehicleBookRecordVos.iterator();
while (iterator.hasNext()) {
VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() != null && vehicleBookRecordVo.getVehicleDepartureLogVo().getState() != 1) { //已经出车
stringBuilder.append("中,使用人:");
stringBuilder.append(vehicleBookRecordVo.getVehicleUsername());
stringBuilder.append(" 使用人电话:");
stringBuilder.append(vehicleBookRecordVo.getVehicleUserPhone());
return stringBuilder.toString();
}
}
}
stringBuilder.append(", 请联系管理员修改车辆状态为正常状态");
return stringBuilder.toString();
}
}
public void arrival(VehicleArrivalVo arrivalVo) {
Vehicle vehicle = vehicleMapper.selectByPrimaryKey(arrivalVo.getVehicleId());
......
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