parent
abde8252ed
commit
2980280f1c
@ -0,0 +1,16 @@ |
||||
package com.hai.config; |
||||
|
||||
import org.springframework.stereotype.Component; |
||||
|
||||
/** |
||||
* @serviceName .java |
||||
* @author Sum1Dream |
||||
* @version 1.0.0 |
||||
* @Description // 四川中石油
|
||||
* @createTime 18:33 2023/11/13 |
||||
**/ |
||||
@Component |
||||
public class ScPetroConfig { |
||||
|
||||
|
||||
} |
@ -0,0 +1,108 @@ |
||||
package com.hai.group; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hai.entity.ApiIpAddress; |
||||
import com.hai.entity.HighGroupCode; |
||||
import com.hai.entity.HighGroupOrder; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface GroupCodeService { |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name insertGroupCode |
||||
* @Description // 新增
|
||||
* @Date 14:32 2023/11/10 |
||||
* @Param highGroupCode |
||||
* @return void |
||||
*/ |
||||
void insertGroupCode(HighGroupCode highGroupCode); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name updateGroupCode |
||||
* @Description // 编辑
|
||||
* @Date 14:32 2023/11/10 |
||||
* @Param highGroupCode |
||||
* @return void |
||||
*/ |
||||
void updateGroupCode(HighGroupCode highGroupCode); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name findGroupCode |
||||
* @Description // 根据id查询
|
||||
* @Date 14:32 2023/11/10 |
||||
* @Param id |
||||
* @return com.hai.entity.HighGroupCode |
||||
*/ |
||||
HighGroupCode findGroupCode(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name findGroupCode |
||||
* @Description // 查询
|
||||
* @Date 14:32 2023/11/10 |
||||
* @Param map |
||||
* @return com.hai.entity.HighGroupCode |
||||
*/ |
||||
HighGroupCode findGroupCode(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name findGroupCodeList |
||||
* @Description // 查询列表
|
||||
* @Date 14:32 2023/11/10 |
||||
* @Param map |
||||
* @return java.util.List<com.hai.entity.HighGroupCode> |
||||
*/ |
||||
List<HighGroupCode> findGroupCodeList(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name generateCode |
||||
* @Description // 生成code
|
||||
* @Date 14:41 2023/11/10 |
||||
* @Param object |
||||
* @return void |
||||
*/ |
||||
HighGroupCode generateCode(Long userId , Long storeId , Long orderId , Long groupId); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name insertGroupOrder |
||||
* @Description // 新增团购订单
|
||||
* @Date 14:54 2023/11/13 |
||||
* @Param highGroupOrder |
||||
* @return void |
||||
*/ |
||||
void insertGroupOrder(HighGroupOrder highGroupOrder); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name updateGroupOrder |
||||
* @Description // 更新团购订单
|
||||
* @Date 14:55 2023/11/13 |
||||
* @Param highGroupOrder |
||||
* @return void |
||||
*/ |
||||
void updateGroupOrder(HighGroupOrder highGroupOrder); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name findGroupOrder |
||||
* @Description // 查询团购订单
|
||||
* @Date 14:55 2023/11/13 |
||||
* @Param groupId |
||||
* @return com.hai.entity.HighGroupOrder |
||||
*/ |
||||
HighGroupOrder findGroupOrder(Long groupId); |
||||
|
||||
HighGroupOrder findGroupOrder(String orderNo); |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,166 @@ |
||||
package com.hai.group.impl; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hai.common.GenerateCode; |
||||
import com.hai.common.QRCodeGenerator; |
||||
import com.hai.common.utils.DateUtil; |
||||
import com.hai.common.utils.IDGenerator; |
||||
import com.hai.config.CommonSysConst; |
||||
import com.hai.dao.HighGroupCodeMapper; |
||||
import com.hai.dao.HighGroupOrderMapper; |
||||
import com.hai.entity.HighGroupCode; |
||||
import com.hai.entity.HighGroupCodeExample; |
||||
import com.hai.entity.HighGroupOrder; |
||||
import com.hai.entity.HighGroupOrderExample; |
||||
import com.hai.group.GroupCodeService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("groupCodeService") |
||||
public class GroupCodeServiceImpl implements GroupCodeService { |
||||
|
||||
@Resource |
||||
private HighGroupCodeMapper highGroupCodeMapper; |
||||
|
||||
@Resource |
||||
private HighGroupOrderMapper highGroupOrderMapper; |
||||
|
||||
@Override |
||||
public void insertGroupCode(HighGroupCode highGroupCode) { |
||||
highGroupCodeMapper.insert(highGroupCode); |
||||
} |
||||
|
||||
@Override |
||||
public void updateGroupCode(HighGroupCode highGroupCode) { |
||||
highGroupCodeMapper.updateByPrimaryKey(highGroupCode); |
||||
} |
||||
|
||||
@Override |
||||
public HighGroupCode findGroupCode(Long id) { |
||||
return highGroupCodeMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public HighGroupCode findGroupCode(Map<String , Object> map) { |
||||
HighGroupCodeExample example = new HighGroupCodeExample(); |
||||
HighGroupCodeExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
|
||||
if (MapUtils.getString(map, "groupCode") != null) { |
||||
criteria.andGroupCodeEqualTo(MapUtils.getString(map, "groupCode")); |
||||
} |
||||
if (MapUtils.getLong(map, "userId") != null) { |
||||
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); |
||||
} |
||||
if (MapUtils.getLong(map, "storeId") != null) { |
||||
criteria.andSroreIdEqualTo(MapUtils.getLong(map, "storeId")); |
||||
} |
||||
|
||||
|
||||
List<HighGroupCode> list = highGroupCodeMapper.selectByExample(example); |
||||
|
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<HighGroupCode> findGroupCodeList(Map<String, Object> map) { |
||||
HighGroupCodeExample example = new HighGroupCodeExample(); |
||||
HighGroupCodeExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
|
||||
if (MapUtils.getString(map, "groupCode") != null) { |
||||
criteria.andGroupCodeEqualTo(MapUtils.getString(map, "groupCode")); |
||||
} |
||||
if (MapUtils.getLong(map, "userId") != null) { |
||||
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); |
||||
} |
||||
if (MapUtils.getLong(map, "storeId") != null) { |
||||
criteria.andSroreIdEqualTo(MapUtils.getLong(map, "storeId")); |
||||
} |
||||
|
||||
return highGroupCodeMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public HighGroupCode generateCode(Long userId, Long storeId, Long orderId, Long groupId) { |
||||
|
||||
try { |
||||
|
||||
HighGroupCode highGroupCode = new HighGroupCode(); |
||||
|
||||
highGroupCode.setGroupId(groupId); |
||||
highGroupCode.setCreateTime(new Date()); |
||||
highGroupCode.setOrderId(orderId); |
||||
highGroupCode.setSroreId(storeId); |
||||
highGroupCode.setUpdateTime(new Date()); |
||||
highGroupCode.setUserId(userId); |
||||
highGroupCode.setStatus(1); |
||||
insertGroupCode(highGroupCode); |
||||
highGroupCode.setGroupCode(GenerateCode.convertCode(highGroupCode.getId() , 16)); |
||||
|
||||
// 生成二维码
|
||||
String qrCodeImg = highGroupCode.getGroupCode() +".png"; |
||||
String qrCodeUrl = CommonSysConst.getSysConfig().getFileUrl() + "/groupCode/" + qrCodeImg; |
||||
QRCodeGenerator.generateQRCodeImage(highGroupCode.getGroupCode(), 350, 350, qrCodeUrl); |
||||
highGroupCode.setCodeImgUrl(qrCodeUrl); |
||||
|
||||
updateGroupCode(highGroupCode); |
||||
|
||||
return highGroupCode; |
||||
} catch (Exception e) { |
||||
return null; |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void insertGroupOrder(HighGroupOrder highGroupOrder) { |
||||
highGroupOrderMapper.insert(highGroupOrder); |
||||
} |
||||
|
||||
@Override |
||||
public void updateGroupOrder(HighGroupOrder highGroupOrder) { |
||||
highGroupOrderMapper.updateByPrimaryKey(highGroupOrder); |
||||
} |
||||
|
||||
@Override |
||||
public HighGroupOrder findGroupOrder(Long groupId) { |
||||
HighGroupOrderExample example = new HighGroupOrderExample(); |
||||
HighGroupOrderExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
criteria.andGroupIdEqualTo(groupId); |
||||
|
||||
List<HighGroupOrder> list = highGroupOrderMapper.selectByExample(example); |
||||
|
||||
if (!list.isEmpty()) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public HighGroupOrder findGroupOrder(String orderNo) { |
||||
HighGroupOrderExample example = new HighGroupOrderExample(); |
||||
HighGroupOrderExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
criteria.andOrderNoEqualTo(orderNo); |
||||
|
||||
List<HighGroupOrder> list = highGroupOrderMapper.selectByExample(example); |
||||
|
||||
if (!list.isEmpty()) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue