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

Merge branch 'dev' into 'master'

Dev-master

See merge request !20
parents 7718fbd4 aea3c1d2
...@@ -7,5 +7,10 @@ target/ ...@@ -7,5 +7,10 @@ target/
.settings/ .settings/
.classpath .classpath
ace-modules/ace-tool/src/main/resources/application-dev.yml ace-modules/ace-tool/src/main/resources/application-dev.yml
**/src/test/ **/src/test
**/logs **/logs
xx-order/xx-order-server/logs/**
*.log
logs/**
/src/main/test/**
...@@ -63,7 +63,7 @@ public class RandomUtil ...@@ -63,7 +63,7 @@ public class RandomUtil
public static void main(String[] args) { public static void main(String[] args) {
int max = 20; int max = 20;
int n = 20; int n = 30;
Set<Integer> set = new HashSet<>(); Set<Integer> set = new HashSet<>();
randomSet(max, n, set, n); randomSet(max, n, set, n);
for(Integer a : set) { for(Integer a : set) {
......
...@@ -37,4 +37,6 @@ public class GoodDataVO{ ...@@ -37,4 +37,6 @@ public class GoodDataVO{
@ApiModelProperty(value = "纬度") @ApiModelProperty(value = "纬度")
private Double latitude; private Double latitude;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -9,4 +9,6 @@ public class PageParam { ...@@ -9,4 +9,6 @@ public class PageParam {
Integer page; Integer page;
@ApiModelProperty("每页限制") @ApiModelProperty("每页限制")
Integer limit; Integer limit;
} }
...@@ -214,7 +214,7 @@ BOOKED_FAILED_CODE = 4007 ...@@ -214,7 +214,7 @@ BOOKED_FAILED_CODE = 4007
4007=车辆预定失败,请重试! 4007=车辆预定失败,请重试!
ONLY_BOOK_FROM_TODAY = 4008 ONLY_BOOK_FROM_TODAY = 4008
4008=取消或预定时间不能小于当前时间 4008=预定时间不能小于当前时间
ADD_VEHICLE_FAIL = 4009 ADD_VEHICLE_FAIL = 4009
4009 = 添加车辆失败,请重试 4009 = 添加车辆失败,请重试
...@@ -226,7 +226,7 @@ DATE_TIME_IS_NULL = 4011 ...@@ -226,7 +226,7 @@ DATE_TIME_IS_NULL = 4011
4011 = 预定时间不能为空 4011 = 预定时间不能为空
ONLY_BOOK_TWO_MONTH = 4012 ONLY_BOOK_TWO_MONTH = 4012
4012 = 只能预定两月内的车辆 4012 = 最多提前三个月预约
ONLY_UNBOOK_TWO_MONTH = 4013 ONLY_UNBOOK_TWO_MONTH = 4013
4013 = 只能取消预定两月内的车辆 4013 = 只能取消预定两月内的车辆
......
...@@ -25,6 +25,8 @@ public class Menu { ...@@ -25,6 +25,8 @@ public class Menu {
private String type; private String type;
private String state;
private String description; private String description;
@Column(name = "crt_time") @Column(name = "crt_time")
...@@ -167,6 +169,20 @@ public class Menu { ...@@ -167,6 +169,20 @@ public class Menu {
this.type = type; this.type = type;
} }
/**
* @return state
*/
public String getState() {
return state;
}
/**
* @param state
*/
public void setState(String state) {
this.state = state;
}
/** /**
* @return description * @return description
*/ */
......
...@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.admin.biz.MenuBiz; ...@@ -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.biz.UserBiz;
import com.github.wxiaoqi.security.admin.entity.Menu; import com.github.wxiaoqi.security.admin.entity.Menu;
import com.github.wxiaoqi.security.admin.entity.User; 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.rpc.service.PermissionService;
import com.github.wxiaoqi.security.admin.vo.FrontUser; import com.github.wxiaoqi.security.admin.vo.FrontUser;
import com.github.wxiaoqi.security.admin.vo.GroupUsers; import com.github.wxiaoqi.security.admin.vo.GroupUsers;
...@@ -120,8 +121,22 @@ public class UserController extends CommonBaseController { ...@@ -120,8 +121,22 @@ public class UserController extends CommonBaseController {
@RequestMapping(value = "/front/menus", method = RequestMethod.GET) @RequestMapping(value = "/front/menus", method = RequestMethod.GET)
public @ResponseBody public @ResponseBody
List<MenuTree> getMenusByUsername(String token) throws Exception { List<MenuTree> getMenusByUsername(String token,String state) throws Exception {
return permissionService.getMenusByUsername(token); 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) @RequestMapping(value = "/front/menu/all", method = RequestMethod.GET)
......
...@@ -170,13 +170,14 @@ public class PermissionService { ...@@ -170,13 +170,14 @@ public class PermissionService {
return frontUser; 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(); String username = userAuthUtil.getInfoFromToken(token).getUniqueName();
if (username == null) { if (username == null) {
return null; return null;
} }
User user = userBiz.getUserByUsername(username); User user = userBiz.getUserByUsername(username);
List<Menu> menus = menuBiz.getUserAuthorityMenuByUserId(user.getId()); 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); return getMenuTree(menus,AdminCommonConstant.ROOT);
} }
} }
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<result column="href" jdbcType="VARCHAR" property="href"/> <result column="href" jdbcType="VARCHAR" property="href"/>
<result column="icon" jdbcType="VARCHAR" property="icon"/> <result column="icon" jdbcType="VARCHAR" property="icon"/>
<result column="type" jdbcType="CHAR" property="type"/> <result column="type" jdbcType="CHAR" property="type"/>
<result column="state" jdbcType="INTEGER" property="state"/>
<result column="description" jdbcType="VARCHAR" property="description"/> <result column="description" jdbcType="VARCHAR" property="description"/>
<result column="crt_time" jdbcType="DATE" property="crtTime"/> <result column="crt_time" jdbcType="DATE" property="crtTime"/>
<result column="crt_user" jdbcType="VARCHAR" property="crtUser"/> <result column="crt_user" jdbcType="VARCHAR" property="crtUser"/>
......
...@@ -24,6 +24,8 @@ import java.util.List; ...@@ -24,6 +24,8 @@ import java.util.List;
@FeignClient(value = "xx-activity") @FeignClient(value = "xx-activity")
public interface ActivityFeign { public interface ActivityFeign {
public static final Integer TYPE_CHECK = 2;
public static final Integer TYPE_USE = 1; public static final Integer TYPE_USE = 1;
public static final Integer TYPE_NO_USE = 0; public static final Integer TYPE_NO_USE = 0;
......
...@@ -16,6 +16,7 @@ import com.xxfc.platform.activity.dto.UserCouponSendDTO; ...@@ -16,6 +16,7 @@ import com.xxfc.platform.activity.dto.UserCouponSendDTO;
import com.xxfc.platform.activity.entity.Coupon; import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.entity.IntegralUserTotal; import com.xxfc.platform.activity.entity.IntegralUserTotal;
import com.xxfc.platform.activity.entity.UserCoupon; import com.xxfc.platform.activity.entity.UserCoupon;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.activity.vo.CouponVo; import com.xxfc.platform.activity.vo.CouponVo;
import com.xxfc.platform.activity.vo.UserCouponPageVo; import com.xxfc.platform.activity.vo.UserCouponPageVo;
import com.xxfc.platform.activity.vo.UserCouponVo; import com.xxfc.platform.activity.vo.UserCouponVo;
...@@ -289,7 +290,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -289,7 +290,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return mapper.getUserCoupon(tickerNo); return mapper.getUserCoupon(tickerNo);
} }
//支付后更新优惠卷状态:type.1- //支付后更新优惠卷状态:type.1-触发使用优惠券;0-不触发优惠券使用(在优惠券未使用时);2--不触发优惠券使用(不管优惠券是否已使用)
public BigDecimal useTickerNo(Integer userId, List<String> tickerNos, String orderNo,Integer channel,BigDecimal amout,Integer type){ public BigDecimal useTickerNo(Integer userId, List<String> tickerNos, String orderNo,Integer channel,BigDecimal amout,Integer type){
BigDecimal couponAmout=new BigDecimal("0.00"); BigDecimal couponAmout=new BigDecimal("0.00");
if(couponAmout.compareTo(amout) >= 0) { if(couponAmout.compareTo(amout) >= 0) {
...@@ -307,7 +308,8 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -307,7 +308,8 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return couponAmout; return couponAmout;
} }
for (UserCoupon userCoupon:list) { for (UserCoupon userCoupon:list) {
if(userCoupon!=null&&userCoupon.getIsUse()==1){ //zjw_0907 当type 为 check(即2)不判断 优惠券是否已使用
if(userCoupon!=null && userCoupon.getIsUse()==1 && !ActivityFeign.TYPE_CHECK.equals(type)){
log.error(userId+"----该优惠卷已使用--tickerNo=="); log.error(userId+"----该优惠卷已使用--tickerNo==");
continue; continue;
} }
......
...@@ -110,4 +110,9 @@ public class Banner { ...@@ -110,4 +110,9 @@ public class Banner {
* 平台 0:APP 1:欣欣房车官网 2:滴房车官网 * 平台 0:APP 1:欣欣房车官网 2:滴房车官网
*/ */
private Integer platform; private Integer platform;
/**
* html 标签悬浮显示 seo 需要
*/
private String alt;
} }
...@@ -23,4 +23,9 @@ public class BannerVo { ...@@ -23,4 +23,9 @@ public class BannerVo {
* 跳转链接地址 * 跳转链接地址
*/ */
private String url; private String url;
/**
* seo html标签优化
*/
private String alt;
} }
...@@ -30,6 +30,7 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> { ...@@ -30,6 +30,7 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
bannerVo.setUrl(banner.getUrl()); bannerVo.setUrl(banner.getUrl());
bannerVo.setTitle(banner.getTitle()); bannerVo.setTitle(banner.getTitle());
bannerVo.setId(banner.getId()); bannerVo.setId(banner.getId());
bannerVo.setAlt(banner.getAlt());
bannerVos.add(bannerVo); bannerVos.add(bannerVo);
}); });
return bannerVos; return bannerVos;
......
...@@ -165,4 +165,7 @@ public class CampsiteShopAdminDTO { ...@@ -165,4 +165,7 @@ public class CampsiteShopAdminDTO {
@ApiModelProperty(value = "海报背景") @ApiModelProperty(value = "海报背景")
private String posterBackground; private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -76,4 +76,8 @@ public class CampsiteShopDetailDTO { ...@@ -76,4 +76,8 @@ public class CampsiteShopDetailDTO {
@ApiModelProperty(value = "海报背景") @ApiModelProperty(value = "海报背景")
private String posterBackground; private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -213,4 +213,7 @@ public class CampsiteShop implements Serializable { ...@@ -213,4 +213,7 @@ public class CampsiteShop implements Serializable {
@Column(name = "poster_background") @Column(name = "poster_background")
@ApiModelProperty(value = "海报背景") @ApiModelProperty(value = "海报背景")
private String posterBackground; private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -172,4 +172,7 @@ public class CampsiteShopAdminVO { ...@@ -172,4 +172,7 @@ public class CampsiteShopAdminVO {
@ApiModelProperty(value = "海报背景") @ApiModelProperty(value = "海报背景")
private String posterBackground; private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -96,6 +96,10 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -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())); PageDataVO<CampsiteShopPageDTO> pageDataVO = PageDataVO.pageInfo(campsiteShopFindDTO.getPage(), campsiteShopFindDTO.getLimit(), () -> mapper.findAllCampsiteShopsByTypeOrCode(campsiteShopFindDTO.getType(),campsiteShopFindDTO.getAddrProvince(),campsiteShopFindDTO.getAddrCity()));
List<CampsiteShopPageDTO> campsiteShopPageDTOS = pageDataVO.getData(); List<CampsiteShopPageDTO> campsiteShopPageDTOS = pageDataVO.getData();
if (CollectionUtils.isEmpty(campsiteShopPageDTOS)) { if (CollectionUtils.isEmpty(campsiteShopPageDTOS)) {
campsiteShopPageDataVO.setPageNum(campsiteShopFindDTO.getPage());
campsiteShopPageDataVO.setTotalCount(0L);
campsiteShopPageDataVO.setTotalPage(0);
campsiteShopPageDataVO.setPageSize(campsiteShopFindDTO.getLimit());
campsiteShopPageDataVO.setData(Collections.EMPTY_LIST); campsiteShopPageDataVO.setData(Collections.EMPTY_LIST);
return campsiteShopPageDataVO; return campsiteShopPageDataVO;
} }
......
...@@ -32,16 +32,33 @@ ...@@ -32,16 +32,33 @@
<result property="isDel" column="is_del"/> <result property="isDel" column="is_del"/>
<result property="hot" column="hot"/> <result property="hot" column="hot"/>
<result property="saleState" column="sale_state"/> <result property="saleState" column="sale_state"/>
<result property="alt" column="alt"/>
</resultMap> </resultMap>
<!--根据类型查询全部--> <!--根据类型查询全部-->
<select id="findAllCampsiteShopsByTypeOrCode" resultType="com.xxfc.platform.campsite.dto.CampsiteShopPageDTO"> <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`, SELECT
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` cs.id AS `id`,
FROM `campsite_shop_tag` cst cs. NAME AS `name`,
left JOIN `campsite_shop` cs on cst.shop_id=cs.id cs.logo AS `logo`,
left JOIN `campsite_tag` ct on cst.tag_id=ct.id cs.url AS `url`,
where cs.sale_state=1 and cs.is_del=0 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"> <if test="typeId!=null">
and cst.tag_id=#{typeId} and cst.tag_id=#{typeId}
</if> </if>
...@@ -51,12 +68,13 @@ ...@@ -51,12 +68,13 @@
<if test="cityCode != null"> <if test="cityCode != null">
and `city`=#{cityCode} and `city`=#{cityCode}
</if> </if>
GROUP BY cs.id
order by `crtTime` DESC order by `crtTime` DESC
</select> </select>
<!--首页查询全部--> <!--首页查询全部-->
<select id="findAllByHome" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO"> <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 FROM `campsite_shop` cs
where cs.sale_state=1 and cs.is_del=0 where cs.sale_state=1 and cs.is_del=0
order by cs.hot desc order by cs.hot desc
...@@ -64,7 +82,7 @@ ...@@ -64,7 +82,7 @@
</select> </select>
<select id="findAll" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO"> <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 FROM `campsite_shop` cs
where cs.sale_state=1 and cs.is_del=0 where cs.sale_state=1 and cs.is_del=0
order by cs.hot desc order by cs.hot desc
...@@ -73,7 +91,7 @@ ...@@ -73,7 +91,7 @@
<!--根据id查询详情--> <!--根据id查询详情-->
<select id="findCampsiteShopDetailById" resultType="com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO"> <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` , 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> </select>
<!--根据查询条件分页查询--> <!--根据查询条件分页查询-->
......
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,8 +8,10 @@ import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; ...@@ -8,8 +8,10 @@ import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.vo.ImiVo; import com.github.wxiaoqi.security.admin.vo.ImiVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.im.dto.CommentVo; import com.xxfc.platform.im.dto.CommentVo;
import com.xxfc.platform.im.dto.PraiseVo; 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.Comment;
import com.xxfc.platform.im.model.Msg; import com.xxfc.platform.im.model.Msg;
import com.xxfc.platform.im.model.Praise; import com.xxfc.platform.im.model.Praise;
...@@ -38,6 +40,9 @@ public class MsgBiz { ...@@ -38,6 +40,9 @@ public class MsgBiz {
@Autowired @Autowired
UserBiz userBiz; UserBiz userBiz;
@Autowired
ImQuestionBiz imQuestionBiz;
/** /**
* 获取消息列表 * 获取消息列表
* *
...@@ -123,8 +128,7 @@ public class MsgBiz { ...@@ -123,8 +128,7 @@ public class MsgBiz {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public ObjectRestResponse getMsgListByUserId(Integer page, Integer limit, Integer type) {
public ObjectRestResponse getMsgListByUserId(Integer page, Integer limit) {
//获取所有朋友圈 //获取所有朋友圈
page = page == null ? 1 : page; page = page == null ? 1 : page;
limit = limit == null ? 10 : limit; limit = limit == null ? 10 : limit;
...@@ -137,8 +141,14 @@ public class MsgBiz { ...@@ -137,8 +141,14 @@ public class MsgBiz {
} }
Pageable pageable = PageRequest.of(--page, limit); Pageable pageable = PageRequest.of(--page, limit);
List<Integer> ids = new ArrayList<>(); List<Integer> ids = new ArrayList<>();
ids.add(2); if(type != null) {
ids.add(4); 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 query = new Query(Criteria.where("body.type").in(ids));
query.addCriteria(Criteria.where("userId").is(userId)); query.addCriteria(Criteria.where("userId").is(userId));
int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size(); int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size();
...@@ -148,7 +158,7 @@ public class MsgBiz { ...@@ -148,7 +158,7 @@ public class MsgBiz {
List<MsgVo> msgVoList = replaceMsgResult(msgList); List<MsgVo> msgVoList = replaceMsgResult(msgList);
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(msgVoList); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(msgVoList);
goodPageInfo.setPageSize(totalSize%limit == 0 ?totalSize/limit : totalSize/limit + 1); goodPageInfo.setPageSize(totalSize%limit == 0 ?totalSize/limit : totalSize/limit + 1);
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(PageDataVO.pageInfo(goodPageInfo));
} }
...@@ -247,7 +257,7 @@ public class MsgBiz { ...@@ -247,7 +257,7 @@ public class MsgBiz {
return praiseVoArrayList; return praiseVoArrayList;
} }
public List<CommentVo> replaceCommentResult(List<Comment> list) { public List<CommentVo> replaceCommentResult(List<Comment> list) {
List<CommentVo> commentVoList = new ArrayList<>(); List<CommentVo> commentVoList = new ArrayList<>();
for(Comment comment : list) { for(Comment comment : list) {
CommentVo commentVo = new CommentVo(); CommentVo commentVo = new CommentVo();
......
...@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.vo.ImiVo; 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.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.mongodb.client.result.UpdateResult; import com.mongodb.client.result.UpdateResult;
import com.xxfc.platform.im.model.User; import com.xxfc.platform.im.model.User;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -17,6 +19,7 @@ import org.springframework.data.mongodb.core.MongoTemplate; ...@@ -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.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update; import org.springframework.data.mongodb.core.query.Update;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
...@@ -27,7 +30,10 @@ import java.net.HttpURLConnection; ...@@ -27,7 +30,10 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
...@@ -229,4 +235,37 @@ public class UserBiz { ...@@ -229,4 +235,37 @@ public class UserBiz {
return imiVo; 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);
}
}
...@@ -32,7 +32,7 @@ public class MsgController { ...@@ -32,7 +32,7 @@ public class MsgController {
} }
@GetMapping(value = "/getByUserId") @GetMapping(value = "/getByUserId")
public ObjectRestResponse getByUserId(Integer page, Integer limit) { public ObjectRestResponse getByUserId(Integer page, Integer limit, Integer type) {
return msgBiz.getMsgListByUserId(page, limit); return msgBiz.getMsgListByUserId(page, limit, type);
} }
} }
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();
}
}
package com.xxfc.platform.order.contant.enumerate;
import java.util.HashMap;
import java.util.Map;
public enum OrderViolateEnum {
BEFORE(1, "提前"),
AFTER(2, "延期")
;
/**
* 编码
*/
private Integer code;
/**
* 类型描述
*/
private String desc;
public static Map<Integer, OrderTypeEnum> codeAndDesc = new HashMap<Integer, OrderTypeEnum>();
//Maps.newHashMap();
static{
for(OrderTypeEnum enumE : OrderTypeEnum.values()){
codeAndDesc.put(enumE.getCode(), enumE);
}
}
OrderViolateEnum(Integer code, String desc){
this.code=code;
this.desc=desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static Boolean exists(Integer code){
return codeAndDesc.containsKey(code);
}
public static OrderTypeEnum get(Integer code) {
for(OrderTypeEnum enumE : OrderTypeEnum.values()) {
if (enumE.getCode().equals(code)) {
return enumE;
}
}
return null;
}
}
...@@ -3,9 +3,11 @@ package com.xxfc.platform.order.entity; ...@@ -3,9 +3,11 @@ package com.xxfc.platform.order.entity;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
import javax.persistence.*; import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.assertj.core.util.Lists;
import tk.mybatis.mapper.annotation.Version; import tk.mybatis.mapper.annotation.Version;
...@@ -249,4 +251,32 @@ public class BaseOrder implements Serializable { ...@@ -249,4 +251,32 @@ public class BaseOrder implements Serializable {
@ApiModelProperty(value = "下单时的会员等级") @ApiModelProperty(value = "下单时的会员等级")
@Column(name = "member_level") @Column(name = "member_level")
private Integer memberLevel; 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;
} }
...@@ -308,4 +308,11 @@ public class OrderRentVehicleDetail implements Serializable { ...@@ -308,4 +308,11 @@ public class OrderRentVehicleDetail implements Serializable {
@Column(name = "fixed_loss_status") @Column(name = "fixed_loss_status")
private Integer fixedLossStatus; private Integer fixedLossStatus;
/**
* 返还的免费天数
*/
@ApiModelProperty(value = "返回的免费天数")
@Column(name = "back_free_days")
Integer backFreeDays;
} }
...@@ -105,6 +105,13 @@ public class OrderVehicleCrosstown { ...@@ -105,6 +105,13 @@ public class OrderVehicleCrosstown {
*/ */
private String dedDetail; private String dedDetail;
/**
* 租车违约金明细
*/
@Column(name = "violate_amount_detail")
private String violateDetail;
/** /**
* 1、交车, 2、还车, 3、定损还车 * 1、交车, 2、还车, 3、定损还车
*/ */
......
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
@Data @Data
public class DedDetailDTO { public class DedDetailDTO {
/** /**
* : 扣除项 * : 扣除项名称
*/ */
String deductions; String deductions;
...@@ -34,4 +34,6 @@ public class DedDetailDTO { ...@@ -34,4 +34,6 @@ public class DedDetailDTO {
//type对应的中文 //type对应的中文
String statusName; String statusName;
} }
package com.xxfc.platform.order.pojo.calculate;
import lombok.Data;
import org.assertj.core.util.Lists;
import java.math.BigDecimal;
import java.util.List;
@Data
public class InProgressVO {
/**
* 违约金
*/
BigDecimal ViolateAmount = BigDecimal.ZERO;
/**
* 赔偿金
*/
BigDecimal damagesAmount = BigDecimal.ZERO;
/**
* 额外费用
*/
BigDecimal extraAmount = BigDecimal.ZERO;
/**
* 返还的优惠券
*/
List<String> backCoupons = Lists.newArrayList();
/**
* 返还的免费天数
*/
Integer backFreeDays = 0;
}
...@@ -24,6 +24,8 @@ public class OrderPageVO extends BaseOrder { ...@@ -24,6 +24,8 @@ public class OrderPageVO extends BaseOrder {
* 用户名 * 用户名
*/ */
private String username; private String username;
//用户姓名
private String realName;
private String startCompanyName; private String startCompanyName;
......
...@@ -145,7 +145,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -145,7 +145,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
* @param timeLag 与开始时间的时间差 * @param timeLag 与开始时间的时间差
* @param dicParentKey * @param dicParentKey
*/ */
public void rentRefundProcess(BaseOrder baseOrder, Long timeLag, String dicParentKey) { public BigDecimal rentRefundProcess(BaseOrder baseOrder, Long timeLag, String dicParentKey) {
//计算退款金额 //计算退款金额
//商品价格 - 优惠券减免的价格 //商品价格 - 优惠券减免的价格
BigDecimal originalRefundAmount = BigDecimal.ZERO.add(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount())); BigDecimal originalRefundAmount = BigDecimal.ZERO.add(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()));
...@@ -158,6 +158,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -158,6 +158,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
//退款子流程: 订单基础,退款描述,退款金额 //退款子流程: 订单基础,退款描述,退款金额
refundSubProcess(baseOrder, refundDescBuilder.toString(), originalRefundAmount, refundAmount, RefundTypeEnum.ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode()); refundSubProcess(baseOrder, refundDescBuilder.toString(), originalRefundAmount, refundAmount, RefundTypeEnum.ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode());
return refundAmount;
} }
/** /**
...@@ -168,7 +169,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -168,7 +169,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
* @param dicParentKey * @param dicParentKey
* @param originalDeductAmount * @param originalDeductAmount
*/ */
public void rentRefundDepositProcess(BaseOrder baseOrder, BigDecimal depositAmount, Long timeLag, String dicParentKey, BigDecimal originalDeductAmount) { public BigDecimal rentRefundDepositProcess(BaseOrder baseOrder, BigDecimal depositAmount, Long timeLag, String dicParentKey, BigDecimal originalDeductAmount) {
// 1、押金 + 租金(规则扣除) // 1、押金 + 租金(规则扣除)
BigDecimal originalRefundAmount = BigDecimal.ZERO.add(depositAmount); BigDecimal originalRefundAmount = BigDecimal.ZERO.add(depositAmount);
BigDecimal refundAmount = BigDecimal.ZERO.add(depositAmount); BigDecimal refundAmount = BigDecimal.ZERO.add(depositAmount);
...@@ -178,12 +179,13 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -178,12 +179,13 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
BigDecimal residueAmount = calculateRefund(originalDeductAmount, timeLag, dicParentKey, refundDescBuilder); BigDecimal residueAmount = calculateRefund(originalDeductAmount, timeLag, dicParentKey, refundDescBuilder);
residueAmount = residueAmount.setScale(2, RoundingMode.HALF_UP); residueAmount = residueAmount.setScale(2, RoundingMode.HALF_UP);
//退款金额 :押金 - (原扣除款 - 剩余款) //退款金额 :押金 - (原扣除款 - 剩余款) 即: 押金 - (免费天数对应的钱 - 剩余款)
refundAmount = originalRefundAmount.subtract(originalDeductAmount.subtract(residueAmount)); refundAmount = originalRefundAmount.subtract(originalDeductAmount.subtract(residueAmount));
} }
//触发押金退款 //触发押金退款
refundSubProcess(baseOrder, refundDescBuilder.toString(), originalRefundAmount, refundAmount, RefundTypeEnum.DEPOSIT.getCode(), RefundStatusEnum.ALL.getCode()); refundSubProcess(baseOrder, refundDescBuilder.toString(), originalRefundAmount, refundAmount, RefundTypeEnum.DEPOSIT.getCode(), RefundStatusEnum.ALL.getCode());
return refundAmount;
} }
public BigDecimal calculateRefund(BigDecimal goodsAmount, Long timeLag, String dicParentKey, StringBuilder refundDescBuilder) { public BigDecimal calculateRefund(BigDecimal goodsAmount, Long timeLag, String dicParentKey, StringBuilder refundDescBuilder) {
......
package com.xxfc.platform.order.biz.inner;
import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.order.biz.OrderItemBiz;
import com.xxfc.platform.order.biz.OrderRefundBiz;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundStatusEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
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.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
/**
* 订单退款记录表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-18 11:08:09
*/
@Slf4j
@Service
public class OrderCalculateBiz {
@Autowired
UserFeign userFeign;
@Autowired
ThirdFeign thirdFeign;
@Autowired
VehicleFeign vehicleFeign;
@Autowired
ConfigFeign configFeign;
@Autowired
ActivityFeign activityFeign;
@Autowired
OrderRefundBiz orderRefundBiz;
@Autowired
OrderItemBiz orderItemBiz;
public InProgressVO inProgressCalculate(BaseOrder baseOrder, OrderItem orderItem, Integer freeDays, Integer useDays) {
//计算:剩余免费天数
Integer backFreeDays = freeDays - useDays;
//过了出发时间取消订单 ,优先使用免费天数
if(backFreeDays <= 0) {
//大于总天数 只返回押金
if(useDays >= orderItem.getTotalNum()) {
//退押金
//orderRefundBiz.rentRefundDepositProcess(hasUpdateOrder, orvd.getDeposit(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, freeDayAmount);
}else {
//需要扣除订单费用
//判断是否达到优惠券条件 不符合则返还优惠券
Integer consumeDays = 0 - backFreeDays;
//计算使用天数的费用
BigDecimal consumeAmount = orderItem.getUnitPrice().multiply(new BigDecimal(consumeDays+""));
List<String> backCouponNos = Lists.newArrayList();
List<BigDecimal> couponAmounts = Lists.newArrayList();
for(String tickerNo : baseOrder.getCouponTickerNos().split(",")) {
BigDecimal couponAmount = activityFeign.use(baseOrder.getUserId(), Lists.newArrayList(tickerNo), baseOrder.getNo(), Coupon.CHANNEL_RENT, consumeAmount, ActivityFeign.TYPE_CHECK);
if(couponAmount.compareTo(BigDecimal.ZERO) > 0) {
//能够使用优惠券,则不返还
couponAmounts.add(couponAmount);
} else {
backCouponNos.add(tickerNo);
}
}
}
}else {
//返回剩余免费天数,返回优惠券,订单款
}
return new InProgressVO();
}
public InProgressVO inProgressCalculate(BaseOrder baseOrder, Integer useDays) {
OrderItem orderItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
setOrderId(baseOrder.getId());
}});
Integer freeDays = (null == orderItem.getCutNum())?0 :orderItem.getCutNum();
return inProgressCalculate(baseOrder, orderItem, freeDays, useDays);
}
}
\ No newline at end of file
...@@ -4,15 +4,19 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign; ...@@ -4,15 +4,19 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.*; import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.contant.enumerate.*; import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO; import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.tour.feign.TourFeign; import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -55,6 +59,9 @@ public class OrderCancelBiz { ...@@ -55,6 +59,9 @@ public class OrderCancelBiz {
@Autowired @Autowired
OrderMsgBiz orderMsgBiz; OrderMsgBiz orderMsgBiz;
@Autowired
OrderCalculateBiz orderCalculateBiz;
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
...@@ -67,6 +74,9 @@ public class OrderCancelBiz { ...@@ -67,6 +74,9 @@ public class OrderCancelBiz {
@Autowired @Autowired
ThirdFeign thirdFeign; ThirdFeign thirdFeign;
@Autowired
ActivityFeign activityFeign;
private static Map<Integer, List<Integer>> cancelAble; private static Map<Integer, List<Integer>> cancelAble;
static { static {
cancelAble = new HashMap<Integer, List<Integer>>(); cancelAble = new HashMap<Integer, List<Integer>>();
...@@ -110,35 +120,49 @@ public class OrderCancelBiz { ...@@ -110,35 +120,49 @@ public class OrderCancelBiz {
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
}}); }});
OrderItem orderItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
setOrderId(baseOrder.getId());
}});
//原退还押金 //原退还押金
Integer freeDays = (null == orderItem.getCutNum())?0 :orderItem.getCutNum();
BigDecimal freeDayAmount = BigDecimal.ZERO; BigDecimal freeDayAmount = BigDecimal.ZERO;
//判断是否使用免费天数,并且进行扣款
if(null != orvd.getFreeDays() && orvd.getFreeDays() > 0) {
OrderItem orderItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
setOrderId(baseOrder.getId());
}});
freeDayAmount = orderItem.getUnitPrice().multiply(new BigDecimal(orvd.getFreeDays()+ ""));
}
//如果超过出发时间,不能取消订单 //如果超过出发时间,不能取消订单
//根据时间处理goodsAmount //根据时间处理goodsAmount
//获取出发时间 到现在 距离时间 //获取出发时间 到现在 距离时间
Long timeLag = orvd.getStartTime() - System.currentTimeMillis(); Long timeLag = orvd.getStartTime() - System.currentTimeMillis();
//后面允许开始时间过后可以取消订单 if(timeLag < 0 ) {
// if(timeLag < 0) { //计算:使用天数 当前时间 - 开始时间的0时0分0秒
// throw new BaseException(ResultCode.FAILED_CODE, new HashSet<String>(){{ Long useTimeLag = System.currentTimeMillis() - orvd.getStartTime();
// add("已超过出发时间,不能取消订单"); Integer useDays = new BigDecimal(useTimeLag + "").divide(new BigDecimal((24 * 60 * 60 * 1000)+ "")).setScale(0, BigDecimal.ROUND_UP).intValue();
// }}); orderCalculateBiz.inProgressCalculate(baseOrder, orderItem, freeDays, useDays);
// }
}else {
//没到出车时间
//判断是否使用免费天数,并且进行扣款
if(freeDays > 0) {
freeDayAmount = orderItem.getUnitPrice().multiply(new BigDecimal(orvd.getFreeDays()+ ""));
//违约金封顶 租车身份价 * 2天
BigDecimal topAmount = orderItem.getUnitPrice().multiply(new BigDecimal("2"));
if(freeDayAmount.compareTo(topAmount) > 0) {
freeDayAmount = freeDayAmount;
}
}
}
//退款流程 //退款流程
//退押金
orderRefundBiz.rentRefundDepositProcess(hasUpdateOrder, orvd.getDeposit(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, freeDayAmount);
//退订单款 //退订单款
orderRefundBiz.rentRefundProcess(hasUpdateOrder, timeLag, APP_ORDER+ "_"+ RENT_REFUND); orderRefundBiz.rentRefundProcess(hasUpdateOrder, timeLag, APP_ORDER+ "_"+ RENT_REFUND);
//退押金
orderRefundBiz.rentRefundDepositProcess(hasUpdateOrder, orvd.getDeposit(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, freeDayAmount);
//已付款的取消订单发送消息 //已付款的取消订单发送消息
try { try {
AppUserDTO appUserDTO = userFeign.userDetailById(baseOrder.getUserId()).getData(); AppUserDTO appUserDTO = userFeign.userDetailById(baseOrder.getUserId()).getData();
......
...@@ -19,5 +19,5 @@ public interface DailyTravelOrderStatisticsMapper extends Mapper<DailyTravelOrde ...@@ -19,5 +19,5 @@ public interface DailyTravelOrderStatisticsMapper extends Mapper<DailyTravelOrde
List<DailyTravelOrderStatistics> getTravelPenalSum(@Param("day") Integer day); 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 ...@@ -25,5 +25,5 @@ public interface DailyVehicleOrderStatisticsMapper extends Mapper<DailyVehicleOr
List<DailyVehicleOrderStatistics> getViolationMoney(@Param("day") Integer day); List<DailyVehicleOrderStatistics> getViolationMoney(@Param("day") Integer day);
OrderStatistics monthOrderTotal(Integer companyId); OrderStatistics monthOrderTotal(@Param("companyId")Integer companyId);
} }
...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO; import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface; import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
...@@ -120,6 +121,11 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -120,6 +121,11 @@ public class BackStageOrderController extends CommonBaseController implements Us
dto.setCompanyIds(companyIds); dto.setCompanyIds(companyIds);
} }
if (StringUtils.isNotEmpty(dto.getPlateNumber())){
List<String> vehicleIds = vehicleFeign.findbyPlateNumber(dto.getPlateNumber().trim());
dto.setVehicleIds(vehicleIds);
}
Query query = new Query(dto); Query query = new Query(dto);
PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.listOrder(query.getSuper())); PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.listOrder(query.getSuper()));
List<OrderListVo> list = pageDataVO.getData(); List<OrderListVo> list = pageDataVO.getData();
...@@ -238,7 +244,13 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -238,7 +244,13 @@ public class BackStageOrderController extends CommonBaseController implements Us
orderPageVO.setCode(restResponse.getData().getCode()); orderPageVO.setCode(restResponse.getData().getCode());
} }
} }
if(orderPageVO.getUserId() != null) {
AppUserDTO appUserDTO = userFeign.userDetailById(orderPageVO.getUserId()).getData();
if(appUserDTO != null) {
orderPageVO.setUsername(appUserDTO.getUsername());
orderPageVO.setRealName(appUserDTO.getRealname());
}
}
} }
return new ObjectRestResponse<>().data(pageDataVO); return new ObjectRestResponse<>().data(pageDataVO);
} }
......
...@@ -309,6 +309,13 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -309,6 +309,13 @@ public class BaseOrderController extends CommonBaseController implements UserRes
private String phone; private String phone;
private List<String> vehicleIds;
/**
* 车牌号
*/
private String plateNumber;
@ApiModelProperty("当前页码") @ApiModelProperty("当前页码")
Integer page; Integer page;
@ApiModelProperty("每页限制") @ApiModelProperty("每页限制")
......
...@@ -52,6 +52,11 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz ...@@ -52,6 +52,11 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
*/ */
private final Integer TYPE_TOTAL = 4; private final Integer TYPE_TOTAL = 4;
/**
* 数据权限
*/
private final Integer DATA_AUTHORITY=1;
@Autowired @Autowired
private DailyVehicleOrderStatisticsBiz vehicleBiz; private DailyVehicleOrderStatisticsBiz vehicleBiz;
...@@ -77,6 +82,10 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz ...@@ -77,6 +82,10 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
UserDTO user = userDTOObjectRestResponse.getData(); UserDTO user = userDTOObjectRestResponse.getData();
Integer companyId = user.getCompanyId(); Integer companyId = user.getCompanyId();
if (DATA_AUTHORITY.equals(user.getDataAll())){
companyId=null;
}
if (TYPE_VEHICLE.equals(type)) { if (TYPE_VEHICLE.equals(type)) {
OrderStatistics vehicle = vehicleBiz.findAll(companyId); OrderStatistics vehicle = vehicleBiz.findAll(companyId);
return ObjectRestResponse.succ(vehicle); return ObjectRestResponse.succ(vehicle);
......
...@@ -142,6 +142,11 @@ ...@@ -142,6 +142,11 @@
and (r.start_time between #{startTime} and #{endTime} and (r.start_time between #{startTime} and #{endTime}
or t.start_time between #{startTime} and #{endTime}) or t.start_time between #{startTime} and #{endTime})
</if> </if>
<if test="vehicleIds != null and vehicleIds.size() > 0">
AND r.vehicle_id IN <foreach collection="vehicleIds" item="vehicleId" open="(" close=")" separator=",">
#{vehicleId}
</foreach>
</if>
<if test="companyIds != null and companyIds.size > 0"> <if test="companyIds != null and companyIds.size > 0">
and (r.start_company_id in and (r.start_company_id in
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> <foreach collection="companyIds" item="id" open="(" separator="," close=")">
......
...@@ -16,33 +16,37 @@ ...@@ -16,33 +16,37 @@
</select> </select>
<select id="monthOrderTotal" resultType="com.xxfc.platform.order.entity.OrderStatistics"> <select id="monthOrderTotal" resultType="com.xxfc.platform.order.entity.OrderStatistics">
SELECT SELECT
IFNULL(sum(gmv),0) as totalGmv IFNULL(sum(gmv),0) as totalGmv
FROM FROM
( (
SELECT SELECT
ANY_VALUE(id) AS id , ANY_VALUE(id) AS id ,
ANY_VALUE(branch_company_id) AS branch_company_id, ANY_VALUE(branch_company_id) AS branch_company_id,
ANY_VALUE(one_day) AS one_day, ANY_VALUE(one_day) AS one_day,
ANY_VALUE(gmv) AS gmv, ANY_VALUE(gmv) AS gmv,
ANY_VALUE(crt_time) AS crt_time ANY_VALUE(crt_time) AS crt_time
FROM FROM
daily_members_order_statistics daily_members_order_statistics
GROUP BY GROUP BY
one_day,branch_company_id one_day,branch_company_id
) m ) m
WHERE WHERE
branch_company_id =#{companyId} 1=1
<if test="companyId != null">
and branch_company_id =#{companyId}
</if>
</select> </select>
<!-- <select id="updateByExampleSelective">--> <!-- <select id="updateByExampleSelective">-->
<!-- SELECT--> <!-- SELECT-->
<!-- IFNULL(sum(gmv),0) as totalGmv--> <!-- IFNULL(sum(gmv),0) as totalGmv-->
<!-- FROM--> <!-- FROM-->
<!-- daily_members_order_statistics--> <!-- daily_members_order_statistics-->
<!-- WHERE--> <!-- WHERE-->
<!-- branch_company_id =#{companyId}--> <!-- branch_company_id =#{companyId}-->
<!-- and--> <!-- and-->
<!-- DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),interval 1 day),'%Y-%c')--> <!-- DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),interval 1 day),'%Y-%c')-->
<!-- </select>--> <!-- </select>-->
</mapper> </mapper>
\ No newline at end of file
...@@ -55,31 +55,34 @@ ...@@ -55,31 +55,34 @@
IFNULL(sum(penal_sum) ,0) as totalPenalSum IFNULL(sum(penal_sum) ,0) as totalPenalSum
FROM FROM
( (
SELECT SELECT
ANY_VALUE(id) AS id, ANY_VALUE(id) AS id,
ANY_VALUE(branch_company_id) AS branch_company_id, ANY_VALUE(branch_company_id) AS branch_company_id,
ANY_VALUE(one_day) AS one_day, ANY_VALUE(one_day) AS one_day,
ANY_VALUE(gmv) AS gmv, ANY_VALUE(gmv) AS gmv,
ANY_VALUE(penal_sum) AS penal_sum, ANY_VALUE(penal_sum) AS penal_sum,
ANY_VALUE(crt_time) AS crt_time ANY_VALUE(crt_time) AS crt_time
FROM FROM
daily_travel_order_statistics daily_travel_order_statistics
GROUP BY GROUP BY
one_day,branch_company_id one_day,branch_company_id
) o ) o
WHERE WHERE
branch_company_id =#{companyId} 1=1
<if test="companyId != null">
and branch_company_id =#{companyId}
</if>
</select> </select>
<!-- <select id="updateByExampleSelective">--> <!-- <select id="updateByExampleSelective">-->
<!-- SELECT--> <!-- SELECT-->
<!-- IFNULL(sum(gmv),0) as totalGmv,--> <!-- IFNULL(sum(gmv),0) as totalGmv,-->
<!-- IFNULL(sum(penal_sum) ,0) as totalPenalSum--> <!-- IFNULL(sum(penal_sum) ,0) as totalPenalSum-->
<!-- FROM--> <!-- FROM-->
<!-- daily_travel_order_statistics--> <!-- daily_travel_order_statistics-->
<!-- WHERE--> <!-- WHERE-->
<!-- branch_company_id =#{branchCompanyId}--> <!-- branch_company_id =#{branchCompanyId}-->
<!-- AND--> <!-- AND-->
<!-- DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%c')--> <!-- DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%c')-->
<!-- </select>--> <!-- </select>-->
</mapper> </mapper>
\ No newline at end of file
...@@ -80,6 +80,40 @@ ...@@ -80,6 +80,40 @@
</select> </select>
<!-- 获取赔偿和延期JSON字符串--> <!-- 获取赔偿和延期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 id="getCompensationAndPostpone" resultType="HashMap">
SELECT SELECT
v.start_company_id AS branchCompanyId, v.start_company_id AS branchCompanyId,
...@@ -105,7 +139,7 @@ ...@@ -105,7 +139,7 @@
order by v.start_company_id asc order by v.start_company_id asc
</select> </select>
<!--违章-->
<select id="getViolationMoney" resultType="com.xxfc.platform.order.entity.DailyVehicleOrderStatistics"> <select id="getViolationMoney" resultType="com.xxfc.platform.order.entity.DailyVehicleOrderStatistics">
SELECT SELECT
d.start_company_id AS branchCompanyId, d.start_company_id AS branchCompanyId,
...@@ -136,37 +170,6 @@ ...@@ -136,37 +170,6 @@
d.start_company_id d.start_company_id
</select> </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 id="updateByExampleSelective">-->
<!-- SELECT--> <!-- SELECT-->
<!-- IFNULL(sum(gmv),0) as totalGmv,--> <!-- IFNULL(sum(gmv),0) as totalGmv,-->
......
...@@ -112,4 +112,7 @@ public class TourGoodDTO { ...@@ -112,4 +112,7 @@ public class TourGoodDTO {
@ApiModelProperty(value = "海报背景") @ApiModelProperty(value = "海报背景")
private String posterBackground; private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -134,4 +134,7 @@ public class TourGood implements Serializable { ...@@ -134,4 +134,7 @@ public class TourGood implements Serializable {
@Column(name = "poster_background") @Column(name = "poster_background")
@ApiModelProperty(value = "海报背景") @ApiModelProperty(value = "海报背景")
private String posterBackground; private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -129,6 +129,8 @@ public class TourGoodDetailVo { ...@@ -129,6 +129,8 @@ public class TourGoodDetailVo {
List<GoodTagDTO> tagDTOS; List<GoodTagDTO> tagDTOS;
private String posterBackground; private String posterBackground;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -36,7 +36,16 @@ ...@@ -36,7 +36,16 @@
LEFT JOIN tour_good_site s ON v.site_id=s.id LEFT JOIN tour_good_site s ON v.site_id=s.id
LEFT JOIN tour_good g ON v.good_id=g.id LEFT JOIN tour_good g ON v.good_id=g.id
LEFT JOIN tour_good_spe_price p ON v.spe_id=p.id LEFT JOIN tour_good_spe_price p ON v.spe_id=p.id
WHERE s.company_id=#{companyId} and v.status=#{orderStatus} and p.start_time=#{travelDate} ORDER BY s.depart_time ) as `goodOrder` WHERE <![CDATA[`total_person`<>0]]>
<if test='companyId !=null'>
and s.company_id=#{companyId}
</if>
<if test="orderStatus!=null">
and v.status=#{orderStatus}
</if>
<if test="travelDate!=null">
and p.start_time=#{travelDate}
</if> ORDER BY s.depart_time ) as `goodOrder`
</select> </select>
<!-- 获取旅游路线id--> <!-- 获取旅游路线id-->
<select id="getGoodList" resultType="com.xxfc.platform.tour.vo.TourVerificationInfoVo"> <select id="getGoodList" resultType="com.xxfc.platform.tour.vo.TourVerificationInfoVo">
......
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 { ...@@ -103,4 +103,7 @@ public class SummitActivitySaveDTO implements Serializable {
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer rank; private Integer rank;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -3,14 +3,12 @@ package com.xxfc.platform.uccn.entity; ...@@ -3,14 +3,12 @@ package com.xxfc.platform.uccn.entity;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import tk.mybatis.mapper.annotation.KeySql; import tk.mybatis.mapper.annotation.KeySql;
import tk.mybatis.mapper.code.IdentityDialect; import tk.mybatis.mapper.code.IdentityDialect;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date; import java.util.Date;
...@@ -108,7 +106,7 @@ public class Article { ...@@ -108,7 +106,7 @@ public class Article {
private Integer status; private Integer status;
@Column(name ="type") @Column(name = "type")
@ApiModelProperty(value = "文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网") @ApiModelProperty(value = "文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网")
private Integer type; private Integer type;
...@@ -116,7 +114,7 @@ public class Article { ...@@ -116,7 +114,7 @@ public class Article {
* 创建时间 * 创建时间
*/ */
@Column(name = "cre_time") @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") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date creTime; private Date creTime;
...@@ -125,7 +123,7 @@ public class Article { ...@@ -125,7 +123,7 @@ public class Article {
* 修改时间 * 修改时间
*/ */
@Column(name = "upd_time") @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") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updTime; private Date updTime;
...@@ -134,9 +132,24 @@ public class Article { ...@@ -134,9 +132,24 @@ public class Article {
* 上架时间 * 上架时间
*/ */
@Column(name = "add_time") @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") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "上架时间") @ApiModelProperty(value = "上架时间")
private Date addTime; 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 { ...@@ -241,4 +241,7 @@ public class SummitActivity implements Serializable {
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer rank; 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 { ...@@ -122,4 +122,7 @@ public class SummitActivityAdminVo implements Serializable {
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer rank; private Integer rank;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -83,4 +83,6 @@ public class SummitActivityDetailVo implements Serializable { ...@@ -83,4 +83,6 @@ public class SummitActivityDetailVo implements Serializable {
@JsonIgnore @JsonIgnore
private Integer willNum; private Integer willNum;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
...@@ -58,4 +58,7 @@ public class SummitActivityVo implements Serializable { ...@@ -58,4 +58,7 @@ public class SummitActivityVo implements Serializable {
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
@JsonIgnore @JsonIgnore
private Integer rank; private Integer rank;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
package com.xxfc.platform.uccn.vo; package com.xxfc.platform.uccn.vo;
import lombok.Data;
public enum TypeEnum { public enum TypeEnum {
VEHICLE(1, "车型"), VEHICLE(1, "车型"),
TOUR(2, "旅游"), TOUR(2, "旅游"),
......
...@@ -3,6 +3,7 @@ package com.xxfc.platform.uccn.biz; ...@@ -3,6 +3,7 @@ package com.xxfc.platform.uccn.biz;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; 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.comstnt.UrlType;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
import com.xxfc.platform.uccn.mapper.ArticleMapper; import com.xxfc.platform.uccn.mapper.ArticleMapper;
...@@ -64,7 +65,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -64,7 +65,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
if (UrlType.OFFICIAL_WEBSITE.getCode().equals(urlType)) { if (UrlType.OFFICIAL_WEBSITE.getCode().equals(urlType)) {
criteria.andEqualTo("status", 1); 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> { ...@@ -113,11 +115,15 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
// if (articleList.size() > HOME_PAGE_NUMBER) { // if (articleList.size() > HOME_PAGE_NUMBER) {
// return articleList.subList(0, HOME_PAGE_NUMBER); // return articleList.subList(0, HOME_PAGE_NUMBER);
// } else { // } else {
return articleList; return articleList;
// } // }
// } // }
} }
/**
* 添加文章
* @param article
*/
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void add(Article article) { public void add(Article article) {
if (article == null) { if (article == null) {
...@@ -131,11 +137,24 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -131,11 +137,24 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
if (article.getType() == null) { if (article.getType() == null) {
article.setType(0); 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()); article.setCreTime(new Date());
mapper.insertSelective(article); mapper.insertSelective(article);
} }
/**
* 后台文章列表
* @param query
* @return
*/
public PageInfo findAll(ArticleQuery query) { public PageInfo findAll(ArticleQuery query) {
PageHelper.startPage(query.getPage(),query.getLimit()); PageHelper.startPage(query.getPage(),query.getLimit());
Example exa = Example.builder(Article.class).where( Example exa = Example.builder(Article.class).where(
...@@ -147,22 +166,36 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -147,22 +166,36 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return PageInfo.of(articles); return PageInfo.of(articles);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateSelectiveByIdRe(Article article){ public int updateSelectiveByIdRe(Article article){
article.setUpdTime(new Date()); article.setUpdTime(new Date());
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo");
}
return mapper.updateByPrimaryKeySelective(article); return mapper.updateByPrimaryKeySelective(article);
} }
/**
* 上架
* @param id
* @return
*/
public int putaway(Integer id) { public int putaway(Integer id) {
Article article = new Article(); Article article = new Article();
article.setId(id); article.setId(id);
article.setUpdTime(new Date()); article.setUpdTime(new Date());
article.setAddTime(new Date()); article.setAddTime(new Date());
article.setStatus(1); article.setStatus(1);
return mapper.updateByPrimaryKeySelective(article); return mapper.updateByPrimaryKeySelective(article);
} }
/**
* 下架
* @param id
* @return
*/
public int soldOut(Integer id) { public int soldOut(Integer id) {
Article article = new Article(); Article article = new Article();
article.setId(id); article.setId(id);
...@@ -171,6 +204,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -171,6 +204,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return mapper.updateByPrimaryKeySelective(article); return mapper.updateByPrimaryKeySelective(article);
} }
/**
* 删除
* @param id
* @return
*/
public int remove(Integer id) { public int remove(Integer id) {
Article article = new Article(); Article article = new Article();
article.setId(id); 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 ...@@ -187,9 +187,7 @@ public class SummitActivityBiz extends BaseBiz<SummitActivityMapper, SummitActiv
if (summitActivities.size() <= num) { if (summitActivities.size() <= num) {
for (SummitActivity summitActivity : summitActivities) { for (SummitActivity summitActivity : summitActivities) {
summitActivityVo = new SummitActivityVo(); summitActivityVo = new SummitActivityVo();
summitActivityVo.setId(summitActivity.getId()); BeanUtils.copyProperties(summitActivity,summitActivityVo);
summitActivityVo.setBanner(summitActivity.getBanner());
summitActivityVo.setTitle(summitActivity.getTitle());
summitActivityVos.add(summitActivityVo); summitActivityVos.add(summitActivityVo);
} }
} else { } else {
...@@ -198,9 +196,7 @@ public class SummitActivityBiz extends BaseBiz<SummitActivityMapper, SummitActiv ...@@ -198,9 +196,7 @@ public class SummitActivityBiz extends BaseBiz<SummitActivityMapper, SummitActiv
for (Integer i : resultSet) { for (Integer i : resultSet) {
summitActivityVo = new SummitActivityVo(); summitActivityVo = new SummitActivityVo();
SummitActivity summitActivity = summitActivities.get(i); SummitActivity summitActivity = summitActivities.get(i);
summitActivityVo.setId(summitActivity.getId()); BeanUtils.copyProperties(summitActivity,summitActivityVo);
summitActivityVo.setBanner(summitActivity.getBanner());
summitActivityVo.setTitle(summitActivity.getTitle());
summitActivityVos.add(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
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 @@ ...@@ -4,7 +4,7 @@
<mapper namespace="com.xxfc.platform.uccn.mapper.ArticleMapper"> <mapper namespace="com.xxfc.platform.uccn.mapper.ArticleMapper">
<select id="getArticleList" resultType="com.xxfc.platform.uccn.entity.Article"> <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 where
is_del=0 is_del=0
and status=1 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 @@ ...@@ -72,6 +72,17 @@
<artifactId>junrar</artifactId> <artifactId>junrar</artifactId>
<version>0.7</version> <version>0.7</version>
</dependency> </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> </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{ ...@@ -61,6 +61,14 @@ public class UploadController{
return JsonResultUtil.createSuccessResultWithObj(uploadService.uploadFile(file,prefix)); 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) @RequestMapping(value = "/app/unauth/admin/upload", method = RequestMethod.POST)
public JSONObject uploads( public JSONObject uploads(
@RequestParam("file") MultipartFile file, @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> {
}
...@@ -31,7 +31,7 @@ public enum ResCode { ...@@ -31,7 +31,7 @@ public enum ResCode {
VEHICLE_DEPARTURE_VEHICLE_DISABLE(104002,"车辆不可用"), VEHICLE_DEPARTURE_VEHICLE_DISABLE(104002,"车辆不可用"),
VEHICLE_DEPARTURE_VEHICLE_DELETE(104007,"车辆已下架"), VEHICLE_DEPARTURE_VEHICLE_DELETE(104007,"车辆已下架"),
VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE(104003,"车辆未出车"), VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE(104003,"车辆未出车"),
VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED(104006,"车辆不在出车范围内,请按照预定日期出车!"), VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED(104006,"请按照预定的日期出车!"),
VEHICLE_BOOK_RECORD_IS_NOT_EXIST(104004, "预约记录不存在"), VEHICLE_BOOK_RECORD_IS_NOT_EXIST(104004, "预约记录不存在"),
VEHICLE_UNBOOK_FAIL(104005, "取消预定失败!"), VEHICLE_UNBOOK_FAIL(104005, "取消预定失败!"),
......
package com.xxfc.platform.vehicle.entity; 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.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; 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 { ...@@ -164,4 +166,7 @@ public class VehicleModel implements Serializable {
@Column(name = "intro") @Column(name = "intro")
@ApiModelProperty(value = "简介") @ApiModelProperty(value = "简介")
private String intro; private String intro;
@ApiModelProperty("seo*html标签优化")
private String alt;
} }
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