Jelajahi Sumber

互市区管理,商户审核,银行字典,商铺管理

qzyReal 2 tahun lalu
induk
melakukan
3119cdbba9
21 mengubah file dengan 901 tambahan dan 452 penghapusan
  1. 1 1
      sp-core/sp-base/src/main/java/com/pj/current/satoken/SaTokenConfigure.java
  2. 3 0
      sp-core/sp-base/src/main/java/com/pj/current/satoken/StpUserUtil.java
  3. 2 2
      sp-core/sp-nacos/src/main/resources/bootstrap.properties
  4. 5 5
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java
  5. 27 7
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseController.java
  6. 63 62
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseMapper.xml
  7. 340 293
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseService.java
  8. 81 65
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartController.java
  9. 3 2
      sp-service/level-one-server/src/main/java/com/pj/tb_order/MethodOrderService.java
  10. 0 1
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderAppController.java
  11. 1 1
      sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsService.java
  12. 0 1
      sp-service/level-one-server/src/main/java/com/pj/tb_port_news/vo/TbPortNewsVo.java
  13. 3 5
      sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShop.java
  14. 2 4
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeArea.java
  15. 11 3
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaService.java
  16. 60 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBank.java
  17. 111 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBankController.java
  18. 55 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBankMapper.java
  19. 76 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBankMapper.xml
  20. 55 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBankService.java
  21. 2 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_district/TbDistrictController.java

+ 1 - 1
sp-core/sp-base/src/main/java/com/pj/current/satoken/SaTokenConfigure.java

@@ -44,7 +44,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
 					StaticLog.info("=======filter===token=======:{}",token);
 					//todo 暂时关闭token校验
 
-//                    SaIdUtil.checkToken(token);
+                    SaIdUtil.checkToken(token);
         		})
         		
         		// 异常处理函数  

+ 3 - 0
sp-core/sp-base/src/main/java/com/pj/current/satoken/StpUserUtil.java

@@ -45,6 +45,9 @@ public class StpUserUtil extends StpUtil{
         String info=RedisUtil.get(key);
         return StrUtil.isEmpty(info)?new PCLoginUserInfo():JSONUtil.toBean(info,PCLoginUserInfo.class);
     }
+    public static String getLoginName(){
+      return getPCLoginInfo().getLoginName();
+    }
 
 
     /**

+ 2 - 2
sp-core/sp-nacos/src/main/resources/bootstrap.properties

@@ -1,10 +1,10 @@
 # --------------------- nacos注册中心 --------------------- 
 ### nacos注册中心 - 地址
-spring.cloud.nacos.discovery.server-addr=47.101.143.145:4048
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8001
 ### nacos注册中心 - 用户
 spring.cloud.nacos.discovery.username=nacos
 ### nacos注册中心 - 密码
-spring.cloud.nacos.discovery.password=yie3Rjf@;1,43
+spring.cloud.nacos.discovery.password=nacos
 
 # --------------------- nacos配置中心 --------------------- 
 ### nacos配置中心 - 地址 [注册中心地址]

+ 5 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java

@@ -39,6 +39,7 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	public static final String PERMISSION_CODE = "tb-enterprise";
 	public static final String PERMISSION_CODE_ADD = "tb-enterprise-add";
 	public static final String PERMISSION_CODE_EDIT = "tb-enterprise-edit";
+	public static final String PERMISSION_CODE_JUDGE = "tb-enterprise-judge";
 	public static final String PERMISSION_CODE_DEL = "tb-enterprise-del";
 
 
@@ -125,6 +126,7 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	 *
 	 */
 	private String address;
+	private String detail;
 
 	/**
 	 *  
@@ -132,7 +134,7 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	private String agreement;
 
 	/**
-	 *  
+	 *  审核状态(0=未审核,1=审核通过,2=审核驳回)
 	 */
 	private int judgeStatus;
 
@@ -141,16 +143,16 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	 */
 	private String judgeContent;
 
+	private String judgeBy;
+
 	/**
 	 *  
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date judgeTime;
 
 	/**
 	 *  
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date registerTime;
 
 //	/**
@@ -161,7 +163,6 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	/**
 	 * 创建时间 
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date createTime;
 
 	/**
@@ -177,7 +178,6 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	/**
 	 * 更新时间 
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date updateTime;
 
 	/**

+ 27 - 7
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseController.java

@@ -99,8 +99,15 @@ public class TbEnterpriseController {
 		List<TbEnterprise> list = tbEnterpriseService.getList(so.startPage());
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
-	
-	
+
+	@RequestMapping("getAll")
+	@SaCheckPermission(TbEnterprise.PERMISSION_CODE)
+	public AjaxJson getAll() {
+		SoMap so = SoMap.getRequestSoMap();
+		so.put("delete_status",1);
+		List<TbEnterprise> list = tbEnterpriseService.getList(so);
+		return AjaxJson.getSuccessData(list);
+	}
 	
 	/** 改 - 删除状态(0=禁用,1=启用) */  
 	@RequestMapping("updateDeleteStatus")
