|
@@ -0,0 +1,232 @@
|
|
|
|
+package com.iotechn.unimall.admin.api.tourism.impl;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+import org.apache.ibatis.session.RowBounds;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
|
+import com.iotechn.unimall.core.exception.ServiceException;
|
|
|
|
+import com.iotechn.unimall.data.util.ExcelUtil;
|
|
|
|
+import com.iotechn.unimall.data.mapper.FoodInfoMapper;
|
|
|
|
+import com.iotechn.unimall.data.domain.FoodInfo;
|
|
|
|
+import com.iotechn.unimall.admin.api.tourism.IFoodInfoService;
|
|
|
|
+import com.iotechn.unimall.data.model.Page;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 餐饮入驻信息Service业务层处理
|
|
|
|
+ *
|
|
|
|
+ * @author jlb
|
|
|
|
+ * @date 2023-05-26
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class FoodInfoServiceImpl implements IFoodInfoService{
|
|
|
|
+ @Autowired
|
|
|
|
+ private FoodInfoMapper foodInfoMapper;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean add(FoodInfo foodInfo) throws ServiceException {
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ foodInfo.setGmtCreate(now);
|
|
|
|
+ foodInfo.setGmtUpdate(now);
|
|
|
|
+ return foodInfoMapper.insert(foodInfo)>0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Page<FoodInfo> list(Long commonId,String mainBody,String shopNames,String coverImage,String indoorImage,String province,String city,String area,String location,String detailedAddress,String operater,String operaterPhone,String contacts,String contactsPhone,String label,String businessLicense,String operateCertificate,Date operateCertificateDate,Date startDate,Date endDate,Long lookFlag,String status,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
|
|
|
|
+ Wrapper<FoodInfo> wrapper = new EntityWrapper<FoodInfo>();
|
|
|
|
+ if (!StringUtils.isEmpty(commonId)) {
|
|
|
|
+ wrapper.eq("common_id", commonId);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(mainBody)) {
|
|
|
|
+ wrapper.eq("main_body", mainBody);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(shopNames)) {
|
|
|
|
+ wrapper.eq("shop_names", shopNames);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(coverImage)) {
|
|
|
|
+ wrapper.eq("cover_image", coverImage);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(indoorImage)) {
|
|
|
|
+ wrapper.eq("indoor_image", indoorImage);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(province)) {
|
|
|
|
+ wrapper.eq("province", province);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(city)) {
|
|
|
|
+ wrapper.eq("city", city);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(area)) {
|
|
|
|
+ wrapper.eq("area", area);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(location)) {
|
|
|
|
+ wrapper.eq("location", location);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(detailedAddress)) {
|
|
|
|
+ wrapper.eq("detailed_address", detailedAddress);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(operater)) {
|
|
|
|
+ wrapper.eq("operater", operater);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(operaterPhone)) {
|
|
|
|
+ wrapper.eq("operater_phone", operaterPhone);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(contacts)) {
|
|
|
|
+ wrapper.eq("contacts", contacts);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(contactsPhone)) {
|
|
|
|
+ wrapper.eq("contacts_phone", contactsPhone);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(label)) {
|
|
|
|
+ wrapper.eq("label", label);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(businessLicense)) {
|
|
|
|
+ wrapper.eq("business_license", businessLicense);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(operateCertificate)) {
|
|
|
|
+ wrapper.eq("operate_certificate", operateCertificate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(operateCertificateDate)) {
|
|
|
|
+ wrapper.eq("operate_certificate_date", operateCertificateDate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(startDate)) {
|
|
|
|
+ wrapper.eq("start_date", startDate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(endDate)) {
|
|
|
|
+ wrapper.eq("end_date", endDate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(lookFlag)) {
|
|
|
|
+ wrapper.eq("look_flag", lookFlag);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(status)) {
|
|
|
|
+ wrapper.eq("status", status);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(gmtCreate)) {
|
|
|
|
+ wrapper.eq("gmt_create", gmtCreate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(gmtUpdate)) {
|
|
|
|
+ wrapper.eq("gmt_update", gmtUpdate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(deleteFlag)) {
|
|
|
|
+ wrapper.eq("delete_flag", deleteFlag);
|
|
|
|
+ }
|
|
|
|
+ wrapper.eq("delete_flag", 0);
|
|
|
|
+ List<FoodInfo> list = foodInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
|
|
+ Integer count = foodInfoMapper.selectCount(wrapper);
|
|
|
|
+ return new Page<FoodInfo>(list, page, limit, count);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public Boolean delete(String id) {
|
|
|
|
+ String[] ids = String.valueOf(id).split(",");
|
|
|
|
+ for (String tt:ids) {
|
|
|
|
+ FoodInfo tmp = foodInfoMapper.selectById(Long.parseLong(tt));
|
|
|
|
+ if(tmp != null){
|
|
|
|
+ tmp.setDeleteFlag(1l);
|
|
|
|
+ foodInfoMapper.updateById(tmp);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean update(FoodInfo foodInfo) throws ServiceException {
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ foodInfo.setGmtUpdate(now);
|
|
|
|
+ return foodInfoMapper.updateById(foodInfo)>0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public FoodInfo get(Long id) throws ServiceException {
|
|
|
|
+ return foodInfoMapper.selectById(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String export(Long commonId,String mainBody,String shopNames,String coverImage,String indoorImage,String province,String city,String area,String location,String detailedAddress,String operater,String operaterPhone,String contacts,String contactsPhone,String label,String businessLicense,String operateCertificate,Date operateCertificateDate,Date startDate,Date endDate,Long lookFlag,String status,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
|
|
|
|
+ Wrapper<FoodInfo> wrapper = new EntityWrapper<FoodInfo>();
|
|
|
|
+ if (!StringUtils.isEmpty(commonId)) {
|
|
|
|
+ wrapper.eq("common_id", commonId);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(mainBody)) {
|
|
|
|
+ wrapper.eq("main_body", mainBody);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(shopNames)) {
|
|
|
|
+ wrapper.eq("shop_names", shopNames);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(coverImage)) {
|
|
|
|
+ wrapper.eq("cover_image", coverImage);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(indoorImage)) {
|
|
|
|
+ wrapper.eq("indoor_image", indoorImage);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(province)) {
|
|
|
|
+ wrapper.eq("province", province);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(city)) {
|
|
|
|
+ wrapper.eq("city", city);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(area)) {
|
|
|
|
+ wrapper.eq("area", area);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(location)) {
|
|
|
|
+ wrapper.eq("location", location);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(detailedAddress)) {
|
|
|
|
+ wrapper.eq("detailed_address", detailedAddress);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(operater)) {
|
|
|
|
+ wrapper.eq("operater", operater);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(operaterPhone)) {
|
|
|
|
+ wrapper.eq("operater_phone", operaterPhone);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(contacts)) {
|
|
|
|
+ wrapper.eq("contacts", contacts);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(contactsPhone)) {
|
|
|
|
+ wrapper.eq("contacts_phone", contactsPhone);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(label)) {
|
|
|
|
+ wrapper.eq("label", label);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(businessLicense)) {
|
|
|
|
+ wrapper.eq("business_license", businessLicense);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(operateCertificate)) {
|
|
|
|
+ wrapper.eq("operate_certificate", operateCertificate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(operateCertificateDate)) {
|
|
|
|
+ wrapper.eq("operate_certificate_date", operateCertificateDate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(startDate)) {
|
|
|
|
+ wrapper.eq("start_date", startDate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(endDate)) {
|
|
|
|
+ wrapper.eq("end_date", endDate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(lookFlag)) {
|
|
|
|
+ wrapper.eq("look_flag", lookFlag);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(status)) {
|
|
|
|
+ wrapper.eq("status", status);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(gmtCreate)) {
|
|
|
|
+ wrapper.eq("gmt_create", gmtCreate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(gmtUpdate)) {
|
|
|
|
+ wrapper.eq("gmt_update", gmtUpdate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(deleteFlag)) {
|
|
|
|
+ wrapper.eq("delete_flag", deleteFlag);
|
|
|
|
+ }
|
|
|
|
+ List<FoodInfo> list = foodInfoMapper.selectList(wrapper);
|
|
|
|
+ ExcelUtil<FoodInfo> util = new ExcelUtil<FoodInfo>(FoodInfo.class);
|
|
|
|
+ return util.exportExcel(list, "操作日志");
|
|
|
|
+ }
|
|
|
|
+}
|