Commit 2a4116d1 by 崔彦峰

svn to git

0 parents
Showing 185 changed files with 5168 additions and 0 deletions
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.com.glsx.framework</groupId>
<artifactId>framework-webapp</artifactId>
<version>1.0.1-SNAPSHOT</version>
</parent>
<groupId>cn.com.glsx</groupId>
<artifactId>web-dj-mobile</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>web-dj-mobile</name>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.oreframework.boot</groupId>
<artifactId>ore-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>org.oreframework.boot</groupId>
<artifactId>ore-boot-starter-swagger</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-marketing-api</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-insure-api</artifactId>
<version>0.0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-wechat-api</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-groupbuy-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-system-api</artifactId>
<version>0.0.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-aibschance-api</artifactId>
<version>0.0.6-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.web.dj.mobile;
import org.oreframework.boot.main.AbsOreBootStarter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
/**
* @Title: Main.java
* @Description:
* @author zhangyan
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2015
*/
@SpringBootApplication
@ServletComponentScan
public class Main extends AbsOreBootStarter {
@Override
public void run(String[] args)
{
SpringApplication.run(Main.class, args);
}
public static void main(String[] args)
{
Main main = new Main();
main.run(args);
}
}
package cn.com.glsx.web.dj.mobile.config;
import cn.com.glsx.framework.core.enums.ErrorEnum;
/**
* @Title: Constants.java
* @Description: 常量
* @author Alvin.zengqi
* @date 2016年6月21日 下午3:32:36
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2015
*/
public class Constants {
public static final String SESSION_REQUEST_PARAMS_KEY = "REQUEST_PARAMS";
public static final String SESSION_REQUEST_URL_KEY = "REQUEST_URL";
/**
* <P>Description: session键定义</P>
*
* @author Alvin
* @version 1.0
*/
public enum SessionKey {
// 账户ID SESSION键
ACCOUNT_ID("SESSION_ACCOUNT_ID"),
// 协议号(原嘀嘀号)SESSION键
PROTOCOL_ID("SESSION_PROTOCOL_ID"),
IMEI("IMEI"),
// 商户号 SESSION键
MERCHANT_ID("SESSION_MERCHANT_ID"),
// 小程序信息 WEAPP_INFO键
WEAPP_INFO_ID("SESSION_WEAPP_INFO"),
// 用户SESSION键
SESSION_USERINFO_KEY("SESSION_USERINFO_KEY"),
// 请求参数 SESSION键
REQUEST_PARAMS_KEY("SESSION_REQUEST_PARAMS_KEY"),
// UNIONID SESSION键
UNIONID("SESSION_UNIONID"),
// OPENID SESSION键
OPENID("SESSION_OPENID"),
// WECHATID SESSION键
WECHATID("SESSION_WECHATID"),
// WEAPP_USERINFO_KEY键
WEAPP_USERINFO_KEY("SESSION_WEAPP_USERINFO_KEY"),
// WEAPP_SESSION_KEY键
WEAPP_SESSION_KEY("SESSION_WEAPP_SESSION_KEY"),
// PLATFORM_SESSIONID_KEY
PLATFORM_SESSIONID_KEY("PLATFORM_SESSIONID_KEY");
private final String value;
SessionKey(String value){
this.value=value;
}
public String getValue() {
return value;
}
}
/**
* 支付错误码枚举
*/
public enum PaymentErrorCode implements ErrorEnum {
/**
* 1000:服务异常
*/
SERVICE_ERROR("1000", "服务异常"),
/**
* 1001:商品ID无效
*/
PRODUCT_ID_INVALID("1001", "商品ID无效"),
/**
* 2001:签名验证失败
*/
SIGN_VERIFY_FAILED("2001", "签名验证失败"),
/**
* 2002:支付失败
*/
PAYMENT_FAILED("2002", "支付失败"),
/**
* 2003:支付回调失败
*/
NOTIFY_FAILED("2003", "支付回调失败"),
/**
* 2004:签名失败
*/
SIGN_FAILED("2004", "签名失败");
private String value;
private String displayName;
private PaymentErrorCode(String value, String displayName){
this.value = value;
this.displayName = displayName;
}
@Override
public String getValue() {
return value;
}
@Override
public String getDisplayName() {
return displayName;
}
}
/**
* 认证状态枚举
* @author yangjia
* @date 2019/06/25
*/
public enum AuthenStatusCode implements ErrorEnum{
/**
* 已认证
* */
AUTHEN_SUCCESS("1","已认证"),
/**
* 认证失败
* */
AUTHEN_FAIL("2","认证失败"),
/**
* 未认证
* */
NOT_AUTHEN("4","未认证");
private String value;
private String displayName;
private AuthenStatusCode(String value, String displayName){
this.value = value;
this.displayName = displayName;
}
@Override
public String getDisplayName() {
return this.displayName;
}
@Override
public String getValue() {
return this.value;
}
}
/**
* 车智能模块错误码枚举
* @author yangjia
* @date 2019/06/25
*/
public enum SmartCarErrorCode implements ErrorEnum{
/**
* 用户未绑定设备
* */
ACCOUNT_UNBIND("2001","用户未绑定设备"),
DEVICE_LIST_UNEXIST("2002", "设备绑定列表获取失败"),
START_CAR_MESSAGES_FAILED("2003","获取爱车启动信息失败"),
ACCOUNT_ID_IS_NULL("2004","accountId为空"),
CHECK_DEVICE_UPDATE("0","更新当前选中设备"),
CHECK_DEVICE_INSERT("1","插入当前选中设备");
private String value;
private String displayName;
private SmartCarErrorCode(String value, String displayName){
this.value = value;
this.displayName = displayName;
}
@Override
public String getDisplayName() {
return this.displayName;
}
@Override
public String getValue() {
return this.value;
}
}
/**
* 套餐类型枚举
*/
public enum WheelPathType {
/**
* 日轨迹
*/
DAY_PATH,
/**
* 月轨迹
*/
MONTH_PATH;
}
}
package cn.com.glsx.web.dj.mobile.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @Title: DjMobileProperty.java
* @Description:
* @author zengqi
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Configuration
@ConfigurationProperties("dj.mobile")
public class DjMobileProperty {
/**
* 会话ID键值
*/
private String sessionIdKey;
/**
* 缓存键值前缀
*/
private String cachePrefix;
/**
* 缓存失效时间(单位:秒)
*/
private Long cacheExpire;
/**
* 公众号应用ID
*/
private String appId;
/**
* 授权回调地址
*/
private String oauth2CallbackUrl;
/**
* 默认商户ID
*/
private Integer merchantId;
public String getSessionIdKey() {
return sessionIdKey;
}
public void setSessionIdKey(String sessionIdKey) {
this.sessionIdKey = sessionIdKey;
}
public String getCachePrefix() {
return cachePrefix;
}
public void setCachePrefix(String cachePrefix) {
this.cachePrefix = cachePrefix;
}
public Long getCacheExpire() {
return cacheExpire;
}
public void setCacheExpire(Long cacheExpire) {
this.cacheExpire = cacheExpire;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getOauth2CallbackUrl() {
return oauth2CallbackUrl;
}
public void setOauth2CallbackUrl(String oauth2CallbackUrl) {
this.oauth2CallbackUrl = oauth2CallbackUrl;
}
public Integer getMerchantId() {
return merchantId;
}
public void setMerchantId(Integer merchantId) {
this.merchantId = merchantId;
}
}
package cn.com.glsx.web.dj.mobile.config;
import org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import cn.com.glsx.dj.aibschance.remote.CollisionNoticeConfigRemote;
import cn.com.glsx.dj.groupbuy.remote.GroupbuyActivityRemote;
import cn.com.glsx.dj.groupbuy.remote.GroupbuyOrderRemote;
import cn.com.glsx.dj.groupbuy.remote.GroupbuyProductRemote;
import cn.com.glsx.dj.insure.remote.EquityActiveInfoRemote;
import cn.com.glsx.dj.insure.remote.InsureEquityRemote;
import cn.com.glsx.dj.insure.remote.InsureRemote;
import cn.com.glsx.dj.insure.remote.InsureVehicleRemote;
import cn.com.glsx.dj.marketing.remote.ActivityCouponUserRemote;
import cn.com.glsx.dj.system.remote.MerchantRemote;
import cn.com.glsx.dj.wechat.remote.WechatH5AuthorizeInfoRemote;
import cn.com.glsx.dj.wechat.remote.WechatMiniprogramRemote;
import cn.com.glsx.dj.wechat.remote.WechatUserInfoRemote;
/**
*
* @Title: DubboConfig.java
* @Description:dubbo服务注册配置
* @author zhangyan
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2018
* @date 20190807
*/
@Configuration
public class DubboConfig {
@Autowired
private ReferenceBuilderFactory factory;
private final int timeout = 30000;
@Bean
public ActivityCouponUserRemote activityCouponUserRemote() {
return factory.builder(ActivityCouponUserRemote.class).check(false).version("0.0.1").timeout(6000).build();
}
@Bean
public InsureRemote insureRemote() {
return factory.builder(InsureRemote.class).check(false).timeout(timeout).build();
}
@Bean
public InsureVehicleRemote insureVehicleRemote() {
return factory.builder(InsureVehicleRemote.class).check(false).timeout(timeout).build();
}
@Bean
public WechatH5AuthorizeInfoRemote wechatH5AuthorizeInfoRemote(){
return factory.builder(WechatH5AuthorizeInfoRemote.class).check(false).timeout(timeout).build();
}
@Bean
public GroupbuyActivityRemote groupbuyActivityRemote(){
return factory.builder(GroupbuyActivityRemote.class).check(false).timeout(timeout).build();
}
@Bean
public GroupbuyOrderRemote groupbuyOrderRemote(){
return factory.builder(GroupbuyOrderRemote.class).check(false).timeout(timeout).build();
}
@Bean
public GroupbuyProductRemote groupbuyProductRemote(){
return factory.builder(GroupbuyProductRemote.class).check(false).timeout(timeout).build();
}
@Bean
public MerchantRemote merchantRemote(){
return factory.builder(MerchantRemote.class).check(false).timeout(timeout).build();
}
@Bean
public InsureEquityRemote insureEquityRemote(){
return factory.builder(InsureEquityRemote.class).check(false).timeout(timeout).build();
}
@Bean
public EquityActiveInfoRemote equityActiveInfoRemote(){
return factory.builder(EquityActiveInfoRemote.class).check(false).timeout(timeout).build();
}
@Bean
public CollisionNoticeConfigRemote collisionNoticeConfigRemote(){
return factory.builder(CollisionNoticeConfigRemote.class).check(false).timeout(timeout).build();
}
@Bean
public WechatMiniprogramRemote wechatMiniprogramRemote(){
return factory.builder(WechatMiniprogramRemote.class).check(false).timeout(timeout).build();
}
@Bean
public WechatUserInfoRemote wechatUserInfoRemote(){
return factory.builder(WechatUserInfoRemote.class).check(false).timeout(timeout).build();
}
}
package cn.com.glsx.web.dj.mobile.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @Title: SystemProperty.java
* @Description:
* @author zhangyan
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Configuration
@ConfigurationProperties("system")
public class SystemProperty {
// 对应配置项:system.name
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package cn.com.glsx.web.dj.mobile.controller;
import cn.com.glsx.dj.marketing.dto.ActivityInfoAndCouponDTO;
import cn.com.glsx.dj.marketing.enums.CouponClickStatusEnums;
import cn.com.glsx.dj.marketing.enums.CouponEffectiveTypeEnums;
import cn.com.glsx.dj.marketing.enums.CouponUseBarriersEnum;
import cn.com.glsx.dj.marketing.model.ActivityCouponUser;
import cn.com.glsx.dj.marketing.remote.ActivityCouponUserRemote;
import cn.com.glsx.web.dj.mobile.vo.CouponReceiveInfoVO;
import org.apache.commons.beanutils.BeanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.dubbo.common.utils.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
* @Title: IndexController.java
* @Description:
* @author zhoulm
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2019
*/
@Controller
@RequestMapping("activityCoupon")
public class ActivityCouponInfoController {
private final static Logger LOGGER = LoggerFactory.getLogger(ActivityCouponInfoController.class);
@Autowired
private ActivityCouponUserRemote activityCouponUserRemote;
/**
* 点击短信链接
* @param code
* @param model
* @param request
* @return
*/
@RequestMapping("{code}")
public String sMsCouponDetail(@PathVariable("code") String code, Model model, HttpServletRequest request) {
LOGGER.info("code:{}", code);
List<ActivityInfoAndCouponDTO> dtoList = activityCouponUserRemote.getUserInfoById(code).getResult();
LOGGER.info("dto:{}", dtoList);
// 1:未领取 2:已领取(有一張沒領全部未領)
Integer receiveStatus = 2;
if (dtoList != null && dtoList.size() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
ActivityInfoAndCouponDTO activityInfoDTO = dtoList.get(0);
// 设置活动信息
model.addAttribute("activityName", activityInfoDTO.getActivityName());
String date1 = sdf.format(activityInfoDTO.getActivityStartTime());
String date2 = sdf.format(activityInfoDTO.getActivityEndTime());
model.addAttribute("activityStartTime", date1);
model.addAttribute("activityEndTime", date2);
String merchantName = "";
if(StringUtils.isNotEmpty(activityInfoDTO.getNickName())){
merchantName = activityInfoDTO.getNickName();
}else if(StringUtils.isNotEmpty(activityInfoDTO.getBussinerssShortName())){
merchantName = activityInfoDTO.getBussinerssShortName();
}else{
merchantName = activityInfoDTO.getBussinessName();
}
model.addAttribute("merchantName", merchantName);
model.addAttribute("bussinessHours", activityInfoDTO.getBussinessHoures());
model.addAttribute("bussinessPhone", activityInfoDTO.getBussinessPhone());
model.addAttribute("bussinessAddress", activityInfoDTO.getBussinessAddress());
model.addAttribute("bgmUrl", activityInfoDTO.getBgimgUrl());
model.addAttribute("activityRule", activityInfoDTO.getActivityRule());
// 活动状态
model.addAttribute("activityStatus", activityInfoDTO.getActivityStatus());
// 活动是否在有效期内
if(activityInfoDTO.getActivityEndTime().getTime() < System.currentTimeMillis()){
// 已过期
model.addAttribute("activityTimeOut", 1);
}else{
model.addAttribute("activityTimeOut", 0);
}
// 活动上下架状态
model.addAttribute("saleStatus", activityInfoDTO.getSaleStatus());
model.addAttribute("clickStatus", activityInfoDTO.getClickStatus());
List<CouponReceiveInfoVO> couponList = new ArrayList<CouponReceiveInfoVO>();
CouponReceiveInfoVO couponReceiveInfoVO = null;
for(ActivityInfoAndCouponDTO dto:dtoList){
String effDate1 = "";
String effDate2 = "";
couponReceiveInfoVO = new CouponReceiveInfoVO();
couponReceiveInfoVO.setId(dto.getCouponUserId());
Double denomination = dto.getDenomination();
if(null != denomination){
couponReceiveInfoVO.setDenomination(String.valueOf(denomination));
}
couponReceiveInfoVO.setEffectiveType(dto.getEffectiveType());
// 有效期
if (dto.getEffectiveType() != null &&
dto.getEffectiveType().equals(CouponEffectiveTypeEnums.COUPONEFFECTIVETYPE_FIXED_DAY.getValue())) {
// 领取后N天有效
couponReceiveInfoVO.setEffectiveDays(dto.getEffectiveDays());
} else if (dto.getEffectiveType() != null && dto.getEffectiveType().equals(CouponEffectiveTypeEnums.COUPONEFFECTIVETYPE_TIME_LONG.getValue())) {
effDate1 = sdf.format(dto.getEffectiveStartTime());
effDate2 = sdf.format(dto.getEffectiveEndTime());
couponReceiveInfoVO.setEffectiveStartTime(effDate1);
couponReceiveInfoVO.setEffectiveEndTime(effDate2);
}
if(dto.getReceiveStatus().equals(CouponClickStatusEnums.COUPONCLICKSTATUS_CLICKED.getValue())){
effDate1 = sdf.format(dto.getReceiveStartTime());
effDate2 = sdf.format(dto.getReceiveEndTime());
couponReceiveInfoVO.setReceiveTime(effDate1);
couponReceiveInfoVO.setReceiveEndTime(effDate2);
}
couponReceiveInfoVO.setReceiveStatus(dto.getReceiveStatus());
couponReceiveInfoVO.setCouponName(dto.getCouponName());
couponReceiveInfoVO.setDiscountType(dto.getDiscountType());
couponReceiveInfoVO.setUseBarriers(dto.getUseBarriers());
if (dto.getUseBarriers().equals(CouponUseBarriersEnum.COUPONUSEBARRIERS_SUB.getValue())) {
Double full = dto.getFull();
if (null != full && full % 1.0 == 0) {
couponReceiveInfoVO.setFull(String.valueOf(full));
}
}
if(dto.getReceiveStatus() == 1){
receiveStatus = 1;
}
couponReceiveInfoVO.setVerificationCode(dto.getVerificationCode());
couponReceiveInfoVO.setReceiveCode(code);
couponReceiveInfoVO.setVerificationStatus(dto.getVerificationStatus());
couponList.add(couponReceiveInfoVO);
LOGGER.info("页面优惠券显示:{}", couponReceiveInfoVO);
}
model.addAttribute("receiveStatus", receiveStatus);
model.addAttribute("couponList", couponList);
}
return "sMSindex";
}
@RequestMapping("code")
@ResponseBody
public List<CouponReceiveInfoVO> sMsCouponDetail1(String code, Model model, HttpServletRequest request) {
LOGGER.info("code:{}", code);
List<CouponReceiveInfoVO> couponList = new ArrayList<CouponReceiveInfoVO>();
try {
List<ActivityCouponUser> list = activityCouponUserRemote.clickCoupon(code).getResult();
LOGGER.info("list:{}", list);
if(null != list && list.size() > 0){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
CouponReceiveInfoVO coupon = null;
for(ActivityCouponUser dto:list){
coupon = new CouponReceiveInfoVO();
BeanUtils.copyProperties(coupon, dto);
coupon.setEffectiveStartTime(sdf.format(dto.getReceiveStartTime()));
coupon.setEffectiveEndTime(sdf.format(dto.getReceiveEndTime()));
couponList.add(coupon);
}
}
} catch (IllegalAccessException | InvocationTargetException e) {
LOGGER.error("对象转换异常");
e.printStackTrace();
}
LOGGER.info("领取对象:{}", couponList);
/*
if (receiveCode != null && receiveCode.length() > 0) {
List<ActivityOfUserInfoDTO> list = activityCouponUserRemote.getUserInfoById(code).getResult();
if(null != list && list.size() > 0){
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
for(ActivityOfUserInfoDTO dto:list){
cal.setTime(dto.getActivityCouponUserDTO().getReceiveTime());
cal.add(Calendar.DATE, dto.getCouponInfoDTO().getEffectiveDays());
Date end = cal.getTime();
dto.setReceive
}
}
Map<String, String> time = new HashMap<>(64);
time.put("receiveTime", sdf.format(dto.getActivityCouponUserDTO().getReceiveTime()));
time.put("receiveEndTime", sdf.format(end));
time.put("verificationCode", dto.getActivityCouponUserDTO().getVerificationCode());
return time;
}*/
return couponList;
}
}
package cn.com.glsx.web.dj.mobile.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.glsx.framework.core.beans.ResultEntity;
import cn.com.glsx.web.dj.mobile.config.Constants;
import cn.com.glsx.web.dj.mobile.config.DjMobileProperty;
import cn.com.glsx.web.dj.mobile.service.GroupbuyActivityService;
import cn.com.glsx.web.dj.mobile.service.GroupbuyOrderService;
import cn.com.glsx.web.dj.mobile.service.GroupbuyProductService;
import cn.com.glsx.web.dj.mobile.util.ThreadLocalCache;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyActivityVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyOrderRequestVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyOrderVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyProductVO;
import cn.com.glsx.web.dj.mobile.web.annotation.NeedOpenId;
import cn.com.glsx.web.dj.mobile.web.session.Session;
/**
* @Title: GroupbuyController.java
* @Description: 嘀加拼团
* @author Alvin
* @date 2020年3月16日 下午2:23:43
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@Controller
@RequestMapping("groupbuy")
@Validated
@Api(value = "/groupbuy", tags = "嘀加拼团")
public class GroupbuyController {
@Autowired
private GroupbuyActivityService groupbuyActivityService;
@Autowired
private GroupbuyOrderService groupbuyOrderService;
@Autowired
private GroupbuyProductService groupbuyProductService;
@Autowired
private DjMobileProperty property;
/**
* 跳转首页
* @return
* @author Alvin
* @date 2020年3月16日 下午8:31:46
*/
@GetMapping("to/index")
@ApiOperation(value = "跳转到首页", notes = "跳转到首页")
public String toIndex(@RequestParam(defaultValue = "10000") Integer merchantId){
Session session = ThreadLocalCache.getSession();
session.put(Constants.SessionKey.MERCHANT_ID.getValue(), merchantId);
return "groupbuy/index";
}
/**
* 跳转二维码分享页面
* @return
* @author Alvin
* @date 2020年3月16日 下午8:31:46
*/
@GetMapping("to/qrcode/{activityId}")
@ApiOperation(value = "跳转到二维码分享页面", notes = "跳转到二维码分享页面")
@ApiImplicitParam(name = "activityId", value = "活动ID", dataType = "long", required = true, example = "1")
public String toQrcode(@PathVariable(name = "activityId") Long activityId, Model model){
model.addAttribute("activityId", activityId);
return "groupbuy/qrcode";
}
/**
* 跳转创建活动页
* @return
* @author Alvin
* @date 2020年3月16日 下午8:31:52
*/
@GetMapping("to/create/activity")
@ApiOperation(value = "跳转到创建活动页面", notes = "跳转到创建活动页面")
public String toCreateActivity(){
return "groupbuy/createActivity";
}
/**
* 跳转用户订单页
* @return
* @author Alvin
* @date 2020年3月16日 下午8:32:06
*/
@GetMapping("to/user/order")
@NeedOpenId
@ApiOperation(value = "跳转到用户订单页面", notes = "跳转到用户订单页面")
public String toUserOrder(){
return "groupbuy/userOrder";
}
/**
* 跳转商户订单页
* @return
* @author Alvin
* @date 2020年3月16日 下午8:32:16
*/
@GetMapping("to/merchant/order")
@ApiOperation(value = "跳转到商户订单页面", notes = "跳转到商户订单页面")
public String toMerchantOrder(){
return "groupbuy/merchantOrder";
}
/**
* 跳转活动页
* @return
* @author Alvin
* @date 2020年3月16日 下午8:32:23
*/
@GetMapping("to/activity/{activityId}")
@NeedOpenId
@ApiOperation(value = "跳转到活动页面", notes = "跳转到活动页面")
@ApiImplicitParam(name = "activityId", value = "活动ID", dataType = "long", required = true, example = "1")
public String toActivity(@PathVariable(name = "activityId") Long activityId, Model model){
model.addAttribute("activityId", activityId);
return "groupbuy/activity";
}
/**
* 跳转下单试算页
* @return
* @author Alvin
* @date 2020年3月16日 下午8:32:35
*/
@GetMapping("to/try/calculation")
@ApiOperation(value = "跳转到下单试算页面", notes = "跳转到下单试算页面")
public String toTryCalculation(){
return "groupbuy/tryCalculation";
}
/**
* 获取商户产品列表
* @param merchantId
* @return
* @author Alvin
* @date 2020年3月19日 下午2:33:07
*/
@GetMapping("merchant/product/list")
@ResponseBody
@ApiOperation(value = "获取商户产品列表", notes = "获取商户产品列表")
public ResultEntity<List<GroupbuyProductVO>> getMerchantProduct(){
return groupbuyProductService.getByMerchantId(ThreadLocalCache.getMerchantId());
}
@GetMapping("activity/{activityId}")
@ResponseBody
@ApiOperation(value = "获取单个拼团活动信息", notes = "获取单个拼团活动信息")
@ApiImplicitParam(name = "activityId", value = "活动ID", dataType = "long", required = true, example = "1")
public ResultEntity<GroupbuyActivityVO> getById(@PathVariable(name = "activityId") Long activityId){
return groupbuyActivityService.getById(activityId);
}
@PostMapping("activity/create")
@ResponseBody
@ApiOperation(value = "创建拼团活动信息", notes = "创建拼团活动信息")
@ApiImplicitParam(name = "activityVO", value = "活动信息", dataType = "GroupbuyActivityVO", required = true)
public ResultEntity<GroupbuyActivityVO> create(@Valid @RequestBody GroupbuyActivityVO activityVO){
if(activityVO.getMerchantId() == null){
activityVO.setMerchantId(ThreadLocalCache.getMerchantId());
}
return groupbuyActivityService.create(activityVO);
}
/**
* 获取用户订单信息
* @return
* @author Alvin
* @date 2020年3月16日 下午3:17:49
*/
@GetMapping("user/order/get")
@NeedOpenId
@ResponseBody
@ApiOperation(value = "获取用户拼团订单", notes = "获取用户拼团订单")
public ResultEntity<List<GroupbuyOrderVO>> getUserOrders(){
GroupbuyOrderVO order = new GroupbuyOrderVO();
order.setOpenId(ThreadLocalCache.getOpenId());
return groupbuyOrderService.queryOrders(order);
}
/**
* 获取单个订单信息
* @param orderId
* @return
* @author Alvin
* @date 2020年3月16日 下午4:28:31
*/
@ResponseBody
@GetMapping("order/{orderId}")
@ApiOperation(value = "获取单个订单信息", notes = "获取单个订单信息")
@ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "long", required = true, example = "1")
public ResultEntity<GroupbuyOrderVO> getOrderById(@PathVariable(name = "orderId") Long orderId){
return groupbuyOrderService.getById(orderId);
}
/**
* 获取商户订单
* @return
* @author Alvin
* @date 2020年3月16日 下午4:29:10
*/
@GetMapping("merchant/order/get")
@ResponseBody
@ApiOperation(value = "获取商户拼团订单", notes = "获取商户拼团订单")
public ResultEntity<List<GroupbuyOrderVO>> getMerchantOrders(){
GroupbuyOrderVO order = new GroupbuyOrderVO();
order.setMerchantId(ThreadLocalCache.getMerchantId());
return groupbuyOrderService.queryOrders(order);
}
/**
* 拼团下单试算
* @param order
* @return
* @author Alvin
* @date 2020年3月16日 下午8:09:41
*/
@PostMapping("order/try/calculation")
@ResponseBody
@ApiOperation(value = "拼团下单试算", notes = "拼团下单试算")
@ApiImplicitParam(name = "order", value = "订单信息", dataType = "GroupbuyOrderRequestVO", required = true)
@NeedOpenId
public ResultEntity<GroupbuyOrderVO> tryCalculation(@Valid @RequestBody GroupbuyOrderRequestVO order){
return groupbuyOrderService.tryCalculation(order);
}
/**
* 创建拼团订单
* @param order
* @return
* @author Alvin
* @date 2020年3月16日 下午8:10:31
*/
@PostMapping("order/create")
@ResponseBody
@ApiOperation(value = "创建拼团订单", notes = "创建拼团订单")
@ApiImplicitParam(name = "order", value = "订单信息", dataType = "GroupbuyOrderRequestVO", required = true)
@NeedOpenId
public ResultEntity<GroupbuyOrderVO> createOrder(@Valid @RequestBody GroupbuyOrderRequestVO order){
return groupbuyOrderService.createOrder(order);
}
}
package cn.com.glsx.web.dj.mobile.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.ModelMap;
import cn.com.glsx.web.dj.mobile.config.SystemProperty;
/**
* @Title: IndexController.java
* @Description:
* @author zhangyan
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Controller
public class IndexController {
@Autowired
private SystemProperty systemProperty;
@ResponseBody
@RequestMapping("home")
public String home(){
return "hello, welcome to home!";
}
@RequestMapping("index")
public String index(ModelMap map){
map.addAttribute("name", systemProperty.getName());
return "index";
}
}
package cn.com.glsx.web.dj.mobile.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import cn.com.glsx.dj.wechat.dto.response.H5AccessTokenResponseDTO;
import cn.com.glsx.dj.wechat.remote.WechatH5AuthorizeInfoRemote;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.web.dj.mobile.config.Constants;
import cn.com.glsx.web.dj.mobile.config.DjMobileProperty;
import cn.com.glsx.web.dj.mobile.util.ThreadLocalCache;
import cn.com.glsx.web.dj.mobile.web.session.Session;
/**
* @Title: WechatController.java
* @Description:
* @author Alvin
* @date 2020年3月16日 下午2:26:07
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@Controller
@RequestMapping("wechat")
public class WechatController {
@Autowired
private HttpServletRequest request;
@Autowired
private WechatH5AuthorizeInfoRemote wechatH5AuthorizeInfoRemote;
@Autowired
private DjMobileProperty property;
@SuppressWarnings("unchecked")
@GetMapping("callback")
public String callback(RedirectAttributes redirectAttributes) {
Session session = ThreadLocalCache.getSession();
String appId = property.getAppId();
// 通过code获取openId
RpcResponse<H5AccessTokenResponseDTO> response = wechatH5AuthorizeInfoRemote.getAccessToken(request.getParameter("code"), appId);
String openId = response.getResult().getOpenid();
if(StringUtils.isNotEmpty(appId)){
session.put(Constants.SessionKey.WECHATID.getValue(), appId);
}
redirectAttributes.addAttribute("openId", openId);// 传递openId参数
session.put(Constants.SessionKey.OPENID.getValue(), openId);
Object requestParams = session.get(Constants.SESSION_REQUEST_PARAMS_KEY);
if (requestParams != null && requestParams instanceof HashMap) {
Map<String, String> params = (HashMap<String, String>) requestParams;
for (String name : params.keySet()) {
redirectAttributes.addAttribute(name, params.get(name));
}
}
// 重定向到目标位置(支持https重定向)
// return new ModelAndView(new RedirectView(request.getParameter("state"), true, false));
return "redirect:".concat(request.getParameter("state"));
}
}
package cn.com.glsx.web.dj.mobile.controller;
import cn.com.glsx.dj.insure.dto.InsureVehicleDTO;
import cn.com.glsx.dj.insure.dto.PdfStampRequestDTO;
import cn.com.glsx.dj.insure.enums.InsuranceCompanyEnum;
import cn.com.glsx.dj.insure.enums.IsGlAcceptanceEnum;
import cn.com.glsx.dj.insure.model.InsureEquity;
import cn.com.glsx.dj.insure.model.InsureOrder;
import cn.com.glsx.dj.insure.remote.InsureEquityRemote;
import cn.com.glsx.dj.insure.remote.InsureRemote;
import cn.com.glsx.dj.insure.remote.InsureVehicleRemote;
import cn.com.glsx.framework.core.beans.ResultEntity;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import com.alibaba.dubbo.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
/**
* @Title: IndexController.java
* @Description:
* @author zhoudan
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2019
*/
@RestController
@RequestMapping("qrCodeQuery")
public class YgQrCodeController {
@Autowired
private InsureRemote insureRemote;
@Autowired
private InsureVehicleRemote insureVehicleRemote;
@Autowired
private InsureEquityRemote insureEquityRemote;
@Autowired
private Environment env;
private final static Logger LOGGER = LoggerFactory.getLogger(YgQrCodeController.class);
@RequestMapping("{insureNo}")
public ResultEntity<Map<String,String>> insureDetail(@PathVariable("insureNo") String insureNo) {
LOGGER.info("insureNo编号:{}", insureNo);
RpcResponse<InsureOrder> insureInfo = insureRemote.selectSuccessBySearchKey(insureNo);
RpcResponse<InsureEquity> equityInfo = insureEquityRemote.queryEquityByEquityNo(insureNo);
LOGGER.info("insureInfo:{}", insureInfo.getResult());
LOGGER.info("equityInfo:{}", equityInfo.getResult());
Map<String, String> info = new HashMap<>(64);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (insureInfo.hasResult()) {
RpcResponse<InsureVehicleDTO> vehicleInfo = insureVehicleRemote.getByVehicleId(insureInfo.getResult().getVehicleId());
LOGGER.info("vehicleInfo:{}", vehicleInfo.getResult());
info.put("fullInsuranceNo", insureInfo.getResult().getFullInsuranceNo());
info.put("effectDate", sdf.format(insureInfo.getResult().getEffectDate()));
info.put("endDate", sdf.format(insureInfo.getResult().getEndDate()));
if (null != insureInfo.getResult().getSumAmount()) {
info.put("insurePrice", insureInfo.getResult().getSumAmount().toString());
} else {
info.put("insurePrice", "");
}
info.put("name", insureInfo.getResult().getName());
info.put("cardNo", insureInfo.getResult().getCardNo());
info.put("standNo", insureInfo.getResult().getStandNo());
info.put("engine", vehicleInfo.getResult().getEngine());
info.put("brandName", vehicleInfo.getResult().getVehicleChildsBrandName());
info.put("color", vehicleInfo.getResult().getVehicleColor());
PdfStampRequestDTO orderDto = new PdfStampRequestDTO();
boolean isGl = IsGlAcceptanceEnum.IS_GL_ACCEPTANCE.getCode().equals(insureInfo.getResult().getIsGlAcceptance()) || IsGlAcceptanceEnum.IS_RB_LOCAL.getCode().equals(insureInfo.getResult().getIsGlAcceptance());
LOGGER.info("is_gl:{} ,seqNo:{} , isGl{}", insureInfo.getResult().getIsGlAcceptance(), insureInfo.getResult().getSeqNo(),isGl);
if (isGl) {
String pdfUrl = env.getProperty("local.order.pdf.url") + "?seqNo=" + insureInfo.getResult().getSeqNo();
LOGGER.info("order_pdfUrl:{}", pdfUrl);
if(StringUtils.isNotEmpty(pdfUrl)){
info.put("pdfUrl", pdfUrl);
}
} else {
orderDto.setProductCode("000001");
orderDto.setChannelCode(insureInfo.getResult().getChannelCode());
orderDto.setFullInsuranceNo(insureInfo.getResult().getFullInsuranceNo());
if ((InsuranceCompanyEnum.SINOSAFE_INSURANCE.getDisplayName()).equals(insureInfo.getResult().getCompanyCode())) {
orderDto.setInsuranceCompany(InsuranceCompanyEnum.SINOSAFE_INSURANCE.getValue());
} else if ((InsuranceCompanyEnum.SINOSIG_INSURANCE.getDisplayName()).equals(insureInfo.getResult().getCompanyCode())) {
orderDto.setInsuranceCompany(InsuranceCompanyEnum.SINOSIG_INSURANCE.getValue());
} else if ((InsuranceCompanyEnum.PICC_INSURANCE.getDisplayName()).equals(insureInfo.getResult().getCompanyCode())) {
orderDto.setInsuranceCompany(InsuranceCompanyEnum.PICC_INSURANCE.getValue());
}
RpcResponse<String> pdfUrl = insureRemote.pdfStamp(orderDto);
LOGGER.info("order_pdfUrl:{}", pdfUrl.getResult());
if(pdfUrl.hasResult()){
info.put("pdfUrl", pdfUrl.getResult());
}
}
}else if(equityInfo.hasResult()){
RpcResponse<InsureVehicleDTO> vehicleInfo = insureVehicleRemote.getByVehicleId(equityInfo.getResult().getVehicleId());
LOGGER.info("vehicleInfo:{}", vehicleInfo.getResult());
info.put("fullInsuranceNo", equityInfo.getResult().getEquityNo());
info.put("effectDate", sdf.format(equityInfo.getResult().getEffectDate()));
info.put("endDate", sdf.format(equityInfo.getResult().getEndDate()));
info.put("insurePrice", equityInfo.getResult().getEquityValue().toString());
info.put("name", equityInfo.getResult().getName());
info.put("cardNo", equityInfo.getResult().getCardNo());
info.put("standNo", equityInfo.getResult().getStandNo());
info.put("engine", vehicleInfo.getResult().getEngine());
info.put("brandName", vehicleInfo.getResult().getVehicleChildsBrandName());
info.put("color", vehicleInfo.getResult().getVehicleColor());
PdfStampRequestDTO equityDto = new PdfStampRequestDTO();
equityDto.setFullInsuranceNo(equityInfo.getResult().getEquityNo());
equityDto.setInsuranceCompany(InsuranceCompanyEnum.PICC_INSURANCE.getValue());
RpcResponse<String> pdfUrl = insureEquityRemote.pdfStampEquity(equityDto);
LOGGER.info("equity_pdfUrl:{}", pdfUrl.getResult());
if(pdfUrl.hasResult()){
info.put("pdfUrl", pdfUrl.getResult());
}
}
LOGGER.info("保单详情:{}", info);
if(info.isEmpty()){
return ResultEntity.error("保单不存在");
}
return ResultEntity.success(info);
}
}
package cn.com.glsx.web.dj.mobile.controller.insure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.glsx.framework.core.beans.ResultEntity;
import cn.com.glsx.framework.core.enums.StatusEnum;
import cn.com.glsx.web.dj.mobile.service.insure.EquityActiveInfoService;
import cn.com.glsx.web.dj.mobile.vo.insure.AllInsureEquityVO;
import io.swagger.annotations.ApiOperation;
@Controller
@RequestMapping("equityActiveInfo")
public class EquityActiveInfoController {
@Autowired
private EquityActiveInfoService equityActiveInfoService;
@GetMapping("index/{type}/{seqNo}")
@ApiOperation(value = "保单权益页面", notes = "保单权益页面")
public String toIndex(@PathVariable("type") String type,@PathVariable("seqNo") String seqNo,Model model){
model.addAttribute("type", type);
model.addAttribute("seqNo", seqNo);
ResultEntity<AllInsureEquityVO> re = null;
if(StatusEnum.YES.getValue().equals(type)){
re = equityActiveInfoService.getEquityOfInsureEquity(seqNo);
}else{
re = equityActiveInfoService.getEquityOfInsureOrder(seqNo);
}
if(re.getData() != null){
model.addAttribute("info", re.getData());
}else{
model.addAttribute("message", re.getMessage());
}
return "equityActiveInfo/equityInfo";
}
/**
* activeEquity
* @param type
* @param seqNo
* @return
*/
@GetMapping("activeEquity")
@ResponseBody
@ApiOperation(value = "激活权益", notes = "激活权益")
public ResultEntity<Boolean> activeEquity(@RequestParam String type,@RequestParam String seqNo){
if(StatusEnum.YES.getValue().equals(type)){
return equityActiveInfoService.activeInsureEquity(seqNo);
}else{
return equityActiveInfoService.activeInsureOrder(seqNo);
}
}
}
package cn.com.glsx.web.dj.mobile.converter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import cn.com.glsx.dj.groupbuy.dto.GroupbuyActivityDTO;
import cn.com.glsx.dj.groupbuy.dto.GroupbuyActivityPackageDTO;
import cn.com.glsx.dj.groupbuy.model.GroupbuyActivityPackagePrice;
import cn.com.glsx.dj.groupbuy.model.GroupbuyParentOrder;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyActivityPackagePriceVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyActivityPackageVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyActivityVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyParentOrderVO;
/**
* @Title: GroupbuyActivityConverter.java
* @Description:
* @author Alvin
* @date 2020年3月19日 下午12:57:27
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyActivityConverter {
public static GroupbuyActivityConverter INSTANCE = new GroupbuyActivityConverter();
public GroupbuyActivityDTO converterToTarget(GroupbuyActivityVO activityVO){
if(activityVO == null){
return null;
}
GroupbuyActivityDTO activityDTO = new GroupbuyActivityDTO();
BeanUtils.copyProperties(activityVO, activityDTO, "packages", "prices", "orders", "merchantInfo");
if(activityVO.getPackages() != null && !activityVO.getPackages().isEmpty()){
List<GroupbuyActivityPackageDTO> packages = new ArrayList<GroupbuyActivityPackageDTO>();
for(GroupbuyActivityPackageVO activityPackageVO:activityVO.getPackages()){
packages.add(GroupbuyActivityPackageConverter.INSTANCE.converterToTargetDTO(activityPackageVO));
}
activityDTO.setPackages(packages);
}
if(activityVO.getPrices() != null && !activityVO.getPrices().isEmpty()){
List<GroupbuyActivityPackagePrice> prices = new ArrayList<GroupbuyActivityPackagePrice>();
for(GroupbuyActivityPackagePriceVO activityPackagePriceVO:activityVO.getPrices()){
prices.add(GroupbuyActivityPackagePriceConverter.INSTANCE.converterToTarget(activityPackagePriceVO));
}
activityDTO.setPrices(prices);
}
if(activityVO.getOrders() != null && !activityVO.getOrders().isEmpty()){
List<GroupbuyParentOrder> orders = new ArrayList<GroupbuyParentOrder>();
for(GroupbuyParentOrderVO parentOrderVO:activityVO.getOrders()){
orders.add(GroupbuyParentOrderConverter.INSTANCE.converterToTarget(parentOrderVO));
}
activityDTO.setOrders(orders);
}
return activityDTO;
}
public GroupbuyActivityVO converterToSource(GroupbuyActivityDTO activityDTO){
if(activityDTO == null){
return null;
}
GroupbuyActivityVO activityVO = new GroupbuyActivityVO();
BeanUtils.copyProperties(activityDTO, activityVO, "packages", "prices", "orders", "merchantInfo");
if(activityDTO.getPackages() != null && !activityDTO.getPackages().isEmpty()){
List<GroupbuyActivityPackageVO> packages = new ArrayList<GroupbuyActivityPackageVO>();
for(GroupbuyActivityPackageDTO activityPackage:activityDTO.getPackages()){
packages.add(GroupbuyActivityPackageConverter.INSTANCE.converterToSource(activityPackage));
}
activityVO.setPackages(packages);
}
if(activityDTO.getPrices() != null && !activityDTO.getPrices().isEmpty()){
List<GroupbuyActivityPackagePriceVO> prices = new ArrayList<GroupbuyActivityPackagePriceVO>();
for(GroupbuyActivityPackagePrice activityPackagePrice:activityDTO.getPrices()){
prices.add(GroupbuyActivityPackagePriceConverter.INSTANCE.converterToSource(activityPackagePrice));
}
activityVO.setPrices(prices);
}
if(activityDTO.getOrders() != null && !activityDTO.getOrders().isEmpty()){
List<GroupbuyParentOrderVO> orders = new ArrayList<GroupbuyParentOrderVO>();
for(GroupbuyParentOrder parentOrder:activityDTO.getOrders()){
orders.add(GroupbuyParentOrderConverter.INSTANCE.converterToSource(parentOrder));
}
activityVO.setOrders(orders);
}
return activityVO;
}
}
package cn.com.glsx.web.dj.mobile.converter;
import org.springframework.beans.BeanUtils;
import cn.com.glsx.dj.groupbuy.dto.GroupbuyActivityPackageDTO;
import cn.com.glsx.dj.groupbuy.model.GroupbuyActivityPackage;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyActivityPackageVO;
/**
* @Title: GroupbuyActivityPackageConverter.java
* @Description:
* @author Alvin
* @date 2020年3月19日 下午12:55:04
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyActivityPackageConverter {
public static GroupbuyActivityPackageConverter INSTANCE = new GroupbuyActivityPackageConverter();
public GroupbuyActivityPackage converterToTarget(GroupbuyActivityPackageVO activityPackageVO){
if(activityPackageVO == null){
return null;
}
GroupbuyActivityPackage activityPackage = new GroupbuyActivityPackage();
BeanUtils.copyProperties(activityPackageVO, activityPackage);
return activityPackage;
}
public GroupbuyActivityPackageDTO converterToTargetDTO(GroupbuyActivityPackageVO activityPackageVO){
if(activityPackageVO == null){
return null;
}
GroupbuyActivityPackageDTO activityPackageDTO = new GroupbuyActivityPackageDTO();
BeanUtils.copyProperties(activityPackageVO, activityPackageDTO);
return activityPackageDTO;
}
public GroupbuyActivityPackageVO converterToSource(GroupbuyActivityPackage activityPackage){
if(activityPackage == null){
return null;
}
GroupbuyActivityPackageVO activityPackageVO = new GroupbuyActivityPackageVO();
BeanUtils.copyProperties(activityPackage, activityPackageVO);
return activityPackageVO;
}
public GroupbuyActivityPackageVO converterToSource(GroupbuyActivityPackageDTO activityPackageDTO){
if(activityPackageDTO == null){
return null;
}
GroupbuyActivityPackageVO activityPackageVO = new GroupbuyActivityPackageVO();
BeanUtils.copyProperties(activityPackageDTO, activityPackageVO);
return activityPackageVO;
}
}
package cn.com.glsx.web.dj.mobile.converter;
import org.springframework.beans.BeanUtils;
import cn.com.glsx.dj.groupbuy.model.GroupbuyActivityPackagePrice;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyActivityPackagePriceVO;
/**
* @Title: GroupbuyActivityPackagePriceConverter.java
* @Description:
* @author Alvin
* @date 2020年3月19日 下午12:52:28
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyActivityPackagePriceConverter {
public static GroupbuyActivityPackagePriceConverter INSTANCE = new GroupbuyActivityPackagePriceConverter();
public GroupbuyActivityPackagePrice converterToTarget(GroupbuyActivityPackagePriceVO activityPackagePriceVO){
if(activityPackagePriceVO == null){
return null;
}
GroupbuyActivityPackagePrice activityPackagePrice = new GroupbuyActivityPackagePrice();
BeanUtils.copyProperties(activityPackagePriceVO, activityPackagePrice);
return activityPackagePrice;
}
public GroupbuyActivityPackagePriceVO converterToSource(GroupbuyActivityPackagePrice activityPackagePrice){
if(activityPackagePrice == null){
return null;
}
GroupbuyActivityPackagePriceVO activityPackagePriceVO = new GroupbuyActivityPackagePriceVO();
BeanUtils.copyProperties(activityPackagePrice, activityPackagePriceVO);
return activityPackagePriceVO;
}
}
package cn.com.glsx.web.dj.mobile.converter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import cn.com.glsx.dj.groupbuy.dto.GroupbuyActivityPackageDTO;
import cn.com.glsx.dj.groupbuy.dto.GroupbuyOrderDTO;
import cn.com.glsx.dj.groupbuy.model.GroupbuySubOrder;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyActivityPackageVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyOrderVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuySubOrderVO;
/**
* @Title: GroupbuyOrderConverter.java
* @Description:
* @author Alvin
* @date 2020年3月19日 上午11:47:59
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyOrderConverter {
public static GroupbuyOrderConverter INSTANCE = new GroupbuyOrderConverter();
public GroupbuyOrderDTO converterToTarget(GroupbuyOrderVO orderVO){
if(orderVO == null){
return null;
}
GroupbuyOrderDTO orderDTO = new GroupbuyOrderDTO();
BeanUtils.copyProperties(orderVO, orderDTO, "subOrders");
if(orderVO.getSubOrders() != null && !orderVO.getSubOrders().isEmpty()){
List<GroupbuySubOrder> subOrders = new ArrayList<GroupbuySubOrder>();
for(GroupbuySubOrderVO subOrderVO:orderVO.getSubOrders()){
subOrders.add(GroupbuySubOrderConverter.INSTANCE.converterToTarget(subOrderVO));
}
orderDTO.setSubOrders(subOrders);
}
return orderDTO;
}
public GroupbuyOrderVO converterToSource(GroupbuyOrderDTO orderDTO){
if(orderDTO == null){
return null;
}
GroupbuyOrderVO orderVO = new GroupbuyOrderVO();
BeanUtils.copyProperties(orderDTO, orderVO, "subOrders");
if(orderDTO.getSubOrders() != null && !orderDTO.getSubOrders().isEmpty()){
List<GroupbuySubOrderVO> subOrders = new ArrayList<GroupbuySubOrderVO>();
for(GroupbuySubOrder subOrder:orderDTO.getSubOrders()){
subOrders.add(GroupbuySubOrderConverter.INSTANCE.converterToSource(subOrder));
}
orderVO.setSubOrders(subOrders);
}
if(orderDTO.getPackages() != null && !orderDTO.getPackages().isEmpty()){
List<GroupbuyActivityPackageVO> packages = new ArrayList<GroupbuyActivityPackageVO>();
for(GroupbuyActivityPackageDTO pkg:orderDTO.getPackages()){
packages.add(GroupbuyActivityPackageConverter.INSTANCE.converterToSource(pkg));
}
orderVO.setPackages(packages);
}
return orderVO;
}
}
package cn.com.glsx.web.dj.mobile.converter;
import org.springframework.beans.BeanUtils;
import cn.com.glsx.dj.groupbuy.model.GroupbuyParentOrder;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyParentOrderVO;
/**
* @Title: GroupbuyParentOrderConverter.java
* @Description:
* @author Alvin
* @date 2020年3月19日 下午12:49:53
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyParentOrderConverter {
public static GroupbuyParentOrderConverter INSTANCE = new GroupbuyParentOrderConverter();
public GroupbuyParentOrder converterToTarget(GroupbuyParentOrderVO parentOrderVO){
if(parentOrderVO == null){
return null;
}
GroupbuyParentOrder parentOrder = new GroupbuyParentOrder();
BeanUtils.copyProperties(parentOrderVO, parentOrder);
return parentOrder;
}
public GroupbuyParentOrderVO converterToSource(GroupbuyParentOrder parentOrder){
if(parentOrder == null){
return null;
}
GroupbuyParentOrderVO parentOrderVO = new GroupbuyParentOrderVO();
BeanUtils.copyProperties(parentOrder, parentOrderVO);
return parentOrderVO;
}
}
package cn.com.glsx.web.dj.mobile.converter;
import org.springframework.beans.BeanUtils;
import cn.com.glsx.dj.groupbuy.model.GroupbuyProduct;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyProductVO;
/**
* @Title: GroupbuyProductConverter.java
* @Description:
* @author Alvin
* @date 2020年3月19日 下午2:28:12
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyProductConverter {
public static GroupbuyProductConverter INSTANCE = new GroupbuyProductConverter();
public GroupbuyProduct converterToTarget(GroupbuyProductVO productVO){
if(productVO == null){
return null;
}
GroupbuyProduct product = new GroupbuyProduct();
BeanUtils.copyProperties(productVO, product);
return product;
}
public GroupbuyProductVO converterToSource(GroupbuyProduct product){
if(product == null){
return null;
}
GroupbuyProductVO productVO = new GroupbuyProductVO();
BeanUtils.copyProperties(product, productVO);
return productVO;
}
}
package cn.com.glsx.web.dj.mobile.converter;
import org.springframework.beans.BeanUtils;
import cn.com.glsx.dj.groupbuy.model.GroupbuySubOrder;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuySubOrderVO;
/**
* @Title: GroupbuySubOrderConverter.java
* @Description:
* @author Alvin
* @date 2020年3月19日 上午11:52:25
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuySubOrderConverter {
public static GroupbuySubOrderConverter INSTANCE = new GroupbuySubOrderConverter();
public GroupbuySubOrder converterToTarget(GroupbuySubOrderVO subOrderVO){
if(subOrderVO == null){
return null;
}
GroupbuySubOrder subOrder = new GroupbuySubOrder();
BeanUtils.copyProperties(subOrderVO, subOrder);
return subOrder;
}
public GroupbuySubOrderVO converterToSource(GroupbuySubOrder subOrder){
if(subOrder == null){
return null;
}
GroupbuySubOrderVO subOrderVO = new GroupbuySubOrderVO();
BeanUtils.copyProperties(subOrder, subOrderVO);
return subOrderVO;
}
}
package cn.com.glsx.web.dj.mobile.service;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import cn.com.glsx.dj.groupbuy.dto.GroupbuyActivityDTO;
import cn.com.glsx.dj.groupbuy.enums.ActivityStatusEnum;
import cn.com.glsx.dj.groupbuy.remote.GroupbuyActivityRemote;
import cn.com.glsx.dj.system.model.Merchant;
import cn.com.glsx.dj.system.remote.MerchantRemote;
import cn.com.glsx.framework.core.beans.ResultEntity;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.web.dj.mobile.converter.GroupbuyActivityConverter;
import cn.com.glsx.web.dj.mobile.vo.MerchantInfoVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyActivityVO;
/**
* @Title: GroupbuyActivityService.java
* @Description:
* @author Alvin
* @date 2020年3月16日 下午2:24:23
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@Component
public class GroupbuyActivityService {
@Autowired
private GroupbuyActivityRemote groupbuyActivityRemote;
@Autowired
private MerchantRemote merchantRemote;
/**
* 获取活动信息
* @param activityId
* @return
* @author Alvin
* @date 2020年3月16日 下午3:09:43
*/
public ResultEntity<GroupbuyActivityVO> getById(Long activityId){
RpcResponse<GroupbuyActivityDTO> response = groupbuyActivityRemote.getById(activityId);
if(response.hasResult()){
GroupbuyActivityVO activityVO = GroupbuyActivityConverter.INSTANCE.converterToSource(response.getResult());
RpcResponse<Merchant> merchantResponse = merchantRemote.getByMerchantId(activityVO.getMerchantId());
if(merchantResponse.hasResult()){
MerchantInfoVO merchant = new MerchantInfoVO();
BeanUtils.copyProperties(merchantResponse.getResult(), merchant);
activityVO.setMerchantInfo(merchant);
}
return ResultEntity.success(activityVO);
}
return ResultEntity.error(response.getError().getValue(), response.getMessage());
}
/**
* 创建活动
* @param activityDTO
* @return
* @author Alvin
* @date 2020年3月16日 下午3:09:52
*/
public ResultEntity<GroupbuyActivityVO> create(GroupbuyActivityVO activityVO){
activityVO.setActivityStatus(ActivityStatusEnum.IN_PROGRESS.getValue());
GroupbuyActivityDTO activityDTO = GroupbuyActivityConverter.INSTANCE.converterToTarget(activityVO);
activityDTO.setCreatedBy(activityVO.getMerchantId().toString());
activityDTO.setUpdatedBy(activityVO.getMerchantId().toString());
RpcResponse<GroupbuyActivityDTO> response = groupbuyActivityRemote.create(activityDTO);
if(response.hasResult()){
activityVO = GroupbuyActivityConverter.INSTANCE.converterToSource(response.getResult());
return ResultEntity.success(activityVO);
}
return ResultEntity.error(response.getError().getValue(), response.getMessage());
}
}
package cn.com.glsx.web.dj.mobile.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import cn.com.glsx.dj.groupbuy.dto.GroupbuyOrderDTO;
import cn.com.glsx.dj.groupbuy.remote.GroupbuyOrderRemote;
import cn.com.glsx.framework.core.beans.ResultEntity;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.web.dj.mobile.converter.GroupbuyOrderConverter;
import cn.com.glsx.web.dj.mobile.util.ThreadLocalCache;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyOrderRequestVO;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyOrderVO;
/**
* @Title: GroupbuyOrderService.java
* @Description:
* @author Alvin
* @date 2020年3月16日 下午3:10:08
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@Component
public class GroupbuyOrderService {
@Autowired
private GroupbuyOrderRemote groupbuyOrderRemote;
/**
* 查询订单
* @param order
* @return
* @author Alvin
* @date 2020年3月16日 下午3:12:34
*/
public ResultEntity<List<GroupbuyOrderVO>> queryOrders(GroupbuyOrderVO order){
GroupbuyOrderDTO orderDTO = GroupbuyOrderConverter.INSTANCE.converterToTarget(order);
RpcResponse<List<GroupbuyOrderDTO>> response = groupbuyOrderRemote.queryOrders(orderDTO);
if(response.hasResult()){
List<GroupbuyOrderVO> orders = new ArrayList<GroupbuyOrderVO>();
for(GroupbuyOrderDTO o:response.getResult()){
orders.add(GroupbuyOrderConverter.INSTANCE.converterToSource(o));
}
return ResultEntity.success(orders);
}
return ResultEntity.error(response.getError().getValue(), response.getMessage());
}
/**
* 查询订单
* @param orderId
* @return
* @author Alvin
* @date 2020年3月16日 下午4:27:17
*/
public ResultEntity<GroupbuyOrderVO> getById(Long orderId){
RpcResponse<GroupbuyOrderDTO> response = groupbuyOrderRemote.getById(orderId);
if(response.hasResult()){
GroupbuyOrderVO order = GroupbuyOrderConverter.INSTANCE.converterToSource(response.getResult());
return ResultEntity.success(order);
}
return ResultEntity.error(response.getError().getValue(), response.getMessage());
}
/**
* 订单试算
* @param order
* @return
* @author Alvin
* @date 2020年3月16日 下午3:12:29
*/
public ResultEntity<GroupbuyOrderVO> tryCalculation(GroupbuyOrderRequestVO orderRequest){
GroupbuyOrderVO order = new GroupbuyOrderVO();
BeanUtils.copyProperties(orderRequest, order);
order.setOpenId(ThreadLocalCache.getOpenId());
GroupbuyOrderDTO orderDTO = GroupbuyOrderConverter.INSTANCE.converterToTarget(order);
RpcResponse<GroupbuyOrderDTO> response = groupbuyOrderRemote.tryCalculation(orderDTO);
if(response.hasResult()){
order = GroupbuyOrderConverter.INSTANCE.converterToSource(response.getResult());
return ResultEntity.success(order);
}
return ResultEntity.error(response.getError().getValue(), response.getMessage());
}
/**
* 创建订单
* @param order
* @return
* @author Alvin
* @date 2020年3月16日 下午3:12:20
*/
public ResultEntity<GroupbuyOrderVO> createOrder(GroupbuyOrderRequestVO orderRequest){
GroupbuyOrderVO order = new GroupbuyOrderVO();
BeanUtils.copyProperties(orderRequest, order);
order.setOpenId(ThreadLocalCache.getOpenId());
GroupbuyOrderDTO orderDTO = GroupbuyOrderConverter.INSTANCE.converterToTarget(order);
RpcResponse<GroupbuyOrderDTO> response = groupbuyOrderRemote.createOrder(orderDTO);
if(response.hasResult()){
order = GroupbuyOrderConverter.INSTANCE.converterToSource(response.getResult());
return ResultEntity.success(order);
}
return ResultEntity.error(response.getError().getValue(), response.getMessage());
}
}
package cn.com.glsx.web.dj.mobile.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import cn.com.glsx.dj.groupbuy.model.GroupbuyProduct;
import cn.com.glsx.dj.groupbuy.remote.GroupbuyProductRemote;
import cn.com.glsx.framework.core.beans.ResultEntity;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.web.dj.mobile.converter.GroupbuyProductConverter;
import cn.com.glsx.web.dj.mobile.vo.groupbuy.GroupbuyProductVO;
/**
* @Title: GroupbuyProductService.java
* @Description:
* @author Alvin
* @date 2020年3月19日 下午2:23:57
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@Component
public class GroupbuyProductService {
@Autowired
private GroupbuyProductRemote groupbuyProductRemote;
public ResultEntity<List<GroupbuyProductVO>> getByMerchantId(Integer merchantId){
RpcResponse<List<GroupbuyProduct>> response = groupbuyProductRemote.getByMerchantId(merchantId);
if(response.hasResult()){
List<GroupbuyProductVO> products = new ArrayList<GroupbuyProductVO>();
for(GroupbuyProduct p:response.getResult()){
products.add(GroupbuyProductConverter.INSTANCE.converterToSource(p));
}
return ResultEntity.success(products);
}
return ResultEntity.error(response.getError().getValue(), response.getMessage());
}
}
package cn.com.glsx.web.dj.mobile.service.common;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.com.glsx.dj.wechat.dto.request.WeappQrcodeReqeustDTO;
import cn.com.glsx.dj.wechat.enums.WeappQrcodeTypeEnum;
import cn.com.glsx.dj.wechat.enums.WeappQrcodeWidthEnum;
import cn.com.glsx.dj.wechat.enums.WechatAppTypeEnum;
import cn.com.glsx.dj.wechat.remote.WechatMiniprogramRemote;
import cn.com.glsx.framework.core.beans.ResultEntity;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.web.dj.mobile.vo.common.WeappQrcodeReqeustVO;
@Service
public class QrcodeService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private WechatMiniprogramRemote wechatMiniprogramRemote;
public ResultEntity<String> createQrcode(WeappQrcodeReqeustVO vo){
logger.info("createQrcode by WeappQrcodeReqeustVO:{}", vo);
try{
WeappQrcodeReqeustDTO reqeustDTO = new WeappQrcodeReqeustDTO();
reqeustDTO.setAppType(WechatAppTypeEnum.WEAPP.name());
reqeustDTO.setIsHyaline(true);
reqeustDTO.setPath(vo.getPath());
// 默认为永久不限小程序码
WeappQrcodeTypeEnum qrcodeType = WeappQrcodeTypeEnum.get(vo.getQrcodeType());
if(qrcodeType == null){
reqeustDTO.setType(WeappQrcodeTypeEnum.QR_WXA_UNLIMIT);
}else{
reqeustDTO.setType(qrcodeType);
}
reqeustDTO.setWidth(WeappQrcodeWidthEnum.W_280);
reqeustDTO.setScene(vo.getScene());
reqeustDTO.setAppId(vo.getAppId());
logger.info("createQrcode by reqeustDTO:{}",reqeustDTO);
RpcResponse<String> rpc = wechatMiniprogramRemote.createQrCode(reqeustDTO);
logger.info("wechatMiniprogramRemote.createQrCode request:{} rpc:{}",reqeustDTO, rpc);
if(rpc.isSuccess() && rpc.hasResult()){
logger.debug("wechatMiniprogramRemote.createQrCode result:{}", rpc.getResult());
return ResultEntity.success(rpc.getResult());
}else{
return ResultEntity.error(rpc.getMessage());
}
}catch(Exception e){
logger.error("createQrcode error:{}", e.getMessage(), e);
return ResultEntity.error(e.getMessage());
}
}
}
package cn.com.glsx.web.dj.mobile.util;
import java.io.Serializable;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import cn.com.glsx.web.dj.mobile.config.DjMobileProperty;
/**
* @Title: RedisCacheManager.java
* @Description:
* @author Alvin
* @date 2019年4月19日 上午11:09:58
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2018
*/
@Component
public class RedisCacheManager {
@Autowired
private DjMobileProperty property;
@Autowired
private RedisTemplate<String, Serializable> redisTemplate;
public Object get(String key) {
return redisTemplate.opsForValue().get(property.getCachePrefix().concat(key));
}
public <T> T get(String key, Class<T> classType) {
Object value = get(key);
if (value != null) {
return classType.cast(value);
}
return null;
}
public void set(String key, Serializable value) {
redisTemplate.opsForValue().set(property.getCachePrefix().concat(key), value);
}
/**
* 添加缓存
* @param key
* @param value
* @param expireTime 失效时间(单位:秒)
* @author Alvin
* @date 2019年4月19日 上午11:19:22
*/
public void set(String key, Serializable value, Long expireTime) {
if(expireTime == null){
expireTime = property.getCacheExpire();
}
redisTemplate.opsForValue().set(property.getCachePrefix().concat(key), value, expireTime, TimeUnit.SECONDS);
}
public void del(String key) {
this.redisTemplate.delete(property.getCachePrefix().concat(key));
}
}
package cn.com.glsx.web.dj.mobile.util;
import cn.com.glsx.web.dj.mobile.web.session.Session;
/**
* @Title: ThreadLocalCache.java
* @Description:
* @author Alvin
* @date 2019年4月18日 下午8:04:11
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2018
*/
public class ThreadLocalCache {
private static ThreadLocal<Session> sessionLocal = new ThreadLocal<Session>();
private static ThreadLocal<String> openIdLocal = new ThreadLocal<String>();
private static ThreadLocal<Integer> merchantIdLocal = new ThreadLocal<Integer>();
public static void setSession(Session session){
sessionLocal.set(session);
}
public static Session getSession(){
return sessionLocal.get();
}
public static void removeSession(){
sessionLocal.remove();
}
public static void setOpenId(String openId){
openIdLocal.set(openId);
}
public static String getOpenId(){
return openIdLocal.get();
}
public static void removeOpenId(){
openIdLocal.remove();
}
public static void setMerchantId(Integer merchantId){
merchantIdLocal.set(merchantId);
}
public static Integer getMerchantId(){
return merchantIdLocal.get();
}
public static void removeMerchantId(){
merchantIdLocal.remove();
}
}
package cn.com.glsx.web.dj.mobile.vo;
import java.io.Serializable;
/**
* 领取的优惠券详情
* @author zhangyan
* @date 2019/11/18
*
*/
public class CouponReceiveInfoVO implements Serializable{
/**
*
*/
private static final long serialVersionUID = 3837755119125573618L;
private Integer id;
private String couponName;
/**
* 领取时间
*/
private String receiveTime;
/**
* 领取到结束使用时间
*/
private String receiveEndTime;
/**
* 有效期开始时间
*/
private String effectiveStartTime;
/**
* 有效期结束时间
*/
private String effectiveEndTime;
/**
* 领取状态
*/
private Integer receiveStatus;
/**
* 有效期类型
*/
private Integer effectiveType;
/**
* 有效期天数
*/
private Integer effectiveDays;
/**
* 优惠方式 1:满减 2:折扣
*/
private Integer discountType;
/**
* 面值
*/
private String denomination;
/**
* 使用门槛 1:无限制 2:满 full 可用
*/
private Integer useBarriers;
/**
* 满减金额
*/
private String full;
/**
* 核销码
*/
private String verificationCode;
/**
*
*/
private String receiveCode;
/**
* 核销状态
*/
private Integer verificationStatus;
/**
* 核销映射码
*/
private String verificationRefCode;
/**
* coupon_id:优惠券ID
*/
private Integer couponId;
/**
* 用描述
**/
private String useDescription;
private Integer couponUserId;
/**
* phone_number:手机号码
*/
private String phoneNumber;
/**
* user_name:用户名
*/
private String userName;
/**
* account_id:用户账户ID
*/
private Integer accountId;
/**
* activity_time_out:优惠券活动是否过期,0没过期,1已过期
*/
private Integer activityTimeOut;
/**
* receive_time_out:领取有效时间是否过期,0没过期,1已过期
*/
private Integer receiveTimeOut;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCouponName() {
return couponName;
}
public void setCouponName(String couponName) {
this.couponName = couponName;
}
public String getReceiveTime() {
return receiveTime;
}
public void setReceiveTime(String receiveTime) {
this.receiveTime = receiveTime;
}
public String getReceiveEndTime() {
return receiveEndTime;
}
public void setReceiveEndTime(String receiveEndTime) {
this.receiveEndTime = receiveEndTime;
}
public String getEffectiveStartTime() {
return effectiveStartTime;
}
public void setEffectiveStartTime(String effectiveStartTime) {
this.effectiveStartTime = effectiveStartTime;
}
public String getEffectiveEndTime() {
return effectiveEndTime;
}
public void setEffectiveEndTime(String effectiveEndTime) {
this.effectiveEndTime = effectiveEndTime;
}
public Integer getReceiveStatus() {
return receiveStatus;
}
public void setReceiveStatus(Integer receiveStatus) {
this.receiveStatus = receiveStatus;
}
public Integer getEffectiveType() {
return effectiveType;
}
public void setEffectiveType(Integer effectiveType) {
this.effectiveType = effectiveType;
}
public Integer getDiscountType() {
return discountType;
}
public void setDiscountType(Integer discountType) {
this.discountType = discountType;
}
public String getDenomination() {
return denomination;
}
public void setDenomination(String denomination) {
this.denomination = denomination;
}
public Integer getUseBarriers() {
return useBarriers;
}
public void setUseBarriers(Integer useBarriers) {
this.useBarriers = useBarriers;
}
public String getFull() {
return full;
}
public void setFull(String full) {
this.full = full;
}
public String getVerificationCode() {
return verificationCode;
}
public void setVerificationCode(String verificationCode) {
this.verificationCode = verificationCode;
}
public String getReceiveCode() {
return receiveCode;
}
public void setReceiveCode(String receiveCode) {
this.receiveCode = receiveCode;
}
public Integer getVerificationStatus() {
return verificationStatus;
}
public void setVerificationStatus(Integer verificationStatus) {
this.verificationStatus = verificationStatus;
}
public String getVerificationRefCode() {
return verificationRefCode;
}
public void setVerificationRefCode(String verificationRefCode) {
this.verificationRefCode = verificationRefCode;
}
public Integer getCouponId() {
return couponId;
}
public void setCouponId(Integer couponId) {
this.couponId = couponId;
}
public String getUseDescription() {
return useDescription;
}
public void setUseDescription(String useDescription) {
this.useDescription = useDescription;
}
public Integer getCouponUserId() {
return couponUserId;
}
public void setCouponUserId(Integer couponUserId) {
this.couponUserId = couponUserId;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Integer getAccountId() {
return accountId;
}
public void setAccountId(Integer accountId) {
this.accountId = accountId;
}
public Integer getActivityTimeOut() {
return activityTimeOut;
}
public void setActivityTimeOut(Integer activityTimeOut) {
this.activityTimeOut = activityTimeOut;
}
public Integer getReceiveTimeOut() {
return receiveTimeOut;
}
public void setReceiveTimeOut(Integer receiveTimeOut) {
this.receiveTimeOut = receiveTimeOut;
}
public Integer getEffectiveDays() {
return effectiveDays;
}
public void setEffectiveDays(Integer effectiveDays) {
this.effectiveDays = effectiveDays;
}
@Override
public String toString() {
return "CouponReceiveInfoVO [id=" + id + ", couponName=" + couponName
+ ", receiveTime=" + receiveTime + ", receiveEndTime="
+ receiveEndTime + ", effectiveStartTime=" + effectiveStartTime
+ ", effectiveEndTime=" + effectiveEndTime + ", receiveStatus="
+ receiveStatus + ", effectiveType=" + effectiveType
+ ", effectiveDays=" + effectiveDays + ", discountType="
+ discountType + ", denomination=" + denomination
+ ", useBarriers=" + useBarriers + ", full=" + full
+ ", verificationCode=" + verificationCode + ", receiveCode="
+ receiveCode + ", verificationStatus=" + verificationStatus
+ ", verificationRefCode=" + verificationRefCode
+ ", couponId=" + couponId + ", useDescription="
+ useDescription + ", couponUserId=" + couponUserId
+ ", phoneNumber=" + phoneNumber + ", userName=" + userName
+ ", accountId=" + accountId + ", activityTimeOut="
+ activityTimeOut + ", receiveTimeOut=" + receiveTimeOut
+ ", toString()=" + super.toString() + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo;
/**
* @Title: DemoVO.java
* @Description:
* @author zhangyan
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
public class DemoVO {
}
package cn.com.glsx.web.dj.mobile.vo;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Title: MerchantInfoVO.java
* @Description:
* @author Alvin
* @date 2020年4月1日 下午2:35:18
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class MerchantInfoVO implements Serializable{
private static final long serialVersionUID = 8965889031533479829L;
@ApiModelProperty(name = "merchantName", notes = "商户名称", dataType = "String", example = "深圳广联赛讯有限公司")
private String merchantName;
@ApiModelProperty(name = "shortName", notes = "商户简称", dataType = "String", example = "广联")
private String shortName;
@ApiModelProperty(name = "contactName", notes = "联系人", dataType = "String", example = "张总")
private String contactName;
@ApiModelProperty(name = "phone", notes = "联系人手机号", dataType = "String", example = "13800138000")
private String phone;
@ApiModelProperty(name = "address", notes = "商户地址", dataType = "String", example = "深圳市南山区")
private String address;
public String getMerchantName() {
return merchantName;
}
public void setMerchantName(String merchantName) {
this.merchantName = merchantName;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getContactName() {
return contactName;
}
public void setContactName(String contactName) {
this.contactName = contactName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "MerchantInfoVO [merchantName=" + merchantName + ", shortName="
+ shortName + ", contactName=" + contactName + ", phone="
+ phone + ", address=" + address + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.common;
import java.io.Serializable;
/**
* 小程序二维码请求参数
* @author zhangyan
* @date 2020年6月16日10:51:43
*
*/
public class WeappQrcodeReqeustVO implements Serializable{
private static final long serialVersionUID = 4348701896168208033L;
private String appId;
/**
* 商户id
*/
private Integer merchantId;
/**
* 二维码类型(QR_WXA_LIMIT:永久有限小程序码,QR_WXA_UNLIMIT:永久不限小程序码,QR_LIMIT:永久有限二维码)
*/
private String qrcodeType;
/**
* 页面路径
*/
private String path;
/**
* 页面参数
*/
private String scene;
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public Integer getMerchantId() {
return merchantId;
}
public void setMerchantId(Integer merchantId) {
this.merchantId = merchantId;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getScene() {
return scene;
}
public void setScene(String scene) {
this.scene = scene;
}
public String getQrcodeType() {
return qrcodeType;
}
public void setQrcodeType(String qrcodeType) {
this.qrcodeType = qrcodeType;
}
@Override
public String toString() {
return "WeappQrcodeReqeustVO [appId=" + appId + ", merchantId="
+ merchantId + ", qrcodeType=" + qrcodeType + ", path=" + path
+ ", scene=" + scene + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.groupbuy;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.validation.constraints.Min;
/**
* @Title: GroupbuyActivityPackagePriceVO.java
* @Description:
* @author Alvin
* @date 2020年3月19日 上午11:28:31
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyActivityPackagePriceVO implements Serializable{
private static final long serialVersionUID = -8820166138094542702L;
@ApiModelProperty(name = "id", notes = "阶梯价ID", dataType = "long", example = "1")
private Long id;
@ApiModelProperty(name = "createdDate", notes = "创建时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date createdDate;
@ApiModelProperty(name = "updatedDate", notes = "更新时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date updatedDate;
/**
* 活动ID
*/
@ApiModelProperty(name = "activityId", notes = "活动ID", dataType = "long", required = true, example = "1")
private Long activityId;
/**
* 最低套数(最小为1)
*/
@Min(value = 1, message = "最低套数(最小为1)")
@ApiModelProperty(name = "minPackages", notes = "最低套数(最小为1)", dataType = "long", required = true, example = "1")
private Integer minPackages;
/**
* 最高套数(无上限)
*/
@ApiModelProperty(name = "maxPackages", notes = "最高套数(无上限)", dataType = "long", required = true, example = "10")
private Integer maxPackages;
/**
* 主产品拼团价
*/
@ApiModelProperty(name = "groupbuyPrice", notes = "主产品拼团价", dataType = "BigDecimal", required = true, example = "128.99")
private BigDecimal groupbuyPrice;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
public Long getActivityId() {
return activityId;
}
public void setActivityId(Long activityId) {
this.activityId = activityId;
}
public Integer getMinPackages() {
return minPackages;
}
public void setMinPackages(Integer minPackages) {
this.minPackages = minPackages;
}
public Integer getMaxPackages() {
return maxPackages;
}
public void setMaxPackages(Integer maxPackages) {
this.maxPackages = maxPackages;
}
public BigDecimal getGroupbuyPrice() {
return groupbuyPrice;
}
public void setGroupbuyPrice(BigDecimal groupbuyPrice) {
this.groupbuyPrice = groupbuyPrice;
}
@Override
public String toString() {
return "GroupbuyActivityPackagePriceVO [id=" + id + ", createdDate="
+ createdDate + ", updatedDate=" + updatedDate
+ ", activityId=" + activityId + ", minPackages=" + minPackages
+ ", maxPackages=" + maxPackages + ", groupbuyPrice="
+ groupbuyPrice + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.groupbuy;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.validation.constraints.Pattern;
/**
* @Title: GroupbuyActivityPackageVO.java
* @Description:
* @author Alvin
* @date 2020年3月19日 上午11:15:59
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyActivityPackageVO implements Serializable{
private static final long serialVersionUID = 902193733728574285L;
@ApiModelProperty(name = "id", notes = "套餐ID", dataType = "long", example = "1")
private Long id;
@ApiModelProperty(name = "createdDate", notes = "创建时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date createdDate;
@ApiModelProperty(name = "updatedDate", notes = "更新时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date updatedDate;
/**
* 活动ID
*/
@ApiModelProperty(name = "activityId", notes = "活动ID", dataType = "long", required = true, example = "1")
private Long activityId;
/**
* 产品ID
*/
@ApiModelProperty(name = "productId", notes = "产品ID", dataType = "long", required = true, example = "1")
private Long productId;
/**
* 产品名称
*/
@ApiModelProperty(name = "productName", notes = "产品名称", dataType = "String", required = true, example = "4G隐藏式记录仪")
private String productName;
/**
* 是否为主产品(Y:是;N:否)
*/
@Pattern(regexp = "^[NY]{1}$")
@ApiModelProperty(name = "isMain", notes = "是否为主产品(Y:是;N:否)", dataType = "String", required = true, example = "Y")
private String isMain;
/**
* 拼团价
*/
@ApiModelProperty(name = "groupbuyPrice", notes = "拼团价", dataType = "BigDecimal", required = true, example = "168.99")
private BigDecimal groupbuyPrice;
/**
* 成本价
*/
@ApiModelProperty(name = "costPrice", notes = "成本价", dataType = "BigDecimal", required = true, example = "99.99")
private BigDecimal costPrice;
/**
* 返利比例
*/
@ApiModelProperty(name = "rebateRatio", notes = "返利比例", dataType = "BigDecimal", required = true, example = "25.5")
private BigDecimal rebateRatio;
/**
* 产品数量
*/
@ApiModelProperty(name = "productCount", notes = "产品数量", dataType = "int", required = true, example = "10")
private Integer productCount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
public Long getActivityId() {
return activityId;
}
public void setActivityId(Long activityId) {
this.activityId = activityId;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getIsMain() {
return isMain;
}
public void setIsMain(String isMain) {
this.isMain = isMain;
}
public BigDecimal getGroupbuyPrice() {
return groupbuyPrice;
}
public void setGroupbuyPrice(BigDecimal groupbuyPrice) {
this.groupbuyPrice = groupbuyPrice;
}
public BigDecimal getCostPrice() {
return costPrice;
}
public void setCostPrice(BigDecimal costPrice) {
this.costPrice = costPrice;
}
public BigDecimal getRebateRatio() {
return rebateRatio;
}
public void setRebateRatio(BigDecimal rebateRatio) {
this.rebateRatio = rebateRatio;
}
public Integer getProductCount() {
return productCount;
}
public void setProductCount(Integer productCount) {
this.productCount = productCount;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
@Override
public String toString() {
return "GroupbuyActivityPackageVO [id=" + id + ", createdDate="
+ createdDate + ", updatedDate=" + updatedDate
+ ", activityId=" + activityId + ", productId=" + productId
+ ", productName=" + productName + ", isMain=" + isMain
+ ", groupbuyPrice=" + groupbuyPrice + ", costPrice="
+ costPrice + ", rebateRatio=" + rebateRatio
+ ", productCount=" + productCount + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.groupbuy;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import cn.com.glsx.web.dj.mobile.vo.MerchantInfoVO;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* @Title: GroupbuyActivityVO.java
* @Description:
* @author Alvin
* @date 2020年3月19日 上午11:26:58
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyActivityVO implements Serializable{
private static final long serialVersionUID = -2362653974604584520L;
@ApiModelProperty(name = "id", notes = "活动ID", dataType = "long", example = "1")
private Long id;
@ApiModelProperty(name = "createdDate", notes = "创建时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date createdDate;
@ApiModelProperty(name = "updatedDate", notes = "更新时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date updatedDate;
/**
* 预计总返利
*/
@ApiModelProperty(name = "totalRebate", notes = "预计总返利", dataType = "BigDecimal", example = "1289.66")
private BigDecimal totalRebate;
/**
* 商户号
*/
@ApiModelProperty(name = "merchantId", notes = "商户号", dataType = "int", example = "10000")
private Integer merchantId;
/**
* 活动名称
*/
@ApiModelProperty(name = "activityName", notes = "活动名称", dataType = "String", example = "车载智能终端拼团购")
private String activityName;
/**
* 开团时间
*/
@ApiModelProperty(name = "beginTime", notes = "更新时间", dataType = "date", example = "2020-03-18 00:00:00")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date beginTime;
/**
* 成团时间
*/
@ApiModelProperty(name = "endTime", notes = "更新时间", dataType = "date", example = "2020-04-18 23:59:59")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
/**
* 成团量(预估销售套餐数)
*/
@ApiModelProperty(name = "packageCount", notes = "成团量(预估销售套餐数)", dataType = "int", example = "1000")
private Integer packageCount;
/**
* 套餐价格
*/
@ApiModelProperty(name = "packagePrice", notes = "套餐价格", dataType = "BigDecimal", example = "168.99")
private BigDecimal packagePrice;
/**
* 活动状态(0:未开始;1:进行中;2:已结束;3:已暂停)
*/
@ApiModelProperty(name = "activityStatus", notes = "活动状态(0:未开始;1:进行中;2:已结束;3:已暂停)", dataType = "int", example = "1")
private Integer activityStatus;
/**
* 活动套餐
*/
@ApiModelProperty(name = "packages", notes = "活动套餐列表", dataType = "list")
private List<GroupbuyActivityPackageVO> packages;
/**
* 阶梯价格
*/
@ApiModelProperty(name = "prices", notes = "阶梯价格列表", dataType = "list")
private List<GroupbuyActivityPackagePriceVO> prices;
/**
* 订单列表(用于排名)
*/
@ApiModelProperty(name = "orders", notes = "订单列表(用于排名)", dataType = "list")
private List<GroupbuyParentOrderVO> orders;
/**
* 商户信息
*/
@ApiModelProperty(name = "merchantInfo", notes = "商户信息", dataType = "MerchantInfoVO")
private MerchantInfoVO merchantInfo;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
public BigDecimal getTotalRebate() {
return totalRebate;
}
public void setTotalRebate(BigDecimal totalRebate) {
this.totalRebate = totalRebate;
}
public Integer getMerchantId() {
return merchantId;
}
public void setMerchantId(Integer merchantId) {
this.merchantId = merchantId;
}
public String getActivityName() {
return activityName;
}
public void setActivityName(String activityName) {
this.activityName = activityName;
}
public Date getBeginTime() {
return beginTime;
}
public void setBeginTime(Date beginTime) {
this.beginTime = beginTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Integer getPackageCount() {
return packageCount;
}
public void setPackageCount(Integer packageCount) {
this.packageCount = packageCount;
}
public BigDecimal getPackagePrice() {
return packagePrice;
}
public void setPackagePrice(BigDecimal packagePrice) {
this.packagePrice = packagePrice;
}
public Integer getActivityStatus() {
return activityStatus;
}
public void setActivityStatus(Integer activityStatus) {
this.activityStatus = activityStatus;
}
public List<GroupbuyActivityPackageVO> getPackages() {
return packages;
}
public void setPackages(List<GroupbuyActivityPackageVO> packages) {
this.packages = packages;
}
public List<GroupbuyActivityPackagePriceVO> getPrices() {
return prices;
}
public void setPrices(List<GroupbuyActivityPackagePriceVO> prices) {
this.prices = prices;
}
public List<GroupbuyParentOrderVO> getOrders() {
return orders;
}
public void setOrders(List<GroupbuyParentOrderVO> orders) {
this.orders = orders;
}
public MerchantInfoVO getMerchantInfo() {
return merchantInfo;
}
public void setMerchantInfo(MerchantInfoVO merchantInfo) {
this.merchantInfo = merchantInfo;
}
@Override
public String toString() {
return "GroupbuyActivityVO [id=" + id + ", createdDate=" + createdDate
+ ", updatedDate=" + updatedDate + ", totalRebate="
+ totalRebate + ", merchantId=" + merchantId
+ ", activityName=" + activityName + ", beginTime=" + beginTime
+ ", endTime=" + endTime + ", packageCount=" + packageCount
+ ", packagePrice=" + packagePrice + ", activityStatus="
+ activityStatus + ", packages=" + packages + ", prices="
+ prices + ", orders=" + orders + ", merchantInfo="
+ merchantInfo + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.groupbuy;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
/**
* @Title: GroupbuyOrderRequestVO.java
* @Description:
* @author Alvin
* @date 2020年3月20日 下午5:32:37
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyOrderRequestVO implements Serializable{
private static final long serialVersionUID = -1151042310148566288L;
/**
* 购买套餐数量
*/
@ApiModelProperty(name = "purchaseQuantity", notes = "购买套餐数量", dataType = "int", example = "100")
private Integer purchaseQuantity;
/**
* 手机号
*/
@ApiModelProperty(name = "phone", notes = "手机号", dataType = "String", example = "13800138000")
private String phone;
/**
* 活动ID
*/
@ApiModelProperty(name = "activityId", notes = "活动ID", dataType = "long", example = "1")
private Long activityId;
public Integer getPurchaseQuantity() {
return purchaseQuantity;
}
public void setPurchaseQuantity(Integer purchaseQuantity) {
this.purchaseQuantity = purchaseQuantity;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Long getActivityId() {
return activityId;
}
public void setActivityId(Long activityId) {
this.activityId = activityId;
}
@Override
public String toString() {
return "GroupbuyOrderRequestVO [purchaseQuantity=" + purchaseQuantity
+ ", phone=" + phone + ", activityId=" + activityId + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.groupbuy;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @Title: GroupbuyOrderVO.java
* @Description:
* @author Alvin
* @date 2020年3月19日 上午11:42:44
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyOrderVO extends GroupbuyParentOrderVO{
private static final long serialVersionUID = 3172013010844841609L;
/**
* 购买套餐数量
*/
@ApiModelProperty(name = "purchaseQuantity", notes = "购买套餐数量", dataType = "int", example = "100")
private Integer purchaseQuantity;
/**
* 返利排名
*/
@ApiModelProperty(name = "rebateRanking", notes = "返利排名", dataType = "int", example = "1")
private Integer rebateRanking;
/**
* 套餐信息列表
*/
@ApiModelProperty(name = "packages", notes = "套餐信息列表", dataType = "list")
private List<GroupbuyActivityPackageVO> packages;
/**
* 子订单
*/
@ApiModelProperty(name = "subOrders", notes = "子订单列表", dataType = "list")
private List<GroupbuySubOrderVO> subOrders;
public Integer getPurchaseQuantity() {
return purchaseQuantity;
}
public void setPurchaseQuantity(Integer purchaseQuantity) {
this.purchaseQuantity = purchaseQuantity;
}
public List<GroupbuySubOrderVO> getSubOrders() {
return subOrders;
}
public void setSubOrders(List<GroupbuySubOrderVO> subOrders) {
this.subOrders = subOrders;
}
public List<GroupbuyActivityPackageVO> getPackages() {
return packages;
}
public void setPackages(List<GroupbuyActivityPackageVO> packages) {
this.packages = packages;
}
public Integer getRebateRanking() {
return rebateRanking;
}
public void setRebateRanking(Integer rebateRanking) {
this.rebateRanking = rebateRanking;
}
@Override
public String toString() {
return "GroupbuyOrderVO [purchaseQuantity=" + purchaseQuantity
+ ", rebateRanking=" + rebateRanking + ", packages=" + packages
+ ", subOrders=" + subOrders + ", toString()="
+ super.toString() + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.groupbuy;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Title: GroupbuyParentOrderVO.java
* @Description:
* @author Alvin
* @date 2020年3月19日 上午11:31:29
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyParentOrderVO implements Serializable{
private static final long serialVersionUID = 7471489113484997441L;
@ApiModelProperty(name = "id", notes = "父订单ID", dataType = "long", example = "1")
private Long id;
@ApiModelProperty(name = "createdDate", notes = "创建时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date createdDate;
@ApiModelProperty(name = "updatedDate", notes = "更新时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date updatedDate;
/**
* 商户号
*/
@ApiModelProperty(name = "merchantId", notes = "商户号", dataType = "int", example = "10000")
private Integer merchantId;
/**
* 用户ID(微信OPEN_ID)
*/
@ApiModelProperty(name = "openId", notes = "用户ID(微信OPEN_ID)", dataType = "String", example = "omXcawmKIqs_1uk8u05eyvEKkvAM")
private String openId;
/**
* 手机号
*/
@ApiModelProperty(name = "phone", notes = "手机号", dataType = "String", example = "13800138000")
private String phone;
/**
* 活动ID
*/
@ApiModelProperty(name = "activityId", notes = "活动ID", dataType = "long", example = "1")
private Long activityId;
/**
* 活动名称
*/
@ApiModelProperty(name = "activityName", notes = "活动名称", dataType = "String", example = "车载智能终端拼团购")
private String activityName;
/**
* 订单总额
*/
@ApiModelProperty(name = "orderAmount", notes = "订单总额", dataType = "BigDecimal", example = "25168.99")
private BigDecimal orderAmount;
/**
* 订单量
*/
@ApiModelProperty(name = "orderNumber", notes = "订单量", dataType = "int", example = "99")
private Integer orderNumber;
/**
* 返利总额
*/
@ApiModelProperty(name = "rebateAmount", notes = "返利总额", dataType = "BigDecimal", example = "3168.99")
private BigDecimal rebateAmount;
/**
* 套餐价格
*/
@ApiModelProperty(name = "packagePrice", notes = "套餐价格", dataType = "BigDecimal", example = "168.99")
private BigDecimal packagePrice;
/**
* 单套餐返利
*/
@ApiModelProperty(name = "packageRebate", notes = "单套餐返利", dataType = "BigDecimal", example = "68.99")
private BigDecimal packageRebate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
public Integer getMerchantId() {
return merchantId;
}
public void setMerchantId(Integer merchantId) {
this.merchantId = merchantId;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Long getActivityId() {
return activityId;
}
public void setActivityId(Long activityId) {
this.activityId = activityId;
}
public String getActivityName() {
return activityName;
}
public void setActivityName(String activityName) {
this.activityName = activityName;
}
public BigDecimal getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(BigDecimal orderAmount) {
this.orderAmount = orderAmount;
}
public Integer getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(Integer orderNumber) {
this.orderNumber = orderNumber;
}
public BigDecimal getRebateAmount() {
return rebateAmount;
}
public void setRebateAmount(BigDecimal rebateAmount) {
this.rebateAmount = rebateAmount;
}
public BigDecimal getPackagePrice() {
return packagePrice;
}
public void setPackagePrice(BigDecimal packagePrice) {
this.packagePrice = packagePrice;
}
public BigDecimal getPackageRebate() {
return packageRebate;
}
public void setPackageRebate(BigDecimal packageRebate) {
this.packageRebate = packageRebate;
}
@Override
public String toString() {
return "GroupbuyParentOrderVO [id=" + id + ", createdDate="
+ createdDate + ", updatedDate=" + updatedDate
+ ", merchantId=" + merchantId + ", openId=" + openId
+ ", phone=" + phone + ", activityId=" + activityId
+ ", activityName=" + activityName + ", orderAmount="
+ orderAmount + ", orderNumber=" + orderNumber
+ ", rebateAmount=" + rebateAmount + ", packagePrice="
+ packagePrice + ", packageRebate=" + packageRebate + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.groupbuy;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Title: GroupbuyProductVO.java
* @Description:
* @author Alvin
* @date 2020年3月19日 下午2:25:20
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuyProductVO implements Serializable{
private static final long serialVersionUID = -549616652087797099L;
@ApiModelProperty(name = "id", notes = "活动ID", dataType = "long", example = "1")
private Long id;
@ApiModelProperty(name = "createdDate", notes = "创建时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date createdDate;
@ApiModelProperty(name = "updatedDate", notes = "更新时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date updatedDate;
/**
* 商户号
*/
@ApiModelProperty(name = "merchantId", notes = "商户号", dataType = "int", example = "10000")
private Integer merchantId;
/**
* 产品名称
*/
@ApiModelProperty(name = "productName", notes = "产品名称", dataType = "String", example = "4G隐藏式记录仪")
private String productName;
/**
* 成本价
*/
@ApiModelProperty(name = "costPrice", notes = "成本价", dataType = "BigDecimal", example = "128.99")
private BigDecimal costPrice;
/**
* 累计销量
*/
@ApiModelProperty(name = "cumulativeSales", notes = "累计销量", dataType = "int", example = "9999")
private Integer cumulativeSales;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
public Integer getMerchantId() {
return merchantId;
}
public void setMerchantId(Integer merchantId) {
this.merchantId = merchantId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public BigDecimal getCostPrice() {
return costPrice;
}
public void setCostPrice(BigDecimal costPrice) {
this.costPrice = costPrice;
}
public Integer getCumulativeSales() {
return cumulativeSales;
}
public void setCumulativeSales(Integer cumulativeSales) {
this.cumulativeSales = cumulativeSales;
}
@Override
public String toString() {
return "GroupbuyProductVO [id=" + id + ", createdDate=" + createdDate
+ ", updatedDate=" + updatedDate + ", merchantId=" + merchantId
+ ", productName=" + productName + ", costPrice=" + costPrice
+ ", cumulativeSales=" + cumulativeSales + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.groupbuy;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
* @Title: GroupbuySubOrderVO.java
* @Description:
* @author Alvin
* @date 2020年3月19日 上午11:43:19
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
public class GroupbuySubOrderVO implements Serializable{
private static final long serialVersionUID = 2197877031858982856L;
@ApiModelProperty(name = "id", notes = "子订单ID", dataType = "long", example = "1")
private Long id;
@ApiModelProperty(name = "createdDate", notes = "创建时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date createdDate;
@ApiModelProperty(name = "updatedDate", notes = "更新时间", dataType = "date", example = "2020-03-18 00:00:00")
private Date updatedDate;
/**
* 父订单ID
*/
@ApiModelProperty(name = "parentOrderId", notes = "父订单ID", dataType = "long", example = "1")
private Long parentOrderId;
/**
* 子订单号
*/
@ApiModelProperty(name = "orderId", notes = "子订单号", dataType = "String", example = "20200316205020241129732421459968")
private String orderId;
/**
* 订单量
*/
@ApiModelProperty(name = "orderNumber", notes = "订单量", dataType = "int", example = "100")
private Integer orderNumber;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
public Long getParentOrderId() {
return parentOrderId;
}
public void setParentOrderId(Long parentOrderId) {
this.parentOrderId = parentOrderId;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public Integer getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(Integer orderNumber) {
this.orderNumber = orderNumber;
}
@Override
public String toString() {
return "GroupbuySubOrderVO [id=" + id + ", createdDate=" + createdDate
+ ", updatedDate=" + updatedDate + ", parentOrderId="
+ parentOrderId + ", orderId=" + orderId + ", orderNumber="
+ orderNumber + "]";
}
}
package cn.com.glsx.web.dj.mobile.vo.insure;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import cn.com.glsx.dj.system.model.Merchant;
public class AllInsureEquityVO implements Serializable{
/**
*
*/
private static final long serialVersionUID = 2368758682477151728L;
private Date effectStartDate;
private Date effectEndDate;
private Integer activeStatus;
private Merchant merchantInfo;
private String counselorName;
private String collisionPhone;
private List<Integer> equityTypeList;
private String qrcode;
public Date getEffectStartDate() {
return effectStartDate;
}
public void setEffectStartDate(Date effectStartDate) {
this.effectStartDate = effectStartDate;
}
public Date getEffectEndDate() {
return effectEndDate;
}
public void setEffectEndDate(Date effectEndDate) {
this.effectEndDate = effectEndDate;
}
public Integer getActiveStatus() {
return activeStatus;
}
public void setActiveStatus(Integer activeStatus) {
this.activeStatus = activeStatus;
}
public Merchant getMerchantInfo() {
return merchantInfo;
}
public void setMerchantInfo(Merchant merchantInfo) {
this.merchantInfo = merchantInfo;
}
public String getCounselorName() {
return counselorName;
}
public void setCounselorName(String counselorName) {
this.counselorName = counselorName;
}
public String getCollisionPhone() {
return collisionPhone;
}
public void setCollisionPhone(String collisionPhone) {
this.collisionPhone = collisionPhone;
}
public List<Integer> getEquityTypeList() {
return equityTypeList;
}
public void setEquityTypeList(List<Integer> equityTypeList) {
this.equityTypeList = equityTypeList;
}
public String getQrcode() {
return qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
@Override
public String toString() {
return "AllInsureEquityVO [effectStartDate=" + effectStartDate + ", effectEndDate=" + effectEndDate
+ ", activeStatus=" + activeStatus + ", merchantInfo=" + merchantInfo + ", counselorName="
+ counselorName + ", collisionPhone=" + collisionPhone + ", equityTypeList=" + equityTypeList
+ ", qrcode=" + qrcode + "]";
}
}
package cn.com.glsx.web.dj.mobile.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
import cn.com.glsx.web.dj.mobile.web.interceptor.AuthInterceptor;
import cn.com.glsx.web.dj.mobile.web.interceptor.SessionInterceptor;
/**
* @Title: SpringMvcConfig.java
* @Description:
* @author Alvin
* @date 2019年5月30日 下午3:53:13
* @version V1.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2018
*/
@SpringBootConfiguration
public class SpringMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
private AuthInterceptor authInterceptor;
@Autowired
private SessionInterceptor sessionInterceptor;
@Autowired
private ThymeleafViewResolver thymeleafViewResolver;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(sessionInterceptor).addPathPatterns("/**");
registry.addInterceptor(authInterceptor).addPathPatterns("/**");
}
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
// 支持https重定向
thymeleafViewResolver.setRedirectHttp10Compatible(false);
registry.viewResolver(thymeleafViewResolver);
super.configureViewResolvers(registry);
}
}
package cn.com.glsx.web.dj.mobile.web.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @Title: NeedSession.java
* @Description: 会话拦截注解
* @author Alvin.zengqi
* @date 2015年9月26日 下午12:12:01
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2015
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface NeedOpenId
{
}
package cn.com.glsx.web.dj.mobile.web.interceptor;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import cn.com.glsx.dj.wechat.remote.WechatH5AuthorizeInfoRemote;
import cn.com.glsx.web.dj.mobile.config.Constants;
import cn.com.glsx.web.dj.mobile.config.DjMobileProperty;
import cn.com.glsx.web.dj.mobile.util.ThreadLocalCache;
import cn.com.glsx.web.dj.mobile.web.annotation.NeedOpenId;
import cn.com.glsx.web.dj.mobile.web.session.Session;
/**
* 授权拦截
* <P>Description: </P>
*
* @author Alvin
* @version 1.0
*/
@Component
@Order(2)
public class AuthInterceptor implements HandlerInterceptor {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private static final String UN_KNOWN = "unknown";
@Autowired
private WechatH5AuthorizeInfoRemote wechatH5AuthorizeInfoRemote;
@Autowired
private DjMobileProperty property;
@Override
public void afterCompletion(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception exception)
throws Exception {
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response,
Object handler, ModelAndView mav) throws Exception {
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler) throws Exception {
response.setHeader("Content-Type", "text/html;charset=UTF-8");
Session session = ThreadLocalCache.getSession();
Map<String, String> params = getParameterMap(request);
String ip = getIpAddr(request);
logger.info("[ip:{}, method:{}, uri:{}, params:{}, user-agent:{}, session:{}"
, ip
, request.getMethod()
, request.getRequestURI()
, params
, request.getHeader("User-Agent")
, session);
HandlerMethod method = null;
if(handler instanceof HandlerMethod){
method = (HandlerMethod) handler;
}
String openId = session.get(Constants.SessionKey.OPENID.getValue(), String.class);
boolean isAuthorized = method != null && StringUtils.isEmpty(openId) && (method.getMethodAnnotation(NeedOpenId.class) != null || method.getBeanType().getDeclaredAnnotation(NeedOpenId.class) != null);
if(isAuthorized){
String state = request.getRequestURI().replaceAll(request.getContextPath(), "");
String redirectAuthUrl = wechatH5AuthorizeInfoRemote.getWechatBaseAuthorizeUrl(property.getOauth2CallbackUrl(), state, property.getAppId()).getResult();
logger.info("get redirect auth url:{} by state:{}, appId:{}", redirectAuthUrl, state, property.getAppId());
response.sendRedirect(redirectAuthUrl);
return false;
}
Integer merchantId = session.get(Constants.SessionKey.MERCHANT_ID.getValue(), Integer.class);
ThreadLocalCache.setMerchantId(merchantId);
ThreadLocalCache.setOpenId(openId);
return true;
}
private HashMap<String, String> getParameterMap(HttpServletRequest request){
HashMap<String, String> parameterMap = new HashMap<String, String>(16);
for(String name:request.getParameterMap().keySet()){
parameterMap.put(name, request.getParameter(name));
}
return parameterMap;
}
protected String getIpAddr(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || UN_KNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Forwarded-For");
}
if (ip == null || ip.length() == 0 || UN_KNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || UN_KNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || UN_KNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || UN_KNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || UN_KNOWN.equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Real-IP");
}
if (ip == null || ip.length() == 0 || UN_KNOWN.equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
if (ip != null) {
String[] ss = ip.split(",");
if (ss.length > 0) {
return ss[0];
}
}
return ip;
}
}
package cn.com.glsx.web.dj.mobile.web.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import cn.com.glsx.web.dj.mobile.util.ThreadLocalCache;
import cn.com.glsx.web.dj.mobile.web.session.Session;
import cn.com.glsx.web.dj.mobile.web.session.SessionManager;
/**
* @Title: SessionInterceptor.java
* @Description:
* @author Alvin.zengqi
* @date 2015年12月23日 上午11:39:38
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2015
*/
@Component
@Order(1)
public class SessionInterceptor implements HandlerInterceptor {
@Autowired
private SessionManager sessionManager;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object arg2) throws Exception {
String sessionId = request.getParameter("sessionId");
if(!StringUtils.isEmpty(sessionId)){
Session session = sessionManager.getSession(sessionId);
if(session != null){
sessionManager.cacheSession(session, response);
}else{
sessionManager.createSession(request, response);
}
}else{
sessionManager.createSession(request, response);
}
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse arg1, Object response, ModelAndView arg3) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse arg1, Object response, Exception arg3) throws Exception {
// 同步集群环境session
sessionManager.sync();
removeThreadLocal();
}
/**
* @Description: 清除线程变量,防止OOM
* @author Alvin.zengqi
* @date 2017年10月19日 上午10:52:57
*/
private void removeThreadLocal(){
ThreadLocalCache.removeSession();
ThreadLocalCache.removeOpenId();
ThreadLocalCache.removeMerchantId();
}
}
package cn.com.glsx.web.dj.mobile.web.session;
import java.io.Serializable;
import java.util.HashMap;
/**
* @Title: Session.java
* @Description:
* @author Alvin.zengqi
* @date 2015年12月22日 下午9:57:35
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2015
*/
@SuppressWarnings("serial")
public class Session extends HashMap<String, Serializable> {
private String id;
private boolean sync = false;
private boolean logout = false;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public boolean isSync() {
return sync;
}
public void setSync(boolean sync) {
this.sync = sync;
}
public <T> T get(String key, Class<T> clazz){
Object value = get(key);
if(value != null){
try{
return clazz.cast(value);
}catch(Exception e){
e.printStackTrace();
}
}
return null;
}
public boolean isLogout() {
return logout;
}
public void setLogout(boolean logout) {
this.logout = logout;
if(logout){
setSync(true);
}
}
@Override
public Serializable put(String key, Serializable value) {
this.sync = true;
return super.put(key, value);
}
@Override
public String toString() {
return "[id:" + id + ", sync:" + sync + ", logout:" + logout + ", Map:" + super.toString() + "]";
}
}
package cn.com.glsx.web.dj.mobile.web.session;
import java.util.UUID;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import cn.com.glsx.web.dj.mobile.config.DjMobileProperty;
import cn.com.glsx.web.dj.mobile.util.RedisCacheManager;
import cn.com.glsx.web.dj.mobile.util.ThreadLocalCache;
/**
* @Title: SessionManager.java
* @Description: 会话管理
* @author Alvin.zengqi
* @date 2015年12月22日 下午10:02:17
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2015
*/
@Component
public class SessionManager {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private RedisCacheManager cacheManager;
@Autowired
private DjMobileProperty property;
public Session createSession(HttpServletRequest request, HttpServletResponse response) {
String sessionId = getSessionId(request);
Session session = null;
try{
session = cacheManager.get(sessionId, Session.class);
}catch(Exception e){
try {
cacheManager.del(sessionId);
} catch (Exception e1) {
logger.error(e1.getMessage(), e);
}
logger.error("get session error:" + e.getMessage(), e);
}
if(session == null){
session = new Session();
session.setId(sessionId);
try{
cacheManager.set(sessionId, session, null);
}catch(Exception e){
}
}else{
if(StringUtils.isEmpty(session.getId())){
session.setId(sessionId);
}
}
Cookie cookie = new Cookie(property.getSessionIdKey(), sessionId);
cookie.setPath("/");
// 有效期30分钟
cookie.setMaxAge(30 * 60);
response.addCookie(cookie);
ThreadLocalCache.setSession(session);
return ThreadLocalCache.getSession();
}
public String getSessionId(HttpServletRequest request){
String sessionId = request.getParameter("sessionId");
if(StringUtils.isEmpty(sessionId)){
Cookie[] cookies = request.getCookies();
if(cookies != null && cookies.length > 0){
for(Cookie cookie:cookies){
if(cookie.getName().equals(property.getSessionIdKey())){
sessionId = cookie.getValue();
continue;
}
}
}
}
if (StringUtils.isEmpty(sessionId)) {
sessionId = request.getRequestedSessionId();
}
if (StringUtils.isEmpty(sessionId)) {
String uri = request.getRequestURI();
if (property.getSessionIdKey() != null) {
int s = uri.indexOf(property.getSessionIdKey());
if (s >= 0) {
s += property.getCachePrefix().length();
int i = s;
while (i < uri.length()) {
char c = uri.charAt(i);
if (c == ';' || c == '#' || c == '?' || c == '/') {
break;
}
i++;
}
sessionId = uri.substring(s,i);
}
}
}
if (StringUtils.isEmpty(sessionId)) {
sessionId = UUID.randomUUID().toString().replaceAll("-", "");
}
return sessionId;
}
public void cacheSession(Session session, HttpServletResponse response){
Cookie cookie = new Cookie(property.getSessionIdKey(), session.getId());
cookie.setPath("/");
// 有效期30分钟
cookie.setMaxAge(30 * 60);
response.addCookie(cookie);
ThreadLocalCache.setSession(session);
}
public Session getSession(String sessionId){
try {
Session session = cacheManager.get(sessionId, Session.class);
if(session != null && StringUtils.isEmpty(session.getId())){
session.setId(sessionId);
}
return session;
} catch (Exception e) {
logger.debug("get session by Id:" + sessionId + " error:" + e.getMessage(), e);
}
return null;
}
/**
* @Description: 会话集群环境同步
* @author Alvin.zengqi
* @date 2017年10月19日 上午10:49:40
*/
public void sync(){
Session session = ThreadLocalCache.getSession();
if(session != null && session.isSync()){
session.setSync(false);
if(session.isLogout()){
cacheManager.del(session.getId());
session.clear();
}else{
cacheManager.set(session.getId(), session, null);
}
}
}
}
org.springframework.boot.env.PropertySourceLoader=org.oreframework.boot.autoconfigure.diamond.DiamondAutoConfiguration
\ No newline at end of file \ No newline at end of file
# framework-archetype-webapp
运营平台项目骨架
一、项目结构说明:
└─src
├─main
├─java
├─cn.com.glsx.web.dj.h5.config 配置层
├─cn.com.glsx.web.dj.h5.controller 控制层
├─cn.com.glsx.web.dj.h5.vo 视图对象
├─cn.com.glsx.web.dj.h5.service 业务层
├─cn.com.glsx.web.dj.h5.Main.java 程序入口
└─cn.com.glsx.web.dj.h5.WebMvcConfigurer.java MVC拦截器配置类
├─resources 资源文件目录
├─config
├─application.properties 应用配置文件
├─templates 模板目录
└─*.flt freemarker模板,(可用于邮件模板)
└─logback.xml 日志配置文件
└─webapp web前端文件目录
├─static 静态文件
├─css 样式文件
├─images 图片文件
└─js JavaScript文件
└─common 公共js文件
├─views
└─model 模块文件夹
└─*.html 视图文件
└─WEB-INF
└─bin shell脚本文件(包含启动、停止、重启等)
└─test 测试目录
├─java
└─cn.com.glsx.web.dj.h5/service 测试代码
└─resources 测试资源目录
└─pom.xml pom文件
二、使用说明:
1、运行项目前需在配置中心创建配置信息,配置内容参考三配置说明:
1.1> dataId : application.properties --> ore.diamond.dataId + ore.diamond.env
1.2> group : application.properties --> ore.diamond.group
1.3> content : 参考三配置说明
三、配置说明:
#----------------------------------------------------------------------------------------------------------
# dubbo配置
# dubbo应用名称
ore.dubbo.application.name=web-dj-h5
# dubbo应用所有者
ore.dubbo.application.owner=zhangyan
# dubbo服务注册地址
ore.dubbo.registry.address=zookeeper://192.168.3.206:2181
# dubbo服务注册超时时间
ore.dubbo.registry.timeout=30000
# 默认协议:dubbo
ore.dubbo.protocol.name=dubbo
# dubbo服务扫描包路径
ore.dubbo.scan=cn.com.glsx.web.dj.h5
#----------------------------------------------------------------------------------------------------------
# 静态文件路径,默认:classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
spring.resources.static-locations:classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,/views/
#----------------------------------------------------------------------------------------------------------
# Freemarker模板配置
# 模板存放路径
spring.freemarker.template-loader-path=classpath:/templates/
# 是否开启模板缓存,默认是开启,开发时请关闭
spring.freemarker.cache=false
# 模板的编码设置,默认UTF-8
spring.freemarker.charset=UTF-8
# 是否检测模板已存在本地
spring.freemarker.check-template-location=true
# 模板的媒体类型设置,默认为text/html
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=true
spring.freemarker.expose-session-attributes=true
spring.freemarker.request-context-attribute=request
# 后缀设置,默认为.ftl
spring.freemarker.suffix=.ftl
┌------------------------------------------------------------┐
注:如需使用freemarker需在pom中添加如下依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
└------------------------------------------------------------┘
#----------------------------------------------------------------------------------------------------------
# Thymeleaf模板配置
# 是否开启模板缓存,默认是开启,开发时请关闭
spring.thymeleaf.cache=true
# 是否检测模板已存在本地
spring.thymeleaf.check-template-location=true
# 模板的媒体类型设置,默认为text/html
spring.thymeleaf.content-type=text/html
# 模板开关
spring.thymeleaf.enabled=true
# 模板的编码设置,默认UTF-8
spring.thymeleaf.encoding=UTF-8
# 排除的视图
spring.thymeleaf.excluded-view-names=
# 模板模式设置,默认为HTML5严格检查;LEGACYHTML5更友好的格式,适用于Vue.js和AngularJs等js库
spring.thymeleaf.mode=HTML5
# 前缀设置,SpringBoot默认模板放置在classpath:/templates/目录下
spring.thymeleaf.prefix=/views/
# 后缀设置,默认为.html
spring.thymeleaf.suffix=.html
┌----------------------------------------------------------------------------------------┐
注:如需使用thymeleaf需在pom中添加如下依赖,且需排除thymelear对springboot的依赖,否则引起包冲突,导致diamond配置不加载
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
注:如模板模式设置为LEGACYHTML5,则需在pom中添加如下依赖
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</dependency>
└----------------------------------------------------------------------------------------┘
#----------------------------------------------------------------------------------------------------------
# 上传文件大小配置
spring.http.multipart.max-file-size=5MB
spring.http.multipart.max-request-size=5MB
server.port=8080
server.display-name=web-dj-mobile
server.context-path=/web-dj-mobile
logging.config=classpath:logback.xml
logging.path=/data/java_log/jetty/dijia/web-dj-mobile/web-dj-mobile.log
logging.level=INFO
ore.starter.class-name=Main
# diamond config
ore.diamond.group=dijia
ore.diamond.dataId=web-dj-mobile
ore.diamond.env=dev
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<property resource="config/application.properties" />
<property name="APP_NAME" value="${server.display-name}" />
<property name="LOG_PATH" value="${logging.path}" />
<property name="LOG_LEVEL" value="${logging.level}" />
<contextName>${APP_NAME}</contextName>
<turboFilter class="org.oreframework.boot.logging.logback.OreBootTurboFilter">
<Marker>oreframework</Marker>
</turboFilter>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [${APP_NAME}] [%thread] %-5level %logger{36} - %msg%n</pattern>
</pattern>
</layout>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- <Encoding> Label Old version of this label can not be used -->
<!-- <Encoding>UTF-8</Encoding> -->
<File>${LOG_PATH}</File>
<!-- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<FileNamePattern>${LOG_PATH}.%d{yyyy-MM-dd}.%i</FileNamePattern>
<MaxHistory>15</MaxHistory>
<maxFileSize>200MB</maxFileSize>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${APP_NAME}] [%thread] %-5level %logger{36} - %msg%n</pattern>
</layout>
<!-- 根据文件大小滚动,不支持 SizeBasedTriggeringPolicy 这种配置-->
<!-- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>200MB</MaxFileSize>
</triggeringPolicy> -->
</appender>
<root level="${LOG_LEVEL}">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
\ No newline at end of file \ No newline at end of file
#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/classes
SERVER_NAME=`sed '/application.name/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
#LOGS_FILE=`sed '/log4j.appender.logToFile.File/!d;s/.*=//' classes/log4j.properties | tr -d '\r'`
LOGS_FILE=`sed '/name="LOG_PATH"/!d;s/.*value="\(.*\)".*/\1/g' classes/logback.xml`
if [ -z "$SERVER_NAME" ]; then
SERVER_NAME=`hostname`
fi
PIDS=`ps --no-heading -C java -f --width 1000 | grep "$CONF_DIR" |awk '{print $2}'`
if [ -z "$PIDS" ]; then
echo "ERROR: The $SERVER_NAME does not started!"
exit 1
fi
LOGS_DIR=""
if [ -n "$LOGS_FILE" ]; then
LOGS_DIR=`dirname $LOGS_FILE`
else
LOGS_DIR=$DEPLOY_DIR/logs
fi
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
DUMP_DIR=$LOGS_DIR/dump
if [ ! -d $DUMP_DIR ]; then
mkdir $DUMP_DIR
fi
DUMP_DATE=`date +%Y%m%d%H%M%S`
DATE_DIR=$DUMP_DIR/$DUMP_DATE
if [ ! -d $DATE_DIR ]; then
mkdir $DATE_DIR
fi
echo -e "Dumping the $SERVER_NAME ...\c"
for PID in $PIDS ; do
jstack $PID > $DATE_DIR/jstack-$PID.dump 2>&1
echo -e ".\c"
jinfo $PID > $DATE_DIR/jinfo-$PID.dump 2>&1
echo -e ".\c"
jstat -gcutil $PID > $DATE_DIR/jstat-gcutil-$PID.dump 2>&1
echo -e ".\c"
jstat -gccapacity $PID > $DATE_DIR/jstat-gccapacity-$PID.dump 2>&1
echo -e ".\c"
jmap $PID > $DATE_DIR/jmap-$PID.dump 2>&1
echo -e ".\c"
jmap -heap $PID > $DATE_DIR/jmap-heap-$PID.dump 2>&1
echo -e ".\c"
jmap -histo $PID > $DATE_DIR/jmap-histo-$PID.dump 2>&1
echo -e ".\c"
if [ -r /usr/sbin/lsof ]; then
/usr/sbin/lsof -p $PID > $DATE_DIR/lsof-$PID.dump
echo -e ".\c"
fi
done
if [ -r /bin/netstat ]; then
/bin/netstat -an > $DATE_DIR/netstat.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/iostat ]; then
/usr/bin/iostat > $DATE_DIR/iostat.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/mpstat ]; then
/usr/bin/mpstat > $DATE_DIR/mpstat.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/vmstat ]; then
/usr/bin/vmstat > $DATE_DIR/vmstat.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/free ]; then
/usr/bin/free -t > $DATE_DIR/free.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/sar ]; then
/usr/bin/sar > $DATE_DIR/sar.dump 2>&1
echo -e ".\c"
fi
if [ -r /usr/bin/uptime ]; then
/usr/bin/uptime > $DATE_DIR/uptime.dump 2>&1
echo -e ".\c"
fi
echo "OK!"
echo "DUMP: $DATE_DIR"
#!/bin/bash
ENV=$1
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
cd `dirname $0`
./stop.sh
./start.sh $ENV
\ No newline at end of file \ No newline at end of file
#!/bin/bash
cd `dirname $0`
if [ "$1" = "start" ]; then
ENV=$2
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
./start.sh $ENV
else
if [ "$1" = "stop" ]; then
./stop.sh
else
if [ "$1" = "debug" ]; then
ENV=$2
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
./start.sh $ENV debug
else
if [ "$1" = "restart" ]; then
ENV=$2
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
./restart.sh $ENV
else
if [ "$1" = "dump" ]; then
./dump.sh
else
echo "ERROR: Please input argument: start or stop or debug or restart or dump"
exit 1
fi
fi
fi
fi
fi
#!/bin/bash
JAVA_HOME="/app/soft/jdk1.8.0_20"
ENV=$1
if [ -z "$ENV" ]; then
echo "ERROR:PLEASE SPEC ENV ARGS,SUCH AS dev,test,beta,release.. "
echo "app exit"
exit 1
fi
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/classes
SERVER_NAME=`sed '/server.display-name/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
SERVER_PORT=`sed '/server.port/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
#LOGS_FILE=`sed '/log4j.appender.logToFile.File/!d;s/.*=//' classes/log4j.properties | tr -d '\r'`
LOGS_FILE=`sed '/logging.path/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
if [ -z "$SERVER_NAME" ]; then
SERVER_NAME=`hostname`
fi
echo "server name is $SERVER_NAME"
echo "server port is $SERVER_PORT"
PIDS=`ps --no-heading -C java -f --width 1000 | grep "$CONF_DIR" |awk '{print $2}'`
if [ -n "$PIDS" ]; then
echo "ERROR: The $SERVER_NAME already started!"
echo "PID: $PIDS"
exit 1
fi
if [ -n "$SERVER_PORT" ]; then
SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l`
if [ $SERVER_PORT_COUNT -gt 0 ]; then
echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
exit 1
fi
fi
LOGS_DIR=""
if [ -n "$LOGS_FILE" ]; then
LOGS_DIR=`dirname $LOGS_FILE`
else
LOGS_DIR=$DEPLOY_DIR/logs
fi
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
STDOUT_FILE=$LOGS_DIR/stdout.log
LIB_DIR=$DEPLOY_DIR/lib
LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"`
JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
JAVA_DEBUG_OPTS=""
if [ "$2" = "debug" ]; then
JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
fi
JAVA_JMX_OPTS=""
if [ "$2" = "jmx" ]; then
JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
fi
JAVA_MEM_OPTS=""
BITS=`file $JAVA_HOME/bin/java | grep 64-bit`
if [ -n "$BITS" ]; then
JAVA_MEM_OPTS=" -server -Xmx1g -Xms1g -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
else
JAVA_MEM_OPTS=" -server -Xms1024m -Xmx1024m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
fi
echo -e "Starting the $SERVER_NAME ...\c"
nohup $JAVA_HOME/bin/java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS org.oreframework.boot.bootstrap.OreBootApplication env=$ENV > $STDOUT_FILE 2>&1 &
COUNT=0
while [ $COUNT -lt 1 ]; do
echo -e ".\c"
sleep 1
if [ -n "$SERVER_PORT" ]; then
COUNT=`netstat -an | grep $SERVER_PORT | wc -l`
else
COUNT=`ps --no-heading -C java -f --width 1000 | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l`
fi
if [ $COUNT -gt 0 ]; then
break
fi
done
echo "OK!"
PIDS=`ps --no-heading -C java -f --width 1000 | grep "$DEPLOY_DIR" | awk '{print $2}'`
echo "PID: $PIDS"
echo "STDOUT: $STDOUT_FILE"
#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/classes
SERVER_NAME=`sed '/application.name/!d;s/.*=//' classes/config/application.properties | tr -d '\r'`
if [ -z "$SERVER_NAME" ]; then
SERVER_NAME=`hostname`
fi
PIDS=`ps --no-heading -C java -f --width 1000 | grep "$CONF_DIR" |awk '{print $2}'`
if [ -z "$PIDS" ]; then
echo "ERROR: The $SERVER_NAME does not started!"
exit 1
fi
#if [ "$1" != "skip" ]; then
#$BIN_DIR/dump.sh
#fi
echo -e "Stopping the $SERVER_NAME ...\c"
for PID in $PIDS ; do
kill $PID > /dev/null 2>&1
done
COUNT=0
while [ $COUNT -lt 1 ]; do
echo -e ".\c"
sleep 1
COUNT=1
for PID in $PIDS ; do
PID_EXIST=`ps --no-heading -p $PID`
if [ -n "$PID_EXIST" ]; then
COUNT=0
break
fi
done
done
echo "OK!"
echo "PID: $PIDS"
No preview for this file type
/* 激活权益 */
* {
padding: 0;
margin: 0;
border: 0;
list-style: none;
}
.m-l-20 {
margin-left: 0.2rem;
}
.equity-wrapper {
background-color: #2C3146;
font-size: 0.16rem;
}
.equity-wrapper .equity-header {
position: relative;
width: 100%;
height: 2.92rem;
background: url(../images/equityInfo/equity-header@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/equity-header@2x.png) 2x, url(../images/equityInfo/equity-header@3x.png) 3x);
background-size: 100%;
}
.equity-wrapper .my-equity {
position: relative;
width: 100%;
height: 2.92rem;
background: url(../images/equityInfo/my-equity@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/my-equity@2x.png) 2x, url(../images/equityInfo/my-equity@3x.png) 3x);
background-size: 100%;
}
.icon-header {
display: inline-block;
width: 0.78rem;
height: 0.73rem;
position: absolute;
top: 1.1rem;
left: 0.36rem;
}
.header-serving {
background: url(../images/equityInfo/serving@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/serving@2x.png) 2x, url(../images/equityInfo/serving@3x.png) 3x);
background-size: 100%;
}
.header-expired {
background: url(../images/equityInfo/expired@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/expired@2x.png) 2x, url(../images/equityInfo/expired@3x.png) 3x);
background-size: 100%;
}
.header-refunded {
background: url(../images/equityInfo/refunded@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/refunded@2x.png) 2x, url(../images/equityInfo/refunded@3x.png) 3x);
background-size: 100%;
}
.header-inactivated {
background: url(../images/equityInfo/inactivated@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/inactivated@2x.png) 2x, url(../images/equityInfo/inactivated@3x.png) 3x);
background-size: 100%;
}
.equity-wrapper .equity-time {
position: absolute;
left: 50%;
bottom: 0.8rem;
transform: translateX(-50%);
font-size: 0.12rem;
color: #3A415D;
}
.equity-wrapper .equity-store {
position: relative;
}
.equity-wrapper .equity-bg {
position: absolute;
top: 0;
width: 100%;
height: 2rem;
background: url(../images/equityInfo/equity-bg@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/equity-bg@2x.png) 2x, url(../images/equityInfo/equity-bg@3x.png) 3x);
background-size: 100%;
/* margin-top: -0.26rem; */
background-position-y: -0.08rem;
}
.equity-wrapper .equity-title {
color: #E4E4E7;
font-size: 0.18rem;
text-align: center;
position: relative;
padding: 0.2rem 0;
}
.equity-wrapper .equity-title::before {
display: inline-block;
content: '';
position: absolute;
top: 50%;
left: 25%;
width: 0.41rem;
height: 0.006rem;
background-image: linear-gradient(to right, rgba(227, 227, 231, 0), rgba(227, 227, 231, 1));
}
.equity-wrapper .equity-title::after {
display: inline-block;
content: '';
position: absolute;
top: 50%;
right: 25%;
width: 0.41rem;
height: 0.006rem;
background-image: linear-gradient(to left, rgba(227, 227, 231, 0), rgba(227, 227, 231, 1));
}
/* 适用门店 */
.equity-wrapper .equity-store .store-info {
display: flex;
align-items: center;
margin: 0 0.2rem;
padding: 0.24rem 0.24rem;
background-color: #222438;
border-radius: 0.08rem;
font-size: 0.12rem;
color: #E4E4E7;
}
.equity-wrapper .equity-store .store-info .store-qrcode {
width: 1rem;
height: 1rem;
box-sizing: border-box;
background-color: #ffffff;
border-radius: 0.08rem;
margin-left: 0.2rem;
padding: 0.06rem;
}
.equity-wrapper .equity-store .store-info .store-qrcode img {
width: 0.88rem;
height: 0.88rem;
}
.equity-wrapper .equity-store .store-info ul li span:last-child {
line-height: 0.18rem;
}
.equity-wrapper .equity-store .store-info ul li {
margin-bottom: 0.06rem;
display: inline-flex;
align-items: flex-start;
width: 100%;
}
.equity-wrapper .equity-store .store-info .store-name {
display: inline-flex;
align-items: center;
font-size: 0.16rem;
color: #F3D4A5;
margin-bottom: 0.1rem;
}
.icon-name {
display: inline-block;
background: url(../images/equityInfo/store@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/store@2x.png) 2x, url(../images/equityInfo/store@3x.png) 3x);
background-size: 100%;
width: 0.158rem;
height: 0.165rem;
margin-right: 0.042rem;
}
.icon-message {
display: inline-block;
background: url(../images/equityInfo/message@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/message@2x.png) 2x, url(../images/equityInfo/message@3x.png) 3x);
background-size: 100%;
width: 0.12rem;
height: 0.125rem;
margin-right: 0.08rem;
}
.icon-phone {
display: inline-block;
background: url(../images/equityInfo/phone@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/phone@2x.png) 2x, url(../images/equityInfo/phone@3x.png) 3x);
background-size: 100%;
width: 0.12rem;
height: 0.125rem;
margin-right: 0.08rem;
}
.icon-address {
display: inline-block;
background: url(../images/equityInfo/address@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/address@2x.png) 2x, url(../images/equityInfo/address@3x.png) 3x);
background-size: 100%;
width: 0.12rem;
height: 0.125rem;
margin-right: 0.08rem;
margin-top: 0.03rem;
}
.store-text {
display: inline-block;
width: 1.08rem;
}
.equity-tip {
width: 2.28rem;
font-size: 0.12rem;
color: #E4E4E7;
text-align: center;
opacity: 0.5;
margin: 0.1rem auto;
}
/* 权益服务 */
.service-icon {
width: 0.74rem;
height: 0.2rem;
position: absolute;
right: 0;
top: 0;
}
.icon-serving {
background: url(../images/equityInfo/mark-serving@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/mark-serving@2x.png) 2x, url(../images/equityInfo/mark-serving@3x.png) 3x);
background-size: 100%;
}
.icon-expired {
background: url(../images/equityInfo/mark-expired@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/mark-expired@2x.png) 2x, url(../images/equityInfo/mark-expired@3x.png) 3x);
background-size: 100%;
}
.icon-refunded {
background: url(../images/equityInfo/mark-refunded@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/mark-refunded@2x.png) 2x, url(../images/equityInfo/mark-refunded@3x.png) 3x);
background-size: 100%;
}
.service-wrapper ul {
margin: 0 0.2rem;
}
.service-wrapper ul li {
position: relative;
font-size: 0.12rem;
color: #28304A;
background-image: linear-gradient(140deg, rgba(250, 235, 206, 0.99) 0%, #EBB76D 100%);
border-radius: 0.08rem;
padding: 0.24rem 0.3rem;
margin-bottom: 0.12rem;
}
.service-wrapper ul li div:first-child {
display: inline-flex;
align-items: center;
margin-bottom: 0.1rem;
font-size: 0.16rem;
}
.service-wrapper ul li div:last-child {
padding-left: 0.2rem;
}
.equity-icon {
display: inline-block;
width: 0.16rem;
height: 0.16rem;
margin-right: 0.04rem;
background-size: 100%;
}
.icon-rescue {
background: url(../images/equityInfo/rescue@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/rescue@2x.png) 2x, url(../images/equityInfo/rescue@3x.png) 3x);
background-size: 100%;
}
.icon-driving {
background: url(../images/equityInfo/driving@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/driving@2x.png) 2x, url(../images/equityInfo/driving@3x.png) 3x);
background-size: 100%;
}
.icon-total-loss {
background: url(../images/equityInfo/total-loss@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/total-loss@2x.png) 2x, url(../images/equityInfo/total-loss@3x.png) 3x);
background-size: 100%;
}
.icon-service {
background: url(../images/equityInfo/service@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/service@2x.png) 2x, url(../images/equityInfo/service@3x.png) 3x);
background-size: 100%;
}
.icon-service-tip {
background: url(../images/equityInfo/service-tip@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/service-tip@2x.png) 2x, url(../images/equityInfo/service-tip@3x.png) 3x);
background-size: 100%;
}
.icon-activity {
background: url(../images/equityInfo/activity-tip@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/equityInfo/activity-tip@2x.png) 2x, url(../images/equityInfo/activity-tip@3x.png) 3x);
background-size: 100%;
}
.equity-btn {
text-align: center;
padding-bottom: 0.5rem;
font-size: 0.2rem;
height: 0.7rem;
}
.equity-wrapper .show {
display: block;
}
.equity-wrapper .hidden {
display: none;
}
.equity-btn button {
display: inline-block;
width: 2.74rem;
height: 0.48rem;
color: #ffffff;
letter-spacing: 2px;
line-height: 0.48rem;
font-size: 0.2rem;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.30);
margin-bottom: 0.12rem;
}
.active-bg button {
background: url(../images/active-bg@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/active-bg@2x.png) 2x, url(../images/active-bg@3x.png) 3x);
background-size: 100%;
}
.inactive-bg button {
background: url(../images/inactive-bg@2x.png) no-repeat;
background-image: -webkit-image-set(url(../images/inactive-bg@2x.png) 2x, url(../images/inactive-bg@3x.png) 3x);
background-size: 100%;
}
.inactivated div {
display: flex;
align-items: center;
justify-content: center;
opacity: 0.5;
font-size: 0.1rem;
color: #E4E4E7;
}
.equity-btn div input {
margin-right: 0.06rem;
}
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
No preview for this file type
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!