Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
gogirl-miniapp-backend
Commits
241b65e1
Commit
241b65e1
authored
Sep 12, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
限时特价
parent
6e1b336b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
129 additions
and
26 deletions
+129
-26
ProducePromotionTime.java
...a/com/gogirl/domain/order/serve/ProducePromotionTime.java
+3
-0
BaseFeaturesMapper.java
...frastructure/mapper/product/serve/BaseFeaturesMapper.java
+27
-0
ProducePromotionTimeMapper.java
...ture/mapper/product/serve/ProducePromotionTimeMapper.java
+1
-0
Schedule.java
...ain/java/com/gogirl/infrastructure/schedule/Schedule.java
+61
-4
CustomerController.java
...m/gogirl/interfaces/user/customer/CustomerController.java
+25
-18
BaseFeaturesMapper.xml
src/main/resources/mapper/product/BaseFeaturesMapper.xml
+9
-2
ProducePromotionTimeMapper.xml
...n/resources/mapper/product/ProducePromotionTimeMapper.xml
+3
-2
No files found.
src/main/java/com/gogirl/domain/order/serve/ProducePromotionTime.java
View file @
241b65e1
...
...
@@ -22,8 +22,11 @@ public class ProducePromotionTime implements Serializable {
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
Integer
produceId
;
private
Date
startTime
;
private
Date
endTime
;
@ApiModelProperty
(
"活动价格"
)
...
...
src/main/java/com/gogirl/infrastructure/mapper/product/serve/BaseFeaturesMapper.java
View file @
241b65e1
...
...
@@ -9,9 +9,36 @@ import java.util.List;
public
interface
BaseFeaturesMapper
extends
BaseMapper
<
BaseFeatures
>
{
/**
* <p>
* 查询款式的标签列表
* </p>
*
* @param serveTypeId
* @return
*/
List
<
BaseFeatures
>
queryProduceFeatures
(
@Param
(
"serveTypeId"
)
Integer
serveTypeId
);
/**
* <p>
* 查询服务的标签列表
* </p>
*
* @param serveTypeId
* @return
*/
List
<
BaseFeatures
>
queryServeFeatures
(
@Param
(
"serveTypeId"
)
Integer
serveTypeId
);
/**
* <p>
* 查询指定款式对应的首页标签列表
*
* </p>
*
* @param id
* @return
*/
List
<
BaseFeatures
>
queryProduceFeaturesById
(
Integer
id
);
}
src/main/java/com/gogirl/infrastructure/mapper/product/serve/ProducePromotionTimeMapper.java
View file @
241b65e1
...
...
@@ -7,5 +7,6 @@ import org.apache.ibatis.annotations.Param;
public
interface
ProducePromotionTimeMapper
extends
BaseMapper
<
ProducePromotionTime
>
{
ProducePromotionTime
queryByProduceId
(
@Param
(
"produceId"
)
Integer
produceId
,
@Param
(
"localDateTime"
)
String
localDateTime
);
}
src/main/java/com/gogirl/infrastructure/schedule/Schedule.java
View file @
241b65e1
...
...
@@ -13,6 +13,7 @@ import com.gogirl.domain.common.xcx.WeekConfig;
import
com.gogirl.domain.market.timescard.TimesCardCustomerRelevance
;
import
com.gogirl.domain.order.mall.MallOrder
;
import
com.gogirl.domain.order.serve.OrderManage
;
import
com.gogirl.domain.order.serve.ProducePromotionTime
;
import
com.gogirl.domain.order.serve.ScheduleManage
;
import
com.gogirl.domain.order.serve.ScheduleServe
;
import
com.gogirl.domain.product.mall.MallCategory
;
...
...
@@ -40,10 +41,7 @@ import com.gogirl.infrastructure.mapper.order.serve.OrderServeMapper;
import
com.gogirl.infrastructure.mapper.order.serve.ScheduleManageMapper
;
import
com.gogirl.infrastructure.mapper.product.mall.MallCategoryMapper
;
import
com.gogirl.infrastructure.mapper.product.mall.MallProductMapper
;
import
com.gogirl.infrastructure.mapper.product.serve.BaseFeaturesMapper
;
import
com.gogirl.infrastructure.mapper.product.serve.BaseProduceMapper
;
import
com.gogirl.infrastructure.mapper.product.serve.FeaturesMappingMapper
;
import
com.gogirl.infrastructure.mapper.product.serve.ProduceSalesMapper
;
import
com.gogirl.infrastructure.mapper.product.serve.*
;
import
com.gogirl.infrastructure.mapper.store.career.CareerMapper
;
import
com.gogirl.infrastructure.mapper.store.store.StoreDataMapper
;
import
com.gogirl.infrastructure.mapper.store.store.StoreManageMapper
;
...
...
@@ -66,13 +64,16 @@ import org.springframework.http.MediaType;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -747,4 +748,60 @@ public class Schedule {
couponCustomerRelevanceDao
.
syncCouponCustomerRelDiscountPercent
();
log
.
info
(
"每分钟同步卡券折扣信息 结束"
);
}
@Resource
ProducePromotionTimeMapper
producePromotionTimeMapper
;
/**
* 每分钟同步款式的现价和限制特价标签
*/
@Transactional
@Scheduled
(
cron
=
"0 0/2 * * * ?"
)
public
void
syncProducePriceAndLabel
()
{
baseProduceMapper
.
selectList
(
new
LambdaQueryWrapper
<>())
.
forEach
(
baseProduce
->
{
ProducePromotionTime
producePromotionTime
=
producePromotionTimeMapper
.
queryByProduceId
(
baseProduce
.
getId
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
LocalDateTime
.
now
()));
//先删除热销标签
//款式的所有标签
List
<
BaseFeatures
>
baseFeaturesList
=
baseFeaturesMapper
.
queryProduceFeaturesById
(
baseProduce
.
getId
());
BaseFeatures
specItem
=
ListUtil
.
getOne
(
baseFeaturesList
,
BaseFeatures:
:
getName
,
"限时特价"
);
if
(
specItem
!=
null
)
{
featuresMappingMapper
.
delete
(
new
LambdaQueryWrapper
<
FeaturesMapping
>()
.
eq
(
FeaturesMapping:
:
getDataId
,
baseProduce
.
getId
())
.
eq
(
FeaturesMapping:
:
getFeaturesId
,
specItem
.
getId
()));
}
//如果不是限时特价
if
(
producePromotionTime
==
null
)
{
baseProduce
.
setCurrentPrice
(
baseProduce
.
getBargainPrice
());
baseProduceMapper
.
updateById
(
baseProduce
);
}
//如果是限时
else
{
baseProduce
.
setCurrentPrice
(
producePromotionTime
.
getPrice
());
baseProduceMapper
.
updateById
(
baseProduce
);
BaseFeatures
baseFeatures
=
baseFeaturesMapper
.
selectOne
(
new
LambdaQueryWrapper
<
BaseFeatures
>()
.
eq
(
BaseFeatures:
:
getName
,
"限时特价"
));
if
(
baseFeatures
!=
null
)
{
//如果存在限时特价标签 就为该款式打上标签
FeaturesMapping
featuresMapping
=
new
FeaturesMapping
();
featuresMapping
.
setDataId
(
baseProduce
.
getId
());
featuresMapping
.
setDataType
(
2
);
featuresMapping
.
setFeaturesId
(
baseFeatures
.
getId
());
featuresMappingMapper
.
insert
(
featuresMapping
);
}
}
});
}
}
src/main/java/com/gogirl/interfaces/user/customer/CustomerController.java
View file @
241b65e1
...
...
@@ -29,6 +29,17 @@ public class CustomerController {
@Resource
private
GogirlTokenService
gogirlTokenService
;
@LoginIgnore
@AuthIgnore
@ApiOperation
(
value
=
"小程序用户登录"
)
@GetMapping
(
"/customer/xcx/login"
)
public
JsonResult
<
String
>
login
(
@RequestParam
String
code
)
{
String
token
=
customerService
.
login
(
code
);
return
JsonResult
.
success
(
token
);
}
@ApiOperation
(
"用户授权接街道地址信息"
)
@GetMapping
(
"/customer/xcx/bindAddressInfo"
)
public
JsonResult
<
String
>
bindAddressInfo
(
@RequestParam
Integer
customerId
,
...
...
@@ -40,14 +51,6 @@ public class CustomerController {
return
JsonResult
.
success
();
}
@LoginIgnore
@AuthIgnore
@ApiOperation
(
value
=
"小程序用户登录"
)
@GetMapping
(
"/customer/xcx/login"
)
public
JsonResult
<
String
>
login
(
@RequestParam
String
code
)
{
String
token
=
customerService
.
login
(
code
);
return
JsonResult
.
success
(
token
);
}
@LoginIgnore
@AuthIgnore
...
...
@@ -60,6 +63,19 @@ public class CustomerController {
return
JsonResult
.
success
(
customer
);
}
@AuthIgnore
@LoginIgnore
@ApiOperation
(
value
=
"客户授权手机号码"
)
@PostMapping
(
"/customer/xcx/authorizedPhone"
)
public
JsonResult
<
Customer
>
authorizedPhone
(
@RequestHeader
String
token
,
@RequestParam
String
encryptedData
,
@RequestParam
String
iv
)
throws
InvalidAlgorithmParameterException
{
Customer
customer
=
customerService
.
authorizedPhone
(
token
,
encryptedData
,
iv
);
return
JsonResult
.
success
(
customer
);
}
@ApiOperation
(
value
=
"h5用户登录"
)
@GetMapping
(
"/customer/no_h5Login"
)
public
JsonResult
<
String
>
h5Login
(
@RequestParam
Integer
orderId
)
{
...
...
@@ -76,16 +92,7 @@ public class CustomerController {
}
@AuthIgnore
@LoginIgnore
@ApiOperation
(
value
=
"客户授权手机号码"
)
@PostMapping
(
"/customer/xcx/authorizedPhone"
)
public
JsonResult
<
Customer
>
authorizedPhone
(
@RequestHeader
String
token
,
@RequestParam
String
encryptedData
,
@RequestParam
String
iv
)
throws
InvalidAlgorithmParameterException
{
Customer
customer
=
customerService
.
authorizedPhone
(
token
,
encryptedData
,
iv
);
return
JsonResult
.
success
(
customer
);
}
@AuthIgnore
@ApiOperation
(
value
=
"客户根据token获取用户信息"
)
...
...
src/main/resources/mapper/product/BaseFeaturesMapper.xml
View file @
241b65e1
...
...
@@ -35,4 +35,12 @@
and t.has_index_show = 1
order by index_sort ASC
</select>
</mapper>
\ No newline at end of file
<select
id=
"queryProduceFeaturesById"
resultType=
"com.gogirl.domain.product.serve.BaseFeatures"
>
SELECT *
from base_produce t1
LEFT JOIN features_mapping t2 on t1.id = t2.data_id and t2.data_type = 2
LEFT JOIN base_features t3 on t2.features_id = t3.id
where t1.id = #{id}
</select>
</mapper>
src/main/resources/mapper/product/ProducePromotionTimeMapper.xml
View file @
241b65e1
<?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.gogirl.infrastructure.mapper.product.serve.ProducePromotionTimeMapper"
>
<select
id=
"queryByProduceId"
resultType=
"com.gogirl.domain.order.serve.ProducePromotionTime"
>
SELECT *
from produce_promotion_time
where produce_id = #{produceId}
and start_time
<
= #{localDateTime}
and end_time
>
= #{localDateTime}
limit 1
</select>
</mapper>
\ No newline at end of file
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment