Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 720102c6
authored
Jul 12, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除已经废弃的表product_category相关的代码
1 parent
891a70e6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
0 additions
and
217 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/ProductCategoryController.java
project-order/src/main/java/com/dituhui/pea/order/dao/ProductCategoryDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/ProductCategoryResp.java
project-order/src/main/java/com/dituhui/pea/order/entity/ProductCategoryEntity.java
project-order/src/main/java/com/dituhui/pea/order/service/ProductCategoryService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/ProductCategoryServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/ProductCategoryController.java
deleted
100644 → 0
View file @
891a70e
package
com
.
dituhui
.
pea
.
order
.
controller
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.service.ProductCategoryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/pea-order"
)
public
class
ProductCategoryController
{
@Autowired
private
ProductCategoryService
productCategoryService
;
@GetMapping
(
"/product/category"
)
public
Result
<?>
getProductCategory
()
{
Result
<?>
res
=
null
;
try
{
res
=
productCategoryService
.
getProductCategory
();
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
}
project-order/src/main/java/com/dituhui/pea/order/dao/ProductCategoryDao.java
deleted
100644 → 0
View file @
891a70e
package
com
.
dituhui
.
pea
.
order
.
dao
;
import
com.dituhui.pea.order.entity.ProductCategoryEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
ProductCategoryDao
extends
JpaRepository
<
ProductCategoryEntity
,
Long
>
{
ProductCategoryEntity
getProductCategoryEntityByBrandAndTypeAndSkill
(
String
brand
,
String
type
,
String
skill
);
@Query
(
"select p.layer from ProductCategoryEntity p where p.brand = :brand and p.type = :type and p.skill = :skill"
)
String
getLayerByBrandAndTypeAndSkill
(
String
brand
,
String
type
,
String
skill
);
}
project-order/src/main/java/com/dituhui/pea/order/dto/ProductCategoryResp.java
deleted
100644 → 0
View file @
891a70e
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
ProductCategoryResp
{
private
List
<
ProductCategory
>
categories
;
@Data
public
static
class
ProductCategory
{
private
String
brand
;
private
String
type
;
private
String
skill
;
private
String
categoryId
;
}
}
project-order/src/main/java/com/dituhui/pea/order/entity/ProductCategoryEntity.java
deleted
100644 → 0
View file @
891a70e
package
com
.
dituhui
.
pea
.
order
.
entity
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
javax.persistence.*
;
@Entity
@Data
@Table
(
name
=
"product_category"
)
public
class
ProductCategoryEntity
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
/**
* 小组id
*/
private
String
productCategoryId
;
/**
* 品牌
*/
private
String
brand
;
/**
* 产品类别
*/
private
String
type
;
/**
* 服务类型
*/
private
String
skill
;
/**
* 所需工时(分钟)
*/
private
Integer
takeTime
;
/**
* 所需人数
*/
private
Integer
takeEngineer
;
/**
* 是否需要低压电工证
*/
private
Integer
lowElectricianCert
;
/**
* 是否需要燃气证
*/
private
Integer
gasCert
;
/**
* 图层标签
*/
private
String
layer
;
/**
* 备注
*/
private
String
memo
;
/**
* 创建时间
*/
private
LocalDateTime
createTime
;
/**
* 更新时间
*/
private
LocalDateTime
updateTime
;
public
ProductCategoryEntity
()
{
}
}
project-order/src/main/java/com/dituhui/pea/order/service/ProductCategoryService.java
deleted
100644 → 0
View file @
891a70e
package
com
.
dituhui
.
pea
.
order
.
service
;
import
com.dituhui.pea.common.Result
;
public
interface
ProductCategoryService
{
Result
<?>
getProductCategory
();
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
720102c
...
...
@@ -23,14 +23,12 @@ import com.dituhui.pea.order.common.CapacityUtils;
import
com.dituhui.pea.order.common.SaasUtils
;
import
com.dituhui.pea.order.dao.OrderRequestDao
;
import
com.dituhui.pea.order.dao.OrgTeamDao
;
import
com.dituhui.pea.order.dao.ProductCategoryDao
;
import
com.dituhui.pea.order.dto.LabelValueDTO
;
import
com.dituhui.pea.order.dto.LocationDTO
;
import
com.dituhui.pea.order.dto.OrderCreateReqDTO
;
import
com.dituhui.pea.order.dto.ParameterRespDTO
;
import
com.dituhui.pea.order.entity.OrderRequestEntity
;
import
com.dituhui.pea.order.entity.OrgTeamEntity
;
import
com.dituhui.pea.order.entity.ProductCategoryEntity
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.service.OrderCreateService
;
import
io.seata.core.context.RootContext
;
...
...
@@ -55,9 +53,6 @@ public class OrderCreateServiceImpl implements OrderCreateService {
private
OrderRequestDao
orderRequestDao
;
@Autowired
private
ProductCategoryDao
productCategoryDao
;
@Autowired
private
OrgTeamDao
orgTeamDao
;
@Autowired
...
...
@@ -160,12 +155,6 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setAppointmentStatus
(
"NOT_ASSIGNED"
);
entity
.
setAppointmentMethod
(
"AUTO_NOW"
);
ProductCategoryEntity
categoryEntity
=
productCategoryDao
.
getProductCategoryEntityByBrandAndTypeAndSkill
(
req
.
getBrand
(),
req
.
getType
(),
req
.
getSkill
());
if
(
categoryEntity
==
null
)
{
throw
new
RuntimeException
(
"产品代码不存在!"
);
}
String
catalogId
=
categoryEntity
.
getProductCategoryId
();
entity
.
setCategoryId
(
catalogId
);
orderRequestDao
.
save
(
entity
);
// 登记
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"API"
,
"创建订单"
,
"创建订单"
,
""
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/ProductCategoryServiceImpl.java
deleted
100644 → 0
View file @
891a70e
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dao.ProductCategoryMPDao
;
import
com.dituhui.pea.order.dto.ProductCategoryResp
;
import
com.dituhui.pea.order.entity.ProductCategory
;
import
com.dituhui.pea.order.service.ProductCategoryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
ProductCategoryServiceImpl
implements
ProductCategoryService
{
@Autowired
private
ProductCategoryMPDao
productCategoryMPDao
;
@Transactional
@Override
public
Result
<?>
getProductCategory
()
{
// 查询所有记录
List
<
ProductCategory
>
records
=
productCategoryMPDao
.
selectList
(
null
);
// 排序brand+type+skill
Comparator
<
ProductCategory
>
byBrand
=
Comparator
.
comparing
(
ProductCategory:
:
getBrand
);
Comparator
<
ProductCategory
>
byType
=
Comparator
.
comparing
(
ProductCategory:
:
getType
);
Comparator
<
ProductCategory
>
bySkill
=
Comparator
.
comparing
(
ProductCategory:
:
getSkill
);
Comparator
<
ProductCategory
>
comp
=
byBrand
.
thenComparing
(
byType
).
thenComparing
(
bySkill
);
List
<
ProductCategory
>
results
=
records
.
stream
().
sorted
(
comp
).
collect
(
Collectors
.
toList
());
ProductCategoryResp
res
=
new
ProductCategoryResp
();
List
<
ProductCategoryResp
.
ProductCategory
>
categories
=
new
ArrayList
<>();
for
(
ProductCategory
p:
results
)
{
ProductCategoryResp
.
ProductCategory
item
=
new
ProductCategoryResp
.
ProductCategory
();
item
.
setBrand
(
p
.
getBrand
());
item
.
setType
(
p
.
getType
());
item
.
setSkill
(
p
.
getSkill
());
item
.
setCategoryId
(
p
.
getProductCategoryId
());
categories
.
add
(
item
);
}
res
.
setCategories
(
categories
);
return
Result
.
success
(
res
);
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment