Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
88500fc1
Commit
88500fc1
authored
Nov 27, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加商品,设备,货道对象
parent
ffe6012b
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1949 additions
and
1 deletions
+1949
-1
GoodsController.java
...ain/java/share/web/controller/system/GoodsController.java
+91
-0
MachineController.java
...n/java/share/web/controller/system/MachineController.java
+91
-0
ShelfController.java
...ain/java/share/web/controller/system/ShelfController.java
+91
-0
VendingMachineController.java
...share/web/controller/system/VendingMachineController.java
+68
-0
VendingMachineConstants.java
...n/java/share/common/constant/VendingMachineConstants.java
+40
-0
ReceiptRdeisEnum.java
...on/src/main/java/share/common/enums/ReceiptRdeisEnum.java
+3
-1
VendingMachineEnum.java
.../src/main/java/share/common/enums/VendingMachineEnum.java
+50
-0
Goods.java
share-system/src/main/java/share/system/domain/Goods.java
+85
-0
Machine.java
share-system/src/main/java/share/system/domain/Machine.java
+118
-0
Shelf.java
share-system/src/main/java/share/system/domain/Shelf.java
+99
-0
GoodsMapper.java
...system/src/main/java/share/system/mapper/GoodsMapper.java
+62
-0
MachineMapper.java
...stem/src/main/java/share/system/mapper/MachineMapper.java
+62
-0
ShelfMapper.java
...system/src/main/java/share/system/mapper/ShelfMapper.java
+62
-0
GoodsService.java
...stem/src/main/java/share/system/service/GoodsService.java
+62
-0
MachineService.java
...em/src/main/java/share/system/service/MachineService.java
+62
-0
ShelfService.java
...stem/src/main/java/share/system/service/ShelfService.java
+62
-0
VendingMachineSrevice.java
...main/java/share/system/service/VendingMachineSrevice.java
+27
-0
GoodsServiceImpl.java
...main/java/share/system/service/impl/GoodsServiceImpl.java
+91
-0
MachineServiceImpl.java
...in/java/share/system/service/impl/MachineServiceImpl.java
+91
-0
ShelfServiceImpl.java
...main/java/share/system/service/impl/ShelfServiceImpl.java
+91
-0
VendingMachineSreviceImpl.java
.../share/system/service/impl/VendingMachineSreviceImpl.java
+145
-0
GoodsMapper.xml
...e-system/src/main/resources/mapper/system/GoodsMapper.xml
+118
-0
MachineMapper.xml
...system/src/main/resources/mapper/system/MachineMapper.xml
+150
-0
ShelfMapper.xml
...e-system/src/main/resources/mapper/system/ShelfMapper.xml
+128
-0
No files found.
share-admin/src/main/java/share/web/controller/system/GoodsController.java
0 → 100644
View file @
88500fc1
package
share
.
web
.
controller
.
system
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.BusinessType
;
import
share.common.utils.poi.ExcelUtil
;
import
share.system.domain.Goods
;
import
share.system.service.GoodsService
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 商品Controller
*
* @author wuwenlong
* @date 2024-11-27
*/
@RestController
@RequestMapping
(
"/system/goods"
)
public
class
GoodsController
extends
BaseController
{
@Autowired
private
GoodsService
goodsService
;
/**
* 查询商品列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Goods
goods
)
{
startPage
();
List
<
Goods
>
list
=
goodsService
.
selectGoodsList
(
goods
);
return
getDataTable
(
list
);
}
/**
* 导出商品列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:export')"
)
@Log
(
title
=
"商品"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
Goods
goods
)
{
List
<
Goods
>
list
=
goodsService
.
selectGoodsList
(
goods
);
ExcelUtil
<
Goods
>
util
=
new
ExcelUtil
<
Goods
>(
Goods
.
class
);
util
.
exportExcel
(
response
,
list
,
"商品数据"
);
}
/**
* 获取商品详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:query')"
)
@GetMapping
(
value
=
"/{goodsId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"goodsId"
)
Long
goodsId
)
{
return
success
(
goodsService
.
selectGoodsByGoodsId
(
goodsId
));
}
/**
* 新增商品
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:add')"
)
@Log
(
title
=
"商品"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
Goods
goods
)
{
return
toAjax
(
goodsService
.
insertGoods
(
goods
));
}
/**
* 修改商品
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:edit')"
)
@Log
(
title
=
"商品"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Goods
goods
)
{
return
toAjax
(
goodsService
.
updateGoods
(
goods
));
}
/**
* 删除商品
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:remove')"
)
@Log
(
title
=
"商品"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{goodsIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
goodsIds
)
{
return
toAjax
(
goodsService
.
deleteGoodsByGoodsIds
(
goodsIds
));
}
}
share-admin/src/main/java/share/web/controller/system/MachineController.java
0 → 100644
View file @
88500fc1
package
share
.
web
.
controller
.
system
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.BusinessType
;
import
share.common.utils.poi.ExcelUtil
;
import
share.system.domain.Machine
;
import
share.system.service.MachineService
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 售货机Controller
*
* @author wuwenlong
* @date 2024-11-27
*/
@RestController
@RequestMapping
(
"/system/machine"
)
public
class
MachineController
extends
BaseController
{
@Autowired
private
MachineService
machineService
;
/**
* 查询售货机列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:machine:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Machine
machine
)
{
startPage
();
List
<
Machine
>
list
=
machineService
.
selectMachineList
(
machine
);
return
getDataTable
(
list
);
}
/**
* 导出售货机列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:machine:export')"
)
@Log
(
title
=
"售货机"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
Machine
machine
)
{
List
<
Machine
>
list
=
machineService
.
selectMachineList
(
machine
);
ExcelUtil
<
Machine
>
util
=
new
ExcelUtil
<
Machine
>(
Machine
.
class
);
util
.
exportExcel
(
response
,
list
,
"售货机数据"
);
}
/**
* 获取售货机详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:machine:query')"
)
@GetMapping
(
value
=
"/{machineId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"machineId"
)
Long
machineId
)
{
return
success
(
machineService
.
selectMachineByMachineId
(
machineId
));
}
/**
* 新增售货机
*/
@PreAuthorize
(
"@ss.hasPermi('system:machine:add')"
)
@Log
(
title
=
"售货机"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
Machine
machine
)
{
return
toAjax
(
machineService
.
insertMachine
(
machine
));
}
/**
* 修改售货机
*/
@PreAuthorize
(
"@ss.hasPermi('system:machine:edit')"
)
@Log
(
title
=
"售货机"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Machine
machine
)
{
return
toAjax
(
machineService
.
updateMachine
(
machine
));
}
/**
* 删除售货机
*/
@PreAuthorize
(
"@ss.hasPermi('system:machine:remove')"
)
@Log
(
title
=
"售货机"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{machineIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
machineIds
)
{
return
toAjax
(
machineService
.
deleteMachineByMachineIds
(
machineIds
));
}
}
share-admin/src/main/java/share/web/controller/system/ShelfController.java
0 → 100644
View file @
88500fc1
package
share
.
web
.
controller
.
system
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.BusinessType
;
import
share.common.utils.poi.ExcelUtil
;
import
share.system.domain.Shelf
;
import
share.system.service.ShelfService
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 货道Controller
*
* @author wuwenlong
* @date 2024-11-27
*/
@RestController
@RequestMapping
(
"/system/shelf"
)
public
class
ShelfController
extends
BaseController
{
@Autowired
private
ShelfService
shelfService
;
/**
* 查询货道列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:shelf:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Shelf
shelf
)
{
startPage
();
List
<
Shelf
>
list
=
shelfService
.
selectShelfList
(
shelf
);
return
getDataTable
(
list
);
}
/**
* 导出货道列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:shelf:export')"
)
@Log
(
title
=
"货道"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
Shelf
shelf
)
{
List
<
Shelf
>
list
=
shelfService
.
selectShelfList
(
shelf
);
ExcelUtil
<
Shelf
>
util
=
new
ExcelUtil
<
Shelf
>(
Shelf
.
class
);
util
.
exportExcel
(
response
,
list
,
"货道数据"
);
}
/**
* 获取货道详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:shelf:query')"
)
@GetMapping
(
value
=
"/{shelfIndex}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"shelfIndex"
)
Long
shelfIndex
)
{
return
success
(
shelfService
.
selectShelfByShelfIndex
(
shelfIndex
));
}
/**
* 新增货道
*/
@PreAuthorize
(
"@ss.hasPermi('system:shelf:add')"
)
@Log
(
title
=
"货道"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
Shelf
shelf
)
{
return
toAjax
(
shelfService
.
insertShelf
(
shelf
));
}
/**
* 修改货道
*/
@PreAuthorize
(
"@ss.hasPermi('system:shelf:edit')"
)
@Log
(
title
=
"货道"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Shelf
shelf
)
{
return
toAjax
(
shelfService
.
updateShelf
(
shelf
));
}
/**
* 删除货道
*/
@PreAuthorize
(
"@ss.hasPermi('system:shelf:remove')"
)
@Log
(
title
=
"货道"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{shelfIndexs}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
shelfIndexs
)
{
return
toAjax
(
shelfService
.
deleteShelfByShelfIndexs
(
shelfIndexs
));
}
}
share-admin/src/main/java/share/web/controller/system/VendingMachineController.java
0 → 100644
View file @
88500fc1
package
share
.
web
.
controller
.
system
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.system.domain.Goods
;
import
share.system.domain.Machine
;
import
share.system.domain.Shelf
;
import
share.system.service.VendingMachineSrevice
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/system/vending/machine"
)
public
class
VendingMachineController
{
@Resource
private
VendingMachineSrevice
vendingMachineSrevice
;
@GetMapping
(
"/otherToken"
)
public
void
otherToken
()
{
vendingMachineSrevice
.
otherToken
();
}
@GetMapping
(
"/machineList"
)
public
List
<
Machine
>
machineList
()
{
return
vendingMachineSrevice
.
machineList
();
}
@GetMapping
(
"/goodsList"
)
public
List
<
Goods
>
gooodsList
()
{
return
vendingMachineSrevice
.
gooodsList
();
}
@PostMapping
(
"/goodsAdd"
)
public
String
goodsAdd
(
Goods
goods
)
{
return
vendingMachineSrevice
.
goodsAdd
(
goods
);
}
@PostMapping
(
"/goodsEdit"
)
public
String
goodsEdit
(
Goods
goods
)
{
return
vendingMachineSrevice
.
goodsEdit
(
goods
);
}
@PostMapping
(
"/goodsDelete"
)
public
String
goodsDelete
(
Goods
goods
)
{
return
vendingMachineSrevice
.
goodsDelete
(
goods
);
}
@GetMapping
(
"/shelfList"
)
public
List
<
Shelf
>
shelfList
(
String
machineId
)
{
return
vendingMachineSrevice
.
selectShelfList
(
machineId
);
}
// 设备货道绑定商品
@PostMapping
(
"/shelfEdit"
)
public
void
shelfEdit
(
String
machineId
,
String
shelfId
,
String
goodsId
)
{
vendingMachineSrevice
.
shelfEdit
(
machineId
,
shelfId
,
goodsId
);
}
//商品上架(下发配置)
@PostMapping
(
"/shelfEditList"
)
public
void
shelfEditList
(
String
machineId
,
String
shelffData
)
{
vendingMachineSrevice
.
shelfEditList
(
machineId
,
shelffData
);
}
}
share-common/src/main/java/share/common/constant/VendingMachineConstants.java
0 → 100644
View file @
88500fc1
package
share
.
common
.
constant
;
public
class
VendingMachineConstants
{
//域名
public
static
final
String
DOMAIN
=
"http://vm.ksepton.com"
;
//获取api_token作为凭证访问接⼝
public
static
final
String
OTHER_TOKEN
=
"/api/mall/get.other.token?app_key={}&app_secret={}&version=2.0"
;
//获取设备列表
public
static
final
String
MACHINE_LIST
=
"/api/mall/query.machine.list"
;
//获取商品列表
public
static
final
String
GOODS_LIST
=
"/api/mall/query.goods.list"
;
//商品添加
public
static
final
String
GOODS_ADD
=
"/api/mall/goods.add"
;
//商品修改
public
static
final
String
GOODS_EDIT
=
"/api/mall/goods.edit"
;
//商品删除
public
static
final
String
GOODS_DELETE
=
"/api/mall/goods.del"
;
//获取货道列表
public
static
final
String
SHELF_LIST
=
"/api/mall/query.shelf.list"
;
//设备货道绑定商品
public
static
final
String
SHELF_EDIT
=
"/api/mall/shelf.edit"
;
//商品上架
public
static
final
String
SHELF_EDIT_LIST
=
"/api/mall/shelf.edit.list"
;
//⼆维码⼿机⽀付
public
static
final
String
CODE_PAY
=
"/api/third/code.pay"
;
//⼆维码⽀付
public
static
final
String
CODE_PAYMENT
=
"/api/third/code.payment"
;
//单商品出货
public
static
final
String
PAY_DELIVERY
=
"/api/mall/pay.delivery"
;
//多商品出货
public
static
final
String
PAY_MULTI_DELIVERY_LIST
=
"/api/mall/pay.multi.delivery"
;
//获取设备订单
public
static
final
String
ORDER_LIST
=
"/api/mall/query.order.list"
;
//微信⽀付宝订单出货成功
public
static
final
String
SEND_ORDER
=
"/api/third/send.order"
;
//取货码第三⽅验证
public
static
final
String
PICKUP_CODE_CHECK
=
"/api/third/pickup.code.check"
;
//获取单条订单信息
public
static
final
String
QUERY_PAY_INFO
=
"/api/mall/query.payInfo"
;
}
share-common/src/main/java/share/common/enums/ReceiptRdeisEnum.java
View file @
88500fc1
...
...
@@ -15,7 +15,9 @@ public enum ReceiptRdeisEnum {
ORDER_CANCEL_PAY
(
10
,
"ORDER_CANCEL_PAY."
),
EQUITY_MEMBERS_TIME
(
11
,
"EQUITY_MEMBERS_TIME."
),
MONTHLY_CARD
(
12
,
"MONTHLY_CARD."
),
SECONDARY_CARD
(
13
,
"SECONDARY_CARD."
)
SECONDARY_CARD
(
13
,
"SECONDARY_CARD."
),
MACHINE_TOKEN
(
14
,
"MACHINE_TOKEN"
),
MACHINE_TOKEN_KEY
(
15
,
"MACHINE_TOKEN_KEY"
),
;
...
...
share-common/src/main/java/share/common/enums/VendingMachineEnum.java
0 → 100644
View file @
88500fc1
package
share
.
common
.
enums
;
public
enum
VendingMachineEnum
{
SUCCESS
(
0
,
"成功"
),
//AppKey或appSecret错误
APP_KEY_ERROR
(
10001
,
"AppKey或appSecret错误"
),
//Token失效
TOKEN_ERROR
(
10101
,
"Token失效"
),
//机器不在线
MACHINE_OFFLINE
(
10102
,
"机器不在线"
),
//下发出货失败
DISPENSE_FAIL
(
10103
,
"下发出货失败"
),
//签名错误
SIGN_ERROR
(
10105
,
"签名错误"
),
//订单不存在
ORDER_NOT_EXIST
(
10106
,
"订单不存在"
),
//设备已过期
EXPIRED
(
10107
,
"设备已过期"
),
//没有权限
NO_AUTH
(
10112
,
"没有权限"
),
;
private
Integer
code
;
private
String
msg
;
VendingMachineEnum
()
{
}
VendingMachineEnum
(
Integer
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
share-system/src/main/java/share/system/domain/Goods.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.math.BigDecimal
;
/**
* 商品对象 s_goods
*
* @author wuwenlong
* @date 2024-11-27
*/
@Data
@TableName
(
"s_goods"
)
public
class
Goods
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 商品唯⼀标识
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
goodsId
;
/**
* 运营商
*/
@Excel
(
name
=
"运营商"
)
private
String
accountName
;
/**
* 商品名称
*/
@Excel
(
name
=
"商品名称"
)
private
String
goodsName
;
/**
* 商品图⽚地址
*/
@Excel
(
name
=
"商品图⽚地址"
)
private
String
goodsImg
;
/**
* 商品售价
*/
@Excel
(
name
=
"商品售价"
)
private
BigDecimal
salesPrice
;
/**
* 优惠价
*/
@Excel
(
name
=
"优惠价"
)
private
BigDecimal
costPrice
;
/**
* 是否删除
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField
(
select
=
false
)
private
Long
isDelete
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"goodsId"
,
getGoodsId
())
.
append
(
"accountName"
,
getAccountName
())
.
append
(
"goodsName"
,
getGoodsName
())
.
append
(
"goodsImg"
,
getGoodsImg
())
.
append
(
"salesPrice"
,
getSalesPrice
())
.
append
(
"costPrice"
,
getCostPrice
())
.
append
(
"remark"
,
getRemark
())
.
append
(
"isDelete"
,
getIsDelete
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
toString
();
}
}
share-system/src/main/java/share/system/domain/Machine.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
/**
* 售货机对象 s_machine
*
* @author wuwenlong
* @date 2024-11-27
*/
@Data
@TableName
(
"s_machine"
)
public
class
Machine
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 机器ID
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
machineId
;
/**
* 机器名称
*/
@Excel
(
name
=
"机器名称"
)
private
String
machineName
;
/**
* 版本号
*/
@Excel
(
name
=
"版本号"
)
private
String
version
;
/**
* 是否在线
*/
@Excel
(
name
=
"是否在线"
)
private
String
isOnline
;
/**
* 机器类型
*/
@Excel
(
name
=
"机器类型"
)
private
String
machineType
;
/**
* 货道数量
*/
@Excel
(
name
=
"货道数量"
)
private
Long
shelfCount
;
/**
* 是否停⽤1正常2停⽤
*/
@Excel
(
name
=
"是否停⽤1正常2停⽤"
)
private
Long
status
;
/**
* 运营商
*/
@Excel
(
name
=
"运营商"
)
private
String
accountName
;
/**
* 到期时间
*/
@Excel
(
name
=
"到期时间"
)
private
String
endTime
;
/**
* 经度
*/
@Excel
(
name
=
"经度"
)
private
String
gpsLongitude
;
/**
* 纬度
*/
@Excel
(
name
=
"纬度"
)
private
String
gpsLatitude
;
/**
* 是否删除
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField
(
select
=
false
)
private
Long
isDelete
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"machineId"
,
getMachineId
())
.
append
(
"machineName"
,
getMachineName
())
.
append
(
"version"
,
getVersion
())
.
append
(
"isOnline"
,
getIsOnline
())
.
append
(
"machineType"
,
getMachineType
())
.
append
(
"shelfCount"
,
getShelfCount
())
.
append
(
"status"
,
getStatus
())
.
append
(
"accountName"
,
getAccountName
())
.
append
(
"endTime"
,
getEndTime
())
.
append
(
"gpsLongitude"
,
getGpsLongitude
())
.
append
(
"gpsLatitude"
,
getGpsLatitude
())
.
append
(
"isDelete"
,
getIsDelete
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
share-system/src/main/java/share/system/domain/Shelf.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.math.BigDecimal
;
/**
* 货道对象 s_shelf
*
* @author wuwenlong
* @date 2024-11-27
*/
@Data
@TableName
(
"s_shelf"
)
public
class
Shelf
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 货道号
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
shelfIndex
;
/**
* 库存
*/
@Excel
(
name
=
"库存"
)
private
Long
stock
;
/**
* 容量
*/
@Excel
(
name
=
"容量"
)
private
Long
maxStock
;
/**
* 是否损坏0正常,1损坏
*/
@Excel
(
name
=
"是否损坏0正常,1损坏"
)
private
Long
isBroken
;
/**
* 机器号
*/
@Excel
(
name
=
"机器号"
)
private
Long
machineId
;
/**
* 商品唯⼀编号
*/
@Excel
(
name
=
"商品唯⼀编号"
)
private
Long
goodsId
;
/**
* 价格
*/
@Excel
(
name
=
"价格"
)
private
BigDecimal
price
;
/**
* 优惠后价格
*/
@Excel
(
name
=
"优惠后价格"
)
private
BigDecimal
couponPrice
;
/**
* 是否删除
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField
(
select
=
false
)
private
Long
isDelete
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"shelfIndex"
,
getShelfIndex
())
.
append
(
"stock"
,
getStock
())
.
append
(
"maxStock"
,
getMaxStock
())
.
append
(
"isBroken"
,
getIsBroken
())
.
append
(
"machineId"
,
getMachineId
())
.
append
(
"goodsId"
,
getGoodsId
())
.
append
(
"price"
,
getPrice
())
.
append
(
"couponPrice"
,
getCouponPrice
())
.
append
(
"isDelete"
,
getIsDelete
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
share-system/src/main/java/share/system/mapper/GoodsMapper.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.Goods
;
import
java.util.List
;
/**
* 商品Mapper接口
*
* @author wuwenlong
* @date 2024-11-27
*/
public
interface
GoodsMapper
extends
BaseMapper
<
Goods
>
{
/**
* 查询商品
*
* @param goodsId 商品主键
* @return 商品
*/
public
Goods
selectGoodsByGoodsId
(
Long
goodsId
);
/**
* 查询商品列表
*
* @param goods 商品
* @return 商品集合
*/
public
List
<
Goods
>
selectGoodsList
(
Goods
goods
);
/**
* 新增商品
*
* @param goods 商品
* @return 结果
*/
public
int
insertGoods
(
Goods
goods
);
/**
* 修改商品
*
* @param goods 商品
* @return 结果
*/
public
int
updateGoods
(
Goods
goods
);
/**
* 删除商品
*
* @param goodsId 商品主键
* @return 结果
*/
public
int
deleteGoodsByGoodsId
(
Long
goodsId
);
/**
* 批量删除商品
*
* @param goodsIds 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteGoodsByGoodsIds
(
Long
[]
goodsIds
);
}
share-system/src/main/java/share/system/mapper/MachineMapper.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.Machine
;
import
java.util.List
;
/**
* 售货机Mapper接口
*
* @author wuwenlong
* @date 2024-11-27
*/
public
interface
MachineMapper
extends
BaseMapper
<
Machine
>
{
/**
* 查询售货机
*
* @param machineId 售货机主键
* @return 售货机
*/
public
Machine
selectMachineByMachineId
(
Long
machineId
);
/**
* 查询售货机列表
*
* @param machine 售货机
* @return 售货机集合
*/
public
List
<
Machine
>
selectMachineList
(
Machine
machine
);
/**
* 新增售货机
*
* @param machine 售货机
* @return 结果
*/
public
int
insertMachine
(
Machine
machine
);
/**
* 修改售货机
*
* @param machine 售货机
* @return 结果
*/
public
int
updateMachine
(
Machine
machine
);
/**
* 删除售货机
*
* @param machineId 售货机主键
* @return 结果
*/
public
int
deleteMachineByMachineId
(
Long
machineId
);
/**
* 批量删除售货机
*
* @param machineIds 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteMachineByMachineIds
(
Long
[]
machineIds
);
}
share-system/src/main/java/share/system/mapper/ShelfMapper.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.Shelf
;
import
java.util.List
;
/**
* 货道Mapper接口
*
* @author wuwenlong
* @date 2024-11-27
*/
public
interface
ShelfMapper
extends
BaseMapper
<
Shelf
>
{
/**
* 查询货道
*
* @param shelfIndex 货道主键
* @return 货道
*/
public
Shelf
selectShelfByShelfIndex
(
Long
shelfIndex
);
/**
* 查询货道列表
*
* @param shelf 货道
* @return 货道集合
*/
public
List
<
Shelf
>
selectShelfList
(
Shelf
shelf
);
/**
* 新增货道
*
* @param shelf 货道
* @return 结果
*/
public
int
insertShelf
(
Shelf
shelf
);
/**
* 修改货道
*
* @param shelf 货道
* @return 结果
*/
public
int
updateShelf
(
Shelf
shelf
);
/**
* 删除货道
*
* @param shelfIndex 货道主键
* @return 结果
*/
public
int
deleteShelfByShelfIndex
(
Long
shelfIndex
);
/**
* 批量删除货道
*
* @param shelfIndexs 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteShelfByShelfIndexs
(
Long
[]
shelfIndexs
);
}
share-system/src/main/java/share/system/service/GoodsService.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.Goods
;
import
java.util.List
;
/**
* 商品Service接口
*
* @author wuwenlong
* @date 2024-11-27
*/
public
interface
GoodsService
extends
IService
<
Goods
>
{
/**
* 查询商品
*
* @param goodsId 商品主键
* @return 商品
*/
public
Goods
selectGoodsByGoodsId
(
Long
goodsId
);
/**
* 查询商品列表
*
* @param goods 商品
* @return 商品集合
*/
public
List
<
Goods
>
selectGoodsList
(
Goods
goods
);
/**
* 新增商品
*
* @param goods 商品
* @return 结果
*/
public
int
insertGoods
(
Goods
goods
);
/**
* 修改商品
*
* @param goods 商品
* @return 结果
*/
public
int
updateGoods
(
Goods
goods
);
/**
* 批量删除商品
*
* @param goodsIds 需要删除的商品主键集合
* @return 结果
*/
public
int
deleteGoodsByGoodsIds
(
Long
[]
goodsIds
);
/**
* 删除商品信息
*
* @param goodsId 商品主键
* @return 结果
*/
public
int
deleteGoodsByGoodsId
(
Long
goodsId
);
}
share-system/src/main/java/share/system/service/MachineService.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.Machine
;
import
java.util.List
;
/**
* 售货机Service接口
*
* @author wuwenlong
* @date 2024-11-27
*/
public
interface
MachineService
extends
IService
<
Machine
>
{
/**
* 查询售货机
*
* @param machineId 售货机主键
* @return 售货机
*/
public
Machine
selectMachineByMachineId
(
Long
machineId
);
/**
* 查询售货机列表
*
* @param machine 售货机
* @return 售货机集合
*/
public
List
<
Machine
>
selectMachineList
(
Machine
machine
);
/**
* 新增售货机
*
* @param machine 售货机
* @return 结果
*/
public
int
insertMachine
(
Machine
machine
);
/**
* 修改售货机
*
* @param machine 售货机
* @return 结果
*/
public
int
updateMachine
(
Machine
machine
);
/**
* 批量删除售货机
*
* @param machineIds 需要删除的售货机主键集合
* @return 结果
*/
public
int
deleteMachineByMachineIds
(
Long
[]
machineIds
);
/**
* 删除售货机信息
*
* @param machineId 售货机主键
* @return 结果
*/
public
int
deleteMachineByMachineId
(
Long
machineId
);
}
share-system/src/main/java/share/system/service/ShelfService.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.Shelf
;
import
java.util.List
;
/**
* 货道Service接口
*
* @author wuwenlong
* @date 2024-11-27
*/
public
interface
ShelfService
extends
IService
<
Shelf
>
{
/**
* 查询货道
*
* @param shelfIndex 货道主键
* @return 货道
*/
public
Shelf
selectShelfByShelfIndex
(
Long
shelfIndex
);
/**
* 查询货道列表
*
* @param shelf 货道
* @return 货道集合
*/
public
List
<
Shelf
>
selectShelfList
(
Shelf
shelf
);
/**
* 新增货道
*
* @param shelf 货道
* @return 结果
*/
public
int
insertShelf
(
Shelf
shelf
);
/**
* 修改货道
*
* @param shelf 货道
* @return 结果
*/
public
int
updateShelf
(
Shelf
shelf
);
/**
* 批量删除货道
*
* @param shelfIndexs 需要删除的货道主键集合
* @return 结果
*/
public
int
deleteShelfByShelfIndexs
(
Long
[]
shelfIndexs
);
/**
* 删除货道信息
*
* @param shelfIndex 货道主键
* @return 结果
*/
public
int
deleteShelfByShelfIndex
(
Long
shelfIndex
);
}
share-system/src/main/java/share/system/service/VendingMachineSrevice.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
service
;
import
share.system.domain.Goods
;
import
share.system.domain.Machine
;
import
share.system.domain.Shelf
;
import
java.util.List
;
public
interface
VendingMachineSrevice
{
void
otherToken
();
List
<
Machine
>
machineList
();
List
<
Goods
>
gooodsList
();
String
goodsAdd
(
Goods
goods
);
String
goodsEdit
(
Goods
goods
);
String
goodsDelete
(
Goods
goods
);
List
<
Shelf
>
selectShelfList
(
String
machineId
);
void
shelfEdit
(
String
machineId
,
String
shelfId
,
String
goodsId
);
void
shelfEditList
(
String
machineId
,
String
shelffData
);
}
share-system/src/main/java/share/system/service/impl/GoodsServiceImpl.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.DateUtils
;
import
share.system.domain.Goods
;
import
share.system.mapper.GoodsMapper
;
import
share.system.service.GoodsService
;
import
java.util.List
;
/**
* 商品Service业务层处理
*
* @author wuwenlong
* @date 2024-11-27
*/
@Service
public
class
GoodsServiceImpl
extends
ServiceImpl
<
GoodsMapper
,
Goods
>
implements
GoodsService
{
@Autowired
private
GoodsMapper
goodsMapper
;
/**
* 查询商品
*
* @param goodsId 商品主键
* @return 商品
*/
@Override
public
Goods
selectGoodsByGoodsId
(
Long
goodsId
)
{
return
goodsMapper
.
selectGoodsByGoodsId
(
goodsId
);
}
/**
* 查询商品列表
*
* @param goods 商品
* @return 商品
*/
@Override
public
List
<
Goods
>
selectGoodsList
(
Goods
goods
)
{
return
goodsMapper
.
selectGoodsList
(
goods
);
}
/**
* 新增商品
*
* @param goods 商品
* @return 结果
*/
@Override
public
int
insertGoods
(
Goods
goods
)
{
goods
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
goodsMapper
.
insertGoods
(
goods
);
}
/**
* 修改商品
*
* @param goods 商品
* @return 结果
*/
@Override
public
int
updateGoods
(
Goods
goods
)
{
goods
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
goodsMapper
.
updateGoods
(
goods
);
}
/**
* 批量删除商品
*
* @param goodsIds 需要删除的商品主键
* @return 结果
*/
@Override
public
int
deleteGoodsByGoodsIds
(
Long
[]
goodsIds
)
{
return
goodsMapper
.
deleteGoodsByGoodsIds
(
goodsIds
);
}
/**
* 删除商品信息
*
* @param goodsId 商品主键
* @return 结果
*/
@Override
public
int
deleteGoodsByGoodsId
(
Long
goodsId
)
{
return
goodsMapper
.
deleteGoodsByGoodsId
(
goodsId
);
}
}
share-system/src/main/java/share/system/service/impl/MachineServiceImpl.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.DateUtils
;
import
share.system.domain.Machine
;
import
share.system.mapper.MachineMapper
;
import
share.system.service.MachineService
;
import
java.util.List
;
/**
* 售货机Service业务层处理
*
* @author wuwenlong
* @date 2024-11-27
*/
@Service
public
class
MachineServiceImpl
extends
ServiceImpl
<
MachineMapper
,
Machine
>
implements
MachineService
{
@Autowired
private
MachineMapper
machineMapper
;
/**
* 查询售货机
*
* @param machineId 售货机主键
* @return 售货机
*/
@Override
public
Machine
selectMachineByMachineId
(
Long
machineId
)
{
return
machineMapper
.
selectMachineByMachineId
(
machineId
);
}
/**
* 查询售货机列表
*
* @param machine 售货机
* @return 售货机
*/
@Override
public
List
<
Machine
>
selectMachineList
(
Machine
machine
)
{
return
machineMapper
.
selectMachineList
(
machine
);
}
/**
* 新增售货机
*
* @param machine 售货机
* @return 结果
*/
@Override
public
int
insertMachine
(
Machine
machine
)
{
machine
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
machineMapper
.
insertMachine
(
machine
);
}
/**
* 修改售货机
*
* @param machine 售货机
* @return 结果
*/
@Override
public
int
updateMachine
(
Machine
machine
)
{
machine
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
machineMapper
.
updateMachine
(
machine
);
}
/**
* 批量删除售货机
*
* @param machineIds 需要删除的售货机主键
* @return 结果
*/
@Override
public
int
deleteMachineByMachineIds
(
Long
[]
machineIds
)
{
return
machineMapper
.
deleteMachineByMachineIds
(
machineIds
);
}
/**
* 删除售货机信息
*
* @param machineId 售货机主键
* @return 结果
*/
@Override
public
int
deleteMachineByMachineId
(
Long
machineId
)
{
return
machineMapper
.
deleteMachineByMachineId
(
machineId
);
}
}
share-system/src/main/java/share/system/service/impl/ShelfServiceImpl.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.DateUtils
;
import
share.system.domain.Shelf
;
import
share.system.mapper.ShelfMapper
;
import
share.system.service.ShelfService
;
import
java.util.List
;
/**
* 货道Service业务层处理
*
* @author wuwenlong
* @date 2024-11-27
*/
@Service
public
class
ShelfServiceImpl
extends
ServiceImpl
<
ShelfMapper
,
Shelf
>
implements
ShelfService
{
@Autowired
private
ShelfMapper
shelfMapper
;
/**
* 查询货道
*
* @param shelfIndex 货道主键
* @return 货道
*/
@Override
public
Shelf
selectShelfByShelfIndex
(
Long
shelfIndex
)
{
return
shelfMapper
.
selectShelfByShelfIndex
(
shelfIndex
);
}
/**
* 查询货道列表
*
* @param shelf 货道
* @return 货道
*/
@Override
public
List
<
Shelf
>
selectShelfList
(
Shelf
shelf
)
{
return
shelfMapper
.
selectShelfList
(
shelf
);
}
/**
* 新增货道
*
* @param shelf 货道
* @return 结果
*/
@Override
public
int
insertShelf
(
Shelf
shelf
)
{
shelf
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
shelfMapper
.
insertShelf
(
shelf
);
}
/**
* 修改货道
*
* @param shelf 货道
* @return 结果
*/
@Override
public
int
updateShelf
(
Shelf
shelf
)
{
shelf
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
shelfMapper
.
updateShelf
(
shelf
);
}
/**
* 批量删除货道
*
* @param shelfIndexs 需要删除的货道主键
* @return 结果
*/
@Override
public
int
deleteShelfByShelfIndexs
(
Long
[]
shelfIndexs
)
{
return
shelfMapper
.
deleteShelfByShelfIndexs
(
shelfIndexs
);
}
/**
* 删除货道信息
*
* @param shelfIndex 货道主键
* @return 结果
*/
@Override
public
int
deleteShelfByShelfIndex
(
Long
shelfIndex
)
{
return
shelfMapper
.
deleteShelfByShelfIndex
(
shelfIndex
);
}
}
share-system/src/main/java/share/system/service/impl/VendingMachineSreviceImpl.java
0 → 100644
View file @
88500fc1
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.constant.VendingMachineConstants
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.StringUtils
;
import
share.common.utils.http.RestTemplateUtil
;
import
share.system.domain.Goods
;
import
share.system.domain.Machine
;
import
share.system.domain.Shelf
;
import
share.system.service.VendingMachineSrevice
;
import
java.net.URLEncoder
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
@Service
public
class
VendingMachineSreviceImpl
implements
VendingMachineSrevice
{
@Autowired
private
RestTemplateUtil
restTemplateUtil
;
@Autowired
private
RedisUtil
redisUtil
;
// @Value("${machine.appSecret}")
private
String
APP_SECRET
;
// @Value("${machine.appKey}")
private
String
APP_KEY
;
@Override
public
void
otherToken
()
{
String
url
=
StrUtil
.
format
(
VendingMachineConstants
.
DOMAIN
+
VendingMachineConstants
.
OTHER_TOKEN
,
APP_KEY
,
APP_SECRET
);
JSONObject
post
=
restTemplateUtil
.
post
(
url
);
if
(
ObjectUtil
.
isNull
(
post
))
{
throw
new
BaseException
(
"售货机平台接口异常,没任何数据返回!"
);
}
if
(
post
.
containsKey
(
"code"
)
&&
post
.
getString
(
"code"
).
equals
(
"0"
))
{
String
accessToken
=
post
.
getString
(
"api_token"
);
String
expiresIn
=
post
.
getString
(
"expires_in"
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"accessToken"
,
accessToken
);
map
.
put
(
"expiresIn"
,
expiresIn
);
//当前时间加上过期时间(秒) 在转为年月日日时分秒
long
time
=
System
.
currentTimeMillis
()
+
Long
.
parseLong
(
expiresIn
);
Date
date
=
new
Date
(
time
);
String
expiresTime
=
DateUtil
.
format
(
date
,
DatePattern
.
NORM_DATETIME_PATTERN
);
map
.
put
(
"expiresTime"
,
expiresTime
);
cn
.
hutool
.
json
.
JSONObject
jsonObject
=
new
cn
.
hutool
.
json
.
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
MACHINE_TOKEN
.
getValue
(),
jsonObject
.
toString
(),
Long
.
parseLong
(
expiresIn
)
-
1800L
,
TimeUnit
.
SECONDS
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
MACHINE_TOKEN_KEY
.
getValue
(),
jsonObject
.
toString
());
}
}
@Override
public
List
<
Machine
>
machineList
()
{
return
Collections
.
emptyList
();
}
@Override
public
List
<
Goods
>
gooodsList
()
{
return
Collections
.
emptyList
();
}
@Override
public
String
goodsAdd
(
Goods
goods
)
{
return
""
;
}
@Override
public
String
goodsEdit
(
Goods
goods
)
{
return
""
;
}
@Override
public
String
goodsDelete
(
Goods
goods
)
{
return
""
;
}
@Override
public
List
<
Shelf
>
selectShelfList
(
String
machineId
)
{
return
Collections
.
emptyList
();
}
@Override
public
void
shelfEdit
(
String
machineId
,
String
shelfId
,
String
goodsId
)
{
}
@Override
public
void
shelfEditList
(
String
machineId
,
String
shelffData
)
{
}
/**
* 对所有传⼊参数按照字段名的 ASCII 码从⼩到⼤排序(字典序),并且⽣成url参数串
*
* @param paraMap 要排序的Map对象
* @param urlEncode 是否需要URLENCODE
* @param keyToLower 是否需要将Key转换为全⼩写(true:key转化成⼩写,false:不转
* 化)
* @return
*/
public
String
formatBizQueryParaMap
(
Map
<
String
,
String
>
paraMap
,
boolean
urlEncode
,
boolean
keyToLower
)
{
String
buff
=
""
;
Map
<
String
,
String
>
tmpMap
=
paraMap
;
try
{
List
<
Map
.
Entry
<
String
,
String
>>
infoIds
=
new
ArrayList
<>(
tmpMap
.
entrySet
());
Collections
.
sort
(
infoIds
,
Comparator
.
comparing
(
Map
.
Entry
::
getKey
));
StringBuilder
buf
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
String
>
item
:
infoIds
)
{
if
(
StringUtils
.
isNotEmpty
(
item
.
getKey
())
&&
StringUtils
.
isNotEmpty
(
item
.
getValue
()))
{
String
key
=
item
.
getKey
();
String
val
=
item
.
getValue
();
if
(
urlEncode
)
{
val
=
URLEncoder
.
encode
(
val
,
"utf-8"
);
}
if
(
keyToLower
)
{
buf
.
append
(
key
.
toLowerCase
()
+
"="
+
val
);
}
else
{
buf
.
append
(
key
+
"="
+
val
);
}
buf
.
append
(
"&"
);
}
}
buff
=
buf
.
toString
();
if
(!
buff
.
isEmpty
())
{
buff
=
buff
.
substring
(
0
,
buff
.
length
()
-
1
);
}
return
buff
;
}
catch
(
Exception
e
)
{
return
null
;
}
}
}
share-system/src/main/resources/mapper/system/GoodsMapper.xml
0 → 100644
View file @
88500fc1
<?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=
"share.system.mapper.GoodsMapper"
>
<resultMap
type=
"Goods"
id=
"GoodsResult"
>
<result
property=
"goodsId"
column=
"goods_id"
/>
<result
property=
"accountName"
column=
"account_name"
/>
<result
property=
"goodsName"
column=
"goods_name"
/>
<result
property=
"goodsImg"
column=
"goods_img"
/>
<result
property=
"salesPrice"
column=
"sales_price"
/>
<result
property=
"costPrice"
column=
"cost_price"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<sql
id=
"selectGoodsVo"
>
select goods_id,
account_name,
goods_name,
goods_img,
sales_price,
cost_price,
remark,
is_delete,
create_by,
create_time,
update_by,
update_time
from s_goods
</sql>
<select
id=
"selectGoodsList"
parameterType=
"Goods"
resultMap=
"GoodsResult"
>
<include
refid=
"selectGoodsVo"
/>
<where>
<if
test=
"accountName != null and accountName != ''"
>
and account_name like concat('%', #{accountName},
'%')
</if>
<if
test=
"goodsName != null and goodsName != ''"
>
and goods_name like concat('%', #{goodsName}, '%')
</if>
<if
test=
"goodsImg != null and goodsImg != ''"
>
and goods_img = #{goodsImg}
</if>
<if
test=
"salesPrice != null "
>
and sales_price = #{salesPrice}
</if>
<if
test=
"costPrice != null "
>
and cost_price = #{costPrice}
</if>
<if
test=
"isDelete != null "
>
and is_delete = #{isDelete}
</if>
</where>
</select>
<select
id=
"selectGoodsByGoodsId"
parameterType=
"Long"
resultMap=
"GoodsResult"
>
<include
refid=
"selectGoodsVo"
/>
where goods_id = #{goodsId}
</select>
<insert
id=
"insertGoods"
parameterType=
"Goods"
useGeneratedKeys=
"true"
keyProperty=
"goodsId"
>
insert into s_goods
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"accountName != null"
>
account_name,
</if>
<if
test=
"goodsName != null"
>
goods_name,
</if>
<if
test=
"goodsImg != null"
>
goods_img,
</if>
<if
test=
"salesPrice != null"
>
sales_price,
</if>
<if
test=
"costPrice != null"
>
cost_price,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"accountName != null"
>
#{accountName},
</if>
<if
test=
"goodsName != null"
>
#{goodsName},
</if>
<if
test=
"goodsImg != null"
>
#{goodsImg},
</if>
<if
test=
"salesPrice != null"
>
#{salesPrice},
</if>
<if
test=
"costPrice != null"
>
#{costPrice},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
</trim>
</insert>
<update
id=
"updateGoods"
parameterType=
"Goods"
>
update s_goods
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"accountName != null"
>
account_name = #{accountName},
</if>
<if
test=
"goodsName != null"
>
goods_name = #{goodsName},
</if>
<if
test=
"goodsImg != null"
>
goods_img = #{goodsImg},
</if>
<if
test=
"salesPrice != null"
>
sales_price = #{salesPrice},
</if>
<if
test=
"costPrice != null"
>
cost_price = #{costPrice},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
</trim>
where goods_id = #{goodsId}
</update>
<delete
id=
"deleteGoodsByGoodsId"
parameterType=
"Long"
>
delete
from s_goods
where goods_id = #{goodsId}
</delete>
<delete
id=
"deleteGoodsByGoodsIds"
parameterType=
"String"
>
delete from s_goods where goods_id in
<foreach
item=
"goodsId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{goodsId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
share-system/src/main/resources/mapper/system/MachineMapper.xml
0 → 100644
View file @
88500fc1
<?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=
"share.system.mapper.MachineMapper"
>
<resultMap
type=
"Machine"
id=
"MachineResult"
>
<result
property=
"machineId"
column=
"machine_id"
/>
<result
property=
"machineName"
column=
"machine_name"
/>
<result
property=
"version"
column=
"version"
/>
<result
property=
"isOnline"
column=
"is_online"
/>
<result
property=
"machineType"
column=
"machine_type"
/>
<result
property=
"shelfCount"
column=
"shelf_count"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"accountName"
column=
"account_name"
/>
<result
property=
"endTime"
column=
"end_time"
/>
<result
property=
"gpsLongitude"
column=
"gps_longitude"
/>
<result
property=
"gpsLatitude"
column=
"gps_latitude"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
</resultMap>
<sql
id=
"selectMachineVo"
>
select machine_id,
machine_name,
version,
is_online,
machine_type,
shelf_count,
status,
account_name,
end_time,
gps_longitude,
gps_latitude,
is_delete,
create_by,
create_time,
update_by,
update_time,
remark
from s_machine
</sql>
<select
id=
"selectMachineList"
parameterType=
"Machine"
resultMap=
"MachineResult"
>
<include
refid=
"selectMachineVo"
/>
<where>
<if
test=
"machineName != null and machineName != ''"
>
and machine_name like concat('%', #{machineName},
'%')
</if>
<if
test=
"version != null and version != ''"
>
and version = #{version}
</if>
<if
test=
"isOnline != null and isOnline != ''"
>
and is_online = #{isOnline}
</if>
<if
test=
"machineType != null and machineType != ''"
>
and machine_type = #{machineType}
</if>
<if
test=
"shelfCount != null "
>
and shelf_count = #{shelfCount}
</if>
<if
test=
"status != null "
>
and status = #{status}
</if>
<if
test=
"accountName != null and accountName != ''"
>
and account_name like concat('%', #{accountName},
'%')
</if>
<if
test=
"endTime != null and endTime != ''"
>
and end_time = #{endTime}
</if>
<if
test=
"gpsLongitude != null and gpsLongitude != ''"
>
and gps_longitude = #{gpsLongitude}
</if>
<if
test=
"gpsLatitude != null and gpsLatitude != ''"
>
and gps_latitude = #{gpsLatitude}
</if>
<if
test=
"isDelete != null "
>
and is_delete = #{isDelete}
</if>
</where>
</select>
<select
id=
"selectMachineByMachineId"
parameterType=
"Long"
resultMap=
"MachineResult"
>
<include
refid=
"selectMachineVo"
/>
where machine_id = #{machineId}
</select>
<insert
id=
"insertMachine"
parameterType=
"Machine"
useGeneratedKeys=
"true"
keyProperty=
"machineId"
>
insert into s_machine
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"machineName != null"
>
machine_name,
</if>
<if
test=
"version != null"
>
version,
</if>
<if
test=
"isOnline != null"
>
is_online,
</if>
<if
test=
"machineType != null"
>
machine_type,
</if>
<if
test=
"shelfCount != null"
>
shelf_count,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"accountName != null"
>
account_name,
</if>
<if
test=
"endTime != null"
>
end_time,
</if>
<if
test=
"gpsLongitude != null"
>
gps_longitude,
</if>
<if
test=
"gpsLatitude != null"
>
gps_latitude,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"machineName != null"
>
#{machineName},
</if>
<if
test=
"version != null"
>
#{version},
</if>
<if
test=
"isOnline != null"
>
#{isOnline},
</if>
<if
test=
"machineType != null"
>
#{machineType},
</if>
<if
test=
"shelfCount != null"
>
#{shelfCount},
</if>
<if
test=
"status != null"
>
#{status},
</if>
<if
test=
"accountName != null"
>
#{accountName},
</if>
<if
test=
"endTime != null"
>
#{endTime},
</if>
<if
test=
"gpsLongitude != null"
>
#{gpsLongitude},
</if>
<if
test=
"gpsLatitude != null"
>
#{gpsLatitude},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
</trim>
</insert>
<update
id=
"updateMachine"
parameterType=
"Machine"
>
update s_machine
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"machineName != null"
>
machine_name = #{machineName},
</if>
<if
test=
"version != null"
>
version = #{version},
</if>
<if
test=
"isOnline != null"
>
is_online = #{isOnline},
</if>
<if
test=
"machineType != null"
>
machine_type = #{machineType},
</if>
<if
test=
"shelfCount != null"
>
shelf_count = #{shelfCount},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"accountName != null"
>
account_name = #{accountName},
</if>
<if
test=
"endTime != null"
>
end_time = #{endTime},
</if>
<if
test=
"gpsLongitude != null"
>
gps_longitude = #{gpsLongitude},
</if>
<if
test=
"gpsLatitude != null"
>
gps_latitude = #{gpsLatitude},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
</trim>
where machine_id = #{machineId}
</update>
<delete
id=
"deleteMachineByMachineId"
parameterType=
"Long"
>
delete
from s_machine
where machine_id = #{machineId}
</delete>
<delete
id=
"deleteMachineByMachineIds"
parameterType=
"String"
>
delete from s_machine where machine_id in
<foreach
item=
"machineId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{machineId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
share-system/src/main/resources/mapper/system/ShelfMapper.xml
0 → 100644
View file @
88500fc1
<?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=
"share.system.mapper.ShelfMapper"
>
<resultMap
type=
"Shelf"
id=
"ShelfResult"
>
<result
property=
"shelfIndex"
column=
"shelf_index"
/>
<result
property=
"stock"
column=
"stock"
/>
<result
property=
"maxStock"
column=
"max_stock"
/>
<result
property=
"isBroken"
column=
"is_broken"
/>
<result
property=
"machineId"
column=
"machine_id"
/>
<result
property=
"goodsId"
column=
"goods_id"
/>
<result
property=
"price"
column=
"price"
/>
<result
property=
"couponPrice"
column=
"coupon_price"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
</resultMap>
<sql
id=
"selectShelfVo"
>
select shelf_index,
stock,
max_stock,
is_broken,
machine_id,
goods_id,
price,
coupon_price,
is_delete,
create_by,
create_time,
update_by,
update_time,
remark
from s_shelf
</sql>
<select
id=
"selectShelfList"
parameterType=
"Shelf"
resultMap=
"ShelfResult"
>
<include
refid=
"selectShelfVo"
/>
<where>
<if
test=
"stock != null "
>
and stock = #{stock}
</if>
<if
test=
"maxStock != null "
>
and max_stock = #{maxStock}
</if>
<if
test=
"isBroken != null "
>
and is_broken = #{isBroken}
</if>
<if
test=
"machineId != null "
>
and machine_id = #{machineId}
</if>
<if
test=
"goodsId != null "
>
and goods_id = #{goodsId}
</if>
<if
test=
"price != null "
>
and price = #{price}
</if>
<if
test=
"couponPrice != null "
>
and coupon_price = #{couponPrice}
</if>
<if
test=
"isDelete != null "
>
and is_delete = #{isDelete}
</if>
</where>
</select>
<select
id=
"selectShelfByShelfIndex"
parameterType=
"Long"
resultMap=
"ShelfResult"
>
<include
refid=
"selectShelfVo"
/>
where shelf_index = #{shelfIndex}
</select>
<insert
id=
"insertShelf"
parameterType=
"Shelf"
useGeneratedKeys=
"true"
keyProperty=
"shelfIndex"
>
insert into s_shelf
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"stock != null"
>
stock,
</if>
<if
test=
"maxStock != null"
>
max_stock,
</if>
<if
test=
"isBroken != null"
>
is_broken,
</if>
<if
test=
"machineId != null"
>
machine_id,
</if>
<if
test=
"goodsId != null"
>
goods_id,
</if>
<if
test=
"price != null"
>
price,
</if>
<if
test=
"couponPrice != null"
>
coupon_price,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"stock != null"
>
#{stock},
</if>
<if
test=
"maxStock != null"
>
#{maxStock},
</if>
<if
test=
"isBroken != null"
>
#{isBroken},
</if>
<if
test=
"machineId != null"
>
#{machineId},
</if>
<if
test=
"goodsId != null"
>
#{goodsId},
</if>
<if
test=
"price != null"
>
#{price},
</if>
<if
test=
"couponPrice != null"
>
#{couponPrice},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
</trim>
</insert>
<update
id=
"updateShelf"
parameterType=
"Shelf"
>
update s_shelf
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"stock != null"
>
stock = #{stock},
</if>
<if
test=
"maxStock != null"
>
max_stock = #{maxStock},
</if>
<if
test=
"isBroken != null"
>
is_broken = #{isBroken},
</if>
<if
test=
"machineId != null"
>
machine_id = #{machineId},
</if>
<if
test=
"goodsId != null"
>
goods_id = #{goodsId},
</if>
<if
test=
"price != null"
>
price = #{price},
</if>
<if
test=
"couponPrice != null"
>
coupon_price = #{couponPrice},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
</trim>
where shelf_index = #{shelfIndex}
</update>
<delete
id=
"deleteShelfByShelfIndex"
parameterType=
"Long"
>
delete
from s_shelf
where shelf_index = #{shelfIndex}
</delete>
<delete
id=
"deleteShelfByShelfIndexs"
parameterType=
"String"
>
delete from s_shelf where shelf_index in
<foreach
item=
"shelfIndex"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{shelfIndex}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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