Merge branch 'repair'

This commit is contained in:
Vinjor 2024-12-06 10:27:25 +08:00
commit 34bc60945f
70 changed files with 3038 additions and 245 deletions

View File

@ -29,4 +29,22 @@ public class DictBaseConstants {
public static final String CYCLE_DICT = "cycle_dict";
/** 企业资产临期判定时间 */
public static final String COMPANY_PROPERTY_EXPIRED = "company_property_expired";
/** 客户状态 */
public static final String DICT_CUS_INFO_STATUS = "cus_info_status";
/** 卡券类型 */
public static final String MEMBER_COUPON_TYPE = "member_coupon_type";
/** 核销规则 */
public static final String MEMBER_COUPON_OUT_RULE = "member_coupon_out_rule";
/** 适用车型 */
public static final String MEMBER_CAR = "member_car";
/** 活动类型 */
public static final String MEMBER_ACTIVE = "member_active";
/** 品牌类型 */
public static final String DICT_BRAND_TYPE = "brand_type";
/** 车辆类别 */
public static final String DICT_CAR_CATEGORY = "car_category";
/** 车辆性质 */
public static final String DICT_CAR_NATURE = "car_nature";
/** 支付方式 */
public static final String REPAIR_PAY_TYPE = "repair_pay_type";
}

View File

