提交 13b89d8f authored 作者: 邓砥奕's avatar 邓砥奕

代码提交

上级 623aa443
package com.example.removetolocal.newentity;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.persistence.*;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import java.util.Date;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
/**
* entity class for device_library
*/
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "device_library")
public class DeviceLibrary {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
/**
* createTime
*/
@Column(name = "create_time")
@CreatedDate
private java.util.Date createTime;
/**
* createUserId
*/
@Column(name = "create_user_id")
@CreatedBy
private Integer createUserId;
/**
* deleteTag
*/
@Column(name = "delete_tag")
private Integer deleteTag;
/**
* invisibleRange
*/
@Column(name = "invisible_range")
private Integer invisibleRange;
/**
* isPart
*/
@Column(name = "is_part")
private Integer isPart;
/**
* lifeStatus
*/
@Column(name = "life_status")
private Integer lifeStatus;
/**
* locationUnit
*/
@Column(name = "location_unit")
private String locationUnit;
/**
* lockStatus
*/
@Column(name = "lock_status")
private Integer lockStatus;
/**
* manageStatus
*/
@Column(name = "manage_status")
private Integer manageStatus;
/**
* matchingRange
*/
@Column(name = "matching_range")
private Integer matchingRange;
/**
* model
*/
@Column(name = "model")
private String model;
/**
* name
*/
@Column(name = "name")
private String name;
/**
* ownUnit
*/
@Column(name = "own_unit")
private String ownUnit;
/**
* packingId
*/
@Column(name = "packing_id")
private Integer packingId;
/**
* partParentId
*/
@Column(name = "part_parent_id")
private Integer partParentId;
/**
* prodNumber
*/
@Column(name = "prod_number")
private String prodNumber;
/**
* rfidCardId
*/
@Column(name = "rfid_card_id")
private String rfidCardId;
/**
* rfidSurfaceId
*/
@Column(name = "rfid_surface_id")
private String rfidSurfaceId;
/**
* secretLevel
*/
@Column(name = "secret_level")
private Integer secretLevel;
/**
* seqNumber
*/
@Column(name = "seq_number")
private String seqNumber;
/**
* storageBillId
*/
@Column(name = "storage_bill_id")
private Integer storageBillId;
/**
* storageType
*/
@Column(name = "storage_type")
private Integer storageType;
/**
* type
*/
@Column(name = "type")
private Integer type;
/**
* updateTime
*/
@Column(name = "update_time")
@LastModifiedDate
private java.util.Date updateTime;
/**
* updateUserId
*/
@Column(name = "update_user_id")
@LastModifiedBy
private Integer updateUserId;
/**
* imageName
*/
@Column(name = "image_name")
private String imageName;
/**
* imageUrl
*/
@Column(name = "image_url")
private String imageUrl;
/**
* position
*/
@Column(name = "position")
private String position;
/**
* recordId
*/
@Column(name = "record_id")
private String recordId;
}
...@@ -47,7 +47,7 @@ public class DeviceLog { ...@@ -47,7 +47,7 @@ public class DeviceLog {
* deleteTag * deleteTag
*/ */
@Column(name = "delete_tag") @Column(name = "delete_tag")
private Integer deleteTag; private Integer deleteTag = 0;
/** /**
* deviceId * deviceId
*/ */
...@@ -72,7 +72,7 @@ public class DeviceLog { ...@@ -72,7 +72,7 @@ public class DeviceLog {
* type * type
*/ */
@Column(name = "type") @Column(name = "type")
private Integer type; private Integer type = 0;
/** /**
* updateTime * updateTime
*/ */
...@@ -86,14 +86,12 @@ public class DeviceLog { ...@@ -86,14 +86,12 @@ public class DeviceLog {
@LastModifiedBy @LastModifiedBy
private Integer updateUserId; private Integer updateUserId;
/** /**
* userId
*/
@Column(name = "user_id")
private Integer userId;
/**
* recordId * recordId
*/ */
@Column(name = "record_id") @Column(name = "record_id")
private String recordId; private String recordId;
@Column(name = "old_id")
private Integer oldId;
} }
package com.example.removetolocal.newentity;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.persistence.*;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import java.util.Date;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
/**
* entity class for packing_library
*/
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "packing_library")
public class PackingLibrary {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
/**
* applyType
*/
@Column(name = "apply_type")
private Integer applyType;
/**
* createTime
*/
@Column(name = "create_time")
@CreatedDate
private java.util.Date createTime;
/**
* createUnit
*/
@Column(name = "create_unit")
private String createUnit;
/**
* createUserId
*/
@Column(name = "create_user_id")
@CreatedBy
private Integer createUserId;
/**
* deleteTag
*/
@Column(name = "delete_tag")
private Integer deleteTag;
/**
* exitTime
*/
@Column(name = "exit_time")
private java.util.Date exitTime;
/**
* fileName
*/
@Column(name = "file_name")
private String fileName;
/**
* fileUrl
*/
@Column(name = "file_url")
private String fileUrl;
/**
* imageName
*/
@Column(name = "image_name")
private String imageName;
/**
* imageUrl
*/
@Column(name = "image_url")
private String imageUrl;
/**
* invisibleRange
*/
@Column(name = "invisible_range")
private Integer invisibleRange;
/**
* isPart
*/
@Column(name = "is_part")
private Integer isPart;
/**
* matchingRange
*/
@Column(name = "matching_range")
private Integer matchingRange;
/**
* model
*/
@Column(name = "model")
private String model;
/**
* name
*/
@Column(name = "name")
private String name;
/**
* nature
*/
@Column(name = "nature")
private Integer nature;
/**
* packingStatus
*/
@Column(name = "packing_status")
private Integer packingStatus;
/**
* partParentId
*/
@Column(name = "part_parent_id")
private Integer partParentId;
/**
* price
*/
@Column(name = "price")
private String price;
/**
* prodUnit
*/
@Column(name = "prod_unit")
private String prodUnit;
/**
* secretLevel
*/
@Column(name = "secret_level")
private Integer secretLevel;
/**
* status
*/
@Column(name = "status")
private Integer status;
/**
* type
*/
@Column(name = "type")
private Integer type;
/**
* updateTime
*/
@Column(name = "update_time")
@LastModifiedDate
private java.util.Date updateTime;
/**
* updateUserId
*/
@Column(name = "update_user_id")
@LastModifiedBy
private Integer updateUserId;
/**
* useraid
*/
@Column(name = "useraid")
private Integer useraid;
/**
* userbid
*/
@Column(name = "userbid")
private Integer userbid;
/**
* useraId
*/
@Column(name = "usera_id")
private Integer useraId;
/**
* userbId
*/
@Column(name = "userb_id")
private Integer userbId;
/**
* isRoot
*/
@Column(name = "is_root")
private Integer isRoot;
/**
* showOrder
*/
@Column(name = "show_order")
private Integer showOrder;
/**
* style
*/
@Column(name = "style")
private Integer style;
/**
* recordId
*/
@Column(name = "record_id")
private String recordId;
}
...@@ -52,7 +52,7 @@ public class StorageBill { ...@@ -52,7 +52,7 @@ public class StorageBill {
* deleteTag * deleteTag
*/ */
@Column(name = "delete_tag") @Column(name = "delete_tag")
private Integer deleteTag; private Integer deleteTag = 0;
/** /**
* fileName * fileName
*/ */
...@@ -106,7 +106,7 @@ public class StorageBill { ...@@ -106,7 +106,7 @@ public class StorageBill {
/** /**
* storageDetail * storageDetail
*/ */
@Column(name = "storage_detail") @Column(name = "storage_detail",columnDefinition="TEXT")
private String storageDetail; private String storageDetail;
/** /**
* storageStatus * storageStatus
......
package com.example.removetolocal.newentity;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.persistence.*;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import java.util.Date;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
/**
* entity class for user
*/
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "user")
public class User {
/**
* userId
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "user_id")
private Integer userId;
/**
* email
*/
@Column(name = "email")
private String email;
/**
* fax
*/
@Column(name = "fax")
private String fax;
/**
* idCard
*/
@Column(name = "id_card")
private String idCard;
/**
* isDel
*/
@Column(name = "is_del")
private Integer isDel;
/**
* mobile
*/
@Column(name = "mobile")
private String mobile;
/**
* name
*/
@Column(name = "name")
private String name;
/**
* password
*/
@Column(name = "password")
private String password;
/**
* position
*/
@Column(name = "position")
private Integer position;
/**
* sex
*/
@Column(name = "sex")
private Integer sex;
/**
* showOrder
*/
@Column(name = "show_order")
private Integer showOrder;
/**
* telphone
*/
@Column(name = "telphone")
private String telphone;
/**
* trainStatus
*/
@Column(name = "train_status")
private Integer trainStatus;
/**
* unitsId
*/
@Column(name = "units_id")
private Integer unitsId;
/**
* username
*/
@Column(name = "username")
private String username;
/**
* noPassword
*/
@Column(name = "no_password")
private String noPassword;
}
package com.example.removetolocal.newentity.dao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.Date;
import java.util.List;
/**
* @author dengdiyi
*/
@SuppressWarnings("SqlResolve")
public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, JpaSpecificationExecutor<DeviceLibrary> {
List<DeviceLibrary> getAllByModel(String model);
List<DeviceLibrary> getAllByOwnUnit(String unit);
List<DeviceLibrary> getAllByTypeAndNameAndModel(Integer type, String name, String model);
/**
* 根据装备型号与装备所在地(多个地区)查询装备数量
*
* @param model 装备型号
* @param locations 装备所在地列表
* @return 装备数量
*/
int countByModelAndLocationUnitIn(String model, List<String> locations);
/**
* 根据装备型号与装备所在地(一个地区)查询装备数量
*
* @param model 装备型号
* @param location 装备所在地
* @return 装备数量
*/
int countByModelAndLocationUnit(String model, String location);
List<DeviceLibrary> getAllByPartParentIdAndIsPart(Integer parentId, Integer isPart);
List<DeviceLibrary> getAllByRfidCardId(String rfidCardId);
@Query(nativeQuery = true, value = "select * from device_library where id in :idList")
List<DeviceLibrary> getDeviceLibraryEntitiesByIdIn(@Param("idList") List<Integer> idList);
List<DeviceLibrary> getAllByRfidSurfaceId(String rfid);
@Query("select o from DeviceLibrary o where o.ownUnit= :unitName and o.createTime >= :startTime and o.createTime <= :endTime")
List<DeviceLibrary> findAllByUnitBetweenTime(String unitName, Date startTime, Date endTime);
List<DeviceLibrary> getAllByPackingId(Integer packingId);
}
package com.example.removetolocal.newentity.dao;
import com.tykj.dev.rfid.entity.domin.InputOutputDevice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author HuangXiahao
* @version V1.0
* @packageName com.tykj.dev.rfid.repository
**/
public interface InputOutputDeviceDao extends JpaRepository<InputOutputDevice, Integer>, JpaSpecificationExecutor<InputOutputDevice> {
List<InputOutputDevice> findAllByUnitIdAndDirection(Integer unitId,Integer direction);
List<InputOutputDevice> findAllByIsRead(Integer isRead);
}
package com.example.removetolocal.newentity.dao;
import com.tykj.dev.rfid.entity.domin.LibraryWarningLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author dengdiyi
*/
public interface LibraryWarningLogDao extends JpaRepository<LibraryWarningLog, Integer>, JpaSpecificationExecutor<LibraryWarningLog> {
}
package com.example.removetolocal.newentity.dao;
import com.tykj.dev.rfid.entity.domin.LibraryWarningLogDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author dengdiyi
*/
public interface LibraryWarningLogDetailDao extends JpaRepository<LibraryWarningLogDetail, Integer>, JpaSpecificationExecutor<LibraryWarningLogDetail> {
}
package com.example.removetolocal.newentity.dao;
import com.example.removetolocal.newentity.PackingLibrary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author dengdiyi
*/
public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer>, JpaSpecificationExecutor<PackingLibrary> {
List<PackingLibrary> findAllByPartParentId(Integer id);
}
package com.example.removetolocal.newentity.dao;
import com.tykj.dev.device.train.entity.TrainTheme;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName TrainDao.java
* @Description TODO
* @createTime 2020年08月13日 15:19:00
*/
public interface TrainThemeDao extends JpaRepository<TrainTheme, Integer>, JpaSpecificationExecutor<TrainTheme> {
List<TrainTheme> findAllByTrainStatus(Integer status);
}
package com.example.removetolocal.newentity.dao;
import com.tykj.dev.device.train.entity.TrainUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName TrainUserDao.java
* @Description TODO
* @createTime 2020年12月01日 13:55:00
*/
public interface TrainUserDao extends JpaRepository<TrainUser, Integer>, JpaSpecificationExecutor<TrainUser> {
TrainUser findByUserIdAndTrainId(Integer userId,Integer trainId);
List<TrainUser> findAllByIsSignUpAndTrainId(Integer IsSignUp,Integer trainId);
List<TrainUser> findAllByTrainId(Integer trainId);
List<TrainUser> findAllByUnitsIdAndTrainId(Integer unitId,Integer userId);
}
package com.example.removetolocal.olddevice.dao;
import com.example.removetolocal.olddevice.domin.DevOptlog;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface DevOptlogDao extends JpaRepository<DevOptlog,Integer> {
List<DevOptlog> findAllByBillidAndOptType(Integer billId,Integer type);
}
package com.example.removetolocal.newentity; package com.example.removetolocal.olddevice.domin;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
...@@ -15,14 +12,14 @@ import org.springframework.data.annotation.LastModifiedBy; ...@@ -15,14 +12,14 @@ import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
/** /**
* entity class for mgrcert * entity class for dev_optlog
* 设备操作日志
*/ */
@Data @Data
@Entity @Entity
@AllArgsConstructor @EntityListeners(AuditingEntityListener.class)
@NoArgsConstructor @Table(name = "dev_optlog")
@Table(name = "mgrcert") public class DevOptlog {
public class Mgrcert {
/** /**
* id * id
...@@ -32,39 +29,64 @@ public class Mgrcert { ...@@ -32,39 +29,64 @@ public class Mgrcert {
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
/** /**
* certName * catalogid
*/
@Column(name = "catalogid")
private Integer catalogid;
/**
* 设备id
*/
@Column(name = "devId")
private Integer devId;
/**
* 操作时间
*/
@Column(name = "optTime")
private java.util.Date optTime;
/**
* 结束时间
*/
@Column(name = "overTime")
private java.util.Date overTime;
/**
* 操作类型
*/
@Column(name = "optType")
private Integer optType;
/**
* 单据ID
*/ */
@Column(name = "cert_name") @Column(name = "billid")
private String certName; private Integer billid;
/** /**
* certNum * optUser
*/ */
@Column(name = "cert_num") @Column(name = "optUser")
private Integer certNum; private String optUser;
/** /**
* expiryDate * srcCompany
*/ */
@Column(name = "expiry_date") @Column(name = "srcCompany")
private java.util.Date expiryDate; private String srcCompany;
/** /**
* isExpiry * descCompany
*/ */
@Column(name = "is_expiry") @Column(name = "descCompany")
private Integer isExpiry; private String descCompany;
/** /**
* issueDate * optcontent
*/ */
@Column(name = "issue_date") @Column(name = "optcontent")
private java.util.Date issueDate; private String optcontent;
/** /**
* name * 单据HTML内容
*/ */
@Column(name = "name") @Column(name = "billfile")
private String name; private Integer billfile;
/** /**
* userId * 是否有效。撤回则无效
*/ */
@Column(name = "user_id") @Column(name = "isValid")
private Integer userId; private Integer isValid;
} }
package com.example.removetolocal.oldentity;
import lombok.Data;
import javax.persistence.*;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import java.util.Date;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
/**
* entity class for dev_instorage
* 入库单
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "dev_instorage")
public class DevInstorage {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
/**
* 申请文号
*/
@Column(name = "applyDocNo")
private String applyDocNo;
/**
* 批复文号
*/
@Column(name = "replyDocNo")
private String replyDocNo;
/**
* 配发单位
*/
@Column(name = "issueUnit")
private String issueUnit;
/**
* 发送时间
*/
@Column(name = "issueTime")
private java.util.Date issueTime;
/**
* 发件人
*/
@Column(name = "sender")
private String sender;
/**
* 核发人
*/
@Column(name = "approver")
private String approver;
/**
* 经办人
*/
@Column(name = "handle")
private String handle;
/**
* 签收人
*/
@Column(name = "signatory")
private String signatory;
/**
* signUnit
*/
@Column(name = "signUnit")
private String signUnit;
/**
* signTime
*/
@Column(name = "signTime")
private java.util.Date signTime;
/**
* 附件
*/
@Column(name = "annex")
private String annex;
/**
* 备注
*/
@Column(name = "remark")
private String remark;
/**
* 入库设备数量
*/
@Column(name = "total")
private Integer total;
/**
* 0 草稿 1待入库 2 已入库
*/
@Column(name = "status")
private Integer status;
/**
* createUser
*/
@Column(name = "createUser")
private String createUser;
/**
* createTime
*/
@Column(name = "createTime")
private java.util.Date createTime;
/**
* updateUser
*/
@Column(name = "updateUser")
private String updateUser;
/**
* updateTime
*/
@Column(name = "updateTime")
private java.util.Date updateTime;
/**
* recordIds
*/
@Column(name = "recordIds")
private String recordIds;
}
package com.example.removetolocal.newentity; package com.example.removetolocal.oldentity;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
...@@ -15,14 +12,14 @@ import org.springframework.data.annotation.LastModifiedBy; ...@@ -15,14 +12,14 @@ import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
/** /**
* entity class for area * entity class for dev_instoragedetail
* 入库明细
*/ */
@Data @Data
@Entity @Entity
@AllArgsConstructor @EntityListeners(AuditingEntityListener.class)
@NoArgsConstructor @Table(name = "dev_instoragedetail")
@Table(name = "area") public class DevInstoragedetail {
public class Area {
/** /**
* id * id
...@@ -32,24 +29,49 @@ public class Area { ...@@ -32,24 +29,49 @@ public class Area {
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
/** /**
* fatherId * pid
*/
@Column(name = "pid")
private Integer pid;
/**
* 入库单ID
*/ */
@Column(name = "father_id") @Column(name = "insId")
private Integer fatherId; private Integer insId;
/** /**
* name * 列装设备ID
*/ */
@Column(name = "name") @Column(name = "catalogId")
private String name; private Integer catalogId;
/** /**
* orders * 型号
*/ */
@Column(name = "orders") @Column(name = "model")
private String orders; private String model;
/** /**
* type * sernum
*/
@Column(name = "sernum")
private String sernum;
/**
* pronum
*/
@Column(name = "pronum")
private String pronum;
/**
* 类型 横向 纵向 代管
*/ */
@Column(name = "type") @Column(name = "type")
private Integer type; private Integer type;
/**
* 入库数量
*/
@Column(name = "num")
private Integer num;
/**
* 序列号是否自动生成
*/
@Column(name = "isAutoGen")
private Boolean isAutoGen;
} }
package com.example.removetolocal.newentity; package com.example.removetolocal.oldentity;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
...@@ -15,51 +12,50 @@ import org.springframework.data.annotation.LastModifiedBy; ...@@ -15,51 +12,50 @@ import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
/** /**
* entity class for units * entity class for sys_file
*/ */
@Data @Data
@Entity @Entity
@AllArgsConstructor @EntityListeners(AuditingEntityListener.class)
@NoArgsConstructor @Table(name = "sys_file")
@Table(name = "units") public class SysFile {
public class Units {
/** /**
* unitId * fileid
*/ */
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "unit_id") @Column(name = "FILEID")
private Integer unitId; private Integer fileid;
/** /**
* areaId * filename
*/ */
@Column(name = "area_id") @Column(name = "FILENAME")
private Integer areaId; private String filename;
/** /**
* code * filepath
*/ */
@Column(name = "code") @Column(name = "FILEPATH")
private String code; private String filepath;
/** /**
* idDel * filetype
*/ */
@Column(name = "id_del") @Column(name = "FILETYPE")
private Integer idDel; private String filetype;
/** /**
* level * filesize
*/ */
@Column(name = "level") @Column(name = "FILESIZE")
private Integer level; private String filesize;
/** /**
* name * creator
*/ */
@Column(name = "name") @Column(name = "CREATOR")
private String name; private String creator;
/** /**
* unitDesc * creatertime
*/ */
@Column(name = "unit_desc") @Column(name = "CREATERTIME")
private String unitDesc; private java.util.Date creatertime;
} }
package com.example.removetolocal.oldentity.dao;
import com.example.removetolocal.oldentity.DevInstorage;
import org.springframework.data.jpa.repository.JpaRepository;
public interface DevInstorageDao extends JpaRepository<DevInstorage,Integer> {
}
package com.example.removetolocal.oldentity.dao;
import com.example.removetolocal.oldentity.DevInstoragedetail;
import org.springframework.data.jpa.repository.JpaRepository;
public interface DevInstoragedetailDao extends JpaRepository<DevInstoragedetail,Integer> {
}
package com.example.removetolocal.oldentity.dao;
import com.example.removetolocal.oldentity.SysFile;
import org.springframework.data.jpa.repository.JpaRepository;
public interface SysFileDao extends JpaRepository<SysFile, Integer> {
}
package com.example.removetolocal.service;
public interface StorageService {
/**
* 入库业务转换
*/
void moveStorage();
}
package com.example.removetolocal.service; package com.example.removetolocal.service;
import com.example.removetolocal.newuser.domin.User;
public interface UserService { public interface UserService {
/** /**
* 区域、部门、用户 * 区域、部门、用户
*/ */
void changeEntity(); void changeEntity();
User getUserByOldId(String oldId);
String getUserNameByOldId(String oldId);
String getUnitNameByOldId(String oldId);
} }
...@@ -4,17 +4,20 @@ import com.example.removetolocal.newdevice.dao.DeviceLibraryDao; ...@@ -4,17 +4,20 @@ import com.example.removetolocal.newdevice.dao.DeviceLibraryDao;
import com.example.removetolocal.newdevice.dao.PackingLibraryDao; import com.example.removetolocal.newdevice.dao.PackingLibraryDao;
import com.example.removetolocal.newdevice.domin.DeviceLibrary; import com.example.removetolocal.newdevice.domin.DeviceLibrary;
import com.example.removetolocal.newdevice.domin.PackingLibrary; import com.example.removetolocal.newdevice.domin.PackingLibrary;
import com.example.removetolocal.newentity.DeviceLog;
import com.example.removetolocal.newentity.dao.DeviceLogDao;
import com.example.removetolocal.newuser.dao.UnitsDao; import com.example.removetolocal.newuser.dao.UnitsDao;
import com.example.removetolocal.newuser.dao.UserDao; import com.example.removetolocal.newuser.dao.UserDao;
import com.example.removetolocal.olddevice.dao.DevAcrossunitDao; import com.example.removetolocal.olddevice.dao.*;
import com.example.removetolocal.olddevice.dao.DevCatalogDao;
import com.example.removetolocal.olddevice.dao.DevModelDao;
import com.example.removetolocal.olddevice.dao.DevRecordDao;
import com.example.removetolocal.olddevice.domin.DevCatalogEntity; import com.example.removetolocal.olddevice.domin.DevCatalogEntity;
import com.example.removetolocal.olddevice.domin.DevModelEntity; import com.example.removetolocal.olddevice.domin.DevModelEntity;
import com.example.removetolocal.olddevice.domin.DevOptlog;
import com.example.removetolocal.olddevice.domin.DevRecordEntity; import com.example.removetolocal.olddevice.domin.DevRecordEntity;
import com.example.removetolocal.oldentity.SysFile;
import com.example.removetolocal.oldentity.dao.SysFileDao;
import com.example.removetolocal.olduser.dao.SysCompanyDao; import com.example.removetolocal.olduser.dao.SysCompanyDao;
import com.example.removetolocal.service.DeviceService; import com.example.removetolocal.service.DeviceService;
import com.example.removetolocal.utils.StringSplitUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -43,6 +46,12 @@ public class DeviceServiceImpl implements DeviceService { ...@@ -43,6 +46,12 @@ public class DeviceServiceImpl implements DeviceService {
DevAcrossunitDao devAcrossunitDao; DevAcrossunitDao devAcrossunitDao;
@Autowired @Autowired
SysCompanyDao sysCompanyDao; SysCompanyDao sysCompanyDao;
@Autowired
DevOptlogDao devOptlogDao;
@Autowired
DeviceLogDao deviceLogDao;
@Autowired
SysFileDao sysFileDao;
/** /**
* 列装和装备库转换 * 列装和装备库转换
*/ */
...@@ -52,6 +61,14 @@ public class DeviceServiceImpl implements DeviceService { ...@@ -52,6 +61,14 @@ public class DeviceServiceImpl implements DeviceService {
List<DevCatalogEntity> devCatalogEntities = devCatalogDao.findAll(); List<DevCatalogEntity> devCatalogEntities = devCatalogDao.findAll();
devCatalogEntities.forEach(devCatalogEntity -> { devCatalogEntities.forEach(devCatalogEntity -> {
PackingLibrary packingLibrary = new PackingLibrary(); PackingLibrary packingLibrary = new PackingLibrary();
if (devCatalogEntity.getAnnex()!=null){
List<Integer> ids = StringSplitUtil.fileIdSplit(devCatalogEntity.getAnnex());
if (ids.size()>0){
SysFile sysFile = sysFileDao.findById(ids.get(0)).get();
packingLibrary.setFileName(sysFile.getFilename());
packingLibrary.setFileUrl(sysFile.getFilepath());
}
}
packingLibrary.setCreateTime(devCatalogEntity.getCreatetime()); packingLibrary.setCreateTime(devCatalogEntity.getCreatetime());
packingLibrary.setUpdateTime(devCatalogEntity.getUpdatetime()); packingLibrary.setUpdateTime(devCatalogEntity.getUpdatetime());
if (devCatalogEntity.getCreateuser() != null) { if (devCatalogEntity.getCreateuser() != null) {
...@@ -338,6 +355,26 @@ public class DeviceServiceImpl implements DeviceService { ...@@ -338,6 +355,26 @@ public class DeviceServiceImpl implements DeviceService {
deviceLibraryDao.save(deviceLibrary); deviceLibraryDao.save(deviceLibrary);
} }
}); });
//装备日志
List<DevOptlog> devOptlogs = devOptlogDao.findAll();
devOptlogs.forEach(devOptlog -> {
if (devOptlog.getIsValid()==1) {
DeviceLog deviceLog = new DeviceLog();
deviceLog.setLogTime(devOptlog.getOptTime());
deviceLog.setCreateTime(devOptlog.getOptTime());
if (devOptlog.getOptUser() != null) {
if (userDao.findByOldCode(devOptlog.getOptUser()) != null || userDao.findByOldId(devOptlog.getOptUser()) != null) {
deviceLog.setCreateUserId(userDao.findByOldCode(devOptlog.getOptUser()) == null ? userDao.findByOldId(devOptlog.getOptUser()).getUserId() : userDao.findByOldCode(devOptlog.getOptUser()).getUserId());
}
}
if (deviceLibraryDao.findByOldId(devOptlog.getDevId())!=null) {
deviceLog.setDeviceId(deviceLibraryDao.findByOldId(devOptlog.getDevId()).getId());
}
deviceLog.setRemark(devOptlog.getOptcontent());
deviceLog.setOldId(devOptlog.getId());
deviceLogDao.save(deviceLog);
}
});
} }
/** /**
......
package com.example.removetolocal.service.impl;
import com.example.removetolocal.newdevice.dao.DeviceLibraryDao;
import com.example.removetolocal.newentity.StorageBill;
import com.example.removetolocal.newentity.dao.DeviceLogDao;
import com.example.removetolocal.newentity.dao.StorageBillDao;
import com.example.removetolocal.newuser.dao.UserDao;
import com.example.removetolocal.olddevice.dao.DevOptlogDao;
import com.example.removetolocal.olddevice.domin.DevOptlog;
import com.example.removetolocal.oldentity.DevInstorage;
import com.example.removetolocal.oldentity.SysFile;
import com.example.removetolocal.oldentity.dao.DevInstorageDao;
import com.example.removetolocal.oldentity.dao.DevInstoragedetailDao;
import com.example.removetolocal.oldentity.dao.SysFileDao;
import com.example.removetolocal.service.StorageService;
import com.example.removetolocal.service.UserService;
import com.example.removetolocal.utils.StringSplitUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class StorageServiceImpl implements StorageService {
@Autowired
DevInstorageDao devInstorageDao;
@Autowired
DevInstoragedetailDao devInstoragedetailDao;
@Autowired
StorageBillDao storageBillDao;
@Autowired
UserDao userDao;
@Autowired
SysFileDao sysFileDao;
@Autowired
UserService userService;
@Autowired
DevOptlogDao devOptlogDao;
@Autowired
DeviceLibraryDao deviceLibraryDao;
/**
* 入库业务转换
*/
@Override
public void moveStorage() {
//入库账单转换
List<DevInstorage> devInstorages = devInstorageDao.findAll();
devInstorages.forEach(devInstorage -> {
if (devInstorage.getStatus()!=1) {
StorageBill storageBill = new StorageBill();
storageBill.setApplyNumber(devInstorage.getApplyDocNo());
storageBill.setReplayNumber(devInstorage.getReplyDocNo());
storageBill.setCreateTime(devInstorage.getCreateTime());
storageBill.setUpdateTime(devInstorage.getUpdateTime());
if (devInstorage.getCreateUser() != null) {
if (userDao.findByOldCode(devInstorage.getCreateUser()) != null || userDao.findByOldId(devInstorage.getCreateUser()) != null) {
storageBill.setCreateUserId(userDao.findByOldCode(devInstorage.getCreateUser()) == null ? userDao.findByOldId(devInstorage.getCreateUser()).getUserId() : userDao.findByOldCode(devInstorage.getCreateUser()).getUserId());
}
}
if (devInstorage.getUpdateUser() != null) {
if (userDao.findByOldCode(devInstorage.getUpdateUser()) != null || userDao.findByOldId(devInstorage.getUpdateUser()) != null) {
storageBill.setUpdateUserId(userDao.findByOldCode(devInstorage.getUpdateUser()) == null ? userDao.findByOldId(devInstorage.getUpdateUser()).getUserId() : userDao.findByOldCode(devInstorage.getUpdateUser()).getUserId());
}
}
if (devInstorage.getAnnex() != null) {
List<Integer> ids = StringSplitUtil.fileIdSplit(devInstorage.getAnnex());
if (ids.size() > 0) {
SysFile sysFile = sysFileDao.findById(ids.get(0)).get();
storageBill.setFileName(sysFile.getFilename());
storageBill.setFileUrl(sysFile.getFilepath());
}
}
storageBill.setReceiveUseraId(userService.getUserByOldId(devInstorage.getHandle()).getUserId());
storageBill.setSendTime(devInstorage.getIssueTime());
if (devInstorage.getIssueUnit() != null) {
storageBill.setSendUnit(userService.getUnitNameByOldId(devInstorage.getIssueUnit()));
}
if (devInstorage.getSender() != null) {
storageBill.setSendUserId(userService.getUserNameByOldId(devInstorage.getSender()));
}
storageBill.setStorageStatus(2);
storageBill.setStoragingCount(devInstorage.getTotal());
storageBill.setStoragedCount(devInstorage.getTotal());
//根据日志找到所有入库的装备
List<Integer> deviceOldIds = devOptlogDao.findAllByBillidAndOptType(devInstorage.getId(),12).stream()
.map(DevOptlog::getDevId)
.collect(Collectors.toList());
StringBuffer stringBuffer = new StringBuffer();
deviceOldIds.forEach(integer -> {
if (deviceLibraryDao.findByOldId(integer)!=null){
stringBuffer.append(deviceLibraryDao.findByOldId(integer).getId());
stringBuffer.append("x");
}
});
storageBill.setStorageDetail(stringBuffer.toString());
storageBillDao.save(storageBill);
}
});
}
}
...@@ -8,6 +8,7 @@ import com.example.removetolocal.newuser.domin.Area; ...@@ -8,6 +8,7 @@ import com.example.removetolocal.newuser.domin.Area;
import com.example.removetolocal.newuser.domin.Mgrcert; import com.example.removetolocal.newuser.domin.Mgrcert;
import com.example.removetolocal.newuser.domin.Units; import com.example.removetolocal.newuser.domin.Units;
import com.example.removetolocal.newuser.domin.User; import com.example.removetolocal.newuser.domin.User;
import com.example.removetolocal.olddevice.dao.DevAcrossunitDao;
import com.example.removetolocal.olduser.dao.*; import com.example.removetolocal.olduser.dao.*;
import com.example.removetolocal.olduser.domin.*; import com.example.removetolocal.olduser.domin.*;
import com.example.removetolocal.service.UserService; import com.example.removetolocal.service.UserService;
...@@ -39,6 +40,8 @@ public class UserServiceImpl implements UserService { ...@@ -39,6 +40,8 @@ public class UserServiceImpl implements UserService {
MgrcertDao mgrcertDao; MgrcertDao mgrcertDao;
@Autowired @Autowired
AreaDao areaDao; AreaDao areaDao;
@Autowired
DevAcrossunitDao devAcrossunitDao;
/** /**
* 区域、部门、用户 * 区域、部门、用户
*/ */
...@@ -60,6 +63,26 @@ public class UserServiceImpl implements UserService { ...@@ -60,6 +63,26 @@ public class UserServiceImpl implements UserService {
changeByFatherArea(devAreaEntity1.getId(),fatherId); changeByFatherArea(devAreaEntity1.getId(),fatherId);
} }
@Override
public User getUserByOldId(String oldId) {
return userDao.findByOldCode(oldId) == null ? userDao.findByOldId(oldId) : userDao.findByOldCode(oldId);
}
@Override
public String getUserNameByOldId(String oldId) {
return !sysUserDao.findById(oldId).isPresent() ? devManagerDao.findAllById(oldId).get(0).getUsername():sysUserDao.findById(oldId).get().getUserName();
}
@Override
public String getUnitNameByOldId(String oldId) {
if (sysCompanyDao.findById(oldId).isPresent()) {
return sysCompanyDao.findById(oldId).get().getCompanyName();
}
else {
return devAcrossunitDao.findById(oldId).get().getUnitname();
}
}
/** /**
* @param oldFatherId 旧表父类Id * @param oldFatherId 旧表父类Id
* @param newFatherId 新表父类id * @param newFatherId 新表父类id
......
package com.example.removetolocal.task; package com.example.removetolocal.task;
import com.example.removetolocal.service.DeviceService; import com.example.removetolocal.service.DeviceService;
import com.example.removetolocal.service.StorageService;
import com.example.removetolocal.service.UserService; import com.example.removetolocal.service.UserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,6 +18,9 @@ public class changeRun implements CommandLineRunner { ...@@ -17,6 +18,9 @@ public class changeRun implements CommandLineRunner {
@Autowired @Autowired
DeviceService deviceService; DeviceService deviceService;
@Autowired
StorageService storageService;
/** /**
* Callback used to run the bean. * Callback used to run the bean.
* *
...@@ -25,9 +29,11 @@ public class changeRun implements CommandLineRunner { ...@@ -25,9 +29,11 @@ public class changeRun implements CommandLineRunner {
*/ */
@Override @Override
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
userService.changeEntity(); // userService.changeEntity();
log.info("用户模块数据迁移完成"); // log.info("用户模块数据迁移完成");
deviceService.deviceChange(); // deviceService.deviceChange();
log.info("zb模块数据迁移完成"); // log.info("zb模块数据迁移完成");
storageService.moveStorage();;
log.info("入库业务数据迁移完成");
} }
} }
package com.example.removetolocal.utils;
import java.util.ArrayList;
import java.util.List;
/**
* @author dengdiyi
* @description 分隔组合字段工具栏
*/
public class StringSplitUtil {
public static List<Integer> fileIdSplit(String s) {
List<Integer> list = new ArrayList<>();
if (s != null) {
//按分隔符,分隔
String[] strings = s.split(",");
//遍历获取id
if (strings.length != 0) {
for (String str : strings) {
if (str.length() > 0) {
list.add(Integer.valueOf(str));
}
}
}
}
return list;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论