remove monitor 增加充值管理 修复拼团等轮播不能修改的问题
This commit is contained in:
@ -0,0 +1,64 @@
|
||||
package co.yixiang.modules.shop.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-03-02
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="yx_user_recharge")
|
||||
public class YxUserRecharge implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
/** 充值用户UID */
|
||||
@Column(name = "uid")
|
||||
private Integer uid;
|
||||
|
||||
/** 订单号 */
|
||||
@Column(name = "order_id",unique = true)
|
||||
private String orderId;
|
||||
|
||||
/** 充值金额 */
|
||||
@Column(name = "price")
|
||||
private BigDecimal price;
|
||||
|
||||
/** 充值类型 */
|
||||
@Column(name = "recharge_type")
|
||||
private String rechargeType;
|
||||
|
||||
/** 是否充值 */
|
||||
@Column(name = "paid")
|
||||
private Integer paid;
|
||||
|
||||
/** 充值支付时间 */
|
||||
@Column(name = "pay_time")
|
||||
private Integer payTime;
|
||||
|
||||
/** 充值时间 */
|
||||
@Column(name = "add_time")
|
||||
private Integer addTime;
|
||||
|
||||
/** 退款金额 */
|
||||
@Column(name = "refund_price")
|
||||
private BigDecimal refundPrice;
|
||||
|
||||
/** 昵称 */
|
||||
@Column(name = "nickname")
|
||||
private String nickname;
|
||||
|
||||
public void copy(YxUserRecharge source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.modules.shop.repository;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxUserRecharge;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-03-02
|
||||
*/
|
||||
public interface YxUserRechargeRepository extends JpaRepository<YxUserRecharge, Integer>, JpaSpecificationExecutor<YxUserRecharge> {
|
||||
/**
|
||||
* 根据 OrderId 查询
|
||||
* @param order_id /
|
||||
* @return /
|
||||
*/
|
||||
YxUserRecharge findByOrderId(String order_id);
|
||||
}
|
@ -20,6 +20,7 @@ import co.yixiang.modules.shop.service.YxWechatUserService;
|
||||
import co.yixiang.modules.shop.service.dto.YxWechatUserDTO;
|
||||
import co.yixiang.mp.domain.YxWechatTemplate;
|
||||
import co.yixiang.mp.service.WxMpTemplateMessageService;
|
||||
import co.yixiang.mp.service.YxTemplateService;
|
||||
import co.yixiang.mp.service.YxWechatTemplateService;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import co.yixiang.utils.RedisUtil;
|
||||
@ -56,11 +57,13 @@ public class StoreOrderController {
|
||||
private final WxMpTemplateMessageService templateMessageService;
|
||||
private final YxWechatTemplateService yxWechatTemplateService;
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
private YxTemplateService templateService;
|
||||
|
||||
public StoreOrderController(YxStoreOrderService yxStoreOrderService, YxStoreOrderStatusService yxStoreOrderStatusService,
|
||||
YxExpressService yxExpressService, YxWechatUserService wechatUserService, WxMpTemplateMessageService templateMessageService,
|
||||
YxWechatTemplateService yxWechatTemplateService,
|
||||
RedisTemplate<String, String> redisTemplate) {
|
||||
RedisTemplate<String, String> redisTemplate,
|
||||
YxTemplateService templateService) {
|
||||
this.yxStoreOrderService = yxStoreOrderService;
|
||||
this.yxStoreOrderStatusService = yxStoreOrderStatusService;
|
||||
this.yxExpressService = yxExpressService;
|
||||
@ -68,6 +71,7 @@ public class StoreOrderController {
|
||||
this.templateMessageService = templateMessageService;
|
||||
this.yxWechatTemplateService = yxWechatTemplateService;
|
||||
this.redisTemplate = redisTemplate;
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/data/count")
|
||||
@ -192,26 +196,15 @@ public class StoreOrderController {
|
||||
yxStoreOrderStatusService.create(storeOrderStatus);
|
||||
|
||||
//模板消息通知
|
||||
String siteUrl = RedisUtil.get("site_url");
|
||||
try {
|
||||
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
|
||||
if (ObjectUtil.isNotNull(wechatUser)) {
|
||||
if (StrUtil.isNotBlank(wechatUser.getOpenid())) {
|
||||
YxWechatTemplate WechatTemplate = yxWechatTemplateService
|
||||
.findByTempkey("OPENTM200565259");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("first", "亲,宝贝已经启程了,好想快点来到你身边。");
|
||||
map.put("keyword1", resources.getOrderId());//订单号
|
||||
map.put("keyword2", expressDTO.getName());
|
||||
map.put("keyword3", resources.getDeliveryId());
|
||||
map.put("remark", "yshop电商系统为你服务!");
|
||||
templateMessageService.sendWxMpTemplateMessage(wechatUser.getOpenid()
|
||||
, WechatTemplate.getTempid(),
|
||||
siteUrl + "/order/detail/" + resources.getOrderId(), map);
|
||||
templateService.deliverySuccessNotice(resources.getOrderId(),
|
||||
expressDTO.getName(),resources.getDeliveryId(),wechatUser.getOpenid());
|
||||
} else if (StrUtil.isNotBlank(wechatUser.getRoutineOpenid())) {
|
||||
//todo 小程序通知
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("当前用户不是微信用户不能发送模板消息哦!");
|
||||
@ -235,26 +228,16 @@ public class StoreOrderController {
|
||||
yxStoreOrderService.refund(resources);
|
||||
|
||||
//模板消息通知
|
||||
String siteUrl = RedisUtil.get("site_url");
|
||||
try {
|
||||
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
|
||||
if (ObjectUtil.isNotNull(wechatUser)) {
|
||||
if (StrUtil.isNotBlank(wechatUser.getOpenid())) {
|
||||
YxWechatTemplate WechatTemplate = yxWechatTemplateService
|
||||
.findByTempkey("OPENTM410119152");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("first", "您在yshop的订单退款申请被通过,钱款将很快还至您的支付账户。");
|
||||
map.put("keyword1", resources.getOrderId());//订单号
|
||||
map.put("keyword2", resources.getPayPrice().toString());
|
||||
map.put("keyword3", OrderUtil.stampToDate(resources.getAddTime().toString()));
|
||||
map.put("remark", "yshop电商系统为你服务!");
|
||||
templateMessageService.sendWxMpTemplateMessage(wechatUser.getOpenid()
|
||||
, WechatTemplate.getTempid(),
|
||||
siteUrl + "/order/detail/" + resources.getOrderId(), map);
|
||||
templateService.refundSuccessNotice(resources.getOrderId(),
|
||||
resources.getPayPrice().toString(),wechatUser.getOpenid(),
|
||||
OrderUtil.stampToDate(resources.getAddTime().toString()));
|
||||
} else if (StrUtil.isNotBlank(wechatUser.getRoutineOpenid())) {
|
||||
//todo 小程序通知
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("当前用户不是微信用户不能发送模板消息哦!");
|
||||
|
@ -0,0 +1,68 @@
|
||||
package co.yixiang.modules.shop.rest;
|
||||
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.modules.shop.domain.YxUserRecharge;
|
||||
import co.yixiang.modules.shop.service.YxUserRechargeService;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserRechargeQueryCriteria;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-03-02
|
||||
*/
|
||||
@Api(tags = "充值管理管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/yxUserRecharge")
|
||||
public class UserRechargeController {
|
||||
|
||||
private final YxUserRechargeService yxUserRechargeService;
|
||||
|
||||
public UserRechargeController(YxUserRechargeService yxUserRechargeService) {
|
||||
this.yxUserRechargeService = yxUserRechargeService;
|
||||
}
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('yxUserRecharge:list')")
|
||||
public void download(HttpServletResponse response, YxUserRechargeQueryCriteria criteria) throws IOException {
|
||||
yxUserRechargeService.download(yxUserRechargeService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询充值管理")
|
||||
@ApiOperation("查询充值管理")
|
||||
@PreAuthorize("@el.check('yxUserRecharge:list')")
|
||||
public ResponseEntity<Object> getYxUserRecharges(YxUserRechargeQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(yxUserRechargeService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增充值管理")
|
||||
@ApiOperation("新增充值管理")
|
||||
@PreAuthorize("@el.check('yxUserRecharge:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody YxUserRecharge resources){
|
||||
return new ResponseEntity<>(yxUserRechargeService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Log("删除充值管理")
|
||||
@ApiOperation("删除充值管理")
|
||||
@PreAuthorize("@el.check('yxUserRecharge:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
|
||||
yxUserRechargeService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/service.iml" filepath="$PROJECT_DIR$/.idea/service.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../../../../../../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,139 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="d0d75b53-cfec-4785-adc2-d809f10f6a57" name="Default Changelist" comment="" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../../../../../../../.." />
|
||||
</component>
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="mavenHome" value="D:/apache-maven-3.6.1-bin/apache-maven-3.6.1" />
|
||||
<option name="userSettingsFile" value="D:\apache-maven-3.6.1-bin\apache-maven-3.6.1\conf\settings.xml" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-12" />
|
||||
<option name="y" value="-12" />
|
||||
<option name="width" value="1890" />
|
||||
<option name="height" value="960" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="service" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="service" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="last_opened_file_path" value="E:/oldwww/www/mp-ma/joolun" />
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||
<property name="settings.editor.selected.configurable" value="MavenSettings" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="d0d75b53-cfec-4785-adc2-d809f10f6a57" name="Default Changelist" comment="" />
|
||||
<created>1582537625774</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1582537625774</updated>
|
||||
<workItem from="1582537627217" duration="52000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="52000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-7" y="-7" width="1295" height="695" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Image Layers" />
|
||||
<window_info id="Designer" />
|
||||
<window_info id="UI Designer" />
|
||||
<window_info id="Capture Tool" />
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2497979" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Database Changes" />
|
||||
<window_info anchor="bottom" id="Version Control" />
|
||||
<window_info anchor="bottom" id="Statistic" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Palette" />
|
||||
<window_info anchor="right" id="Theme Preview" />
|
||||
<window_info anchor="right" id="Maven" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Palette	" />
|
||||
<window_info anchor="right" id="Database" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,62 @@
|
||||
package co.yixiang.modules.shop.service;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxUserRecharge;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserRechargeDto;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserRechargeQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-03-02
|
||||
*/
|
||||
public interface YxUserRechargeService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(YxUserRechargeQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<YxUserRechargeDto>
|
||||
*/
|
||||
List<YxUserRechargeDto> queryAll(YxUserRechargeQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return YxUserRechargeDto
|
||||
*/
|
||||
YxUserRechargeDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return YxUserRechargeDto
|
||||
*/
|
||||
YxUserRechargeDto create(YxUserRecharge resources);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<YxUserRechargeDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-03-02
|
||||
*/
|
||||
@Data
|
||||
public class YxUserRechargeDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 充值用户UID */
|
||||
private Integer uid;
|
||||
|
||||
/** 订单号 */
|
||||
private String orderId;
|
||||
|
||||
/** 充值金额 */
|
||||
private BigDecimal price;
|
||||
|
||||
/** 充值类型 */
|
||||
private String rechargeType;
|
||||
|
||||
/** 是否充值 */
|
||||
private Integer paid;
|
||||
|
||||
/** 充值支付时间 */
|
||||
private Integer payTime;
|
||||
|
||||
/** 充值时间 */
|
||||
private Integer addTime;
|
||||
|
||||
/** 退款金额 */
|
||||
private BigDecimal refundPrice;
|
||||
|
||||
/** 昵称 */
|
||||
private String nickname;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import co.yixiang.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-03-02
|
||||
*/
|
||||
@Data
|
||||
public class YxUserRechargeQueryCriteria{
|
||||
|
||||
/** 模糊 */
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String nickname;
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package co.yixiang.modules.shop.service.impl;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxUserRecharge;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import co.yixiang.utils.FileUtil;
|
||||
import co.yixiang.modules.shop.repository.YxUserRechargeRepository;
|
||||
import co.yixiang.modules.shop.service.YxUserRechargeService;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserRechargeDto;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserRechargeQueryCriteria;
|
||||
import co.yixiang.modules.shop.service.mapper.YxUserRechargeMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import co.yixiang.exception.EntityExistException;
|
||||
// 默认不使用缓存
|
||||
//import org.springframework.cache.annotation.CacheConfig;
|
||||
//import org.springframework.cache.annotation.CacheEvict;
|
||||
//import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import co.yixiang.utils.PageUtil;
|
||||
import co.yixiang.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-03-02
|
||||
*/
|
||||
@Service
|
||||
//@CacheConfig(cacheNames = "yxUserRecharge")
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxUserRechargeServiceImpl implements YxUserRechargeService {
|
||||
|
||||
private final YxUserRechargeRepository yxUserRechargeRepository;
|
||||
|
||||
private final YxUserRechargeMapper yxUserRechargeMapper;
|
||||
|
||||
public YxUserRechargeServiceImpl(YxUserRechargeRepository yxUserRechargeRepository, YxUserRechargeMapper yxUserRechargeMapper) {
|
||||
this.yxUserRechargeRepository = yxUserRechargeRepository;
|
||||
this.yxUserRechargeMapper = yxUserRechargeMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
public Map<String,Object> queryAll(YxUserRechargeQueryCriteria criteria, Pageable pageable){
|
||||
Page<YxUserRecharge> page = yxUserRechargeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(yxUserRechargeMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
public List<YxUserRechargeDto> queryAll(YxUserRechargeQueryCriteria criteria){
|
||||
return yxUserRechargeMapper.toDto(yxUserRechargeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Cacheable(key = "#p0")
|
||||
public YxUserRechargeDto findById(Integer id) {
|
||||
YxUserRecharge yxUserRecharge = yxUserRechargeRepository.findById(id).orElseGet(YxUserRecharge::new);
|
||||
ValidationUtil.isNull(yxUserRecharge.getId(),"YxUserRecharge","id",id);
|
||||
return yxUserRechargeMapper.toDto(yxUserRecharge);
|
||||
}
|
||||
|
||||
@Override
|
||||
//@CacheEvict(allEntries = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxUserRechargeDto create(YxUserRecharge resources) {
|
||||
if(yxUserRechargeRepository.findByOrderId(resources.getOrderId()) != null){
|
||||
throw new EntityExistException(YxUserRecharge.class,"order_id",resources.getOrderId());
|
||||
}
|
||||
return yxUserRechargeMapper.toDto(yxUserRechargeRepository.save(resources));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
//@CacheEvict(allEntries = true)
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
yxUserRechargeRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<YxUserRechargeDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (YxUserRechargeDto yxUserRecharge : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("充值用户UID", yxUserRecharge.getUid());
|
||||
map.put("订单号", yxUserRecharge.getOrderId());
|
||||
map.put("充值金额", yxUserRecharge.getPrice());
|
||||
map.put("充值类型", yxUserRecharge.getRechargeType());
|
||||
map.put("是否充值", yxUserRecharge.getPaid());
|
||||
map.put("充值支付时间", yxUserRecharge.getPayTime());
|
||||
map.put("充值时间", yxUserRecharge.getAddTime());
|
||||
map.put("退款金额", yxUserRecharge.getRefundPrice());
|
||||
map.put("昵称", yxUserRecharge.getNickname());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package co.yixiang.modules.shop.service.mapper;
|
||||
|
||||
import co.yixiang.base.BaseMapper;
|
||||
import co.yixiang.modules.shop.domain.YxUserRecharge;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserRechargeDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-03-02
|
||||
*/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface YxUserRechargeMapper extends BaseMapper<YxUserRechargeDto, YxUserRecharge> {
|
||||
|
||||
}
|
Reference in New Issue
Block a user