@ -1,15 +1,15 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.service.UserCarService;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import cn.iocoder.yudao.module.custom.vo.*;
import cn.iocoder.yudao.module.label.service.BusiLabelService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -25,6 +25,7 @@ import javax.servlet.http.*;
import javax.validation.Valid;
import java.util.*;
import java.io.IOException;
import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@ -32,6 +33,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.common.BaseConstants.TABLE_BASE_CAR_MAIN;
import static cn.iocoder.yudao.common.BaseConstants.TABLE_BASE_CUSTOMER_MAIN;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
@ -167,7 +169,7 @@ public class CarMainController {
*/
@GetMapping("/export-excel")
@Operation(summary = "导出车辆信息 Excel")
@PreAuthorize("@ss.hasPermission('base:car-main:customer')")
@PreAuthorize("@ss.hasPermission('base:car-main:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCarMainExcel(CarMainReqVO pageReqVO, HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
@ -233,4 +235,94 @@ public class CarMainController {
public CommonResult<?> vehicleLicenseOCR(@RequestBody String imagePath) throws Exception {
return CommonResult.success(userCarService.vehicleLicenseOCR(imagePath));
}
/**
* 导出数据 年检临期
*
* @author 小李
* @date 11:38 2024/12/3
* @param pageReqVO 请求对象
**/
@GetMapping("/export-inspection")
@Operation(summary = "导出数据")
public void exportInspection(CarMainReqVO pageReqVO, HttpServletResponse response)throws IOException{
int pageNo = 1, pageSize = 1000;
List<InspectionExportVO> list = new ArrayList<>();
Page<CarMainReqVO> page = new Page<>(pageNo, pageSize);
do {
IPage<CarMainRespVO> carMainRespVOIPage = carMainService.remindCarMainPage2(page, pageReqVO);
List<CarMainRespVO> records = carMainRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<InspectionExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, InspectionExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "年检临期提醒数据.xls", "数据", InspectionExportVO.class, list);
}
/**
* 导出数据 保养临期
*
* @author 小李
* @date 12:19 2024/12/3
* @param pageReqVO 请求对象
**/
@GetMapping("/export-maintenance")
@Operation(summary = "导出数据")
public void exportMaintenance(CarMainReqVO pageReqVO, HttpServletResponse response)throws IOException{
int pageNo = 1, pageSize = 1000;
List<MaintenanceExportVO> list = new ArrayList<>();
Page<CarMainReqVO> page = new Page<>(pageNo, pageSize);
do {
IPage<CarMainRespVO> carMainRespVOIPage = carMainService.remindCarMainPage2(page, pageReqVO);
List<CarMainRespVO> records = carMainRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<MaintenanceExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, MaintenanceExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "保养临期提醒数据.xls", "数据", MaintenanceExportVO.class, list);
}
/**
* 导出数据 保险临期
*
* @author 小李
* @date 12:19 2024/12/3
* @param pageReqVO 请求对象
**/
@GetMapping("/export-insurance")
@Operation(summary = "导出数据")
public void exportInsurance(CarMainReqVO pageReqVO, HttpServletResponse response)throws IOException{
int pageNo = 1, pageSize = 1000;
List<InsuranceExportVO> list = new ArrayList<>();
Page<CarMainReqVO> page = new Page<>(pageNo, pageSize);
do {
IPage<CarMainRespVO> carMainRespVOIPage = carMainService.remindCarMainPage2(page, pageReqVO);
List<CarMainRespVO> records = carMainRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<InsuranceExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, InsuranceExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "保险临期提醒数据.xls", "数据", InsuranceExportVO.class, list);
}
}

View File

@ -1,10 +1,15 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerExportVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
@ -20,8 +25,12 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.BaseConstants.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
@ -44,6 +53,7 @@ public class CustomerMainController {
private BusiLabelService busiLabelService;
@Resource
private CustomerCarService customerCarService;
/**
* 客户管理分页列表查询
*
@ -76,7 +86,7 @@ public class CustomerMainController {
@Operation(summary = "创建客户管理")
@PreAuthorize("@ss.hasPermission('base:customer-main:create')")
public CommonResult<Boolean> createCustomerMain(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) {
customerMainService.saveCustomer(saveReqVO,SIGN_CREATE);
customerMainService.saveCustomer(saveReqVO, SIGN_CREATE);
return success(true);
}
@ -99,7 +109,7 @@ public class CustomerMainController {
@Operation(summary = "更新客户管理")
@PreAuthorize("@ss.hasPermission('base:customer-main:update')")
public CommonResult<Boolean> updateCustomerMain(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) {
customerMainService.saveCustomer(saveReqVO,SIGN_UPDATE);
customerMainService.saveCustomer(saveReqVO, SIGN_UPDATE);
return success(true);
}
@ -185,10 +195,10 @@ public class CustomerMainController {
/**
* 根据姓名和电话查询单条记录
*
* @param customerMain 查询对象
* @author 小李
* @date 11:19 2024/10/8
* @param customerMain 查询对象
**/
**/
@PostMapping("/getByNameAndMobile")
@Operation(summary = "根据姓名和电话查询单条记录")
public CommonResult<?> getByNameAndMobile(@Valid @RequestBody CustomerMain customerMain) {
@ -201,4 +211,39 @@ public class CustomerMainController {
}
throw exception0(500, "系统异常");
}
/**
* 导出数据
*
* @author 小李
* @date 19:33 2024/12/2
* @param pageReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(CustomerMainPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
int pageNo = 1, pageSize = 1000;
List<CustomerExportVO> list = new ArrayList<>();
Page<CustomerMainRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<CustomerMainRespVO> customerMainRespVOIPage = customerMainService.queryListPage(pageReqVO, page);
List<CustomerMainRespVO> records = customerMainRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<CustomerExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, CustomerExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
list.forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getIsHangAccount())){
item.setIsHangAccount(item.getIsHangAccount().equals("0") ? "" : "");
}
});
ExcelUtils.write(response, "客户数据.xls", "数据", CustomerExportVO.class, list);
}
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ -12,6 +13,8 @@ import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import static cn.iocoder.yudao.common.DictBaseConstants.DICT_BRAND_TYPE;
/**
* 车辆品牌维护 DO
*
@ -76,6 +79,7 @@ public class CarBrand extends BaseDO {
*/
@Schema(description = "品牌类型 01国产车 02韩系车 03日系车 04美系车 05欧系车 06德系车", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "品牌类型 01国产车 02韩系车 03日系车 04美系车 05欧系车 06德系车", converter = DictConvert.class)
@DictFormat(DICT_BRAND_TYPE)
private String brandType;
/**
* 品牌键值

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -12,6 +15,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.common.DictBaseConstants.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
/**
@ -36,14 +40,17 @@ public class CarMain extends TenantBaseDO {
/**
* 发动机号码
*/
@ExcelProperty("发动机号码")
private String engineNumber;
/**
* 车架号
*/
@ExcelProperty("车架号")
private String vin;
/**
* 车牌号
*/
@ExcelProperty("车牌号")
private String licenseNumber;
/**
* 车辆型号
@ -106,16 +113,21 @@ public class CarMain extends TenantBaseDO {
/**
* 车辆性质营运 非营运等
*/
@ExcelProperty(value = "车辆性质", converter = DictConvert.class)
@DictFormat(DICT_CAR_NATURE)
private String carNature;
/**
* 车辆类别私家车 货车 教练车 公务车 出租车
*/
@ExcelProperty(value = "车辆类别", converter = DictConvert.class)
@DictFormat(DICT_CAR_CATEGORY)
private String carCategory;
/**
* 车辆注册日期
*/
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("车辆注册日期")
private LocalDateTime carRegisterDate;
/**
* 行驶证图片
@ -124,11 +136,15 @@ public class CarMain extends TenantBaseDO {
/**
* 最近办理业务
*/
@ExcelProperty(value = "最近办理业务", converter = DictConvert.class)
@DictFormat(DICT_CUS_BUSI_TYPE)
private String recentlyHandledBusiness;
/**
* 最近办理业务的时间
*/
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("最近业务时间")
private LocalDateTime recentlyHandleBusinessTime;

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@ -82,6 +83,15 @@ public interface CarMainService extends IService<CarMain> {
**/
IPage<CarMainRespVO> remindCarMainPage(CarMainReqVO pageReqVO);
/**
* 对外提供一个导出用
*
* @author 小李
* @date 12:03 2024/12/3
* @param pageReqVO 查询条件
**/
IPage<CarMainRespVO> remindCarMainPage2(Page<CarMainReqVO> page, CarMainReqVO pageReqVO);
/**
* 绑定车辆信息

View File

@ -242,6 +242,18 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
return baseMapper.remindCarMainPage(page,pageReqVO);
}
/**
* 对外提供一个导出用
*
* @author 小李
* @date 12:03 2024/12/3
* @param pageReqVO 查询条件
**/
@Override
public IPage<CarMainRespVO> remindCarMainPage2(Page<CarMainReqVO> page, CarMainReqVO pageReqVO){
return baseMapper.remindCarMainPage(page, pageReqVO);
}
/**
* 绑定客户信息
*

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.label.entity.BusiLabel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@ -10,6 +11,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 车辆信息 Response VO")
@ -27,8 +29,10 @@ public class CarMainRespVO extends CarMain {
@Schema(description = "标签信息")
List<BusiLabel> labelList;
/**品牌字符*/
@ExcelProperty("车辆品牌")
String brandStr;
/**型号字符*/
@ExcelProperty("车辆型号")
String modelStr;
/**客户名称*/
String cusName;
@ -46,4 +50,9 @@ public class CarMainRespVO extends CarMain {
private String brandType;
/** 车辆logo */
private String logoImg;
/** 登记时间 */
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("登记时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
import static cn.iocoder.yudao.common.DictBaseConstants.*;
/**
* 用于导出客户数据VO
*
* @author 小李
* @date 19:20 2024/12/2
**/
@Data
@ExcelIgnoreUnannotated
public class CustomerExportVO {
@ExcelProperty("客户名称")
private String cusName;
@ExcelProperty(value = "性别", converter = DictConvert.class)
@DictFormat(DICT_SYS_USER_SEX)
private String sex;
@ExcelProperty("会员等级")
private String levelName;
@ExcelProperty("联系方式")
private String phoneNumber;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("生日")
private LocalDateTime birthday;
@ExcelProperty("住址")
private String address;
@ExcelProperty("是否挂账")
private String isHangAccount;
@ExcelProperty(value = "客户来源", converter = DictConvert.class)
@DictFormat(DICT_CUS_DATA_FROM)
private String dataFrom;
@ExcelProperty(value = "最近办理业务", converter = DictConvert.class)
@DictFormat(DICT_CUS_BUSI_TYPE)
private String nearDoContent;
@ExcelProperty("最近业务办理时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private LocalDateTime nearDoTime;
@ExcelProperty(value = "客户状态", converter = DictConvert.class)
@DictFormat(DICT_CUS_INFO_STATUS)
private String status;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.custom.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
/**
* 用于车检临期数据导出VO
*
* @author 小李
* @date 11:49 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class InspectionExportVO extends SyntheticExportVO{
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("上次年检时间")
private LocalDateTime inspectionDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("下次年检时间")
private LocalDateTime nextInspectionDate;
@ExcelProperty("临近年检天数")
private String njCont;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.custom.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
/**
* 用户导出保险临期提醒数据VO
*
* @author 小李
* @date 12:23 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class InsuranceExportVO extends SyntheticExportVO{
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("保险日期")
private LocalDateTime insuranceDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("保险到期日期")
private LocalDateTime insuranceExpiryDate;
@ExcelProperty("保险到期天数")
private String bxCont;
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.custom.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
/**
* 用于保养临期提醒VO
*
* @author 小李
* @date 12:14 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class MaintenanceExportVO extends SyntheticExportVO{
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("保养日期")
private LocalDateTime maintenanceDate;
@ExcelProperty("保养里程")
private BigDecimal maintenanceMileage;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@ExcelProperty("下次保养日期")
private LocalDateTime nextMaintenanceDate;
@ExcelProperty("下次保养里程")
private BigDecimal nextMaintenanceMileage;
@ExcelProperty("临近保养天数")
private String byCont;
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import static cn.iocoder.yudao.common.DictBaseConstants.DICT_CAR_CATEGORY;
import static cn.iocoder.yudao.common.DictBaseConstants.DICT_CAR_NATURE;
/**
* 用于车检临期保养临期保险临期数据导出公共数据VO
*
* @author 小李
* @date 11:49 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class SyntheticExportVO {
@ExcelProperty("车牌号")
private String licenseNumber;
@ExcelProperty("车辆品牌")
String brandStr;
@ExcelProperty("车辆型号")
String modelStr;
@ExcelProperty(value = "车辆类别", converter = DictConvert.class)
@DictFormat(DICT_CAR_CATEGORY)
private String carCategory;
@ExcelProperty(value = "车辆性质", converter = DictConvert.class)
@DictFormat(DICT_CAR_NATURE)
private String carNature;
@ExcelProperty("联系人")
private String cusName;
@ExcelProperty("联系方式")
private String phoneNumber;
}

View File

@ -1,9 +1,13 @@
package cn.iocoder.yudao.module.member.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.member.entity.ActiveMain;
import cn.iocoder.yudao.module.member.service.ActiveMainService;
import cn.iocoder.yudao.module.member.vo.ActiveMainExportVO;
import cn.iocoder.yudao.module.member.vo.ActiveMainPageReqVO;
import cn.iocoder.yudao.module.member.vo.ActiveMainRespVO;
import cn.iocoder.yudao.module.member.vo.ActiveMainSaveReqVO;
@ -17,10 +21,15 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 营销活动")
@ -111,4 +120,38 @@ public class ActiveMainController {
return success(activeMainService.queryListPage(pageReqVO, page));
}
/**
* 导出数据
*
* @author 小李
* @date 20:25 2024/12/2
* @param pageReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(ActiveMainPageReqVO pageReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
List<ActiveMainExportVO> list = new ArrayList<>();
Page<ActiveMainRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<ActiveMainRespVO> activeMainRespVOIPage = activeMainService.queryListPage(pageReqVO, page);
List<ActiveMainRespVO> records = activeMainRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<ActiveMainExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, ActiveMainExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
list.forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getStatus())){
item.setStatus(item.getStatus().equals("01") ? "启用" : "停用");
}
});
ExcelUtils.write(response, "营销活动数据.xls", "数据", ActiveMainExportVO.class, list);
}
}

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.member.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
@ -8,10 +10,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.member.entity.MemberCoupon;
import cn.iocoder.yudao.module.member.service.MemberCouponService;
import cn.iocoder.yudao.module.member.vo.MemberCouponPageReqVO;
import cn.iocoder.yudao.module.member.vo.MemberCouponRespVO;
import cn.iocoder.yudao.module.member.vo.MemberCouponSaveReqVO;
import cn.iocoder.yudao.module.member.vo.MemberLevelRespVO;
import cn.iocoder.yudao.module.member.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
@ -25,9 +24,12 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 基础卡券")
@ -138,5 +140,34 @@ public class MemberCouponController {
return success(couponService.queryListPage(pageReqVO, page));
}
/**
* 导出数据
*
* @author 小李
* @date 19:53 2024/12/2
* @param pageReqVO 请求数据
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(MemberCouponPageReqVO pageReqVO, HttpServletResponse response)throws IOException{
int pageNo = 1, pageSize = 1000;
List<MemberCouponExportVO> list = new ArrayList<>();
Page<MemberCouponRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<MemberCouponRespVO> memberCouponRespVOIPage = couponService.queryListPage(pageReqVO, page);
List<MemberCouponRespVO> records = memberCouponRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<MemberCouponExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, MemberCouponExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "基础卡券数据.xls", "数据", MemberCouponExportVO.class, list);
}
}

View File

@ -1,9 +1,13 @@
package cn.iocoder.yudao.module.member.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.member.entity.MemberLevel;
import cn.iocoder.yudao.module.member.service.MemberLevelService;
import cn.iocoder.yudao.module.member.vo.MemberLevelExportVO;
import cn.iocoder.yudao.module.member.vo.MemberLevelPageReqVO;
import cn.iocoder.yudao.module.member.vo.MemberLevelRespVO;
import cn.iocoder.yudao.module.member.vo.MemberLevelSaveReqVO;
@ -17,10 +21,15 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -127,4 +136,39 @@ public class MemberLevelController {
return success(levelService.queryListAll(pageReqVO));
}
/**
* 导出数据
*
* @author 小李
* @date 19:41 2024/12/2
* @param pageReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(MemberLevelPageReqVO pageReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
List<MemberLevelExportVO> list = new ArrayList<>();
Page<MemberLevelRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<MemberLevelRespVO> memberLevelRespVOIPage = levelService.queryListPage(pageReqVO, page);
List<MemberLevelRespVO> records = memberLevelRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<MemberLevelExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, MemberLevelExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
list.forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getStatus())){
item.setStatus(item.getStatus().equals("01") ? "启用" : "停用");
}
});
ExcelUtils.write(response, "会员等级数据.xls", "数据", MemberLevelExportVO.class, list);
}
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.member.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.common.DictBaseConstants.MEMBER_ACTIVE;
/**
* 用于导出营销活动VO
*
* @author 小李
* @date 20:26 2024/12/2
**/
@Data
@ExcelIgnoreUnannotated
public class ActiveMainExportVO {
@ExcelProperty("活动名称")
private String name;
@ExcelProperty(value = "活动类型", converter = DictConvert.class)
@DictFormat(MEMBER_ACTIVE)
private String type;
@ExcelProperty("活动开始时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime beginTime;
@ExcelProperty("活动结束时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTime;
@ExcelProperty("活动状态")
private String status;
@ExcelProperty("活动描述")
private String remark;
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.member.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.common.DictBaseConstants.*;
/**
* 用于基础卡券导出VO
*
* @author 小李
* @date 19:55 2024/12/2
**/
@Data
@ExcelIgnoreUnannotated
public class MemberCouponExportVO {
@ExcelProperty("卡券名称")
private String name;
@ExcelProperty(value = "卡券类型", converter = DictConvert.class)
@DictFormat(MEMBER_COUPON_TYPE)
private String type;
@ExcelProperty(value = "适用车型", converter = DictConvert.class)
@DictFormat(MEMBER_CAR)
private String carModel;
@ExcelProperty(value = "核销规则", converter = DictConvert.class)
@DictFormat(MEMBER_COUPON_OUT_RULE)
private String outRule;
@ExcelProperty("开始有效期")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime beginTime;
@ExcelProperty("结束有效期")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTime;
@ExcelProperty("面额")
private BigDecimal amount;
@ExcelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.member.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 用于会员等级导出VO
*
* @author 小李
* @date 19:42 2024/12/2
**/
@Data
@ExcelIgnoreUnannotated
public class MemberLevelExportVO {
@ExcelProperty("等级名称")
private String name;
@ExcelProperty("状态")
private String status;
@ExcelProperty("升级所需积分")
private String growthValue;
@ExcelProperty("会员折扣")
private BigDecimal discount;
@ExcelProperty("等级说明")
private String remark;
@ExcelProperty("等级权益")
private String userEquity;
}

View File

@ -1,9 +1,12 @@
package cn.iocoder.yudao.module.order.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
import cn.iocoder.yudao.module.order.vo.RepairOrderExportVO;
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoPageReqVO;
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO;
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoSaveReqVO;
@ -17,13 +20,18 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 维修模块 订单")
@ -113,4 +121,48 @@ public class RepairOrderInfoController {
public CommonResult<?> toPay(@RequestParam("id")String id) throws IOException, NoSuchAlgorithmException, SignatureException, InvalidKeyException {
return success(repairOrderInfoService.payTransactionsCode(id));
}
/**
* 导出数据
*
* @author 小李
* @date 17:03 2024/12/3
* @param pageReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(RepairOrderInfoPageReqVO pageReqVO, HttpServletResponse response)throws IOException{
int pageNo = 1, pageSize = 1000;
List<RepairOrderExportVO> list = new ArrayList<>();
Page<RepairOrderInfoRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<RepairOrderInfoRespVO> repairOrderInfoRespVOIPage = repairOrderInfoService.queryListPage(pageReqVO, page);
List<RepairOrderInfoRespVO> records = repairOrderInfoRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<RepairOrderExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, RepairOrderExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
list.forEach(item -> {
switch (item.getGoodsType()){
case "1":
item.setGoodsType("会员充值");
break;
case "2":
item.setGoodsType("维修服务");
break;
case "3":
item.setGoodsType("保养卡");
break;
}
item.setOrderStatus(item.getOrderStatus().equals("0") ? "待支付" : "已支付");
});
ExcelUtils.write(response, "订单数据.xls", "数据", RepairOrderExportVO.class, list);
}
}

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.order.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.common.DictBaseConstants.REPAIR_PAY_TYPE;
/**
* 用于维修订单导出VO
*
* @author 小李
* @date 17:05 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class RepairOrderExportVO {
@ExcelProperty("订单号")
private String orderNo;
@ExcelProperty("服务名称")
private String goodsTitle;
@ExcelProperty("消费类型")
private String goodsType;
@ExcelProperty("客户姓名")
private String cusName;
@ExcelProperty("客户手机号")
private String cusPhone;
@ExcelProperty("商品原价(元)")
private BigDecimal goodsPrice;
@ExcelProperty("实付金额(元)")
private BigDecimal payMoney;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ExcelProperty("下单时间")
private LocalDateTime orderTime;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ExcelProperty("支付时间")
private LocalDateTime payTime;
@ExcelProperty(value = "支付方式", converter = DictConvert.class)
@DictFormat(REPAIR_PAY_TYPE)
private String payType;
@ExcelProperty("订单状态")
private String orderStatus;
}

View File

@ -1,12 +1,16 @@
package cn.iocoder.yudao.module.supplier.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import cn.iocoder.yudao.module.supplier.service.BaseSupplierService;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO;
import cn.iocoder.yudao.module.supplier.vo.SupplierExportVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -18,8 +22,15 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 供应商")
@ -137,4 +148,40 @@ public class BaseSupplierController {
.like(BaseSupplier::getName,name);
return success(baseSupplierService.list(queryWrapper));
}
/**
* 导出数据
*
* @author 小李
* @date 17:30 2024/12/2
* @param pageReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(BaseSupplierPageReqVO pageReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
List<SupplierExportVO> list = new ArrayList<>();
Page<BaseSupplierRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<BaseSupplierRespVO> baseSupplierRespVOIPage = baseSupplierService.queryListPage(pageReqVO, page);
List<BaseSupplierRespVO> records = baseSupplierRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<SupplierExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, SupplierExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
list.forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getStatus())){
item.setStatus(item.getStatus().equals("01") ? "启用" : "禁用");
}
item.setCorpId(ObjectUtil.isEmpty(item.getCorpId()) ? "未绑定": "已绑定");
});
ExcelUtils.write(response, "供应商数据.xls", "数据", SupplierExportVO.class, list);
}
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.supplier.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 用于导出供应商VO
*
* @author 小李
* @date 17:30 2024/12/2
**/
@Data
@ExcelIgnoreUnannotated
public class SupplierExportVO {
@ExcelProperty("供应商名称")
private String name;
@ExcelProperty("联系人")
private String linkName;
@ExcelProperty("联系电话")
private String linkPhone;
@ExcelProperty("手机号码")
private String phone;
@ExcelProperty("传真")
private String fax;
@ExcelProperty("地址")
private String address;
@ExcelProperty("状态")
private String status;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("绑定状态")
private String corpId;
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.common;
/**
* 维修相关字典枚举
*
* @author 小李
* @date 15:48 2024/11/29
**/
public interface RepairDictConstants {
/** 单位 */
String REPAIR_UNIT = "repair_unit";
/** 配件来源 */
String WARES_DATA_FORM = "repair_data_form";
/** 配件属性 */
String WARES_ATTRIBUTE = "repair_attribute";
/** 配件相关提醒配置 */
String REPAIR_WARES_NOTICE = "repair_wares_notice";
/** 维修工人工种 */
String REPAIR_WORK_TYPE = "repair_work_type";
/** 维修类别 */
String REPAIR_TYPE = "repair_type";
/** 配件申请单审核状态 */
String TICKET_WARES_STATUS = "ticket_wares_status";
/** 库存操作单据状态 */
String REPAIR_SO_STATUS = "repair_so_status";
/** 调拨状态 */
String REPAIR_ST_STATUS = "repair_st_status";
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.project.service.RepairWaresService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 配件库存低于几个可以自己设置需要做库存预警
*
* @author 小李
* @date 14:40 2024/11/30
**/
@Component
@TenantJob
@Slf4j
public class WaresStockBelowJob implements JobHandler {
@Resource
private RepairWaresService waresService;
@Override
public String execute(String param) throws Exception {
waresService.stockBelow();
return null;
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.project.service.RepairWaresService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 配件入库超多少天可以自己设置没用的话需要做一个临期提醒
*
* @author 小李
* @date 14:40 2024/11/30
**/
@Component
@TenantJob
@Slf4j
public class WaresTimeOverJob implements JobHandler {
@Resource
@Lazy
private RepairWaresService waresService;
@Override
public String execute(String param) throws Exception {
waresService.timeOver();
return null;
}
}

View File

@ -1,15 +1,19 @@
package cn.iocoder.yudao.module.base.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.MessageSend;
import cn.iocoder.yudao.common.dto.MessageDTO;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.app.controller.admin.NotifyMessageSocket;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
import cn.iocoder.yudao.module.base.vo.WorkerExportVO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -21,11 +25,14 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.BaseConstants.QUALS_INTERIM_PERIOD;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -168,4 +175,41 @@ public class RepairWorkerController {
}
return ok();
}
/**
* 导出数据
*
* @author 小李
* @date 17:50 2024/12/2
* @param pageReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(RepairWorkerPageReqVO pageReqVO, HttpServletResponse response)throws IOException{
int pageNo = 1, pageSize = 1000;
List<WorkerExportVO> list = new ArrayList<>();
Page<RepairWorkerRespVO> page = new Page<>(pageNo,pageSize);
do {
IPage<RepairWorkerRespVO> repairWorkerRespVOIPage = workerService.queryListPage(pageReqVO, page);
List<RepairWorkerRespVO> records = repairWorkerRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<WorkerExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, WorkerExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
list.forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getIsLeads())){
item.setIsLeads(item.getIsLeads().equals("1") ? "班组长" : "维修工");
}
});
ExcelUtils.write(response, "维修工人数据.xls", "数据", WorkerExportVO.class, list);
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.common.RepairDictConstants;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 用于导出维修工人VO
*
* @author 小李
* @date 17:45 2024/12/2
**/
@Data
@ExcelIgnoreUnannotated
public class WorkerExportVO {
@ExcelProperty("姓名")
private String userName;
@ExcelProperty(value = "工种", converter = DictConvert.class)
@DictFormat(RepairDictConstants.REPAIR_WORK_TYPE)
private String workType;
@ExcelProperty("角色")
private String isLeads;
@ExcelProperty("备注")
private String remark;
}

View File

@ -1,20 +1,30 @@
package cn.iocoder.yudao.module.other.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.other.entity.DlRepairOther;
import cn.iocoder.yudao.module.other.service.DlRepairOtherService;
import cn.iocoder.yudao.module.other.vo.DlRepairOtherReqVO;
import cn.iocoder.yudao.module.other.vo.DlRepairOtherRespVO;
import cn.iocoder.yudao.module.other.vo.OtherExportVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -84,5 +94,42 @@ public class DlRepairOtherController {
List<DlRepairOther> list = dlRepairOtherService.list(new LambdaQueryWrapper<DlRepairOther>().eq(DlRepairOther::getName, name));
return success(list.stream().max(Comparator.comparing(DlRepairOther::getCreateTime)).orElse(null));
}
/**
* 导出数据
*
* @author 小李
* @date 16:39 2024/12/2
* @param repairOtherReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(DlRepairOtherReqVO repairOtherReqVO, HttpServletResponse response) throws IOException {
int pageNo = 1, pageSize = 1000;
List<OtherExportVO> list = new ArrayList<>();
Page<DlRepairOther> page = new Page<>(pageNo, pageSize);
do {
IPage<DlRepairOther> otherPage = dlRepairOtherService.getOtherPage(repairOtherReqVO, page);
List<DlRepairOther> records = otherPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<OtherExportVO> convertedRecords = records.stream()
.map(item -> BeanUtils.toBean(item, OtherExportVO.class))
.collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
} while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "附加数据.xls", "数据", OtherExportVO.class, list);
}
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.other.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 用于导出维修附加内容的VO
*
* @author 小李
* @date 16:20 2024/12/2
**/
@Data
@ExcelIgnoreUnannotated
public class OtherExportVO {
@ExcelProperty("名称")
private String name;
@ExcelProperty("价格")
private BigDecimal price;
}

View File

@ -1,28 +1,38 @@
package cn.iocoder.yudao.module.project.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.conf.entity.BaseType;
import cn.iocoder.yudao.module.conf.entity.BaseWarehouse;
import cn.iocoder.yudao.module.conf.service.BaseTypeService;
import cn.iocoder.yudao.module.conf.service.BaseWarehouseService;
import cn.iocoder.yudao.module.project.entity.RepairProject;
import cn.iocoder.yudao.module.project.service.RepairProjectService;
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO;
import cn.iocoder.yudao.module.project.vo.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.context.annotation.Lazy;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 维修项目")
@ -34,6 +44,14 @@ public class RepairProjectController {
@Resource
private RepairProjectService repairProjectService;
@Resource
@Lazy
private BaseWarehouseService warehouseService;
@Resource
@Lazy
private BaseTypeService typeService;
/**
* 创建维修项目
*
@ -137,4 +155,46 @@ public class RepairProjectController {
public CommonResult getRepairProjectAndCateGory(){
return success(repairProjectService.getRepairProjectAndCateGory());
}
/**
* 导出数据
*
* @author 小李
* @date 17:09 2024/12/2
* @param pageReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(RepairProjectPageReqVO pageReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
List<ProjectExportVO> list = new ArrayList<>();
Page<RepairProjectRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<RepairProjectRespVO> repairProjectRespVOIPage = repairProjectService.queryListPage(pageReqVO, page);
List<RepairProjectRespVO> records = repairProjectRespVOIPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
records.forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getTypeName())){
item.setType(item.getTypeName());
}
});
List<ProjectExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, ProjectExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "维修项目数据.xls", "数据", ProjectExportVO.class, list);
}
}

View File

@ -1,22 +1,42 @@
package cn.iocoder.yudao.module.project.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.conf.entity.BaseType;
import cn.iocoder.yudao.module.conf.entity.BaseWarehouse;
import cn.iocoder.yudao.module.conf.service.BaseTypeService;
import cn.iocoder.yudao.module.conf.service.BaseWarehouseService;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.project.vo.RepairWaresPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresRespVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresSaveReqVO;
import cn.iocoder.yudao.module.project.vo.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.context.annotation.Lazy;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 配件库")
@ -28,6 +48,14 @@ public class RepairWaresController {
@Resource
private RepairWaresService waresService;
@Resource
@Lazy
private BaseWarehouseService warehouseService;
@Resource
@Lazy
private BaseTypeService typeService;
/**
* 创建配件库
*
@ -135,4 +163,106 @@ public class RepairWaresController {
return success(waresService.getAllTypeList());
}
/**
* 下载配件导入模板
*
* @author 小李
* @date 15:35 2024/11/29
**/
@GetMapping("/get-import-template")
@Operation(summary = "下载配件导入模板")
public void getImportTemplate(HttpServletResponse response) throws Exception {
List<RepairWaresExcelVO> list = Collections.singletonList(
RepairWaresExcelVO
.builder()
.barCode("123")
.code("123")
.name("模板数据")
.model("123")
.price(new BigDecimal("100"))
.purPrice(new BigDecimal("100"))
.type("模板分类")
.unit("01")
.warehouse("模板仓库")
.miniStock(new BigDecimal("0"))
.maxStock(new BigDecimal("10"))
.stock(new BigDecimal("5"))
// .attribute("yc")
.carModel("模板车型")
// .dataForm("bd")
.remark("模板")
.build()
);
ExcelUtils.write(response, "配件导入模板.xls", "配件信息", RepairWaresExcelVO.class, list);
}
/**
* 导入配件数据
*
* @author 小李
* @date 16:20 2024/11/29
* @param file Excel 文件
* @param updateSupport 是否支持更新
**/
@PostMapping("/import-data")
@Operation(summary = "导入配件数据")
@Parameters({
@Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
})
public CommonResult<ImportExcelRespVO> importData(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception{
List<RepairWaresExcelVO> list = ExcelUtils.read(file, RepairWaresExcelVO.class);
return success(waresService.importData(list, updateSupport));
}
/**
* 导出数据
*
* @author 小李
* @date 17:20 2024/12/2
* @param pageReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(RepairWaresPageReqVO pageReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
List<RepairWaresExcelVO> list = new ArrayList<>();
Page<RepairWaresRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<RepairWaresRespVO> waresPage = waresService.getWaresPage(pageReqVO, page);
List<RepairWaresRespVO> records = waresPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<RepairWaresExcelVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, RepairWaresExcelVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
List<BaseWarehouse> warehouses = warehouseService.list();
Map<String, String> warehousesMap = warehouses.stream().collect(Collectors.toMap(BaseWarehouse::getId, BaseWarehouse::getName));
List<BaseType> types = typeService.list(new LambdaQueryWrapper<BaseType>().eq(BaseType::getType, "02"));
Map<String, String> typesMap = types.stream().collect(Collectors.toMap(BaseType::getId, BaseType::getName));
list.forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getWarehouse()) && ObjectUtil.isNotEmpty(warehousesMap.get(item.getWarehouse()))){
item.setWarehouse(warehousesMap.get(item.getWarehouse()));
}
if (ObjectUtil.isNotEmpty(item.getType()) && ObjectUtil.isNotEmpty(typesMap.get(item.getType()))){
item.setType(typesMap.get(item.getType()));
}
});
ExcelUtils.write(response, "维修配件数据.xls", "数据", RepairWaresExcelVO.class, list);
}
}

View File

@ -1,9 +1,7 @@
package cn.iocoder.yudao.module.project.service;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.vo.RepairWaresPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresRespVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresSaveReqVO;
import cn.iocoder.yudao.module.project.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@ -80,4 +78,28 @@ public interface RepairWaresService extends IService<RepairWares> {
* @return java.util.List<cn.iocoder.yudao.module.project.entity.RepairWares>
**/
List<RepairWares> listByIds(List<String> idList);
/**
* 导入配件数据
*
* @author 小李
* @date 16:20 2024/11/29
**/
ImportExcelRespVO importData(List<RepairWaresExcelVO> list, Boolean updateSupport);
/**
* 配件入库超多少天可以自己设置没用的话需要做一个临期提醒
*
* @author 小李
* @date 14:42 2024/11/30
**/
void timeOver();
/**
* 配件库存低于几个可以自己设置需要做库存预警
*
* @author 小李
* @date 15:54 2024/11/30
**/
void stockBelow();
}

View File

@ -1,23 +1,40 @@
package cn.iocoder.yudao.module.project.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RepairDictConstants;
import cn.iocoder.yudao.common.RepairRoleEnum;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.conf.entity.BaseType;
import cn.iocoder.yudao.module.conf.entity.BaseWarehouse;
import cn.iocoder.yudao.module.conf.service.BaseTypeService;
import cn.iocoder.yudao.module.conf.service.BaseWarehouseService;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.mapper.RepairWaresMapper;
import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.project.vo.RepairWaresPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresRespVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresSaveReqVO;
import cn.iocoder.yudao.module.project.vo.*;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
/**
* 配件库 Service 实现类
@ -31,6 +48,25 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
@Resource
private RepairWaresMapper waresMapper;
@Resource
@Lazy
private BaseWarehouseService warehouseService;
@Resource
@Lazy
private BaseTypeService typeService;
@Resource
@Lazy
private DictDataApi dictDataApi;
@Resource
@Lazy
private RoleApi roleApi;
@Resource
@Lazy
private RepairWorkerService workerService;
/**
* 保存配件库
@ -98,7 +134,7 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
* @date 18:03 2024/9/25
**/
@Override
public RepairWaresRespVO getWaresByName(String name){
public RepairWaresRespVO getWaresByName(String name) {
return waresMapper.getWaresByName(name);
}
@ -127,4 +163,157 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
return baseMapper.selectBatchIds(idList);
}
/**
* 导入配件数据
*
* @author 小李
* @date 16:20 2024/11/29
**/
@Override
@Transactional(rollbackFor = Exception.class)
public ImportExcelRespVO importData(List<RepairWaresExcelVO> list, Boolean updateSupport) {
// 参数校验
if (CollUtil.isEmpty(list)) {
throw exception0(500, "导入配件数据不能为空!");
}
// 取所有的仓库变成mapkey是名称value是id
List<BaseWarehouse> warehouses = warehouseService.list();
Map<String, String> warehousesMap = warehouses.stream().collect(Collectors.toMap(BaseWarehouse::getName, BaseWarehouse::getId));
// 取所有的配件类型变成mapkey是名称value是id
List<BaseType> types = typeService.list(new LambdaQueryWrapper<BaseType>().eq(BaseType::getType, "02"));
Map<String, String> typesMap = types.stream().collect(Collectors.toMap(BaseType::getName, BaseType::getId));
// 遍历逐个创建 or 更新
ImportExcelRespVO result = ImportExcelRespVO.builder().createNames(new ArrayList<>())
.updateNames(new ArrayList<>()).failureNames(new LinkedHashMap<>()).build();
list.forEach(item -> {
// 验证是否存在用selectList防止本来就有多个导致的报错
List<RepairWares> repairWares = baseMapper.selectList(new LambdaQueryWrapper<RepairWares>().eq(RepairWares::getName, item.getName()));
if (CollUtil.isEmpty(repairWares)) {
RepairWares wares = BeanUtils.toBean(item, RepairWares.class);
if (ObjectUtil.isNotEmpty(item.getType()) && ObjectUtil.isNotEmpty(typesMap.get(item.getType()))) {
wares.setType(typesMap.get(item.getType()));
}
if (ObjectUtil.isNotEmpty(item.getWarehouse()) && ObjectUtil.isNotEmpty(warehousesMap.get(item.getWarehouse()))) {
wares.setWarehouse(warehousesMap.get(item.getWarehouse()));
}
wares.setStatus("01");
baseMapper.insert(wares);
result.getCreateNames().add(item.getName());
return;
}
// 存在看是否可以修改
if (!updateSupport) {
result.getFailureNames().put(item.getName(), "不允许修改!");
return;
}
// 可以修改看是否有多个相同名称的配件
if (repairWares.size() > 1) {
result.getFailureNames().put(item.getName(), "存在多个相同名称的配件!");
return;
}
// 更新
RepairWares wares = repairWares.get(0);
RepairWares updateWares = BeanUtils.toBean(item, RepairWares.class);
updateWares.setId(wares.getId());
if (ObjectUtil.isNotEmpty(item.getType()) && ObjectUtil.isNotEmpty(typesMap.get(item.getType()))) {
updateWares.setType(typesMap.get(item.getType()));
}
if (ObjectUtil.isNotEmpty(item.getWarehouse()) && ObjectUtil.isNotEmpty(warehousesMap.get(item.getWarehouse()))) {
updateWares.setWarehouse(warehousesMap.get(item.getWarehouse()));
}
updateWares.setStatus(wares.getStatus());
baseMapper.updateById(updateWares);
result.getUpdateNames().add(item.getName());
});
return result;
}
/**
* 配件入库超多少天可以自己设置没用的话需要做一个临期提醒
*
* @author 小李
* @date 14:42 2024/11/30
**/
@Override
public void timeOver() {
// 取仓管维修管理员
List<UserDTO> warehouse = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.WAREHOUSE.getCode());
List<UserDTO> admin = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.ADMIN.getCode());
// 取配置
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(RepairDictConstants.REPAIR_WARES_NOTICE);
// 取出第一个
if (CollUtil.isEmpty(dataList)) {
noticeByFlag(true, admin, warehouse);
return;
}
DictDataRespDTO dictDataRespDTO = dataList.get(0);
String day = dictDataRespDTO.getValue();
// 转时间如果updateTime小于这个时间那就是需要提醒的
LocalDateTime dateAgo = LocalDateTime.now().minusDays(Integer.parseInt(day));
List<RepairWares> repairWares = baseMapper.selectList(new LambdaQueryWrapper<RepairWares>().le(RepairWares::getUpdateTime, dateAgo));
if (CollUtil.isNotEmpty(repairWares)) {
List<String> names = repairWares.stream().map(RepairWares::getName).collect(Collectors.toList());
String result = String.join(",", names);
String message = "以下配件未使用天数超过设定的未使用天数提醒,请及时处理相关事项!" + result;
warehouse.forEach(item -> workerService.sentMessage(item.getId(), message));
admin.forEach(item -> workerService.sentMessage(item.getId(), message));
}
}
/**
* 配件库存低于几个可以自己设置需要做库存预警
*
* @author 小李
* @date 15:54 2024/11/30
**/
@Override
public void stockBelow(){
// 取仓管维修管理员
List<UserDTO> warehouse = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.WAREHOUSE.getCode());
List<UserDTO> admin = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.ADMIN.getCode());
// 取配置
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(RepairDictConstants.REPAIR_WARES_NOTICE);
// 取出第二个
if (CollUtil.isEmpty(dataList)) {
noticeByFlag(false, admin, warehouse);
return;
}
DictDataRespDTO dictDataRespDTO = dataList.get(1);
String count = dictDataRespDTO.getValue();
List<RepairWares> repairWares = baseMapper.selectList(new LambdaQueryWrapper<RepairWares>().le(RepairWares::getStock, count));
if (CollUtil.isNotEmpty(repairWares)) {
List<String> names = repairWares.stream().map(RepairWares::getName).collect(Collectors.toList());
String result = String.join(",", names);
String message = "以下配件库存低于设定的库存不足提醒,请及时处理相关事项!\n" + result;
warehouse.forEach(item -> workerService.sentMessage(item.getId(), message));
admin.forEach(item -> workerService.sentMessage(item.getId(), message));
}
}
/**
* 上面两个方法公共的通知方法
*
* @author 小李
* @date 15:57 2024/11/30
* @param flag 什么通知
* @param admin 维修管理员们
* @param warehouse 仓库管理员们
**/
private void noticeByFlag(Boolean flag, List<UserDTO> admin, List<UserDTO> warehouse){
String message = flag ? "检查配件入库是否超时出现故障,请联系开发人员解决" : "检查配件库存是否充足出现故障,请联系开发人员解决";
// 如果为空就通知相关人员出现了问题
if (CollUtil.isNotEmpty(warehouse)) {
warehouse.forEach(item -> workerService.sentMessage(item.getId(), message));
}
if (CollUtil.isNotEmpty(admin)) {
admin.forEach(item -> workerService.sentMessage(item.getId(), message));
}
}
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.project.vo;
import lombok.Builder;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* 导入数据的时候用的通用的响应
*
* @author 小李
* @date 16:22 2024/11/29
**/
@Data
@Builder
public class ImportExcelRespVO {
/** 导入成功的配件名称集合 */
private List<String> createNames;
/** 更新成功的配件名称集合 */
private List<String> updateNames;
/** 导入失败的配件信息key是配件名称value是失败原因 */
private Map<String, String> failureNames;
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.project.vo;
import cn.iocoder.yudao.common.RepairDictConstants;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 用于导出维修项目的VO
*
* @author 小李
* @date 17:03 2024/12/2
**/
@Data
@ExcelIgnoreUnannotated
public class ProjectExportVO {
@ExcelProperty("名称")
private String name;
@ExcelProperty("成本")
private Long cost;
@ExcelProperty("规格")
private String spec;
@ExcelProperty("售价")
private BigDecimal price;
@ExcelProperty("编码")
private String code;
@ExcelProperty(value = "单位", converter = DictConvert.class)
@DictFormat(RepairDictConstants.REPAIR_UNIT)
private String unit;
@ExcelProperty("分类")
private String type;
@ExcelProperty("工时")
private String manHour;
@ExcelProperty("备注")
private String remark;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,80 @@
package cn.iocoder.yudao.module.project.vo;
import cn.iocoder.yudao.common.RepairDictConstants;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 导入导出excel用的配件VO
*
* @author 小李
* @date 15:38 2024/11/29
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false)
public class RepairWaresExcelVO {
@ExcelProperty("条形码")
private String barCode;
@ExcelProperty("商品编码")
private String code;
@ExcelProperty("商品名称")
private String name;
@ExcelProperty("规格型号")
private String model;
@ExcelProperty("售价")
private BigDecimal price;
@ExcelProperty("进价")
private BigDecimal purPrice;
@ExcelProperty("所属分类")
private String type;
@ExcelProperty(value = "计量单位", converter = DictConvert.class)
@DictFormat(RepairDictConstants.REPAIR_UNIT)
private String unit;
@ExcelProperty("默认仓库")
private String warehouse;
@ExcelProperty("最低库存")
private BigDecimal miniStock;
@ExcelProperty("最高库存")
private BigDecimal maxStock;
@ExcelProperty("当前库存")
private BigDecimal stock;
/** 好像找不到这个字典 */
// @ExcelProperty(value = "配件属性", converter = DictConvert.class)
// @DictFormat(RepairDictConstants.WARES_ATTRIBUTE)
// private String attribute;
@ExcelProperty("适用车型")
private String carModel;
/** 好像找不到这个字典 */
// @ExcelProperty(value = "配件来源", converter = DictConvert.class)
// @DictFormat(RepairDictConstants.WARES_DATA_FORM)
// private String dataForm;
@ExcelProperty("备注")
private String remark;
}

View File

@ -1,17 +1,29 @@
package cn.iocoder.yudao.module.stockOperate.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
import cn.iocoder.yudao.module.stockOperate.vo.RepairSoExportVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -144,5 +156,28 @@ public class DlRepairSoController {
dlRepairSoService.inWare(repairSoRespVO);
return CommonResult.ok();
}
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(DlRepairSoReqVO repairSoReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
List<RepairSoExportVO> list = new ArrayList<>();
Page<DlRepairSo> page = new Page<>(pageNo, pageSize);
do {
IPage<DlRepairSo> repairSoPage = dlRepairSoService.getRepairSoPage(repairSoReqVO, page);
List<DlRepairSo> records = repairSoPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<RepairSoExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, RepairSoExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "单据数据.xls", "数据", RepairSoExportVO.class, list);
}
}

View File

@ -1,21 +1,37 @@
package cn.iocoder.yudao.module.stockOperate.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.conf.entity.BaseWarehouse;
import cn.iocoder.yudao.module.conf.service.BaseWarehouseService;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
import cn.iocoder.yudao.module.stockOperate.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -32,6 +48,10 @@ public class DlRepairSoiController{
@Resource
private DlRepairSoiService dlRepairSoiService;
@Resource
@Lazy
private BaseWarehouseService warehouseService;
/**
* 采购单领料单子表 分页
*
@ -88,5 +108,79 @@ public class DlRepairSoiController{
public CommonResult<?> getMapBySoIdAndQuery(@RequestParam("id") String id, @RequestParam("query") String query) {
return success(dlRepairSoiService.getMapBySoIdAndQuery(id, query));
}
/**
* 根据供应商查询该供应商采购过的配件 分页
*
* @author 小李
* @date 11:49 2024/11/28
* @param reqVO 查询对象
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/getSoBySupplier")
@Operation(summary = "根据供应商查询该供应商采购过的配件 分页")
public CommonResult<?> getSoBySupplier(DlRepairSoiReqVO reqVO,
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
Page<DlRepairSoiRespVO> page = new Page<>(pageNo, pageSize);
return success(dlRepairSoiService.getSoBySupplier(reqVO, page));
}
/**
* 导出数据
*
* @author 小李
* @date 16:30 2024/12/3
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(DlRepairSoiReqVO repairSoiReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
Page<DlRepairSoi> page = new Page<>(pageNo, pageSize);
List<DlRepairSoi> allList = new ArrayList<>();
do {
IPage<DlRepairSoi> repairSoiPage = dlRepairSoiService.getRepairSoiPage(repairSoiReqVO, page);
List<DlRepairSoi> records = repairSoiPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
allList.addAll(records);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(allList)){
throw exception0(500, "没有数据可以导出");
}
List<String> ids = allList.stream().map(DlRepairSoi::getId).collect(Collectors.toList());
List<DlRepairSoiQueryRespVO> repairSoiByIds = dlRepairSoiService.getRepairSoiByIds(ids);
List<BaseWarehouse> warehouses = warehouseService.list();
Map<String, String> warehousesMap = warehouses.stream().collect(Collectors.toMap(BaseWarehouse::getId, BaseWarehouse::getName));
List<RepairSoiExportVO> list = repairSoiByIds.stream().map(item -> {
DlRepairSo so = item.getSo();
RepairWares repairWares = item.getRepairWares();
RepairSoiExportVO repairSoiExportVO = new RepairSoiExportVO();
repairSoiExportVO.setSoNo(so.getSoNo());
repairSoiExportVO.setName(repairWares.getName());
repairSoiExportVO.setUserName(so.getUserName());
repairSoiExportVO.setCode(repairWares.getCode());
repairSoiExportVO.setBarCode(repairWares.getBarCode());
repairSoiExportVO.setModel(repairWares.getModel());
repairSoiExportVO.setGoodsCount(item.getGoodsCount());
repairSoiExportVO.setGoodsPrice(item.getGoodsPrice());
BigDecimal goodsPrice = ObjectUtil.isNotEmpty(item.getGoodsPrice()) ? item.getGoodsPrice() : BigDecimal.ZERO;
int goodsCount = ObjectUtil.isNotEmpty(item.getGoodsCount()) ? item.getGoodsCount() : 0;
repairSoiExportVO.setTotal(goodsPrice.multiply(BigDecimal.valueOf(goodsCount)));
repairSoiExportVO.setSupplierName(so.getSupplierName());
if (ObjectUtil.isNotEmpty(item.getWareId())) {
repairSoiExportVO.setWarehouseName(warehousesMap.get(item.getWareId()));
}
repairSoiExportVO.setCropId(so.getCorpId());
repairSoiExportVO.setCreateTime(so.getCreateTime());
repairSoiExportVO.setRemark(item.getRemark());
return repairSoiExportVO;
}).collect(Collectors.toList());
ExcelUtils.write(response, "作废单据数据.xls", "数据", RepairSoiExportVO.class, list);
}
}

View File

@ -36,6 +36,15 @@ public interface DlRepairSoiMapper extends BaseMapper<DlRepairSoi> {
* @param id id
**/
List<DlRepairSoiRespVO> getMapBySoIdAndQuery(@Param("id") String id, @Param("query") String query);
/**
* 根据供应商查询该供应商采购过的配件
*
* @author 小李
* @date 11:49 2024/11/28
* @param reqVO 查询对象
**/
IPage<DlRepairSoiRespVO> getSoBySupplier(@Param("map") DlRepairSoiReqVO reqVO, Page<DlRepairSoiRespVO> page);
}

View File

@ -64,4 +64,13 @@ public interface DlRepairSoiService extends IService<DlRepairSoi> {
* @param id id
**/
Map<String, List<DlRepairSoiRespVO>> getMapBySoIdAndQuery(String id, String query);
/**
* 根据供应商查询该供应商采购过的配件
*
* @author 小李
* @date 11:49 2024/11/28
* @param reqVO 查询对象
**/
IPage<DlRepairSoiRespVO> getSoBySupplier(DlRepairSoiReqVO reqVO, Page<DlRepairSoiRespVO> page);
}

View File

@ -3,9 +3,7 @@ package cn.iocoder.yudao.module.stockOperate.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RecordTypeEnum;
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
import cn.iocoder.yudao.common.SoStatusEnum;
import cn.iocoder.yudao.common.*;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
@ -26,6 +24,7 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
@ -120,14 +119,6 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@Override
public void createRepairSo(DlRepairSoRespVO repairSoRespVO) {
repairSoRespVO.setSoTime(new Date());
// 加个判断可能出现没有设置价格的情况----需求说了非必填注掉
// if (repairSoRespVO.getGoodsList() != null){
// repairSoRespVO.getGoodsList().forEach(item -> {
// if (item.getGoodsPrice() == null){
// throw exception0(500, "有配件未设置进价");
// }
// });
// }
//保存供应商
if (StringUtils.isEmpty(repairSoRespVO.getSupplierId())) {
//采购单中录入供应商或无供应商情况
@ -151,6 +142,12 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
}
}
// 如果没有选择操作的人就取当前操作人
if (ObjectUtil.isEmpty(repairSoRespVO.getUserId())) {
repairSoRespVO.setUserId(SecurityFrameworkUtils.getLoginUserId());
repairSoRespVO.setUserName(SecurityFrameworkUtils.getLoginUserNickname());
}
// 新增主表
// 如果是采购单就把状态变为部分入库
if (repairSoRespVO.getSoType() != null && repairSoRespVO.getSoType().equals("01")) {
@ -163,7 +160,6 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
}
repairSoRespVO.getGoodsList().forEach(item -> {
item.setSoId(repairSoRespVO.getId());
// item.setSoiType(repairSoRespVO.getSoType());
});
repairSoiService.saveBatch(repairSoRespVO.getGoodsList());
@ -171,30 +167,6 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
// 前端选择了配件生成采购单的时候可能会改配件的一些信息但不知道会改什么直接拿到全部重新更新
List<RepairWares> waresList = repairSoRespVO.getWaresList();
waresService.updateBatchById(waresList);
// 操作配件库存表---应该是弃用了
// 获取所有需要操作的数据----生成采购单的时候不直接操作库存放到下面的inWares方法去操作
// if (repairSoRespVO.getSoType() != null && !repairSoRespVO.getSoType().equals("01")){
// List<DlRepairSoi> goodsList = repairSoRespVO.getGoodsList();
// List<String> ids = goodsList.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList());
// List<RepairWares> repairWares = waresService.listByIds(ids);
// // 更新库存和进价
// List<RepairWares> newWares = repairWares.stream().map(item -> {
// // 取数据
// DlRepairSoi repairSoi = goodsList.stream().filter(i -> i.getGoodsId().equals(item.getId())).collect(Collectors.toList()).get(0);
// // 设置新值
// // 如果是采购入库数量+如果是领料出库数量-
// // 01, 03 是采购 02 是领料
// BigDecimal count = new BigDecimal(repairSoi.getGoodsCount());
// RepairWares wares = new RepairWares();
// wares.setId(item.getId());
// wares.setStock("02".equals(repairSoRespVO.getSoType()) ? item.getStock().subtract(count) : item.getStock().add(count));
// // 更新进价
// wares.setPurPrice(repairSoi.getGoodsPrice());
// return wares;
// }).collect(Collectors.toList());
// waresService.updateBatchById(newWares);
// }
}
/**
@ -219,14 +191,20 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@Override
@DSTransactional
public void voidRepairSo(DlRepairSoReqVO repairSoReqVO) {
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairSo>()
.set(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode())
.and(i ->
i.eq(DlRepairSo::getId, repairSoReqVO.getId())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.PICKED.getCode())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.RETURNED.getCode())
));
LambdaUpdateWrapper<DlRepairSo> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode());
String userRole = ticketsService.getUserRole();
if (RepairRoleEnum.WAREHOUSE.getCode().equals(userRole)) {
wrapper.eq(DlRepairSo::getId, repairSoReqVO.getId());
} else {
wrapper.and(i ->
i.eq(DlRepairSo::getId, repairSoReqVO.getId())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.PICKED.getCode())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.RETURNED.getCode())
);
}
int update = baseMapper.update(wrapper);
if (update == 0) {
throw exception0(500, "该单据已有其他人操作");
}
@ -348,21 +326,23 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
if (update == 0) {
throw exception0(500, "该领料单已有其他人操作");
}
// DlRepairSo dlRepairSo = new DlRepairSo();
// dlRepairSo.setId(id);
// dlRepairSo.setSoStatus(SoStatusEnum.PICKED.getCode());
// baseMapper.u
// 查最新的子表信息
DlRepairSo so = baseMapper.selectById(id);
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, so.getTwId()));
// 判断是部分完成还是全部完成----不需要判断了
// DlTicketWares dlTicketWares = new DlTicketWares();
// dlTicketWares.setId(so.getTwId());
// List<DlTwItem> flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList());
// dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04");
// 更新主表的状态
// ticketWaresService.updateById(dlTicketWares);
List<DlRepairSoi> sois = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, id));
//本次领料的配件id
Set<String> waresIds = sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toSet());
//配件库的数据集合
List<RepairWares> repairWares = repairWaresService.listByIds(waresIds);
List<DlRepairSoiRespVO> list = sois.stream().map(item -> {
DlRepairSoiRespVO bean = BeanUtil.toBean(item, DlRepairSoiRespVO.class);
repairWares.stream().filter(i -> i.getId().equals(item.getGoodsId())).findFirst().ifPresent(bean::setWares);
return bean;
}).collect(Collectors.toList());
/* 这里添加新逻辑,员工确认领料时,把领的配件添加进工单子表---start */
this.dealWareItem(true,so.getTwId(),sois,repairWares);
/* 这里添加新逻辑,员工确认领料时,把领的配件添加进工单子表---end */
// 通知仓库
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), so.getUserName() + "已确认领料单:" + so.getSoNo());
@ -371,20 +351,24 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
// 查配件申请表
DlTicketWares byId = ticketWaresService.getById(so.getTwId());
// 取当前操作人的名称
String remark = SecurityFrameworkUtils.getLoginUserNickname();
StringBuilder remark = new StringBuilder("确认领料: ");
// 构建备注
/*
领了什么配件领了多少个
*/
List<String> nameAndCount = list.stream().map(item -> item.getWaresName() + "x" + item.getWaresCount()).collect(Collectors.toList());
remark += "确认领料" + String.join(";", nameAndCount);
for (int i = 0; i < list.size(); i++) {
DlRepairSoiRespVO item = list.get(i);
if (ObjectUtil.isNotEmpty(item.getWares())) {
remark.append(i + 1).append(".").append(item.getWares().getName()).append("x").append(item.getGoodsCount()).append("; ");
}
}
// 记录日志
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), remark, image);
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), remark.toString(), image);
// 更新工单主表时间
if (ObjectUtil.isNotEmpty(so) && ObjectUtil.isNotEmpty(so.getTwId())){
if (ObjectUtil.isNotEmpty(so) && ObjectUtil.isNotEmpty(so.getTwId())) {
DlTicketWares ticketWares = ticketWaresService.getById(so.getTwId());
if (ObjectUtil.isNotEmpty(ticketWares) && ObjectUtil.isNotEmpty(ticketWares.getTicketId())){
if (ObjectUtil.isNotEmpty(ticketWares) && ObjectUtil.isNotEmpty(ticketWares.getTicketId())) {
ticketsService.refreshUpdateTime(ticketWares.getTicketId());
}
}
@ -407,7 +391,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
.ne(DlRepairSo::getSoStatus, SoStatusEnum.RETURNED.getCode())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode()))
);
if (update == 0){
if (update == 0) {
throw exception0(500, "该退料单已有其他人操作");
}
// 查主表
@ -416,29 +400,137 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
repairWorkerService.sentMessage(Long.valueOf(newSo.getCreator()), newSo.getUserName() + "已确认退料单:" + newSo.getSoNo());
// 记录日志
// 查子表信息
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, newSo.getTwId()));
List<DlRepairSoi> sois = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, id));
Set<String> waresIds = sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toSet());
List<RepairWares> repairWares = repairWaresService.listByIds(waresIds);
List<DlRepairSoiRespVO> list = sois.stream().map(item -> {
DlRepairSoiRespVO bean = BeanUtil.toBean(item, DlRepairSoiRespVO.class);
repairWares.stream().filter(i -> i.getId().equals(item.getGoodsId())).findFirst().ifPresent(bean::setWares);
return bean;
}).collect(Collectors.toList());
// 查申请表
DlTicketWares byId = ticketWaresService.getById(newSo.getTwId());
// 取当前操作人的名称
String remark = SecurityFrameworkUtils.getLoginUserNickname();
StringBuilder remark = new StringBuilder("确认退料: ");
/* 这里添加新逻辑,员工确认退料时,把退的配件从工单子表中删除---start */
this.dealWareItem(false,newSo.getTwId(),sois,repairWares);
/* 这里添加新逻辑,员工确认退料时,把退的配件从工单子表中删除---end */
// 构建备注
/*
退了什么配件退了多少个
*/
List<String> nameAndCount = list.stream().map(item -> item.getWaresName() + "(" + item.getWaresCount() + ")").collect(Collectors.toList());
remark += "确认退料" + String.join(",", nameAndCount);
for (int i = 0; i < list.size(); i++) {
DlRepairSoiRespVO item = list.get(i);
if (ObjectUtil.isNotEmpty(item.getWares())) {
remark.append(i + 1).append(".").append(item.getWares().getName()).append("x").append(item.getGoodsCount()).append("; ");
}
}
// 记录日志
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.TL.getCode(), remark, image);
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.TL.getCode(), remark.toString(), image);
// 更新工单主表时间
if (ObjectUtil.isNotEmpty(newSo) && ObjectUtil.isNotEmpty(newSo.getTwId())){
if (ObjectUtil.isNotEmpty(newSo) && ObjectUtil.isNotEmpty(newSo.getTwId())) {
DlTicketWares ticketWares = ticketWaresService.getById(newSo.getTwId());
if (ObjectUtil.isNotEmpty(ticketWares) && ObjectUtil.isNotEmpty(ticketWares.getTicketId())){
if (ObjectUtil.isNotEmpty(ticketWares) && ObjectUtil.isNotEmpty(ticketWares.getTicketId())) {
ticketsService.refreshUpdateTime(ticketWares.getTicketId());
}
}
}
/**
* 领料退料计算工单子表的通用方法
* @author vinjor-M
* @date 14:31 2024/12/4
* @param ifGet 是否是领料
* @param applyId 配件申请单id
* @param sois 领料单退料单配件明细
* @param repairWares 配件库的明细
**/
private void dealWareItem(Boolean ifGet,String applyId,List<DlRepairSoi> sois,List<RepairWares> repairWares){
//配件申请单
DlTicketWares dlTicketWares = ticketWaresService.getById(applyId);
//工单现有的配件
List<DlRepairTitem> titems = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
i.eq(DlRepairTitem::getTicketId,dlTicketWares.getTicketId())
.eq(DlRepairTitem::getItemType, "02");
}));
//更新或插入的数据集合
List<DlRepairTitem> saveOrUpdateList = new ArrayList<>();
//删除的数据id集合
List<String> delIdList = new ArrayList<>();
//工单现有配件转MAP
Map<String,DlRepairTitem> itemMap = titems.stream().collect(Collectors.toMap(DlRepairTitem::getPartId,Function.identity()));
//配件库的数据集合转MAP
Map<String,RepairWares> repairWaresMap = repairWares.stream().collect(Collectors.toMap(RepairWares::getId,Function.identity()));
//遍历本次领料/退料的所有配件
for (DlRepairSoi repairSoi:sois){
if(itemMap.containsKey(repairSoi.getGoodsId())){
//工单中有这个配件
if(ifGet){
//领料
//工单现有配件中就有这个领取的配件需要更新这个配件的数量价格
DlRepairTitem item = itemMap.get(repairSoi.getGoodsId());
item.setItemCount(item.getItemCount() + repairSoi.getGoodsCount());
item.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount())).multiply(item.getItemDiscount()));
item.setItemStatus(TicketsItemStatusEnum.RECEIVED.getCode());
saveOrUpdateList.add(item);
}else{
//退料
//工单现有配件中就有这个领取的配件需要更新这个配件的数量价格
DlRepairTitem item = itemMap.get(repairSoi.getGoodsId());
if(item.getItemCount()>repairSoi.getGoodsCount()){
//现有数量大于要退的数量扣掉
item.setItemCount(item.getItemCount() - repairSoi.getGoodsCount());
item.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount())).multiply(item.getItemDiscount()));
item.setItemStatus(TicketsItemStatusEnum.RECEIVED.getCode());
saveOrUpdateList.add(item);
}else{
//现有数量小于或等于要退的数量直接将这个配件删掉
delIdList.add(item.getId());
}
}
}else{
//工单中没有这个配件
if (ifGet) {
//领料需要把这个配件添加到工单子表中
//配件库的对象
RepairWares waresItem = repairWaresMap.get(repairSoi.getGoodsId());
//工单子表对象
DlRepairTitem titem = new DlRepairTitem();
titem.setTicketId(dlTicketWares.getTicketId());
titem.setItemType("02");
titem.setItemName(waresItem.getName());
titem.setItemCount(repairSoi.getGoodsCount());
titem.setItemUnit(waresItem.getUnit());
//优先取领配件的价格再取配件库的价格
BigDecimal itemPrice = null != repairSoi.getGoodsPrice() ? repairSoi.getGoodsPrice() : (null != waresItem.getPrice() ? waresItem.getPrice() : BigDecimal.ZERO);
titem.setItemPrice(itemPrice);
titem.setItemDiscount(BigDecimal.ONE);
titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
titem.setRepairIds(String.valueOf(dlTicketWares.getRepairId()));
titem.setRepairNames(dlTicketWares.getRepairName());
titem.setSaleId(dlTicketWares.getAdviserId());
titem.setSaleName(dlTicketWares.getAdviserName());
titem.setPartId(repairSoi.getGoodsId());
titem.setItemStatus(TicketsItemStatusEnum.RECEIVED.getCode());
saveOrUpdateList.add(titem);
}else{
//退料不可能出现没领料就退料的情况不用处理
}
}
}
if(!saveOrUpdateList.isEmpty()){
titemService.saveOrUpdateBatch(saveOrUpdateList);
}
if(!delIdList.isEmpty()){
titemService.removeBatchByIds(delIdList);
}
//重新计算工单的价格和订单的价格
ticketsService.computeTicket(dlTicketWares.getTicketId());
}
/**
* 采购入库
*

View File

@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.xml.bind.v2.TODO;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -166,6 +167,18 @@ public class DlRepairSoiServiceImpl extends ServiceImpl<DlRepairSoiMapper, DlRep
}
return result;
}
/**
* 根据供应商查询该供应商采购过的配件
*
* @author 小李
* @date 11:49 2024/11/28
* @param reqVO 查询对象
**/
@Override
public IPage<DlRepairSoiRespVO> getSoBySupplier(DlRepairSoiReqVO reqVO, Page<DlRepairSoiRespVO> page){
return baseMapper.getSoBySupplier(reqVO, page);
}
}

