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
a52e8335
Commit
a52e8335
authored
May 27, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件上传
parent
fe393af7
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
273 additions
and
39 deletions
+273
-39
IOwnProduceService.java
...om/gogirl/application/order/serve/IOwnProduceService.java
+16
-0
OrderManageServiceImpl.java
.../application/order/serve/impl/OrderManageServiceImpl.java
+24
-0
OwnProduceServiceImpl.java
...l/application/order/serve/impl/OwnProduceServiceImpl.java
+20
-0
ScheduleManageServiceImpl.java
...plication/order/serve/impl/ScheduleManageServiceImpl.java
+24
-17
OrderServe.java
src/main/java/com/gogirl/domain/order/serve/OrderServe.java
+27
-9
OwnProduce.java
src/main/java/com/gogirl/domain/order/serve/OwnProduce.java
+38
-0
ScheduleServe.java
...ain/java/com/gogirl/domain/order/serve/ScheduleServe.java
+29
-9
OwnProduceMapper.java
...l/infrastructure/mapper/order/serve/OwnProduceMapper.java
+16
-0
BaseProduceMapper.java
...nfrastructure/mapper/product/serve/BaseProduceMapper.java
+5
-0
OwnProduceController.java
...m/gogirl/interfaces/order/serve/OwnProduceController.java
+19
-0
FileController.java
src/main/java/com/gogirl/interfaces/user/FileController.java
+3
-3
CalcServiceDuration.java
...n/java/com/gogirl/shared/product/CalcServiceDuration.java
+18
-0
application.yml
src/main/resources/application.yml
+1
-1
OwnProduceMapper.xml
src/main/resources/mapper/OwnProduceMapper.xml
+5
-0
BaseProduceMapper.xml
src/main/resources/mapper/product/BaseProduceMapper.xml
+6
-0
Test.java
src/test/java/com/gogirl/Test.java
+22
-0
No files found.
src/main/java/com/gogirl/application/order/serve/IOwnProduceService.java
0 → 100644
View file @
a52e8335
package
com
.
gogirl
.
application
.
order
.
serve
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.gogirl.domain.order.serve.OwnProduce
;
/**
* <p>
* 服务类
* </p>
*
* @author robbendev
* @since 2020-05-27
*/
public
interface
IOwnProduceService
extends
IService
<
OwnProduce
>
{
}
src/main/java/com/gogirl/application/order/serve/impl/OrderManageServiceImpl.java
View file @
a52e8335
...
...
@@ -230,6 +230,18 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
builder
.
serveChangePrice
(
orderServeParam
.
getServeChangePrice
());
}
OrderServe
orderServe
=
builder
.
build
();
//自带款式
if
(
orderServe
.
getServeName
().
trim
().
equals
(
ScheduleServe
.
OWN_PRODUCE_KEY
))
{
orderServe
.
setIsOwnProduce
(
1
);
if
(
orderServe
.
getOwnProduceId
()
==
null
)
{
throw
new
RRException
(
"请补全自带款式"
);
}
}
else
{
orderServe
.
setIsOwnProduce
(
2
);
orderServe
.
setOwnProduceId
(
null
);
}
orderServe
.
calcPrice
();
orderServeMapper
.
insert
(
orderServe
);
...
...
@@ -331,6 +343,18 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
orderServe
.
setCommentStatus
(
orderServeParam
.
getCommentStatus
());
//订单服务备注
orderServe
.
setRemark
(
orderServeParam
.
getRemark
());
//自带款式
if
(
orderServe
.
getServeName
().
trim
().
equals
(
ScheduleServe
.
OWN_PRODUCE_KEY
))
{
orderServe
.
setIsOwnProduce
(
1
);
if
(
orderServe
.
getOwnProduceId
()
==
null
)
{
throw
new
RRException
(
"请补全自带款式"
);
}
}
else
{
orderServe
.
setIsOwnProduce
(
2
);
orderServe
.
setOwnProduceId
(
null
);
}
orderServe
.
calcPrice
();
orderServeMapper
.
updateById
(
orderServe
);
}
...
...
src/main/java/com/gogirl/application/order/serve/impl/OwnProduceServiceImpl.java
0 → 100644
View file @
a52e8335
package
com
.
gogirl
.
application
.
order
.
serve
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.gogirl.application.order.serve.IOwnProduceService
;
import
com.gogirl.domain.order.serve.OwnProduce
;
import
com.gogirl.infrastructure.mapper.order.serve.OwnProduceMapper
;
import
org.springframework.stereotype.Service
;
/**
* <p>
* 服务实现类
* </p>
*
* @author robbendev
* @since 2020-05-27
*/
@Service
public
class
OwnProduceServiceImpl
extends
ServiceImpl
<
OwnProduceMapper
,
OwnProduce
>
implements
IOwnProduceService
{
}
src/main/java/com/gogirl/application/order/serve/impl/ScheduleManageServiceImpl.java
View file @
a52e8335
...
...
@@ -603,6 +603,11 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
if
(
scheduleServe
.
getMainServeId
()
!=
null
)
{
throw
new
RRException
(
"不能对辅助服务开单"
);
}
//如果是自带款式 但是没有设置
if
(
scheduleServe
.
getIsOwnProduce
()
==
1
&&
scheduleServe
.
getOwnProduceId
()
==
null
)
{
throw
new
RRException
(
"请补全自带款式"
);
}
//所有需要更新的服务
List
<
ScheduleServe
>
updateList
=
scheduleServeMapper
.
selectUpdateStatusList
(
scheduleServe
.
getSchId
(),
scheduleServe
.
getServeId
());
...
...
@@ -815,22 +820,15 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
log
.
error
(
e
.
getMessage
(),
e
);
}
// /*3、如果是指定美甲师、判断美甲师是否仍然可用*/
// //构造路径
// List<TreeProgram> treeProgramList = new ArrayList<>();
// TreeProgram treeProgram = new TreeProgram();
// List<ScheduleServe> scheduleServeList = scheduleManage.getListScheduleServer()
// .stream()
// .filter(scheduleServe -> scheduleServe.getServeId() == null)
// .collect(Collectors.toList());
//
// //方案树
// TreeProgram targetTree = idleTimeDTO.getTreeProgram();
//
// boolean isPath = treeProgram.isSubTree(targetTree);
// if (!isPath) {
// throw new RRException("请重新选择美甲师");
// }
}
if
(
SessionUtils
.
isSourceFromTechnician
())
{
scheduleManage
.
getListScheduleServer
().
forEach
(
scheduleServe
->
{
if
(
scheduleServe
.
getIsOwnProduce
()
==
1
&&
scheduleServe
.
getOwnProduceId
()
==
null
)
{
throw
new
RRException
(
"请补全自带款式"
);
}
}
);
}
}
...
...
@@ -924,6 +922,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
scheduleManage
.
setLastUpdateTime
(
new
Date
());
//更次预约
scheduleManageMapper
.
updateById
(
scheduleManage
);
List
<
Integer
>
oldScheduleServeIds
=
scheduleServeMapper
.
selectList
(
new
LambdaQueryWrapper
<
ScheduleServe
>().
eq
(
ScheduleServe:
:
getSchId
,
scheduleManage
.
getId
())).
stream
().
map
(
ScheduleServe:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
ScheduleServe
>
scheduleServeList
=
scheduleManage
.
getScheduleServeList
();
scheduleServeList
.
forEach
(
scheduleServe
->
scheduleServe
.
setSchId
(
scheduleManage
.
getId
()));
...
...
@@ -1339,6 +1338,14 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
scheduleServe
.
setProduceCurrentPrice
(
null
);
//款式id
scheduleServe
.
setProduceId
(
null
);
}
//自带款式
if
(
scheduleServe
.
getServeName
().
trim
().
equals
(
ScheduleServe
.
OWN_PRODUCE_KEY
))
{
scheduleServe
.
setIsOwnProduce
(
1
);
}
else
{
scheduleServe
.
setIsOwnProduce
(
2
);
scheduleServe
.
setOwnProduceId
(
null
);
}
//款式做法
scheduleServe
.
setExplain
(
baseServe
.
getExplain
());
...
...
@@ -1362,7 +1369,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
return
cloneScheduleServe
;
})
.
collect
(
Collectors
.
toList
());
//除了第一个 其余的id设空 防止并发请求的幂等
list
.
stream
().
skip
(
1
).
forEach
(
var
->
var
.
setId
(
null
));
return
list
;
})
...
...
src/main/java/com/gogirl/domain/order/serve/OrderServe.java
View file @
a52e8335
...
...
@@ -235,6 +235,15 @@ public class OrderServe implements Serializable {
@TableField
(
exist
=
false
)
private
String
picturePath
;
@ApiModelProperty
(
"是否自带款式 1-是 2-否"
)
private
Integer
isOwnProduce
;
@ApiModelProperty
(
"自带款式id"
)
@TableField
(
strategy
=
FieldStrategy
.
IGNORED
)
private
Integer
ownProduceId
;
@TableField
(
exist
=
false
)
private
OwnProduce
ownProduce
;
public
void
addDiscountPrice
(
BigDecimal
discountPrice
)
{
this
.
discountPrice
=
this
.
discountPrice
.
add
(
discountPrice
);
...
...
@@ -242,14 +251,13 @@ public class OrderServe implements Serializable {
}
public
void
calcPrice
()
{
if
(
produceId
==
null
)
{
if
(
discountRate
==
null
)
{
price
=
servePrice
;
}
else
{
leisurePrice
=
servePrice
.
multiply
(
discountRate
);
price
=
leisurePrice
;
}
}
else
{
//自带款式
if
(
ownProduce
!=
null
)
{
price
=
ownProduce
.
getPrice
();
}
//预约款式
else
if
(
produceId
!=
null
)
{
if
(
discountRate
==
null
)
{
//没有活动价格
if
(
promotionPrice
==
null
)
{
...
...
@@ -270,10 +278,20 @@ public class OrderServe implements Serializable {
price
=
leisurePrice
.
min
(
produceCurrentPrice
).
min
(
promotionPrice
);
}
}
}
//预约服务
else
{
if
(
discountRate
==
null
)
{
price
=
servePrice
;
}
else
{
leisurePrice
=
servePrice
.
multiply
(
discountRate
);
price
=
leisurePrice
;
}
}
}
public
Boolean
isActivity
()
{
return
price
.
equals
(
leisurePrice
)
||
price
.
equals
(
promotionPrice
)
||
...
...
src/main/java/com/gogirl/domain/order/serve/OwnProduce.java
0 → 100644
View file @
a52e8335
package
com
.
gogirl
.
domain
.
order
.
serve
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020-05-27
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"OwnProduce对象"
,
description
=
""
)
public
class
OwnProduce
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"自带款式名字"
)
private
String
name
;
@ApiModelProperty
(
value
=
"自带款式价格"
)
private
BigDecimal
price
;
@ApiModelProperty
(
value
=
"自带款式时长"
)
private
Integer
duration
;
}
src/main/java/com/gogirl/domain/order/serve/ScheduleServe.java
View file @
a52e8335
...
...
@@ -30,6 +30,8 @@ public class ScheduleServe implements Serializable {
*/
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
String
OWN_PRODUCE_KEY
=
"自带款式"
;
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
"id"
)
private
Integer
id
;
...
...
@@ -185,16 +187,25 @@ public class ScheduleServe implements Serializable {
private
BigDecimal
leisurePrice
;
@ApiModelProperty
(
"是否自带款式 1-是 2-否"
)
private
Integer
isOwnProduce
;
@ApiModelProperty
(
"自带款式id"
)
@TableField
(
strategy
=
FieldStrategy
.
IGNORED
)
private
Integer
ownProduceId
;
@TableField
(
exist
=
false
)
private
OwnProduce
ownProduce
;
public
void
calcPrice
()
{
if
(
produceId
==
null
)
{
if
(
discountRate
==
null
)
{
price
=
servePrice
;
}
else
{
leisurePrice
=
servePrice
.
multiply
(
discountRate
);
price
=
leisurePrice
;
}
}
else
{
//自带款式
if
(
ownProduce
!=
null
)
{
price
=
ownProduce
.
getPrice
();
}
//预约款式
else
if
(
produceId
!=
null
)
{
if
(
discountRate
==
null
)
{
//没有活动价格
if
(
promotionPrice
==
null
)
{
...
...
@@ -215,8 +226,17 @@ public class ScheduleServe implements Serializable {
price
=
leisurePrice
.
min
(
produceCurrentPrice
).
min
(
promotionPrice
);
}
}
}
//预约服务
else
{
if
(
discountRate
==
null
)
{
price
=
servePrice
;
}
else
{
leisurePrice
=
servePrice
.
multiply
(
discountRate
);
price
=
leisurePrice
;
}
}
}
public
Boolean
isActivity
()
{
...
...
src/main/java/com/gogirl/infrastructure/mapper/order/serve/OwnProduceMapper.java
0 → 100644
View file @
a52e8335
package
com
.
gogirl
.
infrastructure
.
mapper
.
order
.
serve
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.gogirl.domain.order.serve.OwnProduce
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author robbendev
* @since 2020-05-27
*/
public
interface
OwnProduceMapper
extends
BaseMapper
<
OwnProduce
>
{
}
src/main/java/com/gogirl/infrastructure/mapper/product/serve/BaseProduceMapper.java
View file @
a52e8335
...
...
@@ -4,9 +4,12 @@ package com.gogirl.infrastructure.mapper.product.serve;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.gogirl.domain.product.serve.BaseProduce
;
import
com.gogirl.shared.product.CalcServiceDuration
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* Created by yinyong on 2018/8/23.
*/
...
...
@@ -47,4 +50,6 @@ public interface BaseProduceMapper extends BaseMapper<BaseProduce> {
* 同步款式销量
*/
void
syncSalesNum
();
List
<
CalcServiceDuration
>
queryProduceServiceDuration
();
}
src/main/java/com/gogirl/interfaces/order/serve/OwnProduceController.java
0 → 100644
View file @
a52e8335
package
com
.
gogirl
.
interfaces
.
order
.
serve
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <p>
* 前端控制器
* </p>
*
* @author robbendev
* @since 2020-05-27
*/
@RestController
@RequestMapping
(
"/own-produce"
)
public
class
OwnProduceController
{
}
src/main/java/com/gogirl/interfaces/user/FileController.java
View file @
a52e8335
...
...
@@ -24,12 +24,12 @@ public class FileController {
@ApiOperation
(
value
=
"图片上传"
)
@PostMapping
(
"/customer/xcx/upload"
)
public
JsonResult
<
String
>
upload
(
MultipartFile
multipartF
ile
)
throws
Exception
{
if
(
multipartF
ile
==
null
)
{
public
JsonResult
<
String
>
upload
(
MultipartFile
f
ile
)
throws
Exception
{
if
(
f
ile
==
null
)
{
throw
new
RRException
(
"上传内容为空"
);
}
log
.
info
(
"图片上传"
);
String
imgUrl
=
fileService
.
saveImage
(
multipartF
ile
);
String
imgUrl
=
fileService
.
saveImage
(
f
ile
);
return
JsonResult
.
success
(
imgUrl
);
}
...
...
src/main/java/com/gogirl/shared/product/CalcServiceDuration.java
0 → 100644
View file @
a52e8335
package
com
.
gogirl
.
shared
.
product
;
import
lombok.Data
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/5/26 5:47 下午
*/
@Data
public
class
CalcServiceDuration
{
private
Integer
id
;
private
Integer
quantity
;
private
Integer
duration
;
}
src/main/resources/application.yml
View file @
a52e8335
spring
:
profiles
:
active
:
pr
od
active
:
pr
e
servlet
:
#文件上传最大容量
multipart
:
...
...
src/main/resources/mapper/OwnProduceMapper.xml
0 → 100644
View file @
a52e8335
<?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.order.serve.OwnProduceMapper"
>
</mapper>
src/main/resources/mapper/product/BaseProduceMapper.xml
View file @
a52e8335
...
...
@@ -127,6 +127,12 @@
</otherwise>
</choose>
</select>
<select
id=
"queryProduceServiceDuration"
resultType=
"com.gogirl.shared.product.CalcServiceDuration"
>
SELECT t1.bargain_price,t1.`name` ,t1.service_duration ,t1.id,t2.quantity,t3.price,t3.duration from base_produce t1
LEFT JOIN produce_technique_sku t2 on t1.id= t2.produce_id
LEFT JOIN technique_sku t3 on t2.technique_sku_id = t3.id
where t3.duration is not null
</select>
</mapper>
src/test/java/com/gogirl/Test.java
View file @
a52e8335
...
...
@@ -19,6 +19,7 @@ import com.gogirl.domain.order.serve.OrderManage;
import
com.gogirl.domain.order.serve.OrderServe
;
import
com.gogirl.domain.product.purchase.PurchaseStock
;
import
com.gogirl.domain.product.purchase.PurchaseStockRecord
;
import
com.gogirl.domain.product.serve.BaseProduce
;
import
com.gogirl.domain.store.complaint.ComplaintDetailed
;
import
com.gogirl.domain.store.complaint.ComplaintDetailedTechnician
;
import
com.gogirl.domain.store.complaint.ComplaintMain
;
...
...
@@ -43,6 +44,7 @@ import com.gogirl.infrastructure.mapper.order.serve.OrderServeMapper;
import
com.gogirl.infrastructure.mapper.product.purchase.PurchaseSkuMapper
;
import
com.gogirl.infrastructure.mapper.product.purchase.PurchaseStockMapper
;
import
com.gogirl.infrastructure.mapper.product.purchase.PurchaseStockRecordMapper
;
import
com.gogirl.infrastructure.mapper.product.serve.BaseProduceMapper
;
import
com.gogirl.infrastructure.mapper.store.complaint.ComplaintDetailedMapper
;
import
com.gogirl.infrastructure.mapper.store.complaint.ComplaintDetailedTechnicianMapper
;
import
com.gogirl.infrastructure.mapper.store.complaint.ComplaintMainMapper
;
...
...
@@ -55,6 +57,7 @@ import com.gogirl.infrastructure.mapper.xcx.TimeNodeMapper;
import
com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper
;
import
com.gogirl.infrastructure.schedule.Schedule
;
import
com.gogirl.infrastructure.service.mail.MailService
;
import
com.gogirl.shared.product.CalcServiceDuration
;
import
com.gogirl.shared.product.PurchaseSkuPOI
;
import
lombok.extern.slf4j.Slf4j
;
import
org.assertj.core.util.Lists
;
...
...
@@ -695,4 +698,23 @@ public class Test {
EasyExcel
.
write
(
fileName
,
PurchaseSkuPOI
.
class
).
sheet
(
"purchaseSku"
).
doWrite
(
purchaseSkuPOIList
);
}
@Resource
BaseProduceMapper
baseProduceMapper
;
@org
.
junit
.
Test
public
void
syncProduceServiceDuration
()
{
List
<
CalcServiceDuration
>
calcServiceDurationList
=
baseProduceMapper
.
queryProduceServiceDuration
();
calcServiceDurationList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CalcServiceDuration:
:
getId
))
.
forEach
((
key
,
value
)
->
{
BaseProduce
baseProduce
=
baseProduceMapper
.
selectById
(
key
);
Integer
sumServiceDuration
=
value
.
stream
().
map
(
calcServiceDuration
->
calcServiceDuration
.
getDuration
()
*
calcServiceDuration
.
getQuantity
()).
mapToInt
(
Integer:
:
intValue
).
sum
();
baseProduce
.
setServiceDuration
(
sumServiceDuration
);
baseProduceMapper
.
updateById
(
baseProduce
);
});
}
}
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