| | |
| | | alter table ticket_registration |
| | | add enter_date timestamp null; |
| | | |
| | | alter table product_record |
| | | add 列_name int null comment 'sale_ledger_projectI_id'; |
| | | |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | |
| | |
| | | |
| | | @PostMapping("import") |
| | | @ApiModelProperty("导入设备台账") |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public AjaxResult importData(MultipartFile file) throws IOException { |
| | | Boolean b = deviceLedgerService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导入成功"); |
| | |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | |
| | | |
| | | @Api(tags = "设备保养") |
| | | @RestController |
| | | @RequestMapping("/device/maintenance") |
| | | public class DeviceMaintenanceController { |
| | |
| | | |
| | | @PostMapping() |
| | | @ApiModelProperty("添加设备保养") |
| | | public AjaxResult add(@RequestBody DeviceMaintenance deviceRepair) { |
| | | return deviceMaintenanceService.saveDeviceRepair(deviceRepair); |
| | | public AjaxResult add(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.saveDeviceRepair(deviceMaintenance); |
| | | } |
| | | |
| | | @ApiModelProperty("根据id查询设备保养") |
| | |
| | | @PutMapping () |
| | | @ApiModelProperty("修改设备保养") |
| | | public AjaxResult update(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceRepair(deviceMaintenance); |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | @PostMapping ("maintenance") |
| | | @ApiModelProperty("修改设备保养") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceRepair(deviceMaintenance); |
| | | deviceMaintenance.setStatus(1); |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @DeleteMapping("/{ida}") |
| | | @ApiModelProperty("删除设备保养") |
| | | public AjaxResult delete(@PathVariable ArrayList<Long> ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(ids); |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设备台账id") |
| | | private String deviceLedgerId; |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("设备名称") |
| | | private String deviceName; |
| | |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("计划保养日期") |
| | | private Date maintenancePlanTime; |
| | | private LocalDateTime maintenancePlanTime; |
| | | |
| | | @ApiModelProperty("实际保养人") |
| | | private String maintenanceActuallyName; |
| | | |
| | | @ApiModelProperty("实际保养日期") |
| | | private Date maintenanceActuallyTime; |
| | | private LocalDateTime maintenanceActuallyTime; |
| | | |
| | | @ApiModelProperty("保养结果 0 维修 1 完好") |
| | | private Integer maintenanceResult; |
| | |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("更新时间") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private Date updateTime; |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("创建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | |
| | | @ApiModelProperty("租户id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("创建人名称") |
| | | private String createUserName; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | |
| | | */ |
| | | @Excel(name = "不含税总价",sort = 9) |
| | | private BigDecimal unTaxIncludingPriceTotal; |
| | | |
| | | /** |
| | | * 录入时间 |
| | | * |
| | | */ |
| | | @Excel(name = "录入时间",sort = 10) |
| | | private LocalDateTime createTime; |
| | | // |
| | | // /** |
| | | // * 录入时间 |
| | | // * |
| | | // */ |
| | | // @Excel(name = "录入时间",sort = 10) |
| | | // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // private LocalDateTime createTime; |
| | | |
| | | |
| | | |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设备台账id") |
| | | private String deviceLedgerId; |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("计划保养日期") |
| | | private Date maintenancePlanTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime maintenancePlanTime; |
| | | |
| | | @ApiModelProperty("实际保养人") |
| | | private String maintenanceActuallyName; |
| | | |
| | | @ApiModelProperty("实际保养日期") |
| | | private Date maintenanceActuallyTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime maintenanceActuallyTime; |
| | | |
| | | @ApiModelProperty("保养结果 0 维修 1 完好") |
| | | private Integer maintenanceResult; |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设备台账id") |
| | | private String deviceLedgerId; |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("报修时间") |
| | | private Date repairTime; |
| | |
| | | private String maintenanceName; |
| | | |
| | | @ApiModelProperty("维修时间") |
| | | private Date maintenanceTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime maintenanceTime; |
| | | |
| | | @ApiModelProperty("维修结果") |
| | | private String maintenanceResult; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | |
| | | public interface IDeviceLedgerService extends IService<DeviceLedger> { |
| | |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | Boolean importData(MultipartFile file); |
| | | Boolean importData(MultipartFile file) throws IOException; |
| | | } |
| | |
| | | |
| | | AjaxResult saveDeviceRepair(DeviceMaintenance deviceMaintenance); |
| | | |
| | | AjaxResult updateDeviceRepair(DeviceMaintenance deviceMaintenance); |
| | | AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenance deviceMaintenance); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | |
| | | 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.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean importData(MultipartFile file) { |
| | | return null; |
| | | public Boolean importData(MultipartFile file) throws IOException { |
| | | ExcelUtil<DeviceLedgerExeclDto> util = new ExcelUtil<DeviceLedgerExeclDto>(DeviceLedgerExeclDto.class); |
| | | List<DeviceLedgerExeclDto> userList = util.importExcel(file.getInputStream()); |
| | | userList.forEach(c -> { |
| | | DeviceLedger deviceLedger = new DeviceLedger(); |
| | | SysUser sysUser = sysUserMapper.selectUserByUserName(c.getCreateUser()); |
| | | if (sysUser!=null) { |
| | | deviceLedger.setCreateUser(sysUser.getUserId().intValue()); |
| | | }else { |
| | | deviceLedger.setCreateUser(SecurityUtils.getUserId().intValue()); |
| | | } |
| | | BeanUtils.copyProperties(c,deviceLedger); |
| | | deviceLedgerMapper.insert(deviceLedger); |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenance deviceRepair) { |
| | | boolean save = this.save(deviceRepair); |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenance deviceMaintenance) { |
| | | boolean save = this.save(deviceMaintenance); |
| | | if (save){ |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateDeviceRepair(DeviceMaintenance deviceRepair) { |
| | | if (this.updateById(deviceRepair)) { |
| | | public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenance deviceMaintenance) { |
| | | if (this.updateById(deviceMaintenance)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除付款登记 |
| | | */ |
| | | @Log(title = "付款登记", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody Long[] ids) { |
| | | return toAjax(paymentRegistrationService.delete(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 获取付款登记详细信息 |
| | | */ |
| | | @GetMapping(value = "/byPurchaseId/{id}") |
| | |
| | | private Long purchaseLedgerId; |
| | | |
| | | /** |
| | | * 产品id |
| | | */ |
| | | private Long saleLedgerProjectId; |
| | | |
| | | /** |
| | | * 产品大类 |
| | | */ |
| | | private String productCategory; |
| | |
| | | * @return 付款登记集合 |
| | | */ |
| | | IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, PaymentRegistrationDto paymentRegistrationDto); |
| | | |
| | | Boolean delete(Long[] ids); |
| | | } |
| | |
| | | return paymentRegistrationMapper.paymentHistoryListPage(page, paymentRegistrationDto); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean delete(Long[] ids) { |
| | | for (Long id : ids) { |
| | | List<ProductRecord> productRecords = productRecordMapper.selectList(new QueryWrapper<ProductRecord>().lambda().eq(ProductRecord::getTicketRegistrationId, id)); |
| | | for (ProductRecord productRecord : productRecords) { |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecord.getSaleLedgerProjectId()); |
| | | salesLedgerProduct.setTicketsNum(salesLedgerProduct.getTicketsNum().subtract(productRecord.getTicketsNum())); |
| | | salesLedgerProduct.setTicketsAmount(salesLedgerProduct.getTicketsAmount().subtract(productRecord.getTicketsAmount())); |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getFutureTickets().add(productRecord.getTicketsNum())); |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getFutureTicketsAmount().add(productRecord.getTicketsAmount())); |
| | | salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | } |
| | | ticketRegistrationMapper.delete(new QueryWrapper<TicketRegistration>().lambda().eq(TicketRegistration::getId, id)); |
| | | productRecordMapper.delete(new QueryWrapper<ProductRecord>().lambda().eq(ProductRecord::getTicketRegistrationId, id)); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // 批量查询采购台账(当月) |
| | | private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) { |
| | | LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>(); |
| | |
| | | if (CollectionUtils.isNotEmpty(salesLedgerProducts)) { |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | ProductRecord productRecord = new ProductRecord(); |
| | | |
| | | productRecord.setTicketRegistrationId(ticketRegistration.getId()); |
| | | productRecord.setPurchaseLedgerId(ticketRegistrationDto.getPurchaseLedgerId()); |
| | | productRecord.setCreatedAt(DateUtils.getNowDate()); |
| | | BeanUtils.copyProperties(salesLedgerProduct, productRecord); |
| | | productRecord.setSaleLedgerProjectId(salesLedgerProduct.getId()); |
| | | productRecord.setId(null); |
| | | productRecord.setType("2"); |
| | | productRecordMapper.insert(productRecord); |
| | |
| | | private String salesContractNo; |
| | | private String customerContractNo; |
| | | private String projectName; |
| | | // @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private String entryDate; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date entryDate; |
| | | |
| | | private String entryDateStart; |
| | | private String entryDateEnd; |
| | | |
| | | |
| | | private String salesman; |
| | | private Long customerId; |
| | | private String customerName; |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * 销售台账对象 sales_ledger |
| | |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "录入日期", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date entryDate; |
| | | |
| | | /** |
| | |
| | | <select id="queryPage" resultType="com.ruoyi.device.dto.DeviceMaintenanceDto"> |
| | | select dm.*, |
| | | dl.device_name, |
| | | dl.device_model |
| | | dl.device_model, |
| | | su.user_name as create_user_name |
| | | from device_maintenance dm |
| | | left join device_ledger dl on dm.device_ledger_id = dl.id |
| | | left join sys_user su on dm.create_user = su.user_id |
| | | <where> |
| | | <if test="deviceRepairDto.deviceName != null"> |
| | | and dl.device_name like concat('%',#{deviceRepairDto.deviceName},'%') |
| | | <if test="deviceMaintenanceDto.deviceName != null"> |
| | | and dl.device_name like concat('%',#{deviceMaintenanceDto.deviceName},'%') |
| | | </if> |
| | | <if test="deviceRepairDto.deviceModel != null"> |
| | | and dl.device_model like concat('%',#{deviceRepairDto.deviceModel},'%') |
| | | <if test="deviceMaintenanceDto.deviceModel != null"> |
| | | and dl.device_model like concat('%',#{deviceMaintenanceDto.deviceModel},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="detailById" resultType="com.ruoyi.device.dto.DeviceMaintenanceDto"> |
| | | select dm.*, |
| | | dl.device_name, |
| | | dl.device_model |
| | | dl.device_model, |
| | | su.user_name as create_user_name |
| | | from device_maintenance dm |
| | | left join device_ledger dl on dm.device_ledger_id = dl.id |
| | | left join sys_user su on dm.create_user = su.user_id |
| | | where dm.id = #{id} |
| | | </select> |
| | | |
| | |
| | | LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id |
| | | <where> |
| | | <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' "> |
| | | T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%') |
| | | AND T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.customerContractNo != null and salesLedgerDto.customerContractNo !='' "> |
| | | T1.customer_contract_no LIKE CONCAT('%',#{salesLedgerDto.customerContractNo},'%') |
| | | AND T1.customer_contract_no LIKE CONCAT('%',#{salesLedgerDto.customerContractNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.salesContractNo != null and salesLedgerDto.salesContractNo != '' "> |
| | | T1.sales_contract_no LIKE CONCAT('%',#{salesLedgerDto.salesContractNo},'%') |
| | | AND T1.sales_contract_no LIKE CONCAT('%',#{salesLedgerDto.salesContractNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.projectName != null and salesLedgerDto.projectName != '' "> |
| | | T1.project_name LIKE CONCAT('%',#{salesLedgerDto.projectName},'%') |
| | | AND T1.project_name LIKE CONCAT('%',#{salesLedgerDto.projectName},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.entryDate != null and salesLedgerDto.entryDate != '' "> |
| | | T1.entry_date = DATE_FORMAT(#{salesLedgerDto.entryDate},'%Y-%m-%d') |
| | | </if> |
| | | <if test="salesLedgerDto.entryDateStart != null and salesLedgerDto.entryDateStart != '' "> |
| | | AND T1.entry_date >= DATE_FORMAT(#{salesLedgerDto.entryDateStart},'%Y-%m-%d') |
| | | </if> |
| | | <if test="salesLedgerDto.entryDateEnd != null and salesLedgerDto.entryDateEnd != '' "> |
| | | AND T1.entry_date <= DATE_FORMAT(#{salesLedgerDto.entryDateEnd},'%Y-%m-%d') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |