|
|
@@ -151,4 +151,45 @@ public class DistributionRuleServiceImpl implements DistributionRuleService{
|
|
|
int count = distributionRuleDao.findCountByEnuu(enuu);
|
|
|
return ResultMap.success(count);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultMap containsName(Long id, String ruleName, Boolean newSave) {
|
|
|
+ Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ Boolean repeat = null;
|
|
|
+ System.out.println("id=" + id);
|
|
|
+ if (id != null){
|
|
|
+ //修改配送规则情况,分保存和另存为两种
|
|
|
+ if (newSave){ //另存为
|
|
|
+ int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
|
|
|
+ System.out.println("count=" + count);
|
|
|
+ if (count != 0){
|
|
|
+ repeat = true;
|
|
|
+ }else {
|
|
|
+ repeat = false;
|
|
|
+ }
|
|
|
+ }else { //保存
|
|
|
+ DistributionRule rule = distributionRuleDao.findOne(id);
|
|
|
+ if (ruleName.equals(rule.getRuleName())){
|
|
|
+ repeat = false;
|
|
|
+ }else {
|
|
|
+ int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
|
|
|
+ System.out.println("count=" + count);
|
|
|
+ if (count != 0){
|
|
|
+ repeat = true;
|
|
|
+ }else {
|
|
|
+ repeat = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else { //新增配送规则情况
|
|
|
+ int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
|
|
|
+ System.out.println("count=" + count);
|
|
|
+ if (count != 0){
|
|
|
+ repeat = true;
|
|
|
+ }else {
|
|
|
+ repeat = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultMap.success(repeat);
|
|
|
+ }
|
|
|
}
|