Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
397c7d0a5a
|
|
@ -136,7 +136,7 @@ public class LogAspect
|
|||
sysLogsVo.setOperaUserName(username);
|
||||
}
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId!=null && userId!=0l) {
|
||||
if (userId!=null && userId!=0L) {
|
||||
sysLogsVo.setUserId(userId.toString());
|
||||
}
|
||||
sysLogsVo.setOperaUri(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255));
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public class GlobalExceptionHandler
|
|||
public final static String BODY_ERROR="Required request body is missing:";
|
||||
|
||||
public final static String DATA_ERROR="Data truncation: Data too long for";
|
||||
|
||||
private final static String TRANS_ERR="Transaction rolled back because it has been marked as rollback-only";
|
||||
/**
|
||||
* 权限码异常
|
||||
*/
|
||||
|
|
@ -112,6 +114,9 @@ public class GlobalExceptionHandler
|
|||
if (msg.contains(DATA_ERROR)){
|
||||
return AjaxResult.error("数据长度过长");
|
||||
}
|
||||
if(msg.contains(TRANS_ERR)){
|
||||
return AjaxResult.error("操作失败,请检查数据是否正确!");
|
||||
}
|
||||
}
|
||||
String requestUri = request.getRequestURI();
|
||||
log.error("请求地址'{}',发生未知异常.", requestUri, e);
|
||||
|
|
|
|||
|
|
@ -377,9 +377,9 @@ public class SysJobServiceImpl implements ISysJobService {
|
|||
} else if (date.compareTo(delayTime) > 0 && "2".equals(item.getIsCheck())) {
|
||||
item.setCheckStatus("8");
|
||||
} else if (date.compareTo(delayTime) <= 0 && !"2".equals(item.getIsCheck())) {
|
||||
item.setCheckStatus("7");
|
||||
} else if (date.compareTo(delayTime) > 0 && !"2".equals(item.getIsCheck())) {
|
||||
item.setCheckStatus("3");
|
||||
} else if (date.compareTo(delayTime) > 0 && !"2".equals(item.getIsCheck())) {
|
||||
item.setCheckStatus("7");
|
||||
}
|
||||
} else {
|
||||
//判断整改时间是否大于当前时间
|
||||
|
|
@ -387,9 +387,9 @@ public class SysJobServiceImpl implements ISysJobService {
|
|||
item.setCheckStatus("2");
|
||||
} else if (date.compareTo(correctionTime) > 0 && "2".equals(item.getIsCheck())) {
|
||||
item.setCheckStatus("6");
|
||||
} else if (date.compareTo(correctionTime) <= 0 && !"2".equals(item.getIsCheck())) {
|
||||
item.setCheckStatus("5");
|
||||
} else if (date.compareTo(correctionTime) > 0 && !"2".equals(item.getIsCheck())) {
|
||||
item.setCheckStatus("5");
|
||||
} else if (date.compareTo(correctionTime) <= 0 && !"2".equals(item.getIsCheck())) {
|
||||
item.setCheckStatus("1");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,8 +188,8 @@ public class RyTask
|
|||
}
|
||||
}
|
||||
|
||||
public void updateHiddenDangerStatus() {
|
||||
|
||||
public void updateHiddenDangerStatus() {
|
||||
sysJobService.updateHiddenDangerStatus();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,9 +117,7 @@ public class AdmissionRequestController extends BaseController {
|
|||
try {
|
||||
String params = allRequestParams.get("params");
|
||||
org.json.JSONObject jsonObject = new org.json.JSONObject(params);
|
||||
if (!arService.checkUserTypeNameUnique(allRequestParams)){
|
||||
return toAjax(arService.addMataddAdmissionRequesterial(facePhotoList, medicalExaminationList, elseImgList, specialTypeOfWorkList, otherFilesList, allRequestParams));
|
||||
}else {
|
||||
if (arService.checkUserTypeNameUnique(allRequestParams)){
|
||||
arService.addUserName(allRequestParams);
|
||||
}
|
||||
return toAjax(arService.addMataddAdmissionRequesterial(facePhotoList, medicalExaminationList, elseImgList, specialTypeOfWorkList, otherFilesList, allRequestParams));
|
||||
|
|
|
|||
|
|
@ -215,9 +215,10 @@ public class ImportServiceImpl implements ImportService {
|
|||
ajaxResult.put("result","此zip内文件在系统内无对应人员,导入失败!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
ajaxResult.isError();
|
||||
// throw new Exception("文件上传失败"+e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("导入模板不正确");
|
||||
}
|
||||
|
||||
return ajaxResult;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import com.bonus.project.mapper.ProMaterialManagementMapper;
|
|||
import com.bonus.project.service.ProMaterialManagementService;
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -22,6 +24,7 @@ import java.util.List;
|
|||
* Description:工程资料管理 逻辑处理层
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProMaterialManagementServiceImpl implements ProMaterialManagementService {
|
||||
@Resource
|
||||
private ProMaterialManagementMapper mapper;
|
||||
|
|
@ -62,7 +65,6 @@ public class ProMaterialManagementServiceImpl implements ProMaterialManagementSe
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, String uploadType) {
|
||||
int code = 0;
|
||||
|
||||
for (MultipartFile file : fileList) {
|
||||
try {
|
||||
// 获取文件名
|
||||
|
|
@ -72,12 +74,14 @@ public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, Str
|
|||
// 获取文件路径
|
||||
R<SysFile> fileResult = remoteFileService.upload(file);
|
||||
if (fileResult == null || fileResult.getData() == null) {
|
||||
throw new RuntimeException("Failed to upload file");
|
||||
throw new RuntimeException("文件上传异常");
|
||||
}
|
||||
String materialPath = fileResult.getData().getUrl();
|
||||
|
||||
// 保存文件信息
|
||||
ProMaterialManagement bean = new ProMaterialManagement();
|
||||
if(StringHelper.isNullOrEmptyString(proId) || "undefined".equals(proId)){
|
||||
throw new RuntimeException("未选择工程");
|
||||
}
|
||||
bean.setProId(Long.valueOf(proId));
|
||||
bean.setMaterialName(materialName);
|
||||
bean.setMaterialSize(Long.toString(materialSize));
|
||||
|
|
@ -85,10 +89,10 @@ public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, Str
|
|||
bean.setMaterialType(uploadType);
|
||||
bean.setCreateName(SecurityUtils.getUsername());
|
||||
bean.setCreateUser(SecurityUtils.getUserId());
|
||||
|
||||
code += mapper.insertProMaterial(bean);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to add upload file due to exception", e);
|
||||
log.error(e.toString(),e);
|
||||
throw new RuntimeException("文件上传入库失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -432,6 +432,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM sys_user
|
||||
WHERE phonenumber = #{phone}
|
||||
AND del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
<select id="checkUserType" resultType="com.bonus.project.domain.AdmissionRequest">
|
||||
SELECT user_id AS id
|
||||
|
|
@ -439,6 +440,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE phonenumber = #{phone}
|
||||
AND user_type = #{userType}
|
||||
AND del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
<select id="getDeptId" resultType="java.lang.String">
|
||||
select
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
pdi.device_phone AS devicePhone,
|
||||
pdi.create_user AS createUser,
|
||||
pdi.create_time AS createTime,
|
||||
pdi.puid,pdi.type_code typeCode,
|
||||
pdi.puid, pdi.device_status deviceStatus,
|
||||
pdi.type_code typeCode,
|
||||
pdi.ball_index as ballIndex,
|
||||
if(ppi.pro_name IS NULL, '无', ppi.pro_name) AS proName
|
||||
FROM
|
||||
|
|
|
|||
|
|
@ -511,22 +511,18 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@Override
|
||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
|
||||
{
|
||||
if (StringUtils.isNull(userList) || userList.size() == 0)
|
||||
{
|
||||
if (StringUtils.isNull(userList) || userList.size() == 0) {
|
||||
throw new ServiceException("导入用户数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (SysUser user : userList)
|
||||
{
|
||||
try
|
||||
{
|
||||
for (SysUser user : userList) {
|
||||
try {
|
||||
// 验证是否存在这个用户
|
||||
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
||||
if (StringUtils.isNull(u))
|
||||
{
|
||||
if (StringUtils.isNull(u)){
|
||||
BeanValidators.validateWithException(validator, user);
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
String password = configService.selectConfigByKey("sys.user.initPassword");
|
||||
|
|
@ -535,9 +531,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
userMapper.insertUser(user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
|
||||
}
|
||||
else if (isUpdateSupport)
|
||||
{
|
||||
} else if (isUpdateSupport) {
|
||||
BeanValidators.validateWithException(validator, user);
|
||||
checkUserAllowed(u);
|
||||
checkUserDataScope(u.getUserId());
|
||||
|
|
@ -547,23 +541,18 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
userMapper.updateUser(user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
||||
failureMsg.append(msg + e.getMessage());
|
||||
log.error(msg, e);
|
||||
}
|
||||
}
|
||||
if (failureNum > 0)
|
||||
{
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue