'提交代码'

dev-discount
= 3 years ago
parent 83ea7a3918
commit fcf97218ec
  1. 13
      hai-cweb/src/main/java/com/cweb/controller/HighGasController.java
  2. 120
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  3. 21
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  4. 2
      hai-schedule/src/main/resources/dev/application.yml
  5. 3
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  6. 8
      hai-service/src/main/java/com/hai/service/HighGasOilPriceService.java
  7. 14
      hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java
  8. 6
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  9. 11
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl.java
  10. 27
      hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java
  11. 5
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -172,19 +172,18 @@ public class HighGasController {
// {"app_key":"208241666939552","gunNo":"1","refuelingAmount":"1.02","thirdSerialNo":"HF2021062716143174807","sign":"83c7e8f70b984a04b937b28b8652aded","driverPhone":"15583658692","gasId":"CS000116587","priceVip":"7.31","oilNo":"90","timestamp":1624781755439,"priceGun":"7.31"}"
String dataStr = "{\"result\": { \"orderNo\": \"CS00011658721062717132106\"},\"code\": 200, \"message\": \"OK\" }";
Map<String,Object> map = new HashMap<>();
map.put("gasId", "CS000116587");
map.put("oilNo", "90");
map.put("gunNo", 1);
BigDecimal priceGun = new BigDecimal("7.31");
BigDecimal priceVip = new BigDecimal("7.31");
map.put("oilNo", "92");
map.put("gunNo", 2);
BigDecimal priceGun = new BigDecimal("7.50");
BigDecimal priceVip = new BigDecimal("7.50");
// BigDecimal priceGun = new BigDecimal("5.58");
// BigDecimal priceVip = new BigDecimal("5.40");
map.put("priceGun", priceGun); // 枪单价
map.put("priceVip", priceVip); // 优惠价
map.put("driverPhone", "15583658692");
map.put("thirdSerialNo", new Date().getTime());
map.put("driverPhone", "18581170527");
map.put("thirdSerialNo", "HF2021063009483541009");
BigDecimal refuelingAmount = new BigDecimal("1").divide(priceGun,10,BigDecimal.ROUND_DOWN).multiply(priceVip).setScale(2,BigDecimal.ROUND_HALF_UP);
map.put("refuelingAmount", refuelingAmount);
/*JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(map);

@ -47,7 +47,7 @@ public class HighTestController {
@RequestMapping(value = "/initTYMerchantStore", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询订单详情")
@ApiOperation(value = "根据")
public ResponseData initTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) {
try {
@ -64,43 +64,89 @@ public class HighTestController {
for (Object gasObject : jsonArray) {
JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject));
if (object.getInteger("gasStatus") == 1) {
highMerchantStore = new HighMerchantStore();
highMerchantStore.setType(1);
highMerchantStore.setMerchantId(merchant.getId());
highMerchantStore.setCompanyId(merchant.getCompanyId());
highMerchantStore.setStoreKey(object.getString("gasId"));
highMerchantStore.setStoreName(object.getString("gasName"));
highMerchantStore.setStoreLogo(object.getString("gasLogoSmall"));
highMerchantStore.setRegionId(object.getLong("provinceCode"));
highMerchantStore.setRegionName(object.getString("provinceName"));
highMerchantStore.setAddress(object.getString("gasAddress"));
highMerchantStore.setLongitude(object.getString("gasAddressLongitude"));
highMerchantStore.setLatitude(object.getString("gasAddressLatitude"));
highMerchantStore.setStatus(1);
highMerchantStore.setOperatorId(0L);
highMerchantStore.setOperatorName("系统创建");
highMerchantStore.setCreateTime(new Date());
highMerchantStore.setUpdateTime(new Date());
HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel();
BeanUtils.copyProperties(highMerchantStore, merchantStoreModel);
highMerchantStoreService.insertMerchantStore(merchantStoreModel);
JSONArray oilPriceList = object.getJSONArray("oilPriceList");
for (Object oilPrice : oilPriceList) {
JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice));
highGasOilPrice = new HighGasOilPrice();
highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId());
highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo"));
highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName"));
highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip"));
highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun"));
highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial"));
highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType"));
highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName"));
highGasOilPriceService.editGasOilPrice(highGasOilPrice);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId"));
if (store != null) {
store.setType(1);
store.setMerchantId(merchant.getId());
store.setCompanyId(merchant.getCompanyId());
store.setStoreKey(object.getString("gasId"));
store.setStoreName(object.getString("gasName"));
store.setStoreLogo(object.getString("gasLogoSmall"));
store.setRegionId(object.getLong("provinceCode"));
store.setRegionName(object.getString("provinceName"));
store.setAddress(object.getString("gasAddress"));
store.setLongitude(object.getString("gasAddressLongitude"));
store.setLatitude(object.getString("gasAddressLatitude"));
store.setOperatorId(0L);
store.setOperatorName("系统创建");
store.setUpdateTime(new Date());
store.setExt1(object.getString("gasSourceId"));
highMerchantStoreService.updateMerchantStoreDetail(store);
JSONArray oilPriceList = object.getJSONArray("oilPriceList");
for (Object oilPrice : oilPriceList) {
JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice));
// 查询门店油号
highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo"));
if(highGasOilPrice == null) {
highGasOilPrice.setMerchantStoreId(store.getId());
highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo"));
highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName"));
highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip"));
highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun"));
highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial"));
highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType"));
highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName"));
} else {
highGasOilPrice.setMerchantStoreId(store.getId());
highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo"));
highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName"));
highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip"));
highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun"));
highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial"));
highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType"));
highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName"));
}
highGasOilPriceService.editGasOilPrice(highGasOilPrice);
}
} else {
highMerchantStore = new HighMerchantStore();
highMerchantStore.setType(1);
highMerchantStore.setMerchantId(merchant.getId());
highMerchantStore.setCompanyId(merchant.getCompanyId());
highMerchantStore.setStoreKey(object.getString("gasId"));
highMerchantStore.setStoreName(object.getString("gasName"));
highMerchantStore.setStoreLogo(object.getString("gasLogoSmall"));
highMerchantStore.setRegionId(object.getLong("provinceCode"));
highMerchantStore.setRegionName(object.getString("provinceName"));
highMerchantStore.setAddress(object.getString("gasAddress"));
highMerchantStore.setLongitude(object.getString("gasAddressLongitude"));
highMerchantStore.setLatitude(object.getString("gasAddressLatitude"));
highMerchantStore.setStatus(1);
highMerchantStore.setOperatorId(0L);
highMerchantStore.setOperatorName("系统创建");
highMerchantStore.setCreateTime(new Date());
highMerchantStore.setUpdateTime(new Date());
highMerchantStore.setExt1(object.getString("gasSourceId"));
HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel();
BeanUtils.copyProperties(highMerchantStore, merchantStoreModel);
highMerchantStoreService.insertMerchantStore(merchantStoreModel);
JSONArray oilPriceList = object.getJSONArray("oilPriceList");
for (Object oilPrice : oilPriceList) {
JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice));
highGasOilPrice = new HighGasOilPrice();
highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId());
highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo"));
highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName"));
highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip"));
highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun"));
highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial"));
highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType"));
highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName"));
highGasOilPriceService.editGasOilPrice(highGasOilPrice);
}
}
}
}
return ResponseMsgUtil.success(jsonArray);

@ -11,6 +11,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import javax.xml.ws.RespectBinding;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -47,4 +48,24 @@ public class HighOrderSchedule {
}
}
/**
* @Author 胡锐
* @Description 完成团油订单 超过支付时间24小时订单自动完成
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
public void finishGasOrder() {
List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder();
if (mapList != null && mapList.size() > 0) {
for (Map<String,Object> map : mapList) {
HighOrder order = highOrderService.getOrderById(Long.parseLong(map.get("orderId").toString()));
if (order != null) {
order.setOrderStatus(3);
order.setFinishTime(new Date());
highOrderService.updateOrderDetail(order);
}
}
}
}
}

@ -9,7 +9,7 @@ debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource

@ -191,4 +191,7 @@ public interface HighOrderMapperExt {
"</script>"})
List<HighOrderModel> selectGasOrderList(@Param("map") Map<String,Object> map);
@Select({"select a.id orderId,b.id childOrderId from high_order a,high_child_order b where a.id = b.order_id and b.goods_type = 3 and a.order_status = 2 and TIMESTAMPDIFF(MINUTE,a.pay_time,SYSDATE()) > 60*24 GROUP BY b.id"})
List<Map<String,Object>> selectFinishGasOrder();
}

@ -13,6 +13,14 @@ public interface HighGasOilPriceService {
*/
void editGasOilPrice(HighGasOilPrice highGasOilPrice);
/**
* 根据门店和油号查询
* @param storeId
* @param oilNo
* @return
*/
HighGasOilPrice getGasOilPriceByStoreAndOilNo(Long storeId,Integer oilNo);
/**
* 根据门店id 查询
* @param storeId

@ -35,6 +35,13 @@ public interface HighMerchantStoreService {
**/
void updateMerchantStore(HighMerchantStoreModel highMerchantStore) throws Exception;
/**
* 修改门店
* @param highMerchantStore
* @throws Exception
*/
void updateMerchantStoreDetail(HighMerchantStore highMerchantStore) throws Exception;
/**
* @Author 胡锐
* @Description 删除门店
@ -49,6 +56,13 @@ public interface HighMerchantStoreService {
**/
HighMerchantStoreModel getMerchantStoreById(Long id);
/**
* 根据key 查询
* @param storeKey
* @return
*/
HighMerchantStoreModel getMerchantStoreByKey(String storeKey);
/**
* @Author 胡锐
* @Description 查询门店列表

@ -161,4 +161,10 @@ public interface HighOrderService {
**/
Integer countUnusedDiscountByUserId(Long userId , Integer status);
/**
* 查询团油超过支付时间24小时订单
* @return
*/
List<Map<String,Object>> getFinishGasOrder();
}

@ -25,6 +25,17 @@ public class HighGasOilPriceServiceImpl implements HighGasOilPriceService {
}
}
@Override
public HighGasOilPrice getGasOilPriceByStoreAndOilNo(Long storeId, Integer oilNo) {
HighGasOilPriceExample example = new HighGasOilPriceExample();
example.createCriteria().andMerchantStoreIdEqualTo(storeId).andOilNoEqualTo(oilNo);
List<HighGasOilPrice> list = highGasOilPriceMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public HighGasOilPrice getGasOilPriceByStore(Long storeId) {
HighGasOilPriceExample example = new HighGasOilPriceExample();

@ -90,6 +90,11 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService {
}
}
@Override
public void updateMerchantStoreDetail(HighMerchantStore highMerchantStore) throws Exception {
highMerchantStoreMapper.updateByPrimaryKey(highMerchantStore);
}
@Override
@Transactional
public void deleteMerchantStore(Long id) {
@ -127,6 +132,28 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService {
return model;
}
@Override
public HighMerchantStoreModel getMerchantStoreByKey(String storeKey) {
HighMerchantStoreExample example = new HighMerchantStoreExample();
example.createCriteria().andStoreKeyEqualTo(storeKey);
List<HighMerchantStore> list = highMerchantStoreMapper.selectByExample(example);
if (list.size() > 0) {
HighMerchantStore merchantStore = list.get(0);
if (merchantStore == null) {
return null;
}
HighMerchantStoreModel model = new HighMerchantStoreModel();
BeanUtils.copyProperties(merchantStore, model);
// 查询主账号
SecUser mainAccount = secUserService.getMainAccount(3, merchantStore.getId());
if (mainAccount != null) {
model.setSecUser(mainAccount);
}
}
return null;
}
@Override
public List<HighMerchantStore> getMerchantStoreList(Map<String, Object> map) {
HighMerchantStoreExample example = new HighMerchantStoreExample();

@ -495,4 +495,9 @@ public class HighOrderServiceImpl implements HighOrderService {
example.setOrderByClause("create_time desc");
return highDiscountUserRelMapper.selectByExample(example).size();
}
@Override
public List<Map<String, Object>> getFinishGasOrder() {
return highOrderMapper.selectFinishGasOrder();
}
}

Loading…
Cancel
Save