diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/listener/NwaPrincipaListener.java b/listener/src/main/java/com/foreverwin/mesnac/listener/listener/NwaPrincipaListener.java new file mode 100644 index 00000000..387f049f --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/listener/NwaPrincipaListener.java @@ -0,0 +1,155 @@ +package com.foreverwin.mesnac.listener.listener; + + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.foreverwin.mesnac.listener.model.SysUser; +import com.foreverwin.mesnac.listener.service.SysUserService; +import com.foreverwin.mesnac.listener.util.ConstantsUtil; +import com.sap.security.api.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.UUID; + +@Service +public class NwaPrincipaListener implements PrincipalListener { + private final Logger logger = LoggerFactory.getLogger(NwaPrincipaListener.class); + + @Autowired + SysUserService sysUserService; + + @Override + public void objectAdded(String s) throws UMException { + logger.info("objectAdded: " + s); + LocalDateTime now = LocalDateTime.now(); + //---------------------------------------------------------------------------------------------------------------------------- + // 创建用户 + if(s.startsWith(ConstantsUtil.NWA_USER_ID_PREFIX)) { + IUser user = UMFactory.getUserFactory().getUser(s); + if (StringUtils.isEmpty(user.getFirstName()) && StringUtils.isEmpty(user.getLastName())) return; + String fullName = user.getLastName(); + if (!StringUtils.isEmpty(user.getFirstName())) fullName = fullName + user.getFirstName(); + //---------------------------------------------------------------------------------------------------------------------------- + //获取默认站点 + String[] sites = user.getAttribute("SAPME", "DEFAULT SITE"); + String site = sites != null && sites.length > 0 ? sites[0] : null; + //获取部门信息 + String departmentInfo = user.getDepartment(); + String department = null; + String departmentDescription = null; + if(departmentInfo != null){ + department = departmentInfo.split("/").length > 0 ? departmentInfo.split("/")[0] : ""; + departmentDescription = departmentInfo.split("/").length > 1 ? departmentInfo.split("/")[1] : ""; + } + String upperUserName = user.getName().toUpperCase(); + SysUser entity = sysUserService.selectOne(upperUserName); + if (entity == null) { + entity = new SysUser(); + entity.setHandle(UUID.randomUUID().toString()); + entity.setUserName(upperUserName); + entity.setCreateTime(now); + }//if + //---------------------------------------------------------------------------------------------------------------------------- + entity.setSite(site); + entity.setFirstName(user.getFirstName()); + entity.setLastName(user.getLastName()); + entity.setFullName(fullName); + entity.setPhone(user.getTelephone()); + entity.setDeptId(department); + entity.setDeptDesc(departmentDescription); + entity.setJobTitle(user.getJobTitle()); + entity.setEmail(user.getEmail()); + entity.setUpdateTime(now); + entity.setLockFlag(ConstantsUtil.N); + entity.setDelFlag(ConstantsUtil.N); + //---------------------------------------------------------------------------------------------------------------------------- + sysUserService.saveOrUpdate(entity); + // 创建用户账号,修改锁定状态 + } else if(s.startsWith(ConstantsUtil.NWA_USER_ACCOUNT_ID_PREFIX)) { + IUserAccount user = UMFactory.getUserAccountFactory().getUserAccount(s); + SysUser entity = sysUserService.selectOne(user.getLogonUid()); + if (entity != null) { + entity.setLockFlag(user.isUserAccountLocked() ? ConstantsUtil.Y : ConstantsUtil.N); + entity.setUpdateTime(now); + //---------------------------------------------------------------------------------------------------------------------------- + sysUserService.saveOrUpdate(entity); + } + } + } + + @Override + public void objectRemoved(String s) throws UMException { + logger.info("objectRemoved: " + s); + } + + @Override + public void objectEdited(String s) throws UMException { + logger.info("objectEdited: " + s); + LocalDateTime now = LocalDateTime.now(); + //---------------------------------------------------------------------------------------------------------------------------- + if (s.startsWith(ConstantsUtil.NWA_USER_ID_PREFIX)) { + IUser user = UMFactory.getUserFactory().getUser(s); + String fullName = user.getLastName(); + if (!StringUtils.isEmpty(user.getFirstName())) fullName = fullName + user.getFirstName(); + //---------------------------------------------------------------------------------------------------------------------------- + //获取默认站点 + String[] sites = user.getAttribute("SAPME", "DEFAULT SITE"); + String site = sites != null && sites.length > 0 ? sites[0] : null; + //获取部门信息 + String departmentInfo = user.getDepartment(); + String department = null; + String departmentDescription = null; + if(departmentInfo != null){ + department = departmentInfo.split("/").length > 0 ? departmentInfo.split("/")[0] : ""; + departmentDescription = departmentInfo.split("/").length > 1 ? departmentInfo.split("/")[1] : ""; + } + String upperUserName = user.getName().toUpperCase(); + SysUser entity = sysUserService.selectOne(upperUserName); + if (entity != null) { + entity.setSite(site); + entity.setFirstName(user.getFirstName()); + entity.setLastName(user.getLastName()); + entity.setFullName(fullName); + entity.setPhone(user.getTelephone()); + entity.setDeptId(department); + entity.setDeptDesc(departmentDescription); + entity.setJobTitle(user.getJobTitle()); + entity.setEmail(user.getEmail()); + entity.setUpdateTime(now); + //---------------------------------------------------------------------------------------------------------------------------- + sysUserService.saveOrUpdate(entity); + } + } else if (s.startsWith(ConstantsUtil.NWA_USER_ACCOUNT_ID_PREFIX)) { + IUserAccount userAccount = UMFactory.getUserAccountFactory().getUserAccount(s); + if (userAccount != null) { + SysUser entity = sysUserService.selectOne(userAccount.getLogonUid()); + if (entity != null) { + if(userAccount.getValidFromDate() != null){ + entity.setValidFrom(DateUtil.toLocalDateTime(userAccount.getValidFromDate()).toLocalDate()); + } + if(userAccount.getValidToDate() != null){ + entity.setValidTo(DateUtil.toLocalDateTime(userAccount.getValidToDate()).toLocalDate()); + } + Boolean locked = userAccount.isUserAccountLocked(); + entity.setLockFlag(locked != null && locked ? ConstantsUtil.Y : ConstantsUtil.N); + //---------------------------------------------------------------------------------------------------------------------------- + sysUserService.saveOrUpdate(entity); + } + } + } + } + + @Override + public void objectAssigned(String s, String s1) throws UMException { + logger.info("objectAssigned: " + s); + } + + @Override + public void objectUnAssigned(String s, String s1) throws UMException { + logger.info("objectUnAssigned: " + s); + } +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/listener/NwaUserListener.java b/listener/src/main/java/com/foreverwin/mesnac/listener/listener/NwaUserListener.java new file mode 100644 index 00000000..dc9f2203 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/listener/NwaUserListener.java @@ -0,0 +1,38 @@ +package com.foreverwin.mesnac.listener.listener; + + +import com.foreverwin.mesnac.listener.model.SysUser; +import com.foreverwin.mesnac.listener.service.SysUserService; +import com.sap.security.api.UMException; +import com.sap.security.api.UserListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class NwaUserListener implements UserListener { + private final Logger logger = LoggerFactory.getLogger(NwaUserListener.class); + + @Autowired + SysUserService sysUserService; + + @Override + public void userAdded(String s) throws UMException { + + } + + @Override + public void userRemoved(String s) throws UMException { + logger.info("user remove start: " + s); + //--------------------------------------------------------------------------------------------------------------------------- + String userName = s.substring(s.indexOf(":") + 1); + String upperUserName = userName.toUpperCase(); + SysUser entity = sysUserService.selectOne(upperUserName); + if (entity == null) return; + //--------------------------------------------------------------------------------------------------------------------------- + sysUserService.removeById(entity.getHandle()); + //--------------------------------------------------------------------------------------------------------------------------- + logger.info("user remove complete: " + s); + } +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/listener/StartListener.java b/listener/src/main/java/com/foreverwin/mesnac/listener/listener/StartListener.java new file mode 100644 index 00000000..49a9058b --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/listener/StartListener.java @@ -0,0 +1,114 @@ +package com.foreverwin.mesnac.listener.listener; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.foreverwin.mesnac.listener.model.SysUser; +import com.foreverwin.mesnac.listener.service.SysUserService; +import com.foreverwin.mesnac.listener.util.ConstantsUtil; +import com.sap.security.api.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.UUID; + +@Component +public class StartListener implements ApplicationListener { + private final Logger logger = LoggerFactory.getLogger(StartListener.class); + + @Autowired + NwaUserListener nwaUserListener; + @Autowired + NwaPrincipaListener nwaPrincipaListener; + @Autowired + SysUserService sysUserService; + + @Override + public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) { + try { + IUserFactory userFactory = UMFactory.getUserFactory(); + IPrincipalFactory principalFactory = UMFactory.getPrincipalFactory(); + //--------------------------------------------------------------------------------------------------------------------------- + userFactory.registerListener(nwaUserListener, UserListener.INFORM_ON_USER_ADDED);// 注册新增用户监听 + userFactory.registerListener(nwaUserListener, UserListener.INFORM_ON_USER_REMOVED);// 注册删除用户监听 + //--------------------------------------------------------------------------------------------------------------------------- + principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_ADDED); + principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_ASSIGNED); + principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_EDITED); + principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_REMOVED); + principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_UNASSIGNED); + //--------------------------------------------------------------------------------------------------------------------------- + initUser(); + } catch (Exception e) { + logger.error("", e.getMessage()); + } + } + + private void initUser() { + new Thread(() -> { + try { + LocalDateTime now = LocalDateTime.now(); + IUserFactory userFactory = UMFactory.getUserFactory(); + ISearchResult searchResult = userFactory.searchUsers(userFactory.getUserSearchFilter()); + if (searchResult == null) return; + //--------------------------------------------------------------------------------------------------------------------------- + while (searchResult.hasNext()) { + String userId = (String)searchResult.next(); + IUser user = userFactory.getUser(userId); + IUserAccount userAccount = UMFactory.getUserAccountFactory().getUserAccount(ConstantsUtil.NWA_USER_ACCOUNT_ID_PREFIX + user.getName()); + if (StringUtils.isEmpty(user.getFirstName()) && StringUtils.isEmpty(user.getLastName())) continue; + String fullName = user.getLastName(); + if (!StringUtils.isEmpty(user.getFirstName())) fullName = fullName + user.getFirstName(); + //--------------------------------------------------------------------------------------------------------------------------- + String upperUserName = user.getName().toUpperCase(); + String departmentInfo = user.getDepartment(); + String department = null; + String departmentDescription = null; + if(departmentInfo != null){ + department = departmentInfo.split("/").length > 0 ? departmentInfo.split("/")[0] : ""; + departmentDescription = departmentInfo.split("/").length > 1 ? departmentInfo.split("/")[1] : ""; + } + String[] sites = user.getAttribute("SAPME", "DEFAULT SITE"); + String site = sites != null && sites.length > 0 ? sites[0] : null; + SysUser entity = sysUserService.selectOne(upperUserName); + if (entity == null) { + entity = new SysUser(); + entity.setHandle(UUID.randomUUID().toString()); + entity.setUserName(upperUserName); + entity.setCreateTime(now); + entity.setDelFlag(ConstantsUtil.N); + }//if + //--------------------------------------------------------------------------------------------------------------------------- + entity.setSite(site); + entity.setFirstName(user.getFirstName()); + entity.setLastName(user.getLastName()); + entity.setFullName(fullName); + entity.setPhone(user.getCellPhone()); + entity.setDeptId(department); + entity.setDeptDesc(departmentDescription); + entity.setJobTitle(user.getJobTitle()); + entity.setEmail(user.getEmail()); + if(userAccount.getValidFromDate() != null){ + entity.setValidFrom(DateUtil.toLocalDateTime(userAccount.getValidFromDate()).toLocalDate()); + } + if(userAccount.getValidToDate() != null){ + entity.setValidTo(DateUtil.toLocalDateTime(userAccount.getValidToDate()).toLocalDate()); + } + entity.setUpdateTime(now); + entity.setLockFlag(userAccount.isUserAccountLocked() ? ConstantsUtil.Y : ConstantsUtil.N); + //--------------------------------------------------------------------------------------------------------------------------- + sysUserService.saveOrUpdate(entity); + }//while + //--------------------------------------------------------------------------------------------------------------------------- + // 删除NWA没有的数据 + //sysUserService.remove(Wrappers.lambdaQuery().lt(SysUser::getUpdateTime, now)); + } catch (Exception e) { + logger.error("", e.getMessage()); + } + }).start(); + } +} diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/listener/StopListener.java b/listener/src/main/java/com/foreverwin/mesnac/listener/listener/StopListener.java new file mode 100644 index 00000000..258edc97 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/listener/StopListener.java @@ -0,0 +1,27 @@ +package com.foreverwin.mesnac.listener.listener; + +import com.sap.security.api.PrincipalListener; +import com.sap.security.api.UMFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextClosedEvent; +import org.springframework.stereotype.Component; + +@Component +public class StopListener implements ApplicationListener { + + @Autowired + NwaUserListener nwaUserListener; + @Autowired + PrincipalListener principalListener; + + @Override + public void onApplicationEvent(ContextClosedEvent contextClosedEvent) { + try { + UMFactory.getUserFactory().unregisterListener(nwaUserListener); + UMFactory.getPrincipalFactory().unregisterListener(principalListener); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/SysUserMapper.java b/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/SysUserMapper.java new file mode 100644 index 00000000..f2220192 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/SysUserMapper.java @@ -0,0 +1,16 @@ +package com.foreverwin.mesnac.listener.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.foreverwin.mesnac.listener.model.SysUser; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SysUserMapper extends BaseMapper { + + SysUser getById(@Param("site") String site, @Param("userName") String engineerQa); + + List selectListForPd(@Param("site") String site); +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/UserScheduleMapper.java b/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/UserScheduleMapper.java new file mode 100644 index 00000000..f8bcea3f --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/UserScheduleMapper.java @@ -0,0 +1,40 @@ +package com.foreverwin.mesnac.listener.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.foreverwin.mesnac.listener.model.UserSchedule; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xqy + * @since 2020-11-09 + */ +@Repository +public interface UserScheduleMapper extends BaseMapper { + /** + * 排班人员修改-根据班课查看排班信息 + * + * @param site + * @param wcBo + * @param user + * @return + */ + List getInfoByUserOrWc(@Param("site") String site, @Param("wcBo") String wcBo, @Param("user") String user, @Param("scheduleStDt") String scheduleStDt, @Param("scheduleEdDt") String scheduleEdDt); + + /** + * 排班人员修改-查找MES-187作业规则RULE_01的值 + * + * @param activityBo + * @return + */ + UserSchedule getActivityRule(@Param("activityBo") String activityBo); + + ListgetShiftMappingGyAndMe(@Param("site") String site); + +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/UsrMapper.java b/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/UsrMapper.java new file mode 100644 index 00000000..4a4e676f --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/mapper/UsrMapper.java @@ -0,0 +1,24 @@ +package com.foreverwin.mesnac.listener.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.foreverwin.mesnac.listener.model.SysUser; +import com.foreverwin.mesnac.listener.model.Usr; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author sungang + * @since 2020-10-16 + */ +@Repository +public interface UsrMapper extends BaseMapper { + List selectListForPd(@Param("site") String site); + + /*List userList(Usr user);*/ +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/model/SysUser.java b/listener/src/main/java/com/foreverwin/mesnac/listener/model/SysUser.java new file mode 100644 index 00000000..ad1ba729 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/model/SysUser.java @@ -0,0 +1,300 @@ +package com.foreverwin.mesnac.listener.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Ervin Chen + * @since 2020-12-12 + */ + +@TableName("Z_NWA_USER") +public class SysUser extends Model { + + private static final long serialVersionUID = 1L; + + @TableId(value = "HANDLE", type = IdType.INPUT) + private String handle; + @TableField("USER_NAME") + private String userName; + @TableField("FIRST_NAME") + private String firstName; + @TableField("LAST_NAME") + private String lastName; + @TableField("FULL_NAME") + private String fullName; + @TableField("PASSWORD") + private String password; + @TableField("SALT") + private String salt; + @TableField("PHONE") + private String phone; + @TableField("AVATAR") + private String avatar; + @TableField("DEPT_ID") + private String deptId; + @TableField("CREATE_TIME") + private LocalDateTime createTime; + @TableField("UPDATE_TIME") + private LocalDateTime updateTime; + @TableField("LOCK_FLAG") + private String lockFlag; + @TableField("DEL_FLAG") + private String delFlag; + @TableField("SITE") + private String site; + @TableField("DEPT_DESC") + private String deptDesc; + @TableField("VALID_FROM") + private LocalDate validFrom; + @TableField("VALID_TO") + private LocalDate validTo; + @TableField("JOB_TITLE") + private String jobTitle; + @TableField("EMAIL") + private String email; + + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getDeptId() { + return deptId; + } + + public void setDeptId(String deptId) { + this.deptId = deptId; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public LocalDateTime getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(LocalDateTime updateTime) { + this.updateTime = updateTime; + } + + public String getLockFlag() { + return lockFlag; + } + + public void setLockFlag(String lockFlag) { + this.lockFlag = lockFlag; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getDeptDesc() { + return deptDesc; + } + + public void setDeptDesc(String deptDesc) { + this.deptDesc = deptDesc; + } + + public LocalDate getValidFrom() { + return validFrom; + } + + public void setValidFrom(LocalDate validFrom) { + this.validFrom = validFrom; + } + + public LocalDate getValidTo() { + return validTo; + } + + public void setValidTo(LocalDate validTo) { + this.validTo = validTo; + } + + public String getJobTitle() { + return jobTitle; + } + + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public static final String HANDLE = "HANDLE"; + + public static final String USER_NAME = "USER_NAME"; + + public static final String FIRST_NAME = "FIRST_NAME"; + + public static final String LAST_NAME = "LAST_NAME"; + + public static final String FULL_NAME = "FULL_NAME"; + + public static final String PASSWORD = "PASSWORD"; + + public static final String SALT = "SALT"; + + public static final String PHONE = "PHONE"; + + public static final String AVATAR = "AVATAR"; + + public static final String DEPT_ID = "DEPT_ID"; + + public static final String CREATE_TIME = "CREATE_TIME"; + + public static final String UPDATE_TIME = "UPDATE_TIME"; + + public static final String LOCK_FLAG = "LOCK_FLAG"; + + public static final String DEL_FLAG = "DEL_FLAG"; + + public static final String SITE = "SITE"; + + public static final String DEPT_DESC = "DEPT_DESC"; + + public static final String VALID_FROM = "VALID_FROM"; + + public static final String VALID_TO = "VALID_TO"; + + public static final String JOB_TITLE = "JOB_TITLE"; + + public static final String EMAIL = "EMAIL"; + + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "SysUser{" + + "handle = " + handle + + ", userName = " + userName + + ", firstName = " + firstName + + ", lastName = " + lastName + + ", fullName = " + fullName + + ", password = " + password + + ", salt = " + salt + + ", phone = " + phone + + ", avatar = " + avatar + + ", deptId = " + deptId + + ", createTime = " + createTime + + ", updateTime = " + updateTime + + ", lockFlag = " + lockFlag + + ", delFlag = " + delFlag + + ", site = " + site + + ", deptDesc = " + deptDesc + + ", validFrom = " + validFrom + + ", validTo = " + validTo + + ", jobTitle = " + jobTitle + + ", email = " + email + + "}"; + } +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/model/UserSchedule.java b/listener/src/main/java/com/foreverwin/mesnac/listener/model/UserSchedule.java new file mode 100644 index 00000000..f5eef8db --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/model/UserSchedule.java @@ -0,0 +1,377 @@ +package com.foreverwin.mesnac.listener.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.foreverwin.modular.core.util.I18nUtil; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author xqy + * @since 2020-11-09 + */ + +@TableName("Z_USER_SCHEDULE") + +public class UserSchedule extends Model { + + private static final long serialVersionUID = 1L; + + @TableId(value = "HANDLE", type = IdType.INPUT) + private String handle; + @TableField("SITE") + private String site; + @TableField("USER_NAME") + private String userName; + @TableField("SCHEDULE_DATE") + private String scheduleDate; + @TableField("TYPE") + private String type; + @TableField("SCHEDULE_START_TIME") + private String scheduleStartTime; + @TableField("SCHEDULE_END_TIME") + private String scheduleEndTime; + @TableField("REMARK") + private String remark; + @TableField("CREATED_DATE_TIME") + private LocalDateTime createdDateTime; + @TableField("UPDATED_DATE_TIME") + private LocalDateTime updatedDateTime; + @TableField("CREATE_USER_BO") + private String createUserBo; + @TableField("UPDATE_USER_BO") + private String updateUserBo; + /** + * 星期 + */ + @TableField("WEEK") + private String week; + /** + * 班次 + */ + @TableField("SHIFT") + private String shift; + // 班课ID + @TableField(exist = false) + private String wc; + // 班课描述 + @TableField(exist = false) + private String wcName; + // 用户名称 + @TableField(exist = false) + private String userFullName; + // 作业规则值 + @TableField(exist = false) + private String activityValue; + // 班次描述 + @TableField(exist = false) + private String shiftDesc; + //盖亚班次 + @TableField(exist = false) + private String gyShift; + + public String getGyShift() { + return gyShift; + } + + public UserSchedule setGyShift(String gyShift) { + this.gyShift = gyShift; + return this; + } + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getScheduleDate() { + return scheduleDate; + } + + public void setScheduleDate(String scheduleDate) { + this.scheduleDate = scheduleDate; + } + + public String getType() { + return type; + } + + public void setType(String type) { + if (I18nUtil.getI18nText("userSchedule.typeA").equals(type)) { + type = "A"; + } else if (I18nUtil.getI18nText("userSchedule.typeB").equals(type)) { + type = "B"; + } else if (I18nUtil.getI18nText("userSchedule.typeC").equals(type)) { + type = "C"; + } else if (I18nUtil.getI18nText("userSchedule.typeD").equals(type)) { + type = "D"; + } else if (I18nUtil.getI18nText("userSchedule.typeE").equals(type)) { + type = "E"; + } else if (I18nUtil.getI18nText("userSchedule.typeF").equals(type)) { + type = "F"; + } else if (I18nUtil.getI18nText("userSchedule.typeG").equals(type)) { + type = "G"; + } else { + switch (type){ + case "A": + type = I18nUtil.getI18nText("userSchedule.typeA"); + break; + case "B": + type = I18nUtil.getI18nText("userSchedule.typeB"); + break; + case "C": + type = I18nUtil.getI18nText("userSchedule.typeC"); + break; + case "D": + type = I18nUtil.getI18nText("userSchedule.typeD"); + break; + case "E": + type = I18nUtil.getI18nText("userSchedule.typeE"); + break; + case "F": + type = I18nUtil.getI18nText("userSchedule.typeF"); + break; + case "G": + type = I18nUtil.getI18nText("userSchedule.typeG"); + break; + default : + type = type; + } + } + this.type = type; + } + + public String getScheduleStartTime() { + return scheduleStartTime; + } + + public void setScheduleStartTime(String scheduleStartTime) { + this.scheduleStartTime = scheduleStartTime; + } + + public String getScheduleEndTime() { + return scheduleEndTime; + } + + public void setScheduleEndTime(String scheduleEndTime) { + this.scheduleEndTime = scheduleEndTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public LocalDateTime getUpdatedDateTime() { + return updatedDateTime; + } + + public void setUpdatedDateTime(LocalDateTime updatedDateTime) { + this.updatedDateTime = updatedDateTime; + } + + public String getCreateUserBo() { + return createUserBo; + } + + public void setCreateUserBo(String createUserBo) { + this.createUserBo = createUserBo; + } + + public String getUpdateUserBo() { + return updateUserBo; + } + + public void setUpdateUserBo(String updateUserBo) { + this.updateUserBo = updateUserBo; + } + + public String getWc() { + return wc; + } + + public void setWc(String wc) { + this.wc = wc; + } + + public String getWcName() { + return wcName; + } + + public void setWcName(String wcName) { + this.wcName = wcName; + } + + public String getUserFullName() { + return userFullName; + } + + public void setUserFullName(String userFullName) { + this.userFullName = userFullName; + } + + public String getActivityValue() { + return activityValue; + } + + public void setActivityValue(String activityValue) { + this.activityValue = activityValue; + } + + public String getWeek() { + return week; + } + + public void setWeek(String week) { + if (I18nUtil.getI18nText("userSchedule.week1").equals(week)) { + week = "1"; + } else if (I18nUtil.getI18nText("userSchedule.week2").equals(week)) { + week = "2"; + } else if (I18nUtil.getI18nText("userSchedule.week3").equals(week)) { + week = "3"; + } else if (I18nUtil.getI18nText("userSchedule.week4").equals(week)) { + week = "4"; + } else if (I18nUtil.getI18nText("userSchedule.week5").equals(week)) { + week = "5"; + } else if (I18nUtil.getI18nText("userSchedule.week6").equals(week)) { + week = "6"; + } else if (I18nUtil.getI18nText("userSchedule.week7").equals(week)) { + week = "7"; + } else { + switch (week){ + case "1": + week = I18nUtil.getI18nText("userSchedule.week1"); + break; + case "2": + week = I18nUtil.getI18nText("userSchedule.week2"); + break; + case "3": + week = I18nUtil.getI18nText("userSchedule.week3"); + break; + case "4": + week = I18nUtil.getI18nText("userSchedule.week4"); + break; + case "5": + week = I18nUtil.getI18nText("userSchedule.week5"); + break; + case "6": + week = I18nUtil.getI18nText("userSchedule.week6"); + break; + case "7": + week = I18nUtil.getI18nText("userSchedule.week7"); + break; + default : + week = week; + } + } + this.week = week; + } + + public String getShift() { + return shift; + } + + public void setShift(String shift) { + this.shift = shift; + } + + public String getShiftDesc() { + return shiftDesc; + } + + public void setShiftDesc(String shiftDesc) { + this.shiftDesc = shiftDesc; + } + + public static final String HANDLE = "HANDLE"; + + public static final String SITE = "SITE"; + + public static final String USER_NAME = "USER_NAME"; + + public static final String SCHEDULE_DATE = "SCHEDULE_DATE"; + + public static final String TYPE = "TYPE"; + + public static final String SCHEDULE_START_TIME = "SCHEDULE_START_TIME"; + + public static final String SCHEDULE_END_TIME = "SCHEDULE_END_TIME"; + + public static final String REMARK = "REMARK"; + + public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME"; + + public static final String UPDATED_DATE_TIME = "UPDATED_DATE_TIME"; + + public static final String CREATE_USER_BO = "CREATE_USER_BO"; + + public static final String UPDATE_USER_BO = "UPDATE_USER_BO"; + + public static final String WEEK = "WEEK"; + + public static final String SHIFT = "SHIFT"; + + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "UserSchedule{" + + "handle = " + handle + + ", site = " + site + + ", userName = " + userName + + ", scheduleDate = " + scheduleDate + + ", type = " + type + + ", scheduleStartTime = " + scheduleStartTime + + ", scheduleEndTime = " + scheduleEndTime + + ", remark = " + remark + + ", createdDateTime = " + createdDateTime + + ", updatedDateTime = " + updatedDateTime + + ", createUserBo = " + createUserBo + + ", updateUserBo = " + updateUserBo + + ", week = " + week + + ", shift = " + shift + + "}"; + } +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/model/Usr.java b/listener/src/main/java/com/foreverwin/mesnac/listener/model/Usr.java new file mode 100644 index 00000000..55a7f6a5 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/model/Usr.java @@ -0,0 +1,291 @@ +package com.foreverwin.mesnac.listener.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author sungang + * @since 2020-10-16 + */ + +@TableName("USR") + +public class Usr extends Model { + + private static final long serialVersionUID = 1L; + + @TableId(value = "HANDLE", type = IdType.INPUT) + private String handle; + @TableField("CHANGE_STAMP") + private Long changeStamp; + @TableField("SITE") + private String site; + @TableField("USER_ID") + private String userId; + @TableField(exist = false) + private String fullName; + @TableField("CURRENT_OPERATION_BO") + private String currentOperationBo; + @TableField("CURRENT_RESOURCE_BO") + private String currentResourceBo; + @TableField("CREATED_DATE_TIME") + private LocalDateTime createdDateTime; + @TableField("MODIFIED_DATE_TIME") + private LocalDateTime modifiedDateTime; + @TableField("BADGE_NUMBER") + private String badgeNumber; + @TableField("EMPLOYEE_NUMBER") + private String employeeNumber; + @TableField("HIRE_DATE") + private String hireDate; + @TableField("TERMINATION_DATE") + private String terminationDate; + @TableField("ALLOW_CLOCK_IN_NON_PROD") + private String allowClockInNonProd; + @TableField("ACTION_CLOCK_OUT_SFC") + private String actionClockOutSfc; + @TableField("CLOCK_IN_OUT_RANGE") + private String clockInOutRange; + @TableField("ALLOW_SUP_TIME_EDIT_APPR") + private String allowSupTimeEditAppr; + @TableField("APPR_REQ_FOR_EXPORT") + private String apprReqForExport; + @TableField("AUTO_CLOCK_OUT") + private String autoClockOut; + @TableField("CLOCK_IN_CONTROL") + private String clockInControl; + @TableField("DEFAULT_WORK_CENTER_BO") + private String defaultWorkCenterBo; + @TableField("ERP_PERSONNEL_NUMBER") + private String erpPersonnelNumber; + @TableField("ERP_USER") + private String erpUser; + + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public Long getChangeStamp() { + return changeStamp; + } + + public void setChangeStamp(Long changeStamp) { + this.changeStamp = changeStamp; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getCurrentOperationBo() { + return currentOperationBo; + } + + public void setCurrentOperationBo(String currentOperationBo) { + this.currentOperationBo = currentOperationBo; + } + + public String getCurrentResourceBo() { + return currentResourceBo; + } + + public void setCurrentResourceBo(String currentResourceBo) { + this.currentResourceBo = currentResourceBo; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public LocalDateTime getModifiedDateTime() { + return modifiedDateTime; + } + + public void setModifiedDateTime(LocalDateTime modifiedDateTime) { + this.modifiedDateTime = modifiedDateTime; + } + + public String getBadgeNumber() { + return badgeNumber; + } + + public void setBadgeNumber(String badgeNumber) { + this.badgeNumber = badgeNumber; + } + + public String getEmployeeNumber() { + return employeeNumber; + } + + public void setEmployeeNumber(String employeeNumber) { + this.employeeNumber = employeeNumber; + } + + public String getHireDate() { + return hireDate; + } + + public void setHireDate(String hireDate) { + this.hireDate = hireDate; + } + + public String getTerminationDate() { + return terminationDate; + } + + public void setTerminationDate(String terminationDate) { + this.terminationDate = terminationDate; + } + + public String getAllowClockInNonProd() { + return allowClockInNonProd; + } + + public void setAllowClockInNonProd(String allowClockInNonProd) { + this.allowClockInNonProd = allowClockInNonProd; + } + + public String getActionClockOutSfc() { + return actionClockOutSfc; + } + + public void setActionClockOutSfc(String actionClockOutSfc) { + this.actionClockOutSfc = actionClockOutSfc; + } + + public String getClockInOutRange() { + return clockInOutRange; + } + + public void setClockInOutRange(String clockInOutRange) { + this.clockInOutRange = clockInOutRange; + } + + public String getAllowSupTimeEditAppr() { + return allowSupTimeEditAppr; + } + + public void setAllowSupTimeEditAppr(String allowSupTimeEditAppr) { + this.allowSupTimeEditAppr = allowSupTimeEditAppr; + } + + public String getApprReqForExport() { + return apprReqForExport; + } + + public void setApprReqForExport(String apprReqForExport) { + this.apprReqForExport = apprReqForExport; + } + + public String getAutoClockOut() { + return autoClockOut; + } + + public void setAutoClockOut(String autoClockOut) { + this.autoClockOut = autoClockOut; + } + + public String getClockInControl() { + return clockInControl; + } + + public void setClockInControl(String clockInControl) { + this.clockInControl = clockInControl; + } + + public String getDefaultWorkCenterBo() { + return defaultWorkCenterBo; + } + + public void setDefaultWorkCenterBo(String defaultWorkCenterBo) { + this.defaultWorkCenterBo = defaultWorkCenterBo; + } + + public String getErpPersonnelNumber() { + return erpPersonnelNumber; + } + + public void setErpPersonnelNumber(String erpPersonnelNumber) { + this.erpPersonnelNumber = erpPersonnelNumber; + } + + public String getErpUser() { + return erpUser; + } + + public void setErpUser(String erpUser) { + this.erpUser = erpUser; + } + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "Usr{" + + "handle = " + handle + + ", changeStamp = " + changeStamp + + ", site = " + site + + ", userId = " + userId + + ", currentOperationBo = " + currentOperationBo + + ", currentResourceBo = " + currentResourceBo + + ", createdDateTime = " + createdDateTime + + ", modifiedDateTime = " + modifiedDateTime + + ", badgeNumber = " + badgeNumber + + ", employeeNumber = " + employeeNumber + + ", hireDate = " + hireDate + + ", terminationDate = " + terminationDate + + ", allowClockInNonProd = " + allowClockInNonProd + + ", actionClockOutSfc = " + actionClockOutSfc + + ", clockInOutRange = " + clockInOutRange + + ", allowSupTimeEditAppr = " + allowSupTimeEditAppr + + ", apprReqForExport = " + apprReqForExport + + ", autoClockOut = " + autoClockOut + + ", clockInControl = " + clockInControl + + ", defaultWorkCenterBo = " + defaultWorkCenterBo + + ", erpPersonnelNumber = " + erpPersonnelNumber + + ", erpUser = " + erpUser + + "}"; + } +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/package-info.java b/listener/src/main/java/com/foreverwin/mesnac/listener/package-info.java new file mode 100644 index 00000000..24430656 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/package-info.java @@ -0,0 +1,5 @@ +/** + * @author Ervin Chen + * @date 2020/10/14 10:09 + */ +package com.foreverwin.mesnac.listener; \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/service/SysUserService.java b/listener/src/main/java/com/foreverwin/mesnac/listener/service/SysUserService.java new file mode 100644 index 00000000..4e23490a --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/service/SysUserService.java @@ -0,0 +1,10 @@ +package com.foreverwin.mesnac.listener.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.mesnac.listener.model.SysUser; + +public interface SysUserService extends IService { + SysUser selectOne(String userName); + + SysUser getById(String site, String engineerQa); +} diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/service/UserScheduleService.java b/listener/src/main/java/com/foreverwin/mesnac/listener/service/UserScheduleService.java new file mode 100644 index 00000000..ceebf177 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/service/UserScheduleService.java @@ -0,0 +1,57 @@ +package com.foreverwin.mesnac.listener.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.mesnac.listener.model.UserSchedule; +import com.foreverwin.modular.core.util.FrontPage; + +import java.util.List; +import java.util.Set; + +/** + *

+ * 服务类 + *

+ * + * @author xqy + * @since 2020-11-09 + */ +public interface UserScheduleService extends IService { + + /** + * 分页查询 + * + * @param frontPage + * @return + */ + IPage selectPage(FrontPage frontPage, UserSchedule userSchedule); + + /** + * 查询 + * + * @param userSchedule + * @return + */ + List selectList(UserSchedule userSchedule); + + /** + * 排班人员修改-根据班课查看排班信息 + * + * @param workCenter + * @param user + * @param scheduleStDt + * @param scheduleEdDt + * @return + */ + List getUserScheduleByUserOrWc(String site,String workCenter, String user, String scheduleStDt, String scheduleEdDt); + + /** + * 排班人员修改-查找MES-187作业规则RULE_01的值 + * + * @param activityBo + * @return + */ + String getActivityRule(String activityBo); + + void delAndSave(StringBuffer stringBuffer, List addList, Set delList); +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/service/UsrService.java b/listener/src/main/java/com/foreverwin/mesnac/listener/service/UsrService.java new file mode 100644 index 00000000..bff21257 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/service/UsrService.java @@ -0,0 +1,33 @@ +package com.foreverwin.mesnac.listener.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.mesnac.listener.model.SysUser; +import com.foreverwin.mesnac.listener.model.Usr; +import com.foreverwin.modular.core.util.FrontPage; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author sungang + * @since 2020-10-16 + */ +public interface UsrService extends IService { + + /** + * 分页查询 + * @param frontPage + * @return + */ + IPage selectPage(FrontPage frontPage, Usr usr); + + List selectList(Usr usr); + + List selectListForPd(String site); + + /* List userList(Usr user);*/ +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/SysUserServiceImpl.java b/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/SysUserServiceImpl.java new file mode 100644 index 00000000..77e70177 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/SysUserServiceImpl.java @@ -0,0 +1,27 @@ +package com.foreverwin.mesnac.listener.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.foreverwin.mesnac.listener.mapper.SysUserMapper; +import com.foreverwin.mesnac.listener.model.SysUser; +import com.foreverwin.mesnac.listener.service.SysUserService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional(rollbackFor = Exception.class) +public class SysUserServiceImpl extends ServiceImpl implements SysUserService { + @Override + public SysUser selectOne(String userName) + { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysUser::getUserName, userName); + //---------------------------------------------------------------------------------------------------------------------------------- + return super.getOne(queryWrapper, false); + } + + @Override + public SysUser getById(String site, String engineerQa) { + return baseMapper.getById(site,engineerQa); + } +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/UserScheduleServiceImpl.java b/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/UserScheduleServiceImpl.java new file mode 100644 index 00000000..72cca0bc --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/UserScheduleServiceImpl.java @@ -0,0 +1,87 @@ +package com.foreverwin.mesnac.listener.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.foreverwin.mesnac.listener.mapper.UserScheduleMapper; +import com.foreverwin.mesnac.listener.model.UserSchedule; +import com.foreverwin.mesnac.listener.service.UserScheduleService; +import com.foreverwin.modular.core.util.FrontPage; +import com.sap.me.plant.WorkCenterBOHandle; +import org.eclipse.jetty.util.StringUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Set; + +/** + *

+ * 服务实现类 + *

+ * + * @author xqy + * @since 2020-11-09 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class UserScheduleServiceImpl extends ServiceImpl implements UserScheduleService { + + + @Autowired + private UserScheduleMapper userScheduleMapper; + + @Override + public IPage selectPage(FrontPage frontPage, UserSchedule userSchedule) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(userSchedule); + return super.page(frontPage.getPagePlus(), queryWrapper); + } + + @Override + public List selectList(UserSchedule userSchedule) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(userSchedule); + return super.list(queryWrapper); + } + + @Override + public List getUserScheduleByUserOrWc(String site, String workCenter, String user, String scheduleStDt, String scheduleEdDt) { + String wcBo = ""; + if (!StringUtil.isEmpty(workCenter)) { + WorkCenterBOHandle boHandle = new WorkCenterBOHandle(site, workCenter); + wcBo = boHandle.getValue(); + } + return userScheduleMapper.getInfoByUserOrWc(site, workCenter, user, scheduleStDt, scheduleEdDt); + } + + @Override + public String getActivityRule(String activityBo) { + String value = ""; + UserSchedule userSchedule = userScheduleMapper.getActivityRule(activityBo); + if (userSchedule != null ) { + value = userSchedule.getActivityValue(); + } + return value; + } + + @Override + public void delAndSave(StringBuffer buffer, List addList, Set delSetList) { + if (buffer.length() == 0 && delSetList.size() > 0) { + for(String del: delSetList) { + String[] t = del.split("=="); + if (t != null && t.length == 2) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq(UserSchedule.USER_NAME, t[0]); + queryWrapper.eq(UserSchedule.SCHEDULE_DATE, t[1]); + remove(queryWrapper); + } + } + } + if (buffer.length() == 0 && addList.size() > 0) { + saveOrUpdateBatch(addList); + } + } + +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/UsrServiceImpl.java b/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/UsrServiceImpl.java new file mode 100644 index 00000000..51100e8b --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/service/impl/UsrServiceImpl.java @@ -0,0 +1,60 @@ +package com.foreverwin.mesnac.listener.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.foreverwin.mesnac.listener.mapper.UsrMapper; +import com.foreverwin.mesnac.listener.model.SysUser; +import com.foreverwin.mesnac.listener.model.Usr; +import com.foreverwin.mesnac.listener.service.UsrService; +import com.foreverwin.modular.core.util.FrontPage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author sungang + * @since 2020-10-16 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class UsrServiceImpl extends ServiceImpl implements UsrService { + + + @Autowired + private UsrMapper usrMapper; + + @Override + public IPage selectPage(FrontPage frontPage, Usr usr) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(usr); + return super.page(frontPage.getPagePlus(), queryWrapper); + } + + @Override + public List selectList(Usr usr) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(usr); + return super.list(queryWrapper); + } + + @Override + public List selectListForPd(String site) { + return usrMapper.selectListForPd(site); + } + + /* @Override + public List userList(Usr user) { + String site = CommonMethods.getSite(); + String user1 = CommonMethods.getUser(); + user.setSite(site); + return usrMapper.userList(user); + }*/ + +} \ No newline at end of file diff --git a/listener/src/main/java/com/foreverwin/mesnac/listener/util/ConstantsUtil.java b/listener/src/main/java/com/foreverwin/mesnac/listener/util/ConstantsUtil.java new file mode 100644 index 00000000..4b5a3053 --- /dev/null +++ b/listener/src/main/java/com/foreverwin/mesnac/listener/util/ConstantsUtil.java @@ -0,0 +1,14 @@ +package com.foreverwin.mesnac.listener.util; + +public class ConstantsUtil { + public static String Y = "Y"; + public static String N = "N"; + + public static String NWA_USER_ID_PREFIX = "USER.PRIVATE_DATASOURCE.un:"; + public static String NWA_USER_ACCOUNT_ID_PREFIX = "UACC.PRIVATE_DATASOURCE.un:"; + + /** 默认日期时间格式 */ + public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; + /** 默认日期格式 */ + public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; +} diff --git a/listener/src/main/resources/mapper/NwaUserMapper.xml b/listener/src/main/resources/mapper/NwaUserMapper.xml new file mode 100644 index 00000000..fdb23e52 --- /dev/null +++ b/listener/src/main/resources/mapper/NwaUserMapper.xml @@ -0,0 +1,575 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HANDLE, USER_NAME, FIRST_NAME, LAST_NAME, FULL_NAME, PASSWORD, SALT, PHONE, AVATAR, DEPT_ID, CREATE_TIME, UPDATE_TIME, LOCK_FLAG, DEL_FLAG, SITE, DEPT_DESC, VALID_FROM, VALID_TO, JOB_TITLE, EMAIL + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO Z_NWA_USER + + HANDLE, + USER_NAME, + FIRST_NAME, + LAST_NAME, + FULL_NAME, + PASSWORD, + SALT, + PHONE, + AVATAR, + DEPT_ID, + CREATE_TIME, + UPDATE_TIME, + LOCK_FLAG, + DEL_FLAG, + SITE, + DEPT_DESC, + VALID_FROM, + VALID_TO, + JOB_TITLE, + EMAIL, + VALUES + + #{handle}, + #{userName}, + #{firstName}, + #{lastName}, + #{fullName}, + #{password}, + #{salt}, + #{phone}, + #{avatar}, + #{deptId}, + #{createTime}, + #{updateTime}, + #{lockFlag}, + #{delFlag}, + #{site}, + #{deptDesc}, + #{validFrom}, + #{validTo}, + #{jobTitle}, + #{email}, + + + + + INSERT INTO Z_NWA_USER + + + VALUES + + #{handle}, + #{userName}, + #{firstName}, + #{lastName}, + #{fullName}, + #{password}, + #{salt}, + #{phone}, + #{avatar}, + #{deptId}, + #{createTime}, + #{updateTime}, + #{lockFlag}, + #{delFlag}, + #{site}, + #{deptDesc}, + #{validFrom}, + #{validTo}, + #{jobTitle}, + #{email}, + + + + + + UPDATE Z_NWA_USER + USER_NAME=#{et.userName}, + FIRST_NAME=#{et.firstName}, + LAST_NAME=#{et.lastName}, + FULL_NAME=#{et.fullName}, + PASSWORD=#{et.password}, + SALT=#{et.salt}, + PHONE=#{et.phone}, + AVATAR=#{et.avatar}, + DEPT_ID=#{et.deptId}, + CREATE_TIME=#{et.createTime}, + UPDATE_TIME=#{et.updateTime}, + LOCK_FLAG=#{et.lockFlag}, + DEL_FLAG=#{et.delFlag}, + SITE=#{et.site}, + DEPT_DESC=#{et.deptDesc}, + VALID_FROM=#{et.validFrom}, + VALID_TO=#{et.validTo}, + JOB_TITLE=#{et.jobTitle}, + EMAIL=#{et.email}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_NWA_USER + USER_NAME=#{et.userName}, + FIRST_NAME=#{et.firstName}, + LAST_NAME=#{et.lastName}, + FULL_NAME=#{et.fullName}, + PASSWORD=#{et.password}, + SALT=#{et.salt}, + PHONE=#{et.phone}, + AVATAR=#{et.avatar}, + DEPT_ID=#{et.deptId}, + CREATE_TIME=#{et.createTime}, + UPDATE_TIME=#{et.updateTime}, + LOCK_FLAG=#{et.lockFlag}, + DEL_FLAG=#{et.delFlag}, + SITE=#{et.site}, + DEPT_DESC=#{et.deptDesc}, + VALID_FROM=#{et.validFrom}, + VALID_TO=#{et.validTo}, + JOB_TITLE=#{et.jobTitle}, + EMAIL=#{et.email}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_NWA_USER + USER_NAME=#{et.userName}, + FIRST_NAME=#{et.firstName}, + LAST_NAME=#{et.lastName}, + FULL_NAME=#{et.fullName}, + PASSWORD=#{et.password}, + SALT=#{et.salt}, + PHONE=#{et.phone}, + AVATAR=#{et.avatar}, + DEPT_ID=#{et.deptId}, + CREATE_TIME=#{et.createTime}, + UPDATE_TIME=#{et.updateTime}, + LOCK_FLAG=#{et.lockFlag}, + DEL_FLAG=#{et.delFlag}, + SITE=#{et.site}, + DEPT_DESC=#{et.deptDesc}, + VALID_FROM=#{et.validFrom}, + VALID_TO=#{et.validTo}, + JOB_TITLE=#{et.jobTitle}, + EMAIL=#{et.email}, + + + + + HANDLE=#{ew.entity.handle} + AND USER_NAME=#{ew.entity.userName} + AND FIRST_NAME=#{ew.entity.firstName} + AND LAST_NAME=#{ew.entity.lastName} + AND FULL_NAME=#{ew.entity.fullName} + AND PASSWORD=#{ew.entity.password} + AND SALT=#{ew.entity.salt} + AND PHONE=#{ew.entity.phone} + AND AVATAR=#{ew.entity.avatar} + AND DEPT_ID=#{ew.entity.deptId} + AND CREATE_TIME=#{ew.entity.createTime} + AND UPDATE_TIME=#{ew.entity.updateTime} + AND LOCK_FLAG=#{ew.entity.lockFlag} + AND DEL_FLAG=#{ew.entity.delFlag} + AND SITE=#{ew.entity.site} + AND DEPT_DESC=#{ew.entity.deptDesc} + AND VALID_FROM=#{ew.entity.validFrom} + AND VALID_TO=#{ew.entity.validTo} + AND JOB_TITLE=#{ew.entity.jobTitle} + AND EMAIL=#{ew.entity.email} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_NWA_USER WHERE HANDLE=#{handle} + + + + DELETE FROM Z_NWA_USER + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM Z_NWA_USER + + + + + HANDLE=#{ew.entity.handle} + + AND USER_NAME=#{ew.entity.userName} + AND FIRST_NAME=#{ew.entity.firstName} + AND LAST_NAME=#{ew.entity.lastName} + AND FULL_NAME=#{ew.entity.fullName} + AND PASSWORD=#{ew.entity.password} + AND SALT=#{ew.entity.salt} + AND PHONE=#{ew.entity.phone} + AND AVATAR=#{ew.entity.avatar} + AND DEPT_ID=#{ew.entity.deptId} + AND CREATE_TIME=#{ew.entity.createTime} + AND UPDATE_TIME=#{ew.entity.updateTime} + AND LOCK_FLAG=#{ew.entity.lockFlag} + AND DEL_FLAG=#{ew.entity.delFlag} + AND SITE=#{ew.entity.site} + AND DEPT_DESC=#{ew.entity.deptDesc} + AND VALID_FROM=#{ew.entity.validFrom} + AND VALID_TO=#{ew.entity.validTo} + AND JOB_TITLE=#{ew.entity.jobTitle} + AND EMAIL=#{ew.entity.email} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_NWA_USER WHERE HANDLE IN ( + #{item} + ) + + + + + + diff --git a/listener/src/main/resources/mapper/UserScheduleMapper.xml b/listener/src/main/resources/mapper/UserScheduleMapper.xml new file mode 100644 index 00000000..cb9537c4 --- /dev/null +++ b/listener/src/main/resources/mapper/UserScheduleMapper.xml @@ -0,0 +1,517 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HANDLE, SITE, USER_NAME, SCHEDULE_DATE, TYPE, SCHEDULE_START_TIME, SCHEDULE_END_TIME, REMARK, CREATED_DATE_TIME, UPDATED_DATE_TIME, CREATE_USER_BO, UPDATE_USER_BO, WEEK, SHIFT + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO Z_USER_SCHEDULE + + HANDLE, + SITE, + USER_NAME, + SCHEDULE_DATE, + TYPE, + SCHEDULE_START_TIME, + SCHEDULE_END_TIME, + REMARK, + CREATED_DATE_TIME, + UPDATED_DATE_TIME, + CREATE_USER_BO, + UPDATE_USER_BO, + WEEK, + SHIFT, + VALUES + + #{handle}, + #{site}, + #{userName}, + #{scheduleDate}, + #{type}, + #{scheduleStartTime}, + #{scheduleEndTime}, + #{remark}, + #{createdDateTime}, + #{updatedDateTime}, + #{createUserBo}, + #{updateUserBo}, + #{week}, + #{shift}, + + + + + INSERT INTO Z_USER_SCHEDULE + + + VALUES + + #{handle}, + #{site}, + #{userName}, + #{scheduleDate}, + #{type}, + #{scheduleStartTime}, + #{scheduleEndTime}, + #{remark}, + #{createdDateTime}, + #{updatedDateTime}, + #{createUserBo}, + #{updateUserBo}, + #{week}, + #{shift}, + + + + + + UPDATE Z_USER_SCHEDULE + SITE=#{et.site}, + USER_NAME=#{et.userName}, + SCHEDULE_DATE=#{et.scheduleDate}, + TYPE=#{et.type}, + SCHEDULE_START_TIME=#{et.scheduleStartTime}, + SCHEDULE_END_TIME=#{et.scheduleEndTime}, + REMARK=#{et.remark}, + CREATED_DATE_TIME=#{et.createdDateTime}, + UPDATED_DATE_TIME=#{et.updatedDateTime}, + CREATE_USER_BO=#{et.createUserBo}, + UPDATE_USER_BO=#{et.updateUserBo}, + WEEK=#{et.week}, + SHIFT=#{et.shift}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_USER_SCHEDULE + SITE=#{et.site}, + USER_NAME=#{et.userName}, + SCHEDULE_DATE=#{et.scheduleDate}, + TYPE=#{et.type}, + SCHEDULE_START_TIME=#{et.scheduleStartTime}, + SCHEDULE_END_TIME=#{et.scheduleEndTime}, + REMARK=#{et.remark}, + CREATED_DATE_TIME=#{et.createdDateTime}, + UPDATED_DATE_TIME=#{et.updatedDateTime}, + CREATE_USER_BO=#{et.createUserBo}, + UPDATE_USER_BO=#{et.updateUserBo}, + WEEK=#{et.week}, + SHIFT=#{et.shift}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_USER_SCHEDULE + SITE=#{et.site}, + USER_NAME=#{et.userName}, + SCHEDULE_DATE=#{et.scheduleDate}, + TYPE=#{et.type}, + SCHEDULE_START_TIME=#{et.scheduleStartTime}, + SCHEDULE_END_TIME=#{et.scheduleEndTime}, + REMARK=#{et.remark}, + CREATED_DATE_TIME=#{et.createdDateTime}, + UPDATED_DATE_TIME=#{et.updatedDateTime}, + CREATE_USER_BO=#{et.createUserBo}, + UPDATE_USER_BO=#{et.updateUserBo}, + WEEK=#{et.week}, + SHIFT=#{et.shift}, + + + + + HANDLE=#{ew.entity.handle} + AND SITE=#{ew.entity.site} + AND USER_NAME=#{ew.entity.userName} + AND SCHEDULE_DATE=#{ew.entity.scheduleDate} + AND TYPE=#{ew.entity.type} + AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime} + AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime} + AND REMARK=#{ew.entity.remark} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime} + AND CREATE_USER_BO=#{ew.entity.createUserBo} + AND UPDATE_USER_BO=#{ew.entity.updateUserBo} + AND WEEK=#{ew.entity.week} + AND SHIFT=#{ew.entity.shift} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_USER_SCHEDULE WHERE HANDLE=#{handle} + + + + DELETE FROM Z_USER_SCHEDULE + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM Z_USER_SCHEDULE + + + + + HANDLE=#{ew.entity.handle} + + AND SITE=#{ew.entity.site} + AND USER_NAME=#{ew.entity.userName} + AND SCHEDULE_DATE=#{ew.entity.scheduleDate} + AND TYPE=#{ew.entity.type} + AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime} + AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime} + AND REMARK=#{ew.entity.remark} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime} + AND CREATE_USER_BO=#{ew.entity.createUserBo} + AND UPDATE_USER_BO=#{ew.entity.updateUserBo} + AND WEEK=#{ew.entity.week} + AND SHIFT=#{ew.entity.shift} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_USER_SCHEDULE WHERE HANDLE IN ( + #{item} + ) + + + + + + + + + diff --git a/listener/src/main/resources/mapper/UsrMapper.xml b/listener/src/main/resources/mapper/UsrMapper.xml new file mode 100644 index 00000000..b4fe79c6 --- /dev/null +++ b/listener/src/main/resources/mapper/UsrMapper.xml @@ -0,0 +1,610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HANDLE, CHANGE_STAMP, SITE, USER_ID, CURRENT_OPERATION_BO, CURRENT_RESOURCE_BO, CREATED_DATE_TIME, MODIFIED_DATE_TIME, BADGE_NUMBER, EMPLOYEE_NUMBER, HIRE_DATE, TERMINATION_DATE, ALLOW_CLOCK_IN_NON_PROD, ACTION_CLOCK_OUT_SFC, CLOCK_IN_OUT_RANGE, ALLOW_SUP_TIME_EDIT_APPR, APPR_REQ_FOR_EXPORT, AUTO_CLOCK_OUT, CLOCK_IN_CONTROL, DEFAULT_WORK_CENTER_BO, ERP_PERSONNEL_NUMBER, ERP_USER + + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO USR + + HANDLE, + CHANGE_STAMP, + SITE, + USER_ID, + CURRENT_OPERATION_BO, + CURRENT_RESOURCE_BO, + CREATED_DATE_TIME, + MODIFIED_DATE_TIME, + BADGE_NUMBER, + EMPLOYEE_NUMBER, + HIRE_DATE, + TERMINATION_DATE, + ALLOW_CLOCK_IN_NON_PROD, + ACTION_CLOCK_OUT_SFC, + CLOCK_IN_OUT_RANGE, + ALLOW_SUP_TIME_EDIT_APPR, + APPR_REQ_FOR_EXPORT, + AUTO_CLOCK_OUT, + CLOCK_IN_CONTROL, + DEFAULT_WORK_CENTER_BO, + ERP_PERSONNEL_NUMBER, + ERP_USER, + VALUES + + #{handle}, + #{changeStamp}, + #{site}, + #{userId}, + #{currentOperationBo}, + #{currentResourceBo}, + #{createdDateTime}, + #{modifiedDateTime}, + #{badgeNumber}, + #{employeeNumber}, + #{hireDate}, + #{terminationDate}, + #{allowClockInNonProd}, + #{actionClockOutSfc}, + #{clockInOutRange}, + #{allowSupTimeEditAppr}, + #{apprReqForExport}, + #{autoClockOut}, + #{clockInControl}, + #{defaultWorkCenterBo}, + #{erpPersonnelNumber}, + #{erpUser}, + + + + + INSERT INTO USR + + + VALUES + + #{handle}, + #{changeStamp}, + #{site}, + #{userId}, + #{currentOperationBo}, + #{currentResourceBo}, + #{createdDateTime}, + #{modifiedDateTime}, + #{badgeNumber}, + #{employeeNumber}, + #{hireDate}, + #{terminationDate}, + #{allowClockInNonProd}, + #{actionClockOutSfc}, + #{clockInOutRange}, + #{allowSupTimeEditAppr}, + #{apprReqForExport}, + #{autoClockOut}, + #{clockInControl}, + #{defaultWorkCenterBo}, + #{erpPersonnelNumber}, + #{erpUser}, + + + + + + UPDATE USR + CHANGE_STAMP=#{et.changeStamp}, + SITE=#{et.site}, + USER_ID=#{et.userId}, + CURRENT_OPERATION_BO=#{et.currentOperationBo}, + CURRENT_RESOURCE_BO=#{et.currentResourceBo}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + BADGE_NUMBER=#{et.badgeNumber}, + EMPLOYEE_NUMBER=#{et.employeeNumber}, + HIRE_DATE=#{et.hireDate}, + TERMINATION_DATE=#{et.terminationDate}, + ALLOW_CLOCK_IN_NON_PROD=#{et.allowClockInNonProd}, + ACTION_CLOCK_OUT_SFC=#{et.actionClockOutSfc}, + CLOCK_IN_OUT_RANGE=#{et.clockInOutRange}, + ALLOW_SUP_TIME_EDIT_APPR=#{et.allowSupTimeEditAppr}, + APPR_REQ_FOR_EXPORT=#{et.apprReqForExport}, + AUTO_CLOCK_OUT=#{et.autoClockOut}, + CLOCK_IN_CONTROL=#{et.clockInControl}, + DEFAULT_WORK_CENTER_BO=#{et.defaultWorkCenterBo}, + ERP_PERSONNEL_NUMBER=#{et.erpPersonnelNumber}, + ERP_USER=#{et.erpUser}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE USR + CHANGE_STAMP=#{et.changeStamp}, + SITE=#{et.site}, + USER_ID=#{et.userId}, + CURRENT_OPERATION_BO=#{et.currentOperationBo}, + CURRENT_RESOURCE_BO=#{et.currentResourceBo}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + BADGE_NUMBER=#{et.badgeNumber}, + EMPLOYEE_NUMBER=#{et.employeeNumber}, + HIRE_DATE=#{et.hireDate}, + TERMINATION_DATE=#{et.terminationDate}, + ALLOW_CLOCK_IN_NON_PROD=#{et.allowClockInNonProd}, + ACTION_CLOCK_OUT_SFC=#{et.actionClockOutSfc}, + CLOCK_IN_OUT_RANGE=#{et.clockInOutRange}, + ALLOW_SUP_TIME_EDIT_APPR=#{et.allowSupTimeEditAppr}, + APPR_REQ_FOR_EXPORT=#{et.apprReqForExport}, + AUTO_CLOCK_OUT=#{et.autoClockOut}, + CLOCK_IN_CONTROL=#{et.clockInControl}, + DEFAULT_WORK_CENTER_BO=#{et.defaultWorkCenterBo}, + ERP_PERSONNEL_NUMBER=#{et.erpPersonnelNumber}, + ERP_USER=#{et.erpUser}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE USR + CHANGE_STAMP=#{et.changeStamp}, + SITE=#{et.site}, + USER_ID=#{et.userId}, + CURRENT_OPERATION_BO=#{et.currentOperationBo}, + CURRENT_RESOURCE_BO=#{et.currentResourceBo}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + BADGE_NUMBER=#{et.badgeNumber}, + EMPLOYEE_NUMBER=#{et.employeeNumber}, + HIRE_DATE=#{et.hireDate}, + TERMINATION_DATE=#{et.terminationDate}, + ALLOW_CLOCK_IN_NON_PROD=#{et.allowClockInNonProd}, + ACTION_CLOCK_OUT_SFC=#{et.actionClockOutSfc}, + CLOCK_IN_OUT_RANGE=#{et.clockInOutRange}, + ALLOW_SUP_TIME_EDIT_APPR=#{et.allowSupTimeEditAppr}, + APPR_REQ_FOR_EXPORT=#{et.apprReqForExport}, + AUTO_CLOCK_OUT=#{et.autoClockOut}, + CLOCK_IN_CONTROL=#{et.clockInControl}, + DEFAULT_WORK_CENTER_BO=#{et.defaultWorkCenterBo}, + ERP_PERSONNEL_NUMBER=#{et.erpPersonnelNumber}, + ERP_USER=#{et.erpUser}, + + + + + HANDLE=#{ew.entity.handle} + AND CHANGE_STAMP=#{ew.entity.changeStamp} + AND SITE=#{ew.entity.site} + AND USER_ID=#{ew.entity.userId} + AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo} + AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + AND BADGE_NUMBER=#{ew.entity.badgeNumber} + AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber} + AND HIRE_DATE=#{ew.entity.hireDate} + AND TERMINATION_DATE=#{ew.entity.terminationDate} + AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd} + AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc} + AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange} + AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr} + AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport} + AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut} + AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl} + AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo} + AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber} + AND ERP_USER=#{ew.entity.erpUser} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM USR WHERE HANDLE=#{handle} + + + + DELETE FROM USR + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM USR + + + + + HANDLE=#{ew.entity.handle} + + AND CHANGE_STAMP=#{ew.entity.changeStamp} + AND SITE=#{ew.entity.site} + AND USER_ID=#{ew.entity.userId} + AND CURRENT_OPERATION_BO=#{ew.entity.currentOperationBo} + AND CURRENT_RESOURCE_BO=#{ew.entity.currentResourceBo} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + AND BADGE_NUMBER=#{ew.entity.badgeNumber} + AND EMPLOYEE_NUMBER=#{ew.entity.employeeNumber} + AND HIRE_DATE=#{ew.entity.hireDate} + AND TERMINATION_DATE=#{ew.entity.terminationDate} + AND ALLOW_CLOCK_IN_NON_PROD=#{ew.entity.allowClockInNonProd} + AND ACTION_CLOCK_OUT_SFC=#{ew.entity.actionClockOutSfc} + AND CLOCK_IN_OUT_RANGE=#{ew.entity.clockInOutRange} + AND ALLOW_SUP_TIME_EDIT_APPR=#{ew.entity.allowSupTimeEditAppr} + AND APPR_REQ_FOR_EXPORT=#{ew.entity.apprReqForExport} + AND AUTO_CLOCK_OUT=#{ew.entity.autoClockOut} + AND CLOCK_IN_CONTROL=#{ew.entity.clockInControl} + AND DEFAULT_WORK_CENTER_BO=#{ew.entity.defaultWorkCenterBo} + AND ERP_PERSONNEL_NUMBER=#{ew.entity.erpPersonnelNumber} + AND ERP_USER=#{ew.entity.erpUser} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM USR WHERE HANDLE IN ( + #{item} + ) + + + + diff --git a/pom.xml b/pom.xml index fce71829..a9439bb0 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ quality equip integration + listener