浏览代码

Merge remote-tracking branch 'origin/master'

shudong 1 年之前
父节点
当前提交
749362529f

+ 31 - 12
collect-fees/collect-fees-service/src/main/java/com/tofly/fees/common/annotate/requestPostSingle/RequestPostSingleParamMethodArgumentResolver.java

@@ -1,7 +1,9 @@
 package com.tofly.fees.common.annotate.requestPostSingle;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.tofly.fees.common.util.ObjFromMapUtils;
 import org.apache.commons.beanutils.ConvertUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -48,10 +50,10 @@ public class RequestPostSingleParamMethodArgumentResolver implements HandlerMeth
         if (servletRequest.getParameterMap() != null &&
                 servletRequest.getParameterMap().size() > 0) {
             Map<String, Object> filterMapObj = new HashMap<>();
-            Map map=servletRequest.getParameterMap();
+            Map map = servletRequest.getParameterMap();
             Set key = map.keySet();
-            for(Object model: key.toArray()){
-                filterMapObj.put(model.toString(),((String[])map.get(model))[0]);
+            for (Object model : key.toArray()) {
+                filterMapObj.put(model.toString(), ((String[]) map.get(model))[0]);
             }
             return this.bindUrlRequestParams(parameter, filterMapObj);
         }
@@ -67,6 +69,8 @@ public class RequestPostSingleParamMethodArgumentResolver implements HandlerMeth
             log.error("请求: {}格式错误, 请求方式需为 {}", servletRequest.getRequestURL().toString(), POST);
             throw new RuntimeException("请求方式错误");
         }
+
+
         // 创建请求
         return this.bindRequestParams(parameter, servletRequest);
     }
@@ -102,6 +106,7 @@ public class RequestPostSingleParamMethodArgumentResolver implements HandlerMeth
         // 获取参数值
         Object value = paramObj.get(parameterName);
 
+
         // 必填判定
         if (requestPostSingleParam.required()) {
             if (ObjectUtils.isEmpty(value)) {
@@ -109,6 +114,21 @@ public class RequestPostSingleParamMethodArgumentResolver implements HandlerMeth
                 throw new Error(String.format("参数【%s】不能为空", parameterName));
             }
         }
+
+        try {
+            switch (parameterType.getTypeName()) {
+                case "java.util.HashMap":
+                    value=JSONObject.parseObject(value.toString(), HashMap.class);
+                    break;
+                case "java.util.Map":
+
+                    break;
+
+            }
+        } catch (Exception ex) {
+            throw new Error(String.format("转换对象异常【%s】", parameterName));
+        }
+
         return ConvertUtils.convert(value, parameterType);
     }
 
@@ -136,31 +156,30 @@ public class RequestPostSingleParamMethodArgumentResolver implements HandlerMeth
         Object value = paramObj.get(parameterName);
 
 
-        switch (parameterType.getTypeName()){
+        switch (parameterType.getTypeName()) {
             case "java.util.ArrayList":
-                String _value=(String) value;
-               value=value.toString().replace("[","").replace("]","");
+                String _value = (String) value;
+                value = value.toString().replace("[", "").replace("]", "");
                 String[] strArr = value.toString().split(",");
                 ArrayList<Object> arr = new ArrayList<>();
-                for(String m : strArr) {
+                for (String m : strArr) {
                     arr.add(m);
                 }
-                value=arr;
+                value = arr;
                 break;
 
             case "java.util.List":
-                value=value.toString().replace("[","").replace("]","");
+                value = value.toString().replace("[", "").replace("]", "");
                 String[] strList = value.toString().split(",");
                 List<Object> lst = new ArrayList<>();
-                for(String m : strList) {
+                for (String m : strList) {
                     lst.add(m);
                 }
-                value= lst;
+                value = lst;
                 break;
         }
 
 
-
         // 必填判定
         if (requestPostSingleParam.required()) {
             if (ObjectUtils.isEmpty(value)) {

+ 52 - 0
collect-fees/collect-fees-service/src/main/java/com/tofly/fees/common/util/ObjFromMapUtils.java

@@ -0,0 +1,52 @@
+package com.tofly.fees.common.util;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @description:
+ * @Title: ObjFromMapUtils
+ * @Package com.tofly.fees.common.util
+ * @Author 芝士汉堡
+ * @Date 2023-07-11 9:51
+ */
+public class ObjFromMapUtils {
+    /**
+     * 将Object类型的数据转化成Map<String,Object>
+     * @param obj
+     * @return
+     * @throws Exception
+     */
+    public static Map<String,Object> obj2Map(Object obj) throws Exception{
+
+        Map<String,Object> map=new HashMap<String, Object>();
+        Field[] fields = obj.getClass().getDeclaredFields();
+        for(Field field:fields){
+            field.setAccessible(true);
+            map.put(field.getName(), field.get(obj));
+        }
+        return map;
+    }
+
+
+    /**
+     * 将Map<String,Object>类型的数据转化成Object
+     * @return
+     * @throws Exception
+     */
+    public Object map2Obj(Map<String,Object> map,Class<?> clz) throws Exception{
+        Object obj = clz.newInstance();
+        Field[] declaredFields = obj.getClass().getDeclaredFields();
+        for(Field field:declaredFields){
+            int mod = field.getModifiers();
+            if(Modifier.isStatic(mod) || Modifier.isFinal(mod)){
+                continue;
+            }
+            field.setAccessible(true);
+            field.set(obj, map.get(field.getName()));
+        }
+        return obj;
+    }
+}

+ 209 - 12
collect-fees/collect-fees-service/src/main/java/com/tofly/fees/feesmgt/controller_easy/SfChargeEasyController.java

@@ -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");
+
+        //注意:jdbctype值为大写, 日期类型为DATE (yyyy-MM-dd)
+        //注意:jdbctype值为大写, 日期类型为TIMESTAMP (yyyy-MM-dd HH:mi:ss)
+        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");  //默认失败
+
+        //注意:jdbctype值为大写, 日期类型为DATE (yyyy-MM-dd)
+        //注意:jdbctype值为大写, 日期类型为TIMESTAMP (yyyy-MM-dd HH:mi:ss)
+        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("预存失败.");
+        }
+
+        // return ResultRespone.success(true);
+    }
+
+    @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"))
+                //.and(i->i.apply("charege_date<TO_DATE({0}, 'yyyy-MM-dd HH24:mi:ss')",DateUtils.formatDate(new Date(),"yyyy-MM-dd 23:59:59"))
+                //.le("charege_date",DateUtils.formatDate(new Date(),"yyyy-MM-dd 00:00:00"))
+                //.ge("charege_date",DateUtils.formatDate(new Date(),"yyyy-MM-dd 23:59:59"))
+                .groupBy("CHARGE_TYPE"); // 按照状态分组
+        List<Map<String, Object>> orderStats = sfChargeService.listMaps(wrapper);
+
+
+         int count=0;
+
+//        for(Map<String, Object> mapList : orderStats ) {
+//            for( String key : mapList.keySet() ) {
+//                System.out.println( key + "-->" + mapList.get(key) );
+//                if(key.equals("COUNT"))
+//                    count+=(Integer) mapList.get(key);
+//                if(key.equals("TOTAL_PRICE"))
+//                    count+=(Integer) mapList.get(key);
+//            }
+//        }
+
+        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);
+    }
+
 
 }