@@ -151,11 +158,24 @@ public class TbEnterpriseController {
 	* @date
 	*/
 	@RequestMapping("audit")
-	@SaCheckPermission(TbEnterprise.PERMISSION_CODE_EDIT)
-	public AjaxJson audit(@RequestBody TbEnterpriseDto tbEnterpriseDto){
-
-		int line = tbEnterpriseService.audit(tbEnterpriseDto);
-		return AjaxJson.getByLine(line);
+	@SaCheckPermission(TbEnterprise.PERMISSION_CODE_JUDGE)
+	public AjaxJson audit(){
+		SoMap soMap=SoMap.getRequestSoMap();
+		Long id=soMap.getLong("id");
+		Integer judgeStatus=soMap.getInt("judgeStatus");
+		String judgeContent=soMap.getString("judgeContent");
+		tbEnterpriseService.audit(id,judgeStatus,judgeContent);
+		return AjaxJson.getSuccess();
+	}
+	@RequestMapping("auditBatch")
+	@SaCheckPermission(TbEnterprise.PERMISSION_CODE_JUDGE)
+	public AjaxJson auditBatch(){
+		SoMap soMap=SoMap.getRequestSoMap();
+		List<Long> ids=soMap.getListByComma("ids",Long.class);
+		Integer judgeStatus=soMap.getInt("judgeStatus");
+		String judgeContent=soMap.getString("judgeContent");
+		tbEnterpriseService.auditBatch(ids,judgeStatus,judgeContent);
+		return AjaxJson.getSuccess();
 	}
 
 

+ 63 - 62
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseMapper.xml

@@ -21,68 +21,69 @@
 	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
 	<select id="getList" resultMap="model">
 		<include refid="select_sql"></include>
-<!--		<where>-->
-<!--			<if test=' this.has("id") '> and id = #{id} </if>-->
-<!--			<if test=' this.has("name") '> and name = #{name} </if>-->
-<!--			<if test=' this.has("nationality") '> and nationality = #{nationality} </if>-->
-<!--			<if test=' this.has("type") '> and type = #{type} </if>-->
-<!--			<if test=' this.has("legalPerson") '> and legal_person = #{legalPerson} </if>-->
-<!--			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>-->
-<!--			<if test=' this.has("contact") '> and contact = #{contact} </if>-->
-<!--			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>-->
-<!--			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>-->
-<!--			<if test=' this.has("bankNo") '> and bank_no = #{bankNo} </if>-->
-<!--			<if test=' this.has("bankName") '> and bank_name = #{bankName} </if>-->
-<!--			<if test=' this.has("bankAccount") '> and bank_account = #{bankAccount} </if>-->
-<!--			<if test=' this.has("dutyParagraph") '> and duty_paragraph = #{dutyParagraph} </if>-->
-<!--			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>-->
-<!--			<if test=' this.has("address") '> and address = #{address} </if>-->
-<!--			<if test=' this.has("agreement") '> and agreement = #{agreement} </if>-->
-<!--			<if test=' this.has("judgeStatus") '> and judge_status = #{judgeStatus} </if>-->
-<!--			<if test=' this.has("judgeContent") '> and judge_content = #{judgeContent} </if>-->
-<!--			<if test=' this.has("judgeTime") '> and judge_time = #{judgeTime} </if>-->
-<!--			<if test=' this.has("registerTime") '> and register_time = #{registerTime} </if>-->
-<!--			<if test=' this.has("personId") '> and person_id = #{personId} </if>-->
-<!--			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>-->
-<!--			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>-->
-<!--			<if test=' this.has("createName") '> and create_name = #{createName} </if>-->
-<!--			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>-->
-<!--			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>-->
-<!--			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>-->
-<!--			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>-->
-<!--		</where>-->
-<!--		order by-->
-<!--		<choose>-->
-<!--			<when test='sortType == 1'> id desc </when>-->
-<!--			<when test='sortType == 2'> name desc </when>-->
-<!--			<when test='sortType == 3'> nationality desc </when>-->
-<!--			<when test='sortType == 4'> type desc </when>-->
-<!--			<when test='sortType == 5'> legal_person desc </when>-->
-<!--			<when test='sortType == 6'> id_card desc </when>-->
-<!--			<when test='sortType == 7'> contact desc </when>-->
-<!--			<when test='sortType == 8'> shop_id desc </when>-->
-<!--			<when test='sortType == 9'> shop_name desc </when>-->
-<!--			<when test='sortType == 10'> bank_no desc </when>-->
-<!--			<when test='sortType == 11'> bank_name desc </when>-->
-<!--			<when test='sortType == 12'> bank_account desc </when>-->
-<!--			<when test='sortType == 13'> duty_paragraph desc </when>-->
-<!--			<when test='sortType == 14'> address_ids desc </when>-->
-<!--			<when test='sortType == 15'> address desc </when>-->
-<!--			<when test='sortType == 16'> agreement desc </when>-->
-<!--			<when test='sortType == 17'> judge_status desc </when>-->
-<!--			<when test='sortType == 18'> judge_content desc </when>-->
-<!--			<when test='sortType == 19'> judge_time desc </when>-->
-<!--			<when test='sortType == 20'> register_time desc </when>-->
-<!--			<when test='sortType == 21'> person_id desc </when>-->
-<!--			<when test='sortType == 22'> create_time desc </when>-->
-<!--			<when test='sortType == 23'> create_by desc </when>-->
-<!--			<when test='sortType == 24'> create_name desc </when>-->
-<!--			<when test='sortType == 25'> update_time desc </when>-->
-<!--			<when test='sortType == 26'> update_by desc </when>-->
-<!--			<when test='sortType == 27'> update_name desc </when>-->
-<!--			<when test='sortType == 28'> delete_status desc </when>-->
-<!--			<otherwise> id desc </otherwise>-->
-<!--		</choose>-->
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("name") '> and name like concat('%',#{name},'%') </if>
+			<if test=' this.has("nationality") '> and nationality = #{nationality} </if>
+			<if test=' this.has("type") '> and type = #{type} </if>
+			<if test=' this.has("legalPerson") '> and legal_person = #{legalPerson} </if>
+			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>
+			<if test=' this.has("contact") '> and contact = #{contact} </if>
+			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>
+			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>
+			<if test=' this.has("bankNo") '> and bank_no = #{bankNo} </if>
+			<if test=' this.has("bankName") '> and bank_name = #{bankName} </if>
+			<if test=' this.has("bankAccount") '> and bank_account = #{bankAccount} </if>
+			<if test=' this.has("dutyParagraph") '> and duty_paragraph = #{dutyParagraph} </if>
+			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>
+			<if test=' this.has("address") '> and address = #{address} </if>
+			<if test=' this.has("agreement") '> and agreement = #{agreement} </if>
+			<if test=' this.has("judgeStatus") '> and judge_status = #{judgeStatus} </if>
+			<if test=' this.has("judgeList") '> and (judge_status = 0 or judge_status=2)</if>
+			<if test=' this.has("judgeContent") '> and judge_content = #{judgeContent} </if>
+			<if test=' this.has("judgeTime") '> and judge_time = #{judgeTime} </if>
+			<if test=' this.has("registerTime") '> and register_time = #{registerTime} </if>
+			<if test=' this.has("personId") '> and person_id = #{personId} </if>
+			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
+			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
+			<if test=' this.has("createName") '> and create_name = #{createName} </if>
+			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>
+			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
+			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
+			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> name desc </when>
+			<when test='sortType == 3'> nationality desc </when>
+			<when test='sortType == 4'> type desc </when>
+			<when test='sortType == 5'> legal_person desc </when>
+			<when test='sortType == 6'> id_card desc </when>
+			<when test='sortType == 7'> contact desc </when>
+			<when test='sortType == 8'> shop_id desc </when>
+			<when test='sortType == 9'> shop_name desc </when>
+			<when test='sortType == 10'> bank_no desc </when>
+			<when test='sortType == 11'> bank_name desc </when>
+			<when test='sortType == 12'> bank_account desc </when>
+			<when test='sortType == 13'> duty_paragraph desc </when>
+			<when test='sortType == 14'> address_ids desc </when>
+			<when test='sortType == 15'> address desc </when>
+			<when test='sortType == 16'> agreement desc </when>
+			<when test='sortType == 17'> judge_status desc </when>
+			<when test='sortType == 18'> judge_content desc </when>
+			<when test='sortType == 19'> judge_time desc </when>
+			<when test='sortType == 20'> register_time desc </when>
+			<when test='sortType == 21'> person_id desc </when>
+			<when test='sortType == 22'> create_time desc </when>
+			<when test='sortType == 23'> create_by desc </when>
+			<when test='sortType == 24'> create_name desc </when>
+			<when test='sortType == 25'> update_time desc </when>
+			<when test='sortType == 26'> update_by desc </when>
+			<when test='sortType == 27'> update_name desc </when>
+			<when test='sortType == 28'> delete_status desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
 	</select>
 
 	

+ 340 - 293
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseService.java

@@ -8,11 +8,14 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.pj.api.client.admin.AdminInterface;
+import com.pj.api.consts.FeignFactory;
+import com.pj.api.dto.DistrictDTO;
 import com.pj.api.dto.EnterpriseDto;
 import com.pj.common.core.exception.ServiceException;
 import com.pj.current.dto.APPLoginUserInfo;
@@ -25,6 +28,7 @@ import com.pj.tb_enterprise.param.EnterpriseParam;
 import com.pj.tb_enterprise.vo.OrdersVo;
 import com.pj.tb_order.TbOrder;
 import com.pj.tb_order.TbOrderMapper;
+import com.pj.utils.sg.AjaxError;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
@@ -44,302 +48,345 @@ import javax.swing.filechooser.FileSystemView;
 
 /**
  * Service: tb_enterprise -- 商家
+ *
  * @author qzy
  */
 @Service
 @Transactional(rollbackFor = Exception.class)
-public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnterprise> implements IService<TbEnterprise>{
-
-	/** 底层 Mapper 对象 */
-	@Autowired
-	TbEnterpriseMapper tbEnterpriseMapper;
-	/** rpc远程调用 */
-	@Autowired
-	AdminInterface adminInterface;
-	/** 订单表mapper */
-	@Autowired
-	private TbOrderMapper tbOrderMapper;
-
-	/** 非事务方法调用事务方法需要代理对象 */
-	@Autowired
-	private MethodEnterpriseService methodEnterpriseService;
-
-	/** 增 */
-	void add(TbEnterprise t){
-		save(t);
-	}
-
-	/** 删 */
-	void delete(Long id){
-		removeById(id);
-	}
-
-	/** 改 */
-	void update(TbEnterprise t){
-		updateById(t);
-
-	}
-
-	/** 查 */
-	TbEnterprise getById(Long id){
-		return super.getById(id);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
-	List<TbEnterprise> getList(SoMap so) {
-		return tbEnterpriseMapper.getList(so);
-	}
-
-	public int audit(TbEnterpriseDto tbEnterpriseDto){
-
-		// 获取当前登录用户id
-		Long loginId = StpUserUtil.getLoginIdAsLong();
-		// 根据id获取商户
-		TbEnterprise tbEnterprise = tbEnterpriseMapper.selectById(tbEnterpriseDto.getId());
-		// 如果商户不存在则抛出异常
-		if(Objects.isNull(tbEnterprise)){
-			throw new RuntimeException("该商户不存在");
-		}
-		BeanUtils.copyProperties(tbEnterpriseDto,tbEnterprise);
-		// 写入更新者id
-		tbEnterprise.setUpdateBy(String.valueOf(loginId));
-		// 更新商户审核状态
-		int line = tbEnterpriseMapper.updateById(tbEnterprise);
-		return line;
-	}
-
-	public int isLock(TbEnterpriseDto tbEnterpriseDto) {
-		// 获取当前登录用户id
-		Long loginId = StpUserUtil.getLoginIdAsLong();
-		// 根据id获取商户
-		TbEnterprise tbEnterprise = tbEnterpriseMapper.selectById(tbEnterpriseDto.getId());
-		// 如果商户不存在则抛出异常
-		if(Objects.isNull(tbEnterprise)){
-			throw new RuntimeException("该商户不存在");
-		}
-		BeanUtils.copyProperties(tbEnterpriseDto,tbEnterprise);
-		// 写入更新者id
-		tbEnterprise.setUpdateBy(String.valueOf(loginId));
-		// 更新商户锁定状态
-		int  line = tbEnterpriseMapper.updateById(tbEnterprise);
-		//获取商户锁定状态
-		int isLock = tbEnterprise.getIsLock();
-		// 如果商户被锁住则禁止app端登录
-		// TODO
-		adminInterface.isLock(String.valueOf(tbEnterprise.getId()), People.PEOPLE_TYPE_TWO.getCode(),isLock);
-
-		return line;
-	}
-
-	/**
-	 * 商家认证
-	 * @param enterpriseParam
-	 * @return
-	 */
-	boolean identification(EnterpriseParam enterpriseParam){
-
-		//手机号去重
-		String linkPhone = enterpriseParam.getLinkPhone();
-		if(tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getIdCard,linkPhone).eq(TbEnterprise::getDeleteStatus,DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
-			throw new RuntimeException("当前手机号已被认证!");
-		//身份证号去重
-		String contact = enterpriseParam.getCorporateIdCard();
-		if(tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getContact,contact).eq(TbEnterprise::getDeleteStatus,DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
-			throw new RuntimeException("当前身份证号已被认证!");
-		//判断是否重复提交
-		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
-		if(appLoginInfo == null || appLoginInfo.getLoginId() == null)
-			throw new RuntimeException("当前登录账号信息已失效!");
-		//重复提交验证
-		methodEnterpriseService.againApply(appLoginInfo.getFk());
-		//todo:是否需要手机发送验证码认证?
-
-		//开始保存商家信息
-		TbEnterprise tbEnterprise = new TbEnterprise();
-		//保存基本信息
-		tbEnterprise.setName(enterpriseParam.getName());
-		tbEnterprise.setNationality("China");
-		tbEnterprise.setLegalPerson(enterpriseParam.getCorporateName());
-		tbEnterprise.setIdCard(enterpriseParam.getCorporateIdCard());
-		tbEnterprise.setContact(enterpriseParam.getLinkPhone());
-		tbEnterprise.setBusinessLicense(enterpriseParam.getBusinessLicense());
-		tbEnterprise.setBankName(enterpriseParam.getBankName());
-		tbEnterprise.setBankAccount(enterpriseParam.getBankAccount());
-		tbEnterprise.setBankNo(enterpriseParam.getBankNo());
-		tbEnterprise.setDutyParagraph(enterpriseParam.getDutyParagraph());
-		//默认待审核
-		tbEnterprise.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode());
-
-		//注册/认证时间
-		tbEnterprise.setRegisterTime(new Date());
-		//创建时间
-		tbEnterprise.setCreateTime(new Date());
-		//删除状态:启用
-		tbEnterprise.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
-
-		// 保存商家信息
-		int insert = tbEnterpriseMapper.insert(tbEnterprise);
-		return insert == 1;
-	}
-
-
-
-	/** 管理一级市场的贸易订单。
-	 * 列表(主要展示字段:订单号、下单时间、商品名称、图片、价格、购买的边民组、订单状态、物流信息)、
-	 * 确认退货/退款;
-	 * 物流状态  SoMap soMap
-	 */
-	public List<OrdersVo> manageLevelOneOrders(SoMap so,String keyword){
-
-		//获取当前登录用户
-		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
-		if(appLoginInfo == null || appLoginInfo.getLoginId() == null)throw new RuntimeException("当前登陆用户信息已失效!");
-		Long fk = appLoginInfo.getFk();
-		//仅能查询自己的订单
-		so.set("buyUserId",fk);
-		so.set("deleteStatus",DeleteStatus.DELETE_STATUS_ON.getCode());
-		so.set("keyword",keyword);
-
-		List<TbOrder> tbOrders = tbOrderMapper.getList(so);
-		//执行数据封装
-		List<OrdersVo> ordersVos = methodEnterpriseService.orderListChangeVo(tbOrders);
-		return ordersVos;
-	}
-
-
-	/**
-	 * 导入
-	 * @param file excel文件
-	 * @return
-	 * @throws IOException
-	 */
-	public String importData(MultipartFile file) throws IOException {
-		System.out.println("\n开始执行文件上传....\n");
-
-		//判空
-		if(file.isEmpty()) return "文件为空,无法执行上传...";
-		//获取文件上传数据
-		HSSFWorkbook wb = new HSSFWorkbook(file.getInputStream());
-		//获取第一页sheet
-		HSSFSheet sheet = wb.getSheetAt(0);
-		//定义计数器
-		int count = 0;
-		//定义行对象
-		HSSFRow row = null;
-		//解析数据封装到集合
-		count = methodEnterpriseService.importMethod(row, sheet, count);
-		wb.close();
-		System.out.println("\n文件上传完成,共上传 " + count + "条 " + "数据...\n");
-		return "上传完成,共上传"  + count + "条"  + "数据。";
-	}
-
-	/**
-	 * 导出 excel文件
-	 * @param keyword
-	 * @return
-	 */
-	public String outportExcel(String keyword,String filepath) throws IOException {
-		System.out.println("\n开始执行文件导出....\n");
-		//导出的文件的路径
-		if(filepath == null || filepath.trim().equals("")){
-			// 获取当前用户的桌面路径
-			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
-			filepath = fileSystemView.getHomeDirectory().getPath();
-		}
-		filepath = filepath + "\\商家数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
-		//根据需求查询数据
-		List<TbEnterprise> selectedList = tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(StringUtils.isNoneBlank(keyword), TbEnterprise::getName, keyword));
-		if(selectedList.size() == 0)return "没有可导出的数据。";
-		//建立excel对象封装数据
-		HSSFWorkbook workbook = new HSSFWorkbook();
-		//创建excel表格右下角的sheet页名称
-		HSSFSheet sheet = workbook.createSheet("1");
-		//创建表头
-		HSSFRow row = sheet.createRow(0);
-		row.createCell(0).setCellValue("序号");
-		row.createCell(1).setCellValue("名称");
-		row.createCell(2).setCellValue("国别");
-		row.createCell(3).setCellValue("商户分类");
-		row.createCell(4).setCellValue("法人");
-		row.createCell(5).setCellValue("身份证号");
-		row.createCell(6).setCellValue("手机号码");
-		row.createCell(7).setCellValue("营业执照");
-		row.createCell(8).setCellValue("所在铺位");
-		row.createCell(9).setCellValue("所在铺位名称");
-		row.createCell(10).setCellValue("银行编号");
-		row.createCell(11).setCellValue("银行名称");
-		row.createCell(12).setCellValue("银行账号");
-		row.createCell(13).setCellValue("银行税号");
-		row.createCell(14).setCellValue("地址ID集合");
-		row.createCell(15).setCellValue("地址");
-		row.createCell(16).setCellValue("agreement");
-		row.createCell(17).setCellValue("judge_status");
-		row.createCell(18).setCellValue("judge_content");
-		row.createCell(19).setCellValue("judge_time");
-		row.createCell(20).setCellValue("注册时间");
-		row.createCell(21).setCellValue("人物编号");
-		row.createCell(22).setCellValue("创建时间");
-		row.createCell(23).setCellValue("创建人编号");
-		row.createCell(24).setCellValue("创建人名称");
-		row.createCell(25).setCellValue("更新时间");
-		row.createCell(26).setCellValue("更新人编号");
-		row.createCell(27).setCellValue("更新人名称");
-		row.createCell(28).setCellValue("删除状态");
-
-		//定义计数器
-		int count = 0;
-		//遍历集合
-		for (int i = 0; i < selectedList.size(); i++) {
-			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
-			sheetRow.createCell(0).setCellValue(i + 1);
-			sheetRow.createCell(1).setCellValue((selectedList.get(i).getName() + "").equals("null")? "": selectedList.get(i).getName() + "");
-			sheetRow.createCell(2).setCellValue((selectedList.get(i).getNationality() + "").equals("null")? "": selectedList.get(i).getNationality() + "");
-			sheetRow.createCell(3).setCellValue((selectedList.get(i).getType() + "").equals("null")? "": selectedList.get(i).getType() + "");
-			sheetRow.createCell(4).setCellValue((selectedList.get(i).getLegalPerson() + "").equals("null")? "": selectedList.get(i).getLegalPerson() + "");
-			sheetRow.createCell(5).setCellValue((selectedList.get(i).getIdCard() + "").equals("null")? "": selectedList.get(i).getIdCard() + "");
-			sheetRow.createCell(6).setCellValue((selectedList.get(i).getContact() + "").equals("null")? "": selectedList.get(i).getContact() + "");
-			sheetRow.createCell(7).setCellValue((selectedList.get(i).getBusinessLicense() + "").equals("null")? "": selectedList.get(i).getBusinessLicense() + "");
-			sheetRow.createCell(8).setCellValue((selectedList.get(i).getShopId() + "" ).equals("null")? "": selectedList.get(i).getShopId() + "");
-			sheetRow.createCell(9).setCellValue((selectedList.get(i).getShopName() + "").equals("null")? "": selectedList.get(i).getShopName() + "");
-			sheetRow.createCell(10).setCellValue((selectedList.get(i).getBankNo() + "").equals("null")? "": selectedList.get(i).getBankNo() + "");
-			sheetRow.createCell(11).setCellValue((selectedList.get(i).getBankName() + "").equals("null")? "": selectedList.get(i).getBankName() + "");
-			sheetRow.createCell(12).setCellValue((selectedList.get(i).getBankAccount() + "").equals("null")? "": selectedList.get(i).getBankAccount() + "");
-			sheetRow.createCell(13).setCellValue((selectedList.get(i).getDutyParagraph() + "").equals("null")? "": selectedList.get(i).getDutyParagraph() + "");
-			sheetRow.createCell(14).setCellValue((selectedList.get(i).getAddressIds() + "").equals("null")? "": selectedList.get(i).getAddressIds() + "");
-			sheetRow.createCell(15).setCellValue((selectedList.get(i).getAddress() + "").equals("null")? "": selectedList.get(i).getAddress() + "");
-			sheetRow.createCell(16).setCellValue((selectedList.get(i).getAgreement() + "").equals("null")? "": selectedList.get(i).getAgreement() + "");
-			sheetRow.createCell(17).setCellValue((selectedList.get(i).getJudgeStatus() + "").equals("null")? "": selectedList.get(i).getJudgeStatus() + "");
-			sheetRow.createCell(18).setCellValue((selectedList.get(i).getJudgeContent() + "").equals("null")? "": selectedList.get(i).getJudgeContent() + "");
-			sheetRow.createCell(19).setCellValue((selectedList.get(i).getJudgeTime() + "").equals("null")? "": selectedList.get(i).getJudgeTime() + "");
-			sheetRow.createCell(20).setCellValue((selectedList.get(i).getRegisterTime() + "").equals("null")? "": selectedList.get(i).getRegisterTime() + "");
+public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnterprise> implements IService<TbEnterprise> {
+
+    /**
+     * 底层 Mapper 对象
+     */
+    @Autowired
+    TbEnterpriseMapper tbEnterpriseMapper;
+    /**
+     * rpc远程调用
+     */
+    @Autowired
+    AdminInterface adminInterface;
+    /**
+     * 订单表mapper
+     */
+    @Autowired
+    private TbOrderMapper tbOrderMapper;
+
+    /**
+     * 非事务方法调用事务方法需要代理对象
+     */
+    @Autowired
+    private MethodEnterpriseService methodEnterpriseService;
+
+    /**
+     * 增
+     */
+    void add(TbEnterprise t) {
+        List<DistrictDTO>districtDTOS= FeignFactory.adminInterface.getDistrictList(t.getAddressIds());
+        t.setAddress(districtDTOS.stream().map(DistrictDTO::getDistrict).collect(Collectors.joining()))
+                .setCreateTime(new Date()).setCreateName(StpUserUtil.getPCLoginInfo().getLoginName());
+        save(t);
+    }
+
+    /**
+     * 删
+     */
+    void delete(Long id) {
+        removeById(id);
+    }
+
+    /**
+     * 改
+     */
+    void update(TbEnterprise t) {
+        List<DistrictDTO>districtDTOS= FeignFactory.adminInterface.getDistrictList(t.getAddressIds());
+        t.setAddress(districtDTOS.stream().map(DistrictDTO::getDistrict).collect(Collectors.joining()))
+                .setCreateTime(new Date()).setCreateName(StpUserUtil.getPCLoginInfo().getLoginName());
+        updateById(t);
+
+    }
+
+    /**
+     * 查
+     */
+    TbEnterprise getById(Long id) {
+        return super.getById(id);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    List<TbEnterprise> getList(SoMap so) {
+        return tbEnterpriseMapper.getList(so);
+    }
+
+
+    public int isLock(TbEnterpriseDto tbEnterpriseDto) {
+        // 获取当前登录用户id
+        Long loginId = StpUserUtil.getLoginIdAsLong();
+        // 根据id获取商户
+        TbEnterprise tbEnterprise = tbEnterpriseMapper.selectById(tbEnterpriseDto.getId());
+        // 如果商户不存在则抛出异常
+        if (Objects.isNull(tbEnterprise)) {
+            throw new RuntimeException("该商户不存在");
+        }
+        BeanUtils.copyProperties(tbEnterpriseDto, tbEnterprise);
+        // 写入更新者id
+        tbEnterprise.setUpdateBy(String.valueOf(loginId));
+        // 更新商户锁定状态
+        int line = tbEnterpriseMapper.updateById(tbEnterprise);
+        //获取商户锁定状态
+        int isLock = tbEnterprise.getIsLock();
+        // 如果商户被锁住则禁止app端登录
+        // TODO
+        adminInterface.isLock(String.valueOf(tbEnterprise.getId()), People.PEOPLE_TYPE_TWO.getCode(), isLock);
+
+        return line;
+    }
+
+    /**
+     * 商家认证
+     *
+     * @param enterpriseParam
+     * @return
+     */
+    boolean identification(EnterpriseParam enterpriseParam) {
+
+        //手机号去重
+        String linkPhone = enterpriseParam.getLinkPhone();
+        if (tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getIdCard, linkPhone).eq(TbEnterprise::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
+            throw new RuntimeException("当前手机号已被认证!");
+        //身份证号去重
+        String contact = enterpriseParam.getCorporateIdCard();
+        if (tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getContact, contact).eq(TbEnterprise::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
+            throw new RuntimeException("当前身份证号已被认证!");
+        //判断是否重复提交
+        APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
+        if (appLoginInfo == null || appLoginInfo.getLoginId() == null)
+            throw new RuntimeException("当前登录账号信息已失效!");
+        //重复提交验证
+        methodEnterpriseService.againApply(appLoginInfo.getFk());
+        //todo:是否需要手机发送验证码认证?
+
+        //开始保存商家信息
+        TbEnterprise tbEnterprise = new TbEnterprise();
+        //保存基本信息
+        tbEnterprise.setName(enterpriseParam.getName());
+        tbEnterprise.setNationality("China");
+        tbEnterprise.setLegalPerson(enterpriseParam.getCorporateName());
+        tbEnterprise.setIdCard(enterpriseParam.getCorporateIdCard());
+        tbEnterprise.setContact(enterpriseParam.getLinkPhone());
+        tbEnterprise.setBusinessLicense(enterpriseParam.getBusinessLicense());
+        tbEnterprise.setBankName(enterpriseParam.getBankName());
+        tbEnterprise.setBankAccount(enterpriseParam.getBankAccount());
+        tbEnterprise.setBankNo(enterpriseParam.getBankNo());
+        tbEnterprise.setDutyParagraph(enterpriseParam.getDutyParagraph());
+        //默认待审核
+        tbEnterprise.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode());
+
+        //注册/认证时间
+        tbEnterprise.setRegisterTime(new Date());
+        //创建时间
+        tbEnterprise.setCreateTime(new Date());
+        //删除状态:启用
+        tbEnterprise.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
+
+        // 保存商家信息
+        int insert = tbEnterpriseMapper.insert(tbEnterprise);
+        return insert == 1;
+    }
+
+
+    /**
+     * 管理一级市场的贸易订单。
+     * 列表(主要展示字段:订单号、下单时间、商品名称、图片、价格、购买的边民组、订单状态、物流信息)、
+     * 确认退货/退款;
+     * 物流状态  SoMap soMap
+     */
+    public List<OrdersVo> manageLevelOneOrders(SoMap so, String keyword) {
+
+        //获取当前登录用户
+        APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
+        if (appLoginInfo == null || appLoginInfo.getLoginId() == null)
+            throw new RuntimeException("当前登陆用户信息已失效!");
+        Long fk = appLoginInfo.getFk();
+        //仅能查询自己的订单
+        so.set("buyUserId", fk);
+        so.set("deleteStatus", DeleteStatus.DELETE_STATUS_ON.getCode());
+        so.set("keyword", keyword);
+
+        List<TbOrder> tbOrders = tbOrderMapper.getList(so);
+        //执行数据封装
+        List<OrdersVo> ordersVos = methodEnterpriseService.orderListChangeVo(tbOrders);
+        return ordersVos;
+    }
+
+
+    /**
+     * 导入
+     *
+     * @param file excel文件
+     * @return
+     * @throws IOException
+     */
+    public String importData(MultipartFile file) throws IOException {
+        System.out.println("\n开始执行文件上传....\n");
+
+        //判空
+        if (file.isEmpty()) return "文件为空,无法执行上传...";
+        //获取文件上传数据
+        HSSFWorkbook wb = new HSSFWorkbook(file.getInputStream());
+        //获取第一页sheet
+        HSSFSheet sheet = wb.getSheetAt(0);
+        //定义计数器
+        int count = 0;
+        //定义行对象
+        HSSFRow row = null;
+        //解析数据封装到集合
+        count = methodEnterpriseService.importMethod(row, sheet, count);
+        wb.close();
+        System.out.println("\n文件上传完成,共上传 " + count + "条 " + "数据...\n");
+        return "上传完成,共上传" + count + "条" + "数据。";
+    }
+
+    /**
+     * 导出 excel文件
+     *
+     * @param keyword
+     * @return
+     */
+    public String outportExcel(String keyword, String filepath) throws IOException {
+        System.out.println("\n开始执行文件导出....\n");
+        //导出的文件的路径
+        if (filepath == null || filepath.trim().equals("")) {
+            // 获取当前用户的桌面路径
+            FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+            filepath = fileSystemView.getHomeDirectory().getPath();
+        }
+        filepath = filepath + "\\商家数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+        //根据需求查询数据
+        List<TbEnterprise> selectedList = tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(StringUtils.isNoneBlank(keyword), TbEnterprise::getName, keyword));
+        if (selectedList.size() == 0) return "没有可导出的数据。";
+        //建立excel对象封装数据
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        //创建excel表格右下角的sheet页名称
+        HSSFSheet sheet = workbook.createSheet("1");
+        //创建表头
+        HSSFRow row = sheet.createRow(0);
+        row.createCell(0).setCellValue("序号");
+        row.createCell(1).setCellValue("名称");
+        row.createCell(2).setCellValue("国别");
+        row.createCell(3).setCellValue("商户分类");
+        row.createCell(4).setCellValue("法人");
+        row.createCell(5).setCellValue("身份证号");
+        row.createCell(6).setCellValue("手机号码");
+        row.createCell(7).setCellValue("营业执照");
+        row.createCell(8).setCellValue("所在铺位");
+        row.createCell(9).setCellValue("所在铺位名称");
+        row.createCell(10).setCellValue("银行编号");
+        row.createCell(11).setCellValue("银行名称");
+        row.createCell(12).setCellValue("银行账号");
+        row.createCell(13).setCellValue("银行税号");
+        row.createCell(14).setCellValue("地址ID集合");
+        row.createCell(15).setCellValue("地址");
+        row.createCell(16).setCellValue("agreement");
+        row.createCell(17).setCellValue("judge_status");
+        row.createCell(18).setCellValue("judge_content");
+        row.createCell(19).setCellValue("judge_time");
+        row.createCell(20).setCellValue("注册时间");
+        row.createCell(21).setCellValue("人物编号");
+        row.createCell(22).setCellValue("创建时间");
+        row.createCell(23).setCellValue("创建人编号");
+        row.createCell(24).setCellValue("创建人名称");
+        row.createCell(25).setCellValue("更新时间");
+        row.createCell(26).setCellValue("更新人编号");
+        row.createCell(27).setCellValue("更新人名称");
+        row.createCell(28).setCellValue("删除状态");
+
+        //定义计数器
+        int count = 0;
+        //遍历集合
+        for (int i = 0; i < selectedList.size(); i++) {
+            HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
+            sheetRow.createCell(0).setCellValue(i + 1);
+            sheetRow.createCell(1).setCellValue((selectedList.get(i).getName() + "").equals("null") ? "" : selectedList.get(i).getName() + "");
+            sheetRow.createCell(2).setCellValue((selectedList.get(i).getNationality() + "").equals("null") ? "" : selectedList.get(i).getNationality() + "");
+            sheetRow.createCell(3).setCellValue((selectedList.get(i).getType() + "").equals("null") ? "" : selectedList.get(i).getType() + "");
+            sheetRow.createCell(4).setCellValue((selectedList.get(i).getLegalPerson() + "").equals("null") ? "" : selectedList.get(i).getLegalPerson() + "");
+            sheetRow.createCell(5).setCellValue((selectedList.get(i).getIdCard() + "").equals("null") ? "" : selectedList.get(i).getIdCard() + "");
+            sheetRow.createCell(6).setCellValue((selectedList.get(i).getContact() + "").equals("null") ? "" : selectedList.get(i).getContact() + "");
+            sheetRow.createCell(7).setCellValue((selectedList.get(i).getBusinessLicense() + "").equals("null") ? "" : selectedList.get(i).getBusinessLicense() + "");
+            sheetRow.createCell(8).setCellValue((selectedList.get(i).getShopId() + "").equals("null") ? "" : selectedList.get(i).getShopId() + "");
+            sheetRow.createCell(9).setCellValue((selectedList.get(i).getShopName() + "").equals("null") ? "" : selectedList.get(i).getShopName() + "");
+            sheetRow.createCell(10).setCellValue((selectedList.get(i).getBankNo() + "").equals("null") ? "" : selectedList.get(i).getBankNo() + "");
+            sheetRow.createCell(11).setCellValue((selectedList.get(i).getBankName() + "").equals("null") ? "" : selectedList.get(i).getBankName() + "");
+            sheetRow.createCell(12).setCellValue((selectedList.get(i).getBankAccount() + "").equals("null") ? "" : selectedList.get(i).getBankAccount() + "");
+            sheetRow.createCell(13).setCellValue((selectedList.get(i).getDutyParagraph() + "").equals("null") ? "" : selectedList.get(i).getDutyParagraph() + "");
+            sheetRow.createCell(14).setCellValue((selectedList.get(i).getAddressIds() + "").equals("null") ? "" : selectedList.get(i).getAddressIds() + "");
+            sheetRow.createCell(15).setCellValue((selectedList.get(i).getAddress() + "").equals("null") ? "" : selectedList.get(i).getAddress() + "");
+            sheetRow.createCell(16).setCellValue((selectedList.get(i).getAgreement() + "").equals("null") ? "" : selectedList.get(i).getAgreement() + "");
+            sheetRow.createCell(17).setCellValue((selectedList.get(i).getJudgeStatus() + "").equals("null") ? "" : selectedList.get(i).getJudgeStatus() + "");
+            sheetRow.createCell(18).setCellValue((selectedList.get(i).getJudgeContent() + "").equals("null") ? "" : selectedList.get(i).getJudgeContent() + "");
+            sheetRow.createCell(19).setCellValue((selectedList.get(i).getJudgeTime() + "").equals("null") ? "" : selectedList.get(i).getJudgeTime() + "");
+            sheetRow.createCell(20).setCellValue((selectedList.get(i).getRegisterTime() + "").equals("null") ? "" : selectedList.get(i).getRegisterTime() + "");
 //			sheetRow.createCell(21).setCellValue((selectedList.get(i).getPersonId() + "").equals("null")? "": selectedList.get(i).getPersonId() + "");
-			sheetRow.createCell(22).setCellValue((selectedList.get(i).getCreateTime() + "").equals("null")? "": selectedList.get(i).getCreateTime() + "");
-			sheetRow.createCell(23).setCellValue((selectedList.get(i).getCreateBy() + "").equals("null")? "": selectedList.get(i).getCreateBy() + "");
-			sheetRow.createCell(24).setCellValue((selectedList.get(i).getCreateName() + "").equals("null")? "": selectedList.get(i).getCreateName() + "");
-			sheetRow.createCell(25).setCellValue((selectedList.get(i).getUpdateTime() + "").equals("null")? "": selectedList.get(i).getUpdateTime() + "");
-			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
-			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
-			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
-			count += 1;
-		}
-		//建立输出流,输出文件
-		FileOutputStream fos = new FileOutputStream(filepath);
-
-		workbook.write(fos);
-		fos.flush();
-		//关闭输出流
-		fos.close();
-		workbook.close();
-		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
-		return "数据导出完成!共导出 " + count + " 条数据。";
-	}
-
-	/** 远程调用方法 注册身份为互市区商家时调用*/
-	public boolean enterpriseDto(EnterpriseDto enterpriseDto){
-		TbEnterprise tbEnterprise = new TbEnterprise();
-		BeanUtils.copyProperties(enterpriseDto,tbEnterprise);
-		boolean save = this.save(tbEnterprise);
-		return save;
-	}
-
+            sheetRow.createCell(22).setCellValue((selectedList.get(i).getCreateTime() + "").equals("null") ? "" : selectedList.get(i).getCreateTime() + "");
+            sheetRow.createCell(23).setCellValue((selectedList.get(i).getCreateBy() + "").equals("null") ? "" : selectedList.get(i).getCreateBy() + "");
+            sheetRow.createCell(24).setCellValue((selectedList.get(i).getCreateName() + "").equals("null") ? "" : selectedList.get(i).getCreateName() + "");
+            sheetRow.createCell(25).setCellValue((selectedList.get(i).getUpdateTime() + "").equals("null") ? "" : selectedList.get(i).getUpdateTime() + "");
+            sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null") ? "" : selectedList.get(i).getUpdateBy() + "");
+            sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null") ? "" : selectedList.get(i).getUpdateName() + "");
+            sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null") ? "" : selectedList.get(i).getDeleteStatus() + "");
+            count += 1;
+        }
+        //建立输出流,输出文件
+        FileOutputStream fos = new FileOutputStream(filepath);
+
+        workbook.write(fos);
+        fos.flush();
+        //关闭输出流
+        fos.close();
+        workbook.close();
+        System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+        return "数据导出完成!共导出 " + count + " 条数据。";
+    }
+
+    /**
+     * 远程调用方法 注册身份为互市区商家时调用
+     */
+    public boolean enterpriseDto(EnterpriseDto enterpriseDto) {
+        TbEnterprise tbEnterprise = new TbEnterprise();
+        BeanUtils.copyProperties(enterpriseDto, tbEnterprise);
+        boolean save = this.save(tbEnterprise);
+        return save;
+    }
+
+    public void audit(Long id, Integer judgeStatus, String judgeContent) {
+        TbEnterprise tbEnterprise = this.getById(id);
+        if (tbEnterprise == null) {
+            throw new AjaxError("商户不存在");
+        }
+        String name = StpUserUtil.getLoginName();
+        tbEnterprise.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date())
+                .setJudgeBy(name);
+        this.updateById(tbEnterprise);
+    }
+
+    /**
+     * 批量审核
+     * @param ids
+     * @param judgeStatus
+     * @param judgeContent
+     */
+    public void auditBatch(List<Long> ids, Integer judgeStatus, String judgeContent) {
+        if (ids.isEmpty()) {
+            throw new AjaxError("必要参数不能为空");
+        }
+        List<TbEnterprise> list = listByIds(ids);
+        String name = StpUserUtil.getLoginName();
+        list.forEach(tbEnterprise -> {
+            tbEnterprise.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date())
+                    .setJudgeBy(name);
+        });
+        this.updateBatchById(list);
+    }
 }

+ 81 - 65
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartController.java

@@ -14,75 +14,91 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 
 /**
  * Controller: tb_goods_cart -- 购物车
- * @author qzy 
+ *
+ * @author qzy
  */
 @RestController
 @RequestMapping("/TbGoodsCart/")
 public class TbGoodsCartController {
 
-	/** 底层 Service 对象 */
-	@Autowired
-	TbGoodsCartService tbGoodsCartService;
-
-	/** 增 */  
-	@RequestMapping("add")
-	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_ADD)
-	public AjaxJson add(TbGoodsCart t){
-		tbGoodsCartService.add(t);
-		t = tbGoodsCartService.getById(SP.publicMapper.getPrimarykey());
-		return AjaxJson.getSuccessData(t);
-	}
-
-	/** 删 */  
-	@RequestMapping("delete")
-	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_DEL)
-	public AjaxJson delete(Long id){
-		 tbGoodsCartService.delete(id);
-		return AjaxJson.getSuccess();
-	}
-	
-	/** 删 - 根据id列表 */  
-	@RequestMapping("deleteByIds")
-	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_DEL)
-	public AjaxJson deleteByIds(){
-		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
-		int line = SP.publicMapper.deleteByIds(TbGoodsCart.TABLE_NAME, ids);
-		return AjaxJson.getByLine(line);
-	}
-	
-	/** 改 */  
-	@RequestMapping("update")
-	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_EDIT)
-	public AjaxJson update(TbGoodsCart t){
-		tbGoodsCartService.update(t);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 查 - 根据id */  
-	@RequestMapping("getById")
-		@SaCheckPermission(TbGoodsCart.PERMISSION_CODE)
-	public AjaxJson getById(String id){
-		TbGoodsCart t = tbGoodsCartService.getById(id);
-		return AjaxJson.getSuccessData(t);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	@RequestMapping("getList")
-		@SaCheckPermission(TbGoodsCart.PERMISSION_CODE)
-	public AjaxJson getList() { 
-		SoMap so = SoMap.getRequestSoMap();
-		List<TbGoodsCart> list = tbGoodsCartService.getList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-	
-	
-	
-	/** 改 - 删除状态(0=禁用,1=启用) */  
-	@RequestMapping("updateDeleteStatus")
-	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_EDIT)
-	public AjaxJson updateDeleteStatus(String id, Integer value){
-		int line = SP.publicMapper.updateColumnById(TbGoodsCart.TABLE_NAME, "delete_status", value, id);
-		return AjaxJson.getByLine(line);
-	}
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbGoodsCartService tbGoodsCartService;
+
+    /**
+     * 增
+     */
+    @RequestMapping("add")
+    @SaCheckPermission(TbGoodsCart.PERMISSION_CODE_ADD)
+    public AjaxJson add(TbGoodsCart t) {
+        tbGoodsCartService.add(t);
+        t = tbGoodsCartService.getById(SP.publicMapper.getPrimarykey());
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 删
+     */
+    @RequestMapping("delete")
+    @SaCheckPermission(TbGoodsCart.PERMISSION_CODE_DEL)
+    public AjaxJson delete(Long id) {
+        tbGoodsCartService.delete(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 删 - 根据id列表
+     */
+    @RequestMapping("deleteByIds")
+    @SaCheckPermission(TbGoodsCart.PERMISSION_CODE_DEL)
+    public AjaxJson deleteByIds() {
+        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+        int line = SP.publicMapper.deleteByIds(TbGoodsCart.TABLE_NAME, ids);
+        return AjaxJson.getByLine(line);
+    }
+
+    /**
+     * 改
+     */
+    @RequestMapping("update")
+    @SaCheckPermission(TbGoodsCart.PERMISSION_CODE_EDIT)
+    public AjaxJson update(TbGoodsCart t) {
+        tbGoodsCartService.update(t);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 查 - 根据id
+     */
+    @RequestMapping("getById")
+    @SaCheckPermission(TbGoodsCart.PERMISSION_CODE)
+    public AjaxJson getById(String id) {
+        TbGoodsCart t = tbGoodsCartService.getById(id);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    //@SaCheckPermission(TbGoodsCart.PERMISSION_CODE)
+    public AjaxJson getList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbGoodsCart> list = tbGoodsCartService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+
+    /**
+     * 改 - 删除状态(0=禁用,1=启用)
+     */
+    @RequestMapping("updateDeleteStatus")
+    @SaCheckPermission(TbGoodsCart.PERMISSION_CODE_EDIT)
+    public AjaxJson updateDeleteStatus(String id, Integer value) {
+        int line = SP.publicMapper.updateColumnById(TbGoodsCart.TABLE_NAME, "delete_status", value, id);
+        return AjaxJson.getByLine(line);
+    }
 
 }

+ 3 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_order/MethodOrderService.java

@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -30,8 +31,8 @@ public class MethodOrderService {
      * @param userType
      */
     public List<TbOrder> checkType(Integer userType, Long fk, SoMap so){
-        if(userType == null)return null;
-        if(fk == null)return null;
+        if(userType == null)return Collections.emptyList();
+        if(fk == null)return Collections.emptyList();
         LambdaQueryWrapper<TbOrder> queryWrapper = new LambdaQueryWrapper<>();
         switch (userType){
             case 1: //边民

+ 0 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderAppController.java

@@ -31,7 +31,6 @@ public class TbOrderAppController {
 
 	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
 	@RequestMapping("getList")
-//		@SaCheckPermission(TbOrder.PERMISSION_CODE)
 	public AjaxJson getList() {
 		SoMap so = SoMap.getRequestSoMap();
 		List<TbOrder> list = tbOrderService.getAPPList(so.startPage());

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsService.java

@@ -112,7 +112,7 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
 				.orderByDesc("release_time")
 				.last("LIMIT " +limit);
 		// 执行查询
-		List<TbPortNews> list = tbPortNewsMapper.selectList(queryWrapper);
+		List<TbPortNews> list = list(queryWrapper);
 		// 将结果列表拷贝至VO列表
 		List<TbPortNewsVo> resList = CglibUtil.copyList(list, TbPortNewsVo::new);
 		// 返回获取的最新口岸资讯

+ 0 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/vo/TbPortNewsVo.java

@@ -55,7 +55,6 @@ public class TbPortNewsVo {
      * 发布时间
      *
      */
-    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date releaseTime;
 
 }

+ 3 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShop.java

@@ -73,8 +73,7 @@ public class TbShop extends Model<TbShop> implements Serializable {
 	/**
 	 * 创建时间 
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
-	private Date createTime;	
+	private Date createTime;
 
 	/**
 	 * 更新者id 
@@ -84,8 +83,7 @@ public class TbShop extends Model<TbShop> implements Serializable {
 	/**
 	 * 更新时间 
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
-	private Date updateTime;	
+	private Date updateTime;
 
 	/**
 	 *  
@@ -133,7 +131,7 @@ public class TbShop extends Model<TbShop> implements Serializable {
 	private String remark;	
 
 	/**
-	 *  
+	 *  入住商家
 	 */
 	private String enterpriseName;	
 

+ 2 - 4
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeArea.java

@@ -73,8 +73,7 @@ public class TbTradeArea extends Model<TbTradeArea> implements Serializable {
 	/**
 	 * 创建时间 
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
-	private Date createTime;	
+	private Date createTime;
 
 	/**
 	 * 创建者id 
@@ -99,8 +98,7 @@ public class TbTradeArea extends Model<TbTradeArea> implements Serializable {
 	/**
 	 * 更新时间 
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
-	private Date updateTime;	
+	private Date updateTime;
 
 	/**
 	 * 删除状态 

+ 11 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaService.java

@@ -4,11 +4,13 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.pj.api.consts.FeignFactory;
+import com.pj.api.dto.DistrictDTO;
+import com.pj.current.satoken.StpUserUtil;
 import com.pj.tb_goods.TbGoods;
 import com.pj.tb_goods.TbGoodsMapper;
 import com.pj.tb_people.TbPeople;
@@ -45,6 +47,9 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 
 	/** 增 */
 	void add(TbTradeArea t){
+		List<DistrictDTO>districtDTOS= FeignFactory.adminInterface.getDistrictList(t.getAddressIds());
+		t.setAddress(districtDTOS.stream().map(DistrictDTO::getDistrict).collect(Collectors.joining()))
+				.setCreateTime(new Date()).setCreateName(StpUserUtil.getPCLoginInfo().getLoginName());
 		save(t);
 	}
 
@@ -55,6 +60,9 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 
 	/** 改 */
 	void update(TbTradeArea t){
+		List<DistrictDTO>districtDTOS= FeignFactory.adminInterface.getDistrictList(t.getAddressIds());
+		t.setAddress(districtDTOS.stream().map(DistrictDTO::getDistrict).collect(Collectors.joining()))
+				.setUpdateTime(new Date()).setUpdateName(StpUserUtil.getPCLoginInfo().getLoginName());
 		updateById(t);
 
 	}

+ 60 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBank.java

@@ -0,0 +1,60 @@
+package com.pj.project.tb_bank;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * Model: tb_bank -- 银行字典表
+ * @author qzyReal 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbBank.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbBank extends Model<TbBank> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_bank";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-bank";	
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+
+	public Long id;	
+
+	/**
+	 * 银行名称 
+	 */
+	public String bankName;	
+
+	/**
+	 * 银行代号 
+	 */
+	public String bankCode;	
+
+
+
+
+
+	
+
+
+}

+ 111 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBankController.java

@@ -0,0 +1,111 @@
+package com.pj.project.tb_bank;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.pj.current.satoken.StpUserUtil;
+import com.pj.project4sp.SP;
+import com.pj.utils.sg.AjaxError;
+import com.pj.utils.sg.AjaxJson;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+
+/**
+ * Controller: tb_bank -- 银行字典表
+ * @author qzyReal 
+ */
+@RestController
+@RequestMapping("/TbBank/")
+public class TbBankController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbBankService tbBankService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbBank.PERMISSION_CODE)
+	@Transactional(rollbackFor = Exception.class)
+	public AjaxJson add(TbBank t){
+		tbBankService.add(t);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbBank.PERMISSION_CODE)
+	public AjaxJson delete(Long id){
+		int line = tbBankService.delete(id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbBank.PERMISSION_CODE)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+		int line = SP.publicMapper.deleteByIds(TbBank.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbBank.PERMISSION_CODE)
+	public AjaxJson update(TbBank t){
+		int line = tbBankService.update(t);
+		return AjaxJson.getByLine(line);
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+	public AjaxJson getById(Long id){
+		TbBank t = tbBankService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbBank> list = tbBankService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
+	@RequestMapping("getAll")
+	public AjaxJson getAll() {
+		List<TbBank> list = tbBankService.list();
+		return AjaxJson.getSuccessData(list);
+	}
+
+	
+	
+	
+	// ------------------------- 前端接口 -------------------------
+	
+	
+	/** 改 - 不传不改 [G] */
+	@RequestMapping("updateByNotNull")
+	public AjaxJson updateByNotNull(Long id){
+		AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
+		// 鉴别身份,是否为数据创建者 
+		long userId = SP.publicMapper.getColumnByIdToLong(TbBank.TABLE_NAME, "user_id", id);
+		AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
+		// 开始修改 (请只保留需要修改的字段)
+		SoMap so = SoMap.getRequestSoMap();
+		so.clearNotIn("id", "bankName", "bankCode").clearNull().humpToLineCase();	
+		int line = SP.publicMapper.updateBySoMapById(TbBank.TABLE_NAME, so, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+	
+	
+	
+	
+
+}

+ 55 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBankMapper.java

@@ -0,0 +1,55 @@
+package com.pj.project.tb_bank;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.pj.utils.so.SoMap;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * Mapper: tb_bank -- 银行字典表
+ * @author qzyReal 
+ */
+
+@Mapper
+@Repository
+public interface TbBankMapper extends BaseMapper <TbBank> {
+
+	/**
+	 * 增  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int add(TbBank t);
+
+	/**
+	 * 删  
+	 * @param id 要删除的数据id  
+	 * @return 受影响行数 
+	 */
+	int delete(Long id);	 
+
+	/** 
+	 * 改  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int update(TbBank t);
+
+	/** 
+	 * 查 - 根据id  
+	 * @param id 要查询的数据id 
+	 * @return 实体对象 
+	 */
+	TbBank getById(Long id);	 
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbBank> getList(SoMap so);
+
+
+}

+ 76 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBankMapper.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.pj.project.tb_bank.TbBankMapper">
+
+	<!-- 增 [G] -->
+	<insert id="add">
+		insert into 
+		tb_bank (id, bank_name, bank_code) 
+		values (#{id}, #{bankName}, #{bankCode}) 
+	</insert>
+
+	<!-- 删 -->
+	<delete id="delete">
+		delete from tb_bank 
+		where id = #{id}
+	</delete>
+
+	<!-- 改 [G] -->
+	<update id="update">
+		update tb_bank set
+		id = #{id}, 
+		bank_name = #{bankName}, 
+		bank_code = #{bankCode}
+		where id = #{id}
+	</update>
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, bank_name, bank_code from tb_bank  -->
+	
+	<!-- 通用映射:手动模式 -->
+	<resultMap id="model" type="com.pj.project.tb_bank.TbBank">
+		<result property="id" column="id" />
+		<result property="bankName" column="bank_name" />
+		<result property="bankCode" column="bank_code" />
+	</resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_bank 
+	</sql>
+	
+	<!-- 查 - 根据id -->
+	<select id="getById" resultMap="model">
+		<include refid="select_sql"></include>
+		where id = #{id}
+	</select>
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.isNotNull("id") '> and id = #{id} </if>
+			<if test=' this.isNotNull("bankName") '> and bank_name = #{bankName} </if>
+			<if test=' this.isNotNull("bankCode") '> and bank_code = #{bankCode} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> bank_name desc </when>
+			<when test='sortType == 3'> bank_code desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 55 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_bank/TbBankService.java

@@ -0,0 +1,55 @@
+package com.pj.project.tb_bank;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * Service: tb_bank -- 银行字典表
+ * @author qzyReal 
+ */
+@Service
+public class TbBankService  extends ServiceImpl <TbBankMapper,TbBank> implements IService<TbBank>  {
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbBankMapper tbBankMapper;
+
+	/** 增 */
+	int add(TbBank t){
+		return tbBankMapper.add(t);
+	}
+
+	/** 删 */
+	int delete(Long id){
+		return tbBankMapper.delete(id);
+	}
+
+	/** 改 */
+	int update(TbBank t){
+		return tbBankMapper.update(t);
+	}
+
+	/** 查 */
+	TbBank getById(Long id){
+		return tbBankMapper.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	public List<TbBank> getList(SoMap so) {
+		return tbBankMapper.getList(so);	
+	}
+
+	public TbBank getByName(String bankName){
+        QueryWrapper<TbBank> ew = new QueryWrapper<>();
+        ew.eq("bank_name", bankName);
+        return getOne(ew);
+    }
+	
+
+}

+ 2 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_district/TbDistrictController.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 
 
@@ -63,6 +64,7 @@ public class TbDistrictController {
             BeanUtils.copyProperties(tbDistrict,districtDTO);
             districtDTOS.add(districtDTO);
         });
+        districtDTOS.sort(Comparator.comparing(DistrictDTO::getLevel));
         return districtDTOS;
     }