修改交班落地数据逻辑

This commit is contained in:
19991905653
2024-04-03 09:05:40 +08:00
parent 8fe9d11d99
commit 9221d56653
5 changed files with 22 additions and 4 deletions

View File

@@ -108,6 +108,7 @@ public class OrderController {
@RequestParam(value = "size", required = false, defaultValue = "1") Integer size){
return orderService.findOrder(shopId,status,page,size,orderNo);
}
@GetMapping("/orderDetail")
public Result orderDetail(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,
@RequestHeader("clientType") String clientType, @RequestParam("shopId") Integer shopId,

View File

@@ -32,4 +32,8 @@ public interface ShopUserDutyMapper {
BigDecimal selectSumAmount(@Param("shopId") String shopId);
ShopUserDuty selectByTokenIdAndTradeDay(@Param("tokenId") int tokenId, @Param("day") String day,@Param("shopId") String shopId);
ShopUserDuty selectByShopIdAndTrade(@Param("shopId") Integer shopId,@Param("day") String day);
// List<String> selectByShopIdAndTradeAll(@Param("shopId") Integer shopId,@Param("day") String day,@Param("tokenId") Integer tokenId);
}

View File

@@ -50,6 +50,7 @@ public class DutyService {
String token = jsonObject.getString("token");
String type = jsonObject.getString("type");
TbToken tbToken = tbTokenMapper.selectByToken(token);
String day = DateUtils.getDay();
if (type.equals("return") || type.equals("create")) {
if (Objects.isNull(tbToken)) {
throw new MsgException("当前用户不存在");
@@ -65,7 +66,9 @@ public class DutyService {
throw new MsgException("订单不存在");
}
List<TbOrderDetail> list = orderDetailMapper.selectAllByOrderId(orderId);
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenId(tokenId);
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenId(tokenId);
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId,day);
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId());
BigDecimal cashAmount = BigDecimal.ZERO;
if (orderInfo.getPayType().equals("cash")) {
cashAmount = orderInfo.getPayAmount();
@@ -165,7 +168,6 @@ public class DutyService {
}
}
} else if (type.equals("wxcreate")) {
String day = DateUtils.getDay();
Integer orderId = jsonObject.getInteger("orderId");
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
if (Objects.isNull(orderInfo)) {
@@ -176,7 +178,8 @@ public class DutyService {
if (orderInfo.getPayType().equals("cash")) {
cashAmount = orderInfo.getPayAmount();
}
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(0, day, orderInfo.getShopId());
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(Integer.valueOf(orderInfo.getShopId()), day);
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(0, day, orderInfo.getShopId());
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
if (Objects.isNull(shopUserDuty)) {
shopUserDuty = new ShopUserDuty(Integer.valueOf(orderInfo.getShopId()), new Date(), 1, orderInfo.getOrderAmount(), "", "0",

View File

@@ -6,6 +6,7 @@ import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -55,7 +56,12 @@ public class ShopInfoService {
if (Objects.isNull(tbToken)){
return Result.fail(CodeEnum.PARAM);
}
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenId(tbToken.getId());
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
Integer shopId = jsonObject.getInteger("shopId");
String day = DateUtils.getDay();
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenId(tbToken.getId());
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId,day);
// List<String> list = shopUserDutyMapper.selectByShopIdAndTradeAll(shopId,day,tbToken.getId());
if (Objects.nonNull(shopUserDuty)){
// PageHelper.startPage(page, pageSize);
List<ShopUserDutyDetail> shopTables=shopUserDutyDetailMapper.selectAllByDuctId(shopUserDuty.getId());

View File

@@ -44,6 +44,10 @@
resultType="com.chaozhanggui.system.cashierservice.entity.ShopUserDuty">
select * from tb_shop_user_duty where shop_id = #{shopId} and trade_day = #{day} and token_id = #{tokenId};
</select>
<select id="selectByShopIdAndTrade"
resultType="com.chaozhanggui.system.cashierservice.entity.ShopUserDuty">
select * from tb_shop_user_duty where trade_day = #{day} and shop_id = #{shopId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_shop_user_duty
where id = #{id,jdbcType=INTEGER}