修改话费定时任务问题

dev-discount
袁野 2 years ago
parent 343b0fb77f
commit 698a5b942e
  1. 176
      hai-bweb/src/main/java/com/bweb/controller/BsIntegralRebateController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 36
      hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java
  4. 48
      hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java

@ -0,0 +1,176 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.dao.BsIntegralRebateMapper;
import com.hai.entity.ApiKfcStores;
import com.hai.entity.BsIntegralRebate;
import com.hai.entity.BsOperationLog;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.BsIntegralRebateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@Controller
@RequestMapping(value = "/bsIntegralRebate")
@Api(value = "积分返利")
public class BsIntegralRebateController {
private static Logger log = LoggerFactory.getLogger(BsIntegralRebateController.class);
@Autowired
private UserCenter userCenter;
@Resource
private BsIntegralRebateService bsIntegralRebateService;
@RequestMapping(value = "/selectCompanyList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取公司列表")
public ResponseData selectCompanyList(@RequestParam(name = "type", required = false) Integer type,
@RequestParam(name = "productId", required = false) Long productId,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
map.put("type", type);
map.put("companyId", userInfoModel.getBsCompany().getId());
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(bsIntegralRebateService.getIntegralRebateByList(map)));
} catch (Exception e) {
log.error("BsCompanyController --> selectCompanyList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findIntegralRebateById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询详情")
public ResponseData getOrderById(@RequestParam(name = "id", required = true) Long id) {
try {
return ResponseMsgUtil.success(bsIntegralRebateService.findIntegralRebateById(id));
} catch (Exception e) {
log.error("HighOrderController --> getOrderById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/insertPrice", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增金额")
public ResponseData insertPrice(@RequestBody BsIntegralRebate integralRebate, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (integralRebate.getPercentage() == null ||
integralRebate.getType() == null ||
integralRebate.getProductId() == null
) {
log.error("OutRechargePriceController -> insertPrice() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String, Object> map = new HashMap<>();
map.put("type" , integralRebate.getType());
map.put("productId" , integralRebate.getProductId());
BsIntegralRebate bsIntegralRebate = bsIntegralRebateService.findIntegralRebateByMap(map);
if (bsIntegralRebate != null) {
log.error("OutRechargePriceController -> insertPrice() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已存在当前产品");
}
integralRebate.setCompanyId(userInfoModel.getBsCompany().getId());
integralRebate.setCreateTime(new Date());
integralRebate.setOperatorName(userInfoModel.getSecUser().getUserName());
integralRebate.setOperatorId(userInfoModel.getSecUser().getId());
integralRebate.setUpdateTime(new Date());
integralRebate.setStatus(101);
bsIntegralRebateService.insertIntegralRebate(integralRebate);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("OutRechargePriceController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/updatePrice", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改金额")
public ResponseData updatePrice(@RequestBody BsIntegralRebate integralRebate, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (integralRebate.getPercentage() == null ||
integralRebate.getId() == null ||
integralRebate.getType() == null ||
integralRebate.getProductId() == null
) {
log.error("OutRechargePriceController -> insertPrice() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String, Object> map = new HashMap<>();
map.put("type" , integralRebate.getType());
map.put("productId" , integralRebate.getProductId());
BsIntegralRebate bsIntegralRebate = bsIntegralRebateService.findIntegralRebateByMap(map);
if (bsIntegralRebate != null && !Objects.equals(integralRebate.getId(), bsIntegralRebate.getId())) {
log.error("OutRechargePriceController -> insertPrice() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已存在当前产品");
}
integralRebate.setOperatorName(userInfoModel.getSecUser().getUserName());
integralRebate.setOperatorId(userInfoModel.getSecUser().getId());
integralRebate.setUpdateTime(new Date());
integralRebate.setStatus(101);
bsIntegralRebateService.updateIntegralRebate(integralRebate);
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("OutRechargePriceController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -168,6 +168,42 @@ public class HuiLianTongConfig {
return object1; return object1;
} }
/**
* 商户派发电子券
* @return
* @throws Exception
*/
public static JSONObject test (JSONObject object1) throws Exception {
new Thread(() -> {
try {
if (object1 != null && object1.getString("result").equals("success")) {
JSONArray dataArray = object1.getJSONArray("data");
for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data;
Map<String, Object> mapPost = new HashMap<>();
mapPost.put("orderNo" , "HF2022080308340632509");
mapPost.put("distCouCount" , "1");
mapPost.put("phone" , "18096074536");
mapPost.put("distributorId" , "1JnL8YMV");
mapPost.put("couNo" , dataObject.getString("couNo"));
mapPost.put("status" , "20");
mapPost.put("couTypeCode" , dataObject.getString("couTypeCode"));
mapPost.put("validStartDate" , dataObject.getString("validStartDate"));
mapPost.put("validEndDate" , dataObject.getString("validEndDate"));
JSONObject o = HuiLianTongUnionCardConfig.syncPayOrder(mapPost);
System.out.println("订单同步请求参数---------" + mapPost);
System.out.println("订单同步请求结果---------" + o);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}).start();
return object1;
}
public static String get3DESEncryptECB(String src,String secretKey) { public static String get3DESEncryptECB(String src,String secretKey) {
try { try {

@ -1,36 +1,76 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.hai.dao.BsIntegralRebateMapper;
import com.hai.entity.BsIntegralRebate; import com.hai.entity.BsIntegralRebate;
import com.hai.entity.BsIntegralRebateExample;
import com.hai.service.BsIntegralRebateService; import com.hai.service.BsIntegralRebateService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Service("bsIntegralRebateService") @Service("bsIntegralRebateService")
public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { public class BsIntegralRebateServiceImpl implements BsIntegralRebateService {
@Resource
private BsIntegralRebateMapper bsIntegralRebateMapper;
@Override @Override
public BsIntegralRebate findIntegralRebateByMap(Map<String, Object> map) { public BsIntegralRebate findIntegralRebateByMap(Map<String, Object> map) {
BsIntegralRebateExample example = new BsIntegralRebateExample();
BsIntegralRebateExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map , "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map , "type"));
}
if (MapUtils.getLong(map , "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(map , "companyId"));
}
if (MapUtils.getLong(map , "productId") != null) {
criteria.andProductIdEqualTo(MapUtils.getLong(map , "productId"));
}
List<BsIntegralRebate> list = bsIntegralRebateMapper.selectByExample(example);
if (list.size() > 0) {
bsIntegralRebateMapper.selectByExample(example).get(0);
}
return null; return null;
} }
@Override @Override
public BsIntegralRebate findIntegralRebateById(Long id) { public BsIntegralRebate findIntegralRebateById(Long id) {
return null; return bsIntegralRebateMapper.selectByPrimaryKey(id);
} }
@Override @Override
public List<BsIntegralRebate> getIntegralRebateByList(Map<String, Object> map) { public List<BsIntegralRebate> getIntegralRebateByList(Map<String, Object> map) {
return null; BsIntegralRebateExample example = new BsIntegralRebateExample();
BsIntegralRebateExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map , "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map , "type"));
}
if (MapUtils.getLong(map , "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(map , "companyId"));
}
if (MapUtils.getLong(map , "productId") != null) {
criteria.andProductIdEqualTo(MapUtils.getLong(map , "productId"));
}
return bsIntegralRebateMapper.selectByExample(example);
} }
@Override @Override
public void insertIntegralRebate(BsIntegralRebate bsIntegralRebate) { public void insertIntegralRebate(BsIntegralRebate bsIntegralRebate) {
bsIntegralRebateMapper.insert(bsIntegralRebate);
} }
@Override @Override
public void updateIntegralRebate(BsIntegralRebate bsIntegralRebate) { public void updateIntegralRebate(BsIntegralRebate bsIntegralRebate) {
bsIntegralRebateMapper.updateByPrimaryKeySelective(bsIntegralRebate);
} }
} }

Loading…
Cancel
Save