diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/BillDataController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/BillDataController.java new file mode 100644 index 000000000..fd7a6d11a --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/BillDataController.java @@ -0,0 +1,38 @@ +package com.logpm.report.controller; + + +import com.logpm.report.service.BillingService; +import com.logpm.report.vo.indexCount.BillingDataVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +@RequestMapping("/bill_data") +@Api(value = "首页开单数据",tags = "首页开单数据") +public class BillDataController { + + private BillingService billingService; + + /** + * 获取开单数据 + * @return + */ + @GetMapping("/bill_data") + @ApiOperation(value = "",tags = "") + public BillingDataVo billData(){ + return billingService.BillData(); + } + + + + + + + +} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/IndexCountController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/IndexCountController.java index b797798f5..51500baa3 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/IndexCountController.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/IndexCountController.java @@ -40,7 +40,7 @@ public class IndexCountController { return R.data(theNumberOfShelvesInTheLibrary); } - @GetMapping("/index_number_in_the_library") + @GetMapping("/index_number_no_the_library") @ApiOperation(value = "定制品在库订单未上架总数",tags = "定制品在库订单未上架总数") public R getTheNumberOfShelvesNoTheLibrary(@RequestParam("id") Long id){ Integer theNumberOfShelvesInTheLibrary= inLibraryDeliverService.theNumberOfShelvesInTheLibrary(id,1); diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/BillDataMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/BillDataMapper.java index f57be4eb1..65025b666 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/BillDataMapper.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/BillDataMapper.java @@ -6,14 +6,16 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; import java.util.List; @Mapper public interface BillDataMapper { - Integer billCount(@Param("warehouseId") Long warehouseId, @Param("timeType") Integer timeType, @Param("date")List date); - BigDecimal billMoney(@Param("warehouseId") Long warehouseId,@Param("timeType") Integer timeType, @Param("date")List date); - BigDecimal detailMoney(@Param("warehouseId") Long warehouseId,@Param("detailMoney") Integer timeType, @Param("date")List date); + Integer billCount(@Param("warehouseId") List warehouseId, @Param("timeType") String timeType, @Param("date") HashMap date); + BigDecimal billMoney(@Param("warehouseId") List warehouseId,@Param("timeType") String timeType, @Param("date")HashMap date); + BigDecimal detailMoney(@Param("warehouseId") List warehouseId,@Param("detailMoney") String timeType, @Param("date")HashMap date); diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/BillDataMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/BillDataMapper.xml index 1532e76a6..e0481ae92 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/BillDataMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/BillDataMapper.xml @@ -7,20 +7,22 @@ select count(*) billCount from logpm_platform.logpm_warehouse_waybill - where freeze_status = 1 + where freeze_status = 0 - - and - where destination_warehouse_id = #{warehouseId} - + + + and destination_warehouse_id = #{item} + + + - - and create_time > #{param.startDate} + + and create_time > #{date.start_date} - - and create_time < #{param.endDate} + + and create_time < #{date.end_date} diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/BillingService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/BillingService.java index 3aae51e96..006058767 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/BillingService.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/BillingService.java @@ -4,6 +4,8 @@ import com.logpm.report.vo.indexCount.BillingDataVo; import com.logpm.report.vo.indexCount.DetailMoneyVo; import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; import java.util.List; public interface BillingService { @@ -13,21 +15,21 @@ public interface BillingService { * @param TType * @return Integer */ - Integer BillCount(Integer TType); + Integer BillCount(String TType,HashMap date); /** * 获取开单收入 * @param TType * @return BigDecimal */ - BigDecimal BillMoney(Integer TType); + BigDecimal BillMoney(String TType, HashMap date); /** * 获取开单收入明细 * @param TType * @return List */ - List DetailType(Integer TType); + List DetailType(String TType,HashMap date); /** diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/BillingServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/BillingServiceImpl.java index dc807afe7..6544ef329 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/BillingServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/BillingServiceImpl.java @@ -2,15 +2,19 @@ package com.logpm.report.service.impl; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.report.mapper.BillDataMapper; import com.logpm.report.service.BillingService; +import com.logpm.report.typepage.TimeType; import com.logpm.report.vo.indexCount.BillingDataVo; import com.logpm.report.vo.indexCount.DetailMoneyVo; import lombok.AllArgsConstructor; + import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; + +import java.util.*; + @Service @AllArgsConstructor @@ -18,35 +22,99 @@ public class BillingServiceImpl implements BillingService { private IBasicdataWarehouseClient warehouseClient; + private BillDataMapper billDataMapper; - + /** + * 获取时间范围内的开单数 + * @param TType + * @param date + * @return Integer + */ @Override - public Integer BillCount(Integer TType) { - return null; + public Integer BillCount(String TType,HashMap date) { + List warehouse = getWarehouse(); + return billDataMapper.billCount(warehouse, TType, date); } + /** + * 获取时间范围内的收入 + * @param TType + * @param date + * @return BigDecimal + */ @Override - public BigDecimal BillMoney(Integer TType) { - return null; + public BigDecimal BillMoney(String TType, HashMap date) { + List warehouse = getWarehouse(); + return billDataMapper.billMoney(warehouse, TType, date); } + /** + * 获取时间范围内地的收入明细 + * @param TType + * @param date + * @return + */ @Override - public List DetailType(Integer TType) { + public List DetailType(String TType,HashMap date) { return null; } + /** + * 获取全部开单数据 + * @return BillingDataVo + */ @Override public BillingDataVo BillData() { - return null; + BillingDataVo billingDataVo = new BillingDataVo(); + HashMap time1 = getOtherTime(TimeType.all.getValue()); + HashMap time2 = getOtherTime(TimeType.moon.getValue()); + HashMap time3 = getOtherTime(TimeType.day.getValue()); + Integer all = BillCount(TimeType.all.getValue(), time1); + Integer moon = BillCount(TimeType.moon.getValue(), time2); + Integer day = BillCount(TimeType.day.getValue(), time3); + billingDataVo.setAllCount(all); + billingDataVo.setMoonCount(moon); + billingDataVo.setDayCount(day); + return billingDataVo; } + /** + * 获取当月/当天时间 + * @param type 2:月:3天 + * @return + */ + public HashMap getOtherTime(String type){ + HashMap hashMap = new HashMap<>(); + Calendar instance = Calendar.getInstance(); + Date endTime = new Date(); + int typeI = Integer.parseInt(type); + if (typeI ==2){ + instance.set(Calendar.DAY_OF_MONTH,1); + Date time = instance.getTime(); + hashMap.put("stare_time",time); + hashMap.put("end_time",endTime); + }else if (typeI ==3) { + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + Date time = calendar.getTime(); + hashMap.put("stare_time",time); + hashMap.put("end_time",endTime); + } + return hashMap; + + + } /** * 获取用户仓库id * @return */ private List getWarehouse(){ BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); +// BasicdataWarehouseEntity myCurrentWarehouse = new BasicdataWarehouseEntity(); List ls = new ArrayList<>(); if (myCurrentWarehouse !=null){ ls.add(myCurrentWarehouse.getId()); diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/indexCount/BillingDataVo.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/indexCount/BillingDataVo.java index 98f6e1f28..d7537edf0 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/indexCount/BillingDataVo.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/indexCount/BillingDataVo.java @@ -1,11 +1,16 @@ package com.logpm.report.vo.indexCount; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; import java.math.BigDecimal; import java.util.List; -public class BillingDataVo { +@Data +@ApiModel("首页开单数据") +public class BillingDataVo implements Serializable { @ApiModelProperty("开单总数") private Integer allCount; diff --git a/blade-service/logpm-report/src/main/resources/application-dev.yml b/blade-service/logpm-report/src/main/resources/application-dev.yml index 3848e6af9..cdf523b40 100644 --- a/blade-service/logpm-report/src/main/resources/application-dev.yml +++ b/blade-service/logpm-report/src/main/resources/application-dev.yml @@ -33,7 +33,7 @@ spring: url: ${blade.datasource.report.master.url} username: ${blade.datasource.report.master.username} # password: ${blade.datasource.report.master.password} - password: Hwy@1234 + password: 12345678 slave: druid: #独立校验配置 @@ -43,5 +43,5 @@ spring: url: ${blade.datasource.report.slave.url} username: ${blade.datasource.report.slave.username} # password: ${blade.datasource.report.slave.password} - password: Hwy@1234 + password: 12345678