SAP定时任务同步订单
parent
a5d3d5727d
commit
a72ac03a1e
@ -0,0 +1,11 @@
|
||||
#for tests only !
|
||||
#Tue Jul 25 15:29:49 CST 2023
|
||||
jco.destination.pool_capacity=true
|
||||
jco.client.lang=zh
|
||||
jco.client.ashost=192.168.0.53
|
||||
jco.client.saprouter=
|
||||
jco.client.user=MES
|
||||
jco.client.sysnr=0
|
||||
jco.destination.peak_limit=20
|
||||
jco.client.passwd=f.6zg4)u7K,V?%$f3X1@sDv,o,cE^tQDiv#oPB+PX*24w(Z.
|
||||
jco.client.client=800
|
@ -0,0 +1,96 @@
|
||||
|
||||
**** Error file opened at 20230724 105509 China Standard Time Rel. 3.0.17 (2017-07-17) [721.913]
|
||||
Error: >Mon Jul 24 10:55:09,173< RfcException:
|
||||
message: Connect to SAP gateway failed
|
||||
Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1
|
||||
|
||||
LOCATION CPIC (TCP/IP) on local host with Unicode
|
||||
ERROR partner '192.168.0.53:3300' not reached
|
||||
TIME Mon Jul 24 10:55:09 2023
|
||||
RELEASE 721
|
||||
COMPONENT NI (network interface)
|
||||
VERSION 40
|
||||
RC -10
|
||||
MODULE nixxi.cpp
|
||||
LINE 3289
|
||||
DETAIL NiPConnect2: 192.168.0.53:3300
|
||||
SYSTEM CALL connect
|
||||
ERRNO 10060
|
||||
ERRNO TEXT WSAETIMEDOUT: Connection timed out
|
||||
COUNTER 2
|
||||
|
||||
return code: RFC_FAILURE (1)
|
||||
error group: 102
|
||||
key: RFC_ERROR_COMMUNICATION
|
||||
|
||||
Error: >Mon Jul 24 10:55:30,220< RfcException:
|
||||
message: Connect to SAP gateway failed
|
||||
Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1
|
||||
|
||||
LOCATION CPIC (TCP/IP) on local host with Unicode
|
||||
ERROR partner '192.168.0.53:3300' not reached
|
||||
TIME Mon Jul 24 10:55:30 2023
|
||||
RELEASE 721
|
||||
COMPONENT NI (network interface)
|
||||
VERSION 40
|
||||
RC -10
|
||||
MODULE nixxi.cpp
|
||||
LINE 3289
|
||||
DETAIL NiPConnect2: 192.168.0.53:3300
|
||||
SYSTEM CALL connect
|
||||
ERRNO 10060
|
||||
ERRNO TEXT WSAETIMEDOUT: Connection timed out
|
||||
COUNTER 4
|
||||
|
||||
return code: RFC_FAILURE (1)
|
||||
error group: 102
|
||||
key: RFC_ERROR_COMMUNICATION
|
||||
|
||||
|
||||
**** Error file opened at 20230725 103104 China Standard Time Rel. 3.0.17 (2017-07-17) [721.913]
|
||||
Error: >Tue Jul 25 10:31:04,628< RfcException:
|
||||
message: Connect to SAP gateway failed
|
||||
Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1
|
||||
|
||||
LOCATION CPIC (TCP/IP) on local host with Unicode
|
||||
ERROR partner '192.168.0.53:3300' not reached
|
||||
TIME Tue Jul 25 10:31:04 2023
|
||||
RELEASE 721
|
||||
COMPONENT NI (network interface)
|
||||
VERSION 40
|
||||
RC -10
|
||||
MODULE nixxi.cpp
|
||||
LINE 3289
|
||||
DETAIL NiPConnect2: 192.168.0.53:3300
|
||||
SYSTEM CALL connect
|
||||
ERRNO 10060
|
||||
ERRNO TEXT WSAETIMEDOUT: Connection timed out
|
||||
COUNTER 2
|
||||
|
||||
return code: RFC_FAILURE (1)
|
||||
error group: 102
|
||||
key: RFC_ERROR_COMMUNICATION
|
||||
|
||||
Error: >Tue Jul 25 10:31:25,675< RfcException:
|
||||
message: Connect to SAP gateway failed
|
||||
Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1
|
||||
|
||||
LOCATION CPIC (TCP/IP) on local host with Unicode
|
||||
ERROR partner '192.168.0.53:3300' not reached
|
||||
TIME Tue Jul 25 10:31:25 2023
|
||||
RELEASE 721
|
||||
COMPONENT NI (network interface)
|
||||
VERSION 40
|
||||
RC -10
|
||||
MODULE nixxi.cpp
|
||||
LINE 3289
|
||||
DETAIL NiPConnect2: 192.168.0.53:3300
|
||||
SYSTEM CALL connect
|
||||
ERRNO 10060
|
||||
ERRNO TEXT WSAETIMEDOUT: Connection timed out
|
||||
COUNTER 4
|
||||
|
||||
return code: RFC_FAILURE (1)
|
||||
error group: 102
|
||||
key: RFC_ERROR_COMMUNICATION
|
||||
|
@ -0,0 +1,253 @@
|
||||
package com.op.system.api.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.op.common.core.annotation.Excel;
|
||||
import com.op.common.core.web.domain.TreeEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class SapProOrder extends TreeEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private String id;
|
||||
|
||||
/** 计划工厂编码 */
|
||||
@Excel(name = "计划工厂编码")
|
||||
private String planFactoryCode;
|
||||
|
||||
/** 计划工厂编码 */
|
||||
@Excel(name = "工厂编码")
|
||||
private String factoryCode;
|
||||
|
||||
/** 订单类型 */
|
||||
@Excel(name = "订单类型")
|
||||
private String orderType;
|
||||
|
||||
/** 订单号 */
|
||||
@Excel(name = "订单号")
|
||||
private String orderCode;
|
||||
|
||||
/** 物料号 */
|
||||
@Excel(name = "物料号")
|
||||
private String prodCode;
|
||||
|
||||
/** 物料名称 */
|
||||
@Excel(name = "物料名称")
|
||||
private String prodDesc;
|
||||
|
||||
/** 订单数量 */
|
||||
@Excel(name = "订单数量")
|
||||
private Long quantity;
|
||||
|
||||
/** 已拆分订单数量 */
|
||||
@Excel(name = "已拆分订单数量")
|
||||
private Long quantitySplit;
|
||||
|
||||
/** 单位 */
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
/** 任务清单 */
|
||||
@Excel(name = "任务清单")
|
||||
private String workerOrder;
|
||||
|
||||
public Long getQuantitySplit() {
|
||||
return quantitySplit;
|
||||
}
|
||||
|
||||
public void setQuantitySplit(Long quantitySplit) {
|
||||
this.quantitySplit = quantitySplit;
|
||||
}
|
||||
|
||||
/** 计划生产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "计划生产日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date planProDate;
|
||||
|
||||
/** 计划完成日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "计划完成日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date planComplete;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String atrr1;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String atrr2;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String atrr3;
|
||||
|
||||
/** 0未拆分 */
|
||||
@Excel(name = "0未拆分")
|
||||
private String status;
|
||||
|
||||
/** 上级工单 */
|
||||
@Excel(name = "上级工单")
|
||||
private String parentOrder;
|
||||
|
||||
public String getPlanFactoryCode() {
|
||||
return planFactoryCode;
|
||||
}
|
||||
|
||||
public void setPlanFactoryCode(String planFactoryCode) {
|
||||
this.planFactoryCode = planFactoryCode;
|
||||
}
|
||||
|
||||
/** 产品类型 */
|
||||
@Excel(name = "产品类型")
|
||||
private String prodType;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setFactoryCode(String factoryCode) {
|
||||
this.factoryCode = factoryCode;
|
||||
}
|
||||
|
||||
public String getFactoryCode() {
|
||||
return factoryCode;
|
||||
}
|
||||
public void setOrderType(String orderType) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
|
||||
public String getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
public void setOrderCode(String orderCode) {
|
||||
this.orderCode = orderCode;
|
||||
}
|
||||
|
||||
public String getOrderCode() {
|
||||
return orderCode;
|
||||
}
|
||||
public void setProdCode(String prodCode) {
|
||||
this.prodCode = prodCode;
|
||||
}
|
||||
|
||||
public String getProdCode() {
|
||||
return prodCode;
|
||||
}
|
||||
public void setProdDesc(String prodDesc) {
|
||||
this.prodDesc = prodDesc;
|
||||
}
|
||||
|
||||
public String getProdDesc() {
|
||||
return prodDesc;
|
||||
}
|
||||
public void setQuantity(Long quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public Long getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
public void setWorkerOrder(String workerOrder) {
|
||||
this.workerOrder = workerOrder;
|
||||
}
|
||||
|
||||
public String getWorkerOrder() {
|
||||
return workerOrder;
|
||||
}
|
||||
public void setPlanProDate(Date planProDate) {
|
||||
this.planProDate = planProDate;
|
||||
}
|
||||
|
||||
public Date getPlanProDate() {
|
||||
return planProDate;
|
||||
}
|
||||
public void setPlanComplete(Date planComplete) {
|
||||
this.planComplete = planComplete;
|
||||
}
|
||||
|
||||
public Date getPlanComplete() {
|
||||
return planComplete;
|
||||
}
|
||||
public void setAtrr1(String atrr1) {
|
||||
this.atrr1 = atrr1;
|
||||
}
|
||||
|
||||
public String getAtrr1() {
|
||||
return atrr1;
|
||||
}
|
||||
public void setAtrr2(String atrr2) {
|
||||
this.atrr2 = atrr2;
|
||||
}
|
||||
|
||||
public String getAtrr2() {
|
||||
return atrr2;
|
||||
}
|
||||
public void setAtrr3(String atrr3) {
|
||||
this.atrr3 = atrr3;
|
||||
}
|
||||
|
||||
public String getAtrr3() {
|
||||
return atrr3;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setParentOrder(String parentOrder) {
|
||||
this.parentOrder = parentOrder;
|
||||
}
|
||||
|
||||
public String getParentOrder() {
|
||||
return parentOrder;
|
||||
}
|
||||
public void setProdType(String prodType) {
|
||||
this.prodType = prodType;
|
||||
}
|
||||
|
||||
public String getProdType() {
|
||||
return prodType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("factoryCode", getFactoryCode())
|
||||
.append("orderType", getOrderType())
|
||||
.append("orderCode", getOrderCode())
|
||||
.append("prodCode", getProdCode())
|
||||
.append("prodDesc", getProdDesc())
|
||||
.append("quantity", getQuantity())
|
||||
.append("unit", getUnit())
|
||||
.append("workerOrder", getWorkerOrder())
|
||||
.append("planProDate", getPlanProDate())
|
||||
.append("planComplete", getPlanComplete())
|
||||
.append("atrr1", getAtrr1())
|
||||
.append("atrr2", getAtrr2())
|
||||
.append("atrr3", getAtrr3())
|
||||
.append("status", getStatus())
|
||||
.append("parentOrder", getParentOrder())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("prodType", getProdType())
|
||||
.toString();
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,25 @@
|
||||
package com.op.job.config;
|
||||
|
||||
import com.op.common.core.utils.uuid.IdUtils;
|
||||
import com.op.job.domain.SapConn;
|
||||
import com.op.job.util.SAPConnUtils;
|
||||
import com.op.system.api.RemoteMesService;
|
||||
import com.op.system.api.model.SapProOrder;
|
||||
import com.sap.conn.jco.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class SapConnConfig {
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.op.mes.util;
|
||||
package com.op.job.domain;
|
||||
|
||||
public class SapConn {
|
||||
// SAP服务器
|
@ -0,0 +1,117 @@
|
||||
package com.op.mes.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.op.mes.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.op.common.core.utils.StringUtils;
|
||||
import com.op.common.core.utils.poi.ExcelUtil;
|
||||
import com.op.common.core.web.controller.BaseController;
|
||||
import com.op.common.core.web.domain.AjaxResult;
|
||||
import com.op.common.core.web.page.TableDataInfo;
|
||||
import com.op.common.log.annotation.Log;
|
||||
import com.op.common.log.enums.BusinessType;
|
||||
import com.op.common.security.annotation.RequiresPermissions;
|
||||
import com.op.common.security.utils.SecurityUtils;
|
||||
import com.op.system.api.domain.SysUser;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author OP
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class SysUserController extends BaseController {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@RequiresPermissions("system:user:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUser user) {
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:user:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysUser user) {
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.exportExcel(response, list, "用户数据");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.importTemplateExcel(response, "用户数据");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
package com.op.mes.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.op.system.api.domain.SysUser;
|
||||
|
||||
/**
|
||||
* 用户 业务层
|
||||
*
|
||||
* @author OP
|
||||
*/
|
||||
public interface ISysUserService {
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUserList(SysUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectAllocatedList(SysUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUnallocatedList(SysUser user);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkUserNameUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkPhoneUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkEmailUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
*
|
||||
* @param user 用户信息
|
||||
*/
|
||||
public void checkUserAllowed(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void checkUserDataScope(Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean registerUser(SysUser user);
|
||||
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserStatus(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserProfile(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean updateUserAvatar(String userName, String avatar);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetPwd(SysUser user);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetUserPwd(String userName, String password);
|
||||
|
||||
}
|
@ -0,0 +1,257 @@
|
||||
package com.op.mes.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import com.op.mes.service.ISysUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.op.common.core.constant.UserConstants;
|
||||
import com.op.common.core.exception.ServiceException;
|
||||
import com.op.common.core.utils.SpringUtils;
|
||||
import com.op.common.core.utils.StringUtils;
|
||||
import com.op.common.datascope.annotation.DataScope;
|
||||
import com.op.common.security.utils.SecurityUtils;
|
||||
import com.op.system.api.domain.SysUser;
|
||||
import com.op.mes.mapper.SysUserMapper;
|
||||
|
||||
/**
|
||||
* 用户 业务层处理
|
||||
*
|
||||
* @author OP
|
||||
*/
|
||||
@Service
|
||||
public class SysUserServiceImpl implements ISysUserService {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
protected Validator validator;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectUserList(SysUser user) {
|
||||
return userMapper.selectUserList(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectAllocatedList(SysUser user) {
|
||||
return userMapper.selectAllocatedList(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectUnallocatedList(SysUser user) {
|
||||
return userMapper.selectUnallocatedList(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysUser selectUserByUserName(String userName) {
|
||||
return userMapper.selectUserByUserName(userName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysUser selectUserById(Long userId) {
|
||||
return userMapper.selectUserById(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkUserNameUnique(SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkPhoneUnique(SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkEmailUnique(SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
*
|
||||
* @param user 用户信息
|
||||
*/
|
||||
@Override
|
||||
public void checkUserAllowed(SysUser user) {
|
||||
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
|
||||
throw new ServiceException("不允许操作超级管理员用户");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
@Override
|
||||
public void checkUserDataScope(Long userId) {
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
|
||||
SysUser user = new SysUser();
|
||||
user.setUserId(userId);
|
||||
List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
|
||||
if (StringUtils.isEmpty(users)) {
|
||||
throw new ServiceException("没有权限访问用户数据!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertUser(SysUser user) {
|
||||
// 新增用户信息
|
||||
int rows = userMapper.insertUser(user);
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean registerUser(SysUser user) {
|
||||
return userMapper.insertUser(user) > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserStatus(SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserProfile(SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean updateUserAvatar(String userName, String avatar) {
|
||||
return userMapper.updateUserAvatar(userName, avatar) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int resetPwd(SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int resetUserPwd(String userName, String password) {
|
||||
return userMapper.resetUserPwd(userName, password);
|
||||
}
|
||||
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
package com.op.mes.util;
|
||||
|
||||
import com.sap.conn.jco.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
public class SapConnConfig {
|
||||
static List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
|
||||
static JCoFunction function;
|
||||
@Value("${sap.ashost}")
|
||||
public String ashost;
|
||||
|
||||
@Value("${sap.sysnr}")
|
||||
public String sysnr;
|
||||
|
||||
@Value("${sap.client}")
|
||||
public String client;
|
||||
|
||||
@Value("${sap.user}")
|
||||
public String user;
|
||||
|
||||
@Value("${sap.passwd}")
|
||||
public String passwd;
|
||||
|
||||
@Value("${sap.lang}")
|
||||
public String lang;
|
||||
|
||||
@Value("${sap.pool_capacity}")
|
||||
public String pool_capacity;
|
||||
|
||||
@Value("${sap.peak_limit}")
|
||||
public String peak_limit;
|
||||
|
||||
@Value("${sap.saprouter}")
|
||||
public String saprouter;
|
||||
@Bean
|
||||
public void SapConn() {
|
||||
SapConn con = new SapConn(
|
||||
ashost,
|
||||
sysnr,
|
||||
client,
|
||||
user,
|
||||
passwd,
|
||||
lang,
|
||||
pool_capacity,
|
||||
peak_limit,
|
||||
saprouter
|
||||
);
|
||||
// 连接
|
||||
JCoDestination jCoDestination = SAPConnUtils.connect(con);
|
||||
RfcTest(jCoDestination);
|
||||
|
||||
}
|
||||
public static List<Map<String, Object>> RfcTest(JCoDestination jCoDestination){
|
||||
try {
|
||||
// 获取调用 RFC 函数对象
|
||||
JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_PRO_TO");
|
||||
|
||||
// 配置传入参数
|
||||
JCoParameterList importParameterList = func.getImportParameterList();
|
||||
//importParameterList.setValue("S_AUFNR",001002125255 );
|
||||
|
||||
// 调用并获取返回值
|
||||
func.execute(jCoDestination);
|
||||
// 获取 内表 - ZMES_PRO
|
||||
JCoTable maraTable = func.getTableParameterList().getTable("ZMES_PRO");
|
||||
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
|
||||
System.out.println("###"+metaData.toString());
|
||||
// 循环输出 Table 数据
|
||||
for (int i = 0; i < maraTable.getNumRows(); i++) {
|
||||
maraTable.setRow(i);
|
||||
String AUFNR = maraTable.getString("AUFNR");
|
||||
String AUART = maraTable.getString("AUART");
|
||||
String MAUFNR = maraTable.getString("MAUFNR");
|
||||
String PLNBEZ = maraTable.getString("PLNBEZ");
|
||||
String MAKTX = maraTable.getString("MAKTX");
|
||||
String PWERK = maraTable.getString("PWERK");
|
||||
String GAMNG = maraTable.getString("GAMNG");
|
||||
String GMEIN = maraTable.getString("GMEIN");
|
||||
String PLNNR = maraTable.getString("PLNNR");
|
||||
String GSTRP = maraTable.getString("GSTRP");
|
||||
String GLTRP = maraTable.getString("GLTRP");
|
||||
String ERNAM = maraTable.getString("ERNAM");
|
||||
String ERDAT = maraTable.getString("ERDAT");
|
||||
String STTXT = maraTable.getString("STTXT");
|
||||
|
||||
// System.out.println("物料编号:" + matnr + " - 创建日期:" + esdra + " - 创建人:" + ernam + " - 物料组:" + matkl + " - 单位:" + meins);
|
||||
System.out.println("订单号:" +AUFNR+" - 订单类型:" + AUART+ " - 上级订单编号:" + MAUFNR+ " - 物料号:" + PLNBEZ+ " - 物料描述(短文本):" + MAKTX
|
||||
+ " - 订单的计划工厂:" + PWERK+ " - 订单数量总计:" + GAMNG+ " - 基本计量单位:" + GMEIN+ " - 任务清单组码:" + PLNNR+ " - 基本开始日期:" + GSTRP
|
||||
+ " - 基本完成日期:" + GLTRP+ " - 输入者:" + ERNAM+ " - 创建日期:" + ERDAT+ " - 系统状态:" + STTXT);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.op.mes;
|
||||
package com.op.sap;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
@ -0,0 +1,5 @@
|
||||
package com.op.sap.controller;
|
||||
|
||||
public class SapController {
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
||||
version="4.0">
|
||||
</web-app>
|
Loading…
Reference in New Issue