对账单导出

localizer
ljw 2025-10-22 11:12:34 +08:00
parent 713f047aa1
commit f1abbcdf5d
6 changed files with 47 additions and 2 deletions

View File

@ -4,12 +4,15 @@ import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.money.pojo.entity.MoneyBillEntity;
import com.njzscloud.supervisory.money.pojo.entity.MoneyChangeDetailEntity;
import com.njzscloud.supervisory.money.pojo.param.RebuildBillParam;
import com.njzscloud.supervisory.money.service.MoneyBillService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
@ -75,4 +78,11 @@ public class MoneyBillController {
return R.success();
}
/**
*
*/
@GetMapping(value = "/export")
public void export(HttpServletResponse response, MoneyBillEntity entity) throws IOException {
moneyBillService.export(response, entity);
}
}

View File

@ -26,4 +26,6 @@ public interface MoneyBillMapper extends BaseMapper<MoneyBillEntity> {
*/
List<MoneyBillResult> selectMoneyBillList(@Param("entity") MoneyBillResult entity);
List<MoneyBillEntity> selectMoneyBillWithNames(@Param("entity") MoneyBillEntity entity);
}

View File

@ -8,11 +8,20 @@ import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.money.mapper.MoneyBillMapper;
import com.njzscloud.supervisory.money.pojo.entity.MoneyBillEntity;
import com.njzscloud.supervisory.money.pojo.param.RebuildBillParam;
import com.njzscloud.supervisory.order.utils.FileUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
*
@ -66,4 +75,27 @@ public class MoneyBillService extends ServiceImpl<MoneyBillMapper, MoneyBillEnti
return;
}
public void export(HttpServletResponse response, MoneyBillEntity entity) throws IOException {
List<MoneyBillEntity> list = baseMapper.selectMoneyBillWithNames(entity);
List<Map<String, Object>> downList = new ArrayList<>();
int i = 1;
for (MoneyBillEntity result : list) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("序号", i);
map.put("公司名称", result.getCompanyName());
map.put("产品名称", result.getGoodsName());
map.put("订单数", result.getOrderCount());
map.put("总重量t", String.valueOf(result.getTotalWeight() == null ? null : BigDecimal.valueOf(result.getTotalWeight())
.divide(BigDecimal.valueOf(1000), 3, RoundingMode.HALF_UP)));
map.put("总车数", result.getCarCount());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
map.put("开始日期", result.getStartTime() != null ? result.getStartTime().format(formatter) : "");
map.put("结束日期", result.getEndTime() != null ? result.getEndTime().format(formatter) : "");
map.put("优惠金额", result.getDiscountMoney());
map.put("账单金额", result.getTotalMoney());
downList.add(map);
i++;
}
FileUtil.downloadExcel(downList, response, "对账单.xlsx");
}
}

View File

@ -1341,7 +1341,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
ew.like(StrUtil.isNotBlank(searchParam.getNickname()), "a.contacts", searchParam.getNickname());
ew.ge(startTime != null, "a.create_time", startTime);
ew.le(endTime != null, "a.create_time", endTime);
;
historyEW(searchParam, null, ew);
List<OrderExportResult> list = baseMapper.exportList(ew);
List<Map<String, Object>> downList = new ArrayList<>();

View File

@ -25,6 +25,7 @@ spring:
- /fdx
- /payment/wechat/notify
- /payment/wechat/refundNotify
- /district/areaList
app:
default-place:
province: 320000

View File

@ -30,7 +30,7 @@
mb.car_count
FROM money_bill mb
LEFT JOIN sys_user u ON mb.user_id = u.id
LEFT JOIN biz_company bc ON mb.station_id = bc.id AND bc.station = 1
LEFT JOIN biz_company bc ON mb.station_id = bc.id
<where>
<if test="entity.userId != null">
AND mb.user_id = #{entity.userId}