View File

@ -29,4 +29,7 @@ public class DlRepairSoiReqVO extends DlRepairSoi {
@Schema(pattern = "查询关键字")
private String query;
/** 供应商ID */
private String supplierId;
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.stockOperate.vo;
import cn.iocoder.yudao.common.RepairDictConstants;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 用于采购单导出VO
*
* @author 小李
* @date 16:03 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class RepairSoExportVO {
/**
* 单据编号;自动生成
*/
@ExcelProperty("单号")
private String soNo;
@ExcelProperty("供应商")
private String supplierName;
@ExcelProperty("操作人")
private String userName;
@ExcelProperty("数量")
private Integer itemCount;
@ExcelProperty("金额")
private BigDecimal totalPrice;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(RepairDictConstants.REPAIR_SO_STATUS)
private String soStatus;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("门店")
private String corpName;
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.stockOperate.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 用于导出库存操作子表的VO
*
* @author 小李
* @date 16:32 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class RepairSoiExportVO {
@ExcelProperty("单号")
private String soNo;
@ExcelProperty("商品名称")
private String name;
@ExcelProperty("操作人")
private String userName;
@ExcelProperty("商品编码")
private String code;
@ExcelProperty("条形码")
private String barCode;
@ExcelProperty("规格")
private String model;
@ExcelProperty("数量")
private Integer goodsCount;
@ExcelProperty("价格")
private BigDecimal goodsPrice;
@ExcelProperty("合计")
private BigDecimal total;
@ExcelProperty("供应商")
private String supplierName;
@ExcelProperty("仓库")
private String warehouseName;
@ExcelProperty("门店")
private String cropId;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("时间")
private LocalDateTime createTime;
@ExcelProperty("备注")
private String remark;
}

View File

@ -1,17 +1,34 @@
package cn.iocoder.yudao.module.stockTransfer.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.company.entity.Company;
import cn.iocoder.yudao.module.company.service.CompanyService;
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
import cn.iocoder.yudao.module.stockTransfer.service.DlRepairStService;
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStReqVO;
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStRespVO;
import cn.iocoder.yudao.module.stockTransfer.vo.RepairStExportVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -28,6 +45,10 @@ public class DlRepairStController{
@Resource
private DlRepairStService dlRepairStService;
@Resource
@Lazy
private CompanyService companyService;
/**
* 调拨单 新增
*
@ -86,5 +107,45 @@ public class DlRepairStController{
public CommonResult<?> getSt(@RequestParam("id") String id){
return success(dlRepairStService.getSt(id));
}
/**
* 导出数据
*
* @author 小李
* @date 17:26 2024/12/3
* @param repairStReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(DlRepairStReqVO repairStReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
List<RepairStExportVO> list = new ArrayList<>();
Page<DlRepairSt> page = new Page<>(pageNo, pageSize);
do {
IPage<DlRepairSt> stPage = dlRepairStService.getStPage(repairStReqVO, page);
List<DlRepairSt> records = stPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<RepairStExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, RepairStExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
List<Company> companies = companyService.list();
Map<String, String> companyMap = companies.stream().collect(Collectors.toMap(Company::getId, Company::getCorpName));
list.forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getInCorpId()) && ObjectUtil.isNotEmpty(companyMap.get(item.getInCorpId()))){
item.setInCorpId(companyMap.get(item.getInCorpId()));
}
if (ObjectUtil.isNotEmpty(item.getOutCorpId()) && ObjectUtil.isNotEmpty(companyMap.get(item.getOutCorpId()))){
item.setOutCorpId(companyMap.get(item.getOutCorpId()));
}
});
ExcelUtils.write(response, "单据数据.xls", "数据", RepairStExportVO.class, list);
}
}

View File

@ -1,21 +1,39 @@
package cn.iocoder.yudao.module.stockTransfer.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.company.entity.Company;
import cn.iocoder.yudao.module.company.service.CompanyService;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSti;
import cn.iocoder.yudao.module.stockTransfer.service.DlRepairStiService;
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStiQueryVO;
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStiReqVO;
import cn.iocoder.yudao.module.stockTransfer.vo.RepairSoiExportVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -32,6 +50,10 @@ public class DlRepairStiController{
@Resource
private DlRepairStiService dlRepairStiService;
@Resource
@Lazy
private CompanyService companyService;
/**
* 调拨单子表 分页
*
@ -62,5 +84,64 @@ public class DlRepairStiController{
public CommonResult<?> getStIsWares(@RequestParam("ids") List<String> ids){
return success(dlRepairStiService.getStIsWares(ids));
}
/**
* 导出数据
*
* @author 小李
* @date 17:43 2024/12/3
* @param repairStiReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(DlRepairStiReqVO repairStiReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
Page<DlRepairSti> page = new Page<>(pageNo, pageSize);
List<DlRepairSti> allList = new ArrayList<>();
do {
IPage<DlRepairSti> stiPage = dlRepairStiService.getStiPage(repairStiReqVO, page);
List<DlRepairSti> records = stiPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
allList.addAll(records);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(allList)){
throw exception0(500, "没有数据可以导出");
}
List<Company> companies = companyService.list();
Map<String, String> companyMap = companies.stream().collect(Collectors.toMap(Company::getId, Company::getCorpName));
List<String> ids = allList.stream().map(DlRepairSti::getId).collect(Collectors.toList());
List<DlRepairStiQueryVO> stIsWares = dlRepairStiService.getStIsWares(ids);
List<RepairSoiExportVO> list = stIsWares.stream().map(item -> {
RepairSoiExportVO repairSoiExportVO = new RepairSoiExportVO();
DlRepairSt st = item.getSt();
RepairWares wares = item.getWares();
repairSoiExportVO.setStNo(st.getStNo());
repairSoiExportVO.setName(wares.getName());
repairSoiExportVO.setModel(wares.getModel());
repairSoiExportVO.setCode(wares.getCode());
repairSoiExportVO.setBarCode(wares.getBarCode());
repairSoiExportVO.setGoodsCount(item.getGoodsCount());
repairSoiExportVO.setPrice(wares.getPrice());
int goodsCount = ObjectUtil.isNotEmpty(item.getGoodsCount()) ? item.getGoodsCount() : 0;
BigDecimal price = ObjectUtil.isNotEmpty(wares.getPrice()) ? wares.getPrice() : BigDecimal.ZERO;
repairSoiExportVO.setTotalPrice(price.multiply(BigDecimal.valueOf(goodsCount)));
repairSoiExportVO.setGoodsPrice(item.getGoodsPrice());
repairSoiExportVO.setUserName(st.getUserName());
if (ObjectUtil.isNotEmpty(st.getInCorpId()) && ObjectUtil.isNotEmpty(companyMap.get(st.getInCorpId()))) {
repairSoiExportVO.setInCorpId(companyMap.get(st.getInCorpId()));
}
if (ObjectUtil.isNotEmpty(st.getOutCorpId()) && ObjectUtil.isNotEmpty(companyMap.get(st.getOutCorpId()))) {
repairSoiExportVO.setOutCorpId(companyMap.get(st.getOutCorpId()));
}
repairSoiExportVO.setStTime(st.getStTime());
repairSoiExportVO.setRemark(item.getRemark());
return repairSoiExportVO;
}).collect(Collectors.toList());
ExcelUtils.write(response, "调拨详细数据.xls", "数据", RepairSoiExportVO.class, list);
}
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.module.stockTransfer.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 用于调拨单子表导出VO
*
* @author 小李
* @date 17:43 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class RepairSoiExportVO {
@ExcelProperty("单号")
private String stNo;
@ExcelProperty("商品名称")
private String name;
@ExcelProperty("规格")
private String model;
@ExcelProperty("商品编码")
private String code;
@ExcelProperty("条形码")
private String barCode;
@ExcelProperty("数量")
private Integer goodsCount;
@ExcelProperty("成本")
private BigDecimal price;
@ExcelProperty("金额")
private BigDecimal goodsPrice;
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
@ExcelProperty("负责人")
private String userName;
@ExcelProperty("调出门店")
private String outCorpId;
@ExcelProperty("调入门店")
private String inCorpId;
@ExcelProperty("调拨时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date stTime;
@ExcelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.stockTransfer.vo;
import cn.iocoder.yudao.common.RepairDictConstants;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用于调拨相关的导出VO
*
* @author 小李
* @date 17:27 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class RepairStExportVO {
@ExcelProperty("调出门店")
private String outCorpId;
@ExcelProperty("调入门店")
private String inCorpId;
@ExcelProperty("单号")
private String stNo;
@ExcelProperty("调拨人")
private String userName;
@ExcelProperty("总数量")
private Integer itemCount;
@ExcelProperty("总金额")
private BigDecimal totalPrice;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(RepairDictConstants.REPAIR_ST_STATUS)
private String stStatus;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ExcelProperty("调拨日期")
private Date stTime;
@ExcelProperty("备注")
private String remark;
}

View File

@ -1,15 +1,16 @@
package cn.iocoder.yudao.module.tickets.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.common.RepairCons;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO;
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
import cn.iocoder.yudao.module.tickets.vo.NoticeCusVO;
import cn.iocoder.yudao.module.tickets.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.apache.commons.lang3.StringUtils;
@ -17,10 +18,11 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -438,5 +440,81 @@ public class DlRepairTicketsController {
public CommonResult<?> getCusAndCarById(@RequestParam("id") String id) {
return success(dlRepairTicketsService.getCusAndCarById(id));
}
/**
* 导出数据
*
* @author 小李
* @date 14:51 2024/12/3
* @param repairTicketsReqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(DlRepairTicketsReqVO repairTicketsReqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
if (StringUtils.isEmpty(repairTicketsReqVO.getSelectType())) {
//查询类型为空默认查待处理的
repairTicketsReqVO.setSelectType(RepairCons.TICKETS_WAITING);
}
List<TicketsExportVO> list = new ArrayList<>();
do {
IPage<DlRepairTickets> pageType = dlRepairTicketsService.getPageType(repairTicketsReqVO, page);
List<DlRepairTickets> records = pageType.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<TicketsExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, TicketsExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "工单数据.xls", "数据", TicketsExportVO.class, list);
}
/**
* 导出数据 根据工单状态
*
* @author 小李
* @date 15:19 2024/12/3
* @param repairTicketsReqVO 请求对象
**/
@GetMapping("/exportByStatus")
@Operation(summary = "导出数据 根据工单状态")
public void exportByStatus(DlRepairTicketsReqVO repairTicketsReqVO, HttpServletResponse response)throws IOException{
int pageNo = 1, pageSize = 1000;
List<TicketExportByStatusVO> list = new ArrayList<>();
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
do {
IPage<DlRepairTickets> ticketsPage = dlRepairTicketsService.getTicketsPage(repairTicketsReqVO, page);
List<DlRepairTickets> records = ticketsPage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<TicketExportByStatusVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, TicketExportByStatusVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
String name = "";
switch (repairTicketsReqVO.getTicketsStatus()){
case "01":
name = "待结算工单数据.xls";
break;
case "02":
name = "已结算工单数据.xls";
break;
case "03":
name = "已作废工单数据.xls";
break;
}
ExcelUtils.write(response, name, "数据", TicketExportByStatusVO.class, list);
}
}

View File

@ -1,18 +1,28 @@
package cn.iocoder.yudao.module.tickets.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresRespVO;
import cn.iocoder.yudao.module.tickets.vo.TicketWaresExportVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -62,7 +72,7 @@ public class DlTicketWaresController {
}
/**
* 新增修改
* 维修工新增配件申请单
*
* @author 小李
* @date 12:14 2024/10/15
@ -210,5 +220,35 @@ public class DlTicketWaresController {
public CommonResult<?> getByIds(@RequestParam("ids") List<String> ids){
return success(dlTicketWaresService.getByIds(ids));
}
/**
* 导出数据
*
* @author 小李
* @date 15:02 2024/12/3
* @param reqVO 请求对象
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(DlTicketWaresReqVO reqVO, HttpServletResponse response)throws IOException {
int pageNo = 1, pageSize = 1000;
List<TicketWaresExportVO> list = new ArrayList<>();
Page<DlTicketWares> page = new Page<>(pageNo, pageSize);
do {
IPage<DlTicketWares> waresServicePage = dlTicketWaresService.getPage(reqVO, page);
List<DlTicketWares> records = waresServicePage.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<TicketWaresExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, TicketWaresExportVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
throw exception0(500, "没有数据可以导出");
}
ExcelUtils.write(response, "配件申请单数据.xls", "数据", TicketWaresExportVO.class, list);
}
}

View File

@ -45,6 +45,15 @@ public class DlRepairTickets extends TenantBaseDO {
*/
private String userName;
/**
* 经办人姓名
*/
private String handleName;
/**
* 经办人电话
*/
private String handleMobile;
/**
* 用户手机号(base_customer_main表的phone_number)
*/
@ -79,6 +88,14 @@ public class DlRepairTickets extends TenantBaseDO {
* 车辆品牌类型(base_car_brand表的brand_type)
*/
private String carBrandType;
/**
* 最近保养日期
*/
private Date maintenanceDate;
/**
* 最近保养里程
*/
private BigDecimal maintenanceMileage;
/**
* 服务顾问ID(system_users表的ID)

View File

@ -2,17 +2,13 @@ package cn.iocoder.yudao.module.tickets.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* 工单配件申请/退回子
* 工单配件申请单配件明细表
*
* @author 小李
* @date 11:49 2024/10/15
@ -43,6 +39,12 @@ public class DlTwItem extends TenantBaseDO {
/** 配件状态:使用字典yes_no1通过0没通过 */
private String waresStatus;
/** 配件添加人id */
private Long addUserId;
/** 配件添加人姓名 */
private String addUserName;
/** 是否仓管添加的0否|1是 */
private Boolean ifHouseAdd;
/** 审核人IDsystem_users的ID */
private Long handleId;

View File

@ -7,9 +7,11 @@ import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.*;
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
@ -83,6 +85,7 @@ import java.io.FileOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
@ -236,6 +239,20 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
ticketsRespVO.setCorpId(dept.getCorpId());
}
/* 更新车辆的最近保养日期、最近保养公里数 start */
if(null!=ticketsRespVO.getMaintenanceDate() || null!= ticketsRespVO.getMaintenanceMileage()){
CarMain carMain = new CarMain();
carMain.setId(ticketsRespVO.getCarId());
if(null!=ticketsRespVO.getMaintenanceDate()){
carMain.setMaintenanceDate(ticketsRespVO.getMaintenanceDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
if(null!=ticketsRespVO.getMaintenanceMileage()) {
carMain.setMaintenanceMileage(ticketsRespVO.getMaintenanceMileage());
}
carMainService.updateById(carMain);
}
/* 更新车辆的最近保养日期、最近保养公里数 end */
// 计算参考成本参考毛利领料状态工单进行状态
// TODO 参考成本 暂时为0
ticketsRespVO.setCost(new BigDecimal("0"));
@ -350,7 +367,24 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
public DlRepairTicketsRespVO getTicketsById(String id,Boolean ifApp) {
// 查工单主表
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
//翻译维修类型
List<DictDataRespDTO> repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
result.setRepairTypeText(repairTypeMap.getOrDefault(dlRepairTickets.getRepairType(),""));
//查是否存在总检完成的记录取出他的时间
LambdaQueryWrapper<RepairRecords> queryWrapper = new LambdaQueryWrapper<RepairRecords>()
.eq(RepairRecords::getTicketId,id)
.eq(RepairRecords::getType,RecordTypeEnum.ZJ.getCode())
.orderByDesc(BaseDO::getCreateTime);
List<RepairRecords> repairRecords = repairRecordsService.list(queryWrapper);
if(!repairRecords.isEmpty()){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedString = repairRecords.get(0).getCreateTime().format(formatter);
result.setRealOverDate(formattedString);
}
AdminUserDO user = userService.getUser(Long.valueOf(dlRepairTickets.getAdviserId()));
result.setLinkPhone(user.getMobile());
//查车辆
@ -365,15 +399,54 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 查工单子表
List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
List<DlRepairTitemReqVO> items = itemList.stream().map(item -> BeanUtil.toBean(item, DlRepairTitemReqVO.class)).collect(Collectors.toList());
// 取项目
//处理项目 取项目
List<DlRepairTitemReqVO> projects = items.stream().filter(item -> item.getItemType().equals("01")).collect(Collectors.toList());
//pc原逻辑
if (CollectionUtil.isNotEmpty(projects)) {
Set<String> ids = projects.stream().map(DlRepairTitemReqVO::getProjectId).collect(Collectors.toSet());
List<RepairProject> repairProjects = projectService.listByIds(ids);
items.forEach(item -> repairProjects.stream().filter(i -> i.getId().equals(item.getProjectId())).findFirst().ifPresent(item::setProject));
}
result.setProjects(projects);
if(ifApp){
//app新增逻辑
if (CollectionUtil.isNotEmpty(projects)) {
List<AppWaresGroupVO> projectList = new ArrayList<>();
//查所有服务分类项目分类
List<BaseType> baseTypeList = baseTypeService.list();
Map<String,String> baseTypeMap = baseTypeList.stream().collect(Collectors.toMap(BaseType::getId,BaseType::getName));
//先过滤出itenTypeId为null或空为单独一个组
List<DlRepairTitemReqVO> nullList = projects.stream().filter(item->StringUtils.isEmpty(item.getItemTypeId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(nullList)) {
AppWaresGroupVO waresGroupVO = new AppWaresGroupVO();
waresGroupVO.setWares(nullList);
waresGroupVO.setGroupName("未知分组");
waresGroupVO.setNums(nullList.size());
waresGroupVO.setShowAll(false);
waresGroupVO.setServicer(nullList.get(0).getSaleName());
waresGroupVO.setWorker(nullList.get(0).getRepairNames());
projectList.add(waresGroupVO);
}
//过滤出有分类的进行分组
Map<String,List<DlRepairTitemReqVO>> groupListMap = projects.stream().filter(item->StringUtils.isNotEmpty(item.getItemTypeId())).collect(Collectors.groupingBy(DlRepairTitem::getItemTypeId));
for (String key:groupListMap.keySet()){
AppWaresGroupVO waresGroupVO = new AppWaresGroupVO();
waresGroupVO.setWares(groupListMap.get(key));
waresGroupVO.setGroupName(baseTypeMap.get(key));
waresGroupVO.setGroupId(key);
waresGroupVO.setNums(groupListMap.get(key).size());
waresGroupVO.setShowAll(false);
waresGroupVO.setServicer(groupListMap.get(key).get(0).getSaleName());
waresGroupVO.setWorker(groupListMap.get(key).get(0).getRepairNames());
projectList.add(waresGroupVO);
}
result.setProjectList(projectList);
}
}
//处理配件
if(ifApp){
//app的逻辑
List<AppWaresGroupVO> waresGroupList = new ArrayList<>();
@ -443,10 +516,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_RECORDS_TYPE);
Map<String, String> typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
result.setRecords(records.stream().peek(item -> item.setType(typeMap.get(item.getType()))).collect(Collectors.toList()));
// 更新主表时间
refreshUpdateTime(id);
return result;
}
@ -610,10 +679,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
@Override
@DSTransactional
public void print(HttpServletResponse response, String id) {
// 更新工单时间
refreshUpdateTime(id);
// 开始之前先计算一次工单
boolean flag = computeTicket(id);
if (!flag) {
@ -1544,7 +1609,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
@Override
@DSTransactional
public void noticeCus(NoticeCusVO noticeCusVO) {
// 获取客户信息
// 获取工单信息
DlRepairTickets tickets = baseMapper.selectById(noticeCusVO.getId());
// 更新工单状态为待结算待取车
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
@ -1556,6 +1621,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.TZQC.getCode(), tickets.getAdviserName() + "电话通知客户取车", null);
return;
}
// 获取客户信息
CustomerMain cus = customerService.getById(tickets.getUserId());
// 维修项目
List<DictDataRespDTO> repairType = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);

View File

@ -161,8 +161,6 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
**/
@Override
public List<DlRepairTitemRespVO> getProjList(String ticketId,String isOpen) {
// 更新工单主表时间
repairTicketsService.refreshUpdateTime(ticketId);
return dlRepairTitemMapper.selectProjList(ticketId,isOpen);
}
}

View File

@ -223,6 +223,10 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
twItem.setTwId(ticketWares.getId());
twItem.setWaresStatus("");
twItem.setWaresAlreadyCount(0);
//非仓管添加
twItem.setIfHouseAdd(false);
twItem.setAddUserId(SecurityFrameworkUtils.getLoginUserId());
twItem.setAddUserName(SecurityFrameworkUtils.getLoginUserNickname());
return twItem;
}).collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) {
@ -289,7 +293,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
List<DlTwItem> twItems = twItemService.listByIds(twItemIds);
// 取所有的配件信息
List<String> wareIds = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
List<RepairWares> repairWares = repairWaresService.listByIds(wareIds);
// 更新配件申请表子表
List<DlTwItem> newTwitems = twItemIds.stream().map(item -> {
DlTwItem twItem = new DlTwItem();
@ -307,68 +310,70 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
if (isStatus) {
baseMapper.update(new LambdaUpdateWrapper<DlTicketWares>().set(DlTicketWares::getStatus, "02").eq(DlTicketWares::getId, respVO.getId()));
}
// 更新维修工单子表
if (status.equals("01")) {
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
List<DlRepairTitem> titems = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
i.in(DlRepairTitem::getTicketId, ticketWares.getTicketId())
.eq(DlRepairTitem::getItemType, "02");
}));
// 要修改的
List<DlRepairTitem> updateTitems = titems.stream().filter(item -> wareIds.contains(item.getPartId())).collect(Collectors.toList());
// 修改
if (CollectionUtil.isNotEmpty(updateTitems)) {
List<DlRepairTitem> newTitems = updateTitems.stream().map(item -> {
DlRepairTitem titem = new DlRepairTitem();
titem.setId(item.getId());
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).findFirst().orElse(null);
if (twItem != null) {
titem.setItemCount(item.getItemCount() + twItem.getWaresCount());
titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(item.getItemDiscount()));
}
return titem;
}).collect(Collectors.toList());
repairTitemService.updateBatchById(newTitems);
}
// 要新增的
if (updateTitems.size() < wareIds.size()) {
List<String> titemIds = updateTitems.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList());
List<RepairWares> newWares = repairWares.stream().filter(item -> !titemIds.contains(item.getId())).collect(Collectors.toList());
// 新增
List<DlRepairTitem> newTitems = newWares.stream().map(item -> {
DlRepairTitem titem = new DlRepairTitem();
titem.setTicketId(ticketWares.getTicketId());
titem.setItemType("02");
titem.setItemName(item.getName());
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null);
titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0);
titem.setItemUnit(item.getUnit());
titem.setItemPrice((item.getPrice() != null) ? item.getPrice() : BigDecimal.ZERO);
titem.setItemDiscount(BigDecimal.ONE);
titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
titem.setRepairIds(String.valueOf(ticketWares.getRepairId()));
titem.setRepairNames(ticketWares.getRepairName());
titem.setSaleId(ticketWares.getAdviserId());
titem.setSaleName(ticketWares.getAdviserName());
titem.setPartId(item.getId());
titem.setItemStatus("04");
titem.setRemark(twItem != null ? twItem.getRemark() : null);
return titem;
}).collect(Collectors.toList());
repairTitemService.saveBatch(newTitems);
}
// 更新维修工单主表
boolean flag = repairTicketsService.computeTicket(ticketWares.getTicketId());
if (!flag) {
throw exception0(500, "重新计算工单错误");
}
// 发送通过的消息给仓库
RoleReqDTO roleInfo = roleApi.getRoleInfo(RepairRoleEnum.WAREHOUSE.getCode());
List<Long> ids = permissionApi.getUserIdByRoleId(roleInfo.getId());
if (CollectionUtil.isNotEmpty(ids)) {
ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理"));
}
}
/* 审核配件申请单暂时不操作工单子表 */
// // 更新维修工单子表
// List<RepairWares> repairWares = repairWaresService.listByIds(wareIds);
// if (status.equals("01")) {
// DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
// List<DlRepairTitem> titems = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
// i.in(DlRepairTitem::getTicketId, ticketWares.getTicketId())
// .eq(DlRepairTitem::getItemType, "02");
// }));
// // 要修改的
// List<DlRepairTitem> updateTitems = titems.stream().filter(item -> wareIds.contains(item.getPartId())).collect(Collectors.toList());
// // 修改
// if (CollectionUtil.isNotEmpty(updateTitems)) {
// List<DlRepairTitem> newTitems = updateTitems.stream().map(item -> {
// DlRepairTitem titem = new DlRepairTitem();
// titem.setId(item.getId());
// DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).findFirst().orElse(null);
// if (twItem != null) {
// titem.setItemCount(item.getItemCount() + twItem.getWaresCount());
// titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(item.getItemDiscount()));
// }
// return titem;
// }).collect(Collectors.toList());
// repairTitemService.updateBatchById(newTitems);
// }
// // 要新增的
// if (updateTitems.size() < wareIds.size()) {
// List<String> titemIds = updateTitems.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList());
// List<RepairWares> newWares = repairWares.stream().filter(item -> !titemIds.contains(item.getId())).collect(Collectors.toList());
// // 新增
// List<DlRepairTitem> newTitems = newWares.stream().map(item -> {
// DlRepairTitem titem = new DlRepairTitem();
// titem.setTicketId(ticketWares.getTicketId());
// titem.setItemType("02");
// titem.setItemName(item.getName());
// DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null);
// titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0);
// titem.setItemUnit(item.getUnit());
// titem.setItemPrice((item.getPrice() != null) ? item.getPrice() : BigDecimal.ZERO);
// titem.setItemDiscount(BigDecimal.ONE);
// titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
// titem.setRepairIds(String.valueOf(ticketWares.getRepairId()));
// titem.setRepairNames(ticketWares.getRepairName());
// titem.setSaleId(ticketWares.getAdviserId());
// titem.setSaleName(ticketWares.getAdviserName());
// titem.setPartId(item.getId());
// titem.setItemStatus("04");
// titem.setRemark(twItem != null ? twItem.getRemark() : null);
// return titem;
// }).collect(Collectors.toList());
// repairTitemService.saveBatch(newTitems);
// }
// // 更新维修工单主表
// boolean flag = repairTicketsService.computeTicket(ticketWares.getTicketId());
// if (!flag) {
// throw exception0(500, "重新计算工单错误");
// }
// // 发送通过的消息给仓库
// RoleReqDTO roleInfo = roleApi.getRoleInfo(RepairRoleEnum.WAREHOUSE.getCode());
// List<Long> ids = permissionApi.getUserIdByRoleId(roleInfo.getId());
// if (CollectionUtil.isNotEmpty(ids)) {
// ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理"));
// }
// }
// 通知维修工
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
repairWorkerService.sentMessage(ticketWares.getRepairId(), "您有新的配件申请单" + (status.equals("01") ? "审批通过了" : "被驳回了"));
@ -433,20 +438,18 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 更新配件申请子表
// 分领料和退料
// 先取出要操作的子表数据
List<DlTwItem> oldData = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
item.eq(DlTwItem::getTwId, respVO.getRepairSo().getTwId())
.in(DlTwItem::getWaresId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
}));
List<DlTwItem> oldData = twItemService.listByIds(respVO.getIds());
// List<DlTwItem> oldData = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
// item.eq(DlTwItem::getTwId, respVO.getRepairSo().getTwId())
// .in(DlTwItem::getWaresId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
// }));
// 要操作的库存数据
List<RepairWares> wares = repairWaresService.list(new LambdaQueryWrapper<RepairWares>().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())));
Map<String, String> waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId, RepairWares::getName));
String remarkStr = "";
for (DlRepairSoi item : respVO.getRepairSois()) {
//组装通知领取配件的文字
if (!"".equals(remarkStr)) {
remarkStr += ";";
}
remarkStr += waresNameMap.get(item.getGoodsId()) + "x" + item.getGoodsCount();
StringBuilder remarkStr = new StringBuilder();
for (int i = 0; i < respVO.getRepairSois().size(); i++) {
DlRepairSoi repairSoi = respVO.getRepairSois().get(i);
remarkStr.append(i + 1).append(".").append(waresNameMap.get(repairSoi.getGoodsId())).append("x").append(repairSoi.getGoodsCount()).append("; ");
}
if (type.equals("02")) { // 领料
// 构造新数据
@ -511,7 +514,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
//插入记录
//最后记录操作日志--创建工单
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, "02".equals(type) ? RecordTypeEnum.TZLL.getCode() : RecordTypeEnum.TZTL.getCode(),
("02".equals(type) ? "通知领料" : "通知退料") + ",配件明细:" + remarkStr, respVO.getImages());
("02".equals(type) ? "通知领料" : "通知退料") + ": " + remarkStr.toString(), respVO.getImages());
// 通知维修工
// 查维修工的userId
repairWorkerService.sentMessage(respVO.getRepairId(), type.equals("02") ? "您有新的领料单需要确认" : "您有新的退料单需要确认");

