| | |
| | | |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.basic.PageInfo; |
| | | import com.jilongda.manage.authority.model.SecUser; |
| | | import com.jilongda.manage.authority.service.SecUserService; |
| | | import com.jilongda.manage.dto.AccountDetailDTO; |
| | | import com.jilongda.manage.model.*; |
| | | import com.jilongda.manage.query.TLineUpQuery; |
| | | import com.jilongda.manage.query.TOrderAccountingQuery; |
| | | import com.jilongda.manage.service.*; |
| | | import com.jilongda.manage.utils.LoginInfoUtil; |
| | | import com.jilongda.manage.vo.TOrderAccountVO; |
| | | import com.jilongda.manage.vo.TOrderVO; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RequestMapping("/t-order-accounting") |
| | | public class TOrderAccountingController { |
| | | @Autowired |
| | | private SecUserService secUserService; |
| | | @Autowired |
| | | private TStoreService storeService; |
| | | @Autowired |
| | | private TOrderService orderService; |
| | |
| | | private TOrderGoodsService orderGoodsService; |
| | | @Autowired |
| | | private SecFeeItemsService feeItemsService; |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @ApiOperation(value = "核算订单分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TOrderVO>> pageList(@RequestBody TOrderAccountingQuery query) { |
| | |
| | | public ApiResult<TOrderAccountVO> detail(Integer id) { |
| | | TOrderAccountVO res = new TOrderAccountVO(); |
| | | TOrder byId = orderService.getById(id); |
| | | TOrderAccounting one = orderAccountingService.lambdaQuery().eq(TOrderAccounting::getOrderId, id).one(); |
| | | if (byId.getUserId()!=null){ |
| | | TAppUser byId1 = appUserService.getById(byId.getUserId()); |
| | | if(byId1!=null){ |
| | |
| | | BigDecimal goodsMoney = new BigDecimal("0"); |
| | | BigDecimal costMoney = new BigDecimal("0"); |
| | | BigDecimal constConfirm = new BigDecimal("0"); |
| | | if (one!=null){ |
| | | |
| | | } |
| | | for (TOrderGoods orderGood : orderGoods) { |
| | | goodsMoney =goodsMoney.add(orderGood.getGoodsMoney()); |
| | | costMoney=costMoney.add(orderGood.getCost()==null?new BigDecimal("0"):orderGood.getCost()); |
| | |
| | | return ApiResult.success(res); |
| | | } |
| | | @ApiOperation(value = "确认核算操作") |
| | | @PostMapping(value = "/confirm") |
| | | public ApiResult confirm(@RequestBody TOrderAccountingQuery query) { |
| | | if (StringUtils.hasLength(query.getStartTime())){ |
| | | query.setStartTime(query.getStartTime()+" 00:00:00"); |
| | | query.setEndTime(query.getEndTime()+" 23:59:59"); |
| | | } |
| | | PageInfo<TOrderVO> res = orderAccountingService.pageList(query); |
| | | return ApiResult.success(res); |
| | | @GetMapping(value = "/confirm") |
| | | public ApiResult confirm(@RequestBody AccountDetailDTO dto) { |
| | | List<TOrderGoods> list = dto.getList(); |
| | | orderGoodsService.updateBatchById(list); |
| | | TOrder byId = orderService.getById(dto.getId()); |
| | | byId.setPayTypeName(dto.getPayTypeName()); |
| | | byId.setPayTypeName(dto.getPayTypeName()); |
| | | byId.setPayMoney(dto.getPayMoney()); |
| | | byId.setCommissionMoney(dto.getCommission()); |
| | | byId.setIsAccounting(1); |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | SecUser byId1 = secUserService.getById(userId); |
| | | byId.setAccountingName(byId1.getNickName()); |
| | | byId.setAccountingTime(LocalDateTime.now()); |
| | | orderService.updateById(byId); |
| | | return ApiResult.success(); |
| | | } |
| | | } |
| | | |