Commit 7cf9d0ac authored by libin's avatar libin

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

parents dd22da1f 30ec26a5
......@@ -96,6 +96,20 @@ public class ActivityList implements Serializable {
@Column(name = "picture")
@ApiModelProperty(value = "活动图片")
private Integer picture;
/**
* 活动类型
*/
@Column(name = "type")
@ApiModelProperty(value = "活动类型")
private Integer type;
/**
* 活动页面链接
*/
@Column(name = "url")
@ApiModelProperty(value = "活动页面链接")
private Integer url;
}
......@@ -76,4 +76,18 @@ public class ActivityManagement {
@Column(name = "picture")
@ApiModelProperty(value = "活动图片")
private Integer picture;
/**
* 活动类型
*/
@Column(name = "type")
@ApiModelProperty(value = "活动类型")
private Integer type;
/**
* 活动页面链接
*/
@Column(name = "url")
@ApiModelProperty(value = "活动页面链接")
private Integer url;
}
......@@ -33,18 +33,17 @@ public class ActivityManagementBiz extends BaseBiz<ActivityManagementMapper, Act
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
public List<ActivityManagement> selectedActivityManagement() throws InvocationTargetException, IllegalAccessException {
public List<ActivityList> selectedActivityManagement() throws InvocationTargetException, IllegalAccessException {
long currentTime = System.currentTimeMillis();
Example exa=Example.builder(ActivityList.class).where(WeekendSqls.<ActivityList>custom()
.andGreaterThanOrEqualTo(ActivityList::getEndTime,currentTime)
.andLessThanOrEqualTo(ActivityList::getStartTime,currentTime)
).orderByAsc("sort").build();
activityListBiz.selectByExample(exa);
List<ActivityList> activityLists = activityListBiz.selectListAll();
if (activityLists==null||activityLists.size()==0) {
return null;
}
ArrayList<ActivityManagement> activityManagements = new ArrayList<>();
for (ActivityList activityList : activityLists) {
ActivityManagement activityManagement =getActivityManagement(activityList);
activityManagements.add(activityManagement);
}
return activityManagements;
return activityLists;
}
/**
......
......@@ -3,6 +3,7 @@ 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.ActivityManagementBiz;
import com.xxfc.platform.activity.entity.ActivityList;
import com.xxfc.platform.activity.entity.ActivityManagement;
import org.springframework.web.bind.annotation.*;
......@@ -26,10 +27,21 @@ public class ActivityManagementController extends BaseController<ActivityManagem
@RequestMapping("/activity/findAll")
public ObjectRestResponse<List<ActivityManagement>> findAll() throws InvocationTargetException, IllegalAccessException {
List<ActivityManagement> list= baseBiz.selectedActivityManagement();
List<ActivityList> list= baseBiz.selectedActivityManagement();
return ObjectRestResponse.succ(list);
}
/**
* 精彩活动列表
* @return
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
@RequestMapping("/app/unauth/activity/findAll")
public ObjectRestResponse<List<ActivityManagement>> appFindAll() throws InvocationTargetException, IllegalAccessException {
List<ActivityList> list= baseBiz.selectedActivityManagement();
return ObjectRestResponse.succ(list);
}
/**
* 查找一条
......
......@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.constant.RestCode;
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.SystemConfig;
import com.xxfc.platform.app.vo.appVersionQuery;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey;
......@@ -52,6 +53,8 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
@Value("${app.uploadPath}")
private String uploadPath;
@Value("${upload.server}")
private String Dev_url;
@Autowired
private RedisTemplate redisTemplate;
......@@ -99,16 +102,17 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
public ObjectRestResponse uploadDrivingLicense(MultipartFile file) throws IOException {
DateTime now = DateTime.now();
String dirPathToday = File.separator + now.toString(DEFAULT_DATE_TIME_FORMATTER);
String dirPathToday = "/" + 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+fileName;
String realFileRelPath = dirPathToday + "/"+fileName;
String filePath = uploadPath + realFileRelPath;
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
realFileRelPath=Dev_url+realFileRelPath;
return ObjectRestResponse.succ(filePath);
}
......
......@@ -11,4 +11,5 @@ import java.util.List;
public class QuestionListVo extends ImQuestion {
List<ImComment> imComment;
List<ImPraise> imPraise;
private boolean isPraise;
}
......@@ -10,11 +10,13 @@ import com.xxfc.platform.im.entity.ImPraise;
import com.xxfc.platform.im.entity.ImQuestion;
import com.xxfc.platform.im.mapper.ImPraiseMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.map.HashedMap;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
......@@ -91,4 +93,12 @@ public class ImPraiseBiz extends BaseBiz<ImPraiseMapper, ImPraise> {
return list;
}
public boolean isExist(Integer userId, Long questionId) {
Map<String, Object> map = new HashedMap<>();
map.put("userId", userId);
map.put("questionId",questionId);
List<ImPraise> list = mapper.selectByUserIdAndQuestionId(map);
return list.size() > 0 ? true : false;
}
}
......@@ -12,6 +12,7 @@ import com.xxfc.platform.im.dto.QuestionParamDto;
import com.xxfc.platform.im.dto.UpdateTypeEnum;
import com.xxfc.platform.im.entity.ImQuestion;
import com.xxfc.platform.im.mapper.ImQuestionMapper;
import com.xxfc.platform.im.vo.QuestionListVo;
import com.xxfc.platform.universal.feign.MQSenderFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,6 +29,8 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
@Autowired
MQSenderFeign mqSenderFeign;
@Autowired
ImPraiseBiz imPraiseBiz;
/**
* 获取列表
*
......@@ -36,8 +39,13 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
*/
public ObjectRestResponse getList(QuestionParamDto questionParamDto) {
Query query = new Query(questionParamDto);
PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getQuestionList(query.getSuper()));
return new ObjectRestResponse<>().data(pageDataVO);
PageDataVO<QuestionListVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getQuestionList(query.getSuper()));
AppUserDTO appUserDTO = userBiz.getUserInfo();
if(appUserDTO != null) {
pageDataVO.getData().forEach((a) -> a.setPraise(imPraiseBiz.isExist(appUserDTO.getUserid(), a.getId())));
}
return new ObjectRestResponse<>().data(pageDataVO);
}
......
......@@ -4,6 +4,7 @@ import com.xxfc.platform.im.entity.ImPraise;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
public interface ImPraiseMapper extends Mapper<ImPraise> {
......@@ -11,4 +12,6 @@ public interface ImPraiseMapper extends Mapper<ImPraise> {
List<ImPraise> selectByQuestionIdAndTime(ImPraise imPraise);
List<ImPraise> selectByUserIdAndQuestionId(Map<String, Object> param);
}
\ No newline at end of file
......@@ -24,4 +24,10 @@
where question_id = #{questionId} and is_del = 0 and visible = 1
and time between #{startTime} and #{endTime}
</select>
<select id="selectByUserIdAndQuestionId" resultType="com.xxfc.platform.im.entity.ImPraise" parameterType="java.util.Map">
select * from im_praise
where question_id = #{questionId} and is_del = 0 and visible = 1
and user_id = #{userId}
</select>
</mapper>
\ No newline at end of file
......@@ -316,20 +316,20 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
//计算退款金额
// 1、押金 + 租金(规则扣除)
//BigDecimal refundGoodsAmount = baseOrder.getGoodsAmount();
String refundDesc = "取消订单退款:";
StringBuilder refundDescBuilder = new StringBuilder("取消订单退款:");
if(null == depositAmount) {
depositAmount = BigDecimal.ZERO;
}
//商品价格 - 优惠券减免的价格
BigDecimal refundGoodsAmount = calculateRefund(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()), timeLag, dicParentKey, refundDesc);
BigDecimal refundGoodsAmount = calculateRefund(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()), timeLag, dicParentKey, refundDescBuilder);
//退款金额
BigDecimal refundAmount = depositAmount.add(refundGoodsAmount);
//退款子流程: 订单基础,退款描述,退款金额
refundSubProcess(baseOrder, refundDesc, refundAmount, RefundTypeEnum.ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode());
refundSubProcess(baseOrder, refundDescBuilder.toString(), refundAmount, RefundTypeEnum.ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode());
}
public BigDecimal calculateRefund(BigDecimal goodsAmount, Long timeLag, String dicParentKey, String refundDesc) {
public BigDecimal calculateRefund(BigDecimal goodsAmount, Long timeLag, String dicParentKey, StringBuilder refundDescBuilder) {
BigDecimal refundGoodsAmount = goodsAmount;
//根据时间处理goodsAmount
......@@ -354,7 +354,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
//ga : goodsAmount
set("ga", goodsAmount);
}})).toString());
refundDesc = names[1]+ ","+ refundDesc;
refundDescBuilder = refundDescBuilder.insert(0, names[1]+ ",");
break;
}
}
......
......@@ -24,6 +24,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
import java.math.BigDecimal;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.universal.constant.DictionaryKey.TOUR_IN_REFUND;
import static com.xxfc.platform.universal.constant.DictionaryKey.TOUR_REFUND;
@Controller
@RequestMapping("orderRefund")
......@@ -40,10 +43,10 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
return userFeign;
}
@RequestMapping(value = "/price/calculate/{type}/{no}", method = RequestMethod.GET)
@RequestMapping(value = "/price/calculate/{no}", method = RequestMethod.GET)
@ResponseBody
@IgnoreClientToken
public ObjectRestResponse getPriceCalculate(@PathVariable(value = "type") String type, @PathVariable(value = "no") String no) {
public ObjectRestResponse<BigDecimal> getPriceCalculate(@PathVariable(value = "no") String no) {
checkAppUser();
//根据no 查订单
OrderPageVO orderPageVO = baseOrderBiz.pageByParm(new Query(new PageParam(){{
......@@ -51,36 +54,38 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
setPage(1);
}}){{put("no", no); }}.getSuper()).get(0);
OrderRefundPriceVO orp = new OrderRefundPriceVO(){{
setRealAmount(orderPageVO.getRealAmount());
}};
OrderTypeEnum orderTypeEnum = OrderTypeEnum.get(orderPageVO.getType());
BigDecimal orderRefundAmount = BigDecimal.ZERO;
StringBuilder refundDescBuilder = new StringBuilder("");
switch (orderTypeEnum) {
case RENT_VEHICLE:
baseOrderBiz.calculateRefund(orderPageVO.getGoodsAmount()
, System.currentTimeMillis() - orderPageVO.getOrderRentVehicleDetail().getStartTime()
orderRefundAmount = baseOrderBiz.calculateRefund(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
, orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.RENT_REFUND
, "取消订单退款:");
, refundDescBuilder);
break;
case TOUR:
// String dicParentKey = DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.TOUR_REFUND;
// //不是省外,
// if(SYS_FALSE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
// dicParentKey = DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.TOUR_IN_REFUND;
// }
// orp.setRefundAmount(baseOrderBiz.calculateRefund(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
// , System.currentTimeMillis() - orderPageVO.getOrderRentVehicleDetail().getStartTime()
// , DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.RENT_REFUND
// , "取消订单退款:"));
//判断是省内还是省外
String key = TOUR_IN_REFUND;
if(SYS_TRUE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
key = TOUR_REFUND;
}
orderRefundAmount = baseOrderBiz.calculateRefund(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
, orderPageVO.getOrderTourDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ DictionaryKey.RENT_REFUND
, refundDescBuilder);
break;
default:
// orp.setRefundAmount(orderPageVO);
break;
}
return null;
OrderRefundPriceVO orpv = new OrderRefundPriceVO();
orpv.setRealAmount(orderPageVO.getRealAmount());
orpv.setRefundAmount(orderRefundAmount);
orpv.setRefundDesc(refundDescBuilder.toString());
return ObjectRestResponse.succ(orpv);
}
@Data
......@@ -88,10 +93,11 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
BigDecimal refundAmount;
BigDecimal realAmount;
BigDecimal cutAmount;
String refundDesc;
public void setRefundAmount(BigDecimal refundAmount) {
this.refundAmount = refundAmount;
this.cutAmount = realAmount.multiply(refundAmount);
this.cutAmount = realAmount.subtract(refundAmount);
}
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -17,5 +18,6 @@ public class BaseController<Biz extends BaseBiz> {
@Autowired
protected HttpServletRequest request;
@Autowired
@Lazy
protected Biz baseBiz;
}
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