Compare commits
2 Commits
c54f51f453
...
afcc1d49d4
Author | SHA1 | Date |
---|---|---|
胡锐 | afcc1d49d4 | 3 weeks ago |
胡锐 | de4d867fda | 3 weeks ago |
@ -0,0 +1,70 @@ |
|||||||
|
|
||||||
|
package com.hfkj.controller; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.common.utils.ResponseMsgUtil; |
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import com.hfkj.entity.BsUserParentRel; |
||||||
|
import com.hfkj.entity.SecDictionary; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.service.sec.SecDictionaryService; |
||||||
|
import com.hfkj.service.user.BsUserGradeService; |
||||||
|
import com.hfkj.service.user.BsUserParentRelService; |
||||||
|
import com.hfkj.service.user.BsUserService; |
||||||
|
import com.hfkj.sysenum.user.UserGradeEnum; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: CmsController |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/9/24 |
||||||
|
**/ |
||||||
|
@Controller |
||||||
|
@RequestMapping(value = "/sysSetting") |
||||||
|
@Api(value = "系统设置") |
||||||
|
public class SysSettingController { |
||||||
|
private static Logger log = LoggerFactory.getLogger(SysSettingController.class); |
||||||
|
@Resource |
||||||
|
private SecDictionaryService secDictionaryService; |
||||||
|
|
||||||
|
@RequestMapping(value="/goldCoinExchangeRate",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "元宝汇率") |
||||||
|
public ResponseData goldCoinExchangeRate(@RequestBody JSONObject body) { |
||||||
|
try { |
||||||
|
if (body == null || body.getBigDecimal("exchangeRate") == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecDictionary where = new SecDictionary(); |
||||||
|
where.setCodeType("GOLD_COIN_EXCHANGE_RATE"); |
||||||
|
// 查询数据
|
||||||
|
SecDictionary dictionary = secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0); |
||||||
|
dictionary.setCodeValue(body.getBigDecimal("exchangeRate").toString()); |
||||||
|
secDictionaryService.update(where, dictionary); |
||||||
|
|
||||||
|
// 刷新缓存
|
||||||
|
secDictionaryService.refreshCache(); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,7 +1,28 @@ |
|||||||
package com.hfkj.dao; |
package com.hfkj.dao; |
||||||
|
|
||||||
|
import com.hfkj.entity.SecDictionary; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.apache.ibatis.annotations.Update; |
||||||
|
|
||||||
/** |
/** |
||||||
* mapper扩展类 |
* mapper扩展类 |
||||||
*/ |
*/ |
||||||
public interface SecDictionaryMapperExt { |
public interface SecDictionaryMapperExt { |
||||||
|
|
||||||
|
@Update({ |
||||||
|
"<script>" + |
||||||
|
"update sec_dictionary", |
||||||
|
"set code_value = #{data.codeValue,jdbcType=VARCHAR}," + |
||||||
|
"code_name = #{data.codeName,jdbcType=VARCHAR},", |
||||||
|
"code_desc = #{data.codeDesc,jdbcType=VARCHAR},", |
||||||
|
"sort_id = #{data.sortId,jdbcType=INTEGER},", |
||||||
|
"`status` = #{data.status,jdbcType=INTEGER},", |
||||||
|
"ext_1 = #{data.ext1,jdbcType=VARCHAR},", |
||||||
|
"ext_2 = #{data.ext2,jdbcType=VARCHAR},", |
||||||
|
"ext_3 = #{data.ext3,jdbcType=VARCHAR}", |
||||||
|
"where code_type = #{codeType,jdbcType=VARCHAR}", |
||||||
|
" <if test='codeValue != null'> and code_value = #{codeValue,jdbcType=VARCHAR} </if>", |
||||||
|
"</script>" |
||||||
|
}) |
||||||
|
void update(@Param("codeType") String codeType, @Param("codeValue") String codeValue, @Param("data") SecDictionary data); |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue