Commit 2c8f6023 authored by 董国亮's avatar 董国亮

youhuajiekou

parent f145ee10
......@@ -121,9 +121,11 @@ public class GreenwaveInducesController {
try {
String startTime = DateUtil.format(DateUtil.parse(m.getControlOptTimes().split("\\|")[0], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
String endTime = DateUtil.format(DateUtil.parse(m.getControlOptTimes().split("\\|")[1], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
greenwaveDTO.setControlOptTimes(startTime.substring(0,startTime.lastIndexOf(":00"))+"-"+endTime.substring(0,endTime.lastIndexOf(":00")));
greenwaveDTO.setControlOptTimes(startTime.substring(0,startTime.lastIndexOf(":"))+"-"+endTime.substring(0,endTime.lastIndexOf(":")));
}catch (ParseException ex){ex.printStackTrace();
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}catch (StringIndexOutOfBoundsException ex){ex.printStackTrace();
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}
}else {
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
......@@ -146,19 +148,19 @@ public class GreenwaveInducesController {
/**
* 根据条件查询记录
*
* @param GreenwaveInduces 查询条件
* @param greenwaveInduces 查询条件
* @return JsonViewObject
*/
@ApiOperation(value = "根据条件查询记录", notes = "根据条件查询记录", response = JsonViewObject.class, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) GreenwaveInduces GreenwaveInduces){
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) GreenwaveInduces greenwaveInduces){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String jsonStr = JSON.toJSONString(GreenwaveInduces);
String jsonStr = JSON.toJSONString(greenwaveInduces);
try {
//参数校验过程中修改,兼容实现,restful入参不用map,便于进行参数逐个校验
Map params = JSONObject.parseObject(JSONObject.toJSONString(GreenwaveInduces), Map.class);
Map params = JSONObject.parseObject(JSONObject.toJSONString(greenwaveInduces), Map.class);
// Map<String, Object> params = new HashMap<>();
// JSONObject.parseObject(JSONObject.toJSONString(GreenwaveInduces), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
List<GreenwaveInduces> greenwaveInducesList = this.greenwaveInducesMapper.findByMap(params);
......@@ -200,9 +202,11 @@ public class GreenwaveInducesController {
try {
String startTime = DateUtil.format(DateUtil.parse(m.getControlOptTimes().split("\\|")[0], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
String endTime = DateUtil.format(DateUtil.parse(m.getControlOptTimes().split("\\|")[1], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
greenwaveDTO.setControlOptTimes(startTime.substring(0,startTime.lastIndexOf(":00"))+"-"+endTime.substring(0,endTime.lastIndexOf(":00")));
greenwaveDTO.setControlOptTimes(startTime.substring(0,startTime.lastIndexOf(":"))+"-"+endTime.substring(0,endTime.lastIndexOf(":")));
}catch (ParseException ex){ex.printStackTrace();
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}catch (StringIndexOutOfBoundsException ex){ex.printStackTrace();
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}
}else {
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
......@@ -219,7 +223,6 @@ public class GreenwaveInducesController {
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getByWhere error,jsonStr:{}", this.getClass().getSimpleName(), jsonStr, e);
}
return jsonView;
}
......@@ -235,7 +238,6 @@ public class GreenwaveInducesController {
JsonViewObject getById(@ApiParam(value = "记录的id", required = true, example = "1") @PathVariable("id") @NotBlank(message = "查询id不能为空") String id){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
GreenwaveInduces GreenwaveInduces = this.greenwaveInducesService.getById(id);
jsonView.success(GreenwaveInduces);
......@@ -278,22 +280,22 @@ public class GreenwaveInducesController {
/**
* 新建记录
*
* @param GreenwaveInduces
* @param greenwaveInduces
* @return JsonViewObject
*/
@ApiOperation(value = "新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) GreenwaveInduces GreenwaveInduces){
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) GreenwaveInduces greenwaveInduces){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (GreenwaveInduces != null) {
jsonView = this.greenwaveInducesService.saveOrUpdate(GreenwaveInduces)?jsonView.success():jsonView.fail();
if (greenwaveInduces != null) {
jsonView = this.greenwaveInducesService.saveOrUpdate(greenwaveInduces)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(GreenwaveInduces), e);
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(greenwaveInduces), e);
}
return jsonView;
}
......@@ -301,21 +303,21 @@ public class GreenwaveInducesController {
/**
* 修改记录
*
* @param GreenwaveInduces
* @param greenwaveInduces
* @return
*/
@ApiOperation(value = "修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) GreenwaveInduces GreenwaveInduces){
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) GreenwaveInduces greenwaveInduces){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (GreenwaveInduces != null) {
jsonView = this.greenwaveInducesService.saveOrUpdate(GreenwaveInduces)?jsonView.success():jsonView.fail();
if (greenwaveInduces != null) {
jsonView = this.greenwaveInducesService.saveOrUpdate(greenwaveInduces)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("UPDATE_FAILED_MSG"));
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(GreenwaveInduces), e);
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(greenwaveInduces), e);
}
return jsonView;
}
......
......@@ -64,22 +64,21 @@ public class InduceHistController {
/**
* 根据条件查询记录
*
* @param InduceHist 查询条件
* @param induceHist 查询条件
* @return JsonViewObject
*/
@ApiOperation(value = "根据条件查询记录", notes = "根据条件查询记录", response = JsonViewObject.class, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) InduceHist InduceHist){
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) InduceHist induceHist){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String jsonStr = JSON.toJSONString(InduceHist);
String jsonStr = JSON.toJSONString(induceHist);
try {
//参数校验过程中修改,兼容实现,restful入参不用map,便于进行参数逐个校验
// Map params = JSONObject.parseObject(JSONObject.toJSONString(InduceHist), Map.class);
Map<String, Object> params = new HashMap<>();
JSONObject.parseObject(JSONObject.toJSONString(InduceHist), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
JSONObject.parseObject(JSONObject.toJSONString(induceHist), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
List list = this.induceHistService.listByMap(params);
jsonView.success(list);
} catch (Exception e) {
......@@ -144,22 +143,22 @@ public class InduceHistController {
/**
* 新建记录
*
* @param InduceHist
* @param induceHist
* @return JsonViewObject
*/
@ApiOperation(value = "新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) InduceHist InduceHist){
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) InduceHist induceHist){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (InduceHist != null) {
jsonView = this.induceHistService.saveOrUpdate(InduceHist)?jsonView.success():jsonView.fail();
if (induceHist != null) {
jsonView = this.induceHistService.saveOrUpdate(induceHist)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(InduceHist), e);
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(induceHist), e);
}
return jsonView;
}
......@@ -167,21 +166,21 @@ public class InduceHistController {
/**
* 修改记录
*
* @param InduceHist
* @param induceHist
* @return
*/
@ApiOperation(value = "修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) InduceHist InduceHist){
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) InduceHist induceHist){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (InduceHist != null) {
jsonView = this.induceHistService.saveOrUpdate(InduceHist)?jsonView.success():jsonView.fail();
if (induceHist != null) {
jsonView = this.induceHistService.saveOrUpdate(induceHist)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("UPDATE_FAILED_MSG"));
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(InduceHist), e);
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(induceHist), e);
}
return jsonView;
}
......
......@@ -67,21 +67,21 @@ public class InduceTemplateController {
/**
* 根据条件查询记录
*
* @param InduceTemplate 查询条件
* @param induceTemplate 查询条件
* @return JsonViewObject
*/
@ApiOperation(value = "根据条件查询记录", notes = "根据条件查询记录", response = JsonViewObject.class, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) InduceTemplate InduceTemplate){
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) InduceTemplate induceTemplate){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String jsonStr = JSON.toJSONString(InduceTemplate);
String jsonStr = JSON.toJSONString(induceTemplate);
try {
//参数校验过程中修改,兼容实现,restful入参不用map,便于进行参数逐个校验
// Map params = JSONObject.parseObject(JSONObject.toJSONString(InduceTemplate), Map.class);
Map<String, Object> params = new HashMap<>();
JSONObject.parseObject(JSONObject.toJSONString(InduceTemplate), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
JSONObject.parseObject(JSONObject.toJSONString(induceTemplate), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
List list = this.induceTemplateService.listByMap(params);
jsonView.success(list);
......@@ -147,22 +147,22 @@ public class InduceTemplateController {
/**
* 新建记录
*
* @param InduceTemplate
* @param induceTemplate
* @return JsonViewObject
*/
@ApiOperation(value = "新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) InduceTemplate InduceTemplate){
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) InduceTemplate induceTemplate){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (InduceTemplate != null) {
jsonView = this.induceTemplateService.saveOrUpdate(InduceTemplate)?jsonView.success():jsonView.fail();
if (induceTemplate != null) {
jsonView = this.induceTemplateService.saveOrUpdate(induceTemplate)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(InduceTemplate), e);
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(induceTemplate), e);
}
return jsonView;
}
......@@ -170,21 +170,21 @@ public class InduceTemplateController {
/**
* 修改记录
*
* @param InduceTemplate
* @param induceTemplate
* @return
*/
@ApiOperation(value = "修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) InduceTemplate InduceTemplate){
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) InduceTemplate induceTemplate){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (InduceTemplate != null) {
jsonView = this.induceTemplateService.saveOrUpdate(InduceTemplate)?jsonView.success():jsonView.fail();
if (induceTemplate != null) {
jsonView = this.induceTemplateService.saveOrUpdate(induceTemplate)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("UPDATE_FAILED_MSG"));
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(InduceTemplate), e);
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(induceTemplate), e);
}
return jsonView;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment