Authored by csgyoho

商家管理

... ... @@ -31,8 +31,54 @@ public class SellerWalletDetail {
private BigDecimal lockAmount;
private Integer isSet;
public enum Type{
RE_CHARGE("充值保证金", 1),
SELLER_ONSHELF("卖家上架商品", 11),
SELLER_ADDPRICE("卖家上调价格", 12),
TRADE_COMPLETE("商品交易完成", 51),
SELLER_REDUCEPRICE("卖家下调价格", 13),
SELLER_OFFSHELF("卖家下架商品", 21),
SYSTEM_OFFSHELF("系统下架商品", 22),
SELLER_UNSELL("卖家不卖",31),
SELLER_SELLOUTTIME("卖家超时发货",32),
SELLER_CHECKFAILED("鉴定不通过", 33),
BUYER_CANCEL_NOLOG("买家取消(无物流)", 41),
BUYER_CANCEL_LOG("买家取消(有物流)", 42),
SELLER_QUIT("卖家退出入驻", 61);
private String name;
private int value;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public enum Type {
private Type(String name, int value) {
this.name = name;
this.value = value;
}
public static Type of(int value) {
for (Type t : values()) {
if(t.value == value){
return t;
}
}
return null;
}
}
public enum TypeSearch {
// 1:充值,11:发布上架,12:加价,13:减价,
// 21卖家下架,22系统下架,31卖家不卖,32卖家超时发货,33鉴定不通过,
// 41买家取消(无物流), 42买家取消(有物流),
... ... @@ -52,7 +98,7 @@ public class SellerWalletDetail {
private String name;
private int[] value;
private Type(String name, int[] value) {
private TypeSearch(String name, int[] value) {
this.name = name;
this.value = value;
}
... ... @@ -68,11 +114,11 @@ public class SellerWalletDetail {
* @param value
* @return
*/
public static Type of(int[] value) {
public static TypeSearch of(int[] value) {
if(value == null || value.length == 0){
return null;
}
for (Type t : values()) {
for (TypeSearch t : values()) {
boolean isFind=true;
if(t.value.length<value.length){
continue;
... ...
... ... @@ -63,39 +63,39 @@ public class MerchantServiceImpl {
info.setUid(sellerWalletDetail.getUid());
info.setType(sellerWalletDetail.getType());
info.setTime(sdf.get().format(new Date(sellerWalletDetail.getCreateTime() * 1000L)));
SellerWalletDetail.Type curType = null;
SellerWalletDetail.TypeSearch curType = null;
//如果类型不存在,则不进行处理
if(info.getType()==null || (curType = SellerWalletDetail.Type.of(new int[]{info.getType().intValue()}))==null){
if(info.getType()==null || (curType = SellerWalletDetail.TypeSearch.of(new int[]{info.getType().intValue()}))==null){
return info;
}
if(curType.equals(SellerWalletDetail.Type.RE_CHARGE)){
if(curType.equals(SellerWalletDetail.TypeSearch.RE_CHARGE)){
return dealReCharge(info,sellerWalletDetail);//保证金充值
}
if(curType.equals(SellerWalletDetail.Type.SELLER_ONSHELF)){
if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_ONSHELF)){
return dealSellerOnShelf(info,sellerWalletDetail);//卖家上架商品
}
if(curType.equals(SellerWalletDetail.Type.SELLER_OFFSHELF)){
if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_OFFSHELF)){
return dealSellerOffShelf(info,sellerWalletDetail);//卖家下架商品
}
if(curType.equals(SellerWalletDetail.Type.TRADE_COMPLETE)){
if(curType.equals(SellerWalletDetail.TypeSearch.TRADE_COMPLETE)){
return dealTradeComplete(info,sellerWalletDetail);//商品交易完成
}
if(curType.equals(SellerWalletDetail.Type.SELLER_TRADEFAILED)){
if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_TRADEFAILED)){
return dealSellerTradeFailed(info,sellerWalletDetail);//卖家原因交易失败
}
if(curType.equals(SellerWalletDetail.Type.SELLER_ADDPRICE)){
if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_ADDPRICE)){
return dealSellerAddPrice(info,sellerWalletDetail);//卖家上调价格
}
if(curType.equals(SellerWalletDetail.Type.SELLER_REDUCEPRICE)){
if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_REDUCEPRICE)){
return dealSellerReducePrice(info,sellerWalletDetail);//卖家下调价格
}
if(curType.equals(SellerWalletDetail.Type.BUYER_CANCEL)){
if(curType.equals(SellerWalletDetail.TypeSearch.BUYER_CANCEL)){
return dealBuyerCancel(info,sellerWalletDetail);//买家付款后取消订单
}
if(curType.equals(SellerWalletDetail.Type.SYSTEM_OFFSHELF)){
if(curType.equals(SellerWalletDetail.TypeSearch.SYSTEM_OFFSHELF)){
return dealSystemOffShelf(info,sellerWalletDetail);//系统下架商品
}
if(curType.equals(SellerWalletDetail.Type.SELLER_QUIT)){
if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_QUIT)){
return dealSellerQuit(info,sellerWalletDetail);//卖家退出入驻
}
return info;
... ... @@ -230,7 +230,7 @@ public class MerchantServiceImpl {
Integer stratTime = parse(req.getStartTime());
Integer endTime = parse(req.getEndTime());
List<Integer> uids = null;
if(StringUtils.isNotBlank(req.getMerchantName()) || req.getUid() !=null){
if(StringUtils.isNotBlank(req.getMerchantName()) || StringUtils.isNotBlank(req.getUid())){
uids = storedSellerMapper.selectUidByCertNameAndUid(req.getMerchantName(),req.getUid());
if(CollectionUtils.isEmpty(uids)){
return new PageResponseBO<>();
... ... @@ -241,15 +241,19 @@ public class MerchantServiceImpl {
return new PageResponseBO<>();
}
List<SellerWalletDetail> beanList = mapper.selectMerchantInfo(CollectionUtils.isEmpty(uids)?null:uids, stratTime, endTime, req.getStateList(),req.getOrderCode(), req.getStart(), req.getRows());
if(CollectionUtils.isEmpty(beanList)){
PageResponseBO<MerchantOrderAttachInfo> result=new PageResponseBO<>();
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
return result;
}
Map<Integer,Map<String,Object>> storedSellerMap = this.storedSellerMapper.selectNameByUids(beanList.stream().map(cell->cell.getUid()).collect(Collectors.toList()));
List<MerchantOrderAttachInfo> boList = new ArrayList<>();
for(SellerWalletDetail detail : beanList) {
MerchantOrderAttachInfo info = JSON.parseObject(detail.getAttachValue(), MerchantOrderAttachInfo.class);
info=info == null?new MerchantOrderAttachInfo():info;
MerchantOrderAttachInfo info = exchange(detail);
info.setOrderCode(detail.getOrderCode());
info.setTime(sdf.get().format(new Date(detail.getCreateTime() * 1000L)));
info.setMerchantName((String)storedSellerMap.get(detail.getUid()).get("cert_name"));
info.setUid(detail.getUid());
boList.add(info);
}
PageResponseBO<MerchantOrderAttachInfo> result=new PageResponseBO<>();
... ... @@ -265,24 +269,30 @@ public class MerchantServiceImpl {
MerchantOrderAttachInfo info = new MerchantOrderAttachInfo();
if(StringUtils.isNotBlank(detail.getAttachValue())) {
info = JSON.parseObject(detail.getAttachValue(), MerchantOrderAttachInfo.class);
info=info == null?new MerchantOrderAttachInfo():info;
}
info.setId(detail.getId());
info.setUid(detail.getUid());
info.setType(detail.getType());
info.setUserName("");
if(null != info.getType()){
info.setTypeName(SellerWalletDetail.Type.of(detail.getType()).getName());
}
info.setTime(sdf.get().format(new Date(detail.getCreateTime() * 1000L)));
if (info.getType() / 10 == 3 || info.getType()==61) {
info.setAccountAmount(detail.getAmount().toString());
info.setLockEarnestMoney(detail.getAmount().toString());
info.setAccountAmount(detail.getAmount()==null?null:detail.getAmount().toString());
info.setLockEarnestMoney(detail.getAmount()==null?null:detail.getAmount().toString());
info.setAvailEarnestMoney("/");
} else {
info.setAccountAmount("/");
info.setLockEarnestMoney("/");
info.setAvailEarnestMoney(detail.getAmount().toString());
info.setAvailEarnestMoney(detail.getAmount()==null?null:detail.getAmount().toString());
}
info.setAccountAllAmount(detail.getAvailAmount().add(detail.getLockAmount()).toString());
info.setLockAllEarnestMoney(detail.getLockAmount().toString());
if(detail.getAvailAmount()!=null){
info.setAccountAllAmount(detail.getLockAmount()==null?
detail.getAvailAmount().toString():detail.getAvailAmount().add(detail.getLockAmount()).toString());
info.setAvailAllEarnestMoney(detail.getAvailAmount().toString());
}
info.setLockAllEarnestMoney(detail.getLockAmount()==null?null:detail.getLockAmount().toString());
return info;
}
... ... @@ -311,6 +321,13 @@ public class MerchantServiceImpl {
return new PageResponseBO<>();
}
List<SellerWallet> sellerWallets = this.sellerWalletMapper.selectByUidAndMerchantUids(req.getUid(),uids,req.getStart(),req.getSize());
if(CollectionUtils.isEmpty(sellerWallets)){
PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();
result.setTotal(total);
result.setPage(req.getPage());
result.setSize(req.getSize());
return result;
}
List<MerchantOrderAttachInfo> infos = initMerchantOrderAttachInfos(sellerWallets);
PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();
result.setTotal(total);
... ...
... ... @@ -183,6 +183,7 @@
width: 80,
align: "center",
rowspan:2,
hidden:'true',//暂时隐藏
formatter: function (value, rowData) {
return "<a role='view' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #5bc0de'>查看</a>";
}
... ...
... ... @@ -103,6 +103,7 @@
// 搜索
$("#searchLinkButton").linkbutton({
onClick: function () {
$("#marginTable").myDatagrid('loadData', []);
loadData();
}
});
... ... @@ -114,6 +115,7 @@
$("#merchantName").textbox("clear");
$("#orderCode").textbox("clear");
$("#violationType").textbox("clear");
$("#marginTable").myDatagrid('loadData', []);
loadData();
}
});
... ...