+ 1 - 0
collect-fees/collect-fees-service/src/main/java/com/tofly/fees/financialmgt/controller_easy/SfRecEasyController.java

@@ -54,6 +54,7 @@ public class SfRecEasyController extends BaseController {
                                          @RequestParam(value = "customerNo", defaultValue = "") String customerNo
     ) throws Exception {
 
+
         DbHelper db = DbHelper.getDbHelper();
         List<HashMap<String,Object>> lst=new ArrayList<>();
         //参数

+ 12 - 0
collect-fees/collect-fees-service/src/main/java/com/tofly/fees/userprofilemgt/entity/DaCustomerSelect.java

@@ -98,4 +98,16 @@ public class DaCustomerSelect extends Model<DaCustomerSelect> {
     @ExcelIgnore
     private String meterCardId;
 
+    @ExcelIgnore
+    private  String priceName;
+
+    @ExcelIgnore
+    private String  meterTypeName;
+
+    @ColumnWidth(1)
+    @ExcelProperty("证件类别")
+    private String certType;
+    @ColumnWidth(50)
+    @ExcelProperty("证件号码")
+    private String certNo;
 }

+ 9 - 2
collect-fees/collect-fees-service/src/main/resources/mapper/userprofilemgt/DaCustomerMapper.xml

@@ -32,10 +32,17 @@
         select  distinct a.customer_no customerNo,a.customer_no_old customerNoOld,  c.name mrArea ,d.name mrBook, a.customer_name
         customerName,a.customer_address customerAddress,a.customer_phone customerPhone,a.apply_datetime
         applyDatetime,a.created_datetime createdDatetime,a.created_oname createdOname,nvl(a.meternumber,0) meterNumber
-        ,a.customer_state customerState, e.last_reading lastReading,e.this_reading thisReading,b.METER_CARD_ID meterCardId  from tf_ywys_da_customer
+        ,a.customer_state customerState, e.last_reading lastReading,e.this_reading thisReading,b.METER_CARD_ID meterCardId
+        ,f.name priceName,g.name meterTypeName
+        from tf_ywys_da_customer
+        ,a.customer_state customerState,a.CERT_TYPE certType,a.CERT_NO certNo, e.last_reading lastReading,e.this_reading thisReading,b.METER_CARD_ID meterCardId  from tf_ywys_da_customer
         a inner join tf_ywys_da_meter b on a.CUSTOMER_NO=b.CUSTOMER_NO
         left join tf_ywys_bm_mr_area c on a.mr_area=c.code left join tf_ywys_bm_mr_book d on a.mr_book=d.code
-        left join tf_ywys_bw_meter_read_plan e on a.customer_no=e.customer_no where 1=1
+        left join tf_ywys_bw_meter_read_plan e on a.customer_no=e.customer_no
+        left join tf_ywys_bm_price f on b.price_code=f.code
+        left join tf_ywys_bm_meter_type g on b.meter_type=g.code
+
+        where 1=1
         <!--模糊查询 -->
         <if test="searchText != null and searchText != ''">
             and ( a.CUSTOMER_NO like '%${searchText}%' or a.CUSTOMER_NAME like '%${searchText}%' or a.CUSTOMER_ADDRESS like