|
|
|
@ -1,6 +1,9 @@ |
|
|
|
|
package com.bweb.controller; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hai.config.TuanYouConfig; |
|
|
|
@ -11,6 +14,7 @@ import com.hai.service.CommonService; |
|
|
|
|
import com.hai.service.SecConfigService; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
@ -144,6 +148,39 @@ public class CommonController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/editConfig",method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "添加配置") |
|
|
|
|
public ResponseData editConfig(@RequestBody JSONObject body) { |
|
|
|
|
try { |
|
|
|
|
if (body == null |
|
|
|
|
|| StringUtils.isBlank(body.getString("codeType")) |
|
|
|
|
|| StringUtils.isBlank(body.getString("codeValue")) |
|
|
|
|
) { |
|
|
|
|
log.error("OrderController --> orderToPay() ERROR", ""); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SecConfig config = secConfigService.findByCodeType(body.getString("codeType")); |
|
|
|
|
if (config == null) { |
|
|
|
|
config = new SecConfig(); |
|
|
|
|
config.setCodeType(body.getString("codeType")); |
|
|
|
|
config.setCodeValue(body.getString("codeValue")); |
|
|
|
|
secConfigService.insertSecConfig(config); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
config.setCodeValue(body.getString("codeValue")); |
|
|
|
|
secConfigService.updateSecConfig(config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("修改成功"); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("CommonController --> editConfig() error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/updateDictionary",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "根据 码值类型 查询数据字典") |
|
|
|
|