|
@@ -1,36 +1,45 @@
|
|
|
package com.tofly.fees.feesmgt.controller_easy;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.tofly.common.core.entity.ResultRespone;
|
|
|
import com.tofly.fees.common.BaseController;
|
|
|
+import com.tofly.fees.common.annotate.requestPostSingle.RequestPostSingleParam;
|
|
|
import com.tofly.fees.common.dbhelper.DbHelper;
|
|
|
import com.tofly.fees.common.dbhelper.PageSortHelper;
|
|
|
import com.tofly.fees.common.enums.SysEnum;
|
|
|
+import com.tofly.fees.common.model.CollectionData;
|
|
|
import com.tofly.fees.common.model.PageLink;
|
|
|
import com.tofly.fees.common.util.DateUtils;
|
|
|
+import com.tofly.fees.common.util.ToolsUtils;
|
|
|
+import com.tofly.fees.feesmgt.entity.SfCharge;
|
|
|
+import com.tofly.fees.feesmgt.service.SfChargeService;
|
|
|
+import com.tofly.fees.feesmgt.service.SfCusAccService;
|
|
|
import com.tofly.fees.wechatofficalacctmgt.entity.WxBzsq;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
-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;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import springfox.documentation.service.ApiListing;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.MessageFormat;
|
|
|
-import java.util.Date;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import static com.tofly.fees.common.ControllerConstants.*;
|
|
|
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
|
-@RequestMapping("/sfcharge")
|
|
|
-@Api(tags="实收明细:实收明细接口")
|
|
|
+@RequestMapping("/api/feesmgt/sfcharge")
|
|
|
+@Api(tags = "实收明细:实收明细接口")
|
|
|
public class SfChargeEasyController extends BaseController {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private final SfChargeService sfChargeService;
|
|
|
+
|
|
|
@GetMapping("/pageInfo")
|
|
|
@ApiOperation(value = "[Easy]自定义分页查询")
|
|
|
public ResultRespone getWxBzsqPage(@ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
|
|
@@ -38,16 +47,204 @@ public class SfChargeEasyController extends BaseController {
|
|
|
@ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
|
|
|
@RequestParam(value = PAGE_NUMBER_PARA_NAME) int page,
|
|
|
@ApiParam(value = "用户编号", required = true)
|
|
|
- @RequestParam(value = "customerNo") String customerNo
|
|
|
+ @RequestParam(value = "customerNo") String customerNo
|
|
|
) throws Exception {
|
|
|
DbHelper db = DbHelper.getDbHelper();
|
|
|
PageLink pg = createPageLink(pageSize, page);
|
|
|
|
|
|
String strSql = String.format("select * from TF_YWYS_SF_CHARGE t where 1=1 ");
|
|
|
- strSql+=String.format(" and yhbh='%s' and CHARGE_FLAG=1",customerNo);
|
|
|
+ strSql += String.format(" and customer_no='%s' and CHARGE_FLAG=1 and cancel_flag='0'", customerNo);
|
|
|
Object obj = db.getPage(pg, strSql, SysEnum.MyBatis.getName());
|
|
|
return ResultRespone.success(obj);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/ChargePayment")
|
|
|
+ @ApiOperation(value = "[Easy]营业厅欠费收取")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "inYhbh", value = "用户编号", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "inSSJE", value = "实收金额", required = true, dataType = "NUMBER"),
|
|
|
+ @ApiImplicitParam(name = "inFFFS", value = "付费方式", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "inSFRYXM", value = "收费人员姓名", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "inSFRYBM", value = "收费人员编码", required = true, dataType = "String"),
|
|
|
+
|
|
|
+ })
|
|
|
+ public ResultRespone ChargePayment(@RequestPostSingleParam HashMap<String, Object> data) throws Exception {
|
|
|
+
|
|
|
+ DbHelper db = DbHelper.getDbHelper();
|
|
|
+ List<HashMap<String, Object>> lst = new ArrayList<>();
|
|
|
+
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String inyhbh = data.get("V_YHBH").toString();
|
|
|
+ String fffs = data.get("V_FFFS").toString();
|
|
|
+ String ids = data.get("V_IDS").toString();
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(inyhbh)){
|
|
|
+ return ResultRespone.failed("未找到用户编号信息.");
|
|
|
+ }
|
|
|
+ Double inSSJE = Double.parseDouble(data.get("V_SSJE").toString());
|
|
|
+ if(inSSJE<=0){
|
|
|
+ return ResultRespone.failed("金额必须大于0元.");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(ids)){
|
|
|
+ return ResultRespone.failed("请选择欠费.");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String sfrybm = "administrator";
|
|
|
+ String sfryxm = "系统管理员";
|
|
|
+
|
|
|
+ params.put("V_YHBH", inyhbh);
|
|
|
+ params.put("V_SFRYBM", sfrybm);
|
|
|
+ params.put("V_SFRYXM", sfryxm);
|
|
|
+ params.put("V_SFRQ",new Date());
|
|
|
+ params.put("V_SSJE", inSSJE);
|
|
|
+ params.put("V_SFD", "1");
|
|
|
+ params.put("V_FFFS", fffs);
|
|
|
+ params.put("V_YESFGD", "1");
|
|
|
+ params.put("V_IDS", ids);
|
|
|
+ params.put("V_SFLSBH", ToolsUtils.getGuid());
|
|
|
+ params.put("V_SFCG", "-1");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Map mp = db.procurdeCmd("{call PROC_SF_ZS(" +
|
|
|
+ "#{V_YHBH,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{V_SFRYBM,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{V_SFRYXM,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{V_SFRQ,mode=IN,jdbcType=TIMESTAMP}," +
|
|
|
+ "#{V_SSJE,mode=IN,jdbcType=DOUBLE}," +
|
|
|
+ "#{V_SFD,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{V_FFFS,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{V_YESFGD,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{V_IDS,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{V_SFLSBH,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{V_SFCG,mode=OUT,jdbcType=INTEGER}" +
|
|
|
+ ")}", params, SysEnum.MyBatis.getName());
|
|
|
+
|
|
|
+
|
|
|
+ String jym = mp.get("V_SFCG").toString();
|
|
|
+ if (jym.equals("0")) {
|
|
|
+ return ResultRespone.success("缴费成功.");
|
|
|
+ } else if(jym.equals("2")) {
|
|
|
+ return ResultRespone.failed("没有欠费.");
|
|
|
+ }else if(jym.equals("3")){
|
|
|
+ return ResultRespone.failed("剩余预付费大于等于最早一笔欠费.");
|
|
|
+ }else if(jym.equals("4")){
|
|
|
+ return ResultRespone.failed("缴费金额低于欠费金额.");
|
|
|
+ } else {
|
|
|
+ return ResultRespone.failed("异常缴费信息.");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/ChargeAdvPayment")
|
|
|
+ @ApiOperation(value = "[Easy]预存")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "inYhbh", value = "用户编号", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "inSSJE", value = "实收金额", required = true, dataType = "NUMBER"),
|
|
|
+ @ApiImplicitParam(name = "inFFFS", value = "付费方式", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "inSFRYXM", value = "收费人员姓名", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "inSFRYBM", value = "收费人员编码", required = true, dataType = "String"),
|
|
|
+
|
|
|
+ })
|
|
|
+ public ResultRespone ChargeAdvPayment(@RequestPostSingleParam HashMap<String, Object> data) throws Exception {
|
|
|
+ DbHelper db = DbHelper.getDbHelper();
|
|
|
+ List<HashMap<String, Object>> lst = new ArrayList<>();
|
|
|
+
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ String inyhbh = data.get("inYhbh").toString();
|
|
|
+ if(StringUtils.isBlank(inyhbh)){
|
|
|
+ return ResultRespone.failed("未找到用户编号信息.");
|
|
|
+ }
|
|
|
+ Double inSSJE = Double.parseDouble(data.get("inSSJE").toString());
|
|
|
+ if(inSSJE<=0){
|
|
|
+ return ResultRespone.failed("金额必须大于0元.");
|
|
|
+ }
|
|
|
+
|
|
|
+ String sfrybm = "administrator";
|
|
|
+ String sfryxm = "系统管理员";
|
|
|
+
|
|
|
+ params.put("inYhbh", inyhbh);
|
|
|
+ params.put("inSfLSH", ToolsUtils.getGuid());
|
|
|
+ params.put("inSfRQ", new Date());
|
|
|
+ params.put("inSSJE", inSSJE);
|
|
|
+ params.put("inYYD", "0");
|
|
|
+ params.put("inFFFS", "01");
|
|
|
+ params.put("inSFRYXM", sfryxm);
|
|
|
+ params.put("inSFRYBM", sfrybm);
|
|
|
+ params.put("out_JYM", "-1");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Map mp = db.procurdeCmd("{call PROC_GT_YFF(" +
|
|
|
+ "#{inYhbh,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{inSfLSH,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{inSfRQ,mode=IN,jdbcType=TIMESTAMP}," +
|
|
|
+ "#{inSSJE,mode=IN,jdbcType=DOUBLE}," +
|
|
|
+ "#{inYYD,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{inFFFS,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{inSFRYXM,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{inSFRYBM,mode=IN,jdbcType=VARCHAR}," +
|
|
|
+ "#{out_JYM,mode=OUT,jdbcType=INTEGER}" +
|
|
|
+ ")}", params, SysEnum.MyBatis.getName());
|
|
|
+
|
|
|
+
|
|
|
+ String jym = mp.get("out_JYM").toString();
|
|
|
+ if (jym.equals("0")) {
|
|
|
+ return ResultRespone.success("预存成功.");
|
|
|
+ } else {
|
|
|
+ return ResultRespone.failed("预存失败.");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/GetToDayChargeInfo")
|
|
|
+ @ApiOperation(value = "[Easy]获取当日实收笔数信息")
|
|
|
+ public ResultRespone GetToDayChargeInfo() throws Exception {
|
|
|
+ QueryWrapper<SfCharge> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select(" (case CHARGE_TYPE when '3' then '预存' else '实收' end ) CHARGE_TYPE", "count(distinct(CHARGE_SERIAL_NO)) as count", "sum(pay_total_amount) as total_price")
|
|
|
+ .eq("charge_ocode","administrator")
|
|
|
+ .and(i->i.eq( "CHARGE_TYPE","3").or() .eq("CHARGE_TYPE","2"))
|
|
|
+ .apply("charge_date>=TO_DATE({0}, 'yyyy-MM-dd HH24:mi:ss') and charge_date<TO_DATE({1}, 'yyyy-MM-dd HH24:mi:ss')",DateUtils.formatDate(new Date(),"yyyy-MM-dd 00:00:00"),DateUtils.formatDate(new Date(),"yyyy-MM-dd 23:59:59"))
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ .groupBy("CHARGE_TYPE");
|
|
|
+ List<Map<String, Object>> orderStats = sfChargeService.listMaps(wrapper);
|
|
|
+
|
|
|
+
|
|
|
+ int count=0;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(orderStats.size()>0){
|
|
|
+
|
|
|
+ BigDecimal total_price_sum = orderStats.stream().map(x -> new BigDecimal(String.valueOf(x.get("TOTAL_PRICE")))).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+ BigDecimal count_sum = orderStats.stream().map(x -> new BigDecimal(String.valueOf(x.get("COUNT")))).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+
|
|
|
+ HashMap<String,Object> map=new HashMap<>();
|
|
|
+ map.put("CHARGE_TYPE","总计");
|
|
|
+ map.put("TOTAL_PRICE",total_price_sum);
|
|
|
+ map.put("COUNT",count_sum);
|
|
|
+
|
|
|
+ orderStats.add(map);
|
|
|
+ }
|
|
|
+ return ResultRespone.success(orderStats);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|