修改交班数据

This commit is contained in:
韩鹏辉
2024-05-30 09:17:43 +08:00
parent 9482cf4597
commit 29293fd093
2 changed files with 56 additions and 20 deletions

View File

@@ -616,12 +616,17 @@ public class CloudPrinterService {
list= JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(mapList), HandoverInfo.PayInfo.class);
}
ShopUserDutyPay shopUserDutyPay=shopUserDutyPayMapper.selectByDuctIdAndType(shopUserDuty.getId(),"deposit");
if(ObjectUtil.isNotEmpty(shopUserDutyPay)){
memberData=new ArrayList<>();
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())? BigDecimal.ONE.toPlainString() : shopUserDuty.getMemberInAmount().toPlainString(),"储值卡充值"));
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberOutAmount())? BigDecimal.ONE.toPlainString() : shopUserDuty.getMemberOutAmount().toPlainString(),"储值卡支付"));
}
// ShopUserDutyPay shopUserDutyPay=shopUserDutyPayMapper.selectByDuctIdAndType(shopUserDuty.getId(),"deposit");
// if(ObjectUtil.isNotEmpty(shopUserDutyPay)){
// memberData=new ArrayList<>();
// memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())? BigDecimal.ONE.toPlainString() : shopUserDuty.getMemberInAmount().toPlainString(),"储值卡充值"));
// memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberOutAmount())? BigDecimal.ONE.toPlainString() : shopUserDuty.getMemberOutAmount().toPlainString(),"储值卡支付"));
// }
memberData=new ArrayList<>();
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())? BigDecimal.ZERO.toPlainString() : shopUserDuty.getMemberInAmount().toPlainString(),"储值卡充值"));
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberOutAmount())? BigDecimal.ZERO.toPlainString() : shopUserDuty.getMemberOutAmount().toPlainString(),"储值卡支付"));
List<Map<String,Object>> categries= shopUserDutyPayMapper.selectCetoryBydutyId(shopUserDuty.getId());
@@ -634,13 +639,13 @@ public class CloudPrinterService {
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())?DateUtils.getTime(shopUserDuty.getLoginTime()):null,
ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime())?DateUtils.getTime(shopUserDuty.getLoginOutTime()):"",
ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
list,memberData,shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).add(ObjectUtil.isNull(shopUserDuty.getIncomeAmount())?BigDecimal.ZERO:shopUserDuty.getIncomeAmount()).toPlainString(),
list,memberData,shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
"0",
shopUserDuty.getAmount().subtract(shopUserDuty.getReturnAmount()).toPlainString(),
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).add(ObjectUtil.isNull(shopUserDuty.getIncomeAmount())?BigDecimal.ZERO:shopUserDuty.getIncomeAmount()).subtract(shopUserDuty.getReturnAmount()).toPlainString(),
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
shopUserDuty.getReturnAmount().toPlainString(),
shopUserDuty.getOrderNum().toString(),
productCategories,shopUserDuty.getQuickAmount().toPlainString()
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString()
);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";

View File

@@ -107,7 +107,34 @@ public class DutyService {
}
}else {
}else if("wxMemberIn".equals(type)){
String shopId=jsonObject.getString("shopId");
BigDecimal amount=new BigDecimal(jsonObject.getString("amount"));
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(Integer.valueOf(shopId), "0");
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
if(Objects.isNull(shopUserDuty)){
shopUserDuty = new ShopUserDuty(Integer.valueOf(shopId), tbToken.getCreateTime(), 1, BigDecimal.ZERO, shopInfo.getShopName(), "0",
BigDecimal.ZERO, Integer.valueOf(shopId), BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, "");
shopUserDuty.setTokenId(0);
shopUserDuty.setType("wxIn");
if (Objects.nonNull(shopInfo)) {
shopUserDuty.setUserName(shopInfo.getShopName());
}
shopUserDuty.setTradeDay(DateUtils.getDay());
shopUserDuty.setReturnAmount(BigDecimal.ZERO);
shopUserDuty.setMemberInAmount(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())?amount:shopUserDuty.getMemberInAmount().add(amount));
shopUserDutyMapper.insert(shopUserDuty);
}else {
shopUserDuty.setMemberInAmount(ObjectUtil.isNull(shopUserDuty.getMemberInAmount())?amount:shopUserDuty.getMemberInAmount().add(amount));
shopUserDutyMapper.updateByPrimaryKey(shopUserDuty);
}
} else {
if (type.equals("return") || type.equals("create")) {
if (Objects.isNull(tbToken)) {
throw new MsgException("当前用户不存在");
@@ -314,17 +341,21 @@ public class DutyService {
shopUserDutyDetailMapper.batchInsert(detaiList);
}
}
ShopUserDutyPay shopUserDutyPay = shopUserDutyPayMapper.selectByDuctIdAndType(shopUserDuty.getId(), orderInfo.getPayType());
if (Objects.nonNull(shopUserDutyPay)) {
shopUserDutyPay.setAmount(orderInfo.getOrderAmount().add(shopUserDutyPay.getAmount()));
shopUserDutyPayMapper.updateByPrimaryKeySelective(shopUserDutyPay);
} else {
shopUserDutyPay = new ShopUserDutyPay();
shopUserDutyPay.setDutyId(shopUserDuty.getId());
shopUserDutyPay.setType(orderInfo.getPayType());
shopUserDutyPay.setAmount(orderInfo.getOrderAmount());
shopUserDutyPayMapper.insert(shopUserDutyPay);
if(!orderInfo.getOrderType().equals("deposit")){
ShopUserDutyPay shopUserDutyPay = shopUserDutyPayMapper.selectByDuctIdAndType(shopUserDuty.getId(), orderInfo.getPayType());
if (Objects.nonNull(shopUserDutyPay)) {
shopUserDutyPay.setAmount(orderInfo.getOrderAmount().add(shopUserDutyPay.getAmount()));
shopUserDutyPayMapper.updateByPrimaryKeySelective(shopUserDutyPay);
} else {
shopUserDutyPay = new ShopUserDutyPay();
shopUserDutyPay.setDutyId(shopUserDuty.getId());
shopUserDutyPay.setType(orderInfo.getPayType());
shopUserDutyPay.setAmount(orderInfo.getOrderAmount());
shopUserDutyPayMapper.insert(shopUserDutyPay);
}
}
} else {
if (type.equals("close")) {
JSONObject tokenJson = TokenUtil.parseParamFromToken(tbToken.getToken());