Merge remote-tracking branch 'origin/dev' into dev

yun-zuoyi
wei.peng 6 years ago
commit 95a680b5c7

@ -45,4 +45,7 @@ public interface ISysLocaleLanguageService {
@ApiOperation(value = "根据语言id批量修改语言状态")
void updateSysLocaleLanguageStatusByIds(Long[] ids,Integer status);
@ApiOperation(value = "根据语言状态查询语言信息")
List<SysLocaleLanguage> findSysLocaleLanguageByStatus(Integer status);
}

@ -59,10 +59,10 @@ public class WhiteController extends CoreBaseController {
private IPersonnelService personnelService;
@GetMapping(value = "/sys-locale-language/list")
@ApiOperation(value = "查询全部系统语言",notes = "查询全部系统语言")
@ApiOperation(value = "查询可用语言",notes = "查询可用语言")
public ResultBean listSysLocaleLanguage(){
try {
List sysLocaleLanguageList = sysLocaleLanguageService.listSysLocaleLanguage();
List sysLocaleLanguageList = sysLocaleLanguageService.findSysLocaleLanguageByStatus(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(sysLocaleLanguageList);
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);

@ -142,7 +142,7 @@ public class SysLocaleLanguageController extends CoreBaseController {
@ApiOperation(value = "根据id批量删除")
public ResultBean deleteSysLocaleLanguageByIds(String[] idsStr){
try {
if(idsStr.length == 0){
if(idsStr == null || idsStr.length == 0){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
@ -180,7 +180,7 @@ public class SysLocaleLanguageController extends CoreBaseController {
@ApiOperation(value = "根据批量修改语言状态")
public ResultBean updateSysLocaleLanguageStatusByIds(String[] idsStr,Integer status){
try {
if(idsStr.length == 0){
if(idsStr == null || idsStr.length == 0){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())

@ -281,7 +281,9 @@ public class SysOrderNoRuleController extends CoreBaseController {
if (zipFile != null) {
FileUtil.deletefile(zipFile.getPath());
}
FileUtil.deletefile(excelDir.getPath());
if(excelDir != null){
FileUtil.deletefile(excelDir.getPath());
}
}
}
@ -290,8 +292,13 @@ public class SysOrderNoRuleController extends CoreBaseController {
public ResultBean importSysOrderNoRule(@RequestParam("file") MultipartFile file){
try {
List<SysOrderNoRule> sysOrderNoRuleList = ExcelUtil.importData(file.getOriginalFilename(),file.getInputStream(),SysOrderNoRule.class);
// 初始化数据
for (SysOrderNoRule sysOrderNoRule: sysOrderNoRuleList) {
sysOrderNoRule.setOrderNoRuleStatus(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
sysOrderNoRule.setSerialNo(CommonEnumUtil.PARENT.DEFAULT.getValue());
}
sysOrderNoRuleService.insertSysOrderNoRuleList(sysOrderNoRuleList);
return ResultBean.success("导出成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
return ResultBean.success("导成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){

@ -114,7 +114,7 @@ public class SysTaskCycleController extends CoreBaseController{
}
sysTaskCycleService.deleteSysTaskCycleById(Long.parseLong(idStr));
return ResultBean.success().setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){

@ -81,6 +81,7 @@ public class SysTaskPlanController extends CoreBaseController{
if(isExecute != null && isExecute){
sysTaskPlanService.executeSysTaskPlan(sysTaskPlan);
}
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(sysTaskPlan);
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);

@ -36,6 +36,7 @@ public class ReportDaoImpl implements IReportDao {
}
}
}
entityManager.clear();
return queryObject.getResultList();
}
}

@ -42,6 +42,7 @@ public class MessageMailQueueReceiver {
ISysConfigService sysConfigService;
@Autowired
MailUtil mailUtil;
/**
*
* @param msg
@ -61,7 +62,8 @@ public class MessageMailQueueReceiver {
mailUtil.setBody(msg.getMessageContent());
// 发送给系统配置中的紧急联系人
mailUtil.setTo(sysConfigService.getSysConfigByCode(PlatformConstWords.CONTACT_MAIL).getConfigValue());
mailUtil.send();
// 次数过于频繁
// mailUtil.send();
} else if(PlatformConstWords.EXTERNAL_MAIL.equals(msg.getMessageReceiversId())){ //判断是否为外部邮件
mailUtil.setSubject(msg.getMessageTitle());

@ -38,7 +38,9 @@ public class DemoJob extends BaseImppScheduleJob {
SysMessage sysMessage = new SysMessage();
sysMessage.setMessageTitle("定时邮件发送");
sysMessage.setMessageContent("定时邮件内容"+TimeTool.getNowTime(true));
sysMessage.setMessageContent("定时任务name"+context.getJobDetail().getKey().getName()
+"定时任务groupName"+context.getJobDetail().getKey().getGroup()
+"定时邮件内容"+TimeTool.getNowTime(true));
sysMessage.setMessageType(ImppEnumUtil.MESSAGE_TYPE.MAIL.getValue());
sysMessage.setMessageContentType(ImppEnumUtil.MESSAGE_TYPE_CONTENT.HTML.getValue());
sysMessage.setMessageReceiversId(PlatformConstWords.CONTACT_MAIL);

@ -102,7 +102,7 @@ public class SysConfigService implements ISysConfigService {
@Override
@ApiOperation(value = "根据code修改系统配置")
public void updateSysConfigByCode(String code, String value) {
SysConfigRDao.updateByProperties("configCode",value,"configValue",value);
SysConfigRDao.updateByProperties("configCode",code,"configValue",value);
}
@Override

@ -92,6 +92,16 @@ public class SysDictionaryService implements ISysDictionaryService {
.build();
}
// 数据反填
SysDictionary newSysDict = sysDictionaryRDao.getById(sysDictionary.getParentId());
newSysDict.setName(sysDictionary.getName());
newSysDict.setDictionaryCode(sysDictionary.getDictionaryCode());
newSysDict.setParentId(sysDictionary.getParentId());
newSysDict.setDictionarySort(sysDictionary.getDictionarySort());
newSysDict.setDictionaryValueType(sysDictionary.getDictionaryValueType());
newSysDict.setDictionaryValue(sysDictionary.getDictionaryValue());
newSysDict.setDictionaryDescription(sysDictionary.getDictionaryDescription());
// 查询父级字典名称
if (sysDictionary.getParentId() != null && sysDictionary.getParentId() > 0) {
LOGGER.info("字典 SYS_DICTIONARY parentId:{}", sysDictionary.getParentId());

@ -87,7 +87,13 @@ public class SysLocaleLanguageService implements ISysLocaleLanguageService {
SysLocaleLanguage sysLocaleLanguage = sysLocaleLanguageRDao.getById(id);
ValidatorBean.checkNotNull(sysLocaleLanguage,"需要删除的资源不存在");
if(sysLocaleResourceRDao.isExitByProperty("languageCode",sysLocaleLanguage.getLanguageCode())){
if(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == sysLocaleLanguage.getIsDefault().intValue()){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("默认语言不允许删除")
.build();
} else if(sysLocaleResourceRDao.isExitByProperty("languageCode",sysLocaleLanguage.getLanguageCode())){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
@ -121,7 +127,15 @@ public class SysLocaleLanguageService implements ISysLocaleLanguageService {
@Override
@ApiOperation(value = "根据id批量删除系统语言",notes = "根据id批量删除系统语言")
public void deleteSysLocaleLanguageByIds(Long[] ids) {
if(sysLocaleResourceRDao.findByHqlWhereCount(CoreHqlPack.packHqlIds("id",ids)) > 0){
// 判断批量数据中是否存在默认语言
List list = sysLocaleLanguageRDao.findByHqlWhere(CoreHqlPack.packHqlSysLocaleLanguageExistDefaultByIds(ids));
if (list.size() > 0) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("默认语言不允许删除")
.build();
} else if(sysLocaleResourceRDao.findByHqlWhereCount(CoreHqlPack.packHqlIds("id",ids)) > 0){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
@ -150,12 +164,41 @@ public class SysLocaleLanguageService implements ISysLocaleLanguageService {
@Override
@ApiOperation(value = "根据语言id修改语言状态")
public void updateSysLocaleLanguageStatusById(Long id, Integer status) {
SysLocaleLanguage sysLocaleLanguage = sysLocaleLanguageRDao.getById(id);
ValidatorBean.checkNotNull(sysLocaleLanguage,"需要删除的资源不存在");
// 判断是否禁用默认语言
if (CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue() == status.intValue()
&& CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == sysLocaleLanguage.getIsDefault().intValue()) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("默认语言不允许禁用")
.build();
}
sysLocaleLanguageRDao.updateByProperties("id",id,"languageStatus",status);
}
@Override
@ApiOperation(value = "根据语言id批量修改语言状态")
public void updateSysLocaleLanguageStatusByIds(Long[] ids, Integer status) {
// 判断批量数据禁用时是否存在默认语言
List list = sysLocaleLanguageRDao.findByHqlWhere(CoreHqlPack.packHqlSysLocaleLanguageExistDefaultByIds(ids));
if (CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue() == status.intValue() && list.size() > 0) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("默认语言不允许禁用")
.build();
}
sysLocaleLanguageRDao.updateByHqlWhere(CoreHqlPack.packHqlIds("id",ids),"languageStatus",status);
}
@Override
@ApiOperation(value = "根据语言状态查询语言信息")
public List<SysLocaleLanguage> findSysLocaleLanguageByStatus(Integer status) {
return sysLocaleLanguageRDao.findByProperty("isDefault",status);
}
}

@ -52,7 +52,7 @@ public class SysTaskPlanService implements ISysTaskPlanService {
@Override
@ApiOperation(value = "新增任务计划",notes = "新增任务计划")
public SysTaskPlan insertSysTaskPlan(SysTaskPlan sysTaskPlan, SysTaskCycle sysTaskCycle,SysTask sysTask) {
public SysTaskPlan insertSysTaskPlan(SysTaskPlan sysTaskPlan, SysTaskCycle sysTaskCycle,SysTask sysTask){
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 唯一校验
@ -98,21 +98,34 @@ public class SysTaskPlanService implements ISysTaskPlanService {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.TASK_EXCEPTION.getCode())
.setErrorDetail(e.getMessage())
.build();
} catch (ParseException e) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_FORMAT.getCode())
.setErrorCode(ImppExceptionEnum.TASK_EXCEPTION.getCode())
.setErrorDetail("表达式起止时间错误")
.setErrorSolution("请更改表达式起止时间")
.build();
} catch (ClassNotFoundException e) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorCode(ImppExceptionEnum.TASK_EXCEPTION.getCode())
.setErrorDetail("定时任务包名及类名不正确")
.setErrorSolution("请重新输入定时任务包名及类名")
.build();
} catch (RuntimeException e){
String message;
if(e.getMessage().indexOf("CronExpression") == 0){
message = "时间周期表达式错误";
}else {
message = e.getMessage();
}
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.TASK_EXCEPTION.getCode())
.setErrorDetail(message)
.build();
}
return sysTaskPlan;
}
@ -169,9 +182,18 @@ public class SysTaskPlanService implements ISysTaskPlanService {
scheduler.scheduleJob(jobDetail, triggerSet, true);
} catch (SchedulerException e) {
e.printStackTrace();
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.TASK_EXCEPTION.getCode())
.setErrorDetail(e.getMessage())
.build();
} catch (ParseException e) {
e.printStackTrace();
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.TASK_EXCEPTION.getCode())
.setErrorDetail("表达式起止时间错误")
.setErrorSolution("请更改表达式起止时间")
.build();
}
}

@ -83,7 +83,7 @@ public class ExcelUtil {
* @param exportClass
* @param exportCol
*/
public static File exportData(File excelFile,List data, Class exportClass, String[] exportCol) {
public static File exportData(File excelFile,List data, Class exportClass, String[] exportCol) throws Exception {
FileOutputStream fos = null;
//创建HSSFWorkbook对象(excel的文档对象)
HSSFWorkbook workbook = new HSSFWorkbook();
@ -164,13 +164,6 @@ public class ExcelUtil {
workbook.write(fos);
fos.flush();
return excelFile;
} catch (Exception e) {
e.printStackTrace();
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.IO_EXCEPTION_FILE.getCode())
.setErrorDetail("Excel 导出错误")
.build();
} finally {
try {
workbook.close();
@ -189,7 +182,7 @@ public class ExcelUtil {
* @param importClass
* @return
*/
public static <T> List<T> importData(String fileName, InputStream inputStream, Class importClass) {
public static <T> List<T> importData(String fileName, InputStream inputStream, Class importClass) throws Exception {
List dataList = new ArrayList<T>();
String fileType = StringTool.getStringFileSuffix(fileName, false);
@ -253,6 +246,7 @@ public class ExcelUtil {
// 判断是否存在引用关系
if (fields[j].isAnnotationPresent(AnnoOutputColumn.class)) {
inputColumn = fields[j].getAnnotation(AnnoOutputColumn.class);
row.getCell(j).setCellType(CellType.STRING);
cellValue = row.getCell(j).getStringCellValue();
// 判断是否为枚举字段
@ -277,8 +271,8 @@ public class ExcelUtil {
dataList.add(obj);
}
} catch (Exception e){
e.printStackTrace();
} finally {
inputStream.close();
}
return dataList;
}

Loading…
Cancel
Save