mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-16 14:26:49 +08:00
合并stat 到third
This commit is contained in:
@@ -122,12 +122,12 @@ public class SCORMPackageManager {
|
|||||||
// .loadSCORMContentPackageFromZipFile("1", "learningserver-scorm/scorm-test-pkg.zip")
|
// .loadSCORMContentPackageFromZipFile("1", "learningserver-scorm/scorm-test-pkg.zip")
|
||||||
// .getContent());
|
// .getContent());
|
||||||
System.out.println("test");
|
System.out.println("test");
|
||||||
ContentPackage cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", "E:/Projects/BOEU/scorm/file/ContentPackagingSingleSCO_SCORM12.zip");
|
ContentPackage cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", "E:/Projects/BOEU/scorm/file/ContentPackagingOneFilePerSCO_SCORM12.zip");
|
||||||
System.out.println(cp.getManifest().getIdentifier());
|
System.out.println(cp.getManifest().getIdentifier());
|
||||||
System.out.println(cp.getContent());
|
System.out.println(cp.getContent());
|
||||||
System.out.println("title="+cp.getManifest().getOrganizations().getOrganizationList().get(0).getTitle());
|
System.out.println("title="+cp.getManifest().getOrganizations().getOrganizationList().get(0).getTitle());
|
||||||
for(Resource res : cp.getManifest().getResources().getResourceList()) {
|
for(Resource res : cp.getManifest().getResources().getResourceList()) {
|
||||||
System.out.print(res.getHref());
|
System.out.println(res.getHref());
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println("ADL_Maritime_Navigation");
|
// System.out.println("ADL_Maritime_Navigation");
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ public interface CacheName {
|
|||||||
*/
|
*/
|
||||||
String NAME_AUTH= "auth";
|
String NAME_AUTH= "auth";
|
||||||
|
|
||||||
|
|
||||||
|
String NAME_USER_LOGIN_ERROR_NUM= "user:login:error:aid:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码key前缀
|
* 验证码key前缀
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.xboe.data.api;
|
package com.xboe.data.api;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -9,15 +7,12 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.xboe.account.entity.Account;
|
|
||||||
import com.xboe.account.service.IAccountService;
|
import com.xboe.account.service.IAccountService;
|
||||||
import com.xboe.core.JsonResponse;
|
import com.xboe.core.JsonResponse;
|
||||||
import com.xboe.core.api.ApiBaseController;
|
import com.xboe.core.api.ApiBaseController;
|
||||||
import com.xboe.data.dto.UserData;
|
import com.xboe.data.dto.UserData;
|
||||||
import com.xboe.data.service.IDataUserSyncService;
|
import com.xboe.data.service.IDataUserSyncService;
|
||||||
import com.xboe.system.organization.entity.Organization;
|
|
||||||
import com.xboe.system.organization.service.IOrganizationService;
|
import com.xboe.system.organization.service.IOrganizationService;
|
||||||
import com.xboe.system.user.entity.User;
|
|
||||||
import com.xboe.system.user.service.IUserService;
|
import com.xboe.system.user.service.IUserService;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -52,71 +47,7 @@ public class UserDataSyncApi extends ApiBaseController {
|
|||||||
//清除缓存需要loginName
|
//清除缓存需要loginName
|
||||||
try {
|
try {
|
||||||
//先查询是否存在
|
//先查询是否存在
|
||||||
Account a=accountService.get(user.getId());
|
service.syncUserFull(user);
|
||||||
User u=userService.get(user.getId());
|
|
||||||
Organization org=null;
|
|
||||||
if(a!=null) {
|
|
||||||
//账户只是修改状态
|
|
||||||
a.setDeleted(user.getDeleted());
|
|
||||||
}else {
|
|
||||||
//新账户
|
|
||||||
a=new Account();
|
|
||||||
a.setDeleted(user.getDeleted());
|
|
||||||
a.setSysId(user.getKid());
|
|
||||||
a.setLoginName(user.getCode());
|
|
||||||
a.setAvatar(user.getAvatar());
|
|
||||||
a.setId(user.getId());
|
|
||||||
a.setRegTime(LocalDateTime.now());
|
|
||||||
a.setSysId(user.getKid());
|
|
||||||
a.setStatus(1);
|
|
||||||
}
|
|
||||||
if(u!=null) {
|
|
||||||
//更新部分用户字段
|
|
||||||
u.setDepartId(user.getDepartId());
|
|
||||||
u.setDepartName(user.getDepartName());
|
|
||||||
u.setName(user.getName());
|
|
||||||
u.setUserType(user.getUserType());
|
|
||||||
if(user.getLearningDuration()>0) { //不大于0才会更新
|
|
||||||
u.setLearningDuration(user.getLearningDuration());
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
//新建用户
|
|
||||||
u=new User();
|
|
||||||
u.setId(user.getId());
|
|
||||||
u.setDepartId(user.getDepartId());
|
|
||||||
u.setDepartName(user.getDepartName());
|
|
||||||
u.setDynamic(0);
|
|
||||||
u.setGender(u.getGender());
|
|
||||||
u.setName(user.getName());
|
|
||||||
u.setSign("");
|
|
||||||
u.setUserNo(user.getCode());
|
|
||||||
u.setUserType(user.getUserType());
|
|
||||||
u.setSysId(user.getKid());
|
|
||||||
u.setStudyTotal(0);
|
|
||||||
u.setLearningDuration(user.getLearningDuration());
|
|
||||||
if(user.getBandLevel()!=null && user.getBandLevel()>15) {
|
|
||||||
u.setShowHome(false);//band16及以上
|
|
||||||
}else {
|
|
||||||
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//对机构的判断,不为空时才会处理,为空时不处理
|
|
||||||
if(StringUtils.isNotBlank(user.getDepartId())) {
|
|
||||||
org=orgService.get(user.getDepartId());
|
|
||||||
if(org==null) {
|
|
||||||
org=new Organization();
|
|
||||||
org.setCode("");
|
|
||||||
org.setId(user.getDepartId());
|
|
||||||
org.setName(user.getDepartName());
|
|
||||||
org.setDeleted(false);
|
|
||||||
org.setStatus(1);
|
|
||||||
}
|
|
||||||
org.setNamePath(user.getOrgNamePath());
|
|
||||||
|
|
||||||
}
|
|
||||||
service.syncUserFull(a, u, org);
|
|
||||||
|
|
||||||
return success(true);
|
return success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("同步处理用户错误", e);
|
log.error("同步处理用户错误", e);
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xboe.data.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 受众人员
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AudienceUser {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户的统一id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户的姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户的代码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.xboe.data.outside;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.xboe.data.dto.AudienceUser;
|
||||||
|
import com.xboe.data.dto.UserData;
|
||||||
|
|
||||||
|
public interface IOutSideDataService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取受众的所有用户
|
||||||
|
* @param task
|
||||||
|
*/
|
||||||
|
List<AudienceUser> getUsersByAudienceId(String audienceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过统一用户id获取用户的信息
|
||||||
|
*/
|
||||||
|
UserData getUserInfoByUserId(String userId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package com.xboe.data.outside;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.xboe.core.SysConstant;
|
||||||
|
import com.xboe.core.api.TokenProxy;
|
||||||
|
import com.xboe.core.utils.OkHttpUtil;
|
||||||
|
import com.xboe.data.dto.AudienceUser;
|
||||||
|
import com.xboe.data.dto.UserData;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OkHttpUtil okHttpUtil;
|
||||||
|
|
||||||
|
|
||||||
|
private String getNodeText(JsonNode jn) {
|
||||||
|
if(jn!=null) {
|
||||||
|
return jn.asText();
|
||||||
|
}else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AudienceUser> getUsersByAudienceId(String audienceId){
|
||||||
|
|
||||||
|
String token = TokenProxy.getToken(request);
|
||||||
|
String type="application/json";
|
||||||
|
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||||
|
String url= getBaseUrl("/audience/memberList");
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("audienceId", audienceId);
|
||||||
|
String json = null;
|
||||||
|
List<AudienceUser> list=new ArrayList<AudienceUser>();
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
try {
|
||||||
|
|
||||||
|
json = mapper.writeValueAsString(params);
|
||||||
|
String responseStr = okHttpUtil.doPostJson(url, json, headers);
|
||||||
|
JsonNode rootNode= mapper.readTree(responseStr);
|
||||||
|
|
||||||
|
JsonNode result = rootNode.get("result")!=null ?( rootNode.get("result").get("data") !=null ? rootNode.get("result").get("data"):null):null;
|
||||||
|
if(rootNode.get("result")!=null & rootNode.get("result").isArray()) {
|
||||||
|
//这里应该是单独的线程去处理
|
||||||
|
for(JsonNode JsonNode :result) {
|
||||||
|
AudienceUser au=new AudienceUser();
|
||||||
|
au.setId(JsonNode.get("id").asText());
|
||||||
|
au.setName(getNodeText(JsonNode.get("userName")));
|
||||||
|
au.setCode(getNodeText(JsonNode.get("userNo")));
|
||||||
|
list.add(au);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取受众用户列表错误",e);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserData getUserInfoByUserId(String userId) {
|
||||||
|
|
||||||
|
String token = TokenProxy.getToken(request);
|
||||||
|
String type="application/json";
|
||||||
|
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||||
|
String url= getBaseUrl("/user/info");
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
try {
|
||||||
|
String responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||||
|
JsonNode rootNode= mapper.readTree(responseStr);
|
||||||
|
int code = rootNode.get("code").asInt();
|
||||||
|
if(code!=200) {
|
||||||
|
log.error("获取当前用户信息返回结果错误:"+responseStr);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
UserData user=new UserData();
|
||||||
|
JsonNode result = rootNode.get("result");
|
||||||
|
if(rootNode.get("result")!=null & rootNode.get("result").isObject()) {
|
||||||
|
//这里应该是单独的线程去处理
|
||||||
|
user.setId(getNodeText(result.get("id")));
|
||||||
|
String band=getNodeText(result.get("bandCode"));
|
||||||
|
if(StringUtils.isNotBlank(band) && band.length()>4) {
|
||||||
|
String bandNum=band.substring(4);
|
||||||
|
user.setBandLevel(Integer.valueOf(bandNum));
|
||||||
|
}else {
|
||||||
|
user.setBandLevel(0);
|
||||||
|
}
|
||||||
|
user.setAvatar("");
|
||||||
|
user.setCode(getNodeText(result.get("userNo")));
|
||||||
|
user.setDeleted(result.get("deleted").asBoolean());
|
||||||
|
user.setDepartId(getNodeText(result.get("departId")));
|
||||||
|
user.setDepartName("");//无此字段
|
||||||
|
user.setGender(1);//少此字段
|
||||||
|
user.setKid(getNodeText(result.get("kid")));
|
||||||
|
user.setLearningDuration(result.get("learningDuration").asInt());
|
||||||
|
user.setName(result.get("realName").asText());
|
||||||
|
user.setOrgNamePath(result.get("orgNamePath").asText());
|
||||||
|
user.setUserType(1);//直接设置为学员
|
||||||
|
if(StringUtils.isBlank(user.getCode())) {
|
||||||
|
log.error("通过接口获取当前用户信息【"+user.getId()+"】"+user.getName()+",工号为空,不能使用");
|
||||||
|
throw new RuntimeException("通过接口获取当前用户信息,工号为空,不能使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取当前用户信息错误",e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBaseUrl(String url) {
|
||||||
|
String baseUrl=SysConstant.getConfigValue("xboe.server.userbasic.url");
|
||||||
|
if(StringUtils.isBlank(baseUrl)) {
|
||||||
|
log.error("调用用户接口错误,未配置用户服务的地址【xboe.server.userbasic.url】");
|
||||||
|
throw new RuntimeException("获取用户信息错误,未配置用户服务的地址");
|
||||||
|
}
|
||||||
|
String reqUrl= baseUrl+"/user/info";
|
||||||
|
return reqUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.xboe.data.service;
|
package com.xboe.data.service;
|
||||||
|
|
||||||
import com.xboe.account.entity.Account;
|
import com.xboe.data.dto.UserData;
|
||||||
import com.xboe.system.organization.entity.Organization;
|
|
||||||
import com.xboe.system.user.entity.User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户数据的更橷
|
* 用户数据的更橷
|
||||||
@@ -17,5 +15,5 @@ public interface IDataUserSyncService {
|
|||||||
* @param org
|
* @param org
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void syncUserFull(Account a,User u,Organization org);
|
void syncUserFull(UserData user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
package com.xboe.data.service.impl;
|
package com.xboe.data.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.xboe.account.dao.AccountDao;
|
import com.xboe.account.dao.AccountDao;
|
||||||
import com.xboe.account.entity.Account;
|
import com.xboe.account.entity.Account;
|
||||||
|
import com.xboe.data.dto.UserData;
|
||||||
import com.xboe.data.service.IDataUserSyncService;
|
import com.xboe.data.service.IDataUserSyncService;
|
||||||
import com.xboe.module.teacher.dao.TeacherDao;
|
import com.xboe.module.teacher.dao.TeacherDao;
|
||||||
import com.xboe.module.teacher.entity.Teacher;
|
import com.xboe.module.teacher.entity.Teacher;
|
||||||
@@ -30,9 +34,80 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
@Autowired
|
@Autowired
|
||||||
TeacherDao teacherDao;
|
TeacherDao teacherDao;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void syncUserFull(Account a, User u, Organization org) {
|
public void syncUserFull(UserData user) {
|
||||||
|
|
||||||
|
//先查询是否存在
|
||||||
|
Account a=accountDao.get(user.getId());
|
||||||
|
User u=userDao.get(user.getId());
|
||||||
|
Organization org=null;
|
||||||
|
if(a!=null) {
|
||||||
|
//账户只是修改状态
|
||||||
|
if(user.getDeleted()!=null) {
|
||||||
|
a.setDeleted(user.getDeleted());
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
//新账户
|
||||||
|
a=new Account();
|
||||||
|
a.setDeleted(user.getDeleted());
|
||||||
|
a.setSysId(user.getKid());
|
||||||
|
a.setLoginName(user.getCode());
|
||||||
|
a.setAvatar(user.getAvatar());
|
||||||
|
a.setId(user.getId());
|
||||||
|
a.setRegTime(LocalDateTime.now());
|
||||||
|
a.setSysId(user.getKid());
|
||||||
|
a.setStatus(1);
|
||||||
|
}
|
||||||
|
if(u!=null) {
|
||||||
|
//更新部分用户字段
|
||||||
|
u.setDepartId(user.getDepartId());
|
||||||
|
u.setDepartName(user.getDepartName());
|
||||||
|
u.setName(user.getName());
|
||||||
|
//2022-12-8 去掉用户类型的更新,因为返回的数据都是学员,
|
||||||
|
//u.setUserType(user.getUserType());
|
||||||
|
if(user.getLearningDuration()>0) { //不大于0才会更新
|
||||||
|
u.setLearningDuration(user.getLearningDuration());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//新建用户
|
||||||
|
u=new User();
|
||||||
|
u.setId(user.getId());
|
||||||
|
u.setDepartId(user.getDepartId());
|
||||||
|
u.setDepartName(user.getDepartName());
|
||||||
|
u.setDynamic(0);
|
||||||
|
u.setGender(user.getGender());
|
||||||
|
u.setName(user.getName());
|
||||||
|
u.setSign("");
|
||||||
|
u.setUserNo(user.getCode());
|
||||||
|
u.setUserType(user.getUserType());
|
||||||
|
u.setSysId(user.getKid());
|
||||||
|
u.setStudyTotal(0);
|
||||||
|
u.setLearningDuration(user.getLearningDuration());
|
||||||
|
if(user.getBandLevel()!=null && user.getBandLevel()>15) {
|
||||||
|
u.setShowHome(false);//band16及以上
|
||||||
|
}else {
|
||||||
|
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//对机构的判断,不为空时才会处理,为空时不处理
|
||||||
|
if(StringUtils.isNotBlank(user.getDepartId())) {
|
||||||
|
org=orgDao.get(user.getDepartId());
|
||||||
|
if(org==null) {
|
||||||
|
org=new Organization();
|
||||||
|
org.setCode("");
|
||||||
|
org.setId(user.getDepartId());
|
||||||
|
org.setName(user.getDepartName());
|
||||||
|
org.setDeleted(false);
|
||||||
|
org.setStatus(1);
|
||||||
|
}
|
||||||
|
org.setNamePath(user.getOrgNamePath());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
accountDao.saveOrUpdate(a);
|
accountDao.saveOrUpdate(a);
|
||||||
userDao.saveOrUpdate(u);
|
userDao.saveOrUpdate(u);
|
||||||
if(org!=null) {
|
if(org!=null) {
|
||||||
|
|||||||
@@ -223,11 +223,7 @@ public class Cases extends BaseEntity {
|
|||||||
@Column(name = "case_value")
|
@Column(name = "case_value")
|
||||||
private String caseValue;
|
private String caseValue;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否属于优秀案例
|
|
||||||
* */
|
|
||||||
@Column(name = "excellent")
|
|
||||||
private Boolean excellent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置时间
|
* 设置时间
|
||||||
|
|||||||
@@ -472,12 +472,6 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
//同时添加发布事件,这里的创建人需要修改为教师
|
//同时添加发布事件,这里的创建人需要修改为教师
|
||||||
Course c=courseDao.get(id);
|
Course c=courseDao.get(id);
|
||||||
//删除分两种情况,一个是管理员删除,一个是自己删除 ,所以这里的处理移到前端了
|
//删除分两种情况,一个是管理员删除,一个是自己删除 ,所以这里的处理移到前端了
|
||||||
// if(eventSender!=null) {
|
|
||||||
// eventSender.send("删除课程","DeleteCourse", "删除课程【"+c.getName()+"】", c.getId(), "1", c.getName(), c.getSysCreateAid(), c.getSysCreateBy(),"");
|
|
||||||
// }else {
|
|
||||||
// log.error("未配置事件消息发送的实现");
|
|
||||||
// }
|
|
||||||
//删除
|
|
||||||
if(c.getFullTextId()!=null) {
|
if(c.getFullTextId()!=null) {
|
||||||
try {
|
try {
|
||||||
fullTextSearch.remove(ICourseFullTextSearch.DEFAULT_INDEX_NAME,c.getFullTextId());
|
fullTextSearch.remove(ICourseFullTextSearch.DEFAULT_INDEX_NAME,c.getFullTextId());
|
||||||
@@ -485,6 +479,26 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
log.error("删除课程时删除全文索引错误",e);
|
log.error("删除课程时删除全文索引错误",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//只有速有全文检索返回标识的,才算是发布过再删除的,删除消息
|
||||||
|
if(StringUtils.isNotBlank(c.getFullTextId())){
|
||||||
|
if(eventSender!=null) {
|
||||||
|
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId", id));
|
||||||
|
if(teachers.size()>0) {
|
||||||
|
String authorIds="";
|
||||||
|
for(CourseTeacher cteacher:teachers) {
|
||||||
|
if(authorIds.equals("")) {
|
||||||
|
authorIds+=cteacher.getTeacherId();
|
||||||
|
}else {
|
||||||
|
authorIds+="|"+cteacher.getTeacherId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String txt="管理删除课程";
|
||||||
|
eventSender.send(txt,"CourseDelete", "管理删除课程", c.getId(), "1", c.getName(), aid, name,"authors:"+authorIds);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
log.error("未配置事件消息发送的实现");
|
||||||
|
}
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
//彻底删除,课件设置为无课程状态
|
//彻底删除,课件设置为无课程状态
|
||||||
courseDao.setDeleted(id);
|
courseDao.setDeleted(id);
|
||||||
@@ -834,12 +848,23 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
//发布到全文检索中
|
//发布到全文检索中
|
||||||
Course c=courseDao.get(courseId);
|
Course c=courseDao.get(courseId);
|
||||||
if(fullTextSearch!=null) {
|
if(fullTextSearch!=null) {
|
||||||
|
|
||||||
this.fullTextPublish(c);
|
this.fullTextPublish(c);
|
||||||
}
|
}
|
||||||
//同时添加发布事件,这里的创建人需要修改为教师
|
//同时添加发布事件,这里的创建人需要修改为教师
|
||||||
if(eventSender!=null) {
|
if(eventSender!=null) {
|
||||||
eventSender.send("发布课程","PublishCourse", "发布课程【"+c.getName()+"】", c.getId(), "1", c.getName(), c.getSysCreateAid(), c.getSysCreateBy(),"");
|
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId", courseId));
|
||||||
|
if(teachers.size()>0) {
|
||||||
|
String authorIds="";
|
||||||
|
for(CourseTeacher cteacher:teachers) {
|
||||||
|
if(authorIds.equals("")) {
|
||||||
|
authorIds+=cteacher.getTeacherId();
|
||||||
|
}else {
|
||||||
|
authorIds+="|"+cteacher.getTeacherId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eventSender.send("发布课程","PublishCourse", "发布课程【"+c.getName()+"】", c.getId(), "1", c.getName(), aid,name,"authors:"+authorIds);
|
||||||
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
log.error("未配置事件消息发送的实现");
|
log.error("未配置事件消息发送的实现");
|
||||||
}
|
}
|
||||||
@@ -943,7 +968,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Override
|
@Override
|
||||||
public List<CourseTeacher> findTeachersByCourseId(String courseId) {
|
public List<CourseTeacher> findTeachersByCourseId(String courseId) {
|
||||||
|
|
||||||
return courseTeacherDao.findList(OrderCondition.desc("teacherName"),FieldFilters.eq("courseId", courseId));
|
return courseTeacherDao.findList(OrderCondition.desc("teacherId"),FieldFilters.eq("courseId", courseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -961,7 +986,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Override
|
@Override
|
||||||
public List<CourseTeacher> findTeachersByCourseIds(List<String> ids) {
|
public List<CourseTeacher> findTeachersByCourseIds(List<String> ids) {
|
||||||
|
|
||||||
return courseTeacherDao.findList(OrderCondition.desc("teacherName"),FieldFilters.in("courseId",ids));
|
return courseTeacherDao.findList(OrderCondition.desc("teacherId"),FieldFilters.in("courseId",ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import javax.annotation.Resource;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.xboe.common.OrderCondition;
|
||||||
import com.xboe.core.orm.FieldFilters;
|
import com.xboe.core.orm.FieldFilters;
|
||||||
import com.xboe.core.orm.QueryBuilder;
|
import com.xboe.core.orm.QueryBuilder;
|
||||||
import com.xboe.module.course.dao.CourseTeacherDao;
|
import com.xboe.module.course.dao.CourseTeacherDao;
|
||||||
@@ -39,7 +40,7 @@ public class CourseTeacherServiceImpl implements ICourseTeacherService {
|
|||||||
public CourseTeacherDto getTeacherByCourseId(String courseId) {
|
public CourseTeacherDto getTeacherByCourseId(String courseId) {
|
||||||
CourseTeacherDto dto = null;
|
CourseTeacherDto dto = null;
|
||||||
|
|
||||||
List<CourseTeacher> list = dao.findList(FieldFilters.eq("courseId",courseId));
|
List<CourseTeacher> list = dao.findList(OrderCondition.desc("teacherId"),FieldFilters.eq("courseId",courseId));
|
||||||
if(list != null && !list.isEmpty()){
|
if(list != null && !list.isEmpty()){
|
||||||
dto=new CourseTeacherDto();
|
dto=new CourseTeacherDto();
|
||||||
dto.setCourseId(courseId);
|
dto.setCourseId(courseId);
|
||||||
@@ -60,7 +61,7 @@ public class CourseTeacherServiceImpl implements ICourseTeacherService {
|
|||||||
public List<CourseTeacherDto> queryTeacher(Collection<String> ids) {
|
public List<CourseTeacherDto> queryTeacher(Collection<String> ids) {
|
||||||
List<CourseTeacherDto> teacherDtos = null;
|
List<CourseTeacherDto> teacherDtos = null;
|
||||||
if (ids != null && !ids.isEmpty()) {
|
if (ids != null && !ids.isEmpty()) {
|
||||||
List<CourseTeacher> list = dao.findList(FieldFilters.in("courseId",ids));
|
List<CourseTeacher> list = dao.findList(OrderCondition.desc("teacherId"),FieldFilters.in("courseId",ids));
|
||||||
if(list != null && !list.isEmpty()) {
|
if(list != null && !list.isEmpty()) {
|
||||||
teacherDtos = new ArrayList<>();
|
teacherDtos = new ArrayList<>();
|
||||||
for (String s : ids) {
|
for (String s : ids) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class ExamUserTask extends IdBaseEntity{
|
|||||||
/**
|
/**
|
||||||
* 群组,受众id
|
* 群组,受众id
|
||||||
*/
|
*/
|
||||||
@Column(name = "group_id",nullable=false,length=20)
|
@Column(name = "group_id",nullable=false,length=36)
|
||||||
private String groupId;
|
private String groupId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ import javax.transaction.Transactional;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.xboe.core.orm.FieldFilters;
|
import com.xboe.core.orm.FieldFilters;
|
||||||
|
import com.xboe.data.dto.AudienceUser;
|
||||||
|
import com.xboe.data.outside.IOutSideDataService;
|
||||||
import com.xboe.module.exam.dao.AloneExamAnswerDao;
|
import com.xboe.module.exam.dao.AloneExamAnswerDao;
|
||||||
import com.xboe.module.exam.dao.AloneExamDao;
|
import com.xboe.module.exam.dao.AloneExamDao;
|
||||||
import com.xboe.module.exam.dao.ExamUserTaskDao;
|
import com.xboe.module.exam.dao.ExamUserTaskDao;
|
||||||
import com.xboe.module.exam.dto.ExamTestDto;
|
import com.xboe.module.exam.dto.ExamTestDto;
|
||||||
import com.xboe.module.exam.entity.AloneExam;
|
import com.xboe.module.exam.entity.AloneExam;
|
||||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||||
import com.xboe.module.exam.entity.ExamPaper;
|
|
||||||
import com.xboe.module.exam.entity.ExamTest;
|
import com.xboe.module.exam.entity.ExamTest;
|
||||||
import com.xboe.module.exam.entity.ExamUserTask;
|
import com.xboe.module.exam.entity.ExamUserTask;
|
||||||
import com.xboe.module.exam.service.IExamUserTaskService;
|
import com.xboe.module.exam.service.IExamUserTaskService;
|
||||||
@@ -42,6 +43,9 @@ public class ExamUserTaskServiceImpl implements IExamUserTaskService{
|
|||||||
@Resource
|
@Resource
|
||||||
AloneExamDao aloneExamDao;
|
AloneExamDao aloneExamDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IOutSideDataService outSideService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void addTask(ExamTestDto task) {
|
public void addTask(ExamTestDto task) {
|
||||||
@@ -54,13 +58,13 @@ public class ExamUserTaskServiceImpl implements IExamUserTaskService{
|
|||||||
examUserTask.setTaskTime(LocalDateTime.now());
|
examUserTask.setTaskTime(LocalDateTime.now());
|
||||||
examUserTask.setStatus(ExamUserTask.STATUS_FINISH);
|
examUserTask.setStatus(ExamUserTask.STATUS_FINISH);
|
||||||
dao.save(examUserTask);
|
dao.save(examUserTask);
|
||||||
|
// 下面的代码应该调用rePushTask
|
||||||
//执行推送,当前因为是固定人,所以这里直接添加处理,按受众添加到每个人中
|
//执行推送,当前因为是固定人,所以这里直接添加处理,按受众添加到每个人中
|
||||||
//查询受众的信息
|
//查询受众的信息
|
||||||
List<UserGroupItem> items = ugroupDao.findList("groupId", task.getGroupId());
|
List<UserGroupItem> items = ugroupDao.findList("groupId", task.getGroupId());
|
||||||
if(items.size()>0) {
|
if(items.size()>0) {
|
||||||
//防止加入两条的问题,应该是先查询,再添加
|
//防止加入两条的问题,应该是先查询,再添加
|
||||||
Map<String,Object> amap= aloneExamDao.findMap("aid", "name",FieldFilters.eq("testId", task.getTestId()));
|
Map<String,Object> amap= aloneExamDao.findMap("aid", "name",FieldFilters.eq("testId", task.getTestId()));
|
||||||
|
|
||||||
//这里应该是单独的线程去处理
|
//这里应该是单独的线程去处理
|
||||||
for(UserGroupItem item :items) {
|
for(UserGroupItem item :items) {
|
||||||
if(amap.containsKey(item.getAid())) {
|
if(amap.containsKey(item.getAid())) {
|
||||||
@@ -90,7 +94,7 @@ public class ExamUserTaskServiceImpl implements IExamUserTaskService{
|
|||||||
@Transactional
|
@Transactional
|
||||||
public void rePushTask(ExamTestDto task) {
|
public void rePushTask(ExamTestDto task) {
|
||||||
//执行推送,当前因为是固定人,所以这里直接添加处理,按受众添加到每个人中
|
//执行推送,当前因为是固定人,所以这里直接添加处理,按受众添加到每个人中
|
||||||
//查询受众的信息
|
//查询受众的信息,2022、11、30 这个的返回需要从接口获取人员信息,然后推送
|
||||||
List<UserGroupItem> items = ugroupDao.findList("groupId", task.getGroupId());
|
List<UserGroupItem> items = ugroupDao.findList("groupId", task.getGroupId());
|
||||||
if(items.size()>0) {
|
if(items.size()>0) {
|
||||||
//防止加入两条的问题,应该是先查询,再添加
|
//防止加入两条的问题,应该是先查询,再添加
|
||||||
@@ -115,6 +119,33 @@ public class ExamUserTaskServiceImpl implements IExamUserTaskService{
|
|||||||
aloneExamDao.save(aloneExam);
|
aloneExamDao.save(aloneExam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//调用用户服务的接口,在启用下面的代码前,需要
|
||||||
|
// List<AudienceUser> sudienceUsers=outSideService.getUsersByAudienceId(task.getGroupId());
|
||||||
|
// if(sudienceUsers.size()>0) {
|
||||||
|
// //防止加入两条的问题,应该是先查询,再添加
|
||||||
|
// Map<String,Object> amap= aloneExamDao.findMap("aid", "name",FieldFilters.eq("testId", task.getTestId()));
|
||||||
|
// //这里应该是单独的线程去处理
|
||||||
|
// for(AudienceUser item :sudienceUsers) {
|
||||||
|
// if(amap.containsKey(item.getId())) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// //检查是否存在
|
||||||
|
// AloneExam aloneExam = new AloneExam();
|
||||||
|
// aloneExam.setAid(item.getId());
|
||||||
|
// aloneExam.setTestId(task.getTestId());
|
||||||
|
// aloneExam.setTestName(task.getTestName());
|
||||||
|
// aloneExam.setName(item.getName());
|
||||||
|
// aloneExam.setUcode(item.getCode());
|
||||||
|
// aloneExam.setTestDuration(task.getDuration());
|
||||||
|
// aloneExam.setTaskTime(LocalDateTime.now());
|
||||||
|
// aloneExam.setStartTime(task.getStartTime());
|
||||||
|
// aloneExam.setStatus(AloneExamAnswer.STATUS_NONE);//未考试过
|
||||||
|
// aloneExam.setScore(0f);
|
||||||
|
// aloneExamDao.save(aloneExam);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
//examUserTask.setStatus(ExamUserTask.STATUS_FINISH);
|
//examUserTask.setStatus(ExamUserTask.STATUS_FINISH);
|
||||||
//dao.update(examUserTask);
|
//dao.update(examUserTask);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class UserGroupItem extends IdEntity {
|
|||||||
/**
|
/**
|
||||||
* 受众ID
|
* 受众ID
|
||||||
*/
|
*/
|
||||||
@Column(name = "group_Id", nullable = false, length = 20)
|
@Column(name = "group_Id", nullable = false, length = 36)
|
||||||
private String groupId;
|
private String groupId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class StudyCourseDao extends BaseDao<StudyCourse> {
|
|||||||
public void finishCheck(String studyId,String courseId,Integer total){
|
public void finishCheck(String studyId,String courseId,Integer total){
|
||||||
int n=scItemDao.count(FieldFilters.eq("studyId",studyId));
|
int n=scItemDao.count(FieldFilters.eq("studyId",studyId));
|
||||||
if(total==null) {
|
if(total==null) {
|
||||||
total=courseContentDao.count(FieldFilters.eq("courseId", courseId));
|
total=courseContentDao.count(FieldFilters.eq("courseId", courseId),FieldFilters.eq("deleted",false));
|
||||||
}
|
}
|
||||||
|
|
||||||
//以下注意,float类型,是否等于100对应
|
//以下注意,float类型,是否等于100对应
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
|
|||||||
assess.setStudyItemId(sci.getId());
|
assess.setStudyItemId(sci.getId());
|
||||||
dao.save(assess);
|
dao.save(assess);
|
||||||
//检查是否全部学习完成
|
//检查是否全部学习完成
|
||||||
int totalContent=courseContentDao.count(FieldFilters.eq("courseId", assess.getCourseId()));
|
int totalContent=courseContentDao.count(FieldFilters.eq("courseId", assess.getCourseId()),FieldFilters.eq("deleted",false));
|
||||||
scDao.finishCheck(assess.getStudyId(),assess.getCourseId(),totalContent);
|
scDao.finishCheck(assess.getStudyId(),assess.getCourseId(),totalContent);
|
||||||
}else {
|
}else {
|
||||||
//转为评估只有一条,所以这里显示一条,不能再增加
|
//转为评估只有一条,所以这里显示一条,不能再增加
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
|||||||
//更新最终成绩
|
//更新最终成绩
|
||||||
//if(exam.get)
|
//if(exam.get)
|
||||||
//检查是否全部学习完成
|
//检查是否全部学习完成
|
||||||
int totalContent=courseContentDao.count(FieldFilters.eq("courseId", exam.getCourseId()));
|
int totalContent=courseContentDao.count(FieldFilters.eq("courseId", exam.getCourseId()),FieldFilters.eq("deleted",false));
|
||||||
scDao.finishCheck(exam.getStudyId(),exam.getCourseId(),totalContent);
|
scDao.finishCheck(exam.getStudyId(),exam.getCourseId(),totalContent);
|
||||||
}else {
|
}else {
|
||||||
exam.setStudyItemId(obj.toString());//此项就是学习条目的id
|
exam.setStudyItemId(obj.toString());//此项就是学习条目的id
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
|||||||
homework.setStudyItemId(sci.getId());
|
homework.setStudyItemId(sci.getId());
|
||||||
dao.save(homework);
|
dao.save(homework);
|
||||||
//检查是否全部学习完成
|
//检查是否全部学习完成
|
||||||
int totalContent=courseContentDao.count(FieldFilters.eq("courseId", homework.getCourseId()));
|
int totalContent=courseContentDao.count(FieldFilters.eq("courseId", homework.getCourseId()),FieldFilters.eq("deleted",false));
|
||||||
scDao.finishCheck(homework.getStudyId(),homework.getCourseId(),totalContent);
|
scDao.finishCheck(homework.getStudyId(),homework.getCourseId(),totalContent);
|
||||||
}else {
|
}else {
|
||||||
//只是保留一条作业记录,不再保存多条记录了
|
//只是保留一条作业记录,不再保存多条记录了
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class EventDataSender implements IEventDataSender{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(String title, String eventKey, String content, String objId, String objType, String objInfo,
|
public void send(String title, String eventKey, String content, String objId, String objType, String objInfo,
|
||||||
String aid, String aname,String author) {
|
String aid, String aname,String parameters) {
|
||||||
String statBaseUrl=SysConstant.getConfigValue("xboe.stat.base.url");
|
String statBaseUrl=SysConstant.getConfigValue("xboe.stat.base.url");
|
||||||
if(StringUtils.isBlank(statBaseUrl)) {
|
if(StringUtils.isBlank(statBaseUrl)) {
|
||||||
log.error("发送事件失败:未配置【xboe.stat.base.url】的值");
|
log.error("发送事件失败:未配置【xboe.stat.base.url】的值");
|
||||||
@@ -58,7 +58,7 @@ public class EventDataSender implements IEventDataSender{
|
|||||||
params.put("objInfo", objInfo);
|
params.put("objInfo", objInfo);
|
||||||
params.put("aid", aid);
|
params.put("aid", aid);
|
||||||
params.put("aname", aname);
|
params.put("aname", aname);
|
||||||
params.put("parameters","");
|
params.put("parameters",parameters);
|
||||||
String token = TokenProxy.getToken(request);
|
String token = TokenProxy.getToken(request);
|
||||||
//最后采用异常发送,不影响当前进程
|
//最后采用异常发送,不影响当前进程
|
||||||
|
|
||||||
|
|||||||
@@ -81,24 +81,6 @@ public class SysLoginApi extends ApiBaseController {
|
|||||||
return success(map);
|
return success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/login/send")
|
|
||||||
public JsonResponse<Map<String, String>> sendMessage() {
|
|
||||||
Map<String, String> rs=new HashMap<String, String>();
|
|
||||||
|
|
||||||
if(eventSender!=null) {
|
|
||||||
try {
|
|
||||||
eventSender.send("测试消息","keykey", "all测试消息","1231231", "1", "aaaa", "asdqadqw","wqwrqre","");
|
|
||||||
}catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return error("发送失败"+e.getMessage());
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
//log.error();
|
|
||||||
return error("未配置事件消息发送的实现");
|
|
||||||
}
|
|
||||||
return success(rs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户名和密码登录
|
* 根据用户名和密码登录
|
||||||
*
|
*
|
||||||
@@ -117,6 +99,9 @@ public class SysLoginApi extends ApiBaseController {
|
|||||||
if (!code.toLowerCase().equals(verCode)) {
|
if (!code.toLowerCase().equals(verCode)) {
|
||||||
return error("验证码错误");
|
return error("验证码错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 检查系统用户是否存在
|
// 检查系统用户是否存在
|
||||||
Account account = accountService.check(loginName,null);
|
Account account = accountService.check(loginName,null);
|
||||||
String passStr = "";
|
String passStr = "";
|
||||||
@@ -124,8 +109,27 @@ public class SysLoginApi extends ApiBaseController {
|
|||||||
passStr = MD5Util.MD5Encode(password + account.getPassKey());
|
passStr = MD5Util.MD5Encode(password + account.getPassKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 从redis缓存中获取5分钟内登陆错误的次数
|
||||||
|
String loginErrorNum = redisTemplate.opsForValue().get(CacheName.NAME_USER_LOGIN_ERROR_NUM+account);
|
||||||
|
Integer loginErrorCount = 0;
|
||||||
|
if(loginErrorNum != null){
|
||||||
|
loginErrorCount = Integer.parseInt(loginErrorNum);
|
||||||
|
}
|
||||||
|
|
||||||
if (account == null || StringUtil.isBlank(passStr) || !passStr.equals(account.getPassValue())) {
|
if (account == null || StringUtil.isBlank(passStr) || !passStr.equals(account.getPassValue())) {
|
||||||
return error("用户名或密码错误");
|
if(loginErrorCount >=5){
|
||||||
|
redisTemplate.opsForValue().set(CacheName.NAME_USER_LOGIN_ERROR_NUM+account, "5", 5, TimeUnit.MINUTES);
|
||||||
|
return error("由于您登录失败次数过多,账号已被锁定!");
|
||||||
|
}else{
|
||||||
|
loginErrorCount = loginErrorCount + 1;
|
||||||
|
redisTemplate.opsForValue().set(CacheName.NAME_USER_LOGIN_ERROR_NUM+account, loginErrorCount+"", 5, TimeUnit.MINUTES);
|
||||||
|
int next = (6-loginErrorCount);
|
||||||
|
if(next == 0){
|
||||||
|
return error("账号已被锁定");
|
||||||
|
}
|
||||||
|
return error("用户名或密码错误,您还有"+(6-loginErrorCount)+"次登录机会");
|
||||||
|
}
|
||||||
|
// return error("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (account.getStatus().equals(Constants.ACCOUNT_STATUS_DEACTIVATE)) {
|
if (account.getStatus().equals(Constants.ACCOUNT_STATUS_DEACTIVATE)) {
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ xboe.externalinterface.url.system=http://localhost:9091
|
|||||||
## 新增加的教师的内部调用接口
|
## 新增加的教师的内部调用接口
|
||||||
xboe.old.base.url=https://u-pre.boe.com
|
xboe.old.base.url=https://u-pre.boe.com
|
||||||
|
|
||||||
|
xboe.server.userbasic.url=https://u-pre.boe.com/userbasic
|
||||||
|
|
||||||
## 用户统计接口的api地址
|
## 用户统计接口的api地址
|
||||||
xboe.stat.base.url=http://127.0.0.1:9080
|
xboe.stat.base.url=http://127.0.0.1:9080
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,10 @@ public class BasicDataSyncServiceImpl implements IBasicDataSyncService{
|
|||||||
}
|
}
|
||||||
//同一个用户工号对应 多个kid的情况,所以直接根据kid查询是不对的,所以这里按工号查询,不使用kid
|
//同一个用户工号对应 多个kid的情况,所以直接根据kid查询是不对的,所以这里按工号查询,不使用kid
|
||||||
User user = userDao.findOne(FieldFilters.eq("userNo", dto.getUserNo()));
|
User user = userDao.findOne(FieldFilters.eq("userNo", dto.getUserNo()));
|
||||||
|
//2022-12-16 增加kid的判断
|
||||||
|
if(user==null){
|
||||||
|
user = userDao.findOne(FieldFilters.eq("kid",dto.getKid()));
|
||||||
|
}
|
||||||
if(user==null) {
|
if(user==null) {
|
||||||
//人员基本信息
|
//人员基本信息
|
||||||
Person person=new Person();
|
Person person=new Person();
|
||||||
@@ -230,8 +234,6 @@ public class BasicDataSyncServiceImpl implements IBasicDataSyncService{
|
|||||||
user.setPayrollPlaceId(dto.getPayrollPlaceId());
|
user.setPayrollPlaceId(dto.getPayrollPlaceId());
|
||||||
user.setPayrollPlaceName(dto.getPayrollPlaceName());
|
user.setPayrollPlaceName(dto.getPayrollPlaceName());
|
||||||
user.setEmployeeStatus(dto.getEmployeeStatus());
|
user.setEmployeeStatus(dto.getEmployeeStatus());
|
||||||
|
|
||||||
|
|
||||||
if(user.getStatus()==null) {
|
if(user.getStatus()==null) {
|
||||||
user.setStatus(1);//如果为空,就是正常
|
user.setStatus(1);//如果为空,就是正常
|
||||||
}
|
}
|
||||||
@@ -253,6 +255,7 @@ public class BasicDataSyncServiceImpl implements IBasicDataSyncService{
|
|||||||
}else {
|
}else {
|
||||||
//更新时不更新用户基本信息和账户信息
|
//更新时不更新用户基本信息和账户信息
|
||||||
user.setDescription(dto.getDescription());
|
user.setDescription(dto.getDescription());
|
||||||
|
user.setUserNo(dto.getUserNo());//同时更新UserNo;
|
||||||
user.setKid(dto.getKid());
|
user.setKid(dto.getKid());
|
||||||
user.setDomainId(dto.getDomainId());
|
user.setDomainId(dto.getDomainId());
|
||||||
user.setDuty(dto.getDuty());
|
user.setDuty(dto.getDuty());
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ public class MainDbSyncServiceImpl implements IMainDbSyncService {
|
|||||||
user.setNationality(dto.getNationality());
|
user.setNationality(dto.getNationality());
|
||||||
user.setOnline(true);
|
user.setOnline(true);
|
||||||
user.setDeleted(false);
|
user.setDeleted(false);
|
||||||
|
user.setUserType(0);
|
||||||
accountDao.save(a);
|
accountDao.save(a);
|
||||||
userDao.save(user);
|
userDao.save(user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,180 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>2.6.3</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
<groupId>com.xboe</groupId>
|
|
||||||
<artifactId>boe-server-case</artifactId>
|
|
||||||
<version>2.0.0</version>
|
|
||||||
<name>boe-server-case</name>
|
|
||||||
<description>BOEDX项目的任务处理服务</description>
|
|
||||||
<properties>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.xboe</groupId>
|
|
||||||
<artifactId>xboe-core</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.boe</groupId>
|
|
||||||
<artifactId>httpsdk</artifactId>
|
|
||||||
<scope>system</scope>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<systemPath>${project.basedir}/src/main/resources/libs/httpsdk-1.0.0.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
<!-- java-jwt -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.auth0</groupId>
|
|
||||||
<artifactId>java-jwt</artifactId>
|
|
||||||
<version>3.18.3</version>
|
|
||||||
</dependency>
|
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bitbucket.b_c</groupId>
|
|
||||||
<artifactId>jose4j</artifactId>
|
|
||||||
<version>0.7.9</version>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
<!-- apache commons -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-codec</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
|
||||||
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<version>5.1.27</version>
|
|
||||||
<!-- <scope>runtime</scope> -->
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
<!-- aspose -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aspose</groupId>
|
|
||||||
<artifactId>slides</artifactId>
|
|
||||||
<version>15.9.0</version>
|
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>${project.basedir}/src/main/resources/aspose/aspose.slides-15.9.0.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aspose</groupId>
|
|
||||||
<artifactId>words</artifactId>
|
|
||||||
<version>15.8.0</version>
|
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>${project.basedir}/src/main/resources/aspose/aspose-words-15.8.0.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aspose</groupId>
|
|
||||||
<artifactId>cells</artifactId>
|
|
||||||
<version>18.11</version>
|
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>${project.basedir}/src/main/resources/aspose/aspose-cells-java-18.11.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--加密配置文件-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.ulisesbocchio</groupId>
|
|
||||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
|
||||||
<version>3.0.3</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<includes>
|
|
||||||
<include>application-${profileActive}.properties</include>
|
|
||||||
<include>application.properties</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<filtering>false</filtering>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<excludes>
|
|
||||||
<exclude>*.properties</exclude>
|
|
||||||
</excludes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<!-- <version>3.8.0</version> -->
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<excludes>
|
|
||||||
<exclude>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</exclude>
|
|
||||||
</excludes>
|
|
||||||
<includeSystemScope>true</includeSystemScope>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>pro</id>
|
|
||||||
<properties>
|
|
||||||
<profileActive>pro</profileActive>
|
|
||||||
</properties>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
|
||||||
<id>pre</id>
|
|
||||||
<properties>
|
|
||||||
<profileActive>pre</profileActive>
|
|
||||||
</properties>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
|
||||||
<id>test</id>
|
|
||||||
<properties>
|
|
||||||
<profileActive>test</profileActive>
|
|
||||||
</properties>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
|
||||||
<id>dev</id>
|
|
||||||
<properties>
|
|
||||||
<profileActive>dev</profileActive>
|
|
||||||
</properties>
|
|
||||||
<activation>
|
|
||||||
<activeByDefault>true</activeByDefault>
|
|
||||||
</activation>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
</project>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.xboe;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.system.ApplicationPid;
|
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableCaching
|
|
||||||
public class BoeServerCaseApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.setProperty("jasypt.encryptor.password","jasypt");
|
|
||||||
SpringApplication.run(BoeServerCaseApplication.class, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
private void handlePid() throws IOException {
|
|
||||||
File file = new File("application-case.pid");
|
|
||||||
new ApplicationPid().write(file);
|
|
||||||
file.deleteOnExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package com.xboe;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回的数据中如果是null 就会转化成空字符串
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class ResultNullToEmptyConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@Primary
|
|
||||||
@ConditionalOnMissingBean(ObjectMapper.class)
|
|
||||||
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
|
|
||||||
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
|
|
||||||
objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() {
|
|
||||||
@Override
|
|
||||||
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
|
|
||||||
throws IOException, JsonProcessingException {
|
|
||||||
jsonGenerator.writeString("");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return objectMapper;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package com.xboe.casetask;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Configuration
|
|
||||||
public class CaseApiConfig {
|
|
||||||
|
|
||||||
@Value("${xboe.case.sync.init}")
|
|
||||||
private Boolean init;
|
|
||||||
|
|
||||||
@Value("${xboe.case.sync.api.url}")
|
|
||||||
private String apiUrl;
|
|
||||||
|
|
||||||
@Value("${xboe.case.sync.api.name}")
|
|
||||||
private String apiName;
|
|
||||||
|
|
||||||
@Value("${xboe.case.sync.api.version}")
|
|
||||||
private String apiVersion;
|
|
||||||
|
|
||||||
@Value("${xboe.case.sync.api.method}")
|
|
||||||
private String apiMethod;
|
|
||||||
|
|
||||||
@Value("${xboe.case.sync.api.ak}")
|
|
||||||
private String apiAK;
|
|
||||||
|
|
||||||
@Value("${xboe.case.sync.api.sk}")
|
|
||||||
private String apiSK;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,436 +0,0 @@
|
|||||||
package com.xboe.casetask;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.aspose.cells.PdfSaveOptions;
|
|
||||||
import com.aspose.cells.Workbook;
|
|
||||||
import com.aspose.slides.Presentation;
|
|
||||||
import com.aspose.words.Document;
|
|
||||||
import com.boe.csb.sdk.HttpCaller;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncCustomize;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncLog;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncRecord;
|
|
||||||
import com.xboe.casetask.entity.DictItem;
|
|
||||||
import com.xboe.casetask.entity.User;
|
|
||||||
import com.xboe.casetask.service.ICaseSyncLogService;
|
|
||||||
import com.xboe.casetask.service.ICaseSyncService;
|
|
||||||
import com.xboe.common.utils.StringUtil;
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 案例同步运行者
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class CaseDataSyncRunner {
|
|
||||||
|
|
||||||
private static final String FILETYPE=".pdf";
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
ICaseSyncService syncService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
ICaseSyncLogService syncLogService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
CaseApiConfig config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 指定时间参数
|
|
||||||
* @param start
|
|
||||||
* @param end
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void runByTime(String start,String end) throws Exception {
|
|
||||||
|
|
||||||
log.info("开始执行案例同步数据任务");
|
|
||||||
String httpUrl=config.getApiUrl();
|
|
||||||
String version=config.getApiVersion();
|
|
||||||
String reqMethod=config.getApiMethod();
|
|
||||||
String API_NAME = config.getApiName();
|
|
||||||
String ak = config.getApiAK();
|
|
||||||
String sk = config.getApiSK();
|
|
||||||
|
|
||||||
Map<String, String> data = new HashMap<String, String>();
|
|
||||||
data.put("TYLC07QueryService","{\"header\":{\"startTime\":\""+start+"\",\"endTime\":\""+end+"\"}}");
|
|
||||||
String result = null;
|
|
||||||
if("get".equals(reqMethod.toLowerCase())){
|
|
||||||
result = HttpCaller.doGet(httpUrl, API_NAME, version, data, ak, sk);
|
|
||||||
}else if("post".equals(reqMethod.toLowerCase())){
|
|
||||||
result = HttpCaller.doPost(httpUrl, API_NAME, version, data, ak, sk);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
CaseSyncLog csl=new CaseSyncLog();
|
|
||||||
csl.setLogTime(LocalDateTime.now());
|
|
||||||
csl.setRequest("{\"header\":{\"startTime\":\""+start+"\",\"endTime\":\""+end+"\"}}");
|
|
||||||
csl.setResponse(result);
|
|
||||||
syncLogService.save(csl);
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("记录请求日志错误",e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(result)) {
|
|
||||||
//记录结果字符串
|
|
||||||
//System.out.println(result);
|
|
||||||
log.info(result);
|
|
||||||
//解析等处理
|
|
||||||
doParser(result);
|
|
||||||
//
|
|
||||||
}else {
|
|
||||||
log.error("同步案例数据错误,未返回任何数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 直接运行,自动计算一天天
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void run() throws Exception {
|
|
||||||
|
|
||||||
LocalDate today=LocalDate.now();
|
|
||||||
DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
||||||
String start=formatter.format(today);
|
|
||||||
String end=formatter.format(today.plusDays(1));
|
|
||||||
runByTime(start,end);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void appendError(CaseSyncRecord csr,String error) {
|
|
||||||
csr.setStatus(1);
|
|
||||||
csr.setErrorInfo(csr.getErrorInfo()+","+error);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void downFile(CaseSyncRecord csr,JsonResultParser parser) {
|
|
||||||
String rootPath=SysConstant.getConfigValue(SysConstant.CONFIG_UPLOAD_FILES_SAVEPATH);
|
|
||||||
int lastIndex=csr.getAttachmentName().lastIndexOf(".");
|
|
||||||
if(lastIndex>0) {
|
|
||||||
String fileType=csr.getAttachmentName().substring(lastIndex);
|
|
||||||
//System.out.println("fileType="+fileType);
|
|
||||||
String savePathName=csr.getApprovalNumber()+fileType;//原文件名
|
|
||||||
String savePdfName=csr.getApprovalNumber()+FILETYPE;//保存的pdf名
|
|
||||||
|
|
||||||
LocalDate localDate=LocalDate.now();
|
|
||||||
String year=String.valueOf(localDate.getYear());
|
|
||||||
String month=String.valueOf(localDate.getMonthValue());
|
|
||||||
|
|
||||||
String savePath=rootPath+"/case/"+year+"/"+month;
|
|
||||||
|
|
||||||
File f=new File(savePath);
|
|
||||||
if(!f.exists()) {
|
|
||||||
f.mkdirs();
|
|
||||||
}
|
|
||||||
String fileUrl=csr.getAttachmentUrl();
|
|
||||||
try {
|
|
||||||
String beforePath=rootPath+"/case/"+year+"/"+month+"/"+savePathName;
|
|
||||||
//把名称进行转码处理
|
|
||||||
int urlLast=fileUrl.lastIndexOf("/");
|
|
||||||
if(urlLast==-1) {
|
|
||||||
this.appendError(csr, "下载案例文件地址解析错误【"+csr.getAttachmentUrl()+"】");
|
|
||||||
log.error("下载案例文件地址解析错误【"+csr.getAttachmentUrl()+"】");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String urlName=fileUrl.substring(urlLast+1);
|
|
||||||
fileUrl=fileUrl.substring(0, urlLast+1)+URLEncoder.encode(urlName, "UTF-8");
|
|
||||||
fileUrl=fileUrl.replaceAll("\\+","%20");
|
|
||||||
log.info("下载文件:"+fileUrl);
|
|
||||||
parser.download(fileUrl, beforePath);
|
|
||||||
//转化为pdf
|
|
||||||
File downFile=new File(beforePath);
|
|
||||||
if(downFile.exists()) {
|
|
||||||
String dbPath="/case/"+year+"/"+month+"/"+savePdfName;
|
|
||||||
|
|
||||||
if(!fileType.toLowerCase().equals(FILETYPE)) {
|
|
||||||
log.info("转化pdf:"+beforePath);
|
|
||||||
this.convertPdf(fileType, beforePath,rootPath+dbPath);
|
|
||||||
}
|
|
||||||
csr.setFilePath(dbPath);//设置到存储数据库
|
|
||||||
}else {
|
|
||||||
log.error("下载案例文件错误【"+csr.getAttachmentUrl()+"】");
|
|
||||||
log.error("下载的处理之后的url路径【"+fileUrl+"】");
|
|
||||||
this.appendError(csr, "下载案例文件错误【"+csr.getAttachmentUrl()+"】");
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("下载案例文件错误【"+csr.getAttachmentUrl()+"】");
|
|
||||||
log.error("下载的处理之后的url路径【"+fileUrl+"】");
|
|
||||||
log.error("下载案例文件错误",e);
|
|
||||||
this.appendError(csr, "下载案例文件错误或转化PDF错误【"+csr.getAttachmentUrl()+"】"+e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getNameStr(String name) {
|
|
||||||
String first=name.replaceAll("\\(","(");
|
|
||||||
int index1=first.indexOf("(");
|
|
||||||
if(index1>0) {
|
|
||||||
first=first.substring(0,index1);
|
|
||||||
}
|
|
||||||
return first;
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
// String str="显示-前台SBU1__eol__(包括:前台:MNT SBU、NB SBU、TPC SBU、TV SBU、F1 SBU、Mobile SBU、产销管理中心、车载SBU、SC SBU、C SBU、显示事业数字化变革管理办公室;终端营销协调组:MNT终端产品线、TV终端产品线、NB终端产品线、TPC终端产品线、3D显示特战队;中台:产销管理中心)";
|
|
||||||
// CaseDataSyncRunner runner=new CaseDataSyncRunner();
|
|
||||||
// System.out.println(runner.getNameStr(str));
|
|
||||||
// System.out.println("显示-前台SBU1__eol__");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
public void doParser(String json) throws Exception {
|
|
||||||
|
|
||||||
JsonResultParser parser=new JsonResultParser();
|
|
||||||
String rootPath=SysConstant.getConfigValue(SysConstant.CONFIG_UPLOAD_FILES_SAVEPATH);
|
|
||||||
|
|
||||||
|
|
||||||
List<CaseSyncRecord> cases = parser.parseJson(json,rootPath);
|
|
||||||
if(cases.size()>0) {
|
|
||||||
Map<String,String> majorTypeMap = syncService.getMajorTypes();
|
|
||||||
//因为每次同步并不一定多,所以这里直接一条一条的查询比对
|
|
||||||
for(CaseSyncRecord csr : cases) {
|
|
||||||
|
|
||||||
String hasId=syncService.getIdByApprovalNumber(csr.getApprovalNumber());
|
|
||||||
if(StringUtils.isNotBlank(hasId)){
|
|
||||||
//已经存在,不再更新
|
|
||||||
csr.setAddNew(false);
|
|
||||||
csr.setStatus(1);
|
|
||||||
csr.setErrorInfo(csr.getErrorInfo()+",内容已存在,不再替换");
|
|
||||||
syncService.saveRecord(csr);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
//下载附件文件
|
|
||||||
if(StringUtils.isNotBlank(csr.getAttachmentUrl())){
|
|
||||||
downFile(csr,parser);
|
|
||||||
}else {
|
|
||||||
if(csr.getAttachmentList()!=null) {
|
|
||||||
CaseSyncCustomize customize= syncService.getLastCustomizeByApprovalNumber(csr.getApprovalNumber());
|
|
||||||
if(customize!=null && customize.getAttachmentIndex()!=null) {
|
|
||||||
if(csr.getAttachmentList().size()>customize.getAttachmentIndex()) {
|
|
||||||
String[] choose=csr.getAttachmentList().get(customize.getAttachmentIndex());
|
|
||||||
if(choose[0].equals(customize.getAttachmentName())) {
|
|
||||||
csr.setAttachmentUrl(choose[1]);
|
|
||||||
csr.setAttachmentName(choose[0]);
|
|
||||||
downFile(csr,parser);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
appendError(csr,"附件配置与返回结果有变化,无法清确匹配,需要重新指定");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
|
||||||
appendError(csr,"附件处理失败");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
appendError(csr,"附件处理失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//组织领域,无根据名称查找 ,再根据找到filter 对应code去找上级的名称
|
|
||||||
if(StringUtils.isNotBlank(csr.getCaseOwnerOrg())) {
|
|
||||||
String firstName=null;
|
|
||||||
DictItem dictItem=null;
|
|
||||||
List<DictItem> items=syncService.findDictItemByName(csr.getCaseOwnerOrg());
|
|
||||||
if(!items.isEmpty()) {
|
|
||||||
dictItem=items.get(0);
|
|
||||||
firstName=csr.getCaseOwnerOrg();
|
|
||||||
}else {
|
|
||||||
firstName=getNameStr(csr.getCaseOwnerOrg());
|
|
||||||
List<DictItem> item2s=syncService.findDictItemByName(firstName);
|
|
||||||
if(!item2s.isEmpty()) {
|
|
||||||
dictItem=item2s.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(dictItem!=null) {
|
|
||||||
csr.setOrgDomain(firstName);
|
|
||||||
csr.setOrgDomainId(dictItem.getCode());
|
|
||||||
//上级的名称
|
|
||||||
DictItem parent=syncService.getDictItemByCode(dictItem.getFilter());
|
|
||||||
if(parent==null) {
|
|
||||||
csr.setStatus(1);
|
|
||||||
csr.setErrorInfo(csr.getErrorInfo()+",未匹配到组织领域上级【"+csr.getCaseOwnerOrg()+"】"+firstName);
|
|
||||||
}else {
|
|
||||||
csr.setOrgDomainParent(parent.getName());
|
|
||||||
csr.setOrgDomainParentId(parent.getCode());
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
appendError(csr, "未匹配到组织领域【"+csr.getCaseOwnerOrg()+"】"+firstName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}else {
|
|
||||||
appendError(csr,"无组织领域【"+csr.getCaseOwnerOrg()+"】");
|
|
||||||
}
|
|
||||||
//专业分类
|
|
||||||
if(StringUtil.isNotBlank(csr.getCaseSpecialtySequence()) ) {
|
|
||||||
//替换逗号
|
|
||||||
String[] names=csr.getCaseSpecialtySequence().split(",");
|
|
||||||
csr.setMajorTypeIdList(new ArrayList<>());
|
|
||||||
for(String sname :names) {
|
|
||||||
String first=getNameStr(sname);
|
|
||||||
if(majorTypeMap.containsKey(first)) {
|
|
||||||
String code=majorTypeMap.get(first);
|
|
||||||
csr.getMajorTypeIdList().add(code);
|
|
||||||
// csr.setMajorType(first);
|
|
||||||
// csr.setMajorTypeId(code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(csr.getMajorTypeIdList().isEmpty()) {
|
|
||||||
this.appendError(csr, "未匹配到任何专业分类【"+csr.getCaseSpecialtySequence()+"】");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//System.out.println("first="+first);
|
|
||||||
// if(majorTypeMap.containsKey(first)) {
|
|
||||||
// String code=majorTypeMap.get(first);
|
|
||||||
// csr.setMajorType(first);
|
|
||||||
// csr.setMajorTypeId(code);
|
|
||||||
// }else {
|
|
||||||
// csr.setStatus(1);
|
|
||||||
// this.appendError(csr, "未匹配到专业分类【"+csr.getCaseSpecialtySequence()+"】");
|
|
||||||
// }
|
|
||||||
}else {
|
|
||||||
if(StringUtils.isBlank(csr.getMajorTypeId())) {
|
|
||||||
csr.setStatus(1);
|
|
||||||
csr.setErrorInfo(csr.getErrorInfo()+",未匹配到专业分类【"+csr.getCaseSpecialtySequence()+"】");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//用户的转化处理,各种异常处理
|
|
||||||
String owner =csr.getCaseOwner();
|
|
||||||
if(StringUtils.isNotBlank(owner)) {
|
|
||||||
int leftIdx=owner.indexOf("<");
|
|
||||||
if(leftIdx>-1) {
|
|
||||||
String no=owner.substring(0,leftIdx);
|
|
||||||
//String author=owner.substring(leftIdx+1,owner.length()-1);
|
|
||||||
//1010返回的json作者信息有变化,后面多了两个<>, 所以这里规则改一下
|
|
||||||
String author=owner.substring(leftIdx+1,owner.indexOf(">"));
|
|
||||||
String id= syncService.getIdByUserNo(no);
|
|
||||||
if(id==null) {
|
|
||||||
csr.setStatus(1);
|
|
||||||
csr.setErrorInfo(csr.getErrorInfo()+",关联用户失败【"+csr.getCaseOwner()+"】");
|
|
||||||
}else {
|
|
||||||
csr.setAuthorId(id);
|
|
||||||
csr.setAuthorName(author);
|
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
|
||||||
//这种情况把它当成单独的工号处理
|
|
||||||
User u= syncService.getByUserNo(owner);
|
|
||||||
if(u==null) {
|
|
||||||
csr.setStatus(1);
|
|
||||||
csr.setErrorInfo(csr.getErrorInfo()+",关联用户失败【"+csr.getCaseOwner()+"】");
|
|
||||||
}else {
|
|
||||||
csr.setAuthorId(u.getId());
|
|
||||||
csr.setAuthorName(u.getName());
|
|
||||||
}
|
|
||||||
// csr.setStatus(1);
|
|
||||||
// csr.setErrorInfo(csr.getErrorInfo()+",caseOwner数据格式错误【"+owner+"】");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
csr.setStatus(1);
|
|
||||||
csr.setErrorInfo(csr.getErrorInfo()+",无caseOwner信息");
|
|
||||||
}
|
|
||||||
//检查是否已存在,移到Service中
|
|
||||||
//Cases has=syncService.getByApprovalNumber(csr.getApprovalNumber());
|
|
||||||
// String hasId=syncService.getIdByApprovalNumber(csr.getApprovalNumber());
|
|
||||||
// if(StringUtils.isBlank(hasId)){
|
|
||||||
// csr.setAddNew(true);
|
|
||||||
// }else {
|
|
||||||
// //csr.setCaseInfo(has);
|
|
||||||
// csr.setAddNew(false);
|
|
||||||
// }
|
|
||||||
}catch(Exception ee) {
|
|
||||||
log.error("解决处理字段错误",ee);
|
|
||||||
this.appendError(csr,"处理字段错误:"+ee.getMessage());
|
|
||||||
}
|
|
||||||
syncService.saveRecord(csr);
|
|
||||||
//单独的保存
|
|
||||||
syncService.saveCase(csr);
|
|
||||||
}
|
|
||||||
|
|
||||||
//syncService.saveCase(cases);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean loadLicense = false;
|
|
||||||
|
|
||||||
private boolean getLicense() {
|
|
||||||
if (!loadLicense) {
|
|
||||||
try {
|
|
||||||
InputStream is = this.getClass().getResourceAsStream("/aspose/license.xml");
|
|
||||||
com.aspose.cells.License cellAposeLic = new com.aspose.cells.License();
|
|
||||||
cellAposeLic.setLicense(is);
|
|
||||||
|
|
||||||
is = this.getClass().getResourceAsStream("/aspose/license.xml");
|
|
||||||
com.aspose.words.License wordAposeLic = new com.aspose.words.License();
|
|
||||||
wordAposeLic.setLicense(is);
|
|
||||||
|
|
||||||
is = this.getClass().getResourceAsStream("/aspose/license.xml");
|
|
||||||
com.aspose.slides.License pptAposeLic = new com.aspose.slides.License();
|
|
||||||
pptAposeLic.setLicense(is);
|
|
||||||
|
|
||||||
loadLicense = true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("读取aspose license文件失败",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return loadLicense;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void convertPdf(String fileType, String filePath,String pdfPath) throws Exception{
|
|
||||||
if (this.getLicense()) {
|
|
||||||
File pdfFile = new File(pdfPath);// 输出路径
|
|
||||||
FileOutputStream fileOS =null;
|
|
||||||
try {
|
|
||||||
if(".doc,.docx".indexOf(fileType)>-1) {
|
|
||||||
fileOS = new FileOutputStream(pdfFile);
|
|
||||||
Document doc = new Document(filePath);//
|
|
||||||
doc.save(fileOS, com.aspose.words.SaveFormat.PDF);
|
|
||||||
}else if(".xls,.xlsx".indexOf(fileType)>-1) {
|
|
||||||
fileOS = new FileOutputStream(pdfFile);
|
|
||||||
Workbook wb = new Workbook(filePath);// 原始excel路径
|
|
||||||
//wb.save(fileOS, com.aspose.cells.SaveFormat.PDF);
|
|
||||||
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
|
|
||||||
pdfSaveOptions.setAllColumnsInOnePagePerSheet(true);
|
|
||||||
wb.save(fileOS, pdfSaveOptions);
|
|
||||||
}else if(".ppt,.pptx".indexOf(fileType)>-1) {
|
|
||||||
fileOS = new FileOutputStream(pdfFile);
|
|
||||||
InputStream slides = new FileInputStream(filePath);// 原始ppt路径
|
|
||||||
Presentation pres = new Presentation(slides);
|
|
||||||
pres.save(fileOS, com.aspose.slides.SaveFormat.Pdf);
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch(Exception e) {
|
|
||||||
throw e;
|
|
||||||
}finally {
|
|
||||||
if(fileOS!=null) {
|
|
||||||
fileOS.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.xboe.casetask;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 案例数据同步处理
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@EnableScheduling
|
|
||||||
@Component("com.xboe.casetask.CaseDataTimeSchedule")
|
|
||||||
public class CaseDataTimeSchedule{
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
CaseDataSyncRunner runner;
|
|
||||||
|
|
||||||
/**每隔12个小时执行一次*/
|
|
||||||
@Scheduled(cron="0 0 12,22 * * ?")
|
|
||||||
public void execute() {
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
runner.run();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("同步案例数据错误",e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
package com.xboe.casetask;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.http.HttpEntity;
|
|
||||||
import org.apache.http.HttpResponse;
|
|
||||||
import org.apache.http.client.HttpClient;
|
|
||||||
import org.apache.http.client.methods.HttpGet;
|
|
||||||
import org.apache.http.impl.client.HttpClients;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncRecord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 案例的解析处理
|
|
||||||
* 此类只是负责解析处理,不做业务逻辑判断
|
|
||||||
*/
|
|
||||||
public class JsonResultParser {
|
|
||||||
|
|
||||||
|
|
||||||
private String getString(JsonNode node,String name, String def) {
|
|
||||||
if(node.has(name)) {
|
|
||||||
return node.get(name).asText();
|
|
||||||
}else {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private LocalDateTime getTime(JsonNode node,String name) {
|
|
||||||
if(node.has(name)) {
|
|
||||||
//System.out.println("node.get(name)="+node.get(name));
|
|
||||||
String strTime=node.get(name).asText();
|
|
||||||
if(strTime.lastIndexOf(".0")>-1) {
|
|
||||||
LocalDateTime dateTime=LocalDateTime.parse(node.get(name).asText(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0"));
|
|
||||||
return dateTime;
|
|
||||||
}else {
|
|
||||||
LocalDateTime dateTime=LocalDateTime.parse(node.get(name).asText(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
return dateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void download(String url, String filepath) throws Exception{
|
|
||||||
|
|
||||||
InputStream is =null;
|
|
||||||
File file=null;
|
|
||||||
FileOutputStream fileout=null;
|
|
||||||
try {
|
|
||||||
HttpClient client = HttpClients.createDefault();
|
|
||||||
HttpGet httpget = new HttpGet(url);
|
|
||||||
// 加入Referer,防止防盗链
|
|
||||||
//httpget.setHeader("Referer", url);
|
|
||||||
httpget.setHeader("Referer", "");
|
|
||||||
HttpResponse response = client.execute(httpget);
|
|
||||||
HttpEntity entity = response.getEntity();
|
|
||||||
is=entity.getContent();
|
|
||||||
|
|
||||||
file = new File(filepath);
|
|
||||||
file.getParentFile().mkdirs();
|
|
||||||
fileout = new FileOutputStream(file);
|
|
||||||
byte[] buffer = new byte[10240];
|
|
||||||
int ch = 0;
|
|
||||||
while ((ch = is.read(buffer)) != -1) {
|
|
||||||
fileout.write(buffer, 0, ch);
|
|
||||||
}
|
|
||||||
fileout.flush();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw e;
|
|
||||||
} catch (UnsupportedOperationException e) {
|
|
||||||
throw e;
|
|
||||||
} finally {
|
|
||||||
if(fileout!=null) {
|
|
||||||
try {
|
|
||||||
fileout.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(is!=null) {
|
|
||||||
try {
|
|
||||||
is.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CaseSyncRecord> parseJson(String json,String rootPath) throws Exception {
|
|
||||||
|
|
||||||
JsonResultParser parser=new JsonResultParser();
|
|
||||||
List<CaseSyncRecord> cases=new ArrayList<CaseSyncRecord>();
|
|
||||||
|
|
||||||
ObjectMapper mapper=new ObjectMapper();
|
|
||||||
|
|
||||||
JsonNode root = mapper.readTree(json);
|
|
||||||
JsonNode result=root.get("TYLC07QueryServiceResponse").get("return");
|
|
||||||
int code=result.get("code").asInt();
|
|
||||||
if(code!=0) {
|
|
||||||
//System.out.println("code:"+code+",msg="+result.get("msg"));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
JsonNode dataList=result.get("data");
|
|
||||||
//因为返回内容有null的情况
|
|
||||||
if(dataList==null || dataList.isEmpty()) {
|
|
||||||
return cases;
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator<JsonNode> list=dataList.iterator();
|
|
||||||
|
|
||||||
while(list.hasNext()) {
|
|
||||||
JsonNode item=list.next();
|
|
||||||
CaseSyncRecord c=new CaseSyncRecord();
|
|
||||||
c.setStatus(0);
|
|
||||||
c.setAddNew(true);
|
|
||||||
c.setErrorInfo("");
|
|
||||||
|
|
||||||
c.setApprovalNumber(parser.getString(item,"approvalNumber",""));
|
|
||||||
c.setCaseChannel(parser.getString(item,"caseChannel",""));
|
|
||||||
c.setCaseFlow(parser.getString(item,"caseFlow",""));
|
|
||||||
c.setCaseOtherContributor(parser.getString(item,"caseOtherContributor",""));
|
|
||||||
c.setCaseOwner(parser.getString(item,"caseOwner",""));
|
|
||||||
c.setCaseOwnerDepartment(parser.getString(item,"caseOwnerDepartment",""));
|
|
||||||
c.setCaseOwnerOrg(parser.getString(item,"caseOwnerOrg",""));
|
|
||||||
c.setCaseOwnerPhone(parser.getString(item,"caseOwnerPhone",""));
|
|
||||||
c.setCaseScope(parser.getString(item,"caseScope",""));
|
|
||||||
c.setCaseSpecialtySequence(parser.getString(item,"caseSpecialtySequence",""));
|
|
||||||
|
|
||||||
c.setCaseTheme(parser.getString(item,"caseTheme",""));
|
|
||||||
c.setCaseThemeDescription(parser.getString(item,"caseThemeDescription",""));
|
|
||||||
c.setCaseTheme1(parser.getString(item,"caseTheme1",""));
|
|
||||||
c.setCaseThemeDescription1(parser.getString(item,"caseThemeDescription1",""));
|
|
||||||
c.setCaseTheme2(parser.getString(item,"caseTheme2",""));
|
|
||||||
c.setCaseThemeDescription2(parser.getString(item,"caseThemeDescription2",""));
|
|
||||||
|
|
||||||
c.setCaseType(parser.getString(item,"caseType",""));
|
|
||||||
c.setCaseType1(parser.getString(item,"caseType1",""));
|
|
||||||
c.setCaseType2(parser.getString(item,"caseType2",""));
|
|
||||||
|
|
||||||
c.setCaseValue(parser.getString(item,"caseValue",""));
|
|
||||||
c.setConfidentialityLevel(parser.getString(item,"confidentialityLevel",""));
|
|
||||||
c.setContactNumber(parser.getString(item,"caseFlow",""));
|
|
||||||
c.setDrafter(parser.getString(item,"drafter",""));
|
|
||||||
c.setDrafter(parser.getString(item,"draftingTime",""));
|
|
||||||
|
|
||||||
c.setEmail(parser.getString(item,"email",""));
|
|
||||||
|
|
||||||
String isLeadershipPlan=parser.getString(item,"isLeadershipPlan","");
|
|
||||||
c.setIsLeadershipPlan(isLeadershipPlan.equals("是")? true:false);
|
|
||||||
|
|
||||||
c.setKeyword1(parser.getString(item,"keyword1",""));
|
|
||||||
c.setKeyword2(parser.getString(item,"keyword2",""));
|
|
||||||
c.setKeyword3(parser.getString(item,"keyword3",""));
|
|
||||||
c.setKeyword4(parser.getString(item,"keyword4",""));
|
|
||||||
c.setKeyword5(parser.getString(item,"keyword5",""));
|
|
||||||
c.setReaders(parser.getString(item,"readers",""));
|
|
||||||
c.setDepartment(parser.getString(item,"department",""));
|
|
||||||
c.setCaseName(parser.getString(item,"caseName",""));
|
|
||||||
c.setCaseSummary(parser.getString(item,"caseSummary",""));
|
|
||||||
|
|
||||||
c.setDraftingTime(parser.getTime(item,"draftingTime"));
|
|
||||||
c.setEndTime(parser.getTime(item,"endTime"));
|
|
||||||
//approvalRecord 直接转化为json保存
|
|
||||||
JsonNode approvalRecord=item.get("approvalRecord");
|
|
||||||
if(approvalRecord!=null) {
|
|
||||||
c.setApprovalRecord(approvalRecord.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonNode attachment=item.get("attachment");
|
|
||||||
if(attachment!=null) {
|
|
||||||
if(attachment.isArray()) {
|
|
||||||
//多个附件的情况下,所附件弄成字符串保存起来
|
|
||||||
c.setAttachment(attachment.toString());
|
|
||||||
//在数据组中查找名字
|
|
||||||
c.setAttachmentList(new ArrayList<>());
|
|
||||||
Iterator<JsonNode> fileList=attachment.iterator();
|
|
||||||
while(fileList.hasNext()) {
|
|
||||||
JsonNode one=fileList.next();
|
|
||||||
String[] values=new String[2];
|
|
||||||
values[0]=parser.getString(one,"attachmentName","");
|
|
||||||
values[1]=parser.getString(one,"attachmentUrl","");
|
|
||||||
c.getAttachmentList().add(values);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
c.setAttachmentName(parser.getString(item.get("attachment"),"attachmentName",""));
|
|
||||||
c.setAttachmentUrl(parser.getString(item.get("attachment"),"attachmentUrl",""));
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
c.setStatus(1);//附件处理失败
|
|
||||||
c.setErrorInfo(c.getErrorInfo()+"附件字段attachment不存在");
|
|
||||||
}
|
|
||||||
cases.add(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return cases;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
package com.xboe.casetask.api;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.xboe.casetask.CaseDataSyncRunner;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncCustomize;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncLog;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncRecord;
|
|
||||||
import com.xboe.casetask.service.ICaseSyncLogService;
|
|
||||||
import com.xboe.casetask.service.ICaseSyncService;
|
|
||||||
import com.xboe.common.PageList;
|
|
||||||
import com.xboe.common.Pagination;
|
|
||||||
import com.xboe.core.JsonResponse;
|
|
||||||
import com.xboe.core.api.ApiBaseController;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping(value = "/inner/task/cases")
|
|
||||||
public class CaseTaskApi extends ApiBaseController{
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
ICaseSyncService service;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
ICaseSyncLogService logService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
CaseDataSyncRunner runner;
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/logs")
|
|
||||||
public JsonResponse<PageList<CaseSyncLog>> logs(Pagination page) {
|
|
||||||
|
|
||||||
PageList<CaseSyncLog> result = logService.findPage(page.getPageIndex(),page.getPageSize());
|
|
||||||
|
|
||||||
return success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/logs-clear")
|
|
||||||
public JsonResponse<Boolean> logsClear() {
|
|
||||||
|
|
||||||
logService.clearLogs();
|
|
||||||
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/records")
|
|
||||||
public JsonResponse<PageList<CaseSyncRecord>> records(Pagination page, CaseSyncRecord record) {
|
|
||||||
|
|
||||||
PageList<CaseSyncRecord> result = service.findPage(page.getPageIndex(),page.getPageSize(), record);
|
|
||||||
|
|
||||||
return success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/records-delete")
|
|
||||||
public JsonResponse<Boolean> recordDelete(String id) {
|
|
||||||
if(StringUtils.isBlank(id)) {
|
|
||||||
return error("未指定id");
|
|
||||||
}
|
|
||||||
|
|
||||||
service.deleteRecord(id);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/save-config")
|
|
||||||
public JsonResponse<CaseSyncCustomize> saveConfig(CaseSyncCustomize csc) {
|
|
||||||
if (StringUtils.isBlank(csc.getApprovalNumber())) {
|
|
||||||
return error("未批定审批单号");
|
|
||||||
}
|
|
||||||
if (csc.getAttachmentIndex()==null) {
|
|
||||||
return error("未指定附件记录");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
service.saveCaseSyncCustomize(csc);
|
|
||||||
return success(csc);
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("保存同步附件设置错误",e);
|
|
||||||
return error("保存同步附件设置失败",e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按指定时间同步处理
|
|
||||||
* @param start
|
|
||||||
* @param end
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/sync-start-end")
|
|
||||||
public JsonResponse<Boolean> runByStartEnd(String start,String end) {
|
|
||||||
if (StringUtils.isBlank(start)) {
|
|
||||||
return error("缺少必要参数");
|
|
||||||
}
|
|
||||||
if (StringUtils.isBlank(end)) {
|
|
||||||
return error("缺少必要参数");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
runner.runByTime(start, end);
|
|
||||||
return success(true);
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("指定时间同步案例错误",e);
|
|
||||||
return error("同步案例失败",e.getMessage(),false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按时间执行
|
|
||||||
* @param start
|
|
||||||
* @param end
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/sync-by-time")
|
|
||||||
public JsonResponse<Boolean> runByTime(String id,String time) {
|
|
||||||
if (StringUtils.isBlank(id)) {
|
|
||||||
return error("缺少必要参数");
|
|
||||||
}
|
|
||||||
if (StringUtils.isBlank(time)) {
|
|
||||||
return error("缺少必要参数");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
//转化时间
|
|
||||||
LocalDateTime dateTime=null;
|
|
||||||
if(time.lastIndexOf(".0")>-1) {
|
|
||||||
dateTime=LocalDateTime.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0"));
|
|
||||||
}else {
|
|
||||||
dateTime=LocalDateTime.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
}
|
|
||||||
|
|
||||||
DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
||||||
//通过前后10分钟上设置查询区间
|
|
||||||
String start=formatter.format(dateTime);
|
|
||||||
//String end=formatter.format(dateTime.plusMinutes(10));
|
|
||||||
|
|
||||||
runner.runByTime(start, start);
|
|
||||||
return success(true);
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("指定时间同步案例错误",e);
|
|
||||||
return error("同步案例失败",e.getMessage(),false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.xboe.casetask.dao;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import com.xboe.casetask.entity.CaseSyncCustomize;
|
|
||||||
import com.xboe.core.orm.BaseDao;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class CaseSyncCustomizeDao extends BaseDao<CaseSyncCustomize>{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.xboe.casetask.dao;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import com.xboe.casetask.entity.CaseSyncLog;
|
|
||||||
import com.xboe.core.orm.BaseDao;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class CaseSyncLogDao extends BaseDao<CaseSyncLog>{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
package com.xboe.casetask.dao;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import com.xboe.casetask.entity.CaseSyncRecord;
|
|
||||||
import com.xboe.casetask.entity.DictItem;
|
|
||||||
import com.xboe.core.orm.BaseDao;
|
|
||||||
import com.xboe.standard.BaseConstant;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class CaseSyncRecordDao extends BaseDao<CaseSyncRecord>{
|
|
||||||
|
|
||||||
public List<DictItem> findDictItemByName(String name){
|
|
||||||
//Map<String,String> keys=new HashMap<String,String>();
|
|
||||||
String sql="Select code,name,filter from "+BaseConstant.DICTIONARY_TABLE_NAMEPRE+"org_domain where name=?1";
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<Object[]> list = this.sqlFindList(sql,name);
|
|
||||||
List<DictItem> items=new ArrayList<DictItem>();
|
|
||||||
for(Object[] objs : list) {
|
|
||||||
DictItem item=new DictItem();
|
|
||||||
item.setCode((String)objs[0]);
|
|
||||||
item.setName((String)objs[1]);
|
|
||||||
item.setFilter((String)objs[2]);
|
|
||||||
items.add(item);
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DictItem> findDictItemByName(String name1,String name2){
|
|
||||||
//Map<String,String> keys=new HashMap<String,String>();
|
|
||||||
String sql="Select code,name,filter from "+BaseConstant.DICTIONARY_TABLE_NAMEPRE+"org_domain where name=?1 or name=?2";
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<Object[]> list = this.sqlFindList(sql,name1,name2);
|
|
||||||
List<DictItem> items=new ArrayList<DictItem>();
|
|
||||||
for(Object[] objs : list) {
|
|
||||||
DictItem item=new DictItem();
|
|
||||||
item.setCode((String)objs[0]);
|
|
||||||
item.setName((String)objs[1]);
|
|
||||||
item.setFilter((String)objs[2]);
|
|
||||||
items.add(item);
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DictItem findDictItemByCode(String code){
|
|
||||||
//Map<String,String> keys=new HashMap<String,String>();
|
|
||||||
String sql="Select code,name,filter from "+BaseConstant.DICTIONARY_TABLE_NAMEPRE+"org_domain where code=?1";
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<Object[]> list = this.sqlFindList(sql,code);
|
|
||||||
if(list!=null && !list.isEmpty()) {
|
|
||||||
Object[] objs=list.get(0);
|
|
||||||
DictItem item=new DictItem();
|
|
||||||
item.setCode((String)objs[0]);
|
|
||||||
item.setName((String)objs[1]);
|
|
||||||
item.setFilter((String)objs[2]);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,DictItem> getOrgDomains(){
|
|
||||||
//Map<String,String> keys=new HashMap<String,String>();
|
|
||||||
String sql="Select code,name,filter from "+BaseConstant.DICTIONARY_TABLE_NAMEPRE+"org_domain";
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<Object[]> list = this.sqlFindList(sql);
|
|
||||||
Map<String,DictItem> maps=new HashMap<String,DictItem>();
|
|
||||||
|
|
||||||
for(Object[] objs : list) {
|
|
||||||
DictItem item=new DictItem();
|
|
||||||
item.setCode((String)objs[0]);
|
|
||||||
item.setName((String)objs[1]);
|
|
||||||
item.setFilter((String)objs[2]);
|
|
||||||
maps.put(item.getName(), item);
|
|
||||||
}
|
|
||||||
// for(Object[] objs : list) {
|
|
||||||
// String code=(String)objs[0];
|
|
||||||
// String filter=(String)objs[2];
|
|
||||||
// DictItem current=maps.get(code);
|
|
||||||
// DictItem parent=maps.get(filter);
|
|
||||||
// if(parent!=null) {
|
|
||||||
// keys.put(current.getName(), parent.getName());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return maps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,String> getMajorTypes(){
|
|
||||||
//Map<String,String> keys=new HashMap<String,String>();
|
|
||||||
String sql="Select code,name,filter from "+BaseConstant.DICTIONARY_TABLE_NAMEPRE+"major_type";
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<Object[]> list = this.sqlFindList(sql);
|
|
||||||
Map<String,String> maps=new HashMap<String,String>();
|
|
||||||
|
|
||||||
for(Object[] objs : list) {
|
|
||||||
DictItem item=new DictItem();
|
|
||||||
item.setCode((String)objs[0]);
|
|
||||||
item.setName((String)objs[1]);
|
|
||||||
item.setFilter((String)objs[2]);
|
|
||||||
maps.put(item.getName(), item.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
return maps;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.xboe.casetask.dao;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import com.xboe.casetask.entity.Cases;
|
|
||||||
import com.xboe.core.orm.BaseDao;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class CasesDao extends BaseDao<Cases> {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.xboe.casetask.dao;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import com.xboe.casetask.entity.CasesMajorType;
|
|
||||||
import com.xboe.core.orm.BaseDao;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class CasesMajorTypeDao extends BaseDao<CasesMajorType> {
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.xboe.casetask.dao;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import com.xboe.casetask.entity.User;
|
|
||||||
import com.xboe.core.orm.BaseDao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户DAO
|
|
||||||
*/
|
|
||||||
@Repository
|
|
||||||
public class UserDao extends BaseDao<User> {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.xboe.casetask.entity;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
import com.xboe.core.orm.IdEntity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步自定义指定
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Entity
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Table(name = SysConstant.TABLE_PRE+"case_sync_customize")
|
|
||||||
public class CaseSyncCustomize extends IdEntity{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "approval_number",length = 100)
|
|
||||||
private String approvalNumber;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 要使用的附件的索引
|
|
||||||
*/
|
|
||||||
@Column(name = "attachment_index",length = 1)
|
|
||||||
private Integer attachmentIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 要使用的附件的名称
|
|
||||||
*/
|
|
||||||
@Column(name = "attachment_name",length =300)
|
|
||||||
private String attachmentName;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.xboe.casetask.entity;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
import com.xboe.core.orm.IdEntity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Entity
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Table(name = SysConstant.TABLE_PRE+"case_sync_log")
|
|
||||||
public class CaseSyncLog extends IdEntity{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "log_time",nullable = false,length = 100)
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime logTime;
|
|
||||||
|
|
||||||
@Column(name = "request",length = 200)
|
|
||||||
private String request;
|
|
||||||
|
|
||||||
@Column(name = "response",columnDefinition = "mediumtext")
|
|
||||||
private String response;
|
|
||||||
}
|
|
||||||
@@ -1,243 +0,0 @@
|
|||||||
package com.xboe.casetask.entity;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.Transient;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
import com.xboe.core.orm.IdEntity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 案例同步记录
|
|
||||||
* @author seastar
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Entity
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Table(name = SysConstant.TABLE_PRE+"case_sync_record")
|
|
||||||
public class CaseSyncRecord extends IdEntity{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
//以下几项,是转化后的结果数据
|
|
||||||
@Column(name = "org_domain_id",length =30)
|
|
||||||
private String orgDomainId;
|
|
||||||
|
|
||||||
@Column(name = "org_domain",length =30)
|
|
||||||
private String orgDomain;
|
|
||||||
|
|
||||||
@Column(name = "org_domain_parent_id",length =30)
|
|
||||||
private String orgDomainParentId;
|
|
||||||
|
|
||||||
@Column(name = "org_domain_parent",length =30)
|
|
||||||
private String orgDomainParent;
|
|
||||||
|
|
||||||
@Column(name = "major_type_code",length =30)
|
|
||||||
private String majorTypeId;
|
|
||||||
|
|
||||||
@Column(name = "major_type",length =30)
|
|
||||||
private String majorType;
|
|
||||||
|
|
||||||
@Column(name = "file_path",length =200)
|
|
||||||
private String filePath;
|
|
||||||
|
|
||||||
@Column(name = "author_id",length =50)
|
|
||||||
private String authorId;
|
|
||||||
|
|
||||||
@Column(name = "author_name",length =50)
|
|
||||||
private String authorName;
|
|
||||||
|
|
||||||
@Column(name = "add_new",length = 1)
|
|
||||||
private Boolean addNew;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private Cases caseInfo;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private List<String[]> attachmentList;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private List<String> majorTypeIdList;
|
|
||||||
|
|
||||||
|
|
||||||
//以下是接收的内容
|
|
||||||
/**审批单号*/
|
|
||||||
@Column(name = "approval_number",length = 100)
|
|
||||||
private String approvalNumber;
|
|
||||||
|
|
||||||
@Column(name = "case_name",length = 200)
|
|
||||||
private String caseName;
|
|
||||||
|
|
||||||
/**摘要,对应数据对接中的,caseSummary字段*/
|
|
||||||
@Column(name = "case_summary", nullable = true, columnDefinition = "text")
|
|
||||||
private String caseSummary;
|
|
||||||
|
|
||||||
/**保密级别*/
|
|
||||||
@Column(name = "confidentiality_level",length = 100)
|
|
||||||
private String confidentialityLevel;
|
|
||||||
|
|
||||||
/**起草时间*/
|
|
||||||
@Column(name = "drafting_time")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime draftingTime;
|
|
||||||
|
|
||||||
/**结束时间*/
|
|
||||||
@Column(name = "end_time")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime endTime;
|
|
||||||
|
|
||||||
/**起草人*/
|
|
||||||
@Column(name = "drafter")
|
|
||||||
private String drafter;
|
|
||||||
|
|
||||||
/**部门*/
|
|
||||||
@Column(name = "department")
|
|
||||||
private String department;
|
|
||||||
|
|
||||||
/**联系电话*/
|
|
||||||
@Column(name = "contact_number")
|
|
||||||
private String contactNumber;
|
|
||||||
|
|
||||||
@Column(name = "email")
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
/**案例渠道,需要字典数据,当前系统未使用此字段,只是记录*/
|
|
||||||
@Column(name = "case_channel")
|
|
||||||
private String caseChannel;
|
|
||||||
|
|
||||||
/**是否为关联管理职级晋升的领导力方案*/
|
|
||||||
@Column(name = "is_leadership_plan")
|
|
||||||
private Boolean isLeadershipPlan;
|
|
||||||
|
|
||||||
/**案例公开范围,默认全员公开*/
|
|
||||||
@Column(name = "case_scope")
|
|
||||||
private String caseScope;
|
|
||||||
|
|
||||||
/**案例涉及流程*/
|
|
||||||
@Column(name = "case_flow")
|
|
||||||
private String caseFlow;
|
|
||||||
|
|
||||||
/**实际案例主*/
|
|
||||||
@Column(name = "case_owner")
|
|
||||||
private String caseOwner;
|
|
||||||
|
|
||||||
/**案主所在部门*/
|
|
||||||
@Column(name = "case_owner_department")
|
|
||||||
private String caseOwnerDepartment;
|
|
||||||
|
|
||||||
/**案主电话*/
|
|
||||||
@Column(name = "case_owner_phone")
|
|
||||||
private String caseOwnerPhone;
|
|
||||||
|
|
||||||
/**案例其他主要贡献人*/
|
|
||||||
@Column(name = "case_other_contributor")
|
|
||||||
private String caseOtherContributor;
|
|
||||||
|
|
||||||
@Column(name = "case_specialty_sequence")
|
|
||||||
private String caseSpecialtySequence;
|
|
||||||
|
|
||||||
/**案主所属组织*/
|
|
||||||
@Column(name = "case_owner_org")
|
|
||||||
private String caseOwnerOrg;
|
|
||||||
|
|
||||||
/**案例类型,需要字典数据*/
|
|
||||||
@Column(name = "case_type")
|
|
||||||
private String caseType;
|
|
||||||
|
|
||||||
@Column(name = "case_type1")
|
|
||||||
private String caseType1;
|
|
||||||
|
|
||||||
@Column(name = "case_type2")
|
|
||||||
private String caseType2;
|
|
||||||
|
|
||||||
/**案例主题,需要字典数据*/
|
|
||||||
@Column(name = "case_theme")
|
|
||||||
private String caseTheme;
|
|
||||||
|
|
||||||
/**案例主题为“自定义”时,会返回案例说明,caseTheme在什么情况下才自定义*/
|
|
||||||
@Column(name = "case_theme_description")
|
|
||||||
private String caseThemeDescription;
|
|
||||||
|
|
||||||
/**案例主题,需要字典数据*/
|
|
||||||
@Column(name = "case_theme1")
|
|
||||||
private String caseTheme1;
|
|
||||||
|
|
||||||
/**案例主题为“自定义”时,会返回案例说明,caseTheme在什么情况下才自定义*/
|
|
||||||
@Column(name = "case_theme_description1")
|
|
||||||
private String caseThemeDescription1;
|
|
||||||
|
|
||||||
/**案例主题,需要字典数据*/
|
|
||||||
@Column(name = "case_theme2")
|
|
||||||
private String caseTheme2;
|
|
||||||
|
|
||||||
/**案例主题为“自定义”时,会返回案例说明,caseTheme在什么情况下才自定义*/
|
|
||||||
@Column(name = "case_theme_description2")
|
|
||||||
private String caseThemeDescription2;
|
|
||||||
|
|
||||||
@Column(name = "keyword1")
|
|
||||||
private String keyword1;
|
|
||||||
|
|
||||||
@Column(name = "keyword2")
|
|
||||||
private String keyword2;
|
|
||||||
|
|
||||||
@Column(name = "keyword3")
|
|
||||||
private String keyword3;
|
|
||||||
|
|
||||||
@Column(name = "keyword4")
|
|
||||||
private String keyword4;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "keyword5")
|
|
||||||
private String keyword5;
|
|
||||||
|
|
||||||
@Column(name = "readers")
|
|
||||||
private String readers;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "case_value")
|
|
||||||
private String caseValue;
|
|
||||||
|
|
||||||
/**对就的attachment内容的json字符串*/
|
|
||||||
@Column(name = "attachment",columnDefinition = "text")
|
|
||||||
private String attachment;
|
|
||||||
|
|
||||||
@Column(name = "attachment_url",length = 500)
|
|
||||||
private String attachmentUrl;
|
|
||||||
|
|
||||||
@Column(name = "attachment_name",length = 200)
|
|
||||||
private String attachmentName;
|
|
||||||
|
|
||||||
/**对就的approvalRecord内容的json字符串*/
|
|
||||||
@Column(name = "approval_record",columnDefinition = "text")
|
|
||||||
private String approvalRecord;
|
|
||||||
|
|
||||||
/**0表执行成功,1表数据解析失败*/
|
|
||||||
@Column(name = "status",length=2)
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**0表执行成功,1表数据接收失败,2表数据解析失败,3组织领域关联失败,4表专业分类关联失败,5表用户关联失败,6表文件识别失败,7表文件下载失败*/
|
|
||||||
@Column(name = "error_info")
|
|
||||||
private String errorInfo;
|
|
||||||
|
|
||||||
/**执行时间*/
|
|
||||||
@Column(name = "sync_time")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime syncTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 入库的id
|
|
||||||
*/
|
|
||||||
@Column(name = "case_id",length=19)
|
|
||||||
private String caseId;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,228 +0,0 @@
|
|||||||
package com.xboe.casetask.entity;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
import com.xboe.core.orm.BaseEntity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 案例表
|
|
||||||
* */
|
|
||||||
@Data
|
|
||||||
@Entity
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Table(name = SysConstant.TABLE_PRE+"cases")
|
|
||||||
public class Cases extends BaseEntity {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**标题*/
|
|
||||||
@Column(name = "title",nullable = false,length = 100)
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
/**企业ID, 多企业使用*/
|
|
||||||
@Column(name = "company_id", length = 36)
|
|
||||||
private String companyId;
|
|
||||||
|
|
||||||
/**内容*/
|
|
||||||
@Column(name = "content",nullable = true,columnDefinition = "text")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
/**文件的路径*/
|
|
||||||
@Column(name = "file_path")
|
|
||||||
private String filePath;
|
|
||||||
|
|
||||||
@Column(name = "file_name")
|
|
||||||
private String fileName;
|
|
||||||
|
|
||||||
|
|
||||||
/**作者id,对应案主ID,原数据 caseOwner 对应是原系统数据,这里是当前系统的用户id,需要一个转化*/
|
|
||||||
@Column(name = "author_id")
|
|
||||||
private String authorId;
|
|
||||||
|
|
||||||
/**作者名称*/
|
|
||||||
@Column(name = "author_name")
|
|
||||||
private String authorName;
|
|
||||||
|
|
||||||
/** 封面图地址*/
|
|
||||||
@Column(name = "cover_url",length = 400)
|
|
||||||
private String coverUrl;
|
|
||||||
|
|
||||||
/**是否推荐 0:未推荐 1:推荐*/
|
|
||||||
@Column(name = "bre_commend",length = 1)
|
|
||||||
private Integer breCommend;
|
|
||||||
|
|
||||||
/**推荐时间*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@Column(name = "recommend_time")
|
|
||||||
private LocalDateTime recommendTime;
|
|
||||||
|
|
||||||
/**是否置顶 0:未置顶,1:已置顶*/
|
|
||||||
@Column(name = "is_top",length = 1)
|
|
||||||
private Boolean isTop;
|
|
||||||
|
|
||||||
/**置顶时间*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@Column(name = "top_time")
|
|
||||||
private LocalDateTime topTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态 0:草稿
|
|
||||||
* 1:待审核
|
|
||||||
* 2:已审核未通过
|
|
||||||
* 3:已审核通过
|
|
||||||
* */
|
|
||||||
// @Column(name = "status",length = 1)
|
|
||||||
// private Integer status;
|
|
||||||
|
|
||||||
@Column(name = "views", nullable = false)
|
|
||||||
private Integer views;
|
|
||||||
|
|
||||||
@Column(name = "comments", nullable = false)
|
|
||||||
private Integer comments;
|
|
||||||
|
|
||||||
@Column(name = "praises", nullable = false)
|
|
||||||
private Integer praises;
|
|
||||||
|
|
||||||
@Column(name = "shares", nullable = false)
|
|
||||||
private Integer shares;
|
|
||||||
|
|
||||||
@Column(name = "favorites", nullable = false)
|
|
||||||
private Integer favorites;
|
|
||||||
|
|
||||||
/**摘要,对应数据对接中的,caseSummary字段*/
|
|
||||||
@Column(name = "summary", nullable = true, length = 400)
|
|
||||||
private String summary;
|
|
||||||
|
|
||||||
/**组织领域二级 对应原数据 caseOwnerOrg 案主所属组织*/
|
|
||||||
@Column(name = "org_domain")
|
|
||||||
private String orgDomain;
|
|
||||||
|
|
||||||
/**组织领域一级 对应原数据 二级对应的关系上级的名称*/
|
|
||||||
@Column(name = "org_domain_parent")
|
|
||||||
private String orgDomainParent;
|
|
||||||
|
|
||||||
/**专业分类,原数据 案例专业序列caseSpecialtySequence*/
|
|
||||||
@Column(name = "major_type")
|
|
||||||
private String majorType;
|
|
||||||
|
|
||||||
/**审批单号*/
|
|
||||||
@Column(name = "approval_number",length = 100)
|
|
||||||
private String approvalNumber;
|
|
||||||
|
|
||||||
/**保密级别*/
|
|
||||||
@Column(name = "confidentiality_level",length = 100)
|
|
||||||
private String confidentialityLevel;
|
|
||||||
|
|
||||||
/**起草时间*/
|
|
||||||
@Column(name = "drafting_time")
|
|
||||||
private LocalDateTime draftingTime;
|
|
||||||
|
|
||||||
/**结束时间*/
|
|
||||||
@Column(name = "end_time")
|
|
||||||
private LocalDateTime endTime;
|
|
||||||
|
|
||||||
/**起草人*/
|
|
||||||
@Column(name = "drafter")
|
|
||||||
private String drafter;
|
|
||||||
|
|
||||||
/**部门*/
|
|
||||||
@Column(name = "department")
|
|
||||||
private String department;
|
|
||||||
|
|
||||||
/**联系电话*/
|
|
||||||
@Column(name = "contact_number")
|
|
||||||
private String contactNumber;
|
|
||||||
|
|
||||||
@Column(name = "email")
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
/**案例渠道,需要字典数据,当前系统未使用此字段,只是记录*/
|
|
||||||
@Column(name = "case_channel")
|
|
||||||
private String caseChannel;
|
|
||||||
|
|
||||||
/**是否为关联管理职级晋升的领导力方案*/
|
|
||||||
@Column(name = "is_leadership_plan")
|
|
||||||
private Boolean isLeadershipPlan;
|
|
||||||
|
|
||||||
/**案例公开范围,默认全员公开*/
|
|
||||||
@Column(name = "case_scope")
|
|
||||||
private String caseScope;
|
|
||||||
|
|
||||||
/**案例涉及流程*/
|
|
||||||
@Column(name = "case_flow")
|
|
||||||
private String caseFlow;
|
|
||||||
|
|
||||||
/**实际案例主*/
|
|
||||||
@Column(name = "case_owner")
|
|
||||||
private String caseOwner;
|
|
||||||
|
|
||||||
/**案主所在部门*/
|
|
||||||
@Column(name = "case_owner_department")
|
|
||||||
private String caseOwnerDepartment;
|
|
||||||
|
|
||||||
/**案主电话*/
|
|
||||||
@Column(name = "case_owner_phone")
|
|
||||||
private String caseOwnerPhone;
|
|
||||||
|
|
||||||
/**案例其他主要贡献人*/
|
|
||||||
@Column(name = "case_other_contributor")
|
|
||||||
private String caseOtherContributor;
|
|
||||||
|
|
||||||
@Column(name = "case_specialty_sequence")
|
|
||||||
private String caseSpecialtySequence;
|
|
||||||
|
|
||||||
/**案主所属组织*/
|
|
||||||
@Column(name = "case_owner_org")
|
|
||||||
private String caseOwnerOrg;
|
|
||||||
|
|
||||||
/**案例类型,需要字典数据*/
|
|
||||||
@Column(name = "case_type")
|
|
||||||
private String caseType;
|
|
||||||
|
|
||||||
@Column(name = "case_type1")
|
|
||||||
private String caseType1;
|
|
||||||
|
|
||||||
@Column(name = "case_type2")
|
|
||||||
private String caseType2;
|
|
||||||
|
|
||||||
/**案例主题,需要字典数据*/
|
|
||||||
@Column(name = "case_theme")
|
|
||||||
private String caseTheme;
|
|
||||||
|
|
||||||
/**案例主题为“自定义”时,会返回案例说明,caseTheme在什么情况下才自定义*/
|
|
||||||
@Column(name = "case_theme_description")
|
|
||||||
private String caseThemeDescription;
|
|
||||||
|
|
||||||
@Column(name = "keyword1")
|
|
||||||
private String keyword1;
|
|
||||||
|
|
||||||
@Column(name = "keyword2")
|
|
||||||
private String keyword2;
|
|
||||||
|
|
||||||
@Column(name = "keyword3")
|
|
||||||
private String keyword3;
|
|
||||||
|
|
||||||
@Column(name = "keyword4")
|
|
||||||
private String keyword4;
|
|
||||||
|
|
||||||
@Column(name = "keyword5")
|
|
||||||
private String keyword5;
|
|
||||||
|
|
||||||
@Column(name = "readers")
|
|
||||||
private String readers;
|
|
||||||
|
|
||||||
/**案例价值和应用场景*/
|
|
||||||
@Column(name = "case_value")
|
|
||||||
private String caseValue;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.xboe.casetask.entity;
|
|
||||||
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
import com.xboe.core.orm.IdEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 中间表
|
|
||||||
* */
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Entity
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Table(name = SysConstant.TABLE_PRE+"cases_major_type")
|
|
||||||
public class CasesMajorType extends IdEntity{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 内容分类id
|
|
||||||
* */
|
|
||||||
|
|
||||||
@Column(name = "major_id",length = 20)
|
|
||||||
private String majorId;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 案例id
|
|
||||||
* */
|
|
||||||
@Column(name = "case_id",length = 20)
|
|
||||||
// @ManyToOne(optional = true)
|
|
||||||
// @JoinColumn(name = "id")
|
|
||||||
private String caseId;
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package com.xboe.casetask.entity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.persistence.Transient;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典条目
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class DictItem implements java.io.Serializable{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**代码*/
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
/**中文名称*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**过滤条件,一般是code,用于字典关联,比如省市县*/
|
|
||||||
private String filter;
|
|
||||||
|
|
||||||
/**分组说明*/
|
|
||||||
private String group;
|
|
||||||
|
|
||||||
private String explanation;
|
|
||||||
|
|
||||||
/**显示顺序*/
|
|
||||||
private Integer norder;
|
|
||||||
|
|
||||||
/**是否允许删除*/
|
|
||||||
private Boolean deletable;
|
|
||||||
|
|
||||||
/**是否已删除*/
|
|
||||||
private Boolean deleted;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级
|
|
||||||
* */
|
|
||||||
@Transient
|
|
||||||
private List<DictItem> list;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
package com.xboe.casetask.entity;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.Transient;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
import com.xboe.core.orm.IdEntity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户信息表
|
|
||||||
* 存储所有的用户信息,原表中的部分信息
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Entity
|
|
||||||
@Table(name = SysConstant.TABLE_PRE + "user")
|
|
||||||
public class User extends IdEntity {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 旧系统id
|
|
||||||
*/
|
|
||||||
@Column(name = "sys_id", length = 36)
|
|
||||||
private String sysId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 旧系统机构id
|
|
||||||
*/
|
|
||||||
@Column(name = "sys_depart_id", length = 36)
|
|
||||||
private String sysDepartId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 姓名
|
|
||||||
*/
|
|
||||||
@Column(name = "name", length = 30)
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 员工编号
|
|
||||||
*/
|
|
||||||
@Column(name = "user_no", length = 30)
|
|
||||||
private String userNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 性别 1:男 2:女
|
|
||||||
*/
|
|
||||||
@Column(name = "gender", length = 1)
|
|
||||||
private Integer gender;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生日
|
|
||||||
*/
|
|
||||||
@Column(name = "birthday")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private LocalDate birthday;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 身份证号
|
|
||||||
*/
|
|
||||||
@Column(name = "id_number", length = 18)
|
|
||||||
private String idNumber;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机号
|
|
||||||
*/
|
|
||||||
@Column(name = "mobile_no", length = 11)
|
|
||||||
private String mobileNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 家庭电话
|
|
||||||
*/
|
|
||||||
@Column(name = "home_phone_no", length = 50)
|
|
||||||
private String homePhoneNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 国籍
|
|
||||||
*/
|
|
||||||
@Column(name = "nationality", length = 50)
|
|
||||||
private String nationality;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 毕业院校
|
|
||||||
*/
|
|
||||||
@Column(name = "graduated_from", length = 50)
|
|
||||||
private String graduatedFrom;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 毕业专业
|
|
||||||
*/
|
|
||||||
@Column(name = "graduated_major", length = 50)
|
|
||||||
private String graduatedMajor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最高学历
|
|
||||||
*/
|
|
||||||
@Column(name = "highest_education", length = 50)
|
|
||||||
private String highestEducation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 办公电话
|
|
||||||
*/
|
|
||||||
@Column(name = "telephone_no", length = 50)
|
|
||||||
private String telephoneNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 职务
|
|
||||||
*/
|
|
||||||
@Column(name = "duty", length = 50)
|
|
||||||
private String duty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 职级
|
|
||||||
*/
|
|
||||||
@Column(name = "rank", length = 50)
|
|
||||||
private String rank;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述
|
|
||||||
*/
|
|
||||||
@Column(name = "description")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所在公司
|
|
||||||
*/
|
|
||||||
@Column(name = "company_id", length = 36)
|
|
||||||
private String companyId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所在部门
|
|
||||||
*/
|
|
||||||
@Column(name = "depart_id", length = 18)
|
|
||||||
private String departId;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private String departName;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所在域
|
|
||||||
*/
|
|
||||||
@Column(name = "domain_id", length = 36)
|
|
||||||
private String domainId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 扩展字段,多租户系统的标识值
|
|
||||||
*/
|
|
||||||
@Column(name = "sass_id", length = 18)
|
|
||||||
private String sassId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户类型,1表学员,2表教师,3表管理员
|
|
||||||
* 该字段暂用于表示是否前台管理员
|
|
||||||
*/
|
|
||||||
@Column(name = "user_type", length = 1)
|
|
||||||
private Integer userType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 学习总时长
|
|
||||||
*/
|
|
||||||
@Column(name = "study_total", length = 11)
|
|
||||||
private Integer studyTotal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* boe的时长,和系统时长单独保存
|
|
||||||
*/
|
|
||||||
@Column(name = "learning_Duration", length = 11)
|
|
||||||
private Integer learningDuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最近一次登录时间
|
|
||||||
*/
|
|
||||||
@Column(name = "last_login_at")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime lastLoginAt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最近一次登录IP
|
|
||||||
*/
|
|
||||||
@Column(name = "last_login_ip", length = 30)
|
|
||||||
private String lastLoginIp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最近一次登录MAC地址
|
|
||||||
*/
|
|
||||||
@Column(name = "last_login_mac", length = 30)
|
|
||||||
private String lastLoginMac;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最近一次操作时间
|
|
||||||
*/
|
|
||||||
@Column(name = "last_action_at")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime lastActionAt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最近一次操作IP
|
|
||||||
*/
|
|
||||||
@Column(name = "last_action_ip", length = 30)
|
|
||||||
private String lastActionIp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最近一次操作MAC地址
|
|
||||||
*/
|
|
||||||
@Column(name = "last_action_mac", length = 30)
|
|
||||||
private String lastActionMac;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在线状态;
|
|
||||||
* 0:离线,1:在线
|
|
||||||
*/
|
|
||||||
@Column(name = "online", length = 1)
|
|
||||||
private Boolean online;
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.xboe.casetask.service;
|
|
||||||
|
|
||||||
import com.xboe.casetask.entity.CaseSyncLog;
|
|
||||||
import com.xboe.common.PageList;
|
|
||||||
|
|
||||||
public interface ICaseSyncLogService{
|
|
||||||
|
|
||||||
void save(CaseSyncLog log);
|
|
||||||
|
|
||||||
|
|
||||||
PageList<CaseSyncLog> findPage(int pageIndex,int pageSize);
|
|
||||||
|
|
||||||
void clearLogs();
|
|
||||||
}
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
package com.xboe.casetask.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.xboe.casetask.entity.CaseSyncCustomize;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncRecord;
|
|
||||||
import com.xboe.casetask.entity.Cases;
|
|
||||||
import com.xboe.casetask.entity.DictItem;
|
|
||||||
import com.xboe.casetask.entity.User;
|
|
||||||
import com.xboe.common.PageList;
|
|
||||||
|
|
||||||
public interface ICaseSyncService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户的id
|
|
||||||
* @param userNo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String getIdByUserNo(String userNo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据工号,查询用户信息
|
|
||||||
* @param userNo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
User getByUserNo(String userNo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得所有的组织领域
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Map<String,DictItem> getOrgDomains();
|
|
||||||
|
|
||||||
List<DictItem> findDictItemByName(String name);
|
|
||||||
|
|
||||||
List<DictItem> findDictItemByNames(String name1,String name2);
|
|
||||||
|
|
||||||
DictItem getDictItemByCode(String code);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取专业分类
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Map<String,String> getMajorTypes();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据审批单号查询案例信息
|
|
||||||
* @param approvalNumber
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Cases getByApprovalNumber(String approvalNumber);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据单号得到案例的id
|
|
||||||
* @param approvalNumber
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String getIdByApprovalNumber(String approvalNumber);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存案例信息
|
|
||||||
* @param records
|
|
||||||
*/
|
|
||||||
// void saveCase(List<CaseSyncRecord> records);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单独的同步保存
|
|
||||||
* @param csr
|
|
||||||
*/
|
|
||||||
void saveCase(CaseSyncRecord csr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存记录
|
|
||||||
* @param record
|
|
||||||
*/
|
|
||||||
void saveRecord(CaseSyncRecord record);
|
|
||||||
|
|
||||||
void deleteRecord(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新同步记录
|
|
||||||
* @param id
|
|
||||||
* @param status
|
|
||||||
* @param error
|
|
||||||
*/
|
|
||||||
void updateRecord(String id,int status,String error);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询案例的同步记录
|
|
||||||
* @param pageIndex
|
|
||||||
* @param pageSize
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
PageList<CaseSyncRecord> findPage(int pageIndex,int pageSize,CaseSyncRecord record);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存用户的配置
|
|
||||||
* @param customize
|
|
||||||
*/
|
|
||||||
void saveCaseSyncCustomize(CaseSyncCustomize customize);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过审核批单号查询用户定义配置
|
|
||||||
* @param approvalNumber
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
CaseSyncCustomize getLastCustomizeByApprovalNumber(String approvalNumber);
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.xboe.casetask.service.impl;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.xboe.casetask.dao.CaseSyncLogDao;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncLog;
|
|
||||||
import com.xboe.casetask.service.ICaseSyncLogService;
|
|
||||||
import com.xboe.common.OrderCondition;
|
|
||||||
import com.xboe.common.PageList;
|
|
||||||
import com.xboe.core.orm.FieldFilters;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class CaseSyncLogServiceImpl implements ICaseSyncLogService{
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
CaseSyncLogDao dao;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void save(CaseSyncLog log) {
|
|
||||||
dao.save(log);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageList<CaseSyncLog> findPage(int pageIndex, int pageSize) {
|
|
||||||
|
|
||||||
return dao.findPage(pageIndex, pageSize,OrderCondition.desc("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void clearLogs() {
|
|
||||||
//dao.deleteByField("1",1);
|
|
||||||
dao.deleteByFilter(FieldFilters.eq("1","1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,361 +0,0 @@
|
|||||||
package com.xboe.casetask.service.impl;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.xboe.casetask.dao.CaseSyncCustomizeDao;
|
|
||||||
import com.xboe.casetask.dao.CaseSyncRecordDao;
|
|
||||||
import com.xboe.casetask.dao.CasesDao;
|
|
||||||
import com.xboe.casetask.dao.CasesMajorTypeDao;
|
|
||||||
import com.xboe.casetask.dao.UserDao;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncCustomize;
|
|
||||||
import com.xboe.casetask.entity.CaseSyncRecord;
|
|
||||||
import com.xboe.casetask.entity.Cases;
|
|
||||||
import com.xboe.casetask.entity.CasesMajorType;
|
|
||||||
import com.xboe.casetask.entity.DictItem;
|
|
||||||
import com.xboe.casetask.entity.User;
|
|
||||||
import com.xboe.casetask.service.ICaseSyncService;
|
|
||||||
import com.xboe.common.OrderCondition;
|
|
||||||
import com.xboe.common.PageList;
|
|
||||||
import com.xboe.core.event.IEventDataSender;
|
|
||||||
import com.xboe.core.orm.FieldFilters;
|
|
||||||
import com.xboe.core.orm.QueryBuilder;
|
|
||||||
import com.xboe.core.orm.UpdateBuilder;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class CaseSyncServiceImpl implements ICaseSyncService{
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CasesDao caseDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CasesMajorTypeDao majorDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CaseSyncRecordDao recordDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CaseSyncCustomizeDao customizeDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private UserDao userDao;
|
|
||||||
|
|
||||||
@Autowired(required = false)
|
|
||||||
private IEventDataSender eventSender;
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// @Transactional
|
|
||||||
// public void saveCase(List<CaseSyncRecord> records) {
|
|
||||||
// //用于控制重复的记录
|
|
||||||
// Set<String> hasNumber=new HashSet<>();
|
|
||||||
// for(CaseSyncRecord csr : records) {
|
|
||||||
// if(csr.getStatus()==0) {
|
|
||||||
// if(hasNumber.contains(csr.getApprovalNumber())) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// hasNumber.add(csr.getApprovalNumber());
|
|
||||||
//
|
|
||||||
// String hasId=getIdByApprovalNumber(csr.getApprovalNumber());
|
|
||||||
// if(StringUtils.isNotBlank(hasId)){
|
|
||||||
// //已经存在,不再更新
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Cases c=new Cases();
|
|
||||||
// c.setTitle(csr.getCaseName());//设置标题
|
|
||||||
//
|
|
||||||
// c.setFileName(csr.getAttachmentName());
|
|
||||||
// c.setApprovalNumber(csr.getApprovalNumber());
|
|
||||||
// c.setAuthorId(csr.getAuthorId());
|
|
||||||
// c.setAuthorName(csr.getAuthorName());
|
|
||||||
// c.setCaseChannel(csr.getCaseChannel());
|
|
||||||
// c.setCaseFlow(csr.getCaseFlow());
|
|
||||||
// c.setCaseOtherContributor(csr.getCaseOtherContributor());
|
|
||||||
// c.setCaseOwner(csr.getCaseOwner());
|
|
||||||
// c.setCaseOwnerDepartment(csr.getCaseOwnerDepartment());
|
|
||||||
// c.setCaseOwnerOrg(csr.getCaseOwnerOrg());
|
|
||||||
// c.setCaseOwnerPhone(csr.getCaseOwnerPhone());
|
|
||||||
// c.setCaseScope(csr.getCaseScope());
|
|
||||||
// c.setCaseSpecialtySequence(csr.getCaseSpecialtySequence());
|
|
||||||
// c.setCaseTheme(csr.getCaseTheme());
|
|
||||||
// c.setCaseThemeDescription(csr.getCaseThemeDescription());
|
|
||||||
// c.setCaseType(csr.getCaseType());
|
|
||||||
// c.setCaseType1(csr.getCaseType1());
|
|
||||||
// c.setCaseType2(csr.getCaseType2());
|
|
||||||
// c.setCaseValue(csr.getCaseValue());
|
|
||||||
// c.setConfidentialityLevel(csr.getConfidentialityLevel());
|
|
||||||
// c.setContactNumber(csr.getContactNumber());
|
|
||||||
// c.setContent("");
|
|
||||||
// c.setDepartment(csr.getDepartment());
|
|
||||||
// c.setDrafter(csr.getDrafter());
|
|
||||||
// c.setDraftingTime(csr.getDraftingTime());
|
|
||||||
// c.setEmail(csr.getEmail());
|
|
||||||
// c.setEndTime(csr.getEndTime());
|
|
||||||
// c.setFileName(csr.getAttachmentName());
|
|
||||||
// c.setFilePath(csr.getFilePath());
|
|
||||||
// c.setIsLeadershipPlan(csr.getIsLeadershipPlan());
|
|
||||||
// c.setKeyword1(csr.getKeyword1());
|
|
||||||
// c.setKeyword2(csr.getKeyword2());
|
|
||||||
// c.setKeyword3(csr.getKeyword3());
|
|
||||||
// c.setKeyword4(csr.getKeyword4());
|
|
||||||
// c.setKeyword5(csr.getKeyword5());
|
|
||||||
// c.setReaders(csr.getReaders());
|
|
||||||
// c.setSummary(csr.getCaseSummary());
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// c.setOrgDomain(csr.getOrgDomainId());
|
|
||||||
// c.setOrgDomainParent(csr.getOrgDomainParentId());
|
|
||||||
// c.setMajorType(csr.getMajorTypeId());
|
|
||||||
// //设置创建时间是endtime对应的时间
|
|
||||||
// c.setSysCreateTime(csr.getEndTime());
|
|
||||||
// //默认值
|
|
||||||
// c.setSysCreateAid(csr.getAuthorId());
|
|
||||||
// c.setSysCreateBy(csr.getAuthorName());
|
|
||||||
// c.setSysUpdateBy(csr.getAuthorName());
|
|
||||||
// c.setComments(0);
|
|
||||||
// c.setBreCommend(0);
|
|
||||||
// c.setFavorites(0);
|
|
||||||
// c.setPraises(0);
|
|
||||||
// c.setShares(0);
|
|
||||||
// c.setTopTime(null);
|
|
||||||
// c.setViews(0);
|
|
||||||
// c.setRecommendTime(null);
|
|
||||||
// c.setIsTop(false);
|
|
||||||
// c.setCoverUrl("");
|
|
||||||
// c.setDeleted(false);
|
|
||||||
// //通过字典关系 ,找到上级的名称 ,加进去
|
|
||||||
// caseDao.save(c);
|
|
||||||
// if(csr.getMajorTypeIdList()!=null && !csr.getMajorTypeIdList().isEmpty()) {
|
|
||||||
// for(String s : csr.getMajorTypeIdList()) {
|
|
||||||
// CasesMajorType cmt=new CasesMajorType();
|
|
||||||
// cmt.setCaseId(c.getId());
|
|
||||||
// cmt.setMajorId(s);
|
|
||||||
// majorDao.save(cmt);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// recordDao.updateFieldById(csr.getId(), "caseId", c.getId());
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void saveCase(CaseSyncRecord csr) {
|
|
||||||
//用于控制重复的记录
|
|
||||||
if(csr.getStatus()==0) {
|
|
||||||
String hasId=getIdByApprovalNumber(csr.getApprovalNumber());
|
|
||||||
if(StringUtils.isNotBlank(hasId)){
|
|
||||||
//已经存在,不再更新
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Cases c=new Cases();
|
|
||||||
c.setTitle(csr.getCaseName());//设置标题
|
|
||||||
|
|
||||||
c.setFileName(csr.getAttachmentName());
|
|
||||||
c.setApprovalNumber(csr.getApprovalNumber());
|
|
||||||
c.setAuthorId(csr.getAuthorId());
|
|
||||||
c.setAuthorName(csr.getAuthorName());
|
|
||||||
c.setCaseChannel(csr.getCaseChannel());
|
|
||||||
c.setCaseFlow(csr.getCaseFlow());
|
|
||||||
c.setCaseOtherContributor(csr.getCaseOtherContributor());
|
|
||||||
c.setCaseOwner(csr.getCaseOwner());
|
|
||||||
c.setCaseOwnerDepartment(csr.getCaseOwnerDepartment());
|
|
||||||
c.setCaseOwnerOrg(csr.getCaseOwnerOrg());
|
|
||||||
c.setCaseOwnerPhone(csr.getCaseOwnerPhone());
|
|
||||||
c.setCaseScope(csr.getCaseScope());
|
|
||||||
c.setCaseSpecialtySequence(csr.getCaseSpecialtySequence());
|
|
||||||
c.setCaseTheme(csr.getCaseTheme());
|
|
||||||
c.setCaseThemeDescription(csr.getCaseThemeDescription());
|
|
||||||
c.setCaseType(csr.getCaseType());
|
|
||||||
c.setCaseType1(csr.getCaseType1());
|
|
||||||
c.setCaseType2(csr.getCaseType2());
|
|
||||||
c.setCaseValue(csr.getCaseValue());
|
|
||||||
c.setConfidentialityLevel(csr.getConfidentialityLevel());
|
|
||||||
c.setContactNumber(csr.getContactNumber());
|
|
||||||
c.setContent("");
|
|
||||||
c.setDepartment(csr.getDepartment());
|
|
||||||
c.setDrafter(csr.getDrafter());
|
|
||||||
c.setDraftingTime(csr.getDraftingTime());
|
|
||||||
c.setEmail(csr.getEmail());
|
|
||||||
c.setEndTime(csr.getEndTime());
|
|
||||||
c.setFileName(csr.getAttachmentName());
|
|
||||||
c.setFilePath(csr.getFilePath());
|
|
||||||
c.setIsLeadershipPlan(csr.getIsLeadershipPlan());
|
|
||||||
c.setKeyword1(csr.getKeyword1());
|
|
||||||
c.setKeyword2(csr.getKeyword2());
|
|
||||||
c.setKeyword3(csr.getKeyword3());
|
|
||||||
c.setKeyword4(csr.getKeyword4());
|
|
||||||
c.setKeyword5(csr.getKeyword5());
|
|
||||||
c.setReaders(csr.getReaders());
|
|
||||||
c.setSummary(csr.getCaseSummary());
|
|
||||||
|
|
||||||
//
|
|
||||||
c.setOrgDomain(csr.getOrgDomainId());
|
|
||||||
c.setOrgDomainParent(csr.getOrgDomainParentId());
|
|
||||||
c.setMajorType(csr.getMajorTypeId());
|
|
||||||
//设置创建时间是endtime对应的时间
|
|
||||||
c.setSysCreateTime(csr.getEndTime());
|
|
||||||
//默认值
|
|
||||||
c.setSysCreateAid(csr.getAuthorId());
|
|
||||||
c.setSysCreateBy(csr.getAuthorName());
|
|
||||||
c.setSysUpdateBy(csr.getAuthorName());
|
|
||||||
c.setComments(0);
|
|
||||||
c.setBreCommend(0);
|
|
||||||
c.setFavorites(0);
|
|
||||||
c.setPraises(0);
|
|
||||||
c.setShares(0);
|
|
||||||
c.setTopTime(null);
|
|
||||||
c.setViews(0);
|
|
||||||
c.setRecommendTime(null);
|
|
||||||
c.setIsTop(false);
|
|
||||||
c.setCoverUrl("");
|
|
||||||
c.setDeleted(false);
|
|
||||||
//通过字典关系 ,找到上级的名称 ,加进去
|
|
||||||
caseDao.save(c);
|
|
||||||
if(csr.getMajorTypeIdList()!=null && !csr.getMajorTypeIdList().isEmpty()) {
|
|
||||||
for(String s : csr.getMajorTypeIdList()) {
|
|
||||||
CasesMajorType cmt=new CasesMajorType();
|
|
||||||
cmt.setCaseId(c.getId());
|
|
||||||
cmt.setMajorId(s);
|
|
||||||
majorDao.save(cmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
recordDao.updateFieldById(csr.getId(), "caseId", c.getId());
|
|
||||||
if(eventSender!=null) {
|
|
||||||
eventSender.send("发布案例", "SyncCase",c.getTitle(), c.getId(), "3",c.getTitle(),c.getSysCreateAid(), c.getSysCreateBy(),"");
|
|
||||||
}else {
|
|
||||||
System.out.print("未配置事件消息发送的实现");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void saveRecord(CaseSyncRecord record) {
|
|
||||||
record.setSyncTime(LocalDateTime.now());
|
|
||||||
recordDao.save(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void updateRecord(String id, int status, String error) {
|
|
||||||
recordDao.updateMultiFieldById(id,UpdateBuilder.create("status", status),UpdateBuilder.create("errorInfo", error));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String,DictItem> getOrgDomains() {
|
|
||||||
|
|
||||||
return recordDao.getOrgDomains();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictItem> findDictItemByName(String name) {
|
|
||||||
|
|
||||||
return recordDao.findDictItemByName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DictItem getDictItemByCode(String code) {
|
|
||||||
|
|
||||||
return recordDao.findDictItemByCode(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, String> getMajorTypes() {
|
|
||||||
|
|
||||||
return recordDao.getMajorTypes();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Cases getByApprovalNumber(String approvalNumber) {
|
|
||||||
Cases c=caseDao.findOne(FieldFilters.eq("approvalNumber", approvalNumber));
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdByUserNo(String userNo) {
|
|
||||||
Object id=userDao.findField("id",FieldFilters.eq("userNo", userNo));
|
|
||||||
return (String)id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdByApprovalNumber(String approvalNumber) {
|
|
||||||
Object id=caseDao.findField("id",FieldFilters.eq("approvalNumber", approvalNumber),FieldFilters.eq("deleted", false));
|
|
||||||
return (String)id;
|
|
||||||
// List<?> list =caseDao.findListField("id", FieldFilters.eq("approvalNumber", approvalNumber));
|
|
||||||
// if(list!=null && !list.isEmpty()) {
|
|
||||||
// return list.get(0).toString();
|
|
||||||
// }else {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageList<CaseSyncRecord> findPage(int pageIndex, int pageSize, CaseSyncRecord record) {
|
|
||||||
QueryBuilder query=QueryBuilder.from(CaseSyncRecord.class);
|
|
||||||
query.setPageIndex(pageIndex);
|
|
||||||
query.setPageSize(pageSize);
|
|
||||||
query.addOrder(OrderCondition.desc("id"));
|
|
||||||
if(record!=null) {
|
|
||||||
if(StringUtils.isNotBlank(record.getCaseName())) {
|
|
||||||
query.addFilter(FieldFilters.like("caseName", record.getCaseName()));
|
|
||||||
}
|
|
||||||
if(record.getStatus()!=null) {
|
|
||||||
query.addFilter(FieldFilters.eq("status", record.getStatus()));
|
|
||||||
}
|
|
||||||
//特定的需求过滤
|
|
||||||
if(StringUtils.isNotBlank(record.getErrorInfo())) {
|
|
||||||
query.addFilter(FieldFilters.ne("errorInfo", record.getErrorInfo()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return recordDao.findPage(query.builder());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void saveCaseSyncCustomize(CaseSyncCustomize customize) {
|
|
||||||
customizeDao.save(customize);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public CaseSyncCustomize getLastCustomizeByApprovalNumber(String approvalNumber) {
|
|
||||||
List<CaseSyncCustomize> list=customizeDao.findList(1,OrderCondition.desc("id"),FieldFilters.eq("approvalNumber", approvalNumber));
|
|
||||||
if(!list.isEmpty()) {
|
|
||||||
return list.get(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void deleteRecord(String id) {
|
|
||||||
recordDao.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DictItem> findDictItemByNames(String name1, String name2) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return recordDao.findDictItemByName(name1, name2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public User getByUserNo(String userNo) {
|
|
||||||
User user=userDao.findOne(FieldFilters.eq("userNo", userNo));
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
package com.xboe.stat;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
import com.xboe.core.api.TokenProxy;
|
|
||||||
import com.xboe.core.event.IEventDataSender;
|
|
||||||
import com.xboe.core.utils.OkHttpUtil;
|
|
||||||
import com.xboe.standard.BaseConstant;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 事件数据发送实现,如果是云环境,只需要修改此类的实现就可以了
|
|
||||||
* @author seastar
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class EventDataSender implements IEventDataSender{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OkHttpUtil okHttpUtil;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void send(String title, String eventKey, String content, String objId, String objType, String objInfo,
|
|
||||||
String aid, String aname,String author) {
|
|
||||||
String statBaseUrl=SysConstant.getConfigValue("xboe.stat.base.url");
|
|
||||||
if(StringUtils.isBlank(statBaseUrl)) {
|
|
||||||
log.error("发送事件失败:未配置【xboe.stat.base.url】的值");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String urlPre="/xboe/m/stat/event/send";
|
|
||||||
//案例同步不需要token
|
|
||||||
if(eventKey.equals("SyncCase")) {
|
|
||||||
urlPre ="/inner/stat/event/send";
|
|
||||||
}
|
|
||||||
|
|
||||||
final String url = statBaseUrl + urlPre;
|
|
||||||
Map<String, String> params = new HashMap<>();
|
|
||||||
params.put("title", title);
|
|
||||||
params.put("source", "all");
|
|
||||||
params.put("content", content);
|
|
||||||
params.put("objId", objId);
|
|
||||||
params.put("key", eventKey);
|
|
||||||
params.put("objType", objType);
|
|
||||||
params.put("objInfo", objInfo);
|
|
||||||
params.put("aid", aid);
|
|
||||||
params.put("aname", aname);
|
|
||||||
params.put("parameters","");
|
|
||||||
String token = TokenProxy.getToken(request);
|
|
||||||
//最后采用异常发送,不影响当前进程
|
|
||||||
|
|
||||||
new Thread(()->{
|
|
||||||
try {
|
|
||||||
ObjectMapper mapper=new ObjectMapper();
|
|
||||||
String json =mapper.writeValueAsString(params);
|
|
||||||
//String[] headers=new String[] {"token",token};
|
|
||||||
String[] headers=new String[] {BaseConstant.HTTP_ACCESS_TOKEN,token};
|
|
||||||
|
|
||||||
String responseStr = okHttpUtil.doPostJson(url, json,headers);
|
|
||||||
if(responseStr.indexOf("\"status\":200")==-1) {
|
|
||||||
log.error("发送事件失败:"+responseStr);
|
|
||||||
log.info("【发送的token】"+headers[0]+": "+headers[1]);
|
|
||||||
}
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("发送事件错误",e);
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
## datasource config
|
|
||||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
|
||||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
|
||||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
|
||||||
spring.datasource.username=root
|
|
||||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
|
||||||
|
|
||||||
logging.level.org.hibernate.SQL=DEBUG
|
|
||||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## xboe config
|
|
||||||
xboe.api.cross_filter=true
|
|
||||||
|
|
||||||
## 案例同步发事件的接口
|
|
||||||
xboe.stat.base.url=http://127.0.0.1:9090
|
|
||||||
|
|
||||||
|
|
||||||
## 案例接口配置,init 是否需要初始化
|
|
||||||
xboe.case.sync.init=true
|
|
||||||
xboe.case.sync.api.url=https://csb-broker.boe.com.cn:8086/test
|
|
||||||
xboe.case.sync.api.name=BoeCaseQueryService
|
|
||||||
xboe.case.sync.api.version=1.0.0
|
|
||||||
xboe.case.sync.api.method=POST
|
|
||||||
xboe.case.sync.api.ak=2fc434b249a9402baa070f4cf162bd01
|
|
||||||
xboe.case.sync.api.sk=HSrZqDJfkQg2LmHP1uwOi5BOA2I=
|
|
||||||
|
|
||||||
#加密盐
|
|
||||||
#jasypt.encryptor.password=jasypt
|
|
||||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
|
||||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
## datasource config
|
|
||||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
|
||||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
|
||||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
|
||||||
spring.datasource.username=root
|
|
||||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
|
||||||
|
|
||||||
logging.level.org.hibernate.SQL=ERROR
|
|
||||||
# logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
|
||||||
|
|
||||||
|
|
||||||
## xboe config
|
|
||||||
xboe.api.cross_filter=true
|
|
||||||
|
|
||||||
## 案例同步发事件的接口
|
|
||||||
xboe.stat.base.url=https://u.boe.com/statApi
|
|
||||||
|
|
||||||
|
|
||||||
## 案例接口配置
|
|
||||||
## 案例接口配置,init 是否需要初始化
|
|
||||||
xboe.case.sync.init=false
|
|
||||||
xboe.case.sync.api.url=https://api-csb-broker.boe.com.cn:8086/test
|
|
||||||
xboe.case.sync.api.name=BoeCaseQueryService
|
|
||||||
xboe.case.sync.api.version=1.0.0
|
|
||||||
xboe.case.sync.api.method=POST
|
|
||||||
xboe.case.sync.api.ak=62f60d4cde0c4e8aa08517081649fdb7
|
|
||||||
xboe.case.sync.api.sk=Qg9sVwQI55vmU3/EQ0yPJJxU92E=
|
|
||||||
|
|
||||||
#加密盐
|
|
||||||
#jasypt.encryptor.password=jasypt
|
|
||||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
|
||||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
|
||||||
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
## datasource config
|
|
||||||
spring.jpa.show-sql = false
|
|
||||||
spring.jpa.hibernate.ddl-auto=none
|
|
||||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
|
||||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
|
||||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
|
||||||
spring.datasource.username=root
|
|
||||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
|
||||||
|
|
||||||
logging.level.org.hibernate.SQL=ERROR
|
|
||||||
# logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
|
||||||
|
|
||||||
|
|
||||||
## xboe config
|
|
||||||
xboe.api.cross_filter=true
|
|
||||||
|
|
||||||
## 案例同步发事件的接口
|
|
||||||
xboe.stat.base.url=https://u.boe.com/statApi
|
|
||||||
|
|
||||||
|
|
||||||
## 案例接口配置
|
|
||||||
## 案例接口配置,init 是否需要初始化
|
|
||||||
xboe.case.sync.init=false
|
|
||||||
xboe.case.sync.api.url=https://api-csb-broker.boe.com.cn:8086/test
|
|
||||||
xboe.case.sync.api.name=BoeCaseQueryService
|
|
||||||
xboe.case.sync.api.version=1.0.0
|
|
||||||
xboe.case.sync.api.method=POST
|
|
||||||
xboe.case.sync.api.ak=62f60d4cde0c4e8aa08517081649fdb7
|
|
||||||
xboe.case.sync.api.sk=Qg9sVwQI55vmU3/EQ0yPJJxU92E=
|
|
||||||
|
|
||||||
#加密盐
|
|
||||||
#jasypt.encryptor.password=jasypt
|
|
||||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
|
||||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
|
||||||
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
## datasource config
|
|
||||||
spring.jpa.show-sql = false
|
|
||||||
spring.jpa.hibernate.ddl-auto=none
|
|
||||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
|
||||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
|
||||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
|
||||||
spring.datasource.username=boe_base
|
|
||||||
spring.datasource.password=ENC(MaC28GJw2JcbH8Lil0CrqSDTYxX49FJ0rxcmHH2pX0k=)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## xboe config
|
|
||||||
xboe.api.cross_filter=true
|
|
||||||
|
|
||||||
## 案例同步发事件的接口
|
|
||||||
xboe.stat.base.url=https://u-pre.boe.com/statApi
|
|
||||||
|
|
||||||
|
|
||||||
## 案例接口配置
|
|
||||||
## 案例接口配置,init 是否需要初始化
|
|
||||||
xboe.case.sync.init=true
|
|
||||||
xboe.case.sync.api.url=https://csb-broker.boe.com.cn:8086/test
|
|
||||||
xboe.case.sync.api.name=BoeCaseQueryService
|
|
||||||
xboe.case.sync.api.version=1.0.0
|
|
||||||
xboe.case.sync.api.method=POST
|
|
||||||
xboe.case.sync.api.ak=2fc434b249a9402baa070f4cf162bd01
|
|
||||||
xboe.case.sync.api.sk=HSrZqDJfkQg2LmHP1uwOi5BOA2I=
|
|
||||||
|
|
||||||
#加密盐
|
|
||||||
#jasypt.encryptor.password=jasypt
|
|
||||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
|
||||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
spring.profiles.active=@profileActive@
|
|
||||||
spring.application.name=boe-server-case
|
|
||||||
server.port=9093
|
|
||||||
server.servlet.session.timeout=30m
|
|
||||||
|
|
||||||
|
|
||||||
server.servlet.encoding.charset=UTF-8
|
|
||||||
server.servlet.encoding.enabled=true
|
|
||||||
server.servlet.encoding.force=true
|
|
||||||
|
|
||||||
server.tomcat.uri-encoding=UTF-8
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ok.http.connect-timeout=30
|
|
||||||
ok.http.read-timeout=30
|
|
||||||
ok.http.write-timeout=30
|
|
||||||
# 连接池中整体的空闲连接的最大数量
|
|
||||||
ok.http.max-idle-connections=200
|
|
||||||
# 连接空闲时间最多为 300 秒
|
|
||||||
ok.http.keep-alive-duration=300
|
|
||||||
|
|
||||||
#spring.jackson.locale=
|
|
||||||
#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
|
||||||
# spring.jackson.default-property-inclusion=NON_NULL
|
|
||||||
spring.jackson.time-zone=GMT+8
|
|
||||||
|
|
||||||
spring.servlet.multipart.max-file-size=1024MB
|
|
||||||
spring.servlet.multipart.max-request-size=1024MB
|
|
||||||
|
|
||||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
|
||||||
spring.mvc.static-path-pattern=/cdn/**
|
|
||||||
|
|
||||||
|
|
||||||
spring.redis.lettuce.pool.max-active=8
|
|
||||||
spring.redis.lettuce.pool.min-idle=0
|
|
||||||
spring.redis.lettuce.pool.max-idle=30
|
|
||||||
spring.redis.lettuce.pool.max-wait=10000ms
|
|
||||||
spring.redis.lettuce.shutdown-timeout=100ms
|
|
||||||
|
|
||||||
# 上传的临时目录,部署到服务器必须指定
|
|
||||||
# spring.servlet.multipart.location=
|
|
||||||
|
|
||||||
# jpa config
|
|
||||||
spring.jpa.database = MYSQL
|
|
||||||
spring.jpa.show-sql = false
|
|
||||||
# spring.jpa.properties.hibernate.cache.use_second_level_cache=true
|
|
||||||
# spring.jpa.properties.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
|
|
||||||
spring.jpa.hibernate.ddl-auto=none
|
|
||||||
spring.jpa.properties.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
|
|
||||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
|
|
||||||
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
|
|
||||||
#spring.transaction
|
|
||||||
# spring.jpa.properties.hibernate.allow_update_outside_transaction=true
|
|
||||||
# spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
|
||||||
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
|
||||||
|
|
||||||
|
|
||||||
# 设置logback.xml位置
|
|
||||||
logging.config=classpath:log/logback-@profileActive@.xml
|
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,14 +0,0 @@
|
|||||||
<License>
|
|
||||||
<Data>
|
|
||||||
<Products>
|
|
||||||
<Product>Aspose.Total for Java</Product>
|
|
||||||
<Product>Aspose.Words for Java</Product>
|
|
||||||
</Products>
|
|
||||||
<EditionType>Enterprise</EditionType>
|
|
||||||
<SubscriptionExpiry>20991231</SubscriptionExpiry>
|
|
||||||
<LicenseExpiry>20991231</LicenseExpiry>
|
|
||||||
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
|
|
||||||
</Data>
|
|
||||||
<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=
|
|
||||||
</Signature>
|
|
||||||
</License>
|
|
||||||
Binary file not shown.
@@ -1,54 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
|
||||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
|
||||||
<!-- 彩色日志格式 -->
|
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
|
||||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
|
||||||
<conversionRule conversionWord="wex"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
|
||||||
<conversionRule conversionWord="wEx"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file debug output -->
|
|
||||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/debug.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file error output -->
|
|
||||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>ERROR</level>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="INFO">
|
|
||||||
<appender-ref ref="console"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
|
||||||
<property name="log.path" value="/home/logs/${spring.application.name}"/>
|
|
||||||
<!-- 彩色日志格式 -->
|
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
|
||||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
|
||||||
<conversionRule conversionWord="wex"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
|
||||||
<conversionRule conversionWord="wEx"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file debug output -->
|
|
||||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/debug.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file error output -->
|
|
||||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>ERROR</level>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="ERROR">
|
|
||||||
<appender-ref ref="debug"/>
|
|
||||||
<appender-ref ref="error"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
|
||||||
<property name="log.path" value="/home/logs/${spring.application.name}"/>
|
|
||||||
<!-- 彩色日志格式 -->
|
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
|
||||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
|
||||||
<conversionRule conversionWord="wex"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
|
||||||
<conversionRule conversionWord="wEx"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file debug output -->
|
|
||||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/debug.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file error output -->
|
|
||||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>ERROR</level>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="ERROR">
|
|
||||||
<appender-ref ref="debug"/>
|
|
||||||
<appender-ref ref="error"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
|
||||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
|
||||||
<!-- 彩色日志格式 -->
|
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
|
||||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
|
||||||
<conversionRule conversionWord="wex"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
|
||||||
<conversionRule conversionWord="wEx"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file debug output -->
|
|
||||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/debug.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file error output -->
|
|
||||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>ERROR</level>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="INFO">
|
|
||||||
<appender-ref ref="debug"/>
|
|
||||||
<appender-ref ref="error"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.xboe;
|
|
||||||
|
|
||||||
public class AttachmentUrlTest {
|
|
||||||
|
|
||||||
// public static String getNameStr(String name) {
|
|
||||||
// String first=name.replaceAll("\\(","(");
|
|
||||||
// int index1=first.indexOf("(");
|
|
||||||
// if(index1>0) {
|
|
||||||
// first=first.substring(0,index1);
|
|
||||||
// }
|
|
||||||
// return first;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void main(String[] args) throws Exception {
|
|
||||||
//// String fileUrl="http://bpm.boe.com.cn/portal/apps/com.awspaas.user.apps.showfj/temp/tylc07_boealfjdz/00002770-张玉欣-专利包质量基准.docx";
|
|
||||||
//// int urlLast=fileUrl.lastIndexOf("/");
|
|
||||||
////
|
|
||||||
//// String urlName=fileUrl.substring(urlLast+1);
|
|
||||||
////
|
|
||||||
//// fileUrl=fileUrl.substring(0, urlLast+1)+URLEncoder.encode(urlName, "UTF-8");
|
|
||||||
//// System.out.println(fileUrl);
|
|
||||||
//// fileUrl=fileUrl.replaceAll("\\+","%20");
|
|
||||||
//// System.out.println(fileUrl);
|
|
||||||
//
|
|
||||||
// String caseName="经营管理(一级、二级经营责任者撰写),战略预算(战略企划与执行、预算),投融资(投资管理、资金、股证)】,未匹配到专业分类【经营管理(一级、二级经营责任者撰写),战略预算(战略企划与执行、预算),投融资(投资管理、资金、股证)";
|
|
||||||
// System.out.println(caseName.replaceAll("\\(","("));
|
|
||||||
// System.out.println(AttachmentUrlTest.getNameStr(caseName));
|
|
||||||
// //替换英文的括号为中文的括号
|
|
||||||
// //caseName=caseName.replaceAll("(","(");
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user