# Conflicts:
#	jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/ParkServiceImpl.java
master
vayne 3 months ago
commit d88db60ec5

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BillTableEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
public interface BillTableMapper extends BaseMapper<BillTableEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BilldevicedeatialEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
public interface BilldevicedeatialMapper extends BaseMapper<BilldevicedeatialEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BillotherdeatialEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
public interface BillotherdeatialMapper extends BaseMapper<BillotherdeatialEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BillspacedetailEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
public interface BillspacedetailMapper extends BaseMapper<BillspacedetailEntity> {
}

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-16
* 2024-07-19
*/
public interface ContractMapper extends BaseMapper<ContractEntity> {

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.DecorationApplicationFormEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* DecorationApplicationForm
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-18
*/
public interface DecorationApplicationFormMapper extends BaseMapper<DecorationApplicationFormEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.EquipmentInspectionRecordsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* EquipmentInspectionRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
public interface EquipmentInspectionRecordsMapper extends BaseMapper<EquipmentInspectionRecordsEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.EquipmentMaintenanceRecordsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* EquipmentMaintenanceRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
public interface EquipmentMaintenanceRecordsMapper extends BaseMapper<EquipmentMaintenanceRecordsEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.EquipmentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Equipment
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-15
*/
public interface EquipmentMapper extends BaseMapper<EquipmentEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.EquipmentRentalRecordsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* EquipmentRentalRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-17
*/
public interface EquipmentRentalRecordsMapper extends BaseMapper<EquipmentRentalRecordsEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.EquipmentRepairRecordsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* EquipmentRepairRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
public interface EquipmentRepairRecordsMapper extends BaseMapper<EquipmentRepairRecordsEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.ParkEquipmentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* ParkEquipment
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-16
*/
public interface ParkEquipmentMapper extends BaseMapper<ParkEquipmentEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.VenueReservationRecordEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* VenueReservationRecord
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-18
*/
public interface VenueReservationRecordMapper extends BaseMapper<VenueReservationRecordEntity> {
}

@ -0,0 +1,65 @@
package jnpf.service;
import jnpf.model.billtable.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
public interface BillTableService extends IService<BillTableEntity> {
List<BillTableEntity> getList(BillTablePagination billTablePagination);
List<BillTableEntity> getTypeList(BillTablePagination billTablePagination, String dataType);
BillTableEntity getInfo(String id);
void delete(BillTableEntity entity);
void create(BillTableEntity entity);
boolean update(String id, BillTableEntity entity);
//子表方法
List<BillspacedetailEntity> getBillspacedetailList(String id, BillTablePagination billTablePagination);
List<BillspacedetailEntity> getBillspacedetailList(String id);
List<BilldevicedeatialEntity> getBilldevicedeatialList(String id, BillTablePagination billTablePagination);
List<BilldevicedeatialEntity> getBilldevicedeatialList(String id);
List<BillotherdeatialEntity> getBillotherdeatialList(String id, BillTablePagination billTablePagination);
List<BillotherdeatialEntity> getBillotherdeatialList(String id);
//副表数据方法
String checkForm(BillTableForm form, int i);
String saveOrUpdate(BillTableForm billTableForm, String id, boolean isSave);
/**
*
*
* @param id id
* @return
*/
String billConfirm(String id);
/**
*
*
* @param id id
* @param billTableForm
* @return
*/
String entry(String id, BillTableForm billTableForm);
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.billtable.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
public interface BilldevicedeatialService extends IService<BilldevicedeatialEntity> {
QueryWrapper<BilldevicedeatialEntity> getChild(BillTablePagination pagination,QueryWrapper<BilldevicedeatialEntity> billdevicedeatialQueryWrapper);
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.billtable.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
public interface BillotherdeatialService extends IService<BillotherdeatialEntity> {
QueryWrapper<BillotherdeatialEntity> getChild(BillTablePagination pagination,QueryWrapper<BillotherdeatialEntity> billotherdeatialQueryWrapper);
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.billtable.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
public interface BillspacedetailService extends IService<BillspacedetailEntity> {
QueryWrapper<BillspacedetailEntity> getChild(BillTablePagination pagination,QueryWrapper<BillspacedetailEntity> billspacedetailQueryWrapper);
}

@ -6,14 +6,20 @@ import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jnpf.entity.ContractEntity;
import jnpf.entity.SpacecontractEntity;
import jnpf.model.contract.ContractForm;
import jnpf.model.contract.ContractPagination;
import jnpf.model.contract.ContractRequest;
import java.util.List;
/**
* Contract
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-16
* 2024-07-19
*/
public interface ContractService extends IService<ContractEntity> {
List<ContractEntity> getList(ContractPagination contractPagination);
@ -53,4 +59,36 @@ public interface ContractService extends IService<ContractEntity> {
* @return string
*/
String finish(ContractRequest request);
/**
* id
*
* @param id id
* @return name
*/
String findNameById(String id);
/**
* id
*
* @param id id
* @return code
*/
String findCodeById(String id);
/**
* id
*
* @param contractPagination
* @return list
*/
List<ContractDTO> getSpacesById(ContractPagination contractPagination);
/**
* id
*
* @param contractPagination
* @return list
*/
List<ContractDevicesDTO> getDevicesById(ContractPagination contractPagination);
}

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.decorationapplicationform.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* DecorationApplicationForm
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-18
*/
public interface DecorationApplicationFormService extends IService<DecorationApplicationFormEntity> {
List<DecorationApplicationFormEntity> getList(DecorationApplicationFormPagination decorationApplicationFormPagination);
List<DecorationApplicationFormEntity> getTypeList(DecorationApplicationFormPagination decorationApplicationFormPagination,String dataType);
DecorationApplicationFormEntity getInfo(String id);
void delete(DecorationApplicationFormEntity entity);
void create(DecorationApplicationFormEntity entity);
boolean update(String id, DecorationApplicationFormEntity entity);
//子表方法
//副表数据方法
String checkForm(DecorationApplicationFormForm form,int i);
void saveOrUpdate(DecorationApplicationFormForm decorationApplicationFormForm,String id, boolean isSave) throws Exception;
}

@ -42,4 +42,12 @@ public interface EnterpriseMerchantsService extends IService<EnterpriseMerchants
* @param parkId id
*/
void updateStatus(String contractStatus, String contractName, String parkId);
/**
* id
*
* @param id id
* @return name
*/
String findNameById(String id);
}

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.equipmentinspectionrecords.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* EquipmentInspectionRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
public interface EquipmentInspectionRecordsService extends IService<EquipmentInspectionRecordsEntity> {
List<EquipmentInspectionRecordsEntity> getList(EquipmentInspectionRecordsPagination equipmentInspectionRecordsPagination);
List<EquipmentInspectionRecordsEntity> getTypeList(EquipmentInspectionRecordsPagination equipmentInspectionRecordsPagination,String dataType);
EquipmentInspectionRecordsEntity getInfo(String id);
void delete(EquipmentInspectionRecordsEntity entity);
void create(EquipmentInspectionRecordsEntity entity);
boolean update(String id, EquipmentInspectionRecordsEntity entity);
//子表方法
//副表数据方法
String checkForm(EquipmentInspectionRecordsForm form,int i);
void saveOrUpdate(EquipmentInspectionRecordsForm equipmentInspectionRecordsForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.equipmentmaintenancerecords.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* EquipmentMaintenanceRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
public interface EquipmentMaintenanceRecordsService extends IService<EquipmentMaintenanceRecordsEntity> {
List<EquipmentMaintenanceRecordsEntity> getList(EquipmentMaintenanceRecordsPagination equipmentMaintenanceRecordsPagination);
List<EquipmentMaintenanceRecordsEntity> getTypeList(EquipmentMaintenanceRecordsPagination equipmentMaintenanceRecordsPagination,String dataType);
EquipmentMaintenanceRecordsEntity getInfo(String id);
void delete(EquipmentMaintenanceRecordsEntity entity);
void create(EquipmentMaintenanceRecordsEntity entity);
boolean update(String id, EquipmentMaintenanceRecordsEntity entity);
//子表方法
//副表数据方法
String checkForm(EquipmentMaintenanceRecordsForm form,int i);
void saveOrUpdate(EquipmentMaintenanceRecordsForm equipmentMaintenanceRecordsForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,45 @@
package jnpf.service;
import jnpf.model.equipmentrentalrecords.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* EquipmentRentalRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-17
*/
public interface EquipmentRentalRecordsService extends IService<EquipmentRentalRecordsEntity> {
List<EquipmentRentalRecordsEntity> getList(EquipmentRentalRecordsPagination equipmentRentalRecordsPagination);
List<EquipmentRentalRecordsEntity> getTypeList(EquipmentRentalRecordsPagination equipmentRentalRecordsPagination, String dataType);
EquipmentRentalRecordsEntity getInfo(String id);
void delete(EquipmentRentalRecordsEntity entity);
void create(EquipmentRentalRecordsEntity entity);
String update(String id, EquipmentRentalRecordsEntity entity);
//子表方法
//副表数据方法
String checkForm(EquipmentRentalRecordsForm form, int i);
void saveOrUpdate(EquipmentRentalRecordsForm equipmentRentalRecordsForm, String id, boolean isSave) throws Exception;
/**
* id
*
* @param merchantId id
* @param keyword
* @return list
*/
List<EquipmentRentalRecordsEntity> findByMerchantId(String merchantId, String keyword);
}

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.equipmentrepairrecords.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* EquipmentRepairRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
public interface EquipmentRepairRecordsService extends IService<EquipmentRepairRecordsEntity> {
List<EquipmentRepairRecordsEntity> getList(EquipmentRepairRecordsPagination equipmentRepairRecordsPagination);
List<EquipmentRepairRecordsEntity> getTypeList(EquipmentRepairRecordsPagination equipmentRepairRecordsPagination,String dataType);
EquipmentRepairRecordsEntity getInfo(String id);
void delete(EquipmentRepairRecordsEntity entity);
void create(EquipmentRepairRecordsEntity entity);
boolean update(String id, EquipmentRepairRecordsEntity entity);
//子表方法
//副表数据方法
String checkForm(EquipmentRepairRecordsForm form,int i);
void saveOrUpdate(EquipmentRepairRecordsForm equipmentRepairRecordsForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,44 @@
package jnpf.service;
import jnpf.model.equipment.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* Equipment
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-15
*/
public interface EquipmentService extends IService<EquipmentEntity> {
List<EquipmentEntity> getList(EquipmentPagination equipmentPagination);
List<EquipmentEntity> getTypeList(EquipmentPagination equipmentPagination, String dataType);
EquipmentEntity getInfo(String id);
void delete(EquipmentEntity entity);
void create(EquipmentEntity entity);
boolean update(String id, EquipmentEntity entity);
//子表方法
//副表数据方法
String checkForm(EquipmentForm form, int i);
void saveOrUpdate(EquipmentForm equipmentForm, String id, boolean isSave) throws Exception;
/**
*
*
* @param equipmentId id
* @param status
*/
void updateStatus(String equipmentId, String status);
}

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.parkequipment.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* ParkEquipment
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-16
*/
public interface ParkEquipmentService extends IService<ParkEquipmentEntity> {
List<ParkEquipmentEntity> getList(ParkEquipmentPagination parkEquipmentPagination);
List<ParkEquipmentEntity> getTypeList(ParkEquipmentPagination parkEquipmentPagination,String dataType);
ParkEquipmentEntity getInfo(String id);
void delete(ParkEquipmentEntity entity);
void create(ParkEquipmentEntity entity);
boolean update(String id, ParkEquipmentEntity entity);
//子表方法
//副表数据方法
String checkForm(ParkEquipmentForm form,int i);
void saveOrUpdate(ParkEquipmentForm parkEquipmentForm,String id, boolean isSave) throws Exception;
}

@ -2,7 +2,9 @@ package jnpf.service;
import jnpf.model.park.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -16,7 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
public interface ParkService extends IService<ParkEntity> {
List<ParkEntity> getList(ParkPagination parkPagination);
List<ParkEntity> getTypeList(ParkPagination parkPagination,String dataType);
List<ParkEntity> getTypeList(ParkPagination parkPagination, String dataType);
ParkEntity getInfo(String id);
@ -28,8 +30,37 @@ public interface ParkService extends IService<ParkEntity> {
//子表方法
//副表数据方法
String checkForm(ParkForm form,int i);
String checkForm(ParkForm form, int i);
void saveOrUpdate(ParkForm parkForm, String id, boolean isSave) throws Exception;
/**
* id
*
* @param id id
* @return name
*/
String findNameById(String id);
/**
* id false
*
* @param spaceIds ids
* @return boolean
*/
boolean queryStatus(List<String> spaceIds);
void saveOrUpdate(ParkForm parkForm,String id, boolean isSave) throws Exception;
/**
* id
*
* @param parkId id
* @param status
*/
void updateStatus(String parkId, String status);
/**
*
* @return
*/
List<ParkDTO> tree();
}

@ -2,7 +2,9 @@ package jnpf.service;
import jnpf.model.contract.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -14,5 +16,29 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
* 2024-07-16
*/
public interface SpacecontractService extends IService<SpacecontractEntity> {
QueryWrapper<SpacecontractEntity> getChild(ContractPagination pagination,QueryWrapper<SpacecontractEntity> spacecontractQueryWrapper);
/**
* id
*
* @param contractNumber
* @return list
*/
List<String> findByNums(String contractNumber);
QueryWrapper<SpacecontractEntity> getChild(ContractPagination pagination, QueryWrapper<SpacecontractEntity> spacecontractQueryWrapper);
/**
*
*
* @param contractNumber
*/
void delData(String contractNumber);
/**
*
*
* @param contractNumber
* @param keyWord
* @return list
*/
List<SpacecontractEntity> findByNum(String contractNumber,String keyWord);
}

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.venuereservationrecord.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* VenueReservationRecord
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-18
*/
public interface VenueReservationRecordService extends IService<VenueReservationRecordEntity> {
List<VenueReservationRecordEntity> getList(VenueReservationRecordPagination venueReservationRecordPagination);
List<VenueReservationRecordEntity> getTypeList(VenueReservationRecordPagination venueReservationRecordPagination,String dataType);
VenueReservationRecordEntity getInfo(String id);
void delete(VenueReservationRecordEntity entity);
void create(VenueReservationRecordEntity entity);
boolean update(String id, VenueReservationRecordEntity entity);
//子表方法
//副表数据方法
String checkForm(VenueReservationRecordForm form,int i);
void saveOrUpdate(VenueReservationRecordForm venueReservationRecordForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,742 @@
package jnpf.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jnpf.entity.*;
import jnpf.mapper.BillTableMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.billtable.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
import javax.annotation.Resource;
/**
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
@Service
@Slf4j
public class BillTableServiceImpl extends ServiceImpl<BillTableMapper, BillTableEntity> implements BillTableService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private BillspacedetailService billspacedetailService;
@Autowired
private BilldevicedeatialService billdevicedeatialService;
@Autowired
private BillotherdeatialService billotherdeatialService;
@Resource
private EnterpriseMerchantsService enterpriseMerchantsService;
@Resource
private ContractService contractService;
@Override
public List<BillTableEntity> getList(BillTablePagination billTablePagination) {
return getTypeList(billTablePagination, billTablePagination.getDataType());
}
/**
*
*/
@Override
public List<BillTableEntity> getTypeList(BillTablePagination billTablePagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? BillTableConstant.getAppColumnData() : BillTableConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0;
int billTableNum = 0;
QueryWrapper<BillTableEntity> billTableQueryWrapper = new QueryWrapper<>();
int billdevicedeatialNum = 0;
QueryWrapper<BilldevicedeatialEntity> billdevicedeatialQueryWrapper = new QueryWrapper<>();
int billotherdeatialNum = 0;
QueryWrapper<BillotherdeatialEntity> billotherdeatialQueryWrapper = new QueryWrapper<>();
int billspacedetailNum = 0;
QueryWrapper<BillspacedetailEntity> billspacedetailQueryWrapper = new QueryWrapper<>();
long billdevicedeatialcount = billdevicedeatialService.count();
long billotherdeatialcount = billotherdeatialService.count();
long billspacedetailcount = billspacedetailService.count();
List<String> allSuperIDlist = new ArrayList<>();
String superOp = "";
if (ObjectUtil.isNotEmpty(billTablePagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = billTablePagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<BillTableEntity> billTableSuperWrapper = new QueryWrapper<>();
billTableSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(billTableSuperWrapper, BillTableEntity.class, queryJson, "0"));
int billTableNum1 = billTableSuperWrapper.getExpression().getNormal().size();
if (billTableNum1 > 0) {
List<String> billTableList = this.list(billTableSuperWrapper).stream().map(BillTableEntity::getId).collect(Collectors.toList());
allSuperList.addAll(billTableList);
intersectionSuperList.add(billTableList);
superNum++;
}
String BilldevicedeatialTable = "yq_bill_device_deatial";
boolean BilldevicedeatialHasSql = queryJson.contains(BilldevicedeatialTable);
List<String> billdevicedeatialList = generaterSwapUtil.selectIdsByChildCondition(BillTableConstant.getTableList(), BilldevicedeatialTable, queryJson, null);
if (BilldevicedeatialHasSql) {
allSuperList.addAll(billdevicedeatialList);
intersectionSuperList.add(billdevicedeatialList);
superNum++;
}
String BillotherdeatialTable = "yq_bill_other_deatial";
boolean BillotherdeatialHasSql = queryJson.contains(BillotherdeatialTable);
List<String> billotherdeatialList = generaterSwapUtil.selectIdsByChildCondition(BillTableConstant.getTableList(), BillotherdeatialTable, queryJson, null);
if (BillotherdeatialHasSql) {
allSuperList.addAll(billotherdeatialList);
intersectionSuperList.add(billotherdeatialList);
superNum++;
}
String BillspacedetailTable = "yq_bill_space_detail";
boolean BillspacedetailHasSql = queryJson.contains(BillspacedetailTable);
List<String> billspacedetailList = generaterSwapUtil.selectIdsByChildCondition(BillTableConstant.getTableList(), BillspacedetailTable, queryJson, null);
if (BillspacedetailHasSql) {
allSuperList.addAll(billspacedetailList);
intersectionSuperList.add(billspacedetailList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<BillTableEntity> billTableSuperWrapper = new QueryWrapper<>();
billTableSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(billTableSuperWrapper, BillTableEntity.class, ruleJson, "0"));
int billTableNum1 = billTableSuperWrapper.getExpression().getNormal().size();
if (billTableNum1 > 0) {
List<String> billTableList = this.list(billTableSuperWrapper).stream().map(BillTableEntity::getId).collect(Collectors.toList());
allRuleList.addAll(billTableList);
intersectionRuleList.add(billTableList);
ruleNum++;
}
String BilldevicedeatialTable = "yq_bill_device_deatial";
boolean BilldevicedeatialHasSql = ruleJson.contains(BilldevicedeatialTable);
List<String> billdevicedeatialList = generaterSwapUtil.selectIdsByChildCondition(BillTableConstant.getTableList(), BilldevicedeatialTable, ruleJson, null);
if (BilldevicedeatialHasSql) {
allRuleList.addAll(billdevicedeatialList);
intersectionRuleList.add(billdevicedeatialList);
ruleNum++;
}
String BillotherdeatialTable = "yq_bill_other_deatial";
boolean BillotherdeatialHasSql = ruleJson.contains(BillotherdeatialTable);
List<String> billotherdeatialList = generaterSwapUtil.selectIdsByChildCondition(BillTableConstant.getTableList(), BillotherdeatialTable, ruleJson, null);
if (BillotherdeatialHasSql) {
allRuleList.addAll(billotherdeatialList);
intersectionRuleList.add(billotherdeatialList);
ruleNum++;
}
String BillspacedetailTable = "yq_bill_space_detail";
boolean BillspacedetailHasSql = ruleJson.contains(BillspacedetailTable);
List<String> billspacedetailList = generaterSwapUtil.selectIdsByChildCondition(BillTableConstant.getTableList(), BillspacedetailTable, ruleJson, null);
if (BillspacedetailHasSql) {
allRuleList.addAll(billspacedetailList);
intersectionRuleList.add(billspacedetailList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object billTableObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(billTableQueryWrapper, BillTableEntity.class, billTablePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(billTableObj)) {
return new ArrayList<>();
} else {
billTableQueryWrapper = (QueryWrapper<BillTableEntity>) billTableObj;
if (billTableQueryWrapper.getExpression().getNormal().size() > 0) {
billTableNum++;
}
}
Object billdevicedeatialObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(billdevicedeatialQueryWrapper, BilldevicedeatialEntity.class, billTablePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(billdevicedeatialObj)) {
return new ArrayList<>();
} else {
billdevicedeatialQueryWrapper = (QueryWrapper<BilldevicedeatialEntity>) billdevicedeatialObj;
if (billdevicedeatialQueryWrapper.getExpression().getNormal().size() > 0) {
billdevicedeatialNum++;
}
}
Object billotherdeatialObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(billotherdeatialQueryWrapper, BillotherdeatialEntity.class, billTablePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(billotherdeatialObj)) {
return new ArrayList<>();
} else {
billotherdeatialQueryWrapper = (QueryWrapper<BillotherdeatialEntity>) billotherdeatialObj;
if (billotherdeatialQueryWrapper.getExpression().getNormal().size() > 0) {
billotherdeatialNum++;
}
}
Object billspacedetailObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(billspacedetailQueryWrapper, BillspacedetailEntity.class, billTablePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(billspacedetailObj)) {
return new ArrayList<>();
} else {
billspacedetailQueryWrapper = (QueryWrapper<BillspacedetailEntity>) billspacedetailObj;
if (billspacedetailQueryWrapper.getExpression().getNormal().size() > 0) {
billspacedetailNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object billTableObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(billTableQueryWrapper, BillTableEntity.class, billTablePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(billTableObj)) {
return new ArrayList<>();
} else {
billTableQueryWrapper = (QueryWrapper<BillTableEntity>) billTableObj;
if (billTableQueryWrapper.getExpression().getNormal().size() > 0) {
billTableNum++;
}
}
Object billdevicedeatialObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(billdevicedeatialQueryWrapper, BilldevicedeatialEntity.class, billTablePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(billdevicedeatialObj)) {
return new ArrayList<>();
} else {
billdevicedeatialQueryWrapper = (QueryWrapper<BilldevicedeatialEntity>) billdevicedeatialObj;
if (billdevicedeatialQueryWrapper.getExpression().getNormal().size() > 0) {
billdevicedeatialNum++;
}
}
Object billotherdeatialObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(billotherdeatialQueryWrapper, BillotherdeatialEntity.class, billTablePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(billotherdeatialObj)) {
return new ArrayList<>();
} else {
billotherdeatialQueryWrapper = (QueryWrapper<BillotherdeatialEntity>) billotherdeatialObj;
if (billotherdeatialQueryWrapper.getExpression().getNormal().size() > 0) {
billotherdeatialNum++;
}
}
Object billspacedetailObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(billspacedetailQueryWrapper, BillspacedetailEntity.class, billTablePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(billspacedetailObj)) {
return new ArrayList<>();
} else {
billspacedetailQueryWrapper = (QueryWrapper<BillspacedetailEntity>) billspacedetailObj;
if (billspacedetailQueryWrapper.getExpression().getNormal().size() > 0) {
billspacedetailNum++;
}
}
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(billTablePagination.getCreationTime())) {
billTableNum++;
List CreationTimeList = JsonUtil.getJsonToList(billTablePagination.getCreationTime(), String.class);
Long fir = Long.valueOf(String.valueOf(CreationTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(CreationTimeList.get(1)));
billTableQueryWrapper.lambda().ge(BillTableEntity::getCreationTime, new Date(fir))
.le(BillTableEntity::getCreationTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if (ObjectUtil.isNotEmpty(billTablePagination.getMerchantName())) {
billTableNum++;
String value = billTablePagination.getMerchantName() instanceof List ?
JsonUtil.getObjectToString(billTablePagination.getMerchantName()) :
String.valueOf(billTablePagination.getMerchantName());
billTableQueryWrapper.lambda().like(BillTableEntity::getMerchantName, value);
}
if (ObjectUtil.isNotEmpty(billTablePagination.getContractName())) {
billTableNum++;
String value = billTablePagination.getContractName() instanceof List ?
JsonUtil.getObjectToString(billTablePagination.getContractName()) :
String.valueOf(billTablePagination.getContractName());
billTableQueryWrapper.lambda().like(BillTableEntity::getContractName, value);
}
if (ObjectUtil.isNotEmpty(billTablePagination.getBillStatus())) {
billTableNum++;
List<String> idList = new ArrayList<>();
try {
String[][] billStatus = JsonUtil.getJsonToBean(billTablePagination.getBillStatus(), String[][].class);
for (int i = 0; i < billStatus.length; i++) {
if (billStatus[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(billStatus[i])));
}
}
} catch (Exception e1) {
try {
List<String> billStatus = JsonUtil.getJsonToList(billTablePagination.getBillStatus(), String.class);
if (billStatus.size() > 0) {
idList.addAll(billStatus);
}
} catch (Exception e2) {
idList.add(String.valueOf(billTablePagination.getBillStatus()));
}
}
billTableQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(BillTableEntity::getBillStatus, tt).or();
});
});
}
}
if (billdevicedeatialNum > 0) {
List<String> billdevicedeatialIdList = billdevicedeatialService.list(billdevicedeatialQueryWrapper).stream().filter(t -> StringUtil.isNotEmpty(t.getBillNumber())).map(t -> t.getBillNumber()).collect(Collectors.toList());
long count = billdevicedeatialService.count();
if (count > 0) {
intersectionList.add(billdevicedeatialIdList);
}
AllIdList.addAll(billdevicedeatialIdList);
}
total += billdevicedeatialNum;
if (billotherdeatialNum > 0) {
List<String> billotherdeatialIdList = billotherdeatialService.list(billotherdeatialQueryWrapper).stream().filter(t -> StringUtil.isNotEmpty(t.getBillNumber())).map(t -> t.getBillNumber()).collect(Collectors.toList());
long count = billotherdeatialService.count();
if (count > 0) {
intersectionList.add(billotherdeatialIdList);
}
AllIdList.addAll(billotherdeatialIdList);
}
total += billotherdeatialNum;
if (billspacedetailNum > 0) {
List<String> billspacedetailIdList = billspacedetailService.list(billspacedetailQueryWrapper).stream().filter(t -> StringUtil.isNotEmpty(t.getBillNumber())).map(t -> t.getBillNumber()).collect(Collectors.toList());
long count = billspacedetailService.count();
if (count > 0) {
intersectionList.add(billspacedetailIdList);
}
AllIdList.addAll(billspacedetailIdList);
}
total += billspacedetailNum;
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
billTableQueryWrapper.lambda().in(BillTableEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
billTableQueryWrapper.lambda().and(t -> t.in(BillTableEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
billTableQueryWrapper.lambda().and(t -> t.in(BillTableEntity::getId, finalAllRuleIDlist));
}
//假删除标志
billTableQueryWrapper.lambda().isNull(BillTableEntity::getDeleteMark);
//排序
if (StringUtil.isEmpty(billTablePagination.getSidx())) {
billTableQueryWrapper.lambda().orderByDesc(BillTableEntity::getId);
} else {
try {
String sidx = billTablePagination.getSidx();
String[] strs = sidx.split("_name");
BillTableEntity billTableEntity = new BillTableEntity();
Field declaredField = billTableEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
billTableQueryWrapper = "asc".equals(billTablePagination.getSort().toLowerCase()) ? billTableQueryWrapper.orderByAsc(value) : billTableQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<BillTableEntity> page = new Page<>(billTablePagination.getCurrentPage(), billTablePagination.getPageSize());
IPage<BillTableEntity> userIPage = this.page(page, billTableQueryWrapper);
return billTablePagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<BillTableEntity> list = new ArrayList();
return billTablePagination.setData(list, list.size());
}
} else {
return this.list(billTableQueryWrapper);
}
}
@Override
public BillTableEntity getInfo(String id) {
QueryWrapper<BillTableEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BillTableEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(BillTableEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, BillTableEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(BillTableEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/**
* Billspacedetail
*/
@Override
public List<BillspacedetailEntity> getBillspacedetailList(String id, BillTablePagination billTablePagination) {
Map<String, Object> newtabMap = BillTableConstant.TABLEFIELDKEY.entrySet()
.stream().collect(Collectors.toMap(e -> e.getValue(), e -> e.getKey()));
String tableName = "billspacedetail";
tableName = newtabMap.get(tableName) == null ? tableName : newtabMap.get(tableName).toString();
QueryWrapper<BillspacedetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = billspacedetailService.getChild(billTablePagination, queryWrapper);
queryWrapper.lambda().eq(BillspacedetailEntity::getBillNumber, id);
generaterSwapUtil.wrapperHandle(BillTableConstant.getColumnData(), BillTableConstant.getAppColumnData(), queryWrapper, BillspacedetailEntity.class, "sub", tableName);
return billspacedetailService.list(queryWrapper);
}
/**
* Billspacedetail
*/
@Override
public List<BillspacedetailEntity> getBillspacedetailList(String id) {
QueryWrapper<BillspacedetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BillspacedetailEntity::getBillNumber, id);
return billspacedetailService.list(queryWrapper);
}
/**
* Billdevicedeatial
*/
@Override
public List<BilldevicedeatialEntity> getBilldevicedeatialList(String id, BillTablePagination billTablePagination) {
Map<String, Object> newtabMap = BillTableConstant.TABLEFIELDKEY.entrySet()
.stream().collect(Collectors.toMap(e -> e.getValue(), e -> e.getKey()));
String tableName = "billdevicedeatial";
tableName = newtabMap.get(tableName) == null ? tableName : newtabMap.get(tableName).toString();
QueryWrapper<BilldevicedeatialEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = billdevicedeatialService.getChild(billTablePagination, queryWrapper);
queryWrapper.lambda().eq(BilldevicedeatialEntity::getBillNumber, id);
generaterSwapUtil.wrapperHandle(BillTableConstant.getColumnData(), BillTableConstant.getAppColumnData(), queryWrapper, BilldevicedeatialEntity.class, "sub", tableName);
return billdevicedeatialService.list(queryWrapper);
}
/**
* Billdevicedeatial
*/
@Override
public List<BilldevicedeatialEntity> getBilldevicedeatialList(String id) {
QueryWrapper<BilldevicedeatialEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BilldevicedeatialEntity::getBillNumber, id);
return billdevicedeatialService.list(queryWrapper);
}
/**
* Billotherdeatial
*/
@Override
public List<BillotherdeatialEntity> getBillotherdeatialList(String id, BillTablePagination billTablePagination) {
Map<String, Object> newtabMap = BillTableConstant.TABLEFIELDKEY.entrySet()
.stream().collect(Collectors.toMap(e -> e.getValue(), e -> e.getKey()));
String tableName = "billotherdeatial";
tableName = newtabMap.get(tableName) == null ? tableName : newtabMap.get(tableName).toString();
QueryWrapper<BillotherdeatialEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = billotherdeatialService.getChild(billTablePagination, queryWrapper);
queryWrapper.lambda().eq(BillotherdeatialEntity::getBillNumber, id);
generaterSwapUtil.wrapperHandle(BillTableConstant.getColumnData(), BillTableConstant.getAppColumnData(), queryWrapper, BillotherdeatialEntity.class, "sub", tableName);
return billotherdeatialService.list(queryWrapper);
}
/**
* Billotherdeatial
*/
@Override
public List<BillotherdeatialEntity> getBillotherdeatialList(String id) {
QueryWrapper<BillotherdeatialEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BillotherdeatialEntity::getBillNumber, id);
return billotherdeatialService.list(queryWrapper);
}
/**
* i-0-1
*/
@Override
public String checkForm(BillTableForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp) {
id = form.getId();
}
//主表字段验证
// if (StringUtil.isEmpty(form.getMerchantId())) {
// return "商户名称不能为空";
// }
//子表字段验证
if (form.getBillspacedetailList() != null) {
}
if (form.getBilldevicedeatialList() != null) {
}
if (form.getBillotherdeatialList() != null) {
}
return countRecover;
}
/**
* ()
*
* @param id
* @param billTableForm
* @return
*/
@Override
@Transactional
public String saveOrUpdate(BillTableForm billTableForm, String id, boolean isSave) {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
billTableForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(BillTableConstant.getFormData(), billTableForm), BillTableForm.class);
BillTableEntity entity = JsonUtil.getJsonToBean(billTableForm, BillTableEntity.class);
ContractEntity contract = contractService.getInfo(billTableForm.getContractId());
//商户名称
String merchantName = enterpriseMerchantsService.findNameById(contract.getMerchantId());
String contractName = contractService.findNameById(billTableForm.getContractId());
entity.setMerchantId(contract.getMerchantId());
entity.setContractName(contractName);
entity.setMerchantName(merchantName);
entity.setContractNumber(contract.getContractNumber());
if (isSave) {
//同一个合同只能创建一条
LambdaQueryWrapper<BillTableEntity> wrapper = new LambdaQueryWrapper<>(BillTableEntity.class).eq(BillTableEntity::getContractId, billTableForm.getContractId());
if (ObjectUtil.isNotNull(this.getOne(wrapper))) {
return "已存在相同合同数据!";
}
//获取当前年月日
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
entity.setBillNumbe("ZD" + currentDate + RandomUtil.uuId().substring(0, 3));
String mainId = RandomUtil.uuId();
entity.setCreationTime(DateUtil.getNowDate());
entity.setCreateBy(userInfo.getUserId());
entity.setId(mainId);
entity.setVersion(0);
entity.setSubmitter(userInfo.getUserId());
entity.setSubmissionTime(DateUtil.getNowDate());
} else {
entity.setCreationTime(DateUtil.getNowDate());
}
boolean result = this.saveOrUpdate(entity);
//Billspacedetail子表数据新增修改
if (!isSave) {
QueryWrapper<BillspacedetailEntity> BillspacedetailqueryWrapper = new QueryWrapper<>();
BillspacedetailqueryWrapper.lambda().eq(BillspacedetailEntity::getBillNumber, entity.getBillNumbe());
billspacedetailService.remove(BillspacedetailqueryWrapper);
}
if (billTableForm.getBillspacedetailList() != null) {
List<BillspacedetailEntity> tableField140 = JsonUtil.getJsonToList(billTableForm.getBillspacedetailList(), BillspacedetailEntity.class);
//假如选择了相同的空间 后端直接去重
List<BillspacedetailEntity> list1 = tableField140.stream()
.filter(obj -> StringUtils.isNoneBlank(obj.getSpaceId()))
.collect(Collectors.toMap(BillspacedetailEntity::getSpaceId, obj -> obj, (o1, o2) -> o1)).values().stream().collect(Collectors.toList());
for (BillspacedetailEntity entitys : list1) {
entitys.setId(RandomUtil.uuId());
entitys.setBillNumber(entity.getBillNumbe());
entitys.setCreateBy(userInfo.getUserId());
entitys.setCreationTime(DateUtil.getNowDate());
if (isSave) {
} else {
}
billspacedetailService.saveOrUpdate(entitys);
}
}
//Billdevicedeatial子表数据新增修改
if (!isSave) {
QueryWrapper<BilldevicedeatialEntity> BilldevicedeatialqueryWrapper = new QueryWrapper<>();
BilldevicedeatialqueryWrapper.lambda().eq(BilldevicedeatialEntity::getBillNumber, entity.getBillNumbe());
billdevicedeatialService.remove(BilldevicedeatialqueryWrapper);
}
if (billTableForm.getBilldevicedeatialList() != null) {
List<BilldevicedeatialEntity> tableField158 = JsonUtil.getJsonToList(billTableForm.getBilldevicedeatialList(), BilldevicedeatialEntity.class);
//假如选择了相同的空间 后端直接去重
List<BilldevicedeatialEntity> list1 = tableField158.stream()
.filter(obj -> StringUtils.isNoneBlank(obj.getEquipmentNumber()))
.collect(Collectors.toMap(BilldevicedeatialEntity::getEquipmentNumber, obj -> obj, (o1, o2) -> o1)).values().stream().collect(Collectors.toList());
for (BilldevicedeatialEntity entitys : list1) {
entitys.setId(RandomUtil.uuId());
entitys.setBillNumber(entity.getBillNumbe());
entitys.setCreateBy(userInfo.getUserId());
entitys.setCreationTime(DateUtil.getNowDate());
if (isSave) {
} else {
}
billdevicedeatialService.saveOrUpdate(entitys);
}
}
//Billotherdeatial子表数据新增修改
if (!isSave) {
QueryWrapper<BillotherdeatialEntity> BillotherdeatialqueryWrapper = new QueryWrapper<>();
BillotherdeatialqueryWrapper.lambda().eq(BillotherdeatialEntity::getBillNumber, entity.getBillNumbe());
billotherdeatialService.remove(BillotherdeatialqueryWrapper);
}
if (billTableForm.getBillotherdeatialList() != null) {
List<BillotherdeatialEntity> tableField166 = JsonUtil.getJsonToList(billTableForm.getBillotherdeatialList(), BillotherdeatialEntity.class);
for (BillotherdeatialEntity entitys : tableField166) {
entitys.setId(RandomUtil.uuId());
entitys.setBillNumber(entity.getBillNumbe());
entitys.setCreateBy(userInfo.getUserId());
entitys.setCreationTime(DateUtil.getNowDate());
if (isSave) {
} else {
}
billotherdeatialService.saveOrUpdate(entitys);
}
}
if (result) {
return "success";
}
return "fail";
}
@Override
public String billConfirm(String id) {
log.info("账单确认id{}", id);
BillTableEntity entity = this.getById(id);
entity.setBillStatus("20");
entity.setUpdateBy(userProvider.get().getUserId());
entity.setUpdateTime(DateUtil.getNowDate());
entity.setConfirmPersonnel(userProvider.get().getUserId());
entity.setConfirmTime(DateUtil.getNowDate());
boolean result = this.updateById(entity);
if (result) {
return "确认成功";
}
return "确认失败";
}
@Override
public String entry(String id, BillTableForm billTableForm) {
log.info("结算录入,id:{},form:{}", id, billTableForm);
BillTableEntity entity = this.getById(id);
if (ObjectUtil.isNull(entity)) {
return "账单不存在";
}
entity.setBillAttachment(billTableForm.getBillAttachment().toString());
entity.setPayStatus(billTableForm.getPayStatus().toString());
entity.setUpdateBy(userProvider.get().getUserId());
entity.setUpdateTime(DateUtil.getNowDate());
if (entity.getBillAmount().compareTo(entity.getPayAmount()) == 0) {
entity.setBillStatus("50");
} else {
//每次相加的支付金额
BigDecimal payAmount = entity.getPayAmount().add(billTableForm.getPayAmount());
//判断支付金额是否大于账单金额
if (entity.getBillAmount().compareTo(payAmount) < 0) {
return "支付金额不能大于账单金额,账单金额:" + entity.getBillAmount() + "元"
+ ",还需支付金额为:" + entity.getBillAmount().subtract(entity.getPayAmount());
}
entity.setPayAmount(payAmount);
if (entity.getBillAmount().compareTo(entity.getPayAmount()) != 0) {
entity.setBillStatus("40");
} else {
entity.setBillStatus("50");
}
}
if (this.updateById(entity)) {
if (entity.getPayAmount().compareTo(entity.getBillAmount()) < 0) {
return "结算录入成功,剩余支付额度为" + entity.getBillAmount().subtract(entity.getPayAmount());
}
return "结算录入成功";
}
return "结算录入失败";
}
}

@ -0,0 +1,59 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.BilldevicedeatialMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.billtable.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
@Service
public class BilldevicedeatialServiceImpl extends ServiceImpl<BilldevicedeatialMapper, BilldevicedeatialEntity> implements BilldevicedeatialService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<BilldevicedeatialEntity> getChild(BillTablePagination pagination, QueryWrapper<BilldevicedeatialEntity> billdevicedeatialQueryWrapper){
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?BillTableConstant.getColumnData():BillTableConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
return billdevicedeatialQueryWrapper;
}
}

@ -0,0 +1,59 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.BillotherdeatialMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.billtable.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
@Service
public class BillotherdeatialServiceImpl extends ServiceImpl<BillotherdeatialMapper, BillotherdeatialEntity> implements BillotherdeatialService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<BillotherdeatialEntity> getChild(BillTablePagination pagination, QueryWrapper<BillotherdeatialEntity> billotherdeatialQueryWrapper){
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?BillTableConstant.getColumnData():BillTableConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
return billotherdeatialQueryWrapper;
}
}

@ -0,0 +1,59 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.BillspacedetailMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.billtable.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* BillTable
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
@Service
public class BillspacedetailServiceImpl extends ServiceImpl<BillspacedetailMapper, BillspacedetailEntity> implements BillspacedetailService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<BillspacedetailEntity> getChild(BillTablePagination pagination, QueryWrapper<BillspacedetailEntity> billspacedetailQueryWrapper){
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?BillTableConstant.getColumnData():BillTableConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
return billspacedetailQueryWrapper;
}
}

@ -1,5 +1,6 @@
package jnpf.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -11,16 +12,17 @@ import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.ContractEntity;
import jnpf.entity.EquipmentRentalRecordsEntity;
import jnpf.entity.ParkEntity;
import jnpf.entity.SpacecontractEntity;
import jnpf.mapper.ContractMapper;
import jnpf.model.QueryModel;
import jnpf.model.contract.*;
import jnpf.permission.entity.UserEntity;
import jnpf.service.ContractService;
import jnpf.service.EnterpriseMerchantsService;
import jnpf.service.SpacecontractService;
import jnpf.service.*;
import jnpf.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -32,6 +34,7 @@ import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -57,6 +60,13 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
@Resource
private EnterpriseMerchantsService enterpriseMerchantsService;
@Resource
private ParkService parkService;
@Resource
private EquipmentRentalRecordsService equipmentRentalRecordsService;
@Override
public List<ContractEntity> getList(ContractPagination contractPagination) {
return getTypeList(contractPagination, contractPagination.getDataType());
@ -393,13 +403,16 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
@Override
public void create(ContractEntity entity) {
entity.setCreateBy(userProvider.get().getUserId());
this.save(entity);
}
@Override
public boolean update(String id, ContractEntity entity) {
return this.updateById(entity);
boolean result = this.updateById(entity);
if (result) {
CompletableFuture.runAsync(() -> spacecontractService.delData(entity.getContractNumber()));
}
return result;
}
@Override
@ -421,7 +434,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
QueryWrapper<SpacecontractEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = spacecontractService.getChild(contractPagination, queryWrapper);
queryWrapper.lambda().eq(SpacecontractEntity::getContractNumber, id);
queryWrapper.lambda().isNull(SpacecontractEntity::getCeleteTags);
generaterSwapUtil.wrapperHandle(ContractConstant.getColumnData(), ContractConstant.getAppColumnData(), queryWrapper, SpacecontractEntity.class, "sub", tableName);
return spacecontractService.list(queryWrapper);
}
@ -476,6 +488,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
if (StringUtil.isEmpty(form.getContactsPhone())) {
return "联系电话不能为空";
}
if (StringUtil.isNotEmpty(form.getContactsPhone())) {
if (!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getContactsPhone())).matches()) {
return "请输入正确的联系方式";
}
}
//子表字段验证
if (form.getSpacecontractList() != null) {
for (SpacecontractModel t : form.getSpacecontractList()) {
@ -507,17 +524,23 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
contractForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(ContractConstant.getFormData(), contractForm), ContractForm.class);
ContractEntity entity = JsonUtil.getJsonToBean(contractForm, ContractEntity.class);
//园区名称
String parkName = parkService.findNameById(contractForm.getParkId().toString());
//商户名称
String merchantName = enterpriseMerchantsService.findNameById(contractForm.getMerchantId().toString());
if (isSave) {
//获取当前年月日
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
entity.setCreationTime(DateUtil.getNowDate());
entity.setContractNumber(currentDate + RandomUtil.uuId().substring(0, 6));
entity.setId(RandomUtil.uuId());
entity.setCreateBy(userProvider.get().getUserId());
entity.setVersion(0);
} else {
entity.setCreationTime(DateUtil.getNowDate());
}
entity.setParkName(parkName);
entity.setMerchantName(merchantName);
this.saveOrUpdate(entity);
//Spacecontract子表数据新增修改
@ -527,12 +550,26 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
spacecontractService.remove(SpacecontractqueryWrapper);
}
if (contractForm.getSpacecontractList() != null) {
List<ParkEntity> list = parkService.list();
Map<String, ParkEntity> map = list.stream().collect(Collectors.toMap(ParkEntity::getId, Function.identity()));
List<SpacecontractEntity> tableField130 = JsonUtil.getJsonToList(contractForm.getSpacecontractList(), SpacecontractEntity.class);
int i = 1;
for (SpacecontractEntity entitys : tableField130) {
//假如选择了相同的空间 后端直接去重
List<SpacecontractEntity> list1 = tableField130.stream()
.filter(obj -> StringUtils.isNoneBlank(obj.getSpaceId()))
.collect(Collectors.toMap(SpacecontractEntity::getSpaceId, obj -> obj, (o1, o2) -> o1)).values().stream().collect(Collectors.toList());
for (SpacecontractEntity entitys : list1) {
if (StringUtils.isBlank(entitys.getSpaceId())) {
continue;
}
entitys.setContractName(contractForm.getContractName());
entitys.setId(RandomUtil.uuId());
entitys.setContractNumber(entity.getContractNumber());
entitys.setContractLineNumber(String.valueOf(i));
entitys.setSpaceArea(map.get(entitys.getSpaceId()).getSpaceArea());
entitys.setSpaceName(map.get(entitys.getSpaceId()).getName());
entitys.setCreateBy(userProvider.get().getUserId());
entitys.setCreationTime(DateUtil.getNowDate());
if (isSave) {
} else {
}
@ -548,10 +585,17 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
LambdaQueryWrapper<ContractEntity> eq = new LambdaQueryWrapper<>(ContractEntity.class)
.eq(ContractEntity::getId, request.getId());
ContractEntity contract = this.getOne(eq);
if (ObjectUtil.isNull(contract)) {
return "合同不存在";
}
if ("10".equals(contract.getContractStatus()) || "21".equals(contract.getContractStatus())) {
//todo 查询空间判断 如果空间状态存在不是待租状态 就提示
//查询绑定了哪些空间
List<String> spaceIds = spacecontractService.findByNums(contract.getContractNumber());
if (CollectionUtils.isNotEmpty(spaceIds)) {
if (!parkService.queryStatus(spaceIds)) {
return "该合同空间状态存在不是待租状态,请确认!";
}
}
contract.setContractStatus(request.getContractStatus());
contract.setApproveDate(DateUtil.getNowDate());
contract.setApprovedBy(userProvider.get().getUserId());
@ -566,8 +610,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
contract.setApproveRemarks(remarks);
boolean result = this.updateById(contract);
if (result) {
//todo 需要处理空间逻辑
//异步处理空间信息
CompletableFuture.runAsync(() -> parkService.updateStatus(contract.getParkId(), "20"));
//异步处理商户信息
CompletableFuture.runAsync(() -> enterpriseMerchantsService.updateStatus(request.getContractStatus(), contract.getContractName(), contract.getParkId()));
}
@ -582,6 +626,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
LambdaQueryWrapper<ContractEntity> eq = new LambdaQueryWrapper<>(ContractEntity.class)
.eq(ContractEntity::getId, request.getId());
ContractEntity contract = this.getOne(eq);
if (ObjectUtil.isNull(contract)) {
return "合同不存在";
}
if (!"20".equals(contract.getContractStatus())) {
return "该合同没有确认,不允许结束!";
} else if ("30".equals(contract.getContractStatus())) {
@ -591,11 +638,69 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
contract.setRemarks(StringUtils.isNoneBlank(request.getApproveRemarks()) ? request.getApproveRemarks() : "同意");
boolean result = this.updateById(contract);
if (result) {
//todo 需要处理空间逻辑
//异步处理空间信息
CompletableFuture.runAsync(() -> parkService.updateStatus(contract.getParkId(), "10"));
//异步处理商户信息
CompletableFuture.runAsync(() -> enterpriseMerchantsService.updateStatus(request.getContractStatus(), contract.getContractName(), null));
}
return "合同结束成功";
}
@Override
public String findNameById(String id) {
ContractEntity contract = this.getById(id);
if (ObjectUtil.isNull(contract)) {
return "";
}
return contract.getContractName();
}
@Override
public String findCodeById(String id) {
ContractEntity contract = this.getById(id);
if (ObjectUtil.isNull(contract)) {
return "";
}
return contract.getContractNumber();
}
@Override
public List<ContractDTO> getSpacesById(ContractPagination contractPagination) {
ContractEntity contract = this.getById(contractPagination.getContractId());
if (ObjectUtil.isNull(contract)) {
return Collections.emptyList();
}
//查询绑定空间信息
List<SpacecontractEntity> byNum = spacecontractService.findByNum(contract.getContractNumber(), contractPagination.getKeyword());
if (ObjectUtil.isNull(byNum)) {
return Collections.emptyList();
}
return byNum.stream().map(obj -> {
ContractDTO contractDTO = BeanUtil.copyProperties(contract, ContractDTO.class);
contractDTO.setSpaceNumber(obj.getSpaceId());
contractDTO.setSpaceId(obj.getSpaceName());
return contractDTO;
}).collect(Collectors.toList());
}
@Override
public List<ContractDevicesDTO> getDevicesById(ContractPagination contractPagination) {
ContractEntity contract = this.getById(contractPagination.getContractId());
if (ObjectUtil.isNull(contract)) {
return Collections.emptyList();
}
//根据合同上的商户id 查询绑定的租赁设备
List<EquipmentRentalRecordsEntity> recordsEntities = equipmentRentalRecordsService.findByMerchantId(contract.getMerchantId(), contractPagination.getKeyword());
return recordsEntities.stream().map(obj -> {
ContractDevicesDTO devicesDTO = new ContractDevicesDTO();
devicesDTO.setId(contract.getId());
devicesDTO.setStartTime(obj.getStartTime());
devicesDTO.setEndTime(obj.getEndTime());
devicesDTO.setTotalRentalPrice(obj.getTotalLeasePrice());
devicesDTO.setLeaseNumber(obj.getLeaseNumber());
devicesDTO.setEquipmentNumber(obj.getEquipmentCoding());
devicesDTO.setEquipmentName(obj.getEquipmentName());
return devicesDTO;
}).collect(Collectors.toList());
}
}

@ -0,0 +1,408 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.DecorationApplicationFormMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.decorationapplicationform.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
import javax.annotation.Resource;
/**
* DecorationApplicationForm
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-18
*/
@Service
public class DecorationApplicationFormServiceImpl extends ServiceImpl<DecorationApplicationFormMapper, DecorationApplicationFormEntity> implements DecorationApplicationFormService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Resource
private EnterpriseMerchantsService enterpriseMerchantsService;
@Resource
private ContractService contractService;
@Resource
private ParkService parkService;
@Override
public List<DecorationApplicationFormEntity> getList(DecorationApplicationFormPagination decorationApplicationFormPagination) {
return getTypeList(decorationApplicationFormPagination, decorationApplicationFormPagination.getDataType());
}
/**
*
*/
@Override
public List<DecorationApplicationFormEntity> getTypeList(DecorationApplicationFormPagination decorationApplicationFormPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? DecorationApplicationFormConstant.getAppColumnData() : DecorationApplicationFormConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0;
int decorationApplicationFormNum = 0;
QueryWrapper<DecorationApplicationFormEntity> decorationApplicationFormQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp = "";
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = decorationApplicationFormPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<DecorationApplicationFormEntity> decorationApplicationFormSuperWrapper = new QueryWrapper<>();
decorationApplicationFormSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(decorationApplicationFormSuperWrapper, DecorationApplicationFormEntity.class, queryJson, "0"));
int decorationApplicationFormNum1 = decorationApplicationFormSuperWrapper.getExpression().getNormal().size();
if (decorationApplicationFormNum1 > 0) {
List<String> decorationApplicationFormList = this.list(decorationApplicationFormSuperWrapper).stream().map(DecorationApplicationFormEntity::getId).collect(Collectors.toList());
allSuperList.addAll(decorationApplicationFormList);
intersectionSuperList.add(decorationApplicationFormList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<DecorationApplicationFormEntity> decorationApplicationFormSuperWrapper = new QueryWrapper<>();
decorationApplicationFormSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(decorationApplicationFormSuperWrapper, DecorationApplicationFormEntity.class, ruleJson, "0"));
int decorationApplicationFormNum1 = decorationApplicationFormSuperWrapper.getExpression().getNormal().size();
if (decorationApplicationFormNum1 > 0) {
List<String> decorationApplicationFormList = this.list(decorationApplicationFormSuperWrapper).stream().map(DecorationApplicationFormEntity::getId).collect(Collectors.toList());
allRuleList.addAll(decorationApplicationFormList);
intersectionRuleList.add(decorationApplicationFormList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object decorationApplicationFormObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(decorationApplicationFormQueryWrapper, DecorationApplicationFormEntity.class, decorationApplicationFormPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(decorationApplicationFormObj)) {
return new ArrayList<>();
} else {
decorationApplicationFormQueryWrapper = (QueryWrapper<DecorationApplicationFormEntity>) decorationApplicationFormObj;
if (decorationApplicationFormQueryWrapper.getExpression().getNormal().size() > 0) {
decorationApplicationFormNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object decorationApplicationFormObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(decorationApplicationFormQueryWrapper, DecorationApplicationFormEntity.class, decorationApplicationFormPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(decorationApplicationFormObj)) {
return new ArrayList<>();
} else {
decorationApplicationFormQueryWrapper = (QueryWrapper<DecorationApplicationFormEntity>) decorationApplicationFormObj;
if (decorationApplicationFormQueryWrapper.getExpression().getNormal().size() > 0) {
decorationApplicationFormNum++;
}
}
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getCreationTime())) {
decorationApplicationFormNum++;
List CreationTimeList = JsonUtil.getJsonToList(decorationApplicationFormPagination.getCreationTime(), String.class);
Long fir = Long.valueOf(String.valueOf(CreationTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(CreationTimeList.get(1)));
decorationApplicationFormQueryWrapper.lambda().ge(DecorationApplicationFormEntity::getCreationTime, new Date(fir))
.le(DecorationApplicationFormEntity::getCreationTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getMerchantName())) {
decorationApplicationFormNum++;
String value = decorationApplicationFormPagination.getMerchantName() instanceof List ?
JsonUtil.getObjectToString(decorationApplicationFormPagination.getMerchantName()) :
String.valueOf(decorationApplicationFormPagination.getMerchantName());
decorationApplicationFormQueryWrapper.lambda().like(DecorationApplicationFormEntity::getMerchantName, value);
}
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getSpaceName())) {
decorationApplicationFormNum++;
String value = decorationApplicationFormPagination.getSpaceName() instanceof List ?
JsonUtil.getObjectToString(decorationApplicationFormPagination.getSpaceName()) :
String.valueOf(decorationApplicationFormPagination.getSpaceName());
decorationApplicationFormQueryWrapper.lambda().like(DecorationApplicationFormEntity::getSpaceName, value);
}
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getDecorationProgress())) {
decorationApplicationFormNum++;
List<String> idList = new ArrayList<>();
try {
String[][] decorationProgress = JsonUtil.getJsonToBean(decorationApplicationFormPagination.getDecorationProgress(), String[][].class);
for (int i = 0; i < decorationProgress.length; i++) {
if (decorationProgress[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(decorationProgress[i])));
}
}
} catch (Exception e1) {
try {
List<String> decorationProgress = JsonUtil.getJsonToList(decorationApplicationFormPagination.getDecorationProgress(), String.class);
if (decorationProgress.size() > 0) {
idList.addAll(decorationProgress);
}
} catch (Exception e2) {
idList.add(String.valueOf(decorationApplicationFormPagination.getDecorationProgress()));
}
}
decorationApplicationFormQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(DecorationApplicationFormEntity::getDecorationProgress, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
decorationApplicationFormQueryWrapper.lambda().in(DecorationApplicationFormEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
decorationApplicationFormQueryWrapper.lambda().and(t -> t.in(DecorationApplicationFormEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
decorationApplicationFormQueryWrapper.lambda().and(t -> t.in(DecorationApplicationFormEntity::getId, finalAllRuleIDlist));
}
//假删除标志
decorationApplicationFormQueryWrapper.lambda().isNull(DecorationApplicationFormEntity::getDeleteMark);
//排序
if (StringUtil.isEmpty(decorationApplicationFormPagination.getSidx())) {
decorationApplicationFormQueryWrapper.lambda().orderByDesc(DecorationApplicationFormEntity::getId);
} else {
try {
String sidx = decorationApplicationFormPagination.getSidx();
String[] strs = sidx.split("_name");
DecorationApplicationFormEntity decorationApplicationFormEntity = new DecorationApplicationFormEntity();
Field declaredField = decorationApplicationFormEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
decorationApplicationFormQueryWrapper = "asc".equals(decorationApplicationFormPagination.getSort().toLowerCase()) ? decorationApplicationFormQueryWrapper.orderByAsc(value) : decorationApplicationFormQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<DecorationApplicationFormEntity> page = new Page<>(decorationApplicationFormPagination.getCurrentPage(), decorationApplicationFormPagination.getPageSize());
IPage<DecorationApplicationFormEntity> userIPage = this.page(page, decorationApplicationFormQueryWrapper);
return decorationApplicationFormPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<DecorationApplicationFormEntity> list = new ArrayList();
return decorationApplicationFormPagination.setData(list, list.size());
}
} else {
return this.list(decorationApplicationFormQueryWrapper);
}
}
@Override
public DecorationApplicationFormEntity getInfo(String id) {
QueryWrapper<DecorationApplicationFormEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DecorationApplicationFormEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(DecorationApplicationFormEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, DecorationApplicationFormEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(DecorationApplicationFormEntity entity) {
if (entity != null) {
boolean result = this.removeById(entity.getId());
if (result) {
//异步处理空间信息
CompletableFuture.runAsync(() -> parkService.updateStatus(entity.getSpaceId(), "20"));
}
}
}
/**
* i-0-1
*/
@Override
public String checkForm(DecorationApplicationFormForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp) {
id = form.getId();
}
//主表字段验证
if (StringUtil.isEmpty(form.getContacts())) {
return "联系人不能为空";
}
if (StringUtil.isEmpty(form.getContactsPhone())) {
return "联系电话不能为空";
}
if (StringUtil.isNotEmpty(form.getContactsPhone())) {
if (!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getContactsPhone())).matches()) {
return "请输入正确的联系方式";
}
}
if (StringUtil.isEmpty(form.getDepositAmount())) {
return "押金金额不能为空";
}
if (StringUtil.isNotEmpty(form.getDepositAmount())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getDepositAmount())).matches()) {
return "请输入正确的金额";
}
}
return countRecover;
}
/**
* ()
*
* @param id
* @param decorationApplicationFormForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(DecorationApplicationFormForm decorationApplicationFormForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
decorationApplicationFormForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(DecorationApplicationFormConstant.getFormData(), decorationApplicationFormForm), DecorationApplicationFormForm.class);
DecorationApplicationFormEntity entity = JsonUtil.getJsonToBean(decorationApplicationFormForm, DecorationApplicationFormEntity.class);
//园区名称
String spaceName = parkService.findNameById(decorationApplicationFormForm.getSpaceId());
//商户名称
String merchantName = enterpriseMerchantsService.findNameById(decorationApplicationFormForm.getMerchantId());
//合同名称
String contractName = contractService.findNameById(decorationApplicationFormForm.getContractId());
if (isSave) {
//获取当前年月日
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
String mainId = RandomUtil.uuId();
entity.setCreateBy(userProvider.get().getUserId());
entity.setCreationTime(DateUtil.getNowDate());
entity.setApplicationNumber("ZX" + currentDate + RandomUtil.uuId().substring(0, 4));
entity.setId(mainId);
entity.setVersion(0);
} else {
entity.setCreationTime(DateUtil.getNowDate());
}
entity.setSpaceName(spaceName);
entity.setMerchantName(merchantName);
entity.setContractName(contractName);
boolean result = this.saveOrUpdate(entity);
if (result) {
String status;
if ("1".equals(decorationApplicationFormForm.getDecorationProgress())) {
status = "30";
} else if ("3".equals(decorationApplicationFormForm.getDecorationProgress())) {
status = "20";
} else {
status = "30";
}
//异步处理空间信息
CompletableFuture.runAsync(() -> parkService.updateStatus(entity.getSpaceId(), status));
}
}
}

@ -429,4 +429,13 @@ public class EnterpriseMerchantsServiceImpl extends ServiceImpl<EnterpriseMercha
entity.setParkId(parkId);
this.updateById(entity);
}
@Override
public String findNameById(String id) {
EnterpriseMerchantsEntity merchants = this.getById(id);
if (ObjectUtil.isNull(merchants)) {
return "";
}
return merchants.getCmpNm();
}
}

@ -0,0 +1,311 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.EquipmentInspectionRecordsMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.equipmentinspectionrecords.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* EquipmentInspectionRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
@Service
public class EquipmentInspectionRecordsServiceImpl extends ServiceImpl<EquipmentInspectionRecordsMapper, EquipmentInspectionRecordsEntity> implements EquipmentInspectionRecordsService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<EquipmentInspectionRecordsEntity> getList(EquipmentInspectionRecordsPagination equipmentInspectionRecordsPagination){
return getTypeList(equipmentInspectionRecordsPagination,equipmentInspectionRecordsPagination.getDataType());
}
/** 列表查询 */
@Override
public List<EquipmentInspectionRecordsEntity> getTypeList(EquipmentInspectionRecordsPagination equipmentInspectionRecordsPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? EquipmentInspectionRecordsConstant.getAppColumnData() : EquipmentInspectionRecordsConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int equipmentInspectionRecordsNum =0;
QueryWrapper<EquipmentInspectionRecordsEntity> equipmentInspectionRecordsQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(equipmentInspectionRecordsPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = equipmentInspectionRecordsPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<EquipmentInspectionRecordsEntity> equipmentInspectionRecordsSuperWrapper = new QueryWrapper<>();
equipmentInspectionRecordsSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentInspectionRecordsSuperWrapper,EquipmentInspectionRecordsEntity.class,queryJson,"0"));
int equipmentInspectionRecordsNum1 = equipmentInspectionRecordsSuperWrapper.getExpression().getNormal().size();
if (equipmentInspectionRecordsNum1>0){
List<String> equipmentInspectionRecordsList =this.list(equipmentInspectionRecordsSuperWrapper).stream().map(EquipmentInspectionRecordsEntity::getId).collect(Collectors.toList());
allSuperList.addAll(equipmentInspectionRecordsList);
intersectionSuperList.add(equipmentInspectionRecordsList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<EquipmentInspectionRecordsEntity> equipmentInspectionRecordsSuperWrapper = new QueryWrapper<>();
equipmentInspectionRecordsSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentInspectionRecordsSuperWrapper,EquipmentInspectionRecordsEntity.class,ruleJson,"0"));
int equipmentInspectionRecordsNum1 = equipmentInspectionRecordsSuperWrapper.getExpression().getNormal().size();
if (equipmentInspectionRecordsNum1>0){
List<String> equipmentInspectionRecordsList =this.list(equipmentInspectionRecordsSuperWrapper).stream().map(EquipmentInspectionRecordsEntity::getId).collect(Collectors.toList());
allRuleList.addAll(equipmentInspectionRecordsList);
intersectionRuleList.add(equipmentInspectionRecordsList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object equipmentInspectionRecordsObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentInspectionRecordsQueryWrapper,EquipmentInspectionRecordsEntity.class,equipmentInspectionRecordsPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(equipmentInspectionRecordsObj)){
return new ArrayList<>();
} else {
equipmentInspectionRecordsQueryWrapper = (QueryWrapper<EquipmentInspectionRecordsEntity>)equipmentInspectionRecordsObj;
if( equipmentInspectionRecordsQueryWrapper.getExpression().getNormal().size()>0){
equipmentInspectionRecordsNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object equipmentInspectionRecordsObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentInspectionRecordsQueryWrapper,EquipmentInspectionRecordsEntity.class,equipmentInspectionRecordsPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(equipmentInspectionRecordsObj)){
return new ArrayList<>();
} else {
equipmentInspectionRecordsQueryWrapper = (QueryWrapper<EquipmentInspectionRecordsEntity>)equipmentInspectionRecordsObj;
if( equipmentInspectionRecordsQueryWrapper.getExpression().getNormal().size()>0){
equipmentInspectionRecordsNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(equipmentInspectionRecordsPagination.getInspectionTicketNumber())){
equipmentInspectionRecordsNum++;
String value = equipmentInspectionRecordsPagination.getInspectionTicketNumber() instanceof List ?
JsonUtil.getObjectToString(equipmentInspectionRecordsPagination.getInspectionTicketNumber()) :
String.valueOf(equipmentInspectionRecordsPagination.getInspectionTicketNumber());
equipmentInspectionRecordsQueryWrapper.lambda().like(EquipmentInspectionRecordsEntity::getInspectionTicketNumber,value);
}
if(ObjectUtil.isNotEmpty(equipmentInspectionRecordsPagination.getSpaceName())){
equipmentInspectionRecordsNum++;
String value = equipmentInspectionRecordsPagination.getSpaceName() instanceof List ?
JsonUtil.getObjectToString(equipmentInspectionRecordsPagination.getSpaceName()) :
String.valueOf(equipmentInspectionRecordsPagination.getSpaceName());
equipmentInspectionRecordsQueryWrapper.lambda().like(EquipmentInspectionRecordsEntity::getSpaceName,value);
}
if(ObjectUtil.isNotEmpty(equipmentInspectionRecordsPagination.getEquipmentNumber())){
equipmentInspectionRecordsNum++;
String value = equipmentInspectionRecordsPagination.getEquipmentNumber() instanceof List ?
JsonUtil.getObjectToString(equipmentInspectionRecordsPagination.getEquipmentNumber()) :
String.valueOf(equipmentInspectionRecordsPagination.getEquipmentNumber());
equipmentInspectionRecordsQueryWrapper.lambda().like(EquipmentInspectionRecordsEntity::getEquipmentNumber,value);
}
if(ObjectUtil.isNotEmpty(equipmentInspectionRecordsPagination.getEquipmentName())){
equipmentInspectionRecordsNum++;
String value = equipmentInspectionRecordsPagination.getEquipmentName() instanceof List ?
JsonUtil.getObjectToString(equipmentInspectionRecordsPagination.getEquipmentName()) :
String.valueOf(equipmentInspectionRecordsPagination.getEquipmentName());
equipmentInspectionRecordsQueryWrapper.lambda().like(EquipmentInspectionRecordsEntity::getEquipmentName,value);
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
equipmentInspectionRecordsQueryWrapper.lambda().in(EquipmentInspectionRecordsEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
equipmentInspectionRecordsQueryWrapper.lambda().and(t->t.in(EquipmentInspectionRecordsEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
equipmentInspectionRecordsQueryWrapper.lambda().and(t->t.in(EquipmentInspectionRecordsEntity::getId, finalAllRuleIDlist));
}
//假删除标志
equipmentInspectionRecordsQueryWrapper.lambda().isNull(EquipmentInspectionRecordsEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(equipmentInspectionRecordsPagination.getSidx())){
equipmentInspectionRecordsQueryWrapper.lambda().orderByDesc(EquipmentInspectionRecordsEntity::getId);
}else{
try {
String sidx = equipmentInspectionRecordsPagination.getSidx();
String[] strs= sidx.split("_name");
EquipmentInspectionRecordsEntity equipmentInspectionRecordsEntity = new EquipmentInspectionRecordsEntity();
Field declaredField = equipmentInspectionRecordsEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
equipmentInspectionRecordsQueryWrapper="asc".equals(equipmentInspectionRecordsPagination.getSort().toLowerCase())?equipmentInspectionRecordsQueryWrapper.orderByAsc(value):equipmentInspectionRecordsQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<EquipmentInspectionRecordsEntity> page=new Page<>(equipmentInspectionRecordsPagination.getCurrentPage(), equipmentInspectionRecordsPagination.getPageSize());
IPage<EquipmentInspectionRecordsEntity> userIPage=this.page(page, equipmentInspectionRecordsQueryWrapper);
return equipmentInspectionRecordsPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<EquipmentInspectionRecordsEntity> list = new ArrayList();
return equipmentInspectionRecordsPagination.setData(list, list.size());
}
}else{
return this.list(equipmentInspectionRecordsQueryWrapper);
}
}
@Override
public EquipmentInspectionRecordsEntity getInfo(String id){
QueryWrapper<EquipmentInspectionRecordsEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(EquipmentInspectionRecordsEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(EquipmentInspectionRecordsEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, EquipmentInspectionRecordsEntity entity){
return this.updateById(entity);
}
@Override
public void delete(EquipmentInspectionRecordsEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(EquipmentInspectionRecordsForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getSpaceName())){
return "空间名称不能为空";
}
if(StringUtil.isEmpty(form.getEquipmentNumber())){
return "设备编码不能为空";
}
if(StringUtil.isEmpty(form.getEquipmentName())){
return "设备名称不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param equipmentInspectionRecordsForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(EquipmentInspectionRecordsForm equipmentInspectionRecordsForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
equipmentInspectionRecordsForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(EquipmentInspectionRecordsConstant.getFormData(),equipmentInspectionRecordsForm),EquipmentInspectionRecordsForm.class);
EquipmentInspectionRecordsEntity entity = JsonUtil.getJsonToBean(equipmentInspectionRecordsForm, EquipmentInspectionRecordsEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setInspectionTicketNumber(generaterSwapUtil.getBillNumber("baoxiudanhao", false));
entity.setId(mainId);
entity.setVersion(0);
}else{
entity.setInspectionTicketNumber(generaterSwapUtil.getBillNumber("baoxiudanhao", false));
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,345 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.EquipmentMaintenanceRecordsMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.equipmentmaintenancerecords.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* EquipmentMaintenanceRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
@Service
public class EquipmentMaintenanceRecordsServiceImpl extends ServiceImpl<EquipmentMaintenanceRecordsMapper, EquipmentMaintenanceRecordsEntity> implements EquipmentMaintenanceRecordsService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private EquipmentRepairRecordsService equipmentRepairRecordsService;
@Autowired
private UserProvider userProvider;
@Override
public List<EquipmentMaintenanceRecordsEntity> getList(EquipmentMaintenanceRecordsPagination equipmentMaintenanceRecordsPagination){
return getTypeList(equipmentMaintenanceRecordsPagination,equipmentMaintenanceRecordsPagination.getDataType());
}
/** 列表查询 */
@Override
public List<EquipmentMaintenanceRecordsEntity> getTypeList(EquipmentMaintenanceRecordsPagination equipmentMaintenanceRecordsPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? EquipmentMaintenanceRecordsConstant.getAppColumnData() : EquipmentMaintenanceRecordsConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int equipmentMaintenanceRecordsNum =0;
QueryWrapper<EquipmentMaintenanceRecordsEntity> equipmentMaintenanceRecordsQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(equipmentMaintenanceRecordsPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = equipmentMaintenanceRecordsPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<EquipmentMaintenanceRecordsEntity> equipmentMaintenanceRecordsSuperWrapper = new QueryWrapper<>();
equipmentMaintenanceRecordsSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentMaintenanceRecordsSuperWrapper,EquipmentMaintenanceRecordsEntity.class,queryJson,"0"));
int equipmentMaintenanceRecordsNum1 = equipmentMaintenanceRecordsSuperWrapper.getExpression().getNormal().size();
if (equipmentMaintenanceRecordsNum1>0){
List<String> equipmentMaintenanceRecordsList =this.list(equipmentMaintenanceRecordsSuperWrapper).stream().map(EquipmentMaintenanceRecordsEntity::getId).collect(Collectors.toList());
allSuperList.addAll(equipmentMaintenanceRecordsList);
intersectionSuperList.add(equipmentMaintenanceRecordsList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<EquipmentMaintenanceRecordsEntity> equipmentMaintenanceRecordsSuperWrapper = new QueryWrapper<>();
equipmentMaintenanceRecordsSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentMaintenanceRecordsSuperWrapper,EquipmentMaintenanceRecordsEntity.class,ruleJson,"0"));
int equipmentMaintenanceRecordsNum1 = equipmentMaintenanceRecordsSuperWrapper.getExpression().getNormal().size();
if (equipmentMaintenanceRecordsNum1>0){
List<String> equipmentMaintenanceRecordsList =this.list(equipmentMaintenanceRecordsSuperWrapper).stream().map(EquipmentMaintenanceRecordsEntity::getId).collect(Collectors.toList());
allRuleList.addAll(equipmentMaintenanceRecordsList);
intersectionRuleList.add(equipmentMaintenanceRecordsList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object equipmentMaintenanceRecordsObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentMaintenanceRecordsQueryWrapper,EquipmentMaintenanceRecordsEntity.class,equipmentMaintenanceRecordsPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(equipmentMaintenanceRecordsObj)){
return new ArrayList<>();
} else {
equipmentMaintenanceRecordsQueryWrapper = (QueryWrapper<EquipmentMaintenanceRecordsEntity>)equipmentMaintenanceRecordsObj;
if( equipmentMaintenanceRecordsQueryWrapper.getExpression().getNormal().size()>0){
equipmentMaintenanceRecordsNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object equipmentMaintenanceRecordsObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentMaintenanceRecordsQueryWrapper,EquipmentMaintenanceRecordsEntity.class,equipmentMaintenanceRecordsPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(equipmentMaintenanceRecordsObj)){
return new ArrayList<>();
} else {
equipmentMaintenanceRecordsQueryWrapper = (QueryWrapper<EquipmentMaintenanceRecordsEntity>)equipmentMaintenanceRecordsObj;
if( equipmentMaintenanceRecordsQueryWrapper.getExpression().getNormal().size()>0){
equipmentMaintenanceRecordsNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(equipmentMaintenanceRecordsPagination.getMaintenanceDate())){
equipmentMaintenanceRecordsNum++;
List MaintenanceDateList = JsonUtil.getJsonToList(equipmentMaintenanceRecordsPagination.getMaintenanceDate(),String.class);
Long fir = Long.valueOf(String.valueOf(MaintenanceDateList.get(0)));
Long sec = Long.valueOf(String.valueOf(MaintenanceDateList.get(1)));
equipmentMaintenanceRecordsQueryWrapper.lambda().ge(EquipmentMaintenanceRecordsEntity::getMaintenanceDate, new Date(fir))
.le(EquipmentMaintenanceRecordsEntity::getMaintenanceDate, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(equipmentMaintenanceRecordsPagination.getNumber())){
equipmentMaintenanceRecordsNum++;
String value = equipmentMaintenanceRecordsPagination.getNumber() instanceof List ?
JsonUtil.getObjectToString(equipmentMaintenanceRecordsPagination.getNumber()) :
String.valueOf(equipmentMaintenanceRecordsPagination.getNumber());
equipmentMaintenanceRecordsQueryWrapper.lambda().like(EquipmentMaintenanceRecordsEntity::getNumber,value);
}
if(ObjectUtil.isNotEmpty(equipmentMaintenanceRecordsPagination.getName())){
equipmentMaintenanceRecordsNum++;
String value = equipmentMaintenanceRecordsPagination.getName() instanceof List ?
JsonUtil.getObjectToString(equipmentMaintenanceRecordsPagination.getName()) :
String.valueOf(equipmentMaintenanceRecordsPagination.getName());
equipmentMaintenanceRecordsQueryWrapper.lambda().like(EquipmentMaintenanceRecordsEntity::getName,value);
}
if(ObjectUtil.isNotEmpty(equipmentMaintenanceRecordsPagination.getMaintenancePlan())){
equipmentMaintenanceRecordsNum++;
List<String> idList = new ArrayList<>();
try {
String[][] maintenancePlan = JsonUtil.getJsonToBean(equipmentMaintenanceRecordsPagination.getMaintenancePlan(),String[][].class);
for(int i=0;i<maintenancePlan.length;i++){
if(maintenancePlan[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(maintenancePlan[i])));
}
}
}catch (Exception e1){
try {
List<String> maintenancePlan = JsonUtil.getJsonToList(equipmentMaintenanceRecordsPagination.getMaintenancePlan(),String.class);
if(maintenancePlan.size()>0){
idList.addAll(maintenancePlan);
}
}catch (Exception e2){
idList.add(String.valueOf(equipmentMaintenanceRecordsPagination.getMaintenancePlan()));
}
}
equipmentMaintenanceRecordsQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(EquipmentMaintenanceRecordsEntity::getMaintenancePlan, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
equipmentMaintenanceRecordsQueryWrapper.lambda().in(EquipmentMaintenanceRecordsEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
equipmentMaintenanceRecordsQueryWrapper.lambda().and(t->t.in(EquipmentMaintenanceRecordsEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
equipmentMaintenanceRecordsQueryWrapper.lambda().and(t->t.in(EquipmentMaintenanceRecordsEntity::getId, finalAllRuleIDlist));
}
//假删除标志
equipmentMaintenanceRecordsQueryWrapper.lambda().isNull(EquipmentMaintenanceRecordsEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(equipmentMaintenanceRecordsPagination.getSidx())){
equipmentMaintenanceRecordsQueryWrapper.lambda().orderByDesc(EquipmentMaintenanceRecordsEntity::getId);
}else{
try {
String sidx = equipmentMaintenanceRecordsPagination.getSidx();
String[] strs= sidx.split("_name");
EquipmentMaintenanceRecordsEntity equipmentMaintenanceRecordsEntity = new EquipmentMaintenanceRecordsEntity();
Field declaredField = equipmentMaintenanceRecordsEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
equipmentMaintenanceRecordsQueryWrapper="asc".equals(equipmentMaintenanceRecordsPagination.getSort().toLowerCase())?equipmentMaintenanceRecordsQueryWrapper.orderByAsc(value):equipmentMaintenanceRecordsQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<EquipmentMaintenanceRecordsEntity> page=new Page<>(equipmentMaintenanceRecordsPagination.getCurrentPage(), equipmentMaintenanceRecordsPagination.getPageSize());
IPage<EquipmentMaintenanceRecordsEntity> userIPage=this.page(page, equipmentMaintenanceRecordsQueryWrapper);
return equipmentMaintenanceRecordsPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<EquipmentMaintenanceRecordsEntity> list = new ArrayList();
return equipmentMaintenanceRecordsPagination.setData(list, list.size());
}
}else{
return this.list(equipmentMaintenanceRecordsQueryWrapper);
}
}
@Override
public EquipmentMaintenanceRecordsEntity getInfo(String id){
QueryWrapper<EquipmentMaintenanceRecordsEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(EquipmentMaintenanceRecordsEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(EquipmentMaintenanceRecordsEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, EquipmentMaintenanceRecordsEntity entity){
return this.updateById(entity);
}
@Override
public void delete(EquipmentMaintenanceRecordsEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(EquipmentMaintenanceRecordsForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getNumber())){
return "设备编码不能为空";
}
if(StringUtil.isEmpty(form.getName())){
return "设备名称不能为空";
}
if(StringUtil.isEmpty(form.getMaintenancePersonnel())){
return "维修人不能为空";
}
if(StringUtil.isNotEmpty(form.getCostAmount())){
if(!Pattern.compile("^\\d+$").matcher(String.valueOf(form.getCostAmount())).matches()){
return "请输入正确的数字";
}
}
if(StringUtil.isEmpty(form.getEquipmentId())){
return "设备id不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param equipmentMaintenanceRecordsForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(EquipmentMaintenanceRecordsForm equipmentMaintenanceRecordsForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
equipmentMaintenanceRecordsForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(EquipmentMaintenanceRecordsConstant.getFormData(),equipmentMaintenanceRecordsForm),EquipmentMaintenanceRecordsForm.class);
EquipmentMaintenanceRecordsEntity entity = JsonUtil.getJsonToBean(equipmentMaintenanceRecordsForm, EquipmentMaintenanceRecordsEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setRepairOrderNumber(generaterSwapUtil.getBillNumber("baoxiudanhao", false));
entity.setId(mainId);
entity.setVersion(0);
}else{
entity.setRepairOrderNumber(generaterSwapUtil.getBillNumber("baoxiudanhao", false));
}
this.saveOrUpdate(entity);
EquipmentRepairRecordsEntity equipmentRepairRecordsEntity = equipmentRepairRecordsService.getById(entity.getRepairOrderId());
equipmentRepairRecordsEntity.setRepairOrderId(entity.getId());
equipmentRepairRecordsEntity.setRepairOrderNumber(entity.getRepairOrderNumber());
equipmentRepairRecordsService.updateById(equipmentRepairRecordsEntity);
}
}

@ -0,0 +1,412 @@
package jnpf.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.EquipmentEntity;
import jnpf.entity.EquipmentRentalRecordsEntity;
import jnpf.mapper.EquipmentRentalRecordsMapper;
import jnpf.model.QueryModel;
import jnpf.model.equipmentrentalrecords.EquipmentRentalRecordsConstant;
import jnpf.model.equipmentrentalrecords.EquipmentRentalRecordsForm;
import jnpf.model.equipmentrentalrecords.EquipmentRentalRecordsPagination;
import jnpf.permission.entity.UserEntity;
import jnpf.service.EnterpriseMerchantsService;
import jnpf.service.EquipmentRentalRecordsService;
import jnpf.service.EquipmentService;
import jnpf.util.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* EquipmentRentalRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-17
*/
@Service
public class EquipmentRentalRecordsServiceImpl extends ServiceImpl<EquipmentRentalRecordsMapper, EquipmentRentalRecordsEntity> implements EquipmentRentalRecordsService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Resource
private EquipmentService equipmentService;
@Resource
private EnterpriseMerchantsService enterpriseMerchantsService;
@Override
public List<EquipmentRentalRecordsEntity> getList(EquipmentRentalRecordsPagination equipmentRentalRecordsPagination) {
return getTypeList(equipmentRentalRecordsPagination, equipmentRentalRecordsPagination.getDataType());
}
/**
*
*/
@Override
public List<EquipmentRentalRecordsEntity> getTypeList(EquipmentRentalRecordsPagination equipmentRentalRecordsPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? EquipmentRentalRecordsConstant.getAppColumnData() : EquipmentRentalRecordsConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0;
int equipmentRentalRecordsNum = 0;
QueryWrapper<EquipmentRentalRecordsEntity> equipmentRentalRecordsQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp = "";
if (ObjectUtil.isNotEmpty(equipmentRentalRecordsPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = equipmentRentalRecordsPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<EquipmentRentalRecordsEntity> equipmentRentalRecordsSuperWrapper = new QueryWrapper<>();
equipmentRentalRecordsSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentRentalRecordsSuperWrapper, EquipmentRentalRecordsEntity.class, queryJson, "0"));
int equipmentRentalRecordsNum1 = equipmentRentalRecordsSuperWrapper.getExpression().getNormal().size();
if (equipmentRentalRecordsNum1 > 0) {
List<String> equipmentRentalRecordsList = this.list(equipmentRentalRecordsSuperWrapper).stream().map(EquipmentRentalRecordsEntity::getId).collect(Collectors.toList());
allSuperList.addAll(equipmentRentalRecordsList);
intersectionSuperList.add(equipmentRentalRecordsList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<EquipmentRentalRecordsEntity> equipmentRentalRecordsSuperWrapper = new QueryWrapper<>();
equipmentRentalRecordsSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentRentalRecordsSuperWrapper, EquipmentRentalRecordsEntity.class, ruleJson, "0"));
int equipmentRentalRecordsNum1 = equipmentRentalRecordsSuperWrapper.getExpression().getNormal().size();
if (equipmentRentalRecordsNum1 > 0) {
List<String> equipmentRentalRecordsList = this.list(equipmentRentalRecordsSuperWrapper).stream().map(EquipmentRentalRecordsEntity::getId).collect(Collectors.toList());
allRuleList.addAll(equipmentRentalRecordsList);
intersectionRuleList.add(equipmentRentalRecordsList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object equipmentRentalRecordsObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentRentalRecordsQueryWrapper, EquipmentRentalRecordsEntity.class, equipmentRentalRecordsPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(equipmentRentalRecordsObj)) {
return new ArrayList<>();
} else {
equipmentRentalRecordsQueryWrapper = (QueryWrapper<EquipmentRentalRecordsEntity>) equipmentRentalRecordsObj;
if (equipmentRentalRecordsQueryWrapper.getExpression().getNormal().size() > 0) {
equipmentRentalRecordsNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object equipmentRentalRecordsObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentRentalRecordsQueryWrapper, EquipmentRentalRecordsEntity.class, equipmentRentalRecordsPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(equipmentRentalRecordsObj)) {
return new ArrayList<>();
} else {
equipmentRentalRecordsQueryWrapper = (QueryWrapper<EquipmentRentalRecordsEntity>) equipmentRentalRecordsObj;
if (equipmentRentalRecordsQueryWrapper.getExpression().getNormal().size() > 0) {
equipmentRentalRecordsNum++;
}
}
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(equipmentRentalRecordsPagination.getCreationTime())) {
equipmentRentalRecordsNum++;
List CreationTimeList = JsonUtil.getJsonToList(equipmentRentalRecordsPagination.getCreationTime(), String.class);
Long fir = Long.valueOf(String.valueOf(CreationTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(CreationTimeList.get(1)));
equipmentRentalRecordsQueryWrapper.lambda().ge(EquipmentRentalRecordsEntity::getCreationTime, new Date(fir))
.le(EquipmentRentalRecordsEntity::getCreationTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if (ObjectUtil.isNotEmpty(equipmentRentalRecordsPagination.getMerchantName())) {
equipmentRentalRecordsNum++;
String value = equipmentRentalRecordsPagination.getMerchantName() instanceof List ?
JsonUtil.getObjectToString(equipmentRentalRecordsPagination.getMerchantName()) :
String.valueOf(equipmentRentalRecordsPagination.getMerchantName());
equipmentRentalRecordsQueryWrapper.lambda().like(EquipmentRentalRecordsEntity::getMerchantName, value);
}
if (ObjectUtil.isNotEmpty(equipmentRentalRecordsPagination.getEquipmentCoding())) {
equipmentRentalRecordsNum++;
String value = equipmentRentalRecordsPagination.getEquipmentCoding() instanceof List ?
JsonUtil.getObjectToString(equipmentRentalRecordsPagination.getEquipmentCoding()) :
String.valueOf(equipmentRentalRecordsPagination.getEquipmentCoding());
equipmentRentalRecordsQueryWrapper.lambda().like(EquipmentRentalRecordsEntity::getEquipmentCoding, value);
}
if (ObjectUtil.isNotEmpty(equipmentRentalRecordsPagination.getEquipmentName())) {
equipmentRentalRecordsNum++;
String value = equipmentRentalRecordsPagination.getEquipmentName() instanceof List ?
JsonUtil.getObjectToString(equipmentRentalRecordsPagination.getEquipmentName()) :
String.valueOf(equipmentRentalRecordsPagination.getEquipmentName());
equipmentRentalRecordsQueryWrapper.lambda().like(EquipmentRentalRecordsEntity::getEquipmentName, value);
}
if (ObjectUtil.isNotEmpty(equipmentRentalRecordsPagination.getLeaseStatus())) {
equipmentRentalRecordsNum++;
List<String> idList = new ArrayList<>();
try {
String[][] leaseStatus = JsonUtil.getJsonToBean(equipmentRentalRecordsPagination.getLeaseStatus(), String[][].class);
for (int i = 0; i < leaseStatus.length; i++) {
if (leaseStatus[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(leaseStatus[i])));
}
}
} catch (Exception e1) {
try {
List<String> leaseStatus = JsonUtil.getJsonToList(equipmentRentalRecordsPagination.getLeaseStatus(), String.class);
if (leaseStatus.size() > 0) {
idList.addAll(leaseStatus);
}
} catch (Exception e2) {
idList.add(String.valueOf(equipmentRentalRecordsPagination.getLeaseStatus()));
}
}
equipmentRentalRecordsQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(EquipmentRentalRecordsEntity::getLeaseStatus, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
equipmentRentalRecordsQueryWrapper.lambda().in(EquipmentRentalRecordsEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
equipmentRentalRecordsQueryWrapper.lambda().and(t -> t.in(EquipmentRentalRecordsEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
equipmentRentalRecordsQueryWrapper.lambda().and(t -> t.in(EquipmentRentalRecordsEntity::getId, finalAllRuleIDlist));
}
//假删除标志
equipmentRentalRecordsQueryWrapper.lambda().isNull(EquipmentRentalRecordsEntity::getDeleteMark);
//排序
if (StringUtil.isEmpty(equipmentRentalRecordsPagination.getSidx())) {
equipmentRentalRecordsQueryWrapper.lambda().orderByDesc(EquipmentRentalRecordsEntity::getId);
} else {
try {
String sidx = equipmentRentalRecordsPagination.getSidx();
String[] strs = sidx.split("_name");
EquipmentRentalRecordsEntity equipmentRentalRecordsEntity = new EquipmentRentalRecordsEntity();
Field declaredField = equipmentRentalRecordsEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
equipmentRentalRecordsQueryWrapper = "asc".equals(equipmentRentalRecordsPagination.getSort().toLowerCase()) ? equipmentRentalRecordsQueryWrapper.orderByAsc(value) : equipmentRentalRecordsQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<EquipmentRentalRecordsEntity> page = new Page<>(equipmentRentalRecordsPagination.getCurrentPage(), equipmentRentalRecordsPagination.getPageSize());
IPage<EquipmentRentalRecordsEntity> userIPage = this.page(page, equipmentRentalRecordsQueryWrapper);
return equipmentRentalRecordsPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<EquipmentRentalRecordsEntity> list = new ArrayList();
return equipmentRentalRecordsPagination.setData(list, list.size());
}
} else {
return this.list(equipmentRentalRecordsQueryWrapper);
}
}
@Override
public EquipmentRentalRecordsEntity getInfo(String id) {
QueryWrapper<EquipmentRentalRecordsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EquipmentRentalRecordsEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(EquipmentRentalRecordsEntity entity) {
this.save(entity);
}
@Override
public String update(String id, EquipmentRentalRecordsEntity entity) {
//判断设备是否是可用状态
EquipmentEntity equipment = equipmentService.getById(entity.getEquipmentId());
if (!"2".equals(equipment.getStatus())) {
return "该设备未归还,不可删除!";
}
//异步更改状态
CompletableFuture.runAsync(() -> equipmentService.updateStatus(entity.getEquipmentId(), "1"));
this.updateById(entity);
return "删除成功";
}
@Override
public void delete(EquipmentRentalRecordsEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/**
* i-0-1
*/
@Override
public String checkForm(EquipmentRentalRecordsForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp) {
id = form.getId();
}
//主表字段验证
if (StringUtil.isNotEmpty(form.getTotalLeasePrice())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getTotalLeasePrice())).matches()) {
return "请输入正确的金额";
}
}
if (StringUtil.isNotEmpty(form.getLeaseDeposit())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getLeaseDeposit())).matches()) {
return "请输入正确的金额";
}
}
if (StringUtil.isNotEmpty(form.getContactsPhone())) {
if (!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getContactsPhone())).matches()) {
return "请输入正确的联系方式";
}
}
return countRecover;
}
/**
* ()
*
* @param id
* @param equipmentRentalRecordsForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(EquipmentRentalRecordsForm equipmentRentalRecordsForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
equipmentRentalRecordsForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(EquipmentRentalRecordsConstant.getFormData(), equipmentRentalRecordsForm), EquipmentRentalRecordsForm.class);
EquipmentRentalRecordsEntity entity = JsonUtil.getJsonToBean(equipmentRentalRecordsForm, EquipmentRentalRecordsEntity.class);
EquipmentEntity equipment = equipmentService.getById(equipmentRentalRecordsForm.getEquipmentId());
if (ObjectUtil.isNotNull(equipment)) {
entity.setEquipmentCoding(equipment.getCode());
entity.setEquipmentName(equipment.getName());
}
String merchantName = enterpriseMerchantsService.findNameById(equipmentRentalRecordsForm.getMerchantId());
if (isSave) {
//查询设备
String mainId = RandomUtil.uuId();
entity.setCreationTime(DateUtil.getNowDate());
entity.setId(mainId);
entity.setLeaseNumber(RandomUtil.uuId());
entity.setCreateBy(userProvider.get().getUserId());
entity.setSubmitter(userProvider.get().getUserId());
entity.setSubmissionTime(DateUtil.getNowDate());
entity.setVersion(0);
} else {
entity.setCreationTime(DateUtil.getNowDate());
}
entity.setMerchantName(merchantName);
boolean result = this.saveOrUpdate(entity);
if (result) {
String status;
if ("1".equals(entity.getLeaseStatus())) {
status = "2";
} else {
status = "1";
}
//异步更新设备表状态
CompletableFuture.runAsync(() -> equipmentService.updateStatus(entity.getEquipmentId(), status));
}
}
@Override
public List<EquipmentRentalRecordsEntity> findByMerchantId(String merchantId, String keyword) {
QueryWrapper<EquipmentRentalRecordsEntity> entityQueryWrapper = new QueryWrapper<>();
entityQueryWrapper.lambda().eq(EquipmentRentalRecordsEntity::getMerchantId, merchantId);
if (StringUtils.isNoneBlank(keyword)) {
entityQueryWrapper.lambda().like(EquipmentRentalRecordsEntity::getEquipmentName, keyword);
}
List<EquipmentRentalRecordsEntity> list = this.list(entityQueryWrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list;
}
}

@ -0,0 +1,332 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.EquipmentRepairRecordsMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.equipmentrepairrecords.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* EquipmentRepairRecords
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-19
*/
@Service
public class EquipmentRepairRecordsServiceImpl extends ServiceImpl<EquipmentRepairRecordsMapper, EquipmentRepairRecordsEntity> implements EquipmentRepairRecordsService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<EquipmentRepairRecordsEntity> getList(EquipmentRepairRecordsPagination equipmentRepairRecordsPagination){
return getTypeList(equipmentRepairRecordsPagination,equipmentRepairRecordsPagination.getDataType());
}
/** 列表查询 */
@Override
public List<EquipmentRepairRecordsEntity> getTypeList(EquipmentRepairRecordsPagination equipmentRepairRecordsPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? EquipmentRepairRecordsConstant.getAppColumnData() : EquipmentRepairRecordsConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int equipmentRepairRecordsNum =0;
QueryWrapper<EquipmentRepairRecordsEntity> equipmentRepairRecordsQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(equipmentRepairRecordsPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = equipmentRepairRecordsPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<EquipmentRepairRecordsEntity> equipmentRepairRecordsSuperWrapper = new QueryWrapper<>();
equipmentRepairRecordsSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentRepairRecordsSuperWrapper,EquipmentRepairRecordsEntity.class,queryJson,"0"));
int equipmentRepairRecordsNum1 = equipmentRepairRecordsSuperWrapper.getExpression().getNormal().size();
if (equipmentRepairRecordsNum1>0){
List<String> equipmentRepairRecordsList =this.list(equipmentRepairRecordsSuperWrapper).stream().map(EquipmentRepairRecordsEntity::getId).collect(Collectors.toList());
allSuperList.addAll(equipmentRepairRecordsList);
intersectionSuperList.add(equipmentRepairRecordsList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<EquipmentRepairRecordsEntity> equipmentRepairRecordsSuperWrapper = new QueryWrapper<>();
equipmentRepairRecordsSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentRepairRecordsSuperWrapper,EquipmentRepairRecordsEntity.class,ruleJson,"0"));
int equipmentRepairRecordsNum1 = equipmentRepairRecordsSuperWrapper.getExpression().getNormal().size();
if (equipmentRepairRecordsNum1>0){
List<String> equipmentRepairRecordsList =this.list(equipmentRepairRecordsSuperWrapper).stream().map(EquipmentRepairRecordsEntity::getId).collect(Collectors.toList());
allRuleList.addAll(equipmentRepairRecordsList);
intersectionRuleList.add(equipmentRepairRecordsList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object equipmentRepairRecordsObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentRepairRecordsQueryWrapper,EquipmentRepairRecordsEntity.class,equipmentRepairRecordsPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(equipmentRepairRecordsObj)){
return new ArrayList<>();
} else {
equipmentRepairRecordsQueryWrapper = (QueryWrapper<EquipmentRepairRecordsEntity>)equipmentRepairRecordsObj;
if( equipmentRepairRecordsQueryWrapper.getExpression().getNormal().size()>0){
equipmentRepairRecordsNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object equipmentRepairRecordsObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentRepairRecordsQueryWrapper,EquipmentRepairRecordsEntity.class,equipmentRepairRecordsPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(equipmentRepairRecordsObj)){
return new ArrayList<>();
} else {
equipmentRepairRecordsQueryWrapper = (QueryWrapper<EquipmentRepairRecordsEntity>)equipmentRepairRecordsObj;
if( equipmentRepairRecordsQueryWrapper.getExpression().getNormal().size()>0){
equipmentRepairRecordsNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(equipmentRepairRecordsPagination.getEquipmentNumber())){
equipmentRepairRecordsNum++;
String value = equipmentRepairRecordsPagination.getEquipmentNumber() instanceof List ?
JsonUtil.getObjectToString(equipmentRepairRecordsPagination.getEquipmentNumber()) :
String.valueOf(equipmentRepairRecordsPagination.getEquipmentNumber());
equipmentRepairRecordsQueryWrapper.lambda().like(EquipmentRepairRecordsEntity::getEquipmentNumber,value);
}
if(ObjectUtil.isNotEmpty(equipmentRepairRecordsPagination.getEquipmentName())){
equipmentRepairRecordsNum++;
String value = equipmentRepairRecordsPagination.getEquipmentName() instanceof List ?
JsonUtil.getObjectToString(equipmentRepairRecordsPagination.getEquipmentName()) :
String.valueOf(equipmentRepairRecordsPagination.getEquipmentName());
equipmentRepairRecordsQueryWrapper.lambda().like(EquipmentRepairRecordsEntity::getEquipmentName,value);
}
if(ObjectUtil.isNotEmpty(equipmentRepairRecordsPagination.getRepairName())){
equipmentRepairRecordsNum++;
String value = equipmentRepairRecordsPagination.getRepairName() instanceof List ?
JsonUtil.getObjectToString(equipmentRepairRecordsPagination.getRepairName()) :
String.valueOf(equipmentRepairRecordsPagination.getRepairName());
equipmentRepairRecordsQueryWrapper.lambda().like(EquipmentRepairRecordsEntity::getRepairName,value);
}
if(ObjectUtil.isNotEmpty(equipmentRepairRecordsPagination.getUrgent())){
equipmentRepairRecordsNum++;
List<String> idList = new ArrayList<>();
try {
String[][] urgent = JsonUtil.getJsonToBean(equipmentRepairRecordsPagination.getUrgent(),String[][].class);
for(int i=0;i<urgent.length;i++){
if(urgent[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(urgent[i])));
}
}
}catch (Exception e1){
try {
List<String> urgent = JsonUtil.getJsonToList(equipmentRepairRecordsPagination.getUrgent(),String.class);
if(urgent.size()>0){
idList.addAll(urgent);
}
}catch (Exception e2){
idList.add(String.valueOf(equipmentRepairRecordsPagination.getUrgent()));
}
}
equipmentRepairRecordsQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(EquipmentRepairRecordsEntity::getUrgent, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
equipmentRepairRecordsQueryWrapper.lambda().in(EquipmentRepairRecordsEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
equipmentRepairRecordsQueryWrapper.lambda().and(t->t.in(EquipmentRepairRecordsEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
equipmentRepairRecordsQueryWrapper.lambda().and(t->t.in(EquipmentRepairRecordsEntity::getId, finalAllRuleIDlist));
}
//假删除标志
equipmentRepairRecordsQueryWrapper.lambda().isNull(EquipmentRepairRecordsEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(equipmentRepairRecordsPagination.getSidx())){
equipmentRepairRecordsQueryWrapper.lambda().orderByDesc(EquipmentRepairRecordsEntity::getId);
}else{
try {
String sidx = equipmentRepairRecordsPagination.getSidx();
String[] strs= sidx.split("_name");
EquipmentRepairRecordsEntity equipmentRepairRecordsEntity = new EquipmentRepairRecordsEntity();
Field declaredField = equipmentRepairRecordsEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
equipmentRepairRecordsQueryWrapper="asc".equals(equipmentRepairRecordsPagination.getSort().toLowerCase())?equipmentRepairRecordsQueryWrapper.orderByAsc(value):equipmentRepairRecordsQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<EquipmentRepairRecordsEntity> page=new Page<>(equipmentRepairRecordsPagination.getCurrentPage(), equipmentRepairRecordsPagination.getPageSize());
IPage<EquipmentRepairRecordsEntity> userIPage=this.page(page, equipmentRepairRecordsQueryWrapper);
return equipmentRepairRecordsPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<EquipmentRepairRecordsEntity> list = new ArrayList();
return equipmentRepairRecordsPagination.setData(list, list.size());
}
}else{
return this.list(equipmentRepairRecordsQueryWrapper);
}
}
@Override
public EquipmentRepairRecordsEntity getInfo(String id){
QueryWrapper<EquipmentRepairRecordsEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(EquipmentRepairRecordsEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(EquipmentRepairRecordsEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, EquipmentRepairRecordsEntity entity){
return this.updateById(entity);
}
@Override
public void delete(EquipmentRepairRecordsEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(EquipmentRepairRecordsForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getRepairName())){
return "报修人不能为空";
}
if(StringUtil.isEmpty(form.getContractInformation())){
return "联系方式不能为空";
}
if(StringUtil.isNotEmpty(form.getContractInformation())){
if(!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getContractInformation())).matches()){
return "请输入正确的联系方式";
}
}
return countRecover;
}
/**
* ()
* @param id
* @param equipmentRepairRecordsForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(EquipmentRepairRecordsForm equipmentRepairRecordsForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
equipmentRepairRecordsForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(EquipmentRepairRecordsConstant.getFormData(),equipmentRepairRecordsForm),EquipmentRepairRecordsForm.class);
EquipmentRepairRecordsEntity entity = JsonUtil.getJsonToBean(equipmentRepairRecordsForm, EquipmentRepairRecordsEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setRepairNumber(generaterSwapUtil.getBillNumber("baoxiudanhao", false));
entity.setId(mainId);
entity.setVersion(0);
}else{
entity.setRepairNumber(generaterSwapUtil.getBillNumber("baoxiudanhao", false));
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,386 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.EquipmentMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.equipment.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
* Equipment
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-15
*/
@Service
@Slf4j
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, EquipmentEntity> implements EquipmentService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<EquipmentEntity> getList(EquipmentPagination equipmentPagination) {
return getTypeList(equipmentPagination, equipmentPagination.getDataType());
}
/**
*
*/
@Override
public List<EquipmentEntity> getTypeList(EquipmentPagination equipmentPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? EquipmentConstant.getAppColumnData() : EquipmentConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0;
int equipmentNum = 0;
QueryWrapper<EquipmentEntity> equipmentQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp = "";
if (ObjectUtil.isNotEmpty(equipmentPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = equipmentPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<EquipmentEntity> equipmentSuperWrapper = new QueryWrapper<>();
equipmentSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentSuperWrapper, EquipmentEntity.class, queryJson, "0"));
int equipmentNum1 = equipmentSuperWrapper.getExpression().getNormal().size();
if (equipmentNum1 > 0) {
List<String> equipmentList = this.list(equipmentSuperWrapper).stream().map(EquipmentEntity::getId).collect(Collectors.toList());
allSuperList.addAll(equipmentList);
intersectionSuperList.add(equipmentList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<EquipmentEntity> equipmentSuperWrapper = new QueryWrapper<>();
equipmentSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(equipmentSuperWrapper, EquipmentEntity.class, ruleJson, "0"));
int equipmentNum1 = equipmentSuperWrapper.getExpression().getNormal().size();
if (equipmentNum1 > 0) {
List<String> equipmentList = this.list(equipmentSuperWrapper).stream().map(EquipmentEntity::getId).collect(Collectors.toList());
allRuleList.addAll(equipmentList);
intersectionRuleList.add(equipmentList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object equipmentObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentQueryWrapper, EquipmentEntity.class, equipmentPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(equipmentObj)) {
return new ArrayList<>();
} else {
equipmentQueryWrapper = (QueryWrapper<EquipmentEntity>) equipmentObj;
if (equipmentQueryWrapper.getExpression().getNormal().size() > 0) {
equipmentNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object equipmentObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(equipmentQueryWrapper, EquipmentEntity.class, equipmentPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(equipmentObj)) {
return new ArrayList<>();
} else {
equipmentQueryWrapper = (QueryWrapper<EquipmentEntity>) equipmentObj;
if (equipmentQueryWrapper.getExpression().getNormal().size() > 0) {
equipmentNum++;
}
}
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(equipmentPagination.getType())) {
equipmentNum++;
List<String> idList = new ArrayList<>();
try {
String[][] type = JsonUtil.getJsonToBean(equipmentPagination.getType(), String[][].class);
for (int i = 0; i < type.length; i++) {
if (type[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(type[i])));
}
}
} catch (Exception e1) {
try {
List<String> type = JsonUtil.getJsonToList(equipmentPagination.getType(), String.class);
if (type.size() > 0) {
idList.addAll(type);
}
} catch (Exception e2) {
idList.add(String.valueOf(equipmentPagination.getType()));
}
}
equipmentQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(EquipmentEntity::getType, tt).or();
});
});
}
if (ObjectUtil.isNotEmpty(equipmentPagination.getBrand())) {
equipmentNum++;
String value = equipmentPagination.getBrand() instanceof List ?
JsonUtil.getObjectToString(equipmentPagination.getBrand()) :
String.valueOf(equipmentPagination.getBrand());
equipmentQueryWrapper.lambda().like(EquipmentEntity::getBrand, value);
}
if (ObjectUtil.isNotEmpty(equipmentPagination.getName())) {
equipmentNum++;
String value = equipmentPagination.getName() instanceof List ?
JsonUtil.getObjectToString(equipmentPagination.getName()) :
String.valueOf(equipmentPagination.getName());
equipmentQueryWrapper.lambda().like(EquipmentEntity::getName, value);
}
if (ObjectUtil.isNotEmpty(equipmentPagination.getCode())) {
equipmentNum++;
String value = equipmentPagination.getCode() instanceof List ?
JsonUtil.getObjectToString(equipmentPagination.getCode()) :
String.valueOf(equipmentPagination.getCode());
equipmentQueryWrapper.lambda().like(EquipmentEntity::getCode, value);
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
equipmentQueryWrapper.lambda().in(EquipmentEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
equipmentQueryWrapper.lambda().and(t -> t.in(EquipmentEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
equipmentQueryWrapper.lambda().and(t -> t.in(EquipmentEntity::getId, finalAllRuleIDlist));
}
//假删除标志
equipmentQueryWrapper.lambda().isNull(EquipmentEntity::getDeleteMark);
//排序
if (StringUtil.isEmpty(equipmentPagination.getSidx())) {
equipmentQueryWrapper.lambda().orderByDesc(EquipmentEntity::getId);
} else {
try {
String sidx = equipmentPagination.getSidx();
String[] strs = sidx.split("_name");
EquipmentEntity equipmentEntity = new EquipmentEntity();
Field declaredField = equipmentEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
equipmentQueryWrapper = "asc".equals(equipmentPagination.getSort().toLowerCase()) ? equipmentQueryWrapper.orderByAsc(value) : equipmentQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<EquipmentEntity> page = new Page<>(equipmentPagination.getCurrentPage(), equipmentPagination.getPageSize());
IPage<EquipmentEntity> userIPage = this.page(page, equipmentQueryWrapper);
return equipmentPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<EquipmentEntity> list = new ArrayList();
return equipmentPagination.setData(list, list.size());
}
} else {
return this.list(equipmentQueryWrapper);
}
}
@Override
public EquipmentEntity getInfo(String id) {
QueryWrapper<EquipmentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EquipmentEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(EquipmentEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, EquipmentEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(EquipmentEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/**
* i-0-1
*/
@Override
public String checkForm(EquipmentForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp) {
id = form.getId();
}
//主表字段验证
if (StringUtil.isEmpty(form.getBrand())) {
return "设备品牌不能为空";
}
if (StringUtil.isEmpty(form.getModel())) {
return "设备型号不能为空";
}
if (StringUtil.isEmpty(form.getBatchNumber())) {
return "批次号不能为空";
}
if (StringUtil.isEmpty(form.getSupplier())) {
return "供应商不能为空";
}
if (StringUtil.isEmpty(form.getSupplierPhone())) {
return "供应商联系电话不能为空";
}
if (StringUtil.isNotEmpty(form.getSupplierPhone())) {
if (!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getSupplierPhone())).matches()) {
return "请输入正确的联系方式";
}
}
if (StringUtil.isEmpty(form.getDefectsLiabilityPeriod())) {
return "保修期不能为空";
}
if (StringUtil.isNotEmpty(form.getDefectsLiabilityPeriod())) {
if (!Pattern.compile("^\\d+$").matcher(String.valueOf(form.getDefectsLiabilityPeriod())).matches()) {
return "请输入正确的数字";
}
}
return countRecover;
}
/**
* ()
*
* @param id
* @param equipmentForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(EquipmentForm equipmentForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
equipmentForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(EquipmentConstant.getFormData(), equipmentForm), EquipmentForm.class);
EquipmentEntity entity = JsonUtil.getJsonToBean(equipmentForm, EquipmentEntity.class);
if (isSave) {
String mainId = RandomUtil.uuId();
entity.setId(mainId);
entity.setVersion(0);
} else {
}
this.saveOrUpdate(entity);
}
@Override
public void updateStatus(String equipmentId, String status) {
log.info("更新设备状态设备id{},更新状态:{}", equipmentId, status);
EquipmentEntity entity = this.getById(equipmentId);
if (ObjectUtil.isNull(equipmentId)) {
return;
}
entity.setStatus(status);
entity.setLastModifyUserId(userProvider.get().getUserId());
entity.setLastModifyTime(DateUtil.getNowDate());
this.updateById(entity);
}
}

@ -0,0 +1,388 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.ParkEquipmentMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.parkequipment.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* ParkEquipment
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-16
*/
@Service
public class ParkEquipmentServiceImpl extends ServiceImpl<ParkEquipmentMapper, ParkEquipmentEntity> implements ParkEquipmentService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<ParkEquipmentEntity> getList(ParkEquipmentPagination parkEquipmentPagination){
return getTypeList(parkEquipmentPagination,parkEquipmentPagination.getDataType());
}
/** 列表查询 */
@Override
public List<ParkEquipmentEntity> getTypeList(ParkEquipmentPagination parkEquipmentPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? ParkEquipmentConstant.getAppColumnData() : ParkEquipmentConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int parkEquipmentNum =0;
QueryWrapper<ParkEquipmentEntity> parkEquipmentQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(parkEquipmentPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = parkEquipmentPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<ParkEquipmentEntity> parkEquipmentSuperWrapper = new QueryWrapper<>();
parkEquipmentSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(parkEquipmentSuperWrapper,ParkEquipmentEntity.class,queryJson,"0"));
int parkEquipmentNum1 = parkEquipmentSuperWrapper.getExpression().getNormal().size();
if (parkEquipmentNum1>0){
List<String> parkEquipmentList =this.list(parkEquipmentSuperWrapper).stream().map(ParkEquipmentEntity::getId).collect(Collectors.toList());
allSuperList.addAll(parkEquipmentList);
intersectionSuperList.add(parkEquipmentList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<ParkEquipmentEntity> parkEquipmentSuperWrapper = new QueryWrapper<>();
parkEquipmentSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(parkEquipmentSuperWrapper,ParkEquipmentEntity.class,ruleJson,"0"));
int parkEquipmentNum1 = parkEquipmentSuperWrapper.getExpression().getNormal().size();
if (parkEquipmentNum1>0){
List<String> parkEquipmentList =this.list(parkEquipmentSuperWrapper).stream().map(ParkEquipmentEntity::getId).collect(Collectors.toList());
allRuleList.addAll(parkEquipmentList);
intersectionRuleList.add(parkEquipmentList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object parkEquipmentObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(parkEquipmentQueryWrapper,ParkEquipmentEntity.class,parkEquipmentPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(parkEquipmentObj)){
return new ArrayList<>();
} else {
parkEquipmentQueryWrapper = (QueryWrapper<ParkEquipmentEntity>)parkEquipmentObj;
if( parkEquipmentQueryWrapper.getExpression().getNormal().size()>0){
parkEquipmentNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object parkEquipmentObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(parkEquipmentQueryWrapper,ParkEquipmentEntity.class,parkEquipmentPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(parkEquipmentObj)){
return new ArrayList<>();
} else {
parkEquipmentQueryWrapper = (QueryWrapper<ParkEquipmentEntity>)parkEquipmentObj;
if( parkEquipmentQueryWrapper.getExpression().getNormal().size()>0){
parkEquipmentNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(parkEquipmentPagination.getEquipmentType())){
parkEquipmentNum++;
List<String> idList = new ArrayList<>();
try {
String[][] equipmentType = JsonUtil.getJsonToBean(parkEquipmentPagination.getEquipmentType(),String[][].class);
for(int i=0;i<equipmentType.length;i++){
if(equipmentType[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(equipmentType[i])));
}
}
}catch (Exception e1){
try {
List<String> equipmentType = JsonUtil.getJsonToList(parkEquipmentPagination.getEquipmentType(),String.class);
if(equipmentType.size()>0){
idList.addAll(equipmentType);
}
}catch (Exception e2){
idList.add(String.valueOf(parkEquipmentPagination.getEquipmentType()));
}
}
parkEquipmentQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(ParkEquipmentEntity::getEquipmentType, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(parkEquipmentPagination.getEquipmentBrand())){
parkEquipmentNum++;
String value = parkEquipmentPagination.getEquipmentBrand() instanceof List ?
JsonUtil.getObjectToString(parkEquipmentPagination.getEquipmentBrand()) :
String.valueOf(parkEquipmentPagination.getEquipmentBrand());
parkEquipmentQueryWrapper.lambda().like(ParkEquipmentEntity::getEquipmentBrand,value);
}
if(ObjectUtil.isNotEmpty(parkEquipmentPagination.getEquipmentCoding())){
parkEquipmentNum++;
String value = parkEquipmentPagination.getEquipmentCoding() instanceof List ?
JsonUtil.getObjectToString(parkEquipmentPagination.getEquipmentCoding()) :
String.valueOf(parkEquipmentPagination.getEquipmentCoding());
parkEquipmentQueryWrapper.lambda().like(ParkEquipmentEntity::getEquipmentCoding,value);
}
if(ObjectUtil.isNotEmpty(parkEquipmentPagination.getDeviceName())){
parkEquipmentNum++;
String value = parkEquipmentPagination.getDeviceName() instanceof List ?
JsonUtil.getObjectToString(parkEquipmentPagination.getDeviceName()) :
String.valueOf(parkEquipmentPagination.getDeviceName());
parkEquipmentQueryWrapper.lambda().like(ParkEquipmentEntity::getDeviceName,value);
}
if(ObjectUtil.isNotEmpty(parkEquipmentPagination.getState())){
parkEquipmentNum++;
List<String> idList = new ArrayList<>();
try {
String[][] state = JsonUtil.getJsonToBean(parkEquipmentPagination.getState(),String[][].class);
for(int i=0;i<state.length;i++){
if(state[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(state[i])));
}
}
}catch (Exception e1){
try {
List<String> state = JsonUtil.getJsonToList(parkEquipmentPagination.getState(),String.class);
if(state.size()>0){
idList.addAll(state);
}
}catch (Exception e2){
idList.add(String.valueOf(parkEquipmentPagination.getState()));
}
}
parkEquipmentQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(ParkEquipmentEntity::getState, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(parkEquipmentPagination.getRegionId())){
parkEquipmentNum++;
String value = parkEquipmentPagination.getRegionId() instanceof List ?
JsonUtil.getObjectToString(parkEquipmentPagination.getRegionId()) :
String.valueOf(parkEquipmentPagination.getRegionId());
parkEquipmentQueryWrapper.lambda().like(ParkEquipmentEntity::getRegionId,value);
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
parkEquipmentQueryWrapper.lambda().in(ParkEquipmentEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
parkEquipmentQueryWrapper.lambda().and(t->t.in(ParkEquipmentEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
parkEquipmentQueryWrapper.lambda().and(t->t.in(ParkEquipmentEntity::getId, finalAllRuleIDlist));
}
//假删除标志
parkEquipmentQueryWrapper.lambda().isNull(ParkEquipmentEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(parkEquipmentPagination.getSidx())){
parkEquipmentQueryWrapper.lambda().orderByDesc(ParkEquipmentEntity::getId);
}else{
try {
String sidx = parkEquipmentPagination.getSidx();
String[] strs= sidx.split("_name");
ParkEquipmentEntity parkEquipmentEntity = new ParkEquipmentEntity();
Field declaredField = parkEquipmentEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
parkEquipmentQueryWrapper="asc".equals(parkEquipmentPagination.getSort().toLowerCase())?parkEquipmentQueryWrapper.orderByAsc(value):parkEquipmentQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<ParkEquipmentEntity> page=new Page<>(parkEquipmentPagination.getCurrentPage(), parkEquipmentPagination.getPageSize());
IPage<ParkEquipmentEntity> userIPage=this.page(page, parkEquipmentQueryWrapper);
return parkEquipmentPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<ParkEquipmentEntity> list = new ArrayList();
return parkEquipmentPagination.setData(list, list.size());
}
}else{
return this.list(parkEquipmentQueryWrapper);
}
}
@Override
public ParkEquipmentEntity getInfo(String id){
QueryWrapper<ParkEquipmentEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(ParkEquipmentEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(ParkEquipmentEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, ParkEquipmentEntity entity){
return this.updateById(entity);
}
@Override
public void delete(ParkEquipmentEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(ParkEquipmentForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getEquipmentCoding())){
return "设备编码不能为空";
}
if(StringUtil.isEmpty(form.getDeviceName())){
return "设备名称不能为空";
}
if(StringUtil.isEmpty(form.getEquipmentBrand())){
return "设备品牌不能为空";
}
if(StringUtil.isNotEmpty(form.getSupplierPhone())){
if(!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getSupplierPhone())).matches()){
return "请输入正确的联系方式";
}
}
if(StringUtil.isNotEmpty(form.getEquipmentWarranty())){
if(!Pattern.compile("^\\d+$").matcher(String.valueOf(form.getEquipmentWarranty())).matches()){
return "请输入正确的数字";
}
}
if(StringUtil.isEmpty(form.getDeviceMacAddress())){
return "设备MAC地址不能为空";
}
if(StringUtil.isNotEmpty(form.getDeviceMacAddress())){
if(!Pattern.compile("^\\d+$").matcher(String.valueOf(form.getDeviceMacAddress())).matches()){
return "请输入正确的数字";
}
}
if(StringUtil.isEmpty(form.getRegionId())){
return "所属区域不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param parkEquipmentForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(ParkEquipmentForm parkEquipmentForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
parkEquipmentForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(ParkEquipmentConstant.getFormData(),parkEquipmentForm),ParkEquipmentForm.class);
ParkEquipmentEntity entity = JsonUtil.getJsonToBean(parkEquipmentForm, ParkEquipmentEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setId(mainId);
entity.setVersion(0);
}else{
}
this.saveOrUpdate(entity);
}
}

@ -1,18 +1,7 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.ParkMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.park.*;
import java.math.BigDecimal;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
@ -25,14 +14,38 @@ import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.ParkEntity;
import jnpf.mapper.ParkMapper;
import jnpf.model.QueryModel;
import jnpf.model.park.ParkConstant;
import jnpf.model.park.ParkDTO;
import jnpf.model.park.ParkForm;
import jnpf.model.park.ParkPagination;
import jnpf.permission.entity.UserEntity;
import jnpf.service.ParkService;
import jnpf.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
* park
* V3.5
* https://www.jnpfsoft.com
@ -40,7 +53,8 @@ import jnpf.permission.entity.UserEntity;
* 2024-07-17
*/
@Service
public class ParkServiceImpl extends ServiceImpl<ParkMapper, ParkEntity> implements ParkService{
@Slf4j
public class ParkServiceImpl extends ServiceImpl<ParkMapper, ParkEntity> implements ParkService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@ -48,110 +62,113 @@ public class ParkServiceImpl extends ServiceImpl<ParkMapper, ParkEntity> impleme
private UserProvider userProvider;
@Override
public List<ParkEntity> getList(ParkPagination parkPagination){
return getTypeList(parkPagination,parkPagination.getDataType());
public List<ParkEntity> getList(ParkPagination parkPagination) {
return getTypeList(parkPagination, parkPagination.getDataType());
}
/** 列表查询 */
/**
*
*/
@Override
public List<ParkEntity> getTypeList(ParkPagination parkPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
public List<ParkEntity> getTypeList(ParkPagination parkPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? ParkConstant.getAppColumnData() : ParkConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int parkNum =0;
QueryWrapper<ParkEntity> parkQueryWrapper=new QueryWrapper<>();
int total = 0;
int parkNum = 0;
QueryWrapper<ParkEntity> parkQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(parkPagination.getSuperQueryJson())){
String superOp = "";
if (ObjectUtil.isNotEmpty(parkPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = parkPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<ParkEntity> parkSuperWrapper = new QueryWrapper<>();
parkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(parkSuperWrapper,ParkEntity.class,queryJson,"0"));
parkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(parkSuperWrapper, ParkEntity.class, queryJson, "0"));
int parkNum1 = parkSuperWrapper.getExpression().getNormal().size();
if (parkNum1>0){
List<String> parkList =this.list(parkSuperWrapper).stream().map(ParkEntity::getId).collect(Collectors.toList());
if (parkNum1 > 0) {
List<String> parkList = this.list(parkSuperWrapper).stream().map(ParkEntity::getId).collect(Collectors.toList());
allSuperList.addAll(parkList);
intersectionSuperList.add(parkList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<ParkEntity> parkSuperWrapper = new QueryWrapper<>();
parkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(parkSuperWrapper,ParkEntity.class,ruleJson,"0"));
parkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(parkSuperWrapper, ParkEntity.class, ruleJson, "0"));
int parkNum1 = parkSuperWrapper.getExpression().getNormal().size();
if (parkNum1>0){
List<String> parkList =this.list(parkSuperWrapper).stream().map(ParkEntity::getId).collect(Collectors.toList());
if (parkNum1 > 0) {
List<String> parkList = this.list(parkSuperWrapper).stream().map(ParkEntity::getId).collect(Collectors.toList());
allRuleList.addAll(parkList);
intersectionRuleList.add(parkList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object parkObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(parkQueryWrapper,ParkEntity.class,parkPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(parkObj)){
return new ArrayList<>();
} else {
parkQueryWrapper = (QueryWrapper<ParkEntity>)parkObj;
if( parkQueryWrapper.getExpression().getNormal().size()>0){
parkNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object parkObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(parkQueryWrapper,ParkEntity.class,parkPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(parkObj)){
return new ArrayList<>();
} else {
parkQueryWrapper = (QueryWrapper<ParkEntity>)parkObj;
if( parkQueryWrapper.getExpression().getNormal().size()>0){
parkNum++;
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object parkObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(parkQueryWrapper, ParkEntity.class, parkPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(parkObj)) {
return new ArrayList<>();
} else {
parkQueryWrapper = (QueryWrapper<ParkEntity>) parkObj;
if (parkQueryWrapper.getExpression().getNormal().size() > 0) {
parkNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object parkObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(parkQueryWrapper, ParkEntity.class, parkPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(parkObj)) {
return new ArrayList<>();
} else {
parkQueryWrapper = (QueryWrapper<ParkEntity>) parkObj;
if (parkQueryWrapper.getExpression().getNormal().size() > 0) {
parkNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(parkPagination.getName())){
parkNum++;
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(parkPagination.getName())) {
parkNum++;
String value = parkPagination.getName() instanceof List ?
JsonUtil.getObjectToString(parkPagination.getName()) :
String.valueOf(parkPagination.getName());
parkQueryWrapper.lambda().like(ParkEntity::getName,value);
JsonUtil.getObjectToString(parkPagination.getName()) :
String.valueOf(parkPagination.getName());
parkQueryWrapper.lambda().like(ParkEntity::getName, value);
}
@ -161,134 +178,202 @@ public class ParkServiceImpl extends ServiceImpl<ParkMapper, ParkEntity> impleme
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
parkQueryWrapper.lambda().in(ParkEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
parkQueryWrapper.lambda().and(t->t.in(ParkEntity::getId, finalAllSuperIDlist));
parkQueryWrapper.lambda().and(t -> t.in(ParkEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
parkQueryWrapper.lambda().and(t->t.in(ParkEntity::getId, finalAllRuleIDlist));
parkQueryWrapper.lambda().and(t -> t.in(ParkEntity::getId, finalAllRuleIDlist));
}
//假删除标志
parkQueryWrapper.lambda().isNull(ParkEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(parkPagination.getSidx())){
if (StringUtil.isEmpty(parkPagination.getSidx())) {
parkQueryWrapper.lambda().orderByDesc(ParkEntity::getId);
}else{
} else {
try {
String sidx = parkPagination.getSidx();
String[] strs= sidx.split("_name");
String[] strs = sidx.split("_name");
ParkEntity parkEntity = new ParkEntity();
Field declaredField = parkEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
parkQueryWrapper="asc".equals(parkPagination.getSort().toLowerCase())?parkQueryWrapper.orderByAsc(value):parkQueryWrapper.orderByDesc(value);
parkQueryWrapper = "asc".equals(parkPagination.getSort().toLowerCase()) ? parkQueryWrapper.orderByAsc(value) : parkQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<ParkEntity> page=new Page<>(parkPagination.getCurrentPage(), parkPagination.getPageSize());
IPage<ParkEntity> userIPage=this.page(page, parkQueryWrapper);
return parkPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<ParkEntity> page = new Page<>(parkPagination.getCurrentPage(), parkPagination.getPageSize());
IPage<ParkEntity> userIPage = this.page(page, parkQueryWrapper);
return parkPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<ParkEntity> list = new ArrayList();
return parkPagination.setData(list, list.size());
}
}else{
} else {
return this.list(parkQueryWrapper);
}
}
@Override
public ParkEntity getInfo(String id){
QueryWrapper<ParkEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(ParkEntity::getId,id);
public ParkEntity getInfo(String id) {
QueryWrapper<ParkEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ParkEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(ParkEntity entity){
public void create(ParkEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, ParkEntity entity){
public boolean update(String id, ParkEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(ParkEntity entity){
if(entity!=null){
public void delete(ParkEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override
public String checkForm(ParkForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
public String checkForm(ParkForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp){
if (isUp) {
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getCode())){
return "园区编码不能为空";
}
if(StringUtil.isNotEmpty(form.getCode())){
form.setCode(form.getCode().trim());
QueryWrapper<ParkEntity> codeWrapper=new QueryWrapper<>();
codeWrapper.lambda().eq(ParkEntity::getCode,form.getCode());
//假删除标志
codeWrapper.lambda().isNull(ParkEntity::getDeleteMark);
if (isUp){
codeWrapper.lambda().ne(ParkEntity::getId, id);
}
if((int) this.count(codeWrapper)>0){
countRecover = "园区编码"+form.getCode()+"不能重复";
}
}
if(StringUtil.isEmpty(form.getName())){
return "园区名称不能为空";
}
if (StringUtil.isEmpty(form.getCode())) {
return "园区编码不能为空";
}
if (StringUtil.isNotEmpty(form.getCode())) {
form.setCode(form.getCode().trim());
QueryWrapper<ParkEntity> codeWrapper = new QueryWrapper<>();
codeWrapper.lambda().eq(ParkEntity::getCode, form.getCode());
//假删除标志
codeWrapper.lambda().isNull(ParkEntity::getDeleteMark);
if (isUp) {
codeWrapper.lambda().ne(ParkEntity::getId, id);
}
if ((int) this.count(codeWrapper) > 0) {
countRecover = "园区编码" + form.getCode() + "不能重复";
}
}
if (StringUtil.isEmpty(form.getName())) {
return "园区名称不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param parkForm
* @return
*/
* ()
*
* @param id
* @param parkForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(ParkForm parkForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
public void saveOrUpdate(ParkForm parkForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
parkForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(ParkConstant.getFormData(),parkForm),ParkForm.class);
generaterSwapUtil.swapDatetime(ParkConstant.getFormData(), parkForm), ParkForm.class);
ParkEntity entity = JsonUtil.getJsonToBean(parkForm, ParkEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
if (isSave) {
String mainId = RandomUtil.uuId();
entity.setId(mainId);
entity.setVersion(0);
}else{
} else {
}
this.saveOrUpdate(entity);
}
@Override
public String findNameById(String id) {
ParkEntity park = this.getById(id);
if (ObjectUtil.isNull(park)) {
return "";
}
return park.getName();
}
@Override
public boolean queryStatus(List<String> spaceIds) {
LambdaQueryWrapper<ParkEntity> wrapper = new LambdaQueryWrapper<>(ParkEntity.class)
.in(ParkEntity::getId, spaceIds)
.isNull(ParkEntity::getDeleteMark);
List<ParkEntity> list = this.list(wrapper);
return list.stream().allMatch(obj -> "10".equals(obj.getState()));
}
@Override
public void updateStatus(String parkId, String status) {
log.info("根据主键id修改状态id{},目标状态:{}", parkId, status);
ParkEntity entity = this.getById(parkId);
if (ObjectUtil.isNull(entity)) {
return;
}
entity.setLastModifyUserId(userProvider.get().getUserId());
entity.setLastModifyTime(DateUtil.getNowDate());
entity.setState(status);
this.updateById(entity);
}
@Override
public List<ParkDTO> tree() {
LambdaQueryWrapper<ParkEntity> wrapper = new LambdaQueryWrapper<>(ParkEntity.class)
.isNull(ParkEntity::getDeleteMark);
List<ParkEntity> list = this.list(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
String pid = "-1";
Map<String, List<ParkDTO>> map = list.stream()
.map(header -> BeanUtil.copyProperties(header, ParkDTO.class))
.collect(Collectors.groupingBy(ParkDTO::getPid));
List<ParkDTO> root = map.getOrDefault(pid, Collections.emptyList());
return buildTree(map, root);
}
private List<ParkDTO> buildTree(Map<String, List<ParkDTO>> map, List<ParkDTO> root) {
for (ParkDTO parkDTO : root) {
List<ParkDTO> list = map.get(parkDTO.getId());
if (CollectionUtils.isEmpty(list)) {
continue;
}
parkDTO.setChild(list);
buildTree(map, list);
}
return root;
}
}

@ -1,34 +1,28 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.SpacecontractMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.contract.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.SpacecontractEntity;
import jnpf.mapper.SpacecontractMapper;
import jnpf.model.contract.ContractConstant;
import jnpf.model.contract.ContractPagination;
import jnpf.service.SpacecontractService;
import jnpf.util.GeneraterSwapUtil;
import jnpf.util.JsonUtil;
import jnpf.util.ServletUtil;
import jnpf.util.UserProvider;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
*
* Contract
* V3.5
* https://www.jnpfsoft.com
@ -36,24 +30,57 @@ import jnpf.permission.entity.UserEntity;
* 2024-07-16
*/
@Service
public class SpacecontractServiceImpl extends ServiceImpl<SpacecontractMapper, SpacecontractEntity> implements SpacecontractService{
public class SpacecontractServiceImpl extends ServiceImpl<SpacecontractMapper, SpacecontractEntity> implements SpacecontractService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<String> findByNums(String contractNumber) {
LambdaQueryWrapper<SpacecontractEntity> wrapper = new LambdaQueryWrapper<>(SpacecontractEntity.class)
.eq(SpacecontractEntity::getContractNumber, contractNumber)
.isNull(SpacecontractEntity::getCeleteTags);
List<SpacecontractEntity> list = this.list(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(SpacecontractEntity::getId).collect(Collectors.toList());
}
//子表过滤方法
@Override
public QueryWrapper<SpacecontractEntity> getChild(ContractPagination pagination, QueryWrapper<SpacecontractEntity> spacecontractQueryWrapper){
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?ContractConstant.getColumnData():ContractConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
public QueryWrapper<SpacecontractEntity> getChild(ContractPagination pagination, QueryWrapper<SpacecontractEntity> spacecontractQueryWrapper) {
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc ? ContractConstant.getColumnData() : ContractConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson, ColumnDataModel.class);
String ruleJson = isPc ? JsonUtil.getObjectToString(dataModel.getRuleList()) : JsonUtil.getObjectToString(dataModel.getRuleListApp());
if (isPc) {
}
return spacecontractQueryWrapper;
}
@Override
public void delData(String contractNumber) {
QueryWrapper<SpacecontractEntity> SpacecontractqueryWrapper = new QueryWrapper<>();
SpacecontractqueryWrapper.lambda().eq(SpacecontractEntity::getContractNumber, contractNumber);
this.remove(SpacecontractqueryWrapper);
}
@Override
public List<SpacecontractEntity> findByNum(String contractNumber, String keyWord) {
QueryWrapper<SpacecontractEntity> SpacecontractqueryWrapper = new QueryWrapper<>();
SpacecontractqueryWrapper.lambda().eq(SpacecontractEntity::getContractNumber, contractNumber);
if (StringUtils.isNoneBlank(keyWord)) {
SpacecontractqueryWrapper.lambda().like(SpacecontractEntity::getSpaceName, keyWord);
}
List<SpacecontractEntity> list = this.list(SpacecontractqueryWrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list;
}
}

@ -0,0 +1,400 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.VenueReservationRecordMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.venuereservationrecord.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
import javax.annotation.Resource;
/**
* VenueReservationRecord
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-18
*/
@Service
public class VenueReservationRecordServiceImpl extends ServiceImpl<VenueReservationRecordMapper, VenueReservationRecordEntity> implements VenueReservationRecordService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Resource
private EnterpriseMerchantsService enterpriseMerchantsService;
@Resource
private ParkService parkService;
@Override
public List<VenueReservationRecordEntity> getList(VenueReservationRecordPagination venueReservationRecordPagination) {
return getTypeList(venueReservationRecordPagination, venueReservationRecordPagination.getDataType());
}
/**
*
*/
@Override
public List<VenueReservationRecordEntity> getTypeList(VenueReservationRecordPagination venueReservationRecordPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? VenueReservationRecordConstant.getAppColumnData() : VenueReservationRecordConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0;
int venueReservationRecordNum = 0;
QueryWrapper<VenueReservationRecordEntity> venueReservationRecordQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp = "";
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = venueReservationRecordPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<VenueReservationRecordEntity> venueReservationRecordSuperWrapper = new QueryWrapper<>();
venueReservationRecordSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(venueReservationRecordSuperWrapper, VenueReservationRecordEntity.class, queryJson, "0"));
int venueReservationRecordNum1 = venueReservationRecordSuperWrapper.getExpression().getNormal().size();
if (venueReservationRecordNum1 > 0) {
List<String> venueReservationRecordList = this.list(venueReservationRecordSuperWrapper).stream().map(VenueReservationRecordEntity::getId).collect(Collectors.toList());
allSuperList.addAll(venueReservationRecordList);
intersectionSuperList.add(venueReservationRecordList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<VenueReservationRecordEntity> venueReservationRecordSuperWrapper = new QueryWrapper<>();
venueReservationRecordSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(venueReservationRecordSuperWrapper, VenueReservationRecordEntity.class, ruleJson, "0"));
int venueReservationRecordNum1 = venueReservationRecordSuperWrapper.getExpression().getNormal().size();
if (venueReservationRecordNum1 > 0) {
List<String> venueReservationRecordList = this.list(venueReservationRecordSuperWrapper).stream().map(VenueReservationRecordEntity::getId).collect(Collectors.toList());
allRuleList.addAll(venueReservationRecordList);
intersectionRuleList.add(venueReservationRecordList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object venueReservationRecordObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(venueReservationRecordQueryWrapper, VenueReservationRecordEntity.class, venueReservationRecordPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(venueReservationRecordObj)) {
return new ArrayList<>();
} else {
venueReservationRecordQueryWrapper = (QueryWrapper<VenueReservationRecordEntity>) venueReservationRecordObj;
if (venueReservationRecordQueryWrapper.getExpression().getNormal().size() > 0) {
venueReservationRecordNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object venueReservationRecordObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(venueReservationRecordQueryWrapper, VenueReservationRecordEntity.class, venueReservationRecordPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(venueReservationRecordObj)) {
return new ArrayList<>();
} else {
venueReservationRecordQueryWrapper = (QueryWrapper<VenueReservationRecordEntity>) venueReservationRecordObj;
if (venueReservationRecordQueryWrapper.getExpression().getNormal().size() > 0) {
venueReservationRecordNum++;
}
}
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getCreationTime())) {
venueReservationRecordNum++;
List CreationTimeList = JsonUtil.getJsonToList(venueReservationRecordPagination.getCreationTime(), String.class);
Long fir = Long.valueOf(String.valueOf(CreationTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(CreationTimeList.get(1)));
venueReservationRecordQueryWrapper.lambda().ge(VenueReservationRecordEntity::getCreationTime, new Date(fir))
.le(VenueReservationRecordEntity::getCreationTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getMerchantName())) {
venueReservationRecordNum++;
String value = venueReservationRecordPagination.getMerchantName() instanceof List ?
JsonUtil.getObjectToString(venueReservationRecordPagination.getMerchantName()) :
String.valueOf(venueReservationRecordPagination.getMerchantName());
venueReservationRecordQueryWrapper.lambda().like(VenueReservationRecordEntity::getMerchantName, value);
}
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getSpaceName())) {
venueReservationRecordNum++;
String value = venueReservationRecordPagination.getSpaceName() instanceof List ?
JsonUtil.getObjectToString(venueReservationRecordPagination.getSpaceName()) :
String.valueOf(venueReservationRecordPagination.getSpaceName());
venueReservationRecordQueryWrapper.lambda().like(VenueReservationRecordEntity::getSpaceName, value);
}
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getUsageProgress())) {
venueReservationRecordNum++;
List<String> idList = new ArrayList<>();
try {
String[][] usageProgress = JsonUtil.getJsonToBean(venueReservationRecordPagination.getUsageProgress(), String[][].class);
for (int i = 0; i < usageProgress.length; i++) {
if (usageProgress[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(usageProgress[i])));
}
}
} catch (Exception e1) {
try {
List<String> usageProgress = JsonUtil.getJsonToList(venueReservationRecordPagination.getUsageProgress(), String.class);
if (usageProgress.size() > 0) {
idList.addAll(usageProgress);
}
} catch (Exception e2) {
idList.add(String.valueOf(venueReservationRecordPagination.getUsageProgress()));
}
}
venueReservationRecordQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(VenueReservationRecordEntity::getUsageProgress, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
venueReservationRecordQueryWrapper.lambda().in(VenueReservationRecordEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
venueReservationRecordQueryWrapper.lambda().and(t -> t.in(VenueReservationRecordEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
venueReservationRecordQueryWrapper.lambda().and(t -> t.in(VenueReservationRecordEntity::getId, finalAllRuleIDlist));
}
//假删除标志
venueReservationRecordQueryWrapper.lambda().isNull(VenueReservationRecordEntity::getDeleteMark);
//排序
if (StringUtil.isEmpty(venueReservationRecordPagination.getSidx())) {
venueReservationRecordQueryWrapper.lambda().orderByDesc(VenueReservationRecordEntity::getId);
} else {
try {
String sidx = venueReservationRecordPagination.getSidx();
String[] strs = sidx.split("_name");
VenueReservationRecordEntity venueReservationRecordEntity = new VenueReservationRecordEntity();
Field declaredField = venueReservationRecordEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
venueReservationRecordQueryWrapper = "asc".equals(venueReservationRecordPagination.getSort().toLowerCase()) ? venueReservationRecordQueryWrapper.orderByAsc(value) : venueReservationRecordQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<VenueReservationRecordEntity> page = new Page<>(venueReservationRecordPagination.getCurrentPage(), venueReservationRecordPagination.getPageSize());
IPage<VenueReservationRecordEntity> userIPage = this.page(page, venueReservationRecordQueryWrapper);
return venueReservationRecordPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<VenueReservationRecordEntity> list = new ArrayList();
return venueReservationRecordPagination.setData(list, list.size());
}
} else {
return this.list(venueReservationRecordQueryWrapper);
}
}
@Override
public VenueReservationRecordEntity getInfo(String id) {
QueryWrapper<VenueReservationRecordEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(VenueReservationRecordEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(VenueReservationRecordEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, VenueReservationRecordEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(VenueReservationRecordEntity entity) {
if (entity != null) {
boolean result = this.removeById(entity.getId());
if (result) {
//异步处理空间信息
CompletableFuture.runAsync(() -> parkService.updateStatus(entity.getSpaceId(), "10"));
}
}
}
/**
* i-0-1
*/
@Override
public String checkForm(VenueReservationRecordForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp) {
id = form.getId();
}
//主表字段验证
if (StringUtil.isEmpty(form.getContacts())) {
return "联系人不能为空";
}
if (StringUtil.isEmpty(form.getContactsPhone())) {
return "联系电话不能为空";
}
if (StringUtil.isNotEmpty(form.getContactsPhone())) {
if (!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getContactsPhone())).matches()) {
return "请输入正确的联系方式";
}
}
if (StringUtil.isEmpty(form.getReservationsNumber())) {
return "预约人数不能为空";
}
if (StringUtil.isNotEmpty(form.getReservationsNumber())) {
if (!Pattern.compile("^\\d+$").matcher(String.valueOf(form.getReservationsNumber())).matches()) {
return "请输入正确的数字";
}
}
return countRecover;
}
/**
* ()
*
* @param id
* @param venueReservationRecordForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(VenueReservationRecordForm venueReservationRecordForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
venueReservationRecordForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(VenueReservationRecordConstant.getFormData(), venueReservationRecordForm), VenueReservationRecordForm.class);
VenueReservationRecordEntity entity = JsonUtil.getJsonToBean(venueReservationRecordForm, VenueReservationRecordEntity.class);
//园区名称
String spaceName = parkService.findNameById(venueReservationRecordForm.getSpaceId());
//商户名称
String merchantName = enterpriseMerchantsService.findNameById(venueReservationRecordForm.getMerchantId());
if (isSave) {
//获取当前年月日
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
String mainId = RandomUtil.uuId();
entity.setCreateBy(userProvider.get().getUserId());
entity.setCreationTime(DateUtil.getNowDate());
entity.setApplicationNumber("YY" + currentDate + RandomUtil.uuId().substring(0, 4));
entity.setId(mainId);
entity.setVersion(0);
} else {
entity.setCreationTime(DateUtil.getNowDate());
}
entity.setSpaceName(spaceName);
entity.setMerchantName(merchantName);
boolean result = this.saveOrUpdate(entity);
if (result) {
String status;
if ("1".equals(venueReservationRecordForm.getUsageProgress())) {
status = "40";
} else {
status = "10";
}
//异步处理空间信息
CompletableFuture.runAsync(() -> parkService.updateStatus(entity.getSpaceId(), status));
}
}
}

@ -0,0 +1,244 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.billtable.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
/**
* BillTable
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-22
*/
@Slf4j
@RestController
@Tag(name = "BillTable", description = "example")
@RequestMapping("/api/example/BillTable")
public class BillTableController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private BillTableService billTableService;
@Autowired
private BillspacedetailService billspacedetailService;
@Autowired
private BilldevicedeatialService billdevicedeatialService;
@Autowired
private BillotherdeatialService billotherdeatialService;
/**
*
*
* @param billTablePagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody BillTablePagination billTablePagination) throws IOException {
List<BillTableEntity> list = billTableService.getList(billTablePagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (BillTableEntity entity : list) {
Map<String, Object> billTableMap = JsonUtil.entityToMap(entity);
billTableMap.put("id", billTableMap.get("id"));
//副表数据
//子表数据
List<BillspacedetailEntity> billspacedetailList = billTableService.getBillspacedetailList(entity.getBillNumbe(), billTablePagination);
billTableMap.put("tableField140", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billspacedetailList)));
List<BilldevicedeatialEntity> billdevicedeatialList = billTableService.getBilldevicedeatialList(entity.getBillNumbe(), billTablePagination);
billTableMap.put("tableField158", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billdevicedeatialList)));
List<BillotherdeatialEntity> billotherdeatialList = billTableService.getBillotherdeatialList(entity.getBillNumbe(), billTablePagination);
billTableMap.put("tableField166", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billotherdeatialList)));
realList.add(billTableMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, BillTableConstant.getFormData(), BillTableConstant.getColumnData(), billTablePagination.getModuleId(), false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(billTablePagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param billTableForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid BillTableForm billTableForm) {
String b = billTableService.checkForm(billTableForm, 0);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
String result = billTableService.saveOrUpdate(billTableForm, null, true);
if (result.contains("success")) {
return ActionResult.success("创建成功");
}
return ActionResult.fail(result);
}
/**
*
*
* @param id
* @param billTableForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid BillTableForm billTableForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
billTableForm.setId(id);
if (!isImport) {
String b = billTableService.checkForm(billTableForm, 1);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
BillTableEntity entity = billTableService.getInfo(id);
if (entity != null) {
try {
billTableService.saveOrUpdate(billTableForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id) {
BillTableEntity entity = billTableService.getInfo(id);
if (entity != null) {
//假删除
entity.setDeleteMark(1);
billTableService.update(id, entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id) {
BillTableEntity entity = billTableService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> billTableMap = JsonUtil.entityToMap(entity);
billTableMap.put("id", billTableMap.get("id"));
//副表数据
//子表数据
List<BillspacedetailEntity> billspacedetailList = billTableService.getBillspacedetailList(entity.getBillNumbe());
billTableMap.put("tableField140", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billspacedetailList)));
List<BilldevicedeatialEntity> billdevicedeatialList = billTableService.getBilldevicedeatialList(entity.getBillNumbe());
billTableMap.put("tableField158", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billdevicedeatialList)));
List<BillotherdeatialEntity> billotherdeatialList = billTableService.getBillotherdeatialList(entity.getBillNumbe());
billTableMap.put("tableField166", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billotherdeatialList)));
billTableMap = generaterSwapUtil.swapDataDetail(billTableMap, BillTableConstant.getFormData(), "585025890216314949", false);
return ActionResult.success(billTableMap);
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id) {
BillTableEntity entity = billTableService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> billTableMap = JsonUtil.entityToMap(entity);
billTableMap.put("id", billTableMap.get("id"));
//副表数据
//子表数据
List<BillspacedetailEntity> billspacedetailList = billTableService.getBillspacedetailList(entity.getBillNumbe());
billTableMap.put("billspacedetailList", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billspacedetailList)));
List<BilldevicedeatialEntity> billdevicedeatialList = billTableService.getBilldevicedeatialList(entity.getBillNumbe());
billTableMap.put("billdevicedeatialList", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billdevicedeatialList)));
List<BillotherdeatialEntity> billotherdeatialList = billTableService.getBillotherdeatialList(entity.getBillNumbe());
billTableMap.put("billotherdeatialList", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(billotherdeatialList)));
billTableMap = generaterSwapUtil.swapDataForm(billTableMap, BillTableConstant.getFormData(), BillTableConstant.TABLEFIELDKEY, BillTableConstant.TABLERENAMES);
return ActionResult.success(billTableMap);
}
@Operation(summary = "账单确认")
@GetMapping("/billConfirm/{id}")
public ActionResult billConfirm(@PathVariable("id") String id) {
return ActionResult.success(billTableService.billConfirm(id));
}
@PutMapping("/entry/{id}")
@Operation(summary = "结算录入")
public ActionResult entry(@PathVariable("id") String id, @RequestBody @Valid BillTableForm billTableForm) {
String result = billTableService.entry(id, billTableForm);
if (result.contains("成功")){
return ActionResult.success(result);
}
return ActionResult.fail(result);
}
}

@ -27,6 +27,7 @@ import jnpf.service.SpacecontractService;
import jnpf.util.*;
import lombok.Cleanup;
import lombok.extern.slf4j.Slf4j;
import oracle.jdbc.proxy.annotation.Post;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
@ -84,7 +85,7 @@ public class ContractController {
contractMap.put("id", contractMap.get("id"));
//副表数据
//子表数据
List<SpacecontractEntity> spacecontractList = contractService.getSpacecontractList(entity.getId(), contractPagination);
List<SpacecontractEntity> spacecontractList = contractService.getSpacecontractList(entity.getContractNumber(), contractPagination);
contractMap.put("tableField130", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(spacecontractList)));
realList.add(contractMap);
}
@ -138,7 +139,7 @@ public class ContractController {
contractMap.put("id", contractMap.get("id"));
//副表数据
//子表数据
List<SpacecontractEntity> spacecontractList = contractService.getSpacecontractList(entity.getId(), contractPagination);
List<SpacecontractEntity> spacecontractList = contractService.getSpacecontractList(entity.getContractNumber(), contractPagination);
contractMap.put("tableField130", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(spacecontractList)));
realList.add(contractMap);
}
@ -176,8 +177,8 @@ public class ContractController {
case "parkId":
entitys.add(new ExcelExportEntity("园区名称", "parkId"));
break;
case "merchantName":
entitys.add(new ExcelExportEntity("商户名称", "merchantName"));
case "merchantId":
entitys.add(new ExcelExportEntity("商户名称", "merchantId"));
break;
case "totalRentalPrice":
entitys.add(new ExcelExportEntity("租金总价", "totalRentalPrice"));
@ -221,8 +222,8 @@ public class ContractController {
case "tableField130-contractLineNumber":
tableField130List.add(new ExcelExportEntity("合同行号", "contractLineNumber"));
break;
case "tableField130-spaceName":
tableField130List.add(new ExcelExportEntity("空间名称", "spaceName"));
case "tableField130-spaceId":
tableField130List.add(new ExcelExportEntity("空间名称", "spaceId"));
break;
case "tableField130-spaceArea":
tableField130List.add(new ExcelExportEntity("空间面积", "spaceArea"));
@ -368,7 +369,7 @@ public class ContractController {
contractMap.put("id", contractMap.get("id"));
//副表数据
//子表数据
List<SpacecontractEntity> spacecontractList = contractService.getSpacecontractList(entity.getId());
List<SpacecontractEntity> spacecontractList = contractService.getSpacecontractList(entity.getContractNumber());
contractMap.put("tableField130", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(spacecontractList)));
contractMap = generaterSwapUtil.swapDataDetail(contractMap, ContractConstant.getFormData(), "582839350958489605", false);
return ActionResult.success(contractMap);
@ -392,7 +393,7 @@ public class ContractController {
contractMap.put("id", contractMap.get("id"));
//副表数据
//子表数据
List<SpacecontractEntity> spacecontractList = contractService.getSpacecontractList(entity.getId());
List<SpacecontractEntity> spacecontractList = contractService.getSpacecontractList(entity.getContractNumber());
contractMap.put("spacecontractList", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(spacecontractList)));
contractMap = generaterSwapUtil.swapDataForm(contractMap, ContractConstant.getFormData(), ContractConstant.TABLEFIELDKEY, ContractConstant.TABLERENAMES);
return ActionResult.success(contractMap);
@ -418,4 +419,24 @@ public class ContractController {
return ActionResult.success(result);
}
@Operation(summary = "根据合同id查询绑定空间信息")
@PostMapping("/getSpacesById")
public ActionResult getSpacesById(@RequestBody ContractPagination contractPagination) {
PageListVO vo = new PageListVO();
vo.setList(contractService.getSpacesById(contractPagination));
PaginationVO page = JsonUtil.getJsonToBean(contractPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
@Operation(summary = "根据合同id查询绑定商户的设备信息")
@PostMapping("/getDevicesById")
public ActionResult getDevicesById(@RequestBody ContractPagination contractPagination) {
PageListVO vo = new PageListVO();
vo.setList(contractService.getDevicesById(contractPagination));
PaginationVO page = JsonUtil.getJsonToBean(contractPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
}

@ -0,0 +1,364 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.decorationapplicationform.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import lombok.Cleanup;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* DecorationApplicationForm
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Slf4j
@RestController
@Tag(name = "DecorationApplicationForm" , description = "example")
@RequestMapping("/api/example/DecorationApplicationForm")
public class DecorationApplicationFormController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private DecorationApplicationFormService decorationApplicationFormService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param decorationApplicationFormPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody DecorationApplicationFormPagination decorationApplicationFormPagination)throws IOException{
List<DecorationApplicationFormEntity> list= decorationApplicationFormService.getList(decorationApplicationFormPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (DecorationApplicationFormEntity entity : list) {
Map<String, Object> decorationApplicationFormMap=JsonUtil.entityToMap(entity);
decorationApplicationFormMap.put("id", decorationApplicationFormMap.get("id"));
//副表数据
//子表数据
realList.add(decorationApplicationFormMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, DecorationApplicationFormConstant.getFormData(), DecorationApplicationFormConstant.getColumnData(), decorationApplicationFormPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(decorationApplicationFormPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param decorationApplicationFormForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid DecorationApplicationFormForm decorationApplicationFormForm) {
String b = decorationApplicationFormService.checkForm(decorationApplicationFormForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
decorationApplicationFormService.saveOrUpdate(decorationApplicationFormForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody DecorationApplicationFormPagination decorationApplicationFormPagination) throws IOException {
if (StringUtil.isEmpty(decorationApplicationFormPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<DecorationApplicationFormEntity> list= decorationApplicationFormService.getList(decorationApplicationFormPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (DecorationApplicationFormEntity entity : list) {
Map<String, Object> decorationApplicationFormMap=JsonUtil.entityToMap(entity);
decorationApplicationFormMap.put("id", decorationApplicationFormMap.get("id"));
//副表数据
//子表数据
realList.add(decorationApplicationFormMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, DecorationApplicationFormConstant.getFormData(), DecorationApplicationFormConstant.getColumnData(), decorationApplicationFormPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(decorationApplicationFormPagination.getSelectKey())?decorationApplicationFormPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "applicationNumber" :
entitys.add(new ExcelExportEntity("申请单号" ,"applicationNumber"));
break;
case "merchantId" :
entitys.add(new ExcelExportEntity("商户名称" ,"merchantId"));
break;
case "contractId" :
entitys.add(new ExcelExportEntity("合同名称" ,"contractId"));
break;
case "spaceId" :
entitys.add(new ExcelExportEntity("空间名称" ,"spaceId"));
break;
case "expectedStartTime" :
entitys.add(new ExcelExportEntity("预计开始时间" ,"expectedStartTime"));
break;
case "expectedEndTime" :
entitys.add(new ExcelExportEntity("预计结束时间" ,"expectedEndTime"));
break;
case "contacts" :
entitys.add(new ExcelExportEntity("联系人" ,"contacts"));
break;
case "contactsPhone" :
entitys.add(new ExcelExportEntity("联系电话" ,"contactsPhone"));
break;
case "depositAmount" :
entitys.add(new ExcelExportEntity("押金金额" ,"depositAmount"));
break;
case "isTheDepositRefunded" :
entitys.add(new ExcelExportEntity("押金是否退回" ,"isTheDepositRefunded"));
break;
case "depositRefundDate" :
entitys.add(new ExcelExportEntity("押金退回日期" ,"depositRefundDate"));
break;
case "decorationProgress" :
entitys.add(new ExcelExportEntity("装修进度" ,"decorationProgress"));
break;
case "fieldPhoto" :
entitys.add(new ExcelExportEntity("实地照片" ,"fieldPhoto"));
break;
case "creationTime" :
entitys.add(new ExcelExportEntity("创建时间" ,"creationTime"));
break;
case "merchantName" :
entitys.add(new ExcelExportEntity("商户名称" ,"merchantName"));
break;
case "spaceName" :
entitys.add(new ExcelExportEntity("空间名称" ,"spaceName"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
list.add(new HashMap<>());
}
//去除空数据
List<Map<String, Object>> dataList = new ArrayList<>();
for (Map<String, Object> map : list) {
int i = 0;
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
for (Map<String, Object> childMap : childList) {
if (childMap.get(field) != null) {
i++;
}
}
}
} else {
Object o = map.get(key);
if (o != null) {
i++;
}
}
}
if (i > 0) {
dataList.add(map);
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(DecorationApplicationFormConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
* @param id
* @param decorationApplicationFormForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid DecorationApplicationFormForm decorationApplicationFormForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
decorationApplicationFormForm.setId(id);
if (!isImport) {
String b = decorationApplicationFormService.checkForm(decorationApplicationFormForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
DecorationApplicationFormEntity entity= decorationApplicationFormService.getInfo(id);
if(entity!=null){
try{
decorationApplicationFormService.saveOrUpdate(decorationApplicationFormForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
DecorationApplicationFormEntity entity= decorationApplicationFormService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
decorationApplicationFormService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
DecorationApplicationFormEntity entity= decorationApplicationFormService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> decorationApplicationFormMap=JsonUtil.entityToMap(entity);
decorationApplicationFormMap.put("id", decorationApplicationFormMap.get("id"));
//副表数据
//子表数据
decorationApplicationFormMap = generaterSwapUtil.swapDataDetail(decorationApplicationFormMap,DecorationApplicationFormConstant.getFormData(),"583556228408410885",false);
return ActionResult.success(decorationApplicationFormMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
DecorationApplicationFormEntity entity= decorationApplicationFormService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> decorationApplicationFormMap=JsonUtil.entityToMap(entity);
decorationApplicationFormMap.put("id", decorationApplicationFormMap.get("id"));
//副表数据
//子表数据
decorationApplicationFormMap = generaterSwapUtil.swapDataForm(decorationApplicationFormMap,DecorationApplicationFormConstant.getFormData(),DecorationApplicationFormConstant.TABLEFIELDKEY,DecorationApplicationFormConstant.TABLERENAMES);
return ActionResult.success(decorationApplicationFormMap);
}
}

@ -0,0 +1,211 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.equipment.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
/**
* Equipment
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-15
*/
@Slf4j
@RestController
@Tag(name = "Equipment" , description = "example")
@RequestMapping("/api/example/Equipment")
public class EquipmentController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private EquipmentService equipmentService;
/**
*
*
* @param equipmentPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody EquipmentPagination equipmentPagination)throws IOException{
List<EquipmentEntity> list= equipmentService.getList(equipmentPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (EquipmentEntity entity : list) {
Map<String, Object> equipmentMap=JsonUtil.entityToMap(entity);
equipmentMap.put("id", equipmentMap.get("id"));
//副表数据
//子表数据
realList.add(equipmentMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, EquipmentConstant.getFormData(), EquipmentConstant.getColumnData(), equipmentPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(equipmentPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param equipmentForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid EquipmentForm equipmentForm) {
String b = equipmentService.checkForm(equipmentForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
equipmentService.saveOrUpdate(equipmentForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param equipmentForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid EquipmentForm equipmentForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
equipmentForm.setId(id);
if (!isImport) {
String b = equipmentService.checkForm(equipmentForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
EquipmentEntity entity= equipmentService.getInfo(id);
if(entity!=null){
try{
equipmentService.saveOrUpdate(equipmentForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "报废")
@GetMapping("/baofei/{id}")
@Transactional
public ActionResult baofei(@PathVariable("id") String id){
EquipmentEntity entity= equipmentService.getInfo(id);
if(entity!=null && "1".equals(entity.getStatus())){
entity.setStatus("3");
equipmentService.update(id,entity);
}else {
return ActionResult.fail("该数据状态非可用或者不存在,请刷新列表");
}
return ActionResult.success("报废成功");
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
EquipmentEntity entity= equipmentService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
equipmentService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
EquipmentEntity entity= equipmentService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentMap=JsonUtil.entityToMap(entity);
equipmentMap.put("id", equipmentMap.get("id"));
//副表数据
//子表数据
equipmentMap = generaterSwapUtil.swapDataDetail(equipmentMap,EquipmentConstant.getFormData(),"582551166336897669",false);
return ActionResult.success(equipmentMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
EquipmentEntity entity= equipmentService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentMap=JsonUtil.entityToMap(entity);
equipmentMap.put("id", equipmentMap.get("id"));
//副表数据
//子表数据
equipmentMap = generaterSwapUtil.swapDataForm(equipmentMap,EquipmentConstant.getFormData(),EquipmentConstant.TABLEFIELDKEY,EquipmentConstant.TABLERENAMES);
return ActionResult.success(equipmentMap);
}
}

@ -0,0 +1,191 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.equipmentinspectionrecords.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
/**
* EquipmentInspectionRecords
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Slf4j
@RestController
@Tag(name = "EquipmentInspectionRecords" , description = "example")
@RequestMapping("/api/example/EquipmentInspectionRecords")
public class EquipmentInspectionRecordsController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private EquipmentInspectionRecordsService equipmentInspectionRecordsService;
/**
*
*
* @param equipmentInspectionRecordsPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody EquipmentInspectionRecordsPagination equipmentInspectionRecordsPagination)throws IOException{
List<EquipmentInspectionRecordsEntity> list= equipmentInspectionRecordsService.getList(equipmentInspectionRecordsPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (EquipmentInspectionRecordsEntity entity : list) {
Map<String, Object> equipmentInspectionRecordsMap=JsonUtil.entityToMap(entity);
equipmentInspectionRecordsMap.put("id", equipmentInspectionRecordsMap.get("id"));
//副表数据
//子表数据
realList.add(equipmentInspectionRecordsMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, EquipmentInspectionRecordsConstant.getFormData(), EquipmentInspectionRecordsConstant.getColumnData(), equipmentInspectionRecordsPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(equipmentInspectionRecordsPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param equipmentInspectionRecordsForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid EquipmentInspectionRecordsForm equipmentInspectionRecordsForm) {
String b = equipmentInspectionRecordsService.checkForm(equipmentInspectionRecordsForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
equipmentInspectionRecordsService.saveOrUpdate(equipmentInspectionRecordsForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param equipmentInspectionRecordsForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid EquipmentInspectionRecordsForm equipmentInspectionRecordsForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
equipmentInspectionRecordsForm.setId(id);
if (!isImport) {
String b = equipmentInspectionRecordsService.checkForm(equipmentInspectionRecordsForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
EquipmentInspectionRecordsEntity entity= equipmentInspectionRecordsService.getInfo(id);
if(entity!=null){
try{
equipmentInspectionRecordsService.saveOrUpdate(equipmentInspectionRecordsForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
EquipmentInspectionRecordsEntity entity= equipmentInspectionRecordsService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
equipmentInspectionRecordsService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
EquipmentInspectionRecordsEntity entity= equipmentInspectionRecordsService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentInspectionRecordsMap=JsonUtil.entityToMap(entity);
equipmentInspectionRecordsMap.put("id", equipmentInspectionRecordsMap.get("id"));
//副表数据
//子表数据
equipmentInspectionRecordsMap = generaterSwapUtil.swapDataDetail(equipmentInspectionRecordsMap,EquipmentInspectionRecordsConstant.getFormData(),"583294095649145157",false);
return ActionResult.success(equipmentInspectionRecordsMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
EquipmentInspectionRecordsEntity entity= equipmentInspectionRecordsService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentInspectionRecordsMap=JsonUtil.entityToMap(entity);
equipmentInspectionRecordsMap.put("id", equipmentInspectionRecordsMap.get("id"));
//副表数据
//子表数据
equipmentInspectionRecordsMap = generaterSwapUtil.swapDataForm(equipmentInspectionRecordsMap,EquipmentInspectionRecordsConstant.getFormData(),EquipmentInspectionRecordsConstant.TABLEFIELDKEY,EquipmentInspectionRecordsConstant.TABLERENAMES);
return ActionResult.success(equipmentInspectionRecordsMap);
}
}

@ -0,0 +1,191 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.equipmentmaintenancerecords.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
/**
* EquipmentMaintenanceRecords
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Slf4j
@RestController
@Tag(name = "EquipmentMaintenanceRecords" , description = "example")
@RequestMapping("/api/example/EquipmentMaintenanceRecords")
public class EquipmentMaintenanceRecordsController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private EquipmentMaintenanceRecordsService equipmentMaintenanceRecordsService;
/**
*
*
* @param equipmentMaintenanceRecordsPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody EquipmentMaintenanceRecordsPagination equipmentMaintenanceRecordsPagination)throws IOException{
List<EquipmentMaintenanceRecordsEntity> list= equipmentMaintenanceRecordsService.getList(equipmentMaintenanceRecordsPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (EquipmentMaintenanceRecordsEntity entity : list) {
Map<String, Object> equipmentMaintenanceRecordsMap=JsonUtil.entityToMap(entity);
equipmentMaintenanceRecordsMap.put("id", equipmentMaintenanceRecordsMap.get("id"));
//副表数据
//子表数据
realList.add(equipmentMaintenanceRecordsMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, EquipmentMaintenanceRecordsConstant.getFormData(), EquipmentMaintenanceRecordsConstant.getColumnData(), equipmentMaintenanceRecordsPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(equipmentMaintenanceRecordsPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param equipmentMaintenanceRecordsForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid EquipmentMaintenanceRecordsForm equipmentMaintenanceRecordsForm) {
String b = equipmentMaintenanceRecordsService.checkForm(equipmentMaintenanceRecordsForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
equipmentMaintenanceRecordsService.saveOrUpdate(equipmentMaintenanceRecordsForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param equipmentMaintenanceRecordsForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid EquipmentMaintenanceRecordsForm equipmentMaintenanceRecordsForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
equipmentMaintenanceRecordsForm.setId(id);
if (!isImport) {
String b = equipmentMaintenanceRecordsService.checkForm(equipmentMaintenanceRecordsForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
EquipmentMaintenanceRecordsEntity entity= equipmentMaintenanceRecordsService.getInfo(id);
if(entity!=null){
try{
equipmentMaintenanceRecordsService.saveOrUpdate(equipmentMaintenanceRecordsForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
EquipmentMaintenanceRecordsEntity entity= equipmentMaintenanceRecordsService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
equipmentMaintenanceRecordsService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
EquipmentMaintenanceRecordsEntity entity= equipmentMaintenanceRecordsService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentMaintenanceRecordsMap=JsonUtil.entityToMap(entity);
equipmentMaintenanceRecordsMap.put("id", equipmentMaintenanceRecordsMap.get("id"));
//副表数据
//子表数据
equipmentMaintenanceRecordsMap = generaterSwapUtil.swapDataDetail(equipmentMaintenanceRecordsMap,EquipmentMaintenanceRecordsConstant.getFormData(),"583194294618161349",false);
return ActionResult.success(equipmentMaintenanceRecordsMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
EquipmentMaintenanceRecordsEntity entity= equipmentMaintenanceRecordsService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentMaintenanceRecordsMap=JsonUtil.entityToMap(entity);
equipmentMaintenanceRecordsMap.put("id", equipmentMaintenanceRecordsMap.get("id"));
//副表数据
//子表数据
equipmentMaintenanceRecordsMap = generaterSwapUtil.swapDataForm(equipmentMaintenanceRecordsMap,EquipmentMaintenanceRecordsConstant.getFormData(),EquipmentMaintenanceRecordsConstant.TABLEFIELDKEY,EquipmentMaintenanceRecordsConstant.TABLERENAMES);
return ActionResult.success(equipmentMaintenanceRecordsMap);
}
}

@ -0,0 +1,373 @@
package jnpf.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.xuyanwu.spring.file.storage.FileInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import jnpf.base.vo.DownloadVO;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.config.ConfigValueUtil;
import jnpf.entity.EquipmentRentalRecordsEntity;
import jnpf.model.equipmentrentalrecords.EquipmentRentalRecordsConstant;
import jnpf.model.equipmentrentalrecords.EquipmentRentalRecordsForm;
import jnpf.model.equipmentrentalrecords.EquipmentRentalRecordsPagination;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.service.EquipmentRentalRecordsService;
import jnpf.util.*;
import lombok.Cleanup;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.io.IOException;
import java.util.*;
/**
* EquipmentRentalRecords
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-17
*/
@Slf4j
@RestController
@Tag(name = "EquipmentRentalRecords", description = "example")
@RequestMapping("/api/example/EquipmentRentalRecords")
public class EquipmentRentalRecordsController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private EquipmentRentalRecordsService equipmentRentalRecordsService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param equipmentRentalRecordsPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody EquipmentRentalRecordsPagination equipmentRentalRecordsPagination) throws IOException {
List<EquipmentRentalRecordsEntity> list = equipmentRentalRecordsService.getList(equipmentRentalRecordsPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (EquipmentRentalRecordsEntity entity : list) {
Map<String, Object> equipmentRentalRecordsMap = JsonUtil.entityToMap(entity);
equipmentRentalRecordsMap.put("id", equipmentRentalRecordsMap.get("id"));
//副表数据
//子表数据
realList.add(equipmentRentalRecordsMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, EquipmentRentalRecordsConstant.getFormData(), EquipmentRentalRecordsConstant.getColumnData(), equipmentRentalRecordsPagination.getModuleId(), false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(equipmentRentalRecordsPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param equipmentRentalRecordsForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid EquipmentRentalRecordsForm equipmentRentalRecordsForm) {
String b = equipmentRentalRecordsService.checkForm(equipmentRentalRecordsForm, 0);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
try {
equipmentRentalRecordsService.saveOrUpdate(equipmentRentalRecordsForm, null, true);
} catch (Exception e) {
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody EquipmentRentalRecordsPagination equipmentRentalRecordsPagination) throws IOException {
if (StringUtil.isEmpty(equipmentRentalRecordsPagination.getSelectKey())) {
return ActionResult.fail("请选择导出字段");
}
List<EquipmentRentalRecordsEntity> list = equipmentRentalRecordsService.getList(equipmentRentalRecordsPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (EquipmentRentalRecordsEntity entity : list) {
Map<String, Object> equipmentRentalRecordsMap = JsonUtil.entityToMap(entity);
equipmentRentalRecordsMap.put("id", equipmentRentalRecordsMap.get("id"));
//副表数据
//子表数据
realList.add(equipmentRentalRecordsMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, EquipmentRentalRecordsConstant.getFormData(), EquipmentRentalRecordsConstant.getColumnData(), equipmentRentalRecordsPagination.getModuleId(), false);
String[] keys = !StringUtil.isEmpty(equipmentRentalRecordsPagination.getSelectKey()) ? equipmentRentalRecordsPagination.getSelectKey() : new String[0];
UserInfo userInfo = userProvider.get();
DownloadVO vo = this.creatModelExcel(configValueUtil.getTemporaryFilePath(), realList, keys, userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path, List<Map<String, Object>> list, String[] keys, UserInfo userInfo) {
DownloadVO vo = DownloadVO.builder().build();
List<ExcelExportEntity> entitys = new ArrayList<>();
if (keys.length > 0) {
for (String key : keys) {
switch (key) {
case "leaseNumber":
entitys.add(new ExcelExportEntity("租赁单号", "leaseNumber"));
break;
case "startTime":
entitys.add(new ExcelExportEntity("开始时间", "startTime"));
break;
case "endTime":
entitys.add(new ExcelExportEntity("结束时间", "endTime"));
break;
case "equipmentId":
entitys.add(new ExcelExportEntity("设备名称", "equipmentId"));
break;
case "totalLeasePrice":
entitys.add(new ExcelExportEntity("租赁总价", "totalLeasePrice"));
break;
case "leaseDeposit":
entitys.add(new ExcelExportEntity("租赁押金", "leaseDeposit"));
break;
case "merchantId":
entitys.add(new ExcelExportEntity("商户名称", "merchantId"));
break;
case "contacts":
entitys.add(new ExcelExportEntity("联系人", "contacts"));
break;
case "contactsPhone":
entitys.add(new ExcelExportEntity("联系电话", "contactsPhone"));
break;
case "leaseStatus":
entitys.add(new ExcelExportEntity("租赁状态", "leaseStatus"));
break;
case "enclosure":
entitys.add(new ExcelExportEntity("附件", "enclosure"));
break;
case "equipmentCoding":
entitys.add(new ExcelExportEntity("设备编码", "equipmentCoding"));
break;
case "returnedBy":
entitys.add(new ExcelExportEntity("归还人", "returnedBy"));
break;
case "returnTime":
entitys.add(new ExcelExportEntity("归还时间", "returnTime"));
break;
case "returnStatus":
entitys.add(new ExcelExportEntity("归还状态", "returnStatus"));
break;
case "remarks":
entitys.add(new ExcelExportEntity("归还说明", "remarks"));
break;
case "creationTime":
entitys.add(new ExcelExportEntity("创建时间", "creationTime"));
break;
case "equipmentName":
entitys.add(new ExcelExportEntity("设备名称", "equipmentName"));
break;
case "merchantName":
entitys.add(new ExcelExportEntity("商户名称", "merchantName"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try {
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size() > 0) {
if (list.size() == 0) {
list.add(new HashMap<>());
}
//去除空数据
List<Map<String, Object>> dataList = new ArrayList<>();
for (Map<String, Object> map : list) {
int i = 0;
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-"));
String field = key.substring(key.indexOf("-") + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
for (Map<String, Object> childMap : childList) {
if (childMap.get(field) != null) {
i++;
}
}
}
} else {
Object o = map.get(key);
if (o != null) {
i++;
}
}
}
if (i > 0) {
dataList.add(map);
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(EquipmentRentalRecordsConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
*
* @param id
* @param equipmentRentalRecordsForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid EquipmentRentalRecordsForm equipmentRentalRecordsForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
equipmentRentalRecordsForm.setId(id);
if (!isImport) {
String b = equipmentRentalRecordsService.checkForm(equipmentRentalRecordsForm, 1);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
EquipmentRentalRecordsEntity entity = equipmentRentalRecordsService.getInfo(id);
if (entity != null) {
try {
equipmentRentalRecordsService.saveOrUpdate(equipmentRentalRecordsForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id) {
EquipmentRentalRecordsEntity entity = equipmentRentalRecordsService.getInfo(id);
String result = null;
if (entity != null) {
//假删除
entity.setDeleteMark(1);
result = equipmentRentalRecordsService.update(id, entity);
}
if (result != null && result.contains("成功")) {
return ActionResult.success(result);
}
return ActionResult.fail(result);
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id) {
EquipmentRentalRecordsEntity entity = equipmentRentalRecordsService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentRentalRecordsMap = JsonUtil.entityToMap(entity);
equipmentRentalRecordsMap.put("id", equipmentRentalRecordsMap.get("id"));
//副表数据
//子表数据
equipmentRentalRecordsMap = generaterSwapUtil.swapDataDetail(equipmentRentalRecordsMap, EquipmentRentalRecordsConstant.getFormData(), "583211716402217477", false);
return ActionResult.success(equipmentRentalRecordsMap);
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id) {
EquipmentRentalRecordsEntity entity = equipmentRentalRecordsService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentRentalRecordsMap = JsonUtil.entityToMap(entity);
equipmentRentalRecordsMap.put("id", equipmentRentalRecordsMap.get("id"));
//副表数据
//子表数据
equipmentRentalRecordsMap = generaterSwapUtil.swapDataForm(equipmentRentalRecordsMap, EquipmentRentalRecordsConstant.getFormData(), EquipmentRentalRecordsConstant.TABLEFIELDKEY, EquipmentRentalRecordsConstant.TABLERENAMES);
return ActionResult.success(equipmentRentalRecordsMap);
}
}

@ -0,0 +1,191 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.equipmentrepairrecords.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
/**
* EquipmentRepairRecords
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Slf4j
@RestController
@Tag(name = "EquipmentRepairRecords" , description = "example")
@RequestMapping("/api/example/EquipmentRepairRecords")
public class EquipmentRepairRecordsController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private EquipmentRepairRecordsService equipmentRepairRecordsService;
/**
*
*
* @param equipmentRepairRecordsPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody EquipmentRepairRecordsPagination equipmentRepairRecordsPagination)throws IOException{
List<EquipmentRepairRecordsEntity> list= equipmentRepairRecordsService.getList(equipmentRepairRecordsPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (EquipmentRepairRecordsEntity entity : list) {
Map<String, Object> equipmentRepairRecordsMap=JsonUtil.entityToMap(entity);
equipmentRepairRecordsMap.put("id", equipmentRepairRecordsMap.get("id"));
//副表数据
//子表数据
realList.add(equipmentRepairRecordsMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, EquipmentRepairRecordsConstant.getFormData(), EquipmentRepairRecordsConstant.getColumnData(), equipmentRepairRecordsPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(equipmentRepairRecordsPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param equipmentRepairRecordsForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid EquipmentRepairRecordsForm equipmentRepairRecordsForm) {
String b = equipmentRepairRecordsService.checkForm(equipmentRepairRecordsForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
equipmentRepairRecordsService.saveOrUpdate(equipmentRepairRecordsForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param equipmentRepairRecordsForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid EquipmentRepairRecordsForm equipmentRepairRecordsForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
equipmentRepairRecordsForm.setId(id);
if (!isImport) {
String b = equipmentRepairRecordsService.checkForm(equipmentRepairRecordsForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
EquipmentRepairRecordsEntity entity= equipmentRepairRecordsService.getInfo(id);
if(entity!=null){
try{
equipmentRepairRecordsService.saveOrUpdate(equipmentRepairRecordsForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
EquipmentRepairRecordsEntity entity= equipmentRepairRecordsService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
equipmentRepairRecordsService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
EquipmentRepairRecordsEntity entity= equipmentRepairRecordsService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentRepairRecordsMap=JsonUtil.entityToMap(entity);
equipmentRepairRecordsMap.put("id", equipmentRepairRecordsMap.get("id"));
//副表数据
//子表数据
equipmentRepairRecordsMap = generaterSwapUtil.swapDataDetail(equipmentRepairRecordsMap,EquipmentRepairRecordsConstant.getFormData(),"582885544460025925",false);
return ActionResult.success(equipmentRepairRecordsMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
EquipmentRepairRecordsEntity entity= equipmentRepairRecordsService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> equipmentRepairRecordsMap=JsonUtil.entityToMap(entity);
equipmentRepairRecordsMap.put("id", equipmentRepairRecordsMap.get("id"));
//副表数据
//子表数据
equipmentRepairRecordsMap = generaterSwapUtil.swapDataForm(equipmentRepairRecordsMap,EquipmentRepairRecordsConstant.getFormData(),EquipmentRepairRecordsConstant.TABLEFIELDKEY,EquipmentRepairRecordsConstant.TABLERENAMES);
return ActionResult.success(equipmentRepairRecordsMap);
}
}

@ -15,16 +15,20 @@ import jnpf.model.park.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile;
@ -36,7 +40,9 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
@ -51,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
/**
* park
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
@ -58,7 +65,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Slf4j
@RestController
@Tag(name = "park" , description = "example")
@Tag(name = "park", description = "example")
@RequestMapping("/api/example/Park")
public class ParkController {
@ -72,30 +79,29 @@ public class ParkController {
private ParkService parkService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param parkPagination
* @return
*/
*
*
* @param parkPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody ParkPagination parkPagination)throws IOException{
List<ParkEntity> list= parkService.getList(parkPagination);
List<Map<String, Object>> realList=new ArrayList<>();
public ActionResult list(@RequestBody ParkPagination parkPagination) throws IOException {
List<ParkEntity> list = parkService.getList(parkPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (ParkEntity entity : list) {
Map<String, Object> parkMap=JsonUtil.entityToMap(entity);
parkMap.put("id", parkMap.get("id"));
//副表数据
//子表数据
Map<String, Object> parkMap = JsonUtil.entityToMap(entity);
parkMap.put("id", parkMap.get("id"));
//副表数据
//子表数据
realList.add(parkMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, ParkConstant.getFormData(), ParkConstant.getColumnData(), parkPagination.getModuleId(),false);
realList = generaterSwapUtil.swapDataList(realList, ParkConstant.getFormData(), ParkConstant.getColumnData(), parkPagination.getModuleId(), false);
//返回对象
PageListVO vo = new PageListVO();
@ -104,90 +110,92 @@ public class ParkController {
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param parkForm
* @return
*/
*
*
* @param parkForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid ParkForm parkForm) {
String b = parkService.checkForm(parkForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
String b = parkService.checkForm(parkForm, 0);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
try{
parkService.saveOrUpdate(parkForm, null ,true);
}catch(Exception e){
try {
parkService.saveOrUpdate(parkForm, null, true);
} catch (Exception e) {
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody ParkPagination parkPagination) throws IOException {
if (StringUtil.isEmpty(parkPagination.getSelectKey())){
if (StringUtil.isEmpty(parkPagination.getSelectKey())) {
return ActionResult.fail("请选择导出字段");
}
List<ParkEntity> list= parkService.getList(parkPagination);
List<Map<String, Object>> realList=new ArrayList<>();
List<ParkEntity> list = parkService.getList(parkPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (ParkEntity entity : list) {
Map<String, Object> parkMap=JsonUtil.entityToMap(entity);
parkMap.put("id", parkMap.get("id"));
//副表数据
//子表数据
Map<String, Object> parkMap = JsonUtil.entityToMap(entity);
parkMap.put("id", parkMap.get("id"));
//副表数据
//子表数据
realList.add(parkMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, ParkConstant.getFormData(), ParkConstant.getColumnData(), parkPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(parkPagination.getSelectKey())?parkPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
realList = generaterSwapUtil.swapDataList(realList, ParkConstant.getFormData(), ParkConstant.getColumnData(), parkPagination.getModuleId(), false);
String[] keys = !StringUtil.isEmpty(parkPagination.getSelectKey()) ? parkPagination.getSelectKey() : new String[0];
UserInfo userInfo = userProvider.get();
DownloadVO vo = this.creatModelExcel(configValueUtil.getTemporaryFilePath(), realList, keys, userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "code" :
entitys.add(new ExcelExportEntity("园区编码" ,"code"));
break;
case "name" :
entitys.add(new ExcelExportEntity("园区名称" ,"name"));
break;
case "description" :
entitys.add(new ExcelExportEntity("园区描述" ,"description"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
case "type" :
entitys.add(new ExcelExportEntity("类型" ,"type"));
break;
*
*/
public DownloadVO creatModelExcel(String path, List<Map<String, Object>> list, String[] keys, UserInfo userInfo) {
DownloadVO vo = DownloadVO.builder().build();
List<ExcelExportEntity> entitys = new ArrayList<>();
if (keys.length > 0) {
for (String key : keys) {
switch (key) {
case "code":
entitys.add(new ExcelExportEntity("园区编码", "code"));
break;
case "name":
entitys.add(new ExcelExportEntity("园区名称", "name"));
break;
case "description":
entitys.add(new ExcelExportEntity("园区描述", "description"));
break;
case "remark":
entitys.add(new ExcelExportEntity("备注", "remark"));
break;
case "type":
entitys.add(new ExcelExportEntity("类型", "type"));
break;
default:
break;
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
try {
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
if (entitys.size() > 0) {
if (list.size() == 0) {
list.add(new HashMap<>());
}
//去除空数据
@ -197,8 +205,8 @@ public class ParkController {
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
String tableField = key.substring(0, key.indexOf("-"));
String field = key.substring(key.indexOf("-") + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
@ -224,7 +232,7 @@ public class ParkController {
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
@ -241,6 +249,7 @@ public class ParkController {
}
return vo;
}
@Operation(summary = "上传文件")
@PostMapping("/Uploader")
public ActionResult<Object> Uploader() {
@ -260,67 +269,67 @@ public class ParkController {
}
/**
*
*
* @return
*/
*
*
* @return
*/
@Operation(summary = "模板下载")
@GetMapping("/TemplateDownload")
public ActionResult<DownloadVO> TemplateDownload(){
public ActionResult<DownloadVO> TemplateDownload() {
DownloadVO vo = DownloadVO.builder().build();
UserInfo userInfo = userProvider.get();
Map<String, Object> dataMap = new HashMap<>();
//主表对象
List<ExcelExportEntity> entitys = new ArrayList<>();
//以下添加字段
entitys.add(new ExcelExportEntity("园区编码" ,"code"));
entitys.add(new ExcelExportEntity("园区名称" ,"name"));
entitys.add(new ExcelExportEntity("园区编码", "code"));
entitys.add(new ExcelExportEntity("园区名称", "name"));
List<Map<String, Object>> list = new ArrayList<>();
list.add(dataMap);
ExportParams exportParams = new ExportParams(null, "园区管理模板");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
list.add(new HashMap<>());
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(ParkConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
}
String fileName = "园区管理模板" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
try {
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size() > 0) {
if (list.size() == 0) {
list.add(new HashMap<>());
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(ParkConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
}
String fileName = "园区管理模板" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("模板信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
log.error("模板信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return ActionResult.success(vo);
}
/**
*
*
* @return
*/
@Operation(summary = "导入预览" )
*
*
* @return
*/
@Operation(summary = "导入预览")
@GetMapping("/ImportPreview")
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
Map<String, Object> headAndDataMap = new HashMap<>(2);
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
int headerRowIndex = 1;
int headerRowIndex = 1;
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setHeadRows(headerRowIndex);
@ -329,11 +338,11 @@ public class ParkController {
List<ParkExcelVO> excelDataList = ExcelImportUtil.importExcel(temporary, ParkExcelVO.class, params);
// 导入字段
List<ExcelImFieldModel> columns = new ArrayList<>();
columns.add(new ExcelImFieldModel("code","园区编码"));
columns.add(new ExcelImFieldModel("name","园区名称"));
headAndDataMap.put("dataRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(excelDataList)));
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
} catch (Exception e){
columns.add(new ExcelImFieldModel("code", "园区编码"));
columns.add(new ExcelImFieldModel("name", "园区名称"));
headAndDataMap.put("dataRow", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(excelDataList)));
headAndDataMap.put("headerRow", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
} catch (Exception e) {
e.printStackTrace();
return ActionResult.fail("表头名称不可更改,表头行不能删除");
}
@ -341,170 +350,185 @@ public class ParkController {
}
/**
*
*
* @return
*/
@Operation(summary = "导入数据" )
*
*
* @return
*/
@Operation(summary = "导入数据")
@PostMapping("/ImportData")
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
List<Map<String, Object>> listData=new ArrayList<>();
for(Map<String, Object> map : visualImportModel.getList()){
List<Map<String, Object>> listData = new ArrayList<>();
for (Map<String, Object> map : visualImportModel.getList()) {
listData.add(map);
}
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
uniqueModel.setDbLinkId(ParkConstant.DBLINKID);
uniqueModel.setUpdate(Objects.equals("1", "2"));
ExcelImportModel excelImportModel = generaterSwapUtil.importData(ParkConstant.getFormData(),listData,uniqueModel,
ParkConstant.TABLEFIELDKEY,ParkConstant.getTableList());
ExcelImportModel excelImportModel = generaterSwapUtil.importData(ParkConstant.getFormData(), listData, uniqueModel,
ParkConstant.TABLEFIELDKEY, ParkConstant.getTableList());
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
for (ImportDataModel model : importDataModel) {
String id = model.getId();
Map<String, Object> result = model.getResultData();
if(StringUtil.isNotEmpty(id)){
update(id, JsonUtil.getJsonToBean(result,ParkForm.class), true);
}else {
create( JsonUtil.getJsonToBean(result,ParkForm.class));
if (StringUtil.isNotEmpty(id)) {
update(id, JsonUtil.getJsonToBean(result, ParkForm.class), true);
} else {
create(JsonUtil.getJsonToBean(result, ParkForm.class));
}
}
return ActionResult.success(excelImportModel);
}
/**
*
*
* @return
*/
*
*
* @return
*/
@Operation(summary = "导出异常报告")
@PostMapping("/ImportExceptionData")
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
DownloadVO vo=DownloadVO.builder().build();
DownloadVO vo = DownloadVO.builder().build();
List<ParkExcelErrorVO> parkVOList = JsonUtil.getJsonToList(visualImportModel.getList(), ParkExcelErrorVO.class);
UserInfo userInfo = userProvider.get();
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
ExportParams exportParams = new ExportParams(null, "错误报告");
exportParams.setType(ExcelType.XSSF);
workbook = ExcelExportUtil.exportExcel(exportParams,
ParkExcelErrorVO.class, parkVOList);
try {
@Cleanup Workbook workbook = new HSSFWorkbook();
ExportParams exportParams = new ExportParams(null, "错误报告");
exportParams.setType(ExcelType.XSSF);
workbook = ExcelExportUtil.exportExcel(exportParams,
ParkExcelErrorVO.class, parkVOList);
String fileName = "错误报告" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String fileName = "错误报告" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
e.printStackTrace();
e.printStackTrace();
}
return ActionResult.success(vo);
}
/**
*
* @param ids
* @return
*/
*
*
* @param ids
* @return
*/
@DeleteMapping("/batchRemove")
@Transactional
@Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids){
public ActionResult batchRemove(@RequestBody String ids) {
List<String> idList = JsonUtil.getJsonToList(ids, String.class);
int i =0;
for (String allId : idList){
int i = 0;
for (String allId : idList) {
this.delete(allId);
i++;
}
if (i == 0 ){
return ActionResult.fail("删除失败");
if (i == 0) {
return ActionResult.fail("删除失败");
}
return ActionResult.success("删除成功");
}
/**
*
* @param id
* @param parkForm
* @return
*/
*
*
* @param id
* @param parkForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid ParkForm parkForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ParkForm parkForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
parkForm.setId(id);
if (!isImport) {
String b = parkService.checkForm(parkForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
String b = parkService.checkForm(parkForm, 1);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
ParkEntity entity= parkService.getInfo(id);
if(entity!=null){
try{
parkService.saveOrUpdate(parkForm,id,false);
}catch(Exception e){
ParkEntity entity = parkService.getInfo(id);
if (entity != null) {
try {
parkService.saveOrUpdate(parkForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
*
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
ParkEntity entity= parkService.getInfo(id);
if(entity!=null){
public ActionResult delete(@PathVariable("id") String id) {
ParkEntity entity = parkService.getInfo(id);
if (entity != null) {
//假删除
entity.setDeleteMark(1);
parkService.update(id,entity);
parkService.update(id, entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
ParkEntity entity= parkService.getInfo(id);
if(entity==null){
public ActionResult detailInfo(@PathVariable("id") String id) {
ParkEntity entity = parkService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> parkMap=JsonUtil.entityToMap(entity);
Map<String, Object> parkMap = JsonUtil.entityToMap(entity);
parkMap.put("id", parkMap.get("id"));
//副表数据
//子表数据
parkMap = generaterSwapUtil.swapDataDetail(parkMap,ParkConstant.getFormData(),"581462239718932549",false);
parkMap = generaterSwapUtil.swapDataDetail(parkMap, ParkConstant.getFormData(), "581462239718932549", false);
return ActionResult.success(parkMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
ParkEntity entity= parkService.getInfo(id);
if(entity==null){
public ActionResult info(@PathVariable("id") String id) {
ParkEntity entity = parkService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> parkMap=JsonUtil.entityToMap(entity);
Map<String, Object> parkMap = JsonUtil.entityToMap(entity);
parkMap.put("id", parkMap.get("id"));
//副表数据
//子表数据
parkMap = generaterSwapUtil.swapDataForm(parkMap,ParkConstant.getFormData(),ParkConstant.TABLEFIELDKEY,ParkConstant.TABLERENAMES);
parkMap = generaterSwapUtil.swapDataForm(parkMap, ParkConstant.getFormData(), ParkConstant.TABLEFIELDKEY, ParkConstant.TABLERENAMES);
return ActionResult.success(parkMap);
}
@Operation(summary = "数据树形结构")
@GetMapping("/tree")
public ActionResult tree() {
return ActionResult.success(parkService.tree());
}
}

@ -0,0 +1,191 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.parkequipment.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
/**
* ParkEquipment
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
*/
@Slf4j
@RestController
@Tag(name = "ParkEquipment" , description = "example")
@RequestMapping("/api/example/ParkEquipment")
public class ParkEquipmentController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private ParkEquipmentService parkEquipmentService;
/**
*
*
* @param parkEquipmentPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody ParkEquipmentPagination parkEquipmentPagination)throws IOException{
List<ParkEquipmentEntity> list= parkEquipmentService.getList(parkEquipmentPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (ParkEquipmentEntity entity : list) {
Map<String, Object> parkEquipmentMap=JsonUtil.entityToMap(entity);
parkEquipmentMap.put("id", parkEquipmentMap.get("id"));
//副表数据
//子表数据
realList.add(parkEquipmentMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, ParkEquipmentConstant.getFormData(), ParkEquipmentConstant.getColumnData(), parkEquipmentPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(parkEquipmentPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param parkEquipmentForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid ParkEquipmentForm parkEquipmentForm) {
String b = parkEquipmentService.checkForm(parkEquipmentForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
parkEquipmentService.saveOrUpdate(parkEquipmentForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param parkEquipmentForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid ParkEquipmentForm parkEquipmentForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
parkEquipmentForm.setId(id);
if (!isImport) {
String b = parkEquipmentService.checkForm(parkEquipmentForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
ParkEquipmentEntity entity= parkEquipmentService.getInfo(id);
if(entity!=null){
try{
parkEquipmentService.saveOrUpdate(parkEquipmentForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
ParkEquipmentEntity entity= parkEquipmentService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
parkEquipmentService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
ParkEquipmentEntity entity= parkEquipmentService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> parkEquipmentMap=JsonUtil.entityToMap(entity);
parkEquipmentMap.put("id", parkEquipmentMap.get("id"));
//副表数据
//子表数据
parkEquipmentMap = generaterSwapUtil.swapDataDetail(parkEquipmentMap,ParkEquipmentConstant.getFormData(),"582564179701929029",false);
return ActionResult.success(parkEquipmentMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
ParkEquipmentEntity entity= parkEquipmentService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> parkEquipmentMap=JsonUtil.entityToMap(entity);
parkEquipmentMap.put("id", parkEquipmentMap.get("id"));
//副表数据
//子表数据
parkEquipmentMap = generaterSwapUtil.swapDataForm(parkEquipmentMap,ParkEquipmentConstant.getFormData(),ParkEquipmentConstant.TABLEFIELDKEY,ParkEquipmentConstant.TABLERENAMES);
return ActionResult.success(parkEquipmentMap);
}
}

@ -0,0 +1,355 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.venuereservationrecord.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import lombok.Cleanup;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* VenueReservationRecord
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Slf4j
@RestController
@Tag(name = "VenueReservationRecord" , description = "example")
@RequestMapping("/api/example/VenueReservationRecord")
public class VenueReservationRecordController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private VenueReservationRecordService venueReservationRecordService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param venueReservationRecordPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody VenueReservationRecordPagination venueReservationRecordPagination)throws IOException{
List<VenueReservationRecordEntity> list= venueReservationRecordService.getList(venueReservationRecordPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (VenueReservationRecordEntity entity : list) {
Map<String, Object> venueReservationRecordMap=JsonUtil.entityToMap(entity);
venueReservationRecordMap.put("id", venueReservationRecordMap.get("id"));
//副表数据
//子表数据
realList.add(venueReservationRecordMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, VenueReservationRecordConstant.getFormData(), VenueReservationRecordConstant.getColumnData(), venueReservationRecordPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(venueReservationRecordPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param venueReservationRecordForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid VenueReservationRecordForm venueReservationRecordForm) {
String b = venueReservationRecordService.checkForm(venueReservationRecordForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
venueReservationRecordService.saveOrUpdate(venueReservationRecordForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody VenueReservationRecordPagination venueReservationRecordPagination) throws IOException {
if (StringUtil.isEmpty(venueReservationRecordPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<VenueReservationRecordEntity> list= venueReservationRecordService.getList(venueReservationRecordPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (VenueReservationRecordEntity entity : list) {
Map<String, Object> venueReservationRecordMap=JsonUtil.entityToMap(entity);
venueReservationRecordMap.put("id", venueReservationRecordMap.get("id"));
//副表数据
//子表数据
realList.add(venueReservationRecordMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, VenueReservationRecordConstant.getFormData(), VenueReservationRecordConstant.getColumnData(), venueReservationRecordPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(venueReservationRecordPagination.getSelectKey())?venueReservationRecordPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "applicationNumber" :
entitys.add(new ExcelExportEntity("申请单号" ,"applicationNumber"));
break;
case "merchantId" :
entitys.add(new ExcelExportEntity("商户名称" ,"merchantId"));
break;
case "spaceId" :
entitys.add(new ExcelExportEntity("空间名称" ,"spaceId"));
break;
case "startTime" :
entitys.add(new ExcelExportEntity("开始时间" ,"startTime"));
break;
case "endTime" :
entitys.add(new ExcelExportEntity("结束时间" ,"endTime"));
break;
case "contacts" :
entitys.add(new ExcelExportEntity("联系人" ,"contacts"));
break;
case "contactsPhone" :
entitys.add(new ExcelExportEntity("联系电话" ,"contactsPhone"));
break;
case "reservationsNumber" :
entitys.add(new ExcelExportEntity("预约人数" ,"reservationsNumber"));
break;
case "reservationsThing" :
entitys.add(new ExcelExportEntity("预约事由" ,"reservationsThing"));
break;
case "usageProgress" :
entitys.add(new ExcelExportEntity("预约进度" ,"usageProgress"));
break;
case "creationTime" :
entitys.add(new ExcelExportEntity("创建时间" ,"creationTime"));
break;
case "spaceName" :
entitys.add(new ExcelExportEntity("空间名称" ,"spaceName"));
break;
case "merchantName" :
entitys.add(new ExcelExportEntity("商户名称" ,"merchantName"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
list.add(new HashMap<>());
}
//去除空数据
List<Map<String, Object>> dataList = new ArrayList<>();
for (Map<String, Object> map : list) {
int i = 0;
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
for (Map<String, Object> childMap : childList) {
if (childMap.get(field) != null) {
i++;
}
}
}
} else {
Object o = map.get(key);
if (o != null) {
i++;
}
}
}
if (i > 0) {
dataList.add(map);
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(VenueReservationRecordConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
* @param id
* @param venueReservationRecordForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid VenueReservationRecordForm venueReservationRecordForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
venueReservationRecordForm.setId(id);
if (!isImport) {
String b = venueReservationRecordService.checkForm(venueReservationRecordForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
VenueReservationRecordEntity entity= venueReservationRecordService.getInfo(id);
if(entity!=null){
try{
venueReservationRecordService.saveOrUpdate(venueReservationRecordForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
VenueReservationRecordEntity entity= venueReservationRecordService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
venueReservationRecordService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
VenueReservationRecordEntity entity= venueReservationRecordService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> venueReservationRecordMap=JsonUtil.entityToMap(entity);
venueReservationRecordMap.put("id", venueReservationRecordMap.get("id"));
//副表数据
//子表数据
venueReservationRecordMap = generaterSwapUtil.swapDataDetail(venueReservationRecordMap,VenueReservationRecordConstant.getFormData(),"583566974336893829",false);
return ActionResult.success(venueReservationRecordMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
VenueReservationRecordEntity entity= venueReservationRecordService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> venueReservationRecordMap=JsonUtil.entityToMap(entity);
venueReservationRecordMap.put("id", venueReservationRecordMap.get("id"));
//副表数据
//子表数据
venueReservationRecordMap = generaterSwapUtil.swapDataForm(venueReservationRecordMap,VenueReservationRecordConstant.getFormData(),VenueReservationRecordConstant.TABLEFIELDKEY,VenueReservationRecordConstant.TABLERENAMES);
return ActionResult.success(venueReservationRecordMap);
}
}

@ -0,0 +1,85 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-22
*/
@Data
@TableName("yq_bill_table")
public class BillTableEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "MERCHANT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String merchantId;
@TableField(value = "MERCHANT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String merchantName;
@TableField(value = "CONTRACT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String contractName;
@TableField(value = "CONTRACT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String contractId;
@TableField(value = "CONTRACT_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String contractNumber;
@TableField(value = "BILL_NUMBE" , updateStrategy = FieldStrategy.IGNORED)
private String billNumbe;
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField("SUBMITTER")
private String submitter;
@TableField("SUBMISSION_TIME")
private Date submissionTime;
@TableField(value = "BILL_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String billStatus;
@TableField(value = "BILL_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal billAmount;
@TableField(value = "NOTICE_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date noticeTime;
@TableField(value = "PAY_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal payAmount;
@TableField(value = "PAY_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String payStatus;
@TableField("PAY_VOUCHER")
private String payVoucher;
@TableField(value = "NOTIFICATION_STATE" , updateStrategy = FieldStrategy.IGNORED)
private String notificationState;
@TableField(value = "NOTIFICATION_METHOD" , updateStrategy = FieldStrategy.IGNORED)
private String notificationMethod;
@TableField(value = "CONFIRM_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date confirmTime;
@TableField(value = "CONFIRM_PERSONNEL" , updateStrategy = FieldStrategy.IGNORED)
private String confirmPersonnel;
@TableField("CONFIRM_EXPLAIN")
private String confirmExplain;
@TableField(value = "BILL_ATTACHMENT" , updateStrategy = FieldStrategy.IGNORED)
private String billAttachment;
@TableField("REMARKS")
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,56 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-22
*/
@Data
@TableName("yq_bill_device_deatial")
public class BilldevicedeatialEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField(value = "EQUIPMENT_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentNumber;
@TableField(value = "EQUIPMENT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentName;
@TableField("LEASE_ID")
private String leaseId;
@TableField(value = "LEASE_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String leaseNumber;
@TableField("BILL_ID")
private String billId;
@TableField("BILL_NUMBER")
private String billNumber;
@TableField("USE_AMOUNT")
private String useAmount;
@TableField(value = "BILL_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal billAmount;
@TableField(value = "COST_DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String costDescription;
@TableField("REMARKS")
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
}

@ -0,0 +1,48 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-22
*/
@Data
@TableName("yq_bill_other_deatial")
public class BillotherdeatialEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField("BILL_ID")
private String billId;
@TableField("BILL_NUMBER")
private String billNumber;
@TableField(value = "USE_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private String useAmount;
@TableField(value = "BILL_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal billAmount;
@TableField(value = "COST_DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String costDescription;
@TableField("REMARKS")
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
}

@ -0,0 +1,56 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-22
*/
@Data
@TableName("yq_bill_space_detail")
public class BillspacedetailEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField("SPACE_NAME")
private String spaceName;
@TableField(value = "SPACE_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String spaceNumber;
@TableField("BILL_ID")
private String billId;
@TableField("BILL_NUMBER")
private String billNumber;
@TableField("BILL_TYPE")
private String billType;
@TableField("USE_AMOUNT")
private String useAmount;
@TableField(value = "BILL_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal billAmount;
@TableField(value = "COST_DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String costDescription;
@TableField("REMARKS")
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
}

@ -11,7 +11,7 @@ import java.math.BigDecimal;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
* @ 2024-07-19
*/
@Data
@TableName("yq_contract")
@ -34,9 +34,9 @@ public class ContractEntity {
private Date signingDate;
@TableField(value = "LEASE_TERM" , updateStrategy = FieldStrategy.IGNORED)
private String leaseTerm;
@TableField("MERCHANT_ID")
@TableField(value = "MERCHANT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String merchantId;
@TableField(value = "MERCHANT_NAME" , updateStrategy = FieldStrategy.IGNORED)
@TableField("MERCHANT_NAME")
private String merchantName;
@TableField(value = "PARK_ID" , updateStrategy = FieldStrategy.IGNORED)
private String parkId;

@ -0,0 +1,84 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
@TableName("yq_decoration_application_form")
public class DecorationApplicationFormEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "MERCHANT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String merchantId;
@TableField(value = "MERCHANT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String merchantName;
@TableField(value = "APPLICATION_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String applicationNumber;
@TableField("CONTRACT_NAME")
private String contractName;
@TableField(value = "CONTRACT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String contractId;
@TableField("DECORATION_INSTRUCTIONS")
private String decorationInstructions;
@TableField(value = "EXPECTED_START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date expectedStartTime;
@TableField(value = "EXPECTED_END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date expectedEndTime;
@TableField(value = "DEPOSIT_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal depositAmount;
@TableField(value = "IS_THE_DEPOSIT_REFUNDED" , updateStrategy = FieldStrategy.IGNORED)
private String isTheDepositRefunded;
@TableField(value = "DEPOSIT_REFUND_DATE" , updateStrategy = FieldStrategy.IGNORED)
private Date depositRefundDate;
@TableField(value = "CONTACTS" , updateStrategy = FieldStrategy.IGNORED)
private String contacts;
@TableField(value = "DECORATION_PROGRESS" , updateStrategy = FieldStrategy.IGNORED)
private String decorationProgress;
@TableField(value = "FIELD_PHOTO" , updateStrategy = FieldStrategy.IGNORED)
private String fieldPhoto;
@TableField(value = "CONTACTS_PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String contactsPhone;
@TableField("SUBMITTER")
private String submitter;
@TableField("SUBMISSION_DATE")
private Date submissionDate;
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField(value = "SPACE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String spaceName;
@TableField("REMARKS")
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
@TableField("COMPANY")
private String company;
@TableField("DEPARTMENT")
private String department;
@TableField("ORGANIZATION")
private String organization;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,71 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-15
*/
@Data
@TableName("yq_equipment")
public class EquipmentEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "CODE" , updateStrategy = FieldStrategy.IGNORED)
private String code;
@TableField(value = "NAME" , updateStrategy = FieldStrategy.IGNORED)
private String name;
@TableField(value = "TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String type;
@TableField(value = "BRAND" , updateStrategy = FieldStrategy.IGNORED)
private String brand;
@TableField(value = "MODEL" , updateStrategy = FieldStrategy.IGNORED)
private String model;
@TableField(value = "SUPPLIER" , updateStrategy = FieldStrategy.IGNORED)
private String supplier;
@TableField(value = "SUPPLIER_PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String supplierPhone;
@TableField(value = "WARRANTY_START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date warrantyStartTime;
@TableField(value = "WARRANTY_END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date warrantyEndTime;
@TableField(value = "DEFECTS_LIABILITY_PERIOD" , updateStrategy = FieldStrategy.IGNORED)
private String defectsLiabilityPeriod;
@TableField(value = "BATCH_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String batchNumber;
@TableField(value = "DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String description;
@TableField(value = "STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String status;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_VERSION")
private Integer version;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -0,0 +1,65 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Data
@TableName("yq_equipment_inspection_records")
public class EquipmentInspectionRecordsEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "EQUIPMENT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentId;
@TableField(value = "EQUIPMENT_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentNumber;
@TableField(value = "EQUIPMENT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentName;
@TableField(value = "INSPECTION_TICKET_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String inspectionTicketNumber;
@TableField(value = "EQUIPMENT_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentStatus;
@TableField("INSPECTION_TIME")
private Date inspectionTime;
@TableField("INSPECTION_PERSONNEL")
private String inspectionPersonnel;
@TableField(value = "INSPECTION_PHOTOS" , updateStrategy = FieldStrategy.IGNORED)
private String inspectionPhotos;
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField(value = "SPACE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String spaceName;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_VERSION")
private Integer version;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -0,0 +1,82 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Data
@TableName("yq_equipment_maintenance_records")
public class EquipmentMaintenanceRecordsEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "EQUIPMENT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentId;
@TableField(value = "NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String number;
@TableField(value = "NAME" , updateStrategy = FieldStrategy.IGNORED)
private String name;
@TableField(value = "REPAIR_ORDER_ID" , updateStrategy = FieldStrategy.IGNORED)
private String repairOrderId;
@TableField(value = "REPAIR_ORDER_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String repairOrderNumber;
@TableField(value = "EXPENSES_INCURRED" , updateStrategy = FieldStrategy.IGNORED)
private String expensesIncurred;
@TableField(value = "COST_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal costAmount;
@TableField(value = "COST_DETAIL" , updateStrategy = FieldStrategy.IGNORED)
private String costDetail;
@TableField(value = "TENANT_BILL" , updateStrategy = FieldStrategy.IGNORED)
private String tenantBill;
@TableField(value = "REPAIR_PHOTO" , updateStrategy = FieldStrategy.IGNORED)
private String repairPhoto;
@TableField(value = "MAINTENANCE_PERSONNEL" , updateStrategy = FieldStrategy.IGNORED)
private String maintenancePersonnel;
@TableField(value = "MAINTENANCE_DATE" , updateStrategy = FieldStrategy.IGNORED)
private Date maintenanceDate;
@TableField(value = "MAINTENANCE_METHODS" , updateStrategy = FieldStrategy.IGNORED)
private String maintenanceMethods;
@TableField(value = "MAINTENANCE_DESCRIBE" , updateStrategy = FieldStrategy.IGNORED)
private String maintenanceDescribe;
@TableField(value = "MAINTENANCE_PLAN" , updateStrategy = FieldStrategy.IGNORED)
private String maintenancePlan;
@TableField("SPACE_ID")
private String spaceId;
@TableField("SPACE_NAME")
private String spaceName;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_VERSION")
private Integer version;
@TableField("REPAIR_ID")
private String repairId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -0,0 +1,85 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-17
*/
@Data
@TableName("yq_equipment_rental_records")
public class EquipmentRentalRecordsEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "LEASE_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String leaseNumber;
@TableField(value = "EQUIPMENT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentName;
@TableField(value = "EQUIPMENT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentId;
@TableField(value = "EQUIPMENT_CODING" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentCoding;
@TableField(value = "MERCHANT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String merchantId;
@TableField(value = "MERCHANT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String merchantName;
@TableField(value = "CONTACTS" , updateStrategy = FieldStrategy.IGNORED)
private String contacts;
@TableField(value = "CONTACTS_PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String contactsPhone;
@TableField(value = "TOTAL_LEASE_PRICE" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal totalLeasePrice;
@TableField(value = "LEASE_DEPOSIT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal leaseDeposit;
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField(value = "LEASE_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String leaseStatus;
@TableField(value = "RETURNED_BY" , updateStrategy = FieldStrategy.IGNORED)
private String returnedBy;
@TableField(value = "RETURN_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date returnTime;
@TableField(value = "RETURN_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String returnStatus;
@TableField(value = "ENCLOSURE" , updateStrategy = FieldStrategy.IGNORED)
private String enclosure;
@TableField("SUBMITTER")
private String submitter;
@TableField("SUBMISSION_TIME")
private Date submissionTime;
@TableField(value = "REMARKS" , updateStrategy = FieldStrategy.IGNORED)
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
@TableField("COMPANY")
private String company;
@TableField("DEPARTMENT")
private String department;
@TableField("ORGANIZATION")
private String organization;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,83 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Data
@TableName("yq_equipment_repair_records")
public class EquipmentRepairRecordsEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "REPAIR_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String repairNumber;
@TableField(value = "REPAIR_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String repairName;
@TableField("REPAIR_DATE")
private Date repairDate;
@TableField(value = "EQUIPMENT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentId;
@TableField(value = "EQUIPMENT_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentNumber;
@TableField(value = "EQUIPMENT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentName;
@TableField(value = "REGION_ID" , updateStrategy = FieldStrategy.IGNORED)
private String regionId;
@TableField(value = "REGION_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String regionName;
@TableField("REPAIR_ORDER_ID")
private String repairOrderId;
@TableField("REPAIR_ORDER_NUMBER")
private String repairOrderNumber;
@TableField(value = "CAUSE_OF_MALFUNCTION" , updateStrategy = FieldStrategy.IGNORED)
private String causeOmalfunction;
@TableField(value = "CONTRACT_INFORMATION" , updateStrategy = FieldStrategy.IGNORED)
private String contractInformation;
@TableField(value = "URGENT" , updateStrategy = FieldStrategy.IGNORED)
private String urgent;
@TableField(value = "REPAIR_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date repairTime;
@TableField(value = "FAULT_PHOTOS" , updateStrategy = FieldStrategy.IGNORED)
private String faultPhotos;
@TableField(value = "MESSAGE_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String messageStatus;
@TableField("REPLY_MESSAGE")
private String replyMessage;
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField(value = "SPACE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String spaceName;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_VERSION")
private Integer version;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -0,0 +1,89 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
*/
@Data
@TableName("yq_park_equipment")
public class ParkEquipmentEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "EQUIPMENT_CODING" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentCoding;
@TableField(value = "DEVICE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String deviceName;
@TableField(value = "EQUIPMENT_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentType;
@TableField(value = "EQUIPMENT_BRAND" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentBrand;
@TableField(value = "SUPPLIER" , updateStrategy = FieldStrategy.IGNORED)
private String supplier;
@TableField(value = "SUPPLIER_PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String supplierPhone;
@TableField("INSTALLATION_TIME")
private Date installationTime;
@TableField("PERSON_IN_CHARGE")
private String personInCharge;
@TableField("CHARGE_PHONE")
private String chargePhone;
@TableField(value = "DEVICE_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String deviceStatus;
@TableField(value = "WARRANTY_START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date warrantyStartTime;
@TableField(value = "WARRANTY_END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date warrantyEndTime;
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField("SPACE_NAME")
private String spaceName;
@TableField(value = "REGION_ID" , updateStrategy = FieldStrategy.IGNORED)
private String regionId;
@TableField("REGION_NAME")
private String regionName;
@TableField(value = "EQUIPMENT_WARRANTY" , updateStrategy = FieldStrategy.IGNORED)
private String equipmentWarranty;
@TableField(value = "DEVICE_DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String deviceDescription;
@TableField(value = "DEVICE_MAC_ADDRESS" , updateStrategy = FieldStrategy.IGNORED)
private String deviceMacAddress;
@TableField(value = "STATE" , updateStrategy = FieldStrategy.IGNORED)
private String state;
@TableField("EQUIPMENT_CODE")
private String equipmentCode;
@TableField("REMARKS")
private String remarks;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_VERSION")
private Integer version;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -34,9 +34,9 @@ public class SpacecontractEntity {
private String contractName;
@TableField(value = "TOTAL_RENTAL_PRICE" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal totalRentalPrice;
@TableField("SPACE_ID")
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField(value = "SPACE_NAME" , updateStrategy = FieldStrategy.IGNORED)
@TableField("SPACE_NAME")
private String spaceName;
@TableField(value = "SPACE_AREA" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal spaceArea;

@ -28,6 +28,10 @@ public class VehicleEntity {
private String vehicleColor;
@TableField(value = "VEHICLE_PHOTOS" , updateStrategy = FieldStrategy.IGNORED)
private String vehiclePhotos;
@TableField(value = "vehicle_weight" , updateStrategy = FieldStrategy.IGNORED)
private String vehicleWeight;
@TableField(value = "weight_tolerances" , updateStrategy = FieldStrategy.IGNORED)
private String weightTolerances;
@TableField(value = "CONTACTS_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String contactsName;
@TableField(value = "CONTACTS_PHONE" , updateStrategy = FieldStrategy.IGNORED)

@ -0,0 +1,73 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
@TableName("yq_venue_reservation_record")
public class VenueReservationRecordEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "MERCHANT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String merchantId;
@TableField(value = "MERCHANT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String merchantName;
@TableField(value = "APPLICATION_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String applicationNumber;
@TableField(value = "RESERVATIONS_THING" , updateStrategy = FieldStrategy.IGNORED)
private String reservationsThing;
@TableField(value = "RESERVATIONS_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String reservationsNumber;
@TableField(value = "USAGE_PROGRESS" , updateStrategy = FieldStrategy.IGNORED)
private String usageProgress;
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField("SUBMITTER")
private String submitter;
@TableField("SUBMISSION_TIME")
private Date submissionTime;
@TableField(value = "CONTACTS" , updateStrategy = FieldStrategy.IGNORED)
private String contacts;
@TableField(value = "CONTACTS_PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String contactsPhone;
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField(value = "SPACE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String spaceName;
@TableField("REMARKS")
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
@TableField("COMPANY")
private String company;
@TableField("DEPARTMENT")
private String department;
@TableField("ORGANIZATION")
private String organization;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,26 @@
package jnpf.model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
*
*
* : V3.0.0
* : (https://www.jnpfsoft.com)
* JNPF
* 2020-12-31
*/
@Data
public class ContractForm {
@Schema(description = "姓名")
private String contractName;
@Schema(description = "手机号")
private String mytelePhone;
@Schema(description = "文件")
private String fileJson;
}

@ -0,0 +1,27 @@
package jnpf.model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
*
*
* : V3.0.0
* : (https://www.jnpfsoft.com)
* JNPF
* 2020-12-31
*/
@Data
public class ContractInfoVO {
@Schema(description = "主键")
private String id;
@Schema(description = "姓名")
private String contractName;
@Schema(description = "手机号")
private String mytelePhone;
@Schema(description = "文件")
private String fileJson;
}

@ -0,0 +1,16 @@
package jnpf.model;
import lombok.Data;
/**
*
*
* : V3.0.0
* : (https://www.jnpfsoft.com)
* JNPF
* 2020-12-31
*/
@Data
public class ContractListVO extends ContractInfoVO {
}

@ -0,0 +1,89 @@
package jnpf.model.billtable;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* BillTable
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-22
*/
@Data
public class BillTableForm {
/** 主键 */
private String id;
/** 子表数据 **/
@JsonProperty("billspacedetailList")
private List<BillspacedetailModel> billspacedetailList;
/** 子表数据 **/
@JsonProperty("billdevicedeatialList")
private List<BilldevicedeatialModel> billdevicedeatialList;
/** 子表数据 **/
@JsonProperty("billotherdeatialList")
private List<BillotherdeatialModel> billotherdeatialList;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 账单号 **/
@JsonProperty("billNumbe")
private String billNumbe;
/** 合同名称 **/
@JsonProperty("contractId")
private String contractId;
/** 账单状态 **/
@JsonProperty("billStatus")
private Object billStatus;
/** 商户名称 **/
@JsonProperty("merchantId")
private String merchantId;
/** 开始时间 **/
@JsonProperty("startTime")
private String startTime;
/** 结束时间 **/
@JsonProperty("endTime")
private String endTime;
/** 账单金额 **/
@JsonProperty("billAmount")
private BigDecimal billAmount;
/** 通知方式 **/
@JsonProperty("notificationMethod")
private Object notificationMethod;
/** 通知时间 **/
@JsonProperty("noticeTime")
private String noticeTime;
/** 通知状态 **/
@JsonProperty("notificationState")
private Object notificationState;
/** 支付方式 **/
@JsonProperty("payStatus")
private Object payStatus;
/** 支付金额 **/
@JsonProperty("payAmount")
private BigDecimal payAmount;
/** 确认人 **/
@JsonProperty("confirmPersonnel")
private String confirmPersonnel;
/** 确认时间 **/
@JsonProperty("confirmTime")
private String confirmTime;
/** 相关附件 **/
@JsonProperty("billAttachment")
private Object billAttachment;
/** 合同名称 **/
@JsonProperty("contractName")
private String contractName;
/** 商户名称 **/
@JsonProperty("merchantName")
private String merchantName;
/** 创建时间 **/
@JsonProperty("creationTime")
private String creationTime;
/** 合同编号 **/
@JsonProperty("contractNumber")
private String contractNumber;
}

@ -0,0 +1,42 @@
package jnpf.model.billtable;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* BillTable
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-22
*/
@Data
public class BillTablePagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 提交时间 */
@JsonProperty("creationTime")
private Object creationTime;
/** 商户名称 */
@JsonProperty("merchantName")
private Object merchantName;
/** 合同名称 */
@JsonProperty("contractName")
private Object contractName;
/** 账单状态 */
@JsonProperty("billStatus")
private Object billStatus;
}

@ -0,0 +1,45 @@
package jnpf.model.billtable;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* BillTable
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
@Data
public class BilldevicedeatialModel {
/** 租赁单号 **/
@JSONField(name = "leaseNumber")
private String leaseNumber;
/** 设备编码 **/
@JSONField(name = "equipmentNumber")
private String equipmentNumber;
/** 设备名称 **/
@JSONField(name = "equipmentName")
private String equipmentName;
/** 开始时间 **/
@JSONField(name = "startTime")
private Long startTime;
/** 结束时间 **/
@JSONField(name = "endTime")
private Long endTime;
/** 账单金额 **/
@JSONField(name = "billAmount")
private BigDecimal billAmount;
/** 费用说明 **/
@JSONField(name = "costDescription")
private String costDescription;
}

@ -0,0 +1,39 @@
package jnpf.model.billtable;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* BillTable
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
@Data
public class BillotherdeatialModel {
/** 使用量 **/
@JSONField(name = "useAmount")
private String useAmount;
/** 开始时间 **/
@JSONField(name = "startTime")
private Long startTime;
/** 结束时间 **/
@JSONField(name = "endTime")
private Long endTime;
/** 账单金额 **/
@JSONField(name = "billAmount")
private BigDecimal billAmount;
/** 费用说明 **/
@JSONField(name = "costDescription")
private String costDescription;
}

@ -0,0 +1,42 @@
package jnpf.model.billtable;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* BillTable
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-07-22
*/
@Data
public class BillspacedetailModel {
/** 空间编码 **/
@JSONField(name = "spaceNumber")
private String spaceNumber;
/** 空间名称 **/
@JSONField(name = "spaceId")
private String spaceId;
/** 开始时间 **/
@JSONField(name = "startTime")
private Long startTime;
/** 结束时间 **/
@JSONField(name = "endTime")
private Long endTime;
/** 账单金额 **/
@JSONField(name = "billAmount")
private BigDecimal billAmount;
/** 费用说明 **/
@JSONField(name = "costDescription")
private String costDescription;
}

@ -0,0 +1,52 @@
package jnpf.model.contract;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class ContractDTO implements Serializable {
/**
* id
*/
private String id;
/**
*
*/
private String contractNumber;
/**
*
*/
private String contractName;
/**
* id
*/
private String merchantId;
/**
* id
*/
private String merchantName;
/**
* id
*/
private String spaceNumber;
/**
*
*/
private String spaceId;
/**
*
*/
private Date startTime;
/**
*
*/
private Date endTime;
/**
*
*/
private BigDecimal totalRentalPrice;
}

@ -0,0 +1,45 @@
package jnpf.model.contract;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class ContractDevicesDTO implements Serializable {
/**
* id
*/
private String id;
/**
*
*/
private Date startTime;
/**
*
*/
private Date endTime;
/**
*
*/
private BigDecimal totalRentalPrice;
/**
*
*/
private String leaseNumber;
/**
*
*/
private String equipmentNumber;
/**
*
*/
private String equipmentName;
}

@ -7,10 +7,11 @@ import java.util.List;
/**
* Contract
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
* @ 2024-07-19
*/
@Data
public class ContractForm {
@ -39,8 +40,8 @@ public class ContractForm {
@JsonProperty("parkId")
private Object parkId;
/** 商户名称 **/
@JsonProperty("merchantName")
private Object merchantName;
@JsonProperty("merchantId")
private Object merchantId;
/** 租金总价 **/
@JsonProperty("totalRentalPrice")
private String totalRentalPrice;

@ -3,11 +3,12 @@ package jnpf.model.contract;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* Contract
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
@ -15,34 +16,62 @@ import java.util.List;
*/
@Data
public class ContractPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
/**
* key
*/
private String[] selectKey;
/**
* json
*/
private String json;
/**
* 0-1-
*/
private String dataType;
/**
*
*/
private String superQueryJson;
/**
* id
*/
private String moduleId;
/** 菜单id */
/**
* id
*/
private String menuId;
/** 申请时间 */
/**
*
*/
@JsonProperty("creationTime")
private Object creationTime;
/** 商户名称 */
/**
*
*/
@JsonProperty("merchantName")
private Object merchantName;
/** 合同状态 */
/**
*
*/
@JsonProperty("contractStatus")
private Object contractStatus;
/** 合同名称 */
/**
*
*/
@JsonProperty("contractName")
private Object contractName;
/** 合同编号 */
/**
*
*/
@JsonProperty("contractNumber")
private Object contractNumber;
/** 园区名称 */
/**
*
*/
@JsonProperty("parkId")
private Object parkId;
/**
* id
**/
private String contractId;
}

@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-07-16
* 2024-07-19
*/
@Data
public class SpacecontractModel {
@ -22,8 +22,8 @@ public class SpacecontractModel {
@JSONField(name = "contractLineNumber")
private String contractLineNumber;
/** 空间名称 **/
@JSONField(name = "spaceName")
private String spaceName;
@JSONField(name = "spaceId")
private String spaceId;
/** 空间面积 **/
@JSONField(name = "spaceArea")
private String spaceArea;

@ -0,0 +1,71 @@
package jnpf.model.decorationapplicationform;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* DecorationApplicationForm
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
public class DecorationApplicationFormForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 申请单号 **/
@JsonProperty("applicationNumber")
private String applicationNumber;
/** 商户名称 **/
@JsonProperty("merchantId")
private String merchantId;
/** 合同名称 **/
@JsonProperty("contractId")
private String contractId;
/** 空间名称 **/
@JsonProperty("spaceId")
private String spaceId;
/** 预计开始时间 **/
@JsonProperty("expectedStartTime")
private String expectedStartTime;
/** 预计结束时间 **/
@JsonProperty("expectedEndTime")
private String expectedEndTime;
/** 联系人 **/
@JsonProperty("contacts")
private String contacts;
/** 联系电话 **/
@JsonProperty("contactsPhone")
private String contactsPhone;
/** 押金金额 **/
@JsonProperty("depositAmount")
private String depositAmount;
/** 押金是否退回 **/
@JsonProperty("isTheDepositRefunded")
private Object isTheDepositRefunded;
/** 押金退回日期 **/
@JsonProperty("depositRefundDate")
private String depositRefundDate;
/** 装修进度 **/
@JsonProperty("decorationProgress")
private Object decorationProgress;
/** 实地照片 **/
@JsonProperty("fieldPhoto")
private Object fieldPhoto;
/** 创建时间 **/
@JsonProperty("creationTime")
private String creationTime;
/** 商户名称 **/
@JsonProperty("merchantName")
private String merchantName;
/** 空间名称 **/
@JsonProperty("spaceName")
private String spaceName;
}

@ -0,0 +1,42 @@
package jnpf.model.decorationapplicationform;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* DecorationApplicationForm
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
public class DecorationApplicationFormPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 提交日期 */
@JsonProperty("creationTime")
private Object creationTime;
/** 商户名称 */
@JsonProperty("merchantName")
private Object merchantName;
/** 空间名称 */
@JsonProperty("spaceName")
private Object spaceName;
/** 装修进度 */
@JsonProperty("decorationProgress")
private Object decorationProgress;
}

@ -0,0 +1,62 @@
package jnpf.model.equipment;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Equipment
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-15
*/
@Data
public class EquipmentForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 设备编码 **/
@JsonProperty("code")
private String code;
/** 设备名称 **/
@JsonProperty("name")
private String name;
/** 设备类型 **/
@JsonProperty("type")
private Object type;
/** 设备品牌 **/
@JsonProperty("brand")
private String brand;
/** 设备型号 **/
@JsonProperty("model")
private String model;
/** 批次号 **/
@JsonProperty("batchNumber")
private String batchNumber;
/** 供应商 **/
@JsonProperty("supplier")
private String supplier;
/** 供应商联系电话 **/
@JsonProperty("supplierPhone")
private String supplierPhone;
/** 设备状态 **/
@JsonProperty("status")
private Object status;
/** 保修期 **/
@JsonProperty("defectsLiabilityPeriod")
private String defectsLiabilityPeriod;
/** 保修开始时间 **/
@JsonProperty("warrantyStartTime")
private String warrantyStartTime;
/** 保修结束时间 **/
@JsonProperty("warrantyEndTime")
private String warrantyEndTime;
/** 设备描述 **/
@JsonProperty("description")
private String description;
}

@ -0,0 +1,42 @@
package jnpf.model.equipment;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* Equipment
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-15
*/
@Data
public class EquipmentPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 设备类型 */
@JsonProperty("type")
private Object type;
/** 设备品牌 */
@JsonProperty("brand")
private Object brand;
/** 设备名称 */
@JsonProperty("name")
private Object name;
/** 设备编码 */
@JsonProperty("code")
private Object code;
}

@ -0,0 +1,47 @@
package jnpf.model.equipmentinspectionrecords;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* EquipmentInspectionRecords
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Data
public class EquipmentInspectionRecordsForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 巡检单号 **/
@JsonProperty("inspectionTicketNumber")
private String inspectionTicketNumber;
/** 空间 **/
@JsonProperty("spaceId")
private String spaceId;
/** 空间名称 **/
@JsonProperty("spaceName")
private String spaceName;
/** 设备 **/
@JsonProperty("equipmentId")
private String equipmentId;
/** 设备编码 **/
@JsonProperty("equipmentNumber")
private String equipmentNumber;
/** 设备名称 **/
@JsonProperty("equipmentName")
private String equipmentName;
/** 设备状态 **/
@JsonProperty("equipmentStatus")
private Object equipmentStatus;
/** 巡检照片 **/
@JsonProperty("inspectionPhotos")
private Object inspectionPhotos;
}

@ -0,0 +1,42 @@
package jnpf.model.equipmentinspectionrecords;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* EquipmentInspectionRecords
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Data
public class EquipmentInspectionRecordsPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 巡检单号 */
@JsonProperty("inspectionTicketNumber")
private Object inspectionTicketNumber;
/** 空间名称 */
@JsonProperty("spaceName")
private Object spaceName;
/** 设备编码 */
@JsonProperty("equipmentNumber")
private Object equipmentNumber;
/** 设备名称 */
@JsonProperty("equipmentName")
private Object equipmentName;
}

@ -0,0 +1,73 @@
package jnpf.model.equipmentmaintenancerecords;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* EquipmentMaintenanceRecords
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Data
public class EquipmentMaintenanceRecordsForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 维修单号 **/
@JsonProperty("repairOrderNumber")
private String repairOrderNumber;
/** 报修单 **/
@JsonProperty("repairOrderId")
private String repairOrderId;
/** 设备编码 **/
@JsonProperty("number")
private String number;
/** 设备名称 **/
@JsonProperty("name")
private String name;
/** 维修方式 **/
@JsonProperty("maintenanceMethods")
private Object maintenanceMethods;
/** 维修进度 **/
@JsonProperty("maintenancePlan")
private Object maintenancePlan;
/** 维修人 **/
@JsonProperty("maintenancePersonnel")
private String maintenancePersonnel;
/** 维修时间 **/
@JsonProperty("maintenanceDate")
private String maintenanceDate;
/** 是否产生费用 **/
@JsonProperty("expensesIncurred")
private Object expensesIncurred;
/** 费用金额 **/
@JsonProperty("costAmount")
private String costAmount;
/** 是否计入租户账单 **/
@JsonProperty("tenantBill")
private Object tenantBill;
/** 费用说明 **/
@JsonProperty("costDetail")
private String costDetail;
/** 维修描述 **/
@JsonProperty("maintenanceDescribe")
private String maintenanceDescribe;
/** 维修照片 **/
@JsonProperty("repairPhoto")
private Object repairPhoto;
/** 设备id **/
@JsonProperty("equipmentId")
private String equipmentId;
@JsonProperty("spaceId")
private String spaceId;
@JsonProperty("spaceName")
private String spaceName;
}

@ -0,0 +1,42 @@
package jnpf.model.equipmentmaintenancerecords;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* EquipmentMaintenanceRecords
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-19
*/
@Data
public class EquipmentMaintenanceRecordsPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 维修时间 */
@JsonProperty("maintenanceDate")
private Object maintenanceDate;
/** 设备编码 */
@JsonProperty("number")
private Object number;
/** 设备名称 */
@JsonProperty("name")
private Object name;
/** 维修进度 */
@JsonProperty("maintenancePlan")
private Object maintenancePlan;
}

@ -0,0 +1,80 @@
package jnpf.model.equipmentrentalrecords;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* EquipmentRentalRecords
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-17
*/
@Data
public class EquipmentRentalRecordsForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 租赁单号 **/
@JsonProperty("leaseNumber")
private String leaseNumber;
/** 开始时间 **/
@JsonProperty("startTime")
private String startTime;
/** 结束时间 **/
@JsonProperty("endTime")
private String endTime;
/** 设备名称 **/
@JsonProperty("equipmentId")
private String equipmentId;
/** 租赁总价 **/
@JsonProperty("totalLeasePrice")
private String totalLeasePrice;
/** 租赁押金 **/
@JsonProperty("leaseDeposit")
private String leaseDeposit;
/** 商户名称 **/
@JsonProperty("merchantId")
private String merchantId;
/** 联系人 **/
@JsonProperty("contacts")
private String contacts;
/** 联系电话 **/
@JsonProperty("contactsPhone")
private String contactsPhone;
/** 租赁状态 **/
@JsonProperty("leaseStatus")
private Object leaseStatus;
/** 附件 **/
@JsonProperty("enclosure")
private Object enclosure;
/** 设备编码 **/
@JsonProperty("equipmentCoding")
private String equipmentCoding;
/** 归还人 **/
@JsonProperty("returnedBy")
private String returnedBy;
/** 归还时间 **/
@JsonProperty("returnTime")
private String returnTime;
/** 归还状态 **/
@JsonProperty("returnStatus")
private Object returnStatus;
/** 归还说明 **/
@JsonProperty("remarks")
private String remarks;
/** 创建时间 **/
@JsonProperty("creationTime")
private String creationTime;
/** 设备名称 **/
@JsonProperty("equipmentName")
private String equipmentName;
/** 商户名称 **/
@JsonProperty("merchantName")
private String merchantName;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save