dev-discount
袁野 3 years ago
parent 27d2ae09aa
commit 6d5a27dfa4
  1. 28
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java
  2. 4
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java

@ -1,6 +1,7 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bweb.config.SysConst;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -202,4 +203,31 @@ public class HighDiscountAgentRelController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDiscountStatus",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改状态")
public ResponseData getDiscountStatus(@RequestBody JSONObject jsonObject) {
try {
Integer status = jsonObject.getInteger("status");
Long minNumber = jsonObject.getLong("minNumber");
Long maxNumber = jsonObject.getLong("maxNumber");
for (Long i = minNumber; i <= maxNumber; i++) {
HighDiscountAgentCode highDiscountAgentCode = highDiscountAgentCodeService.getCodeById(i);
if (highDiscountAgentCode.getStatus() == 1 || highDiscountAgentCode.getStatus() == 4 ) {
highDiscountAgentCode.setStatus(status);
highDiscountAgentCodeService.updateCode(highDiscountAgentCode);
}
}
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("HighDiscountController -> getDiscountCodeById() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -5,6 +5,8 @@ import com.hai.entity.*;
import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@ -50,6 +52,7 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void updateCode(HighDiscountAgentCode highDiscountAgentCode) {
highDiscountAgentCodeMapper.updateByPrimaryKey(highDiscountAgentCode);
}
@ -104,4 +107,5 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
example.createCriteria().andDiscountAgentIdEqualTo(discountAgentId).andStatusNotEqualTo(1);
return highDiscountAgentCodeMapper.selectByExample(example).size();
}
}

Loading…
Cancel
Save