View File

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.tickets.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
@ -101,30 +103,86 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
**/
@Override
public void addTwi(AddTwiVO addTwiVO){
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// 构建子表数据
if (CollectionUtil.isEmpty(addTwiVO.getItems())){
throw exception0(500, "请选择配件");
}
// 查出该配件申请单已有的所有配件这里只取没有审核过通过驳回的不要同一个配件如果已经审核过了又添加还是算新的
List<DlTwItem> oldData = baseMapper.selectList(new LambdaQueryWrapper<DlTwItem>().and(i -> {
i.in(DlTwItem::getTwId, addTwiVO.getId())
.eq(DlTwItem::getWaresStatus, "");
}));
if (CollectionUtil.isNotEmpty(oldData)){
// 取配件ID
List<String> ids = oldData.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
// 过滤添加的
List<AddTwiVO.AddTwiVoItem> add = addTwiVO.getItems().stream().filter(item -> !ids.contains(item.getId())).collect(Collectors.toList());
// 过滤存在的
List<AddTwiVO.AddTwiVoItem> update = addTwiVO.getItems().stream().filter(item -> ids.contains(item.getId())).collect(Collectors.toList());
// 添加
if (CollectionUtil.isNotEmpty(add)){
List<DlTwItem> twItems = add.stream().map(item -> {
if(addTwiVO.getIfHouseAdd()){
//仓管添加
List<DlTwItem> twItems = addTwiVO.getItems().stream().map(item -> {
DlTwItem twItem = new DlTwItem();
twItem.setTwId(addTwiVO.getId());
twItem.setWaresId(item.getId());
twItem.setWaresName(item.getName());
twItem.setWaresCount(item.getCount());
twItem.setAddUserId(loginUser.getId());
twItem.setAddUserName(loginUser.getInfo().get("nickname"));
twItem.setIfHouseAdd(true);
twItem.setWaresAlreadyCount(0);
twItem.setWaresStatus("1");
twItem.setHandleId(loginUser.getId());
twItem.setHandleName(loginUser.getInfo().get("nickname"));
twItem.setRemark(item.getRemark());
return twItem;
}).collect(Collectors.toList());
// 新增
baseMapper.insert(twItems);
}else{
//服务顾问添加
// 查出该配件申请单已有的所有配件这里只取没有审核过通过驳回的不要同一个配件如果已经审核过了又添加还是算新的
List<DlTwItem> oldData = baseMapper.selectList(new LambdaQueryWrapper<DlTwItem>().and(i -> {
i.in(DlTwItem::getTwId, addTwiVO.getId())
.eq(DlTwItem::getWaresStatus, "");
}));
if (CollectionUtil.isNotEmpty(oldData)){
// 取配件ID
List<String> ids = oldData.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
// 过滤添加的
List<AddTwiVO.AddTwiVoItem> add = addTwiVO.getItems().stream().filter(item -> !ids.contains(item.getId())).collect(Collectors.toList());
// 过滤存在的
List<AddTwiVO.AddTwiVoItem> update = addTwiVO.getItems().stream().filter(item -> ids.contains(item.getId())).collect(Collectors.toList());
// 添加
if (CollectionUtil.isNotEmpty(add)){
List<DlTwItem> twItems = add.stream().map(item -> {
DlTwItem twItem = new DlTwItem();
twItem.setTwId(addTwiVO.getId());
twItem.setWaresId(item.getId());
twItem.setWaresName(item.getName());
twItem.setWaresCount(item.getCount());
twItem.setAddUserId(loginUser.getId());
twItem.setAddUserName(loginUser.getInfo().get("nickname"));
twItem.setIfHouseAdd(false);
twItem.setWaresAlreadyCount(0);
twItem.setWaresStatus("");
twItem.setRemark(item.getRemark());
return twItem;
}).collect(Collectors.toList());
// 新增
baseMapper.insert(twItems);
}
// 更新
if (CollectionUtil.isNotEmpty(update)){
List<DlTwItem> twItems = update.stream().map(item -> {
DlTwItem twItem = oldData.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null);
// 只更新数量其他不变
if (twItem != null) {
twItem.setWaresCount(twItem.getWaresCount() + item.getCount());
}
return twItem;
}).collect(Collectors.toList());
baseMapper.updateById(twItems);
}
}else {
List<DlTwItem> twItems = addTwiVO.getItems().stream().map(item -> {
DlTwItem twItem = new DlTwItem();
twItem.setTwId(addTwiVO.getId());
twItem.setWaresId(item.getId());
twItem.setWaresName(item.getName());
twItem.setWaresCount(item.getCount());
twItem.setAddUserId(loginUser.getId());
twItem.setAddUserName(loginUser.getInfo().get("nickname"));
twItem.setIfHouseAdd(false);
twItem.setWaresAlreadyCount(0);
twItem.setWaresStatus("");
twItem.setRemark(item.getRemark());
@ -133,32 +191,6 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
// 新增
baseMapper.insert(twItems);
}
// 更新
if (CollectionUtil.isNotEmpty(update)){
List<DlTwItem> twItems = update.stream().map(item -> {
DlTwItem twItem = oldData.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null);
// 只更新数量其他不变
if (twItem != null) {
twItem.setWaresCount(twItem.getWaresCount() + item.getCount());
}
return twItem;
}).collect(Collectors.toList());
baseMapper.updateById(twItems);
}
}else {
List<DlTwItem> twItems = addTwiVO.getItems().stream().map(item -> {
DlTwItem twItem = new DlTwItem();
twItem.setTwId(addTwiVO.getId());
twItem.setWaresId(item.getId());
twItem.setWaresName(item.getName());
twItem.setWaresCount(item.getCount());
twItem.setWaresAlreadyCount(0);
twItem.setWaresStatus("");
twItem.setRemark(item.getRemark());
return twItem;
}).collect(Collectors.toList());
// 新增
baseMapper.insert(twItems);
}
}

View File

@ -14,6 +14,10 @@ import java.util.List;
public class AddTwiVO {
private String id;
/**
* 是否仓管添加
*/
private Boolean ifHouseAdd;
private List<AddTwiVoItem> items;

View File

@ -7,12 +7,14 @@ import java.math.BigDecimal;
import java.util.List;
/**
* app使用的配件明细按分类分组后的
* app使用的配件明细(项目)按分类分组后的
* @author vinjor-M
* @date 10:10 2024/11/19
**/
@Data
public class AppWaresGroupVO {
/** 是否展开数据 */
private Boolean showAll;
/** 分组ID分类ID */
private String groupId;
/** 分组名称(分类名称) */
@ -23,7 +25,7 @@ public class AppWaresGroupVO {
private Integer nums;
/** 总价 */
private BigDecimal totalAmount;
/** 配件明细 */
/** 配件/项目明细 */
private List<DlRepairTitemReqVO> wares;
/** 配件申请单配件明细 */
private List<DlTwItemRespVO> twItemList;
@ -36,4 +38,9 @@ public class AppWaresGroupVO {
private Integer waitingNum;
/** 审核不通过数量-- */
private Integer noNum;
/** 服务顾问人名 */
private String servicer;
/** 维修工人名 */
private String worker;
}

View File

@ -65,4 +65,11 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
/** app分组回显专用--配件明细 */
List<AppWaresGroupVO> waresGroupList;
/** app分组回显专用--项目明细 */
List<AppWaresGroupVO> projectList;
/** 维修类型文本 */
private String repairTypeText;
/** 车辆实际竣工(总检完成)时间 */
private String realOverDate;
}

View File

@ -36,4 +36,7 @@ public class DlTicketWaresRespVO extends DlTicketWares {
/** 通知领料时上传的图片 */
private String images;
/** 操作的配件申请单子表的ids */
private List<String> ids;
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.tickets.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 用于导出不对状态的工单
*
* @author 小李
* @date 15:21 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class TicketExportByStatusVO extends TicketsExportVO{
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
@ExcelProperty("参考成本")
private BigDecimal cost;
@ExcelProperty("参考毛利")
private BigDecimal profit;
@ExcelProperty("服务顾问")
private String adviserName;
@ExcelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.tickets.vo;
import cn.iocoder.yudao.common.RepairDictConstants;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 用于配件申请单数据导出VO
*
* @author 小李
* @date 15:03 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class TicketWaresExportVO {
@ExcelProperty("单据号")
private String no;
@ExcelProperty("客户名称")
private String userName;
@ExcelProperty("客户电话")
private String userMobile;
@ExcelProperty("车牌号")
private String licenseNumber;
@ExcelProperty("申请人")
private String repairName;
@ExcelProperty(value = "岗位", converter = DictConvert.class)
@DictFormat(RepairDictConstants.REPAIR_WORK_TYPE)
private String repairWork;
@ExcelProperty("服务顾问")
private String adviserName;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(RepairDictConstants.TICKET_WARES_STATUS)
private String status;
@ExcelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.tickets.vo;
import cn.iocoder.yudao.common.RepairDictConstants;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 用于工单数据导出
*
* @author 小李
* @date 14:41 2024/12/3
**/
@Data
@ExcelIgnoreUnannotated
public class TicketsExportVO {
@ExcelProperty("订单编号")
private String ticketNo;
@ExcelProperty(value = "维修类别", converter = DictConvert.class)
@DictFormat(RepairDictConstants.REPAIR_TYPE)
private String repairType;
@ExcelProperty("客户名称")
private String userName;
@ExcelProperty("车牌号")
private String carNo;
@ExcelProperty("车系")
private String carBrandName;
@ExcelProperty("手机号")
private String userMobile;
@ExcelProperty("经办人姓名")
private String handleName;
@ExcelProperty("经办人电话")
private String handleMobile;
}

View File

@ -148,4 +148,45 @@
)
</if>
</select>
<select id="getSoBySupplier" resultMap="SoiAndWares">
select drsi.*,
drw.id AS wares_id,
drw.bar_code,
drw.code,
drw.name,
drw.model,
drw.price,
drw.pur_price,
drw.type,
drw.unit,
drw.warehouse,
drw.mini_stock,
drw.max_stock,
drw.stock,
drw.img,
drw.attribute,
drw.corp_id,
drw.cover_img,
drw.car_model,
drw.remark AS wares_remark,
drw.status,
drw.data_form
from dl_repair_soi drsi
join dl_repair_so drs on drsi.so_id = drs.id
join dl_repair_wares drw on drsi.goods_id = drw.id
where drs.so_type = '01'
<if test="map.supplierId != null and map.supplierId != ''">
and drs.supplier_id = #{map.supplierId}
</if>
<if test="map.query != null and map.query != ''">
and (
drw.name like concat('%', #{map.query}, '%')
or
drw.code like concat('%', #{map.query}, '%')
or
drw.model like concat('%', #{map.query}, '%')
)
</if>
</select>
</mapper>

View File

@ -107,6 +107,8 @@
<result property="confirmFaultMoney" column="confirm_fault_money" />
<result property="billingRemark" column="billing_remark" />
<result property="canOperate" column="can_operate" />
<result property="handleName" column="handle_name" />
<result property="handleMobile" column="handle_mobile" />
<association property="booking" javaType="cn.iocoder.yudao.module.booking.entity.DlRepairBooking" select="selectBookingById" column="id"/>
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
</resultMap>
@ -160,7 +162,9 @@
rescue_money,
three_pack_money,
confirm_fault_money,
billing_remark
billing_remark,
handle_name,
handle_mobile
from dl_repair_tickets drt
where drt.deleted = '0'
</sql>

View File

@ -26,6 +26,9 @@
wares_count,
wares_already_count,
wares_status,
add_user_id,
add_user_name,
if_house_add,
handle_id,
handle_name,
remark
@ -56,6 +59,9 @@
dti.wares_count,
dti.wares_already_count,
dti.wares_status,
dti.add_user_id,
dti.add_user_name,
dti.if_house_add,
dti.handle_id,
dti.handle_name,
dti.update_time,

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.warnMessage.mapper.WarnMessageByRepairMapper">
</mapper>

View File

@ -47,6 +47,8 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<AdminUserDO>()
.likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
// 这里加了个模糊查询用户名称搜索时可以模糊查用户昵称
.likeIfPresent(AdminUserDO::getNickname, reqVO.getUsername())
.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
.inIfPresent(AdminUserDO::getDeptId, deptIds)