lmstack 3 سال پیش
والد
کامیت
dafcf0bae4

+ 15 - 9
src/main/java/cn/fastfun/controller/api/ApiAssetProfitController.java

@@ -1,5 +1,6 @@
 package cn.fastfun.controller.api;
 
+import cn.fastfun.controller.dto.asset.AssetConfDto;
 import cn.fastfun.controller.dto.asset.BaseInfoDTO;
 import cn.fastfun.controller.dto.asset.ResponseDTO;
 import cn.fastfun.controller.dto.asset.FigureDTO;
@@ -10,7 +11,7 @@ import cn.fastfun.service.entity.AppAssetConf;
 import cn.fastfun.service.entity.AppDevice;
 import cn.fastfun.service.impl.AppAssetConfServiceImpl;
 import cn.fastfun.service.impl.AppAssetProfitServiceImpl;
-//import cn.fastfun.service.mapper.AppAssetConfMapper;
+import cn.fastfun.service.mapper.AppAssetConfMapper;
 import cn.fastfun.util.IrrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -52,8 +53,8 @@ public class ApiAssetProfitController {
     @Autowired
     AppDeviceService appDeviceService;
 
-//    @Autowired
-//    AppAssetConfMapper appAssetConfMapper;
+    @Autowired
+    AppAssetConfMapper appAssetConfMapper;
 
 
     @ApiOperation(value = "基础信息")
@@ -786,15 +787,20 @@ public class ApiAssetProfitController {
                 }
 
                 Page<AppAssetConf> appAssetConfPage = appAssetConfService.page(page, appAssetConfQueryWrapper);
-//                appAssetConfMapper.getAssetConf(param.getSn(), param.getTableOrder(), param.getType().split(","),
-//                        new SimpleDateFormat("yyyy-MM-dd").format(param.getTimeStart()), new SimpleDateFormat("yyyy-MM-dd").format(param.getTimeEnd()),
-//                        (param.getIndex()-1)*param.getLength(), param.getLength());
+
+                List<String> strings = Arrays.asList(param.getType());
+
+                List<AssetConfDto> assetConf = appAssetConfMapper.getAssetConf(param.getSn(), param.getTableOrder(),
+                        param.getType() == null?null:Arrays.asList(param.getType()),
+                        param.getTimeStart() == null?null:new SimpleDateFormat("yyyy-MM-dd").format(param.getTimeStart()),
+                        param.getTimeEnd() == null?null:new SimpleDateFormat("yyyy-MM-dd").format(param.getTimeEnd()),
+                        (param.getIndex() - 1) * param.getLength(), param.getLength());
                 List<Map<String, Object>> data = new ArrayList<>();
-                if (appAssetConfPage.getTotal() > 0) {
-                    appAssetConfPage.getRecords().forEach(p -> {
+                if (assetConf.size() > 0) {
+                    assetConf.forEach(p -> {
                         data.add(new HashMap<String, Object>() {{
                             put("time", p.getTime());
-                            put("type", p.getType());
+                            put("type", p.getTypeText());
                             put("amount", p.getAmount());
                             put("remark", "");
                         }});

+ 20 - 0
src/main/java/cn/fastfun/controller/dto/asset/AssetConfDto.java

@@ -0,0 +1,20 @@
+package cn.fastfun.controller.dto.asset;
+
+import cn.fastfun.service.entity.AppAssetConf;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 资产基础信息
+ * @author user
+ */
+@Data
+public class AssetConfDto extends AppAssetConf {
+
+    private static final long serialVersionUID = -1821068317406106793L;
+
+    private String typeText;
+}

+ 1 - 0
src/main/java/cn/fastfun/service/entity/AppAssetConf.java

@@ -41,6 +41,7 @@ public class AppAssetConf implements Serializable {
 
     private Integer type;
 
+
     @ApiModelProperty(value = "费用")
     private BigDecimal amount;
 

+ 56 - 54
src/main/java/cn/fastfun/service/mapper/AppAssetConfMapper.java

@@ -1,11 +1,13 @@
 package cn.fastfun.service.mapper;
 
+import cn.fastfun.controller.dto.asset.AssetConfDto;
 import cn.fastfun.service.entity.AppAssetConf;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * <p>
@@ -17,59 +19,59 @@ import java.util.List;
  */
 public interface AppAssetConfMapper extends BaseMapper<AppAssetConf> {
 
-//    @Select("<script>" +
-//            "SELECT" +
-//            "d.sn," +
-//            "d.amount," +
-//            "CASE" +
-//            "CONCAT( d.table_order, d.type ) " +
-//            "WHEN ( 21 ) THEN" +
-//            "'故障花费' " +
-//            "WHEN ( 22 ) THEN" +
-//            "'平台服务费' " +
-//            "WHEN ( 31 ) THEN" +
-//            "'赔偿花费' " +
-//            "WHEN ( 51 ) THEN" +
-//            "'仓储费用' " +
-//            "WHEN ( 52 ) THEN" +
-//            "'运输费用' " +
-//            "WHEN ( 53 ) THEN" +
-//            "'销售费用' " +
-//            "WHEN ( 54 ) THEN" +
-//            "'平台费用' " +
-//            "WHEN ( 61 ) THEN" +
-//            "'已支付金融成本' " +
-//            "WHEN ( 62 ) THEN" +
-//            "'未支付金融成本' " +
-//            "WHEN ( 71 ) THEN" +
-//            "'翻新金额-支' " +
-//            "WHEN ( 72 ) THEN" +
-//            "'处置支出' " +
-//            "WHEN ( 73 ) THEN" +
-//            "'处置收益' " +
-//            "WHEN ( 81 ) THEN" +
-//            "'其他支出项目' " +
-//            "WHEN ( 82 ) THEN" +
-//            "'其他收入项目' ELSE '其他' " +
-//            "END AS type " +
-//            "FROM" +
-//            "app_asset_conf d " +
-//            "where sn = #{sn} " +
-//            "and table_order = #{tableOrder} " +
-//            "<when test='type!=null'>" +
-//            "and type in (" +
-//            "<foreach item='item' collection='type' index='index'  open='(' separator=',' close=')'>#{item}</foreach>" +
-//            ")" +
-//            "</when>" +
-//            "<when test='timeStart!=null'>" +
-//            "and time > #{timeStart} " +
-//            "</when>" +
-//            "<when test='timeEnd!=null'>" +
-//            "and time < #{timeEnd} " +
-//            "</when>" +
-//            "limit #{offset}, #{length}" +
-//            "</script")
-//    List<AppAssetConf> getAssetConf(@Param("sn") String sn, @Param("tableOrder") Integer tableOrder, @Param("type") String[] type,
-//                                    @Param("timeStart") String timeStart,@Param("timeEnd") String timeEnd, @Param("offset") Integer offset, @Param("length") Integer length);
+    @Select({"<script>" +
+            " SELECT" +
+            " d.sn," +
+            " d.amount," +
+            " d.time," +
+            " CASE" +
+            " CONCAT( d.table_order, d.type ) " +
+            " WHEN ( '21' ) THEN" +
+            " '故障花费' " +
+            " WHEN ( '22' ) THEN" +
+            " '平台服务费' " +
+            " WHEN ( '31' ) THEN" +
+            " '赔偿花费' " +
+            " WHEN ( '51' ) THEN" +
+            " '仓储费用' " +
+            " WHEN ( '52' ) THEN" +
+            " '运输费用' " +
+            " WHEN ( '53' ) THEN" +
+            " '销售费用' " +
+            " WHEN ( '54' ) THEN" +
+            " '平台费用' " +
+            " WHEN ( '61' ) THEN" +
+            " '已支付金融成本' " +
+            " WHEN ( '62' ) THEN" +
+            " '未支付金融成本' " +
+            " WHEN ( '71' ) THEN" +
+            " '翻新金额-支' " +
+            " WHEN ( '72' ) THEN" +
+            " '处置支出' " +
+            " WHEN ( '73' ) THEN" +
+            " '处置收益' " +
+            " WHEN ( '81' ) THEN" +
+            " '其他支出项目' " +
+            " WHEN ( '82' ) THEN" +
+            " '其他收入项目' ELSE '其他' " +
+            " END AS typeText " +
+            " FROM" +
+            " app_asset_conf d " +
+            " where sn = #{sn} " +
+            " and table_order = #{tableOrder} " +
+            "<when test='type!=null'>" +
+            " and type in " +
+            "<foreach item='id' collection='type' index='index'  open='(' separator=',' close=')'>#{id}</foreach>" +
+            "</when>" +
+            "<when test='timeStart!=null'>" +
+            " and time &gt; #{timeStart} " +
+            "</when>" +
+            "<when test='timeEnd!=null'>" +
+            " and time &lt; #{timeEnd} " +
+            "</when>" +
+            " limit #{offset}, #{length}" +
+            "</script>"})
+    List<AssetConfDto> getAssetConf(@Param("sn") String sn, @Param("tableOrder") Integer tableOrder, @Param("type") List<String> type,
+                                    @Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("offset") Integer offset, @Param("length") Integer length);
 
 }

+ 4 - 0
src/main/resources/application-dev.yml

@@ -20,6 +20,10 @@ spring:
     hibernate:
       ddl-auto: update
 
+mybatis-plus:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
 logging:
   level:
     com.bridge: debug