Commit 6d231f0e authored by 周健威's avatar 周健威

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

# Conflicts:
#	ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/ImiVo.java
#	ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
parents dcda6ee5 63c74fec
...@@ -86,7 +86,7 @@ public class CommonLogServiceImpl implements CommonLogService { ...@@ -86,7 +86,7 @@ public class CommonLogServiceImpl implements CommonLogService {
} }
@Override @Override
public void run() { public void run() {
mongoTemplate.insert(xxLogEntity, xxLogEntity.getMongoKey()); // mongoTemplate.insert(xxLogEntity, xxLogEntity.getMongoKey());
} }
} }
......
...@@ -74,9 +74,4 @@ public class BaseUserMemberVO implements Serializable { ...@@ -74,9 +74,4 @@ public class BaseUserMemberVO implements Serializable {
@Column(name = "name") @Column(name = "name")
private String name; private String name;
} }
...@@ -51,22 +51,17 @@ public class AppUserManageVo { ...@@ -51,22 +51,17 @@ public class AppUserManageVo {
@Column(name = "source") @Column(name = "source")
private Integer source; private Integer source;
/**
* 邀请人id
*/
@Column(name = "inviter_account")
private String inviterAccount;
/** /**
* 省代码 * 省代码
*/ */
@Column(name = "province_code") @Column(name = "province_code")
private String provinceCode; private Integer provinceCode;
/** /**
* 市代码 * 市代码
*/ */
@Column(name = "city_code") @Column(name = "city_code")
private String cityCode; private Integer cityCode;
/** /**
* 用户性别 * 用户性别
...@@ -108,7 +103,7 @@ public class AppUserManageVo { ...@@ -108,7 +103,7 @@ public class AppUserManageVo {
* 有效期;0代表永久 * 有效期;0代表永久
*/ */
@Column(name = "valid_time") @Column(name = "valid_time")
private Integer validTime; private Long validTime;
/** /**
* 创建时间 * 创建时间
...@@ -160,4 +155,9 @@ public class AppUserManageVo { ...@@ -160,4 +155,9 @@ public class AppUserManageVo {
* 头像 * 头像
*/ */
private String headimgurl; private String headimgurl;
/**
* 邀请人用户名
*/
private String inviter;
} }
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
* @author libin * @author libin
* @version 1.0 * @version 1.0
* @description * @description
* @data 2019/7/15 18:15 * @data 2019/7/15 16:35
*/ */
@Data @Data
public class ImiVo { public class ImiVo {
......
...@@ -4,6 +4,10 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -4,6 +4,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/** /**
* @author libin * @author libin
...@@ -42,14 +46,16 @@ public class SellingWalletVo { ...@@ -42,14 +46,16 @@ public class SellingWalletVo {
@ApiModelProperty(value = "售价") @ApiModelProperty(value = "售价")
private BigDecimal price; private BigDecimal price;
@ApiModelProperty(value = "创建时间", hidden = true ) @ApiModelProperty(value = "创建时间", hidden = true)
private Long crtTime; private Long crtTime;
@ApiModelProperty(value = "更新时间", hidden = true ) @ApiModelProperty(value = "更新时间", hidden = true)
private Long updTime; private Long updTime;
@ApiModelProperty("是否入账:0-未入账;1-已入账")
private Integer waiting; private Integer waiting;
@ApiModelProperty("'类别:0-正;1-负(退款时)")
private Integer status; private Integer status;
/** /**
* 所获佣金 * 所获佣金
......
package com.github.wxiaoqi.security.admin.vo; package com.github.wxiaoqi.security.admin.vo;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author libin * @author libin
......
...@@ -172,10 +172,10 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -172,10 +172,10 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
} }
public Map<Integer, AppUserLogin> findUserIdAndUserLoginMapByMemberIds(List<Integer> memberIds) { public Map<Integer, AppUserLogin> findUserIdAndUserLoginMapByMemberIds(List<Integer> memberIds) {
Map<Integer,AppUserLogin> userIdAndAppUserLoginMap = new HashMap<>(); Map<Integer,AppUserLogin> userIdAndAppUserLoginMap = new HashMap<>();
List<AppUserLogin> appUserLogins = mapper.selectByIdList(memberIds); List<AppUserLogin> appUserLogins = mapper.selectByIdList(memberIds);
if (CollectionUtils.isNotEmpty(appUserLogins)){ if (CollectionUtils.isNotEmpty(appUserLogins)){
userIdAndAppUserLoginMap = appUserLogins.stream().collect(Collectors.toMap(AppUserLogin::getId, Function.identity())); userIdAndAppUserLoginMap = appUserLogins.stream().collect(Collectors.toMap(AppUserLogin::getId, Function.identity()));
} }
return userIdAndAppUserLoginMap; return userIdAndAppUserLoginMap;
} }
......
...@@ -207,7 +207,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb ...@@ -207,7 +207,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
* @param baseUserMemberVO * @param baseUserMemberVO
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void setUserMember(BaseUserMemberVO baseUserMemberVO) throws InvocationTargetException, IllegalAccessException { public void UpdateUserMember(BaseUserMemberVO baseUserMemberVO) throws InvocationTargetException, IllegalAccessException {
Example exa = Example.builder(BaseUserMember.class).where( Example exa = Example.builder(BaseUserMember.class).where(
WeekendSqls.<BaseUserMember>custom() WeekendSqls.<BaseUserMember>custom()
...@@ -219,11 +219,14 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb ...@@ -219,11 +219,14 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
BaseUserMember baseUserMember = new BaseUserMember(); BaseUserMember baseUserMember = new BaseUserMember();
BeanUtilsBean.getInstance().copyProperties(baseUserMember,baseUserMemberVO); BeanUtilsBean.getInstance().copyProperties(baseUserMember,baseUserMemberVO);
if (baseUserMembers==null||baseUserMembers.size()==0) { if (baseUserMembers==null||baseUserMembers.size()==0) {
if (baseUserMemberVO.getMemberLevel()==null||baseUserMember.getValidTime()==null) return;
baseUserMember.setCrtTime(System.currentTimeMillis()); baseUserMember.setCrtTime(System.currentTimeMillis());
baseUserMember.setIsDel(0); baseUserMember.setIsDel(0);
baseUserMember.setPayCount(0); baseUserMember.setPayCount(0);
baseUserMember.setCardLeave(0); baseUserMember.setCardLeave(1);
baseUserMember.setRecentRecharge(System.currentTimeMillis()); baseUserMember.setRecentRecharge(System.currentTimeMillis());
Integer buyCount = baseUserMember.getBuyCount()==null? 0:baseUserMember.getBuyCount();
baseUserMember.setBuyCount(buyCount+1);
insertSelective(baseUserMember); insertSelective(baseUserMember);
return; return;
}else if (baseUserMembers.size()==1){ }else if (baseUserMembers.size()==1){
......
...@@ -15,6 +15,7 @@ import tk.mybatis.mapper.entity.Example; ...@@ -15,6 +15,7 @@ import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -40,6 +41,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { ...@@ -40,6 +41,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
List<MyWalletCath> walletCaths = walletCathPage.getData(); List<MyWalletCath> walletCaths = walletCathPage.getData();
if (CollectionUtils.isEmpty(walletCaths)){ if (CollectionUtils.isEmpty(walletCaths)){
walletCathPageVo.setPageNum(pageNo);
walletCathPageVo.setPageSize(pageSize);
walletCathPageVo.setTotalCount(0);
walletCathPageVo.setTotalPage(0);
walletCathPageVo.setWalletCaths(Collections.EMPTY_LIST);
return walletCathPageVo; return walletCathPageVo;
} }
......
...@@ -33,14 +33,14 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet ...@@ -33,14 +33,14 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId",userId); criteria.andEqualTo("userId",userId);
PageDataVO<WalletDetailPageVo> walletDetailPageVoPageDataVO = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example)); PageDataVO<MyWalletDetail> walletDetailPageVoPageDataVO = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example));
List<WalletDetailPageVo> walletDetails = walletDetailPageVoPageDataVO.getData(); List<MyWalletDetail> walletDetails = walletDetailPageVoPageDataVO.getData();
if (CollectionUtils.isEmpty(walletDetails)){ if (CollectionUtils.isEmpty(walletDetails)){
return walletDetailPageVo; return walletDetailPageVo;
} }
List<WalletDetailPageVo> walletDetailPageVoList = new ArrayList<>(); List<WalletDetailPageVo> walletDetailPageVoList = new ArrayList<>();
WalletDetailPageVo walletDetail; WalletDetailPageVo walletDetail;
for (WalletDetailPageVo walletDetailPage : walletDetails) { for (MyWalletDetail walletDetailPage : walletDetails) {
walletDetail = new WalletDetailPageVo(); walletDetail = new WalletDetailPageVo();
BeanUtils.copyProperties(walletDetailPage,walletDetail); BeanUtils.copyProperties(walletDetailPage,walletDetail);
walletDetailPageVoList.add(walletDetail); walletDetailPageVoList.add(walletDetail);
......
...@@ -9,10 +9,13 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -9,10 +9,13 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.Date; import java.util.Date;
/** /**
...@@ -107,5 +110,12 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{ ...@@ -107,5 +110,12 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
return isToday; return isToday;
} }
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
public int createWalletByUserId(Integer userId){
MyWallet myWallet = new MyWallet();
myWallet.setUserId(userId);
myWallet.setCrtTime(Instant.now().toEpochMilli());
myWallet.setUpdTime(Instant.now().toEpochMilli());
return mapper.insertSelective(myWallet);
}
} }
\ No newline at end of file
...@@ -63,4 +63,5 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -63,4 +63,5 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
} }
} }
...@@ -36,10 +36,10 @@ public class BaseUserMemberController extends BaseController<BaseUserMemberBiz, ...@@ -36,10 +36,10 @@ public class BaseUserMemberController extends BaseController<BaseUserMemberBiz,
* @param baseUserMemberVO * @param baseUserMemberVO
* @return * @return
*/ */
@PostMapping("/setUserMember") @PutMapping("/setUserMember")
public ObjectRestResponse setUserMember(@RequestBody BaseUserMemberVO baseUserMemberVO) public ObjectRestResponse UpdateUserMember(@RequestBody BaseUserMemberVO baseUserMemberVO)
throws InvocationTargetException, IllegalAccessException { throws InvocationTargetException, IllegalAccessException {
baseBiz.setUserMember(baseUserMemberVO); baseBiz.UpdateUserMember(baseUserMemberVO);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
} }
...@@ -75,6 +75,9 @@ public class AppPermissionService { ...@@ -75,6 +75,9 @@ public class AppPermissionService {
@Resource @Resource
private RegionFeign regionFeign; private RegionFeign regionFeign;
@Autowired
private MyWaterBiz walletBiz;
private BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12); private BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12);
@Autowired @Autowired
private RedisTemplate userRedisTemplate; private RedisTemplate userRedisTemplate;
...@@ -261,8 +264,10 @@ public class AppPermissionService { ...@@ -261,8 +264,10 @@ public class AppPermissionService {
log.error("注册:新增用户详情: " + userid); log.error("注册:新增用户详情: " + userid);
//临时会员绑定 //临时会员绑定
insertUserMemberByUserIdAndPhone(userid, username); insertUserMemberByUserIdAndPhone(userid, username);
//自动登录获取优惠卷 //参加新人活动
authCoupn(userid); jionActivity(userid);
//创建钱包
walletBiz.createWalletByUserId(appUserLogin.getId());
// 登录结果要做做统一处理 // 登录结果要做做统一处理
JSONObject data = autoLogin(userid, username, headimgurl, nickname); JSONObject data = autoLogin(userid, username, headimgurl, nickname);
// 到im注册,获取返回结果 // 到im注册,获取返回结果
...@@ -723,6 +728,16 @@ public class AppPermissionService { ...@@ -723,6 +728,16 @@ public class AppPermissionService {
} }
} }
//注册参与活动
public void jionActivity(Integer userId) {
try {
activityFeign.join(userId);
} catch (Exception e) {
e.printStackTrace();
return;
}
}
/** /**
* 通过用户id登录*** Unbelievable! ! ! * 通过用户id登录*** Unbelievable! ! !
...@@ -787,12 +802,16 @@ public class AppPermissionService { ...@@ -787,12 +802,16 @@ public class AppPermissionService {
setCreateIPInfo(rsUserDetail); setCreateIPInfo(rsUserDetail);
appUserDetailBiz.insertSelective(rsUserDetail); appUserDetailBiz.insertSelective(rsUserDetail);
log.error("注册:新增用户详情: " + userid); log.error("注册:新增用户详情: " + userid);
//创建钱包
walletBiz.createWalletByUserId(appUserLogin.getId());
//临时会员绑定 //临时会员绑定
insertUserMemberByUserIdAndPhone(userid, username); insertUserMemberByUserIdAndPhone(userid, username);
//上线绑定 //上线绑定
relationBiz.bindByUserId(userid, small_id); relationBiz.bindByUserId(userid, small_id);
//发送短信通知用户 //发送短信通知用户
thirdFeign.sendCode(username, password, SystemConfig.TEMPLATECODE); thirdFeign.sendCode(username, password, SystemConfig.TEMPLATECODE);
//参加新人活动
jionActivity(userid);
// 登录结果要做做统一处理 // 登录结果要做做统一处理
JSONObject data = autoLogin(userid, username, headimgurl, nickname); JSONObject data = autoLogin(userid, username, headimgurl, nickname);
// 到im注册,获取返回结果 // 到im注册,获取返回结果
...@@ -839,7 +858,8 @@ public class AppPermissionService { ...@@ -839,7 +858,8 @@ public class AppPermissionService {
AppUserLogin user = appUserLoginBiz.checkeUserLogin(username); AppUserLogin user = appUserLoginBiz.checkeUserLogin(username);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
if (null == user) { if (null == user) {
String password = "12345678"; //随机生成密码
String password = UUIDUtils.genCodes(8);
data = applyRegister(username, password, headimgurl, nickname, small_id); data = applyRegister(username, password, headimgurl, nickname, small_id);
} else { } else {
Integer userid = user.getId(); Integer userid = user.getId();
...@@ -929,7 +949,6 @@ public class AppPermissionService { ...@@ -929,7 +949,6 @@ public class AppPermissionService {
} }
} }
/** /**
* @author libin * @author libin
* @version 1.0.0 * @version 1.0.0
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
d.isdel, d.isdel,
d.nickname, d.nickname,
d.source, d.source,
d.Inviter_account as inviterAccount,
d.province_code as provinceCode, d.province_code as provinceCode,
d.city_code as cityCode, d.city_code as cityCode,
d.sex, d.sex,
...@@ -69,12 +68,18 @@ ...@@ -69,12 +68,18 @@
m.rent_free_days as rentFreeDays, m.rent_free_days as rentFreeDays,
m.crt_time as timeOfMembership, m.crt_time as timeOfMembership,
m.recent_recharge as recentRecharge, m.recent_recharge as recentRecharge,
m.name as memberName m.name as memberName,
ul.username as inviter
from from
app_user_login l app_user_login l
left join left join
app_user_detail d app_user_detail d
on d.userid = l.id on
d.userid = l.id
left join
app_user_login ul
on
ul.id=d.inviter_account
left join left join
( (
select select
...@@ -89,10 +94,13 @@ ...@@ -89,10 +94,13 @@
) m ) m
on on
l.id = m.user_id l.id = m.user_id
where 1=1 where 1=1
<if test="mobile !=null"> <if test="mobile !=null">
and l.username=#{mobile} and l.username like CONCAT('%',#{mobile},'%')
</if> </if>
<if test="channel !=null"> <if test="channel !=null">
and d.channel=#{channel} and d.channel=#{channel}
...@@ -107,7 +115,7 @@ ...@@ -107,7 +115,7 @@
and l.createtime &lt;= #{registrationTimeEnd} and l.createtime &lt;= #{registrationTimeEnd}
</if> </if>
<if test="source !=null"> <if test="source !=null">
and d.source &lt;= #{source} and d.source = #{source}
</if> </if>
order by l.id ASC order by l.id ASC
......
package com.xxfc.platform.activity.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 通用活动规则表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Data
@Table(name = "activity_rule")
public class ActivityRule implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Integer id;
/**
* 活动名称
*/
@Column(name = "name")
@ApiModelProperty(value = "活动名称")
private String name;
/**
* 活动描述
*/
@Column(name = "descr")
@ApiModelProperty(value = "活动描述")
private String descr;
/**
* 活动人数限制
*/
@Column(name = "number")
@ApiModelProperty(value = "活动人数限制")
private Integer number;
/**
* 参加活动人数
*/
@Column(name = "join_number")
@ApiModelProperty(value = "参加活动人数")
private Integer joinNumber;
/**
* 活动是否开启:0-未开启;1-已开启;2-已关闭
*/
@Column(name = "status")
@ApiModelProperty(value = "活动是否开启:0-未开启;1-已开启;2-已关闭")
private Integer status;
/**
* 活动奖励规则,json数组格式 [{"type":1, "detail":{...}},...] //// type分类 1--现金;
*/
@Column(name = "value")
@ApiModelProperty(value = "活动奖励规则,json数组格式 [{type:1, detail:{...}},...] //// type分类 1--现金;")
private String value;
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
/**
* 是否删除:0-正常;1-删除
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除:0-正常;1-删除")
private Integer isDel;
}
package com.xxfc.platform.activity.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 用户活动参与表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Data
@Table(name = "activity_user_join")
public class ActivityUserJoin implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Integer id;
/**
* 用户id
*/
@Column(name = "user_id")
@ApiModelProperty(value = "用户id")
private Integer userId;
/**
* 活动规则id
*/
@Column(name = "activity_id")
@ApiModelProperty(value = "活动规则id")
private Integer activityId;
/**
* 状态:0-已参与;1-已领取
*/
@Column(name = "status")
@ApiModelProperty(value = "状态:0-已参与;1-已领取")
private Integer status;
/**
* 参与时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "参与时间", hidden = true )
private Long crtTime;
/**
* 领取时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "领取时间", hidden = true )
private Long updTime;
}
...@@ -36,4 +36,8 @@ public interface ActivityFeign { ...@@ -36,4 +36,8 @@ public interface ActivityFeign {
@RequestMapping(value = "/user/cancelUse", method = RequestMethod.POST) @RequestMapping(value = "/user/cancelUse", method = RequestMethod.POST)
public ObjectRestResponse cancelUse(@RequestParam(value = "TickerNo",defaultValue ="" ) String TickerNo); public ObjectRestResponse cancelUse(@RequestParam(value = "TickerNo",defaultValue ="" ) String TickerNo);
@ApiOperation("新人有礼参加活动")
@RequestMapping(value = "/user", method = RequestMethod.POST)
public ObjectRestResponse join(@RequestParam(value = "userId",defaultValue ="0" ) Integer userId);
} }
package com.xxfc.platform.activity.biz;
import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.entity.ActivityRule;
import com.xxfc.platform.activity.mapper.ActivityRuleMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/**
* 通用活动规则表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Service
public class ActivityRuleBiz extends BaseBiz<ActivityRuleMapper,ActivityRule> {
//获取最新的生效的活动
public ActivityRule getActity(){
Example example=new Example(ActivityRule.class);
example.createCriteria().andEqualTo("status",1).andEqualTo("isDel",0);
example.orderBy("id desc");
List<ActivityRule> list=mapper.selectByExample(example);
if(list.size()>0){
return list.get(0);
}
return null;
}
}
\ No newline at end of file
package com.xxfc.platform.activity.biz;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xxfc.platform.activity.entity.ActivityRule;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.entity.ActivityUserJoin;
import com.xxfc.platform.activity.mapper.ActivityUserJoinMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
/**
* 用户活动参与表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Service
@Slf4j
public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,ActivityUserJoin> {
@Autowired
ActivityRuleBiz ruleBiz;
@Autowired
UserCouponBiz userCouponBiz;
//注册参与活动
public void joinActivity(Integer userId){
ActivityRule rule=ruleBiz.getActity();
if(rule==null){
log.error("----没有开启的活动----");
return;
}
Integer joinNumber=rule.getJoinNumber()==null?0:rule.getJoinNumber();
Integer number=rule.getNumber()==null?0:rule.getNumber();
if(joinNumber>=number){
log.error("----活动已超过参与人数----number==="+number);
return;
}
Integer activityId=rule.getId();
ActivityUserJoin userJoin=new ActivityUserJoin();
userJoin.setActivityId(activityId);
userJoin.setUserId(userId);
Long num=selectCount(userJoin);
if(num!=null||num>0){
log.error("----用户已经参与活动----userId===="+userId);
return;
}
insertSelective(userJoin);
}
//领取优惠卷
public void receiveCoupn(Integer userId) {
ActivityRule rule = ruleBiz.getActity();
if (rule == null) {
log.error("----没有开启的活动----");
return;
}
Integer activityId = rule.getId();
ActivityUserJoin userJoin = new ActivityUserJoin();
userJoin.setActivityId(activityId);
userJoin.setUserId(userId);
Long num = selectCount(userJoin);
if (num == null || num == 0) {
log.error("----用户没有此参与活动----userId====" + userId);
return;
}
String value=rule.getValue();
JSONObject json=JSONObject.parseObject(value);
if(json!=null){
Integer type=json.getInteger("type");
if(type==1){
JSONArray array=json.getJSONArray("value");
if(array.size()>0){
for(int i=0;i<array.size();i++){
Integer id=array.getJSONObject(i).getInteger("id");
userCouponBiz.userLedCoupon(userId,id);
}
}
}
}
}
}
\ No newline at end of file
...@@ -48,14 +48,33 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -48,14 +48,33 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return null; return null;
} }
Integer couponId=coupon.getId(); Integer couponId=coupon.getId();
Example example=new Example(UserCoupon.class); boolean falg=checkUserLed(userId,couponId);
example.createCriteria().andEqualTo("userId",userId).andEqualTo("couponId",couponId); if(falg){
List<UserCoupon> list=selectByExample(example);
if(list.size()>0){
log.error(userId+"----已领优惠卷"); log.error(userId+"----已领优惠卷");
return null; return null;
} }
return led(coupon,userId);
}
//用户领劵
public String userLedCoupon(Integer userId,Integer couponId){
Coupon coupon=couponBiz.selectById(couponId);
if (coupon==null||coupon.getIsDel()!=0||coupon.getStatus()!=1){
log.error(userId+"----无可领取优惠卷");
return null;
}
boolean falg=checkUserLed(userId,couponId);
if(falg){
log.error(userId+"----已领优惠卷");
return null;
}
return led(coupon,userId);
}
//领取动作
public String led( Coupon coupon,Integer userId ){
int type=coupon.getValidType(); int type=coupon.getValidType();
Integer couponId=coupon.getId();
Long expireTime=System.currentTimeMillis(); Long expireTime=System.currentTimeMillis();
Long startTime=0L; Long startTime=0L;
if(type==1){ if(type==1){
...@@ -74,7 +93,18 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -74,7 +93,18 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
userCoupon.setExpireTime(expireTime); userCoupon.setExpireTime(expireTime);
insertSelective(userCoupon); insertSelective(userCoupon);
return ticker_no; return ticker_no;
}
//检查用户是否领卷
public boolean checkUserLed(Integer userId,Integer id){
Example example=new Example(UserCoupon.class);
example.createCriteria().andEqualTo("userId",userId).andEqualTo("couponId",id);
List<UserCoupon> list=selectByExample(example);
if(list.size()>0){
log.error(userId+"----已领优惠卷");
return true;
}
return false;
} }
//获取我的优惠卷 //获取我的优惠卷
......
package com.xxfc.platform.activity.mapper;
import com.xxfc.platform.activity.entity.ActivityRule;
import tk.mybatis.mapper.common.Mapper;
/**
* 通用活动规则表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
public interface ActivityRuleMapper extends Mapper<ActivityRule> {
}
package com.xxfc.platform.activity.mapper;
import com.xxfc.platform.activity.entity.ActivityUserJoin;
import tk.mybatis.mapper.common.Mapper;
/**
* 用户活动参与表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
public interface ActivityUserJoinMapper extends Mapper<ActivityUserJoin> {
}
package com.xxfc.platform.activity.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.activity.biz.ActivityUserJoinBiz;
import com.xxfc.platform.activity.entity.ActivityUserJoin;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("join")
public class ActivityUserJoinController extends BaseController<ActivityUserJoinBiz,ActivityUserJoin> {
@ApiOperation("新人有礼参加活动")
@RequestMapping(value = "/user", method = RequestMethod.POST)
public ObjectRestResponse join(
@RequestParam(value = "userId",defaultValue ="0" ) Integer userId){
baseBiz.joinActivity(userId);
return ObjectRestResponse.succ();
}
}
\ No newline at end of file
...@@ -10,4 +10,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -10,4 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("coupon") @RequestMapping("coupon")
public class CouponController extends BaseController<CouponBiz, Coupon> { public class CouponController extends BaseController<CouponBiz, Coupon> {
} }
\ No newline at end of file
...@@ -3,9 +3,11 @@ package com.xxfc.platform.activity.rest; ...@@ -3,9 +3,11 @@ package com.xxfc.platform.activity.rest;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.biz.ActivityUserJoinBiz;
import com.xxfc.platform.activity.biz.UserCouponBiz; import com.xxfc.platform.activity.biz.UserCouponBiz;
import com.xxfc.platform.activity.vo.UserCouponVo; import com.xxfc.platform.activity.vo.UserCouponVo;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@RestController @RestController
...@@ -13,6 +15,10 @@ import org.springframework.web.bind.annotation.*; ...@@ -13,6 +15,10 @@ import org.springframework.web.bind.annotation.*;
public class UserCouponController extends ActivityBaseController<UserCouponBiz> { public class UserCouponController extends ActivityBaseController<UserCouponBiz> {
@Autowired
ActivityUserJoinBiz joinBiz;
@ApiOperation("用户自动领取新人卷") @ApiOperation("用户自动领取新人卷")
@RequestMapping(value = "/auth/led", method = RequestMethod.POST) @RequestMapping(value = "/auth/led", method = RequestMethod.POST)
public String led(@RequestParam(value = "userId",defaultValue = "0") Integer userId) { public String led(@RequestParam(value = "userId",defaultValue = "0") Integer userId) {
...@@ -56,6 +62,18 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -56,6 +62,18 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@ApiOperation("领取优惠卷")
@RequestMapping(value = "/coupon/led", method = RequestMethod.POST)
public ObjectRestResponse led() {
AppUserDTO userInfo = getUserInfo();
Integer userId = userInfo.getId();
if (userId == null) {
return ObjectRestResponse.createDefaultFail();
}
joinBiz.receiveCoupn(userId);
return ObjectRestResponse.succ();
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.activity.mapper.ActivityRuleMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.activity.entity.ActivityRule" id="activityRuleMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="descr" column="descr"/>
<result property="number" column="number"/>
<result property="joinNumber" column="join_number"/>
<result property="status" column="status"/>
<result property="value" column="value"/>
<result property="crtTime" column="crt_time"/>
<result property="updTime" column="upd_time"/>
<result property="isDel" column="is_del"/>
</resultMap>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.activity.mapper.ActivityUserJoinMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.activity.entity.ActivityUserJoin" id="activityUserJoinMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="activityId" column="activity_id"/>
<result property="status" column="status"/>
<result property="crtTime" column="crt_time"/>
<result property="updTime" column="upd_time"/>
</resultMap>
</mapper>
\ No newline at end of file
...@@ -294,4 +294,11 @@ public class OrderRentVehicleDetail implements Serializable { ...@@ -294,4 +294,11 @@ public class OrderRentVehicleDetail implements Serializable {
@ApiModelProperty(value = "是否购买免赔") @ApiModelProperty(value = "是否购买免赔")
private Integer damageSafe; private Integer damageSafe;
/**
* 是否处理违章 0--未处理;1--已处理
*/
@ApiModelProperty(value = "是否购买免赔")
@Column(name = "handel_violation")
private Integer handelViolation;
} }
package com.xxfc.platform.order.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
@Data
public class OrderViolation {
@Id
@GeneratedValue(generator ="JDBC")
private Integer id;
/**
* 违章总金额
*/
@Column(name="price")
private Double price;
/**
* 租车订单id
*/
@Column(name = "detail_id")
private Integer detailId;
/**
* 违章截图
*/
@Column(name = "picture")
private String picture;
/**
* 创建人id
*/
@Column(name = "crt_user_id")
private Integer crtUserId;
/**
* 创建人姓名
*/
@Column(name = "crt_name")
private String crtName;
/**
* 创建人host
*/
@Column(name = "crt_host")
private String crtHost;
/**
* 创建时间
*/
@JsonFormat(pattern="yyyy-MM-dd:HH:mm:ss",timezone="GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd:HH:mm:ss")
@Column(name = "crt_time")
private Date crtTime;
/**
* 修改时间
*/
@JsonFormat(pattern="yyyy-MM-dd:HH:mm:ss",timezone="GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd:HH:mm:ss")
@Column(name = "upd_time")
private Date updTime;
/**
* 修改人id
*/
@Column(name = "upd_user_id")
private Integer updUserId;
/**
* 修改人姓名
*/
@Column(name = "upd_name")
private String updName;
/**
* 修改人host
*/
@Column(name = "upd_host")
private String updHost;
/**
* 是否已删除:0-否,1-是
*/
@Column(name="is_del")
private Integer isDel;
}
...@@ -12,6 +12,9 @@ public class QueryOrderDTO extends PageParam { ...@@ -12,6 +12,9 @@ public class QueryOrderDTO extends PageParam {
@ApiModelProperty(hidden = false) @ApiModelProperty(hidden = false)
private Integer crtUser; private Integer crtUser;
@ApiModelProperty(hidden = false)
private Integer userId;
@ApiModelProperty(hidden = false) @ApiModelProperty(hidden = false)
private Integer crtCompanyId; private Integer crtCompanyId;
......
...@@ -16,6 +16,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany; ...@@ -16,6 +16,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.List; import java.util.List;
/** /**
...@@ -49,6 +50,13 @@ public class OrderTourVerificationBiz{ ...@@ -49,6 +50,13 @@ public class OrderTourVerificationBiz{
return PageDataVO.pageInfo(page,limit,()->verificationMapper.pageByParm(verificationId)); return PageDataVO.pageInfo(page,limit,()->verificationMapper.pageByParm(verificationId));
} }
/**
*
* @param no 订单号
* @param list 分公司列表
* @param userDTO
* @return
*/
//核销 //核销
public ObjectRestResponse VerificationByOrder(String no, List<BranchCompany> list, UserDTO userDTO){ public ObjectRestResponse VerificationByOrder(String no, List<BranchCompany> list, UserDTO userDTO){
BaseOrder baseOrder=new BaseOrder(); BaseOrder baseOrder=new BaseOrder();
...@@ -79,6 +87,17 @@ public class OrderTourVerificationBiz{ ...@@ -79,6 +87,17 @@ public class OrderTourVerificationBiz{
} }
} }
} }
// 出发时间 是否已经发车
Long departureTime = tourFeign.selectDepartureTimeByStartCompanyIdAndRouteId(tourDetail.getStartCompanyId(),tourDetail.getGoodId());
if (Instant.now().toEpochMilli()<departureTime){
return ObjectRestResponse.createFailedResultWithObj(400,"还未到发车时间",0);
}
Integer departureStatus = tourFeign.selectDepartureStatusByVerificationId(verificationId);
if (departureStatus==1){
return ObjectRestResponse.createFailedResultWithObj(400,"已经发车",1);
}
baseOrder=new BaseOrder(); baseOrder=new BaseOrder();
baseOrder.setId(orderId); baseOrder.setId(orderId);
baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode()); baseOrder.setStatus(OrderStatusEnum.ORDER_FINISH.getCode());
......
package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.entity.OrderViolation;
import com.xxfc.platform.order.mapper.OrderRentVehicleDetailMapper;
import com.xxfc.platform.order.mapper.OrderViolationMapper;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**订单违章记录biz
* @author Administrator
*/
@Service
@Slf4j
public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolation> {
@Autowired
private OrderRentVehicleDetailMapper detailMapper;
@Value("order.violation.upload")
private String ovUpload;
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
@Autowired
private RedisTemplate redisTemplate;
/**
* 保存违章记录
* @param orderViolation
*/
@Transactional(rollbackFor = Exception.class)
public void insertOrderViolation(OrderViolation orderViolation) {
OrderRentVehicleDetail orderRentVehicleDetail = new OrderRentVehicleDetail();
orderRentVehicleDetail.setId(orderViolation.getDetailId());
orderRentVehicleDetail.setHandelViolation(0);
mapper.insertSelective(orderViolation);
detailMapper.updateByPrimaryKeySelective(orderRentVehicleDetail);
}
/**
* 修改违章记录
* @param orderViolation
*/
@Transactional(rollbackFor = Exception.class)
public void updateOrderViolation(OrderViolation orderViolation) {
OrderRentVehicleDetail orderRentVehicleDetail = detailMapper.selectByPrimaryKey(orderViolation.getDetailId());
if (orderRentVehicleDetail.getHandelViolation()==0) {
mapper.updateByPrimaryKeySelective(orderViolation);
}else {
throw new BaseException("The violation has been dealt with and cannot be modified");
}
}
public ObjectRestResponse uploadViolation(MultipartFile file) throws IOException {
DateTime now = DateTime.now();
String dirPathToday = File.separator + now.toString(DEFAULT_DATE_TIME_FORMATTER);
String redisNoKey = RedisKey.UPLOAD_FILE_NO_PREFIX + now.toString(DEFAULT_DATE_TIME_FORMATTER);
Long no = redisTemplate.opsForValue().increment(redisNoKey);
if(no.equals(1L)){
redisTemplate.expire(redisNoKey,1, TimeUnit.DAYS);
}
String fileName = file.getOriginalFilename();
String realFileRelPath = dirPathToday + File.separator+no+fileName.substring(fileName.lastIndexOf("."));
String filePath = ovUpload + realFileRelPath;
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return ObjectRestResponse.succ(filePath);
}
/**
* 下载行驶证图片
* @param realFileRelPath
* @return
* @throws Exception
*/
public ResponseEntity<byte[]> downloadViolation(String realFileRelPath) throws Exception{
String filePath = ovUpload + realFileRelPath;
File file = new File(filePath);//新建一个文件
HttpHeaders headers = new HttpHeaders();//http头信息
String downloadFileName = new String(file.getName());//设置编码
headers.setContentDispositionFormData("attachment", downloadFileName);
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
}
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderViolation;
import tk.mybatis.mapper.common.Mapper;
public interface OrderViolationMapper extends Mapper<OrderViolation> {
}
...@@ -186,6 +186,7 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -186,6 +186,7 @@ public class BaseOrderController extends CommonBaseController implements UserRes
if(startResponse.getData() != null) { if(startResponse.getData() != null) {
orderPageVO.setStartCompanyName(startResponse.getData().getName()); orderPageVO.setStartCompanyName(startResponse.getData().getName());
} }
ObjectRestResponse<CompanyDetail> restResponse = vehicleFeign.getCompanyDetail(orderPageVO.getOrderRentVehicleDetail().getEndCompanyId()); ObjectRestResponse<CompanyDetail> restResponse = vehicleFeign.getCompanyDetail(orderPageVO.getOrderRentVehicleDetail().getEndCompanyId());
if(restResponse.getData() != null) { if(restResponse.getData() != null) {
orderPageVO.setEndCompanyName(restResponse.getData().getName()); orderPageVO.setEndCompanyName(restResponse.getData().getName());
......
...@@ -79,11 +79,4 @@ public class OrderTourVerificationController extends CommonBaseController { ...@@ -79,11 +79,4 @@ public class OrderTourVerificationController extends CommonBaseController {
public ObjectRestResponse list(@RequestBody TourGoodOrderFindVo tourGoodOrderFindVo) { public ObjectRestResponse list(@RequestBody TourGoodOrderFindVo tourGoodOrderFindVo) {
return verificationBiz.getVerifications(tourGoodOrderFindVo); return verificationBiz.getVerifications(tourGoodOrderFindVo);
} }
} }
\ No newline at end of file
package com.xxfc.platform.order.rest;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.biz.OrderViolationBiz;
import com.xxfc.platform.order.entity.OrderViolation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
* 订单违章表
*
* @author Administrator
*/
@RestController
@RequestMapping("orderViolation")
public class OrderViolationController extends BaseController<OrderViolationBiz, OrderViolation> {
@Autowired
private UserFeign userFeign;
private Long MAX_DRIVING_LICENSE_SIZE = 1024 * 1024 * 50L;
private final String FILE_TYPE="JPG";
/**
* 获取操作用户信息
*/
private UserDTO getUserDTO() {
ObjectRestResponse<UserDTO> orrUserDTO = userFeign.userinfoByToken(request.getHeader("Authorization"));
if (orrUserDTO == null || orrUserDTO.getData() == null || orrUserDTO.getData().getId() == null) {
throw new BaseException("This user does not exist");
}
UserDTO userDTOD = orrUserDTO.getData();
return userDTOD;
}
/**
* 保存违章记录
*
* @param orderViolation
* @param request
* @return
*/
@PostMapping("/saveOrderViolation")
public ObjectRestResponse saveOrderViolation(@RequestBody OrderViolation orderViolation, HttpServletRequest request) {
UserDTO userDTOD = getUserDTO();
orderViolation.setCrtHost(request.getRemoteHost());
orderViolation.setCrtName(userDTOD.getName());
orderViolation.setCrtUserId(userDTOD.getId());
orderViolation.setCrtTime(new Date());
getBaseBiz().insertOrderViolation(orderViolation);
return ObjectRestResponse.succ();
}
/**
* 通过订单id查询违章记录
*
* @param detailId
* @return
*/
@GetMapping("/getOne/{detailId}")
public ObjectRestResponse<OrderViolation> getOne(@PathVariable Integer detailId) {
Example exa = Example.builder(OrderViolation.class)
.where(WeekendSqls.<OrderViolation>custom().andEqualTo(OrderViolation::getDetailId, detailId)
.andEqualTo(OrderViolation::getIsDel, 0)).build();
List<OrderViolation> orderViolations = getBaseBiz().selectByExample(exa);
if (orderViolations.size() > 1) {
throw new BaseException("The database has multiple records");
}
OrderViolation orderViolation= new OrderViolation();
orderViolation=(orderViolations.size()==0)? null:orderViolations.get(0);
return ObjectRestResponse.succ(orderViolation);
}
/**
* 保存修改违章记录
*
* @param orderViolation
* @param request
* @return
*/
@PutMapping("/updateOrderViolation")
public ObjectRestResponse updateOrderViolation(@RequestBody OrderViolation orderViolation, HttpServletRequest request) {
UserDTO userDTOD = getUserDTO();
orderViolation.setUpdHost(request.getRemoteHost());
orderViolation.setUpdName(userDTOD.getName());
orderViolation.setUpdUserId(userDTOD.getId());
orderViolation.setUpdTime(new Date());
getBaseBiz().updateOrderViolation(orderViolation);
return ObjectRestResponse.succ();
}
@PostMapping(value = "/upload/violation")
public ObjectRestResponse uploadViolation(@RequestParam("file") MultipartFile file)
throws Exception {
Assert.notNull(file);
//文件类型
String contentType = file.getContentType();
if (!FILE_TYPE.equalsIgnoreCase(contentType)||"png".equalsIgnoreCase(contentType)) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"Picture format error");
}
if (file.getSize() > MAX_DRIVING_LICENSE_SIZE) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"Picture is too large");
}
return baseBiz.uploadViolation(file);
}
@GetMapping(value = "/download/Violation/{realFileRelPath}") //匹配的是href中的download请求
public ResponseEntity<byte[]> downloadViolation(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception {
return baseBiz.downloadViolation(realFileRelPath);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xxfc.platform.order.mapper.OrderViolationMapper" >
</mapper>
\ No newline at end of file
...@@ -94,4 +94,10 @@ public interface TourFeign { ...@@ -94,4 +94,10 @@ public interface TourFeign {
//获取商品信息 //获取商品信息
@RequestMapping(value = "/good/app/unauth/one", method = RequestMethod.GET) @RequestMapping(value = "/good/app/unauth/one", method = RequestMethod.GET)
public TourGood one(@RequestParam(value = "goodId",defaultValue = "0") Integer goodId); public TourGood one(@RequestParam(value = "goodId",defaultValue = "0") Integer goodId);
@GetMapping("/tourGoodSite/departure_time")
Long selectDepartureTimeByStartCompanyIdAndRouteId(@RequestParam(value = "companyId") Integer companyId, @RequestParam(value = "goodId") Integer routeId);
@GetMapping("/tourGood/verfication/departure_status")
Integer selectDepartureStatusByVerificationId(@RequestParam(value = "verificationId") Integer verificationId);
} }
...@@ -21,4 +21,12 @@ public class TourGoodSiteBiz extends BaseBiz<TourGoodSiteMapper,TourGoodSite> { ...@@ -21,4 +21,12 @@ public class TourGoodSiteBiz extends BaseBiz<TourGoodSiteMapper,TourGoodSite> {
//删除站点 //删除站点
public void delGoodSite(Integer goodId, List<Integer> ids){ mapper.delSite(goodId,ids);} public void delGoodSite(Integer goodId, List<Integer> ids){ mapper.delSite(goodId,ids);}
public Long selectDepartureTimeByStartCompanyIdAndRouteId(Integer companyId, Integer routeId) {
TourGoodSite tourGoodSite = new TourGoodSite();
tourGoodSite.setCompanyId(companyId);
tourGoodSite.setGoodId(routeId);
TourGoodSite site = mapper.selectOne(tourGoodSite);
return site.getDepartTime();
}
} }
\ No newline at end of file
...@@ -9,9 +9,7 @@ import com.xxfc.platform.tour.entity.TourGoodVerification; ...@@ -9,9 +9,7 @@ import com.xxfc.platform.tour.entity.TourGoodVerification;
import com.xxfc.platform.tour.mapper.TourGoodVerificationMapper; import com.xxfc.platform.tour.mapper.TourGoodVerificationMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalTime;
import java.util.*; import java.util.*;
/** /**
...@@ -85,4 +83,11 @@ public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper, ...@@ -85,4 +83,11 @@ public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper,
return mapper.updateTourGoodPerNumbs(verficationId,properties,number); return mapper.updateTourGoodPerNumbs(verficationId,properties,number);
} }
public Integer selectDepartureStatusByVerificationId(Integer verificationId) {
TourGoodVerification tourGoodVerification = new TourGoodVerification();
tourGoodVerification.setId(verificationId);
TourGoodVerification verfication = mapper.selectByPrimaryKey(tourGoodVerification);
return verfication.getStatus();
}
} }
\ No newline at end of file
...@@ -3,11 +3,19 @@ package com.xxfc.platform.tour.rest; ...@@ -3,11 +3,19 @@ package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourGoodSiteBiz; import com.xxfc.platform.tour.biz.TourGoodSiteBiz;
import com.xxfc.platform.tour.entity.TourGoodSite; import com.xxfc.platform.tour.entity.TourGoodSite;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("tourGoodSite") @RequestMapping("tourGoodSite")
public class TourGoodSiteController extends BaseController<TourGoodSiteBiz,TourGoodSite> { public class TourGoodSiteController extends BaseController<TourGoodSiteBiz,TourGoodSite> {
@GetMapping("/departure_time")
public Long selectDepartureTimeByStartCompanyIdAndRouteId(@RequestParam(value = "companyId") Integer companyId,
@RequestParam(value = "goodId") Integer routeId){
return baseBiz.selectDepartureTimeByStartCompanyIdAndRouteId(companyId,routeId);
}
} }
\ No newline at end of file
...@@ -62,4 +62,9 @@ public class TourGoodVerificationController extends BaseController<TourGoodVerif ...@@ -62,4 +62,9 @@ public class TourGoodVerificationController extends BaseController<TourGoodVerif
} }
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
@GetMapping("/departure_status")
public Integer selectDepartureStatusByVerificationId(@RequestParam(value = "verificationId") Integer verificationId){
return baseBiz.selectDepartureStatusByVerificationId(verificationId);
}
} }
\ No newline at end of file
...@@ -76,4 +76,12 @@ public interface VehicleFeign { ...@@ -76,4 +76,12 @@ public interface VehicleFeign {
*/ */
@GetMapping(value = "/vehicleModel/goodList") @GetMapping(value = "/vehicleModel/goodList")
List<GoodDataVO> goodList(@RequestParam(value = "page") Integer page, @RequestParam("limit") Integer limit); List<GoodDataVO> goodList(@RequestParam(value = "page") Integer page, @RequestParam("limit") Integer limit);
/**
* 根据一个id获取城市
* @param id
* @return
*/
@GetMapping("/sysRegion/getSysRegionById/{id}")
RestResponse getSysRegionById(@PathVariable Integer id);
} }
...@@ -75,4 +75,23 @@ public class SysRegionController extends BaseController<SysRegionBiz> { ...@@ -75,4 +75,23 @@ public class SysRegionController extends BaseController<SysRegionBiz> {
} }
/**
* 根据一个id获取城市
* @param id
* @return
*/
@GetMapping("/getSysRegionById/{id}")
public RestResponse getSysRegionById(@PathVariable Integer id){
Example exam = Example.builder(SysRegion.class)
.where(WeekendSqls.<SysRegion>custom()
.andEqualTo(SysRegion::getId,id)).build();
List<SysRegion> sysRegions = baseBiz.selectByExample(exam);
if (sysRegions==null||sysRegions.size()!=1) {
RestResponse.suc();
}
return RestResponse.suc( sysRegions.get(0));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment