New file |
| | |
| | | package com.matrix.system.score.service; |
| | | |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-02-22 |
| | | **/ |
| | | @Service |
| | | public class ScoreRuleSettingService{ |
| | | |
| | | @Autowired |
| | | private BusParameterSettingsDao busParameterSettingsDao; |
| | | @Autowired |
| | | private SysVipInfoDao sysVipInfoDao; |
| | | |
| | | public AjaxResult updateScoreRuleByCompanyId(List<BusParameterSettings> busParameterSettings) { |
| | | //获取当前登录人员信息 |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | for (BusParameterSettings busParameterSetting:busParameterSettings ) { |
| | | String paramCode = busParameterSetting.getParamCode(); |
| | | if(StringUtils.isNotBlank(paramCode)){ |
| | | //删除原有code |
| | | BusParameterSettings delParanm=new BusParameterSettings(); |
| | | delParanm.setCompanyId(user.getCompanyId()); |
| | | delParanm.setParamCode(paramCode); |
| | | busParameterSettingsDao.deleteByModel(delParanm); |
| | | //添加新的code |
| | | BusParameterSettings newParam=new BusParameterSettings(); |
| | | newParam.setParamCode(paramCode); |
| | | newParam.setCompanyId(user.getCompanyId()); |
| | | newParam.setParamValue(busParameterSetting.getParamValue()); |
| | | newParam.setParamValue1(busParameterSetting.getParamValue1()); |
| | | newParam.setParamValue2(busParameterSetting.getParamValue2()); |
| | | busParameterSettingsDao.insert(newParam); |
| | | }else{ |
| | | return AjaxResult.buildFailInstance("code不能为空"); |
| | | } |
| | | } |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "更新成功"); |
| | | return result; |
| | | } |
| | | |
| | | } |