Merge remote-tracking branch 'origin/div' into div
| | |
| | | package com.yeshi.fanli.controller.admin.shop;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.MultipartHttpServletRequest;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private BanLiShopGoodsService banLiShopGoodsService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsClassService banLiShopGoodsClassService;
|
| | |
|
| | | /**
|
| | | * 保存信息
|
| | | *
|
| | |
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, BanLiShopGoods record, HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | String picture = null;
|
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | MultipartFile file = fileRequest.getFile("file");
|
| | | if (file != null)
|
| | | picture = uploadPicture(file);
|
| | | banLiShopGoodsService.saveObject(fileRequest.getFile("file"),fileRequest.getFile("file2"), record);
|
| | | } else {
|
| | | banLiShopGoodsService.saveObject(null, null,record);
|
| | | }
|
| | | record.setPicture(picture);
|
| | | banLiShopGoodsService.addGoods(record);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (BanLiShopGoodsException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (BanLiShopGoodsSetException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (BanLiShopGoodsSetPayException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 上传图片
|
| | | * |
| | | * @param file
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public String uploadPicture(MultipartFile file) throws BanLiShopGoodsException {
|
| | | // 文件解析
|
| | | InputStream inputStream;
|
| | | try {
|
| | | inputStream = file.getInputStream();
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | throw new BanLiShopGoodsException(1, "图片获取失败");
|
| | | }
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 文件路径
|
| | | String filePath = "/img/HomeNavbar/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | return COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | for (BanLiShopGoods shopGoods: list) {
|
| | | BanLiShopGoodsClass goodsClass = shopGoods.getGoodsClass();
|
| | | if (goodsClass != null) {
|
| | | shopGoods.setGoodsClass(banLiShopGoodsClassService.selectByPrimaryKey(goodsClass.getId()));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | long count = banLiShopGoodsService.countGoods(key, state);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private BanLiShopGoodsSetService banLiShopGoodsSetService;
|
| | |
|
| | | |
| | | /**
|
| | | * 保存信息
|
| | | * |
| | | * @param callback
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, BanLiShopGoodsSets record, HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | banLiShopGoodsSetService.saveObject(record);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (BanLiShopGoodsSetException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) {
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Long goodsId, PrintWriter out) {
|
| | | try {
|
| | | if (pageIndex == null || pageIndex < 1)
|
| | | pageIndex = 1;
|
| | |
| | | if (pageSize == null || pageSize < 1)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<BanLiShopGoodsSets> list = banLiShopGoodsSetService.listQuery(pageIndex, pageSize, key);
|
| | | List<BanLiShopGoodsSets> list = banLiShopGoodsSetService.listQuery(pageIndex, pageSize, key, goodsId);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = banLiShopGoodsSetService.countQuery(key);
|
| | | long count = banLiShopGoodsSetService.countQuery(key, goodsId);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetPayService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsSetPayService banLiShopGoodsSetPayService;
|
| | | |
| | | @Resource
|
| | | private BanLiShopGoodsSetService banLiShopGoodsSetService;
|
| | | |
| | | |
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, BanLiShopGoodsSetsPay record, HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | banLiShopGoodsSetPayService.saveObject(record);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (BanLiShopGoodsSetPayException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer payType, PrintWriter out) {
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, Long setId, String key, Integer payType, PrintWriter out) {
|
| | | try {
|
| | | if (pageIndex == null || pageIndex < 1)
|
| | | pageIndex = 1;
|
| | |
| | | if (pageSize == null || pageSize < 1)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<BanLiShopGoodsSetsPay> list = banLiShopGoodsSetPayService.listQuery(pageIndex, pageSize, key, payType);
|
| | | List<BanLiShopGoodsSetsPay> list = banLiShopGoodsSetPayService.listQuery(pageIndex, pageSize, key, payType, setId);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = banLiShopGoodsSetPayService.countQuery(key, payType);
|
| | | for (BanLiShopGoodsSetsPay setsPay: list) {
|
| | | BanLiShopGoodsSets goodsSet = setsPay.getGoodsSet();
|
| | | if (goodsSet != null) {
|
| | | setsPay.setGoodsSet(banLiShopGoodsSetService.selectByPrimaryKey(goodsSet.getId()));
|
| | | }
|
| | | }
|
| | | |
| | | long count = banLiShopGoodsSetPayService.countQuery(key, payType, setId);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<BanLiShopGoodsSets> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key);
|
| | | List<BanLiShopGoodsSets> listQuery(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key, @Param("goodsId")Long goodsId);
|
| | |
|
| | | /**
|
| | | * 计数
|
| | |
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | long countQuery(@Param("key") String key);
|
| | | long countQuery(@Param("key") String key, @Param("goodsId")Long goodsId);
|
| | | } |
| | |
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<BanLiShopGoodsSetsPay> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key, @Param("payType") Integer payType);
|
| | | List<BanLiShopGoodsSetsPay> listQuery(@Param("start") long start, @Param("count") int count,
|
| | | @Param("key") String key, @Param("payType") Integer payType, @Param("setId")Long setId);
|
| | |
|
| | | /**
|
| | | * 计数
|
| | |
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | long countQuery(@Param("key") String key, @Param("payType") Integer payType);
|
| | | long countQuery(@Param("key") String key, @Param("payType") Integer payType, @Param("setId")Long setId);
|
| | |
|
| | | } |
| | |
| | | <select id="listQuery" resultMap="BaseResultMap">
|
| | | select <include refid="Base_Column_List" /> from yeshi_ec_shop_goods_set
|
| | | where sgs_name like '${key}%'
|
| | | <if test="goodsId != null">AND sgs_goods_id = #{goodsId}</if>
|
| | | order by sgs_weight desc
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | | <select id="countQuery" resultType="java.lang.Long">
|
| | | select count(sgs_id) from yeshi_ec_shop_goods_set
|
| | | where sgs_name like '${key}%'
|
| | | where sgs_name like '${key}%' <if test="goodsId != null">AND sgs_goods_id = #{goodsId}</if>
|
| | | </select>
|
| | |
|
| | |
|
| | |
| | | <if test="payType != null">
|
| | | and sp_pay_type=#{payType}
|
| | | </if>
|
| | | <if test="setId != null">
|
| | | and sp_goods_set_id = #{setId}
|
| | | </if>
|
| | | order by sp_weight desc
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | |
| | | <if test="payType != null">
|
| | | and sp_pay_type=#{payType}
|
| | | </if>
|
| | | <if test="setId != null">
|
| | | and sp_goods_set_id = #{setId}
|
| | | </if>
|
| | | </select>
|
| | |
|
| | |
|
| | |
| | |
|
| | | BrandShopCahe brandShop = new BrandShopCahe();
|
| | | brandShop.setBrandId(brandInfo.getId());
|
| | | brandShop.setShop(ShopInfoVOFactory.convertTaoBaoShop(taoBaoShop));
|
| | | brandShop.setShop(shopInfoVO);
|
| | | brandShop.setCreateTime(new Date());
|
| | | brandShopCaheDao.insert(brandShop);
|
| | | return false;
|
| | |
| | | package com.yeshi.fanli.service.impl.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.user.UserMoneyExtraMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
|
| | | @Service
|
| | | public class UserMoneyExtraServiceImpl implements UserMoneyExtraService {
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public void listValid(int page, int count) {
|
| | | userMoneyExtraMapper.listValid((page-1) * count, count);
|
| | | public List<UserMoneyExtra> listValid(int page, int count) {
|
| | | return userMoneyExtraMapper.listValid((page-1) * count, count);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.money.msg.MsgMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | |
| | | System.out.println("1-insertSelective执行数据。。。。。。。。。。" + detail.getId());
|
| | | LogHelper.test("1-insertSelective执行数据。。。。。。。。。。" + detail.getId());
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.subSidy) {
|
| | | if (detail.getMoney() == null || detail.getUser() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | |
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | }
|
| | |
|
| | | userMsgReadStateService.addMoneyMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | System.out.println("1-insertSelective执行数据完成。。。。。。。。。。");
|
| | | LogHelper.test("2-insertSelective执行数据。。。。。。。。。。" + detail.getId());
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackBalance;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackExchange;
|
| | |
| | |
|
| | | String extractBanlenMin = redPackConfigService.getValueByKey("extract_banlen_min");
|
| | |
|
| | | BigDecimal balance = redPackBalanceService.getBalance(uid);
|
| | | if (balance == null || balance.compareTo(new BigDecimal(extractBanlenMin)) < 0)
|
| | | RedPackBalance balance = redPackBalanceService.selectByPrimaryKey(uid);
|
| | | if (balance == null)
|
| | | throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
|
| | |
|
| | | if (balance.compareTo(amount) < 0)
|
| | | if (balance.getState() != null && balance.getState() == RedPackBalance.STATE_LOCKED) |
| | | throw new RedPackExchangeException(1, "红包已封禁,感谢使用");
|
| | | |
| | | BigDecimal balanceMoney = balance.getMoney();
|
| | | if (balanceMoney == null || balanceMoney.compareTo(new BigDecimal(extractBanlenMin)) < 0)
|
| | | throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
|
| | | |
| | | if (balanceMoney.compareTo(amount) < 0)
|
| | | throw new RedPackExchangeException(1, "提现余额不足");
|
| | |
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord.TokenTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackBalance;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
|
| | |
| | | if (amount.compareTo(new BigDecimal(giveMin)) < 0 || amount.compareTo(new BigDecimal(giveMax)) > 0)
|
| | | throw new RedPackGiveRecordException(1, "赠送金额至少" + giveMin + "元至多" + giveMax + "元");
|
| | |
|
| | | BigDecimal balance = redPackBalanceService.getBalance(uid);
|
| | | if (balance == null || amount.compareTo(balance) > 0)
|
| | | RedPackBalance balance = redPackBalanceService.selectByPrimaryKey(uid);
|
| | | if (balance == null)
|
| | | throw new RedPackGiveRecordException(1, "余额不足");
|
| | |
|
| | | if (balance.getState() != null && balance.getState() == RedPackBalance.STATE_LOCKED) |
| | | throw new RedPackGiveRecordException(1, "红包已封禁,感谢使用");
|
| | | |
| | | if (balance.getMoney() == null || amount.compareTo(balance.getMoney()) > 0)
|
| | | throw new RedPackGiveRecordException(1, "余额不足");
|
| | | |
| | |
|
| | | Date nowDate = new Date();
|
| | | // 赠送记录
|
| | | RedPackGiveRecord giveRecord = new RedPackGiveRecord();
|
| | |
| | | package com.yeshi.fanli.service.impl.shop;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsMapper;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void saveObject(MultipartFile file, MultipartFile file2, BanLiShopGoods record) throws BanLiShopGoodsException, Exception{
|
| | | if (record.getGoodsClass() == null || record.getGoodsClass().getId() == null)
|
| | | throw new BanLiShopGoodsException(1, "请指定商品分类");
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(record.getTitle()))
|
| | | throw new BanLiShopGoodsException(1, "缺少标题");
|
| | |
|
| | | if (file != null)
|
| | | record.setPicture(uploadPicture(file));
|
| | | |
| | | if (file2 != null)
|
| | | record.setSquarePicture(uploadPicture(file2));
|
| | | |
| | | if (record.getState() == null)
|
| | | record.setState(BanLiShopGoods.STATE_ONLINE);
|
| | | |
| | | if (record.getSalesCount() == null)
|
| | | record.setSalesCount(0L);
|
| | | |
| | | record.setUpdateTime(new Date());
|
| | | |
| | | if (record.getId() == null) {
|
| | | if (StringUtil.isNullOrEmpty(record.getPicture()))
|
| | | throw new BanLiShopGoodsException(1, "缺少封面图");
|
| | | |
| | | record.setCreateTime(new Date());
|
| | | banLiShopGoodsMapper.insertSelective(record);
|
| | | } else {
|
| | | BanLiShopGoods resultObj = banLiShopGoodsMapper.selectDetailByPrimaryKey(record.getId());
|
| | | if (resultObj == null)
|
| | | throw new BanLiShopGoodsException(1, "修改内容已不存在");
|
| | | |
| | | if (StringUtil.isNullOrEmpty(record.getPicture())) {
|
| | | record.setPicture(resultObj.getPicture());
|
| | | } else {
|
| | | removePicture(resultObj.getPicture());
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(record.getSquarePicture())) {
|
| | | record.setSquarePicture(resultObj.getSquarePicture());
|
| | | } else {
|
| | | removePicture(resultObj.getSquarePicture());
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(record.getPicture()))
|
| | | throw new BanLiShopGoodsException(1, "缺少封面图");
|
| | | |
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | banLiShopGoodsMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 上传图片
|
| | | * @param file
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public String uploadPicture(MultipartFile file) throws Exception {
|
| | | // 文件解析 |
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 文件路径
|
| | | String filePath="/img/BanLiShopGoods/"+UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | return fileLink;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除图片-不更新数据库
|
| | | * @param record
|
| | | * @throws Exception
|
| | | */
|
| | | public void removePicture(String picture) throws Exception {
|
| | | if (picture != null && picture.trim().length() > 0) {
|
| | | COSManager.getInstance().deleteFile(picture);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoods goods) {
|
| | | if (goods == null || goods.getId() == null)
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void saveObject(BanLiShopGoodsSetsPay record) throws BanLiShopGoodsSetPayException {
|
| | | // 判断参数是否齐全
|
| | | if (record.getGoodsSet() == null || record.getGoodsSet().getId() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "套餐不存在");
|
| | |
|
| | | if (record.getPayType() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定支付方式");
|
| | |
|
| | | if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO) {
|
| | | if (record.getHongBaoPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定红包支付价格");
|
| | | } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_BALANCE) {
|
| | | if (record.getBalancePrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定余额支付价格");
|
| | | } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO_MONEY) {
|
| | | if (record.getHongBaoPrice() == null || record.getMoneyPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定红包、现金支付价格");
|
| | | } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_MONEY) {
|
| | | if (record.getMoneyPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定现金支付价格");
|
| | | }
|
| | |
|
| | | record.setUpdateTime(new Date());
|
| | | if (record.getId() == null) {
|
| | | record.setCreateTime(new Date());
|
| | | banLiShopGoodsSetsPayMapper.insertSelective(record);
|
| | |
|
| | | if (record.getWeight() == null) {// 权重更新
|
| | | BanLiShopGoodsSetsPay update = new BanLiShopGoodsSetsPay();
|
| | | update.setId(record.getId());
|
| | | update.setWeight((int) record.getId().longValue());
|
| | | banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | } else {
|
| | | BanLiShopGoodsSetsPay resultObj = banLiShopGoodsSetsPayMapper.selectByPrimaryKey(record.getId());
|
| | | if (resultObj == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "修改内容已不存在");
|
| | | |
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | banLiShopGoodsSetsPayMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsSetsPay pay) {
|
| | | if (pay.getId() == null)
|
| | | return;
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopGoodsSetsPay> listQuery(int page, int pageSize, String key, Integer payType) {
|
| | | return banLiShopGoodsSetsPayMapper.listQuery((page - 1) * pageSize, pageSize, key, payType);
|
| | | public List<BanLiShopGoodsSetsPay> listQuery(int page, int pageSize, String key, Integer payType, Long setId) {
|
| | | return banLiShopGoodsSetsPayMapper.listQuery((page - 1) * pageSize, pageSize, key, payType, setId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countQuery(String key, Integer payType) {
|
| | | return banLiShopGoodsSetsPayMapper.countQuery(key, payType);
|
| | | public long countQuery(String key, Integer payType, Long setId) {
|
| | | return banLiShopGoodsSetsPayMapper.countQuery(key, payType, setId);
|
| | | }
|
| | |
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void saveObject(BanLiShopGoodsSets record) throws BanLiShopGoodsSetException {
|
| | | if (record.getGoods() == null || record.getGoods().getId() == null)
|
| | | throw new BanLiShopGoodsSetException(1, "请指定商品");
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(record.getName()))
|
| | | throw new BanLiShopGoodsSetException(1, "缺少套餐名字");
|
| | |
|
| | | if (record.getOriginalPrice() == null || record.getZkPrice() == null)
|
| | | throw new BanLiShopGoodsSetException(1, "价格信息不完整");
|
| | |
|
| | | if (record.getStock() == null)
|
| | | throw new BanLiShopGoodsSetException(1, "缺少库存信息");
|
| | |
|
| | | record.setUpdateTime(new Date());
|
| | | if (record.getId() == null) {
|
| | | record.setCreateTime(new Date());
|
| | | banLiShopGoodsSetsMapper.insertSelective(record);
|
| | | |
| | | if (record.getWeight() == null) {// 权重更新
|
| | | BanLiShopGoodsSets update = new BanLiShopGoodsSets();
|
| | | update.setId(record.getId());
|
| | | update.setWeight((int) record.getId().longValue());
|
| | | banLiShopGoodsSetsMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | } else {
|
| | | BanLiShopGoodsSets resultObj = banLiShopGoodsSetsMapper.selectDetailByPrimaryKey(record.getId());
|
| | | if (resultObj == null)
|
| | | throw new BanLiShopGoodsSetException(1, "修改内容已不存在");
|
| | | |
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | banLiShopGoodsSetsMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | |
|
| | | @Override
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsSets set) {
|
| | | if (set.getId() == null)
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopGoodsSets> listQuery(int page, int pageSize, String key) {
|
| | | return banLiShopGoodsSetsMapper.listQuery((page - 1) * pageSize, pageSize, key);
|
| | | public List<BanLiShopGoodsSets> listQuery(int page, int pageSize, String key, Long goodsId) {
|
| | | return banLiShopGoodsSetsMapper.listQuery((page - 1) * pageSize, pageSize, key, goodsId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countQuery(String key) {
|
| | | return banLiShopGoodsSetsMapper.countQuery(key);
|
| | | public long countQuery(String key, Long goodsId) {
|
| | | return banLiShopGoodsSetsMapper.countQuery(key, goodsId);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | MsgOtherRewardIntegralDTO msgOther = new MsgOtherRewardIntegralDTO();
|
| | | msgOther.setTitle("推广红包");
|
| | | msgOther.setTotal("推广红包¥" + tlj.setScale(2));
|
| | | msgOther.setNum(goldCoin + "枚");
|
| | | msgOther.setNum(addGoldCoin + "枚");
|
| | | msgOther.setSource("已进入到可用金币中");
|
| | | msgOther.setExplain("原推广红包功能下线,剩余推广红包按照10:1折算为金币 ");
|
| | | userOtherMsgNotificationService.taoLiJinExchangeMsg(uid, "本折算有且仅有一次", msgOther);
|
| | |
| | | package com.yeshi.fanli.service.inter.money;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | |
|
| | | public interface UserMoneyExtraService {
|
| | |
| | | public void updateByPrimaryKeySelective(UserMoneyExtra record);
|
| | |
|
| | |
|
| | | public void listValid(int page, int count);
|
| | | /**
|
| | | * 获取有效金币用户
|
| | | * @param page
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<UserMoneyExtra> listValid(int page, int count);
|
| | | }
|
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
|
| | |
| | | */
|
| | | public void addSalesCount(Long id,int count);
|
| | |
|
| | | /**
|
| | | * 后台维护
|
| | | * @param file
|
| | | * @param file2
|
| | | * @param record
|
| | | * @throws BanLiShopGoodsSetException
|
| | | * @throws Exception
|
| | | */
|
| | | public void saveObject(MultipartFile file, MultipartFile file2, BanLiShopGoods record)
|
| | | throws BanLiShopGoodsException, Exception;
|
| | | |
| | |
|
| | | }
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | |
|
| | | /**
|
| | |
| | | * @param payType
|
| | | * @return
|
| | | */
|
| | | public List<BanLiShopGoodsSetsPay> listQuery(int page, int pageSize, String key, Integer payType);
|
| | | public List<BanLiShopGoodsSetsPay> listQuery(int page, int pageSize, String key, Integer payType, Long setId);
|
| | |
|
| | | public long countQuery(String key, Integer payType);
|
| | | public long countQuery(String key, Integer payType, Long setId);
|
| | |
|
| | | /**
|
| | | * 后台编辑
|
| | | * @param record
|
| | | * @throws BanLiShopGoodsSetException
|
| | | */
|
| | | public void saveObject(BanLiShopGoodsSetsPay record) throws BanLiShopGoodsSetPayException;
|
| | |
|
| | | }
|
| | |
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public List<BanLiShopGoodsSets> listQuery(int page, int pageSize, String key);
|
| | | public List<BanLiShopGoodsSets> listQuery(int page, int pageSize, String key, Long goodsId);
|
| | |
|
| | | public long countQuery(String key);
|
| | | public long countQuery(String key, Long goodsId);
|
| | |
|
| | | /**
|
| | | * 销量增加
|
| | |
| | | */
|
| | | public void addSalesCount(Long id,int count);
|
| | |
|
| | | /**
|
| | | * 后台编辑
|
| | | * @param record
|
| | | * @throws BanLiShopGoodsSetException
|
| | | */
|
| | | public void saveObject(BanLiShopGoodsSets record) throws BanLiShopGoodsSetException;
|
| | |
|
| | | }
|
| | |
| | | userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
|
| | | userMsgVO.setContentItems(items);
|
| | | return userMsgVO;
|
| | | } else if (msg.getType() == MsgTypeOtherTypeEnum.taoLiJinExchange) {
|
| | | if (StringUtil.isNullOrEmpty(msg.getContent()))
|
| | | return null;
|
| | |
|
| | | MsgOtherRewardIntegralDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherRewardIntegralDTO.class);
|
| | | if (dto == null)
|
| | | return null;
|
| | |
|
| | | icon = "http://img.flqapp.com/resource/msg/icon_msg_other_system_give.png";
|
| | |
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getExplain())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getExplain() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("原因", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (dto.getTotal() != null) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getTotal(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("可则算额", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getNum())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getNum() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("折算金币", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getSource())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getSource(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | UserMsgVO userMsgVO = new UserMsgVO();
|
| | | userMsgVO.setIcon(icon);
|
| | | userMsgVO.setTitle(dto.getTitle());
|
| | | userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
|
| | | userMsgVO.setContentItems(items);
|
| | | return userMsgVO;
|
| | | }
|
| | |
|
| | | return new UserMsgVO(icon, msg.getType().getDesc(),
|