添加店铺初始化支付方式
This commit is contained in:
parent
6d866f4116
commit
eb81545075
|
|
@ -13,6 +13,7 @@ import com.czg.account.service.ShopPayTypeService;
|
|||
import com.czg.service.account.mapper.ShopPayTypeMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -25,17 +26,25 @@ import java.util.Map;
|
|||
*/
|
||||
@Service
|
||||
public class ShopPayTypeServiceImpl extends ServiceImpl<ShopPayTypeMapper, ShopPayType> implements ShopPayTypeService{
|
||||
private final Map<String, String> payTypeMap = Map.of(
|
||||
"cash", "现金",
|
||||
"bank", "银行卡",
|
||||
"scanCode", "扫码支付",
|
||||
"deposit", "储值卡",
|
||||
"virtual", "挂账支付"
|
||||
);
|
||||
private final ArrayList<ShopPayType> payTypeArrayList = new ArrayList<>(){{
|
||||
add(new ShopPayType().setPayType("cash").setPayName("现金").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/319005ffef734aa6a88d432459fa59d8.png"));
|
||||
add(new ShopPayType().setPayType("bank").setPayName("银行卡").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/98e6199cc61a480b9c63617600b2f2fe.png"));
|
||||
add(new ShopPayType().setPayType("scanCode").setPayName("扫码支付").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/3a344b46638547df81d5857a3c8cac66.png"));
|
||||
add(new ShopPayType().setPayType("deposit").setPayName("储值卡").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6f778df10ea74142a6cba310c2a19063.png"));
|
||||
add(new ShopPayType().setPayType("virtual").setPayName("挂账支付").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6f778df10ea74142a6cba310c2a19063.png").setIsShowShortcut(0));
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void addInfo(Long shopId) {
|
||||
payTypeMap.forEach((k, v) -> save(new ShopPayType().setPayType(k).setPayName(v).setShopId(shopId).setIsShowShortcut("挂账支付".equals(v) ? 0 : 1)));
|
||||
payTypeArrayList.forEach(item -> {
|
||||
long count = count(new QueryWrapper().eq(ShopPayType::getShopId, shopId).eq(ShopPayType::getPayType, item.getPayType()));
|
||||
if (count > 0) {
|
||||
return;
|
||||
}
|
||||
ShopPayType shopPayType = BeanUtil.copyProperties(item, ShopPayType.class);
|
||||
shopPayType.setShopId(shopId);
|
||||
save(shopPayType);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue