Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
ba4a36e5
Commit
ba4a36e5
authored
Jul 04, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
7.04 登出接口
parent
10655e8b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
194 additions
and
89 deletions
+194
-89
base-module/src/main/java/com/gingersoft/gsa/cloud/ui/bean/mode/BrandsBean.java
+109
-0
login-module/src/main/java/com/gingersoft/gsa/cloud/login/mvp/server/LoginService.java
+0
-5
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/model/service/MainService.java
+2
-1
print-module/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
+83
-83
No files found.
base-module/src/main/java/com/gingersoft/gsa/cloud/ui/bean/mode/BrandsBean.java
0 → 100644
View file @
ba4a36e5
package
com
.
gingersoft
.
gsa
.
cloud
.
ui
.
bean
.
mode
;
import
java.util.List
;
public
class
BrandsBean
{
private
boolean
success
;
private
long
sysTime
;
private
List
<
BrandsData
>
data
;
public
class
BrandsData
{
/**
* brandId : 242
* brandName : 莫拉塔
* restaurants : []
*/
private
int
brandId
;
private
String
brandName
;
private
List
<
RestaurantsBean
>
restaurants
;
public
int
getBrandId
()
{
return
brandId
;
}
public
void
setBrandId
(
int
brandId
)
{
this
.
brandId
=
brandId
;
}
public
String
getBrandName
()
{
return
brandName
;
}
public
void
setBrandName
(
String
brandName
)
{
this
.
brandName
=
brandName
;
}
public
List
<
RestaurantsBean
>
getRestaurants
()
{
return
restaurants
;
}
public
void
setRestaurants
(
List
<
RestaurantsBean
>
restaurants
)
{
this
.
restaurants
=
restaurants
;
}
public
class
RestaurantsBean
{
private
int
restaurantId
;
private
String
restaurantName
;
public
int
getRestaurantId
()
{
return
restaurantId
;
}
public
void
setRestaurantId
(
int
restaurantId
)
{
this
.
restaurantId
=
restaurantId
;
}
public
String
getRestaurantName
()
{
return
restaurantName
;
}
public
void
setRestaurantName
(
String
restaurantName
)
{
this
.
restaurantName
=
restaurantName
;
}
@Override
public
String
toString
()
{
return
"RestaurantsBean{"
+
"restaurantId="
+
restaurantId
+
", restaurantName='"
+
restaurantName
+
'\''
+
'}'
;
}
}
@Override
public
String
toString
()
{
return
"BrandsBean{"
+
"brandId="
+
brandId
+
", brandName='"
+
brandName
+
'\''
+
", restaurants="
+
restaurants
+
'}'
;
}
}
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
public
long
getSysTime
()
{
return
sysTime
;
}
public
void
setSysTime
(
long
sysTime
)
{
this
.
sysTime
=
sysTime
;
}
public
List
<
BrandsData
>
getData
()
{
return
data
;
}
public
void
setData
(
List
<
BrandsData
>
data
)
{
this
.
data
=
data
;
}
}
login-module/src/main/java/com/gingersoft/gsa/cloud/login/mvp/server/LoginService.java
View file @
ba4a36e5
...
@@ -24,11 +24,6 @@ public interface LoginService {
...
@@ -24,11 +24,6 @@ public interface LoginService {
@POST
(
"public/user/login"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
@POST
(
"public/user/login"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
LoginBean
>
login
(
@Body
RequestBody
requestBody
);
Observable
<
LoginBean
>
login
(
@Body
RequestBody
requestBody
);
@Headers
({
"Domain-Name: system_url"
})
@POST
(
"user/logout"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
Object
>
loginOut
(
@Body
RequestBody
requestBody
);
@GET
(
"user/brand/get"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
@GET
(
"user/brand/get"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
BrandsBean
>
getRestaurantList
();
Observable
<
BrandsBean
>
getRestaurantList
();
...
...
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/model/service/MainService.java
View file @
ba4a36e5
...
@@ -14,7 +14,8 @@ import retrofit2.http.POST;
...
@@ -14,7 +14,8 @@ import retrofit2.http.POST;
*/
*/
public
interface
MainService
{
public
interface
MainService
{
@POST
(
"gsa/logout"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
@Headers
({
"Domain-Name: system_url"
})
@POST
(
"user/logout"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
Object
>
loginOut
(
@Body
RequestBody
requestBody
);
Observable
<
Object
>
loginOut
(
@Body
RequestBody
requestBody
);
@Headers
({
"Domain-Name: update_version"
})
@Headers
({
"Domain-Name: update_version"
})
...
...
print-module/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
View file @
ba4a36e5
...
@@ -44,89 +44,89 @@ public class PrintOtherOrder extends PrinterRoot {
...
@@ -44,89 +44,89 @@ public class PrintOtherOrder extends PrinterRoot {
//再將食品數據根據打印位置分組。
//再將食品數據根據打印位置分組。
//打印一組之後,關閉連接,切換第二台打印機ip,如此循環
//打印一組之後,關閉連接,切換第二台打印機ip,如此循環
//打印完成之後,返回所有打印結果。
//打印完成之後,返回所有打印結果。
Map
<
String
,
List
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
>>
foodMaps
=
new
HashMap
<>();
//
Map<String, List<OrderDetails.DataBean.PRODUCTNAMEBean>> foodMaps = new HashMap<>();
String
emptyPrintLocation
=
""
;
//部分食品沒有打印位置時設置為此key,比如這是第一個食品,沒有打印位置時
//
String emptyPrintLocation = "";//部分食品沒有打印位置時設置為此key,比如這是第一個食品,沒有打印位置時
int
lastEmptyPrintLocationIndex
=
0
;
//上一次遍歷到第一個食品時都沒有打印位置時,開始的食品位置
//
int lastEmptyPrintLocationIndex = 0;//上一次遍歷到第一個食品時都沒有打印位置時,開始的食品位置
//獲取這個訂單的一級食品
//
//獲取這個訂單的一級食品
if
(
dataBean
.
getPRODUCT_NAME
()
!=
null
)
{
//
if (dataBean.getPRODUCT_NAME() != null) {
for
(
int
i
=
0
;
i
<
dataBean
.
getPRODUCT_NAME
().
size
();
i
++)
{
//
for (int i = 0; i < dataBean.getPRODUCT_NAME().size(); i++) {
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
food
=
dataBean
.
getPRODUCT_NAME
().
get
(
i
);
//
OrderDetails.DataBean.PRODUCTNAMEBean food = dataBean.getPRODUCT_NAME().get(i);
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
food
.
getPrintseting
()))
{
//
if (TextUtil.isEmptyOrNullOrUndefined(food.getPrintseting())) {
//如果沒有打印位置,向上尋找
//
//如果沒有打印位置,向上尋找
if
(
i
==
0
)
{
//
if (i == 0) {
food
.
setPrintseting
(
emptyPrintLocation
);
//
food.setPrintseting(emptyPrintLocation);
addToMap
(
foodMaps
,
food
);
//
addToMap(foodMaps, food);
}
else
{
//
} else {
for
(
int
j
=
i
-
1
;
j
>=
lastEmptyPrintLocationIndex
;
j
--)
{
//
for (int j = i - 1; j >= lastEmptyPrintLocationIndex; j--) {
//一直遍歷,直到找到有打印位置的食品
//
//一直遍歷,直到找到有打印位置的食品
// 如果所有食品都沒有打印位置的情況,為了避免多次遍歷
//
// 如果所有食品都沒有打印位置的情況,為了避免多次遍歷
// 如果本次遍歷到第一個食品,都沒有打印位置,記錄下這一次開始遍歷的下標,下一次遍歷到這個位置就停止
//
// 如果本次遍歷到第一個食品,都沒有打印位置,記錄下這一次開始遍歷的下標,下一次遍歷到這個位置就停止
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
dataBean
.
getPRODUCT_NAME
().
get
(
j
).
getPrintseting
()))
{
//
if (!TextUtil.isEmptyOrNullOrUndefined(dataBean.getPRODUCT_NAME().get(j).getPrintseting())) {
//一直遍歷,直到找到有打印位置的食品
//
//一直遍歷,直到找到有打印位置的食品
//判斷是否帶*號
//
//判斷是否帶*號
if
(
Objects
.
requireNonNull
(
dataBean
.
getPRODUCT_NAME
().
get
(
j
).
getPrintseting
()).
contains
(
"*"
))
{
//
if (Objects.requireNonNull(dataBean.getPRODUCT_NAME().get(j).getPrintseting()).contains("*")) {
//帶*號,則需要取得通過下標加去掉*號的標識來取得map中的集合,將i食品裝進去,這樣就能打印在一張紙上
//
//帶*號,則需要取得通過下標加去掉*號的標識來取得map中的集合,將i食品裝進去,這樣就能打印在一張紙上
//如果沒取得集合,則通過打印位置去map取得集合,將j食品從map中移除,將這個j食品的和i食品裝一起
//
//如果沒取得集合,則通過打印位置去map取得集合,將j食品從map中移除,將這個j食品的和i食品裝一起
// 生成新的key。為當前下標+"標識符"+去掉*的打印位置,不帶*的key取得的食品集合才能打印在一張紙上。
//
// 生成新的key。為當前下標+"標識符"+去掉*的打印位置,不帶*的key取得的食品集合才能打印在一張紙上。
String
newKey
=
j
+
DELIMITER
+
dataBean
.
getPRODUCT_NAME
().
get
(
j
).
getPrintseting
().
replaceAll
(
"\\*"
,
""
);
//
String newKey = j + DELIMITER + dataBean.getPRODUCT_NAME().get(j).getPrintseting().replaceAll("\\*", "");
//通過newKey取得map中的集合
//
//通過newKey取得map中的集合
List
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
>
newKeyfoods
=
foodMaps
.
get
(
newKey
);
//
List<OrderDetails.DataBean.PRODUCTNAMEBean> newKeyfoods = foodMaps.get(newKey);
if
(
newKeyfoods
!=
null
)
{
//
if (newKeyfoods != null) {
newKeyfoods
.
add
(
food
);
//
newKeyfoods.add(food);
}
else
{
//
} else {
List
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
>
printsetingFoods
=
foodMaps
.
get
(
dataBean
.
getPRODUCT_NAME
().
get
(
j
).
getPrintseting
());
//
List<OrderDetails.DataBean.PRODUCTNAMEBean> printsetingFoods = foodMaps.get(dataBean.getPRODUCT_NAME().get(j).getPrintseting());
if
(
printsetingFoods
!=
null
)
{
//理論上不會為空
//
if (printsetingFoods != null) {//理論上不會為空
printsetingFoods
.
remove
(
printsetingFoods
.
lastIndexOf
(
dataBean
.
getPRODUCT_NAME
().
get
(
j
)));
//
printsetingFoods.remove(printsetingFoods.lastIndexOf(dataBean.getPRODUCT_NAME().get(j)));
//移除掉之後,put到newkey中
//
//移除掉之後,put到newkey中
List
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
>
newFoods
=
new
ArrayList
<>();
//
List<OrderDetails.DataBean.PRODUCTNAMEBean> newFoods = new ArrayList<>();
newFoods
.
add
(
dataBean
.
getPRODUCT_NAME
().
get
(
j
));
//
newFoods.add(dataBean.getPRODUCT_NAME().get(j));
newFoods
.
add
(
food
);
//
newFoods.add(food);
foodMaps
.
put
(
newKey
,
newFoods
);
//
foodMaps.put(newKey, newFoods);
}
//
}
}
//
}
break
;
//
break;
}
else
{
//
} else {
//沒有*號,不需要做多餘的操作
//
//沒有*號,不需要做多餘的操作
food
.
setPrintseting
(
dataBean
.
getPRODUCT_NAME
().
get
(
j
).
getPrintseting
());
//
food.setPrintseting(dataBean.getPRODUCT_NAME().get(j).getPrintseting());
addToMap
(
foodMaps
,
food
);
//
addToMap(foodMaps, food);
}
//
}
}
else
if
(
j
==
lastEmptyPrintLocationIndex
)
{
//
} else if (j == lastEmptyPrintLocationIndex) {
//從i到0的打印位置都沒有,記錄下i,下次只遍歷到i就停下來
//
//從i到0的打印位置都沒有,記錄下i,下次只遍歷到i就停下來
lastEmptyPrintLocationIndex
=
i
;
//
lastEmptyPrintLocationIndex = i;
//如果找到最初的那個食品,也沒有打印位置,設置打印位置為"null"
//
//如果找到最初的那個食品,也沒有打印位置,設置打印位置為"null"
food
.
setPrintseting
(
emptyPrintLocation
);
//
food.setPrintseting(emptyPrintLocation);
addToMap
(
foodMaps
,
food
);
//
addToMap(foodMaps, food);
}
//
}
}
//
}
}
//
}
}
else
{
//
} else {
//有打印位置,
//
//有打印位置,
//已經保存過這個位置的,
//
//已經保存過這個位置的,
addToMap
(
foodMaps
,
food
);
//
addToMap(foodMaps, food);
}
//
}
}
//
}
}
//
}
//通過打印位置生成多張用於打印的bitmap
//
//通過打印位置生成多張用於打印的bitmap
for
(
Map
.
Entry
<
String
,
List
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
>>
entry
:
foodMaps
.
entrySet
())
{
//
for (Map.Entry<String, List<OrderDetails.DataBean.PRODUCTNAMEBean>> entry : foodMaps.entrySet()) {
String
key
=
entry
.
getKey
();
//
String key = entry.getKey();
List
<
Bitmap
>
bitmaps
=
new
ArrayList
<>();
//
List<Bitmap> bitmaps = new ArrayList<>();
if
(
key
.
contains
(
"*"
))
{
//
if (key.contains("*")) {
//如果帶*號,這個集合就需要切紙,每個食品都需要單獨在一張廚房單上
//
//如果帶*號,這個集合就需要切紙,每個食品都需要單獨在一張廚房單上
for
(
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
orderDetail
:
entry
.
getValue
())
{
//
for (OrderDetails.DataBean.PRODUCTNAMEBean orderDetail : entry.getValue()) {
List
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
>
orders
=
new
ArrayList
<>();
//這裡new集合是因為下面的方法需要的參數是list集合
//
List<OrderDetails.DataBean.PRODUCTNAMEBean> orders = new ArrayList<>();//這裡new集合是因為下面的方法需要的參數是list集合
orders
.
add
(
orderDetail
);
//
orders.add(orderDetail);
//獲取廚房單圖片
//
//獲取廚房單圖片
Bitmap
bitmap
=
getOrderKitchenBitmap
(
mContext
,
orders
,
dataBean
);
//
Bitmap bitmap = getOrderKitchenBitmap(mContext, orders, dataBean);
bitmaps
.
add
(
bitmap
);
//
bitmaps.add(bitmap);
}
//
}
}
else
{
//
} else {
//獲取廚房單圖片
//
//獲取廚房單圖片
Bitmap
bitmap
=
getOrderKitchenBitmap
(
mContext
,
entry
.
getValue
(),
dataBean
);
//
Bitmap bitmap = getOrderKitchenBitmap(mContext, entry.getValue(), dataBean);
//不帶*號,所有同樣廚房位置的食品都在一張紙上
//
//不帶*號,所有同樣廚房位置的食品都在一張紙上
bitmaps
.
add
(
bitmap
);
//
bitmaps.add(bitmap);
}
//
}
bitmapMaps
.
put
(
key
,
bitmaps
);
//
bitmapMaps.put(key, bitmaps);
}
//
}
//如果需要打印印單,加上
//如果需要打印印單,加上
List
<
Bitmap
>
bitmaps
=
new
ArrayList
<>();
List
<
Bitmap
>
bitmaps
=
new
ArrayList
<>();
Bitmap
bitmap
=
initPrintView
(
mContext
,
dataBean
);
Bitmap
bitmap
=
initPrintView
(
mContext
,
dataBean
);
...
...
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