|
|
@ -21,8 +21,10 @@ import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -182,19 +184,28 @@ public class LoanFinPolicyService extends MybatisBaseService<LoanFinPolicyMapper |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean setState(String sid, String useState) { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean setState(LoanFinPolicyStateQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//ToDo:是否可以停用或开启,需补充条件
|
|
|
|
LoanFinPolicy loanFinPolicy = fetchBySid(sid); |
|
|
|
if (loanFinPolicy == null) { |
|
|
|
return rb.setMsg("该金融产品政策不存在"); |
|
|
|
List<String> sidsList = query.getSidsList(); |
|
|
|
sidsList.removeAll(Collections.singleton(null)); |
|
|
|
if (sidsList.isEmpty()) { |
|
|
|
return rb.setMsg("请选择数据"); |
|
|
|
} |
|
|
|
loanFinPolicy.setUseSate(Integer.valueOf(useState).intValue()); |
|
|
|
baseMapper.updateById(loanFinPolicy); |
|
|
|
LoanFinOtherPolicy loanFinOtherPolicy = loanFinOtherPolicyService.selectByMainSid(sid); |
|
|
|
if (loanFinOtherPolicy != null) { |
|
|
|
loanFinOtherPolicy.setUseSate(Integer.valueOf(useState).intValue()); |
|
|
|
loanFinOtherPolicyService.updateById(loanFinOtherPolicy); |
|
|
|
String useState = query.getUseState(); |
|
|
|
for (String sid : sidsList) { |
|
|
|
LoanFinPolicy loanFinPolicy = fetchBySid(sid); |
|
|
|
if (loanFinPolicy == null) { |
|
|
|
return rb.setMsg("选择中包含金融产品政策不存在的数据,请刷新后操作"); |
|
|
|
} |
|
|
|
loanFinPolicy.setUseSate(Integer.valueOf(useState).intValue()); |
|
|
|
baseMapper.updateById(loanFinPolicy); |
|
|
|
LoanFinOtherPolicy loanFinOtherPolicy = loanFinOtherPolicyService.selectByMainSid(sid); |
|
|
|
if (loanFinOtherPolicy != null) { |
|
|
|
loanFinOtherPolicy.setUseSate(Integer.valueOf(useState).intValue()); |
|
|
|
loanFinOtherPolicyService.updateById(loanFinOtherPolicy); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
@ -299,4 +310,30 @@ public class LoanFinPolicyService extends MybatisBaseService<LoanFinPolicyMapper |
|
|
|
PagerVo<LoanFinPolicyVos> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean setRiskState(LoanRiskStateQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//ToDo:是否可以停用或开启,需补充条件
|
|
|
|
List<String> sidsList = query.getSidsList(); |
|
|
|
sidsList.removeAll(Collections.singleton(null)); |
|
|
|
if (sidsList.isEmpty()) { |
|
|
|
return rb.setMsg("请选择数据"); |
|
|
|
} |
|
|
|
String riskState = query.getRiskState(); |
|
|
|
for (String sid : sidsList) { |
|
|
|
LoanFinPolicy loanFinPolicy = fetchBySid(sid); |
|
|
|
if (loanFinPolicy == null) { |
|
|
|
return rb.setMsg("选择中包含金融产品政策不存在的数据,请刷新后操作"); |
|
|
|
} |
|
|
|
loanFinPolicy.setRiskState(Integer.valueOf(riskState).intValue()); |
|
|
|
baseMapper.updateById(loanFinPolicy); |
|
|
|
LoanFinOtherPolicy loanFinOtherPolicy = loanFinOtherPolicyService.selectByMainSid(sid); |
|
|
|
if (loanFinOtherPolicy != null) { |
|
|
|
loanFinOtherPolicy.setRiskState(Integer.valueOf(riskState).intValue()); |
|
|
|
loanFinOtherPolicyService.updateById(loanFinOtherPolicy); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|