eason.qian 7 years ago
parent a887493153
commit b7459efc5b

@ -15,6 +15,7 @@ import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -88,6 +89,7 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
@Override @Override
public void actApply(JSONObject device) { public void actApply(JSONObject device) {
JSONObject act = actAppMapper.getActDetail("1"); JSONObject act = actAppMapper.getActDetail("1");
Assert.notNull(act,"The activity is not valid");
if (!act.getBoolean("is_valid")) { if (!act.getBoolean("is_valid")) {
throw new BadRequestException("The activity is not valid"); throw new BadRequestException("The activity is not valid");
} }
@ -106,11 +108,12 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
} }
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if (device.getIntValue("client_id") != account.getIntValue("client_id") || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { if (device.getIntValue("client_id") != account.getIntValue("client_id") || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
throw new ForbiddenException("You have no permission"); throw new ForbiddenException("You have no permission.Please login in using the administrator account");
} }
device.put("account_name", account.getString("display_name")); device.put("account_name", account.getString("display_name"));
device.put("create_time", new Date()); device.put("create_time", new Date());
device.put("rate",new BigDecimal(12)); JSONObject params = act.getJSONObject("params_json");
device.put("rate", params.getBigDecimal("rate") == null ? new BigDecimal(0.15) : params.getBigDecimal("rate"));
device.put("expire_time", act.getDate("expire_date")); device.put("expire_time", act.getDate("expire_date"));
actMonDelaySettleMapper.save(device); actMonDelaySettleMapper.save(device);
} }

Loading…
Cancel
Save