This commit is contained in:
xiaofajia 2024-12-16 18:04:45 +08:00
parent 3b5c87b032
commit e813321ea3
5 changed files with 344 additions and 202 deletions

View File

@ -79,57 +79,58 @@ public class PartnerOwnController extends BaseController {
* 开始或者停止营业
*/
@PostMapping("/startOrEnd")
public CommonResult startOrEnd(Long partnerId)
{
public CommonResult startOrEnd(Long partnerId) {
partnerList.startOrEnd(partnerId);
return success();
}
/**
* 首页 顶部数据统计
*/
@GetMapping("/statisticsInfo")
public CommonResult statisticsInfo()
{
public CommonResult statisticsInfo() {
return success(partnerList.statisticsInfo(null));
}
/**
* 检测线图
*/
@GetMapping("/chartInfoAmount")
public CommonResult chartInfoAmount(Long partnerId,String unit)
{
public CommonResult chartInfoAmount(Long partnerId, String unit) {
return success(partnerList.chartInfoAmount(partnerId, unit));
}
/**
* 新检测线图
*/
@GetMapping("/newChartInfoAmount")
public CommonResult newChartInfoAmount(String unit)
{
public CommonResult newChartInfoAmount(String unit) {
return success(partnerList.newChartInfoAmount(unit));
}
/**staticsTable1
/**
* staticsTable1
* 检测数量折线图
*/
@GetMapping("/chartLineInspectionNum")
public CommonResult chartLineInspectionNum(Long partnerId,String unit)
{
public CommonResult chartLineInspectionNum(Long partnerId, String unit) {
return success(partnerList.chartLineInspectionNum(partnerId, unit));
}
/**staticsTable1
/**
* staticsTable1
* 新检测数量折线图
*/
@GetMapping("/newChartLineInspectionNum")
public CommonResult newChartLineInspectionNum(String unit)
{
public CommonResult newChartLineInspectionNum(String unit) {
return success(partnerList.newChartLineInspectionNum(unit));
}
/**
* 检测金额折线图
*/
@GetMapping("/chartLineInspectionAmount")
public CommonResult chartLineInspectionAmount(Long partnerId,String unit)
{
public CommonResult chartLineInspectionAmount(Long partnerId, String unit) {
return success(partnerList.chartLineInspectionAmount(partnerId, unit));
}
@ -137,8 +138,7 @@ public class PartnerOwnController extends BaseController {
* 新检测金额折线图
*/
@GetMapping("/newChartLineInspectionAmount")
public CommonResult newChartLineInspectionAmount(String unit)
{
public CommonResult newChartLineInspectionAmount(String unit) {
return success(partnerList.newChartLineInspectionAmount(unit));
}
@ -146,16 +146,15 @@ public class PartnerOwnController extends BaseController {
* 检测线图
*/
@GetMapping("/chartInfoNum")
public CommonResult chartInfoNum(Long partnerId,String unit)
{
public CommonResult chartInfoNum(Long partnerId, String unit) {
return success(partnerList.chartInfoNum(partnerId, unit));
}
/**
* 新检测线图
*/
@GetMapping("/newChartInfoNum")
public CommonResult newChartInfoNum(String unit)
{
public CommonResult newChartInfoNum(String unit) {
return success(partnerList.newChartInfoNum(unit));
}
@ -169,36 +168,36 @@ public class PartnerOwnController extends BaseController {
}
return success(partnerList.chartInfoRatio(partnerId, unit));
}
/**
* 新检测线图
*/
@GetMapping("/newChartInfoRatio")
public CommonResult newChartInfoRatio(String unit)
{
public CommonResult newChartInfoRatio(String unit) {
return success(partnerList.newChartInfoRatio(unit));
}
/**
* 首页 订单信息
*/
@GetMapping("/orderInfo")
public CommonResult orderInfo(Long partnerId)
{
public CommonResult orderInfo(Long partnerId) {
return success(partnerList.orderInfo(partnerId));
}
/**
* 热销商品列表
*/
@GetMapping("/hotGoodsList")
public CommonResult hotGoodsList(Long partnerId)
{
public CommonResult hotGoodsList(Long partnerId) {
return success(partnerList.hotGoodsList(partnerId));
}
/**
* 热销商品列表
*/
@GetMapping("/newHotGoodsList")
public CommonResult newHotGoodsList()
{
public CommonResult newHotGoodsList() {
return success(partnerList.newHotGoodsList());
}
@ -209,11 +208,11 @@ public class PartnerOwnController extends BaseController {
* @return 所有数据
*/
@GetMapping("/categoryList")
public CommonResult categoryList(Long partnerId)
{
public CommonResult categoryList(Long partnerId) {
return success(partnerList.categoryList(partnerId));
}
/**
* 发布商品
*/
@ -229,8 +228,7 @@ public class PartnerOwnController extends BaseController {
@GetMapping("/goodsList")
public CommonResult goodsList(Long partnerId, String isListing, String goodsTitle,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = partnerList.getById(partnerId);
if (!partners.getUserId().equals(user.getId())) {
@ -240,12 +238,12 @@ public class PartnerOwnController extends BaseController {
IPage<GoodsVo> list = partnerList.goodsList(page, partnerId, isListing, goodsTitle);
return success(list);
}
/**
* 商品管理列表
*/
@GetMapping("/canUsegoods")
public CommonResult canUseGoods(Long partnerId)
{
public CommonResult canUseGoods(Long partnerId) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = partnerList.getById(partnerId);
if (!partners.getUserId().equals(user.getId())) {
@ -253,12 +251,12 @@ public class PartnerOwnController extends BaseController {
}
return success(partnerList.canUseGoods(partnerId));
}
/**
* 商品详细信息
*/
@GetMapping("/goodsDetail")
public CommonResult goodsDetail(Long goodsId)
{
public CommonResult goodsDetail(Long goodsId) {
return success(partnerList.goodsDetail(goodsId));
}
@ -270,11 +268,13 @@ public class PartnerOwnController extends BaseController {
partnerList.editGoods(goods);
return success();
}
@PostMapping("/editSkuPrice")
public CommonResult editSkuPrice(@RequestBody ShopInspectionGoods goods) throws Exception {
partnerList.editSkuPrice(goods);
return success();
}
/**
* 上下架
*/
@ -283,6 +283,7 @@ public class PartnerOwnController extends BaseController {
partnerList.changeListing(goodsId);
return success();
}
/**
* 删除商品
*/
@ -291,12 +292,12 @@ public class PartnerOwnController extends BaseController {
partnerList.delGoods(goodsId);
return success();
}
/**
* 管理店铺信息
*/
@PostMapping("/getPartnerInfo")
public CommonResult getPartnerInfo(Long partnerId)
{
public CommonResult getPartnerInfo(Long partnerId) {
return success(partnerList.getPartnerInfo(partnerId));
}
@ -304,8 +305,7 @@ public class PartnerOwnController extends BaseController {
* 管理店铺信息
*/
@PostMapping("/editPartnerInfo")
public CommonResult editPartnerInfo(@RequestBody ShopMallPartners partners)
{
public CommonResult editPartnerInfo(@RequestBody ShopMallPartners partners) {
partnerList.editPartnerInfo(partners);
return success();
}
@ -314,8 +314,7 @@ public class PartnerOwnController extends BaseController {
* 店铺账户信息
*/
@GetMapping("/accountInfo")
public CommonResult accountInfo(Long partnerId)
{
public CommonResult accountInfo(Long partnerId) {
return success(partnerList.accountInfo(partnerId));
}
@ -325,20 +324,19 @@ public class PartnerOwnController extends BaseController {
@GetMapping("/accountDetail")
public CommonResult accountDetail(Long partnerId,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<PartnerBalanceDetail> page = new Page<>(pageNum, pageSize);
IPage<PartnerBalanceDetail> details = partnerList.accountDetail(page, partnerId, pageNum, pageSize);
return success(details);
}
/**
* 当前店铺的订单信息
*/
@GetMapping("/orderList")
public CommonResult orderList(Long partnerId, String phoneNum, String title,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partnersTmp = partnerList.getById(partnerId);
if (!partnersTmp.getUserId().equals(user.getId())) {
@ -348,6 +346,7 @@ public class PartnerOwnController extends BaseController {
IPage<OrderAppDetail> orderInfos = partnerList.orderList(page, partnerId, phoneNum, title);
return success(orderInfos);
}
/**
* 通过核销码获取订单信息
*/
@ -361,11 +360,11 @@ public class PartnerOwnController extends BaseController {
* 当前的订单信息
*/
@GetMapping("/orderDetail")
public CommonResult orderDetail(Long partnerId, Long orderId)
{
public CommonResult orderDetail(Long partnerId, Long orderId) {
OrderAppDetail orderInfos = partnerList.orderDetail(partnerId, orderId);
return success(orderInfos);
}
/**
* 店铺核销功能
*/
@ -374,6 +373,7 @@ public class PartnerOwnController extends BaseController {
partnerList.takeOut(partnerId, orderId, workId, carNum);
return success();
}
@PostMapping("/addWorker")
public CommonResult addWorker(Long partnerId, String realName, String phoneNum, Long postId) throws Exception {
@ -385,8 +385,7 @@ public class PartnerOwnController extends BaseController {
* 获取员工信息
*/
@GetMapping("/getWorkList")
public CommonResult<IPage<?>> getWorkList(Long partnerId, String workName, String phoneNum, Long postId, Integer pageNum, Integer pageSize)
{
public CommonResult<IPage<?>> getWorkList(Long partnerId, String workName, String phoneNum, Long postId, Integer pageNum, Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
// ShopMallPartners partnersTmp = partnerList.getById(partnerId);
// if (!partnersTmp.getUserId().equals(user.getId())){
@ -444,24 +443,28 @@ public class PartnerOwnController extends BaseController {
IPage<InspectionInfo> inspectionInfos = partnerList.inspectionList(page, partnerId, status, searchValue);
return success(inspectionInfos);
}
//增加检测步骤信息
@PostMapping("/addStepInfo")
public CommonResult addStepInfo(@RequestBody InspectionStepInfo stepInfo) {
partnerList.addStepInfo(stepInfo);
return success();
}
//增加检测结果
@PostMapping("/stopInspection")
public CommonResult editInspection(@RequestBody InspectionInfo info) throws Exception {
partnerList.stopInspection(info);
return success();
}
//完成制证
@PostMapping("/makeCertOk")
public CommonResult makeCertOk(Long inspectionId) {
partnerList.makeCertOk(inspectionId);
return success();
}
//获取到店预约的数据
@GetMapping("/getAppointmentList")
public CommonResult getAppointmentList(Long partnerId, String phoneNum, Integer pageSize, Integer pageNum) {
@ -531,6 +534,7 @@ public class PartnerOwnController extends BaseController {
IPage<ShopCouponTemplate> shopCouponTemplates = partnerList.listCoupon(page, partnerId, searchValue);
return success(shopCouponTemplates);
}
//删除优惠券
@PostMapping("/delCoupon")
public CommonResult delCoupon(Long partnerId, Long id) {
@ -613,6 +617,7 @@ public class PartnerOwnController extends BaseController {
dictDataService.deleteDictData(dictId);
return success();
}
//批量删除客户来源
@PostMapping("/delCustomerSourceBatch")
public CommonResult delCustomerSourceBatch(@RequestBody List<Long> dictIds) {
@ -621,20 +626,18 @@ public class PartnerOwnController extends BaseController {
}
@PostMapping("/vehicleLicenseOCR")
public CommonResult vehicleLicenseOCR(String imagePath) throws Exception
{
public CommonResult vehicleLicenseOCR(String imagePath) throws Exception {
return success(partnerList.vehicleLicenseOCR(imagePath));
}
//线下收费
@PostMapping("/offlineCharging")
public CommonResult offlineCharging(@RequestBody InspectionInfoVo infoVo)
{
public CommonResult offlineCharging(@RequestBody InspectionInfoVo infoVo) {
partnerList.offlineCharging(infoVo);
return success();
}
//获取收款账号
@GetMapping("/getBankAccountList")
public CommonResult getBankAccountList(String searchValue) throws Exception {
@ -705,6 +708,7 @@ public class PartnerOwnController extends BaseController {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable1(partners.getPartnerId(), startTime, endTime));
}
//统计表格1
@GetMapping("/newStaticsTable1")
public CommonResult newStaticsTable1(String startTime, String endTime) throws Exception {
@ -717,34 +721,40 @@ public class PartnerOwnController extends BaseController {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable2(partners.getPartnerId(), startTime, endTime));
}
//新统计表格2
@GetMapping("/newStaticsTable2")
public CommonResult newStaticsTable2(String startTime, String endTime) throws Exception {
return success(partnerList.newStaticsTable2(startTime, endTime));
}
//统计表格3
@GetMapping("/staticsTable3")
public CommonResult staticsTable3(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable3(partners.getPartnerId(), startTime, endTime));
}
//新统计表格3
@GetMapping("/newStaticsTable3")
public CommonResult newStaticsTable3(String startTime, String endTime) throws Exception {
return success(partnerList.newStaticsTable3(startTime, endTime));
}
//统计表格3
@GetMapping("/staticsTable3Detail")
public CommonResult staticsTable3Detail(String startTime, String endTime, String remark) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable3Detail(partners.getPartnerId(), startTime, endTime, remark));
}
//统计表格4
@GetMapping("/staticsTable4")
public CommonResult staticsTable4(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable4(partners.getPartnerId(), startTime, endTime));
}
//统计表格5
@GetMapping("/staticsTable5")
public CommonResult staticsTable5(String startTime, String endTime) throws Exception {
@ -755,9 +765,9 @@ public class PartnerOwnController extends BaseController {
/**
* 根据inspection_info的id查有的项目名称
*
* @param ids inspection_info的id
* @author 小李
* @date 14:52 2024/12/10
* @param ids inspection_info的id
**/
@GetMapping("/getProjectByIds")
public CommonResult<?> getProjectByIds(Long[] ids) {
@ -767,19 +777,36 @@ public class PartnerOwnController extends BaseController {
/**
* 根据时间查订单
*
* @author 小李
* @date 14:39 2024/12/12
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
* @param pageNum 页码
* @param pageSize 条数
* @author 小李
* @date 14:39 2024/12/12
**/
@GetMapping("/getOrderByDate")
public CommonResult<?> getOrderByDate(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "chooseStatus", required = false) String chooseStatus,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<OrderTable> page = new Page<>(pageNum, pageSize);
return success(partnerList.getOrderByDate(startTime, endTime, page));
return success(partnerList.getOrderByDate(startTime, endTime, chooseStatus, page));
}
/**
* 分类计数
*
* @author 小李
* @date 17:14 2024/12/16
* @param startTime 开始时间
* @param endTime 结束时间
* @param chooseStatus 状态
**/
@GetMapping("/getTypeCount")
public CommonResult<?> getTypeCount(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "chooseStatus", required = false) String chooseStatus){
return success(partnerList.getTypeCount(startTime, endTime, chooseStatus));
}
}

View File

@ -74,5 +74,16 @@ public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners>
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
**/
IPage<OrderTable> getOrderByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, Page<OrderTable> page);
IPage<OrderTable> getOrderByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("chooseStatus") String chooseStatus, Page<OrderTable> page);
/**
* 分类计数
*
* @author 小李
* @date 17:14 2024/12/16
* @param startTime 开始时间
* @param endTime 结束时间
* @param chooseStatus 状态
**/
List<Map<String, Long>> getTypeCount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("chooseStatus") String chooseStatus);
}

View File

@ -128,5 +128,16 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
* @param startTime 开始时间 非必传
* @param endTime 结束时间 非必传
**/
IPage<OrderTable> getOrderByDate(String startTime, String endTime, Page<OrderTable> page);
IPage<OrderTable> getOrderByDate(String startTime, String endTime, String chooseStatus, Page<OrderTable> page);
/**
* 分类计数
*
* @author 小李
* @date 17:14 2024/12/16
* @param startTime 开始时间
* @param endTime 结束时间
* @param chooseStatus 状态
**/
Map<String, Long> getTypeCount(String startTime, String endTime, String chooseStatus);
}

View File

@ -1951,13 +1951,34 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
* @param endTime 结束时间 非必传
**/
@Override
public IPage<OrderTable> getOrderByDate(String startTime, String endTime, Page<OrderTable> page){
public IPage<OrderTable> getOrderByDate(String startTime, String endTime, String chooseStatus, Page<OrderTable> page){
if (StringUtils.isEmpty(startTime)){
startTime = DateUtil.format(new Date(), "yyyy-MM-dd");
endTime = DateUtil.format(new Date(), "yyyy-MM-dd");
}
startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59";
return baseMapper.getOrderByDate(startTime, endTime, page);
return baseMapper.getOrderByDate(startTime, endTime, chooseStatus, page);
}
/**
* 分类计数
*
* @author 小李
* @date 17:14 2024/12/16
* @param startTime 开始时间
* @param endTime 结束时间
* @param chooseStatus 状态
**/
@Override
public Map<String, Long> getTypeCount(String startTime, String endTime, String chooseStatus){
if (StringUtils.isEmpty(startTime)){
startTime = DateUtil.format(new Date(), "yyyy-MM-dd");
endTime = DateUtil.format(new Date(), "yyyy-MM-dd");
}
startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59";
List<Map<String, Long>> typeCount = baseMapper.getTypeCount(startTime, endTime, chooseStatus);
return typeCount.stream().collect(Collectors.toMap(map -> String.valueOf(map.get("type")), map -> map.get("count")));
}
}

View File

@ -574,6 +574,78 @@ FROM
ii.id = iwn_agg.inspection_info_id
WHERE oi.create_time BETWEEN #{startTime} AND #{endTime}
AND oi.deleted = '0') t
<where>
<choose>
<when test="chooseStatus == '2'.toString()">
t.status = '检测中'
</when>
<when test="chooseStatus == '3'.toString()">
t.status = '已完成'
</when>
</choose>
</where>
ORDER BY t.create_time DESC
</select>
<select id="getTypeCount" resultType="java.util.Map">
SELECT t2.type as type, COUNT(*) as count FROM (
SELECT t.id,
t.carNum,
t.type,
t.pay,
t.payType,
CASE
WHEN t.status = '已完成' AND t.is_pass = 0 THEN '不合格'
WHEN t.status = '已完成' AND t.is_pass = 1 THEN '合格'
WHEN t.status = '已完成' THEN '未知'
ELSE ''
END AS result,
t.status
FROM (SELECT ii.id,
ii.car_num AS carNum,
oi.sku_name AS type,
oi.pay_type as payType,
CASE
WHEN oi.pay_type IS NULL THEN '未支付'
ELSE '已支付'
END AS pay,
CASE
WHEN oi.pay_type IS NOT NULL THEN '已完成'
WHEN has_status_0_or_null THEN '检测中'
WHEN (ii.status = 0 OR ii.status = 2) AND has_status_1 THEN '检测中'
WHEN (COALESCE(max_iwn_status, 0) = 2 OR ii.status = 1) THEN '已完成'
WHEN (ii.status = 0 OR ii.status = 2) AND COALESCE(max_iwn_status, 0) = 0 THEN '待检测'
ELSE '未知状态' -- 这是为了处理任何未预期的情况
END AS status,
ii.is_pass,
COALESCE(max_iwn_status, 0) AS max_iwn_status,
oi.create_time
FROM order_info oi
INNER JOIN
inspection_info ii
ON
oi.id = ii.inspection_order_id
LEFT JOIN (SELECT inspection_info_id,
MAX(COALESCE(status, 0)) AS max_iwn_status,
MAX(CASE WHEN COALESCE(status, 0) = 1 THEN 1 ELSE 0 END) AS has_status_1,
MAX(CASE WHEN COALESCE(status, 0) = 0 THEN 1 ELSE 0 END) AS has_status_0_or_null
FROM inspection_work_node
GROUP BY inspection_info_id) iwn_agg
ON
ii.id = iwn_agg.inspection_info_id
WHERE oi.create_time BETWEEN #{startTime} AND #{endTime}
AND oi.deleted = '0') t
<where>
<choose>
<when test="chooseStatus == '2'.toString()">
t.status = '检测中'
</when>
<when test="chooseStatus == '3'.toString()">
t.status = '已完成'
</when>
</choose>
</where>
) t2
GROUP BY t2.type
</select>
</